path
stringlengths 5
300
| repo_name
stringlengths 6
76
| content
stringlengths 26
1.05M
|
---|---|---|
src/admin/components/Profesori.js | zeljkoX/e-learning | import React from 'react';
import {State, History} from 'react-router';
import { Menu, Mixins, Styles } from 'material-ui';
import Content from '../../components/layout/Content';
import ContentHeader from '../../components/layout/ContentHeader';
import Tabela from '../../components/Tabela';
class Profesori extends React.Component {
displayName: "React-breadcrumbs";
render() {
var menu = [{name:'Dodaj Profesora', link:'profesori/add'}];
return (
<Content>
<ContentHeader title='Naziv stranice' menu={menu}/>
<Tabela/>
</Content>
);
}
}
export default Profesori;
|
fields/types/localfile/LocalFileField.js | stosorio/keystone | import Field from '../Field';
import React from 'react';
import { Button, FormField, FormInput, FormNote } from 'elemental';
module.exports = Field.create({
shouldCollapse () {
return this.props.collapse && !this.hasExisting();
},
fileFieldNode () {
return this.refs.fileField.getDOMNode();
},
changeFile () {
this.refs.fileField.getDOMNode().click();
},
getFileSource () {
if (this.hasLocal()) {
return this.state.localSource;
} else if (this.hasExisting()) {
return this.props.value.url;
} else {
return null;
}
},
getFileURL () {
if (!this.hasLocal() && this.hasExisting()) {
return this.props.value.url;
}
},
undoRemove () {
this.fileFieldNode().value = '';
this.setState({
removeExisting: false,
localSource: null,
origin: false,
action: null
});
},
fileChanged (event) {//eslint-disable-line no-unused-vars
this.setState({
origin: 'local'
});
},
removeFile (e) {
var state = {
localSource: null,
origin: false
};
if (this.hasLocal()) {
this.fileFieldNode().value = '';
} else if (this.hasExisting()) {
state.removeExisting = true;
if (this.props.autoCleanup) {
if (e.altKey) {
state.action = 'reset';
} else {
state.action = 'delete';
}
} else {
if (e.altKey) {
state.action = 'delete';
} else {
state.action = 'reset';
}
}
}
this.setState(state);
},
hasLocal () {
return this.state.origin === 'local';
},
hasFile () {
return this.hasExisting() || this.hasLocal();
},
hasExisting () {
return !!this.props.value.filename;
},
getFilename () {
if (this.hasLocal()) {
return this.fileFieldNode().value.split('\\').pop();
} else {
return this.props.value.filename;
}
},
renderFileDetails (add) {
var values = null;
if (this.hasFile() && !this.state.removeExisting) {
values = (
<div className='file-values'>
<FormInput noedit>{this.getFilename()}</FormInput>
</div>
);
}
return (
<div key={this.props.path + '_details'} className='file-details'>
{values}
{add}
</div>
);
},
renderAlert () {
if (this.hasLocal()) {
return (
<div className="file-values upload-queued">
<FormInput noedit>File selected - save to upload</FormInput>
</div>
);
} else if (this.state.origin === 'cloudinary') {
return (
<div className="file-values select-queued">
<FormInput noedit>File selected from Cloudinary</FormInput>
</div>
);
} else if (this.state.removeExisting) {
return (
<div className="file-values delete-queued">
<FormInput noedit>File {this.props.autoCleanup ? 'deleted' : 'removed'} - save to confirm</FormInput>
</div>
);
} else {
return null;
}
},
renderClearButton () {
if (this.state.removeExisting) {
return (
<Button type="link" onClick={this.undoRemove}>
Undo Remove
</Button>
);
} else {
var clearText;
if (this.hasLocal()) {
clearText = 'Cancel Upload';
} else {
clearText = (this.props.autoCleanup ? 'Delete File' : 'Remove File');
}
return (
<Button type="link-cancel" onClick={this.removeFile}>
{clearText}
</Button>
);
}
},
renderFileField () {
if (!this.shouldRenderField()) return null;
return <input ref="fileField" type="file" name={this.props.paths.upload} className="field-upload" onChange={this.fileChanged} tabIndex="-1" />;
},
renderFileAction () {
if (!this.shouldRenderField()) return null;
return <input type="hidden" name={this.props.paths.action} className="field-action" value={this.state.action} />;
},
renderFileToolbar () {
return (
<div key={this.props.path + '_toolbar'} className='file-toolbar'>
<div className='u-float-left'>
<Button onClick={this.changeFile}>
{this.hasFile() ? 'Change' : 'Upload'} File
</Button>
{this.hasFile() && this.renderClearButton()}
</div>
</div>
);
},
renderNote () {
if (!this.props.note) return null;
return <FormNote note={this.props.note} />;
},
renderUI () {
var container = [];
var body = [];
var hasFile = this.hasFile();
if (this.shouldRenderField()) {
if (hasFile) {
container.push(this.renderFileDetails(this.renderAlert()));
}
body.push(this.renderFileToolbar());
} else {
if (hasFile) {
container.push(this.renderFileDetails());
} else {
container.push(<FormInput noedit>no file</FormInput>);
}
}
return (
<FormField label={this.props.label} className="field-type-localfile">
{this.renderFileField()}
{this.renderFileAction()}
<div className="file-container">{container}</div>
{body}
{this.renderNote()}
</FormField>
);
}
});
|
src/icons/font/NoteIcon.js | skystebnicki/chamel | import React from 'react';
import PropTypes from 'prop-types';
import FontIcon from '../../FontIcon';
import ThemeService from '../../styles/ChamelThemeService';
/**
* Note button
*
* @param props
* @param context
* @returns {ReactDOM}
* @constructor
*/
const NoteIcon = (props, context) => {
let theme =
context.chamelTheme && context.chamelTheme.fontIcon
? context.chamelTheme.fontIcon
: ThemeService.defaultTheme.fontIcon;
return (
<FontIcon {...props} className={theme.iconNote}>
{'note'}
</FontIcon>
);
};
/**
* An alternate theme may be passed down by a provider
*/
NoteIcon.contextTypes = {
chamelTheme: PropTypes.object,
};
export default NoteIcon;
|
node_modules/karma/node_modules/socket.io/node_modules/socket.io-client/node_modules/uglify-js/tmp/app.js | prashant-andani/detectbrowser.github.io | /* Modernizr 2.0.6 (Custom Build) | MIT & BSD
* Build: http://www.modernizr.com/download/#-iepp
*/
;window.Modernizr=function(a,b,c){function w(a,b){return!!~(""+a).indexOf(b)}function v(a,b){return typeof a===b}function u(a,b){return t(prefixes.join(a+";")+(b||""))}function t(a){j.cssText=a}var d="2.0.6",e={},f=b.documentElement,g=b.head||b.getElementsByTagName("head")[0],h="modernizr",i=b.createElement(h),j=i.style,k,l=Object.prototype.toString,m={},n={},o={},p=[],q,r={}.hasOwnProperty,s;!v(r,c)&&!v(r.call,c)?s=function(a,b){return r.call(a,b)}:s=function(a,b){return b in a&&v(a.constructor.prototype[b],c)};for(var x in m)s(m,x)&&(q=x.toLowerCase(),e[q]=m[x](),p.push((e[q]?"":"no-")+q));t(""),i=k=null,a.attachEvent&&function(){var a=b.createElement("div");a.innerHTML="<elem></elem>";return a.childNodes.length!==1}()&&function(a,b){function s(a){var b=-1;while(++b<g)a.createElement(f[b])}a.iepp=a.iepp||{};var d=a.iepp,e=d.html5elements||"abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",f=e.split("|"),g=f.length,h=new RegExp("(^|\\s)("+e+")","gi"),i=new RegExp("<(/*)("+e+")","gi"),j=/^\s*[\{\}]\s*$/,k=new RegExp("(^|[^\\n]*?\\s)("+e+")([^\\n]*)({[\\n\\w\\W]*?})","gi"),l=b.createDocumentFragment(),m=b.documentElement,n=m.firstChild,o=b.createElement("body"),p=b.createElement("style"),q=/print|all/,r;d.getCSS=function(a,b){if(a+""===c)return"";var e=-1,f=a.length,g,h=[];while(++e<f){g=a[e];if(g.disabled)continue;b=g.media||b,q.test(b)&&h.push(d.getCSS(g.imports,b),g.cssText),b="all"}return h.join("")},d.parseCSS=function(a){var b=[],c;while((c=k.exec(a))!=null)b.push(((j.exec(c[1])?"\n":c[1])+c[2]+c[3]).replace(h,"$1.iepp_$2")+c[4]);return b.join("\n")},d.writeHTML=function(){var a=-1;r=r||b.body;while(++a<g){var c=b.getElementsByTagName(f[a]),d=c.length,e=-1;while(++e<d)c[e].className.indexOf("iepp_")<0&&(c[e].className+=" iepp_"+f[a])}l.appendChild(r),m.appendChild(o),o.className=r.className,o.id=r.id,o.innerHTML=r.innerHTML.replace(i,"<$1font")},d._beforePrint=function(){p.styleSheet.cssText=d.parseCSS(d.getCSS(b.styleSheets,"all")),d.writeHTML()},d.restoreHTML=function(){o.innerHTML="",m.removeChild(o),m.appendChild(r)},d._afterPrint=function(){d.restoreHTML(),p.styleSheet.cssText=""},s(b),s(l);d.disablePP||(n.insertBefore(p,n.firstChild),p.media="print",p.className="iepp-printshim",a.attachEvent("onbeforeprint",d._beforePrint),a.attachEvent("onafterprint",d._afterPrint))}(a,b),e._version=d;return e}(this,this.document);
(function (con) {
// the dummy function
function dummy() {};
// console methods that may exist
for(var methods = "assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(','), func; func = methods.pop();) {
con[func] = con[func] || dummy;
}
}(window.console = window.console || {}));
// we do this crazy little dance so that the `console` object
// inside the function is a name that can be shortened to a single
// letter by the compressor to make the compressed script as tiny
// as possible.
/*!
* jQuery JavaScript Library v1.6.3
* http://jquery.com/
*
* Copyright 2011, John Resig
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* Includes Sizzle.js
* http://sizzlejs.com/
* Copyright 2011, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
*
* Date: Wed Aug 31 10:35:15 2011 -0400
*/
(function( window, undefined ) {
// Use the correct document accordingly with window argument (sandbox)
var document = window.document,
navigator = window.navigator,
location = window.location;
var jQuery = (function() {
// Define a local copy of jQuery
var jQuery = function( selector, context ) {
// The jQuery object is actually just the init constructor 'enhanced'
return new jQuery.fn.init( selector, context, rootjQuery );
},
// Map over jQuery in case of overwrite
_jQuery = window.jQuery,
// Map over the $ in case of overwrite
_$ = window.$,
// A central reference to the root jQuery(document)
rootjQuery,
// A simple way to check for HTML strings or ID strings
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,
// Check if a string has a non-whitespace character in it
rnotwhite = /\S/,
// Used for trimming whitespace
trimLeft = /^\s+/,
trimRight = /\s+$/,
// Check for digits
rdigit = /\d/,
// Match a standalone tag
rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
// JSON RegExp
rvalidchars = /^[\],:{}\s]*$/,
rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
// Useragent RegExp
rwebkit = /(webkit)[ \/]([\w.]+)/,
ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
rmsie = /(msie) ([\w.]+)/,
rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
// Matches dashed string for camelizing
rdashAlpha = /-([a-z]|[0-9])/ig,
rmsPrefix = /^-ms-/,
// Used by jQuery.camelCase as callback to replace()
fcamelCase = function( all, letter ) {
return ( letter + "" ).toUpperCase();
},
// Keep a UserAgent string for use with jQuery.browser
userAgent = navigator.userAgent,
// For matching the engine and version of the browser
browserMatch,
// The deferred used on DOM ready
readyList,
// The ready event handler
DOMContentLoaded,
// Save a reference to some core methods
toString = Object.prototype.toString,
hasOwn = Object.prototype.hasOwnProperty,
push = Array.prototype.push,
slice = Array.prototype.slice,
trim = String.prototype.trim,
indexOf = Array.prototype.indexOf,
// [[Class]] -> type pairs
class2type = {};
jQuery.fn = jQuery.prototype = {
constructor: jQuery,
init: function( selector, context, rootjQuery ) {
var match, elem, ret, doc;
// Handle $(""), $(null), or $(undefined)
if ( !selector ) {
return this;
}
// Handle $(DOMElement)
if ( selector.nodeType ) {
this.context = this[0] = selector;
this.length = 1;
return this;
}
// The body element only exists once, optimize finding it
if ( selector === "body" && !context && document.body ) {
this.context = document;
this[0] = document.body;
this.selector = selector;
this.length = 1;
return this;
}
// Handle HTML strings
if ( typeof selector === "string" ) {
// Are we dealing with HTML string or an ID?
if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
// Assume that strings that start and end with <> are HTML and skip the regex check
match = [ null, selector, null ];
} else {
match = quickExpr.exec( selector );
}
// Verify a match, and that no context was specified for #id
if ( match && (match[1] || !context) ) {
// HANDLE: $(html) -> $(array)
if ( match[1] ) {
context = context instanceof jQuery ? context[0] : context;
doc = (context ? context.ownerDocument || context : document);
// If a single string is passed in and it's a single tag
// just do a createElement and skip the rest
ret = rsingleTag.exec( selector );
if ( ret ) {
if ( jQuery.isPlainObject( context ) ) {
selector = [ document.createElement( ret[1] ) ];
jQuery.fn.attr.call( selector, context, true );
} else {
selector = [ doc.createElement( ret[1] ) ];
}
} else {
ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
selector = (ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment).childNodes;
}
return jQuery.merge( this, selector );
// HANDLE: $("#id")
} else {
elem = document.getElementById( match[2] );
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
if ( elem && elem.parentNode ) {
// Handle the case where IE and Opera return items
// by name instead of ID
if ( elem.id !== match[2] ) {
return rootjQuery.find( selector );
}
// Otherwise, we inject the element directly into the jQuery object
this.length = 1;
this[0] = elem;
}
this.context = document;
this.selector = selector;
return this;
}
// HANDLE: $(expr, $(...))
} else if ( !context || context.jquery ) {
return (context || rootjQuery).find( selector );
// HANDLE: $(expr, context)
// (which is just equivalent to: $(context).find(expr)
} else {
return this.constructor( context ).find( selector );
}
// HANDLE: $(function)
// Shortcut for document ready
} else if ( jQuery.isFunction( selector ) ) {
return rootjQuery.ready( selector );
}
if (selector.selector !== undefined) {
this.selector = selector.selector;
this.context = selector.context;
}
return jQuery.makeArray( selector, this );
},
// Start with an empty selector
selector: "",
// The current version of jQuery being used
jquery: "1.6.3",
// The default length of a jQuery object is 0
length: 0,
// The number of elements contained in the matched element set
size: function() {
return this.length;
},
toArray: function() {
return slice.call( this, 0 );
},
// Get the Nth element in the matched element set OR
// Get the whole matched element set as a clean array
get: function( num ) {
return num == null ?
// Return a 'clean' array
this.toArray() :
// Return just the object
( num < 0 ? this[ this.length + num ] : this[ num ] );
},
// Take an array of elements and push it onto the stack
// (returning the new matched element set)
pushStack: function( elems, name, selector ) {
// Build a new jQuery matched element set
var ret = this.constructor();
if ( jQuery.isArray( elems ) ) {
push.apply( ret, elems );
} else {
jQuery.merge( ret, elems );
}
// Add the old object onto the stack (as a reference)
ret.prevObject = this;
ret.context = this.context;
if ( name === "find" ) {
ret.selector = this.selector + (this.selector ? " " : "") + selector;
} else if ( name ) {
ret.selector = this.selector + "." + name + "(" + selector + ")";
}
// Return the newly-formed element set
return ret;
},
// Execute a callback for every element in the matched set.
// (You can seed the arguments with an array of args, but this is
// only used internally.)
each: function( callback, args ) {
return jQuery.each( this, callback, args );
},
ready: function( fn ) {
// Attach the listeners
jQuery.bindReady();
// Add the callback
readyList.done( fn );
return this;
},
eq: function( i ) {
return i === -1 ?
this.slice( i ) :
this.slice( i, +i + 1 );
},
first: function() {
return this.eq( 0 );
},
last: function() {
return this.eq( -1 );
},
slice: function() {
return this.pushStack( slice.apply( this, arguments ),
"slice", slice.call(arguments).join(",") );
},
map: function( callback ) {
return this.pushStack( jQuery.map(this, function( elem, i ) {
return callback.call( elem, i, elem );
}));
},
end: function() {
return this.prevObject || this.constructor(null);
},
// For internal use only.
// Behaves like an Array's method, not like a jQuery method.
push: push,
sort: [].sort,
splice: [].splice
};
// Give the init function the jQuery prototype for later instantiation
jQuery.fn.init.prototype = jQuery.fn;
jQuery.extend = jQuery.fn.extend = function() {
var options, name, src, copy, copyIsArray, clone,
target = arguments[0] || {},
i = 1,
length = arguments.length,
deep = false;
// Handle a deep copy situation
if ( typeof target === "boolean" ) {
deep = target;
target = arguments[1] || {};
// skip the boolean and the target
i = 2;
}
// Handle case when target is a string or something (possible in deep copy)
if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
target = {};
}
// extend jQuery itself if only one argument is passed
if ( length === i ) {
target = this;
--i;
}
for ( ; i < length; i++ ) {
// Only deal with non-null/undefined values
if ( (options = arguments[ i ]) != null ) {
// Extend the base object
for ( name in options ) {
src = target[ name ];
copy = options[ name ];
// Prevent never-ending loop
if ( target === copy ) {
continue;
}
// Recurse if we're merging plain objects or arrays
if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
if ( copyIsArray ) {
copyIsArray = false;
clone = src && jQuery.isArray(src) ? src : [];
} else {
clone = src && jQuery.isPlainObject(src) ? src : {};
}
// Never move original objects, clone them
target[ name ] = jQuery.extend( deep, clone, copy );
// Don't bring in undefined values
} else if ( copy !== undefined ) {
target[ name ] = copy;
}
}
}
}
// Return the modified object
return target;
};
jQuery.extend({
noConflict: function( deep ) {
if ( window.$ === jQuery ) {
window.$ = _$;
}
if ( deep && window.jQuery === jQuery ) {
window.jQuery = _jQuery;
}
return jQuery;
},
// Is the DOM ready to be used? Set to true once it occurs.
isReady: false,
// A counter to track how many items to wait for before
// the ready event fires. See #6781
readyWait: 1,
// Hold (or release) the ready event
holdReady: function( hold ) {
if ( hold ) {
jQuery.readyWait++;
} else {
jQuery.ready( true );
}
},
// Handle when the DOM is ready
ready: function( wait ) {
// Either a released hold or an DOMready/load event and not yet ready
if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) {
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
if ( !document.body ) {
return setTimeout( jQuery.ready, 1 );
}
// Remember that the DOM is ready
jQuery.isReady = true;
// If a normal DOM Ready event fired, decrement, and wait if need be
if ( wait !== true && --jQuery.readyWait > 0 ) {
return;
}
// If there are functions bound, to execute
readyList.resolveWith( document, [ jQuery ] );
// Trigger any bound ready events
if ( jQuery.fn.trigger ) {
jQuery( document ).trigger( "ready" ).unbind( "ready" );
}
}
},
bindReady: function() {
if ( readyList ) {
return;
}
readyList = jQuery._Deferred();
// Catch cases where $(document).ready() is called after the
// browser event has already occurred.
if ( document.readyState === "complete" ) {
// Handle it asynchronously to allow scripts the opportunity to delay ready
return setTimeout( jQuery.ready, 1 );
}
// Mozilla, Opera and webkit nightlies currently support this event
if ( document.addEventListener ) {
// Use the handy event callback
document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
// A fallback to window.onload, that will always work
window.addEventListener( "load", jQuery.ready, false );
// If IE event model is used
} else if ( document.attachEvent ) {
// ensure firing before onload,
// maybe late but safe also for iframes
document.attachEvent( "onreadystatechange", DOMContentLoaded );
// A fallback to window.onload, that will always work
window.attachEvent( "onload", jQuery.ready );
// If IE and not a frame
// continually check to see if the document is ready
var toplevel = false;
try {
toplevel = window.frameElement == null;
} catch(e) {}
if ( document.documentElement.doScroll && toplevel ) {
doScrollCheck();
}
}
},
// See test/unit/core.js for details concerning isFunction.
// Since version 1.3, DOM methods and functions like alert
// aren't supported. They return false on IE (#2968).
isFunction: function( obj ) {
return jQuery.type(obj) === "function";
},
isArray: Array.isArray || function( obj ) {
return jQuery.type(obj) === "array";
},
// A crude way of determining if an object is a window
isWindow: function( obj ) {
return obj && typeof obj === "object" && "setInterval" in obj;
},
isNaN: function( obj ) {
return obj == null || !rdigit.test( obj ) || isNaN( obj );
},
type: function( obj ) {
return obj == null ?
String( obj ) :
class2type[ toString.call(obj) ] || "object";
},
isPlainObject: function( obj ) {
// Must be an Object.
// Because of IE, we also have to check the presence of the constructor property.
// Make sure that DOM nodes and window objects don't pass through, as well
if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
return false;
}
try {
// Not own constructor property must be Object
if ( obj.constructor &&
!hasOwn.call(obj, "constructor") &&
!hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
return false;
}
} catch ( e ) {
// IE8,9 Will throw exceptions on certain host objects #9897
return false;
}
// Own properties are enumerated firstly, so to speed up,
// if last one is own, then all properties are own.
var key;
for ( key in obj ) {}
return key === undefined || hasOwn.call( obj, key );
},
isEmptyObject: function( obj ) {
for ( var name in obj ) {
return false;
}
return true;
},
error: function( msg ) {
throw msg;
},
parseJSON: function( data ) {
if ( typeof data !== "string" || !data ) {
return null;
}
// Make sure leading/trailing whitespace is removed (IE can't handle it)
data = jQuery.trim( data );
// Attempt to parse using the native JSON parser first
if ( window.JSON && window.JSON.parse ) {
return window.JSON.parse( data );
}
// Make sure the incoming data is actual JSON
// Logic borrowed from http://json.org/json2.js
if ( rvalidchars.test( data.replace( rvalidescape, "@" )
.replace( rvalidtokens, "]" )
.replace( rvalidbraces, "")) ) {
return (new Function( "return " + data ))();
}
jQuery.error( "Invalid JSON: " + data );
},
// Cross-browser xml parsing
parseXML: function( data ) {
var xml, tmp;
try {
if ( window.DOMParser ) { // Standard
tmp = new DOMParser();
xml = tmp.parseFromString( data , "text/xml" );
} else { // IE
xml = new ActiveXObject( "Microsoft.XMLDOM" );
xml.async = "false";
xml.loadXML( data );
}
} catch( e ) {
xml = undefined;
}
if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
jQuery.error( "Invalid XML: " + data );
}
return xml;
},
noop: function() {},
// Evaluates a script in a global context
// Workarounds based on findings by Jim Driscoll
// http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
globalEval: function( data ) {
if ( data && rnotwhite.test( data ) ) {
// We use execScript on Internet Explorer
// We use an anonymous function so that context is window
// rather than jQuery in Firefox
( window.execScript || function( data ) {
window[ "eval" ].call( window, data );
} )( data );
}
},
// Convert dashed to camelCase; used by the css and data modules
// Microsoft forgot to hump their vendor prefix (#9572)
camelCase: function( string ) {
return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
},
nodeName: function( elem, name ) {
return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
},
// args is for internal usage only
each: function( object, callback, args ) {
var name, i = 0,
length = object.length,
isObj = length === undefined || jQuery.isFunction( object );
if ( args ) {
if ( isObj ) {
for ( name in object ) {
if ( callback.apply( object[ name ], args ) === false ) {
break;
}
}
} else {
for ( ; i < length; ) {
if ( callback.apply( object[ i++ ], args ) === false ) {
break;
}
}
}
// A special, fast, case for the most common use of each
} else {
if ( isObj ) {
for ( name in object ) {
if ( callback.call( object[ name ], name, object[ name ] ) === false ) {
break;
}
}
} else {
for ( ; i < length; ) {
if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) {
break;
}
}
}
}
return object;
},
// Use native String.trim function wherever possible
trim: trim ?
function( text ) {
return text == null ?
"" :
trim.call( text );
} :
// Otherwise use our own trimming functionality
function( text ) {
return text == null ?
"" :
text.toString().replace( trimLeft, "" ).replace( trimRight, "" );
},
// results is for internal usage only
makeArray: function( array, results ) {
var ret = results || [];
if ( array != null ) {
// The window, strings (and functions) also have 'length'
// The extra typeof function check is to prevent crashes
// in Safari 2 (See: #3039)
// Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
var type = jQuery.type( array );
if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) {
push.call( ret, array );
} else {
jQuery.merge( ret, array );
}
}
return ret;
},
inArray: function( elem, array ) {
if ( !array ) {
return -1;
}
if ( indexOf ) {
return indexOf.call( array, elem );
}
for ( var i = 0, length = array.length; i < length; i++ ) {
if ( array[ i ] === elem ) {
return i;
}
}
return -1;
},
merge: function( first, second ) {
var i = first.length,
j = 0;
if ( typeof second.length === "number" ) {
for ( var l = second.length; j < l; j++ ) {
first[ i++ ] = second[ j ];
}
} else {
while ( second[j] !== undefined ) {
first[ i++ ] = second[ j++ ];
}
}
first.length = i;
return first;
},
grep: function( elems, callback, inv ) {
var ret = [], retVal;
inv = !!inv;
// Go through the array, only saving the items
// that pass the validator function
for ( var i = 0, length = elems.length; i < length; i++ ) {
retVal = !!callback( elems[ i ], i );
if ( inv !== retVal ) {
ret.push( elems[ i ] );
}
}
return ret;
},
// arg is for internal usage only
map: function( elems, callback, arg ) {
var value, key, ret = [],
i = 0,
length = elems.length,
// jquery objects are treated as arrays
isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ;
// Go through the array, translating each of the items to their
if ( isArray ) {
for ( ; i < length; i++ ) {
value = callback( elems[ i ], i, arg );
if ( value != null ) {
ret[ ret.length ] = value;
}
}
// Go through every key on the object,
} else {
for ( key in elems ) {
value = callback( elems[ key ], key, arg );
if ( value != null ) {
ret[ ret.length ] = value;
}
}
}
// Flatten any nested arrays
return ret.concat.apply( [], ret );
},
// A global GUID counter for objects
guid: 1,
// Bind a function to a context, optionally partially applying any
// arguments.
proxy: function( fn, context ) {
if ( typeof context === "string" ) {
var tmp = fn[ context ];
context = fn;
fn = tmp;
}
// Quick check to determine if target is callable, in the spec
// this throws a TypeError, but we will just return undefined.
if ( !jQuery.isFunction( fn ) ) {
return undefined;
}
// Simulated bind
var args = slice.call( arguments, 2 ),
proxy = function() {
return fn.apply( context, args.concat( slice.call( arguments ) ) );
};
// Set the guid of unique handler to the same of original handler, so it can be removed
proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
return proxy;
},
// Mutifunctional method to get and set values to a collection
// The value/s can optionally be executed if it's a function
access: function( elems, key, value, exec, fn, pass ) {
var length = elems.length;
// Setting many attributes
if ( typeof key === "object" ) {
for ( var k in key ) {
jQuery.access( elems, k, key[k], exec, fn, value );
}
return elems;
}
// Setting one attribute
if ( value !== undefined ) {
// Optionally, function values get executed if exec is true
exec = !pass && exec && jQuery.isFunction(value);
for ( var i = 0; i < length; i++ ) {
fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
}
return elems;
}
// Getting an attribute
return length ? fn( elems[0], key ) : undefined;
},
now: function() {
return (new Date()).getTime();
},
// Use of jQuery.browser is frowned upon.
// More details: http://docs.jquery.com/Utilities/jQuery.browser
uaMatch: function( ua ) {
ua = ua.toLowerCase();
var match = rwebkit.exec( ua ) ||
ropera.exec( ua ) ||
rmsie.exec( ua ) ||
ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||
[];
return { browser: match[1] || "", version: match[2] || "0" };
},
sub: function() {
function jQuerySub( selector, context ) {
return new jQuerySub.fn.init( selector, context );
}
jQuery.extend( true, jQuerySub, this );
jQuerySub.superclass = this;
jQuerySub.fn = jQuerySub.prototype = this();
jQuerySub.fn.constructor = jQuerySub;
jQuerySub.sub = this.sub;
jQuerySub.fn.init = function init( selector, context ) {
if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
context = jQuerySub( context );
}
return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
};
jQuerySub.fn.init.prototype = jQuerySub.fn;
var rootjQuerySub = jQuerySub(document);
return jQuerySub;
},
browser: {}
});
// Populate the class2type map
jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
class2type[ "[object " + name + "]" ] = name.toLowerCase();
});
browserMatch = jQuery.uaMatch( userAgent );
if ( browserMatch.browser ) {
jQuery.browser[ browserMatch.browser ] = true;
jQuery.browser.version = browserMatch.version;
}
// Deprecated, use jQuery.browser.webkit instead
if ( jQuery.browser.webkit ) {
jQuery.browser.safari = true;
}
// IE doesn't match non-breaking spaces with \s
if ( rnotwhite.test( "\xA0" ) ) {
trimLeft = /^[\s\xA0]+/;
trimRight = /[\s\xA0]+$/;
}
// All jQuery objects should point back to these
rootjQuery = jQuery(document);
// Cleanup functions for the document ready method
if ( document.addEventListener ) {
DOMContentLoaded = function() {
document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
jQuery.ready();
};
} else if ( document.attachEvent ) {
DOMContentLoaded = function() {
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
if ( document.readyState === "complete" ) {
document.detachEvent( "onreadystatechange", DOMContentLoaded );
jQuery.ready();
}
};
}
// The DOM ready check for Internet Explorer
function doScrollCheck() {
if ( jQuery.isReady ) {
return;
}
try {
// If IE is used, use the trick by Diego Perini
// http://javascript.nwbox.com/IEContentLoaded/
document.documentElement.doScroll("left");
} catch(e) {
setTimeout( doScrollCheck, 1 );
return;
}
// and execute any waiting functions
jQuery.ready();
}
return jQuery;
})();
var // Promise methods
promiseMethods = "done fail isResolved isRejected promise then always pipe".split( " " ),
// Static reference to slice
sliceDeferred = [].slice;
jQuery.extend({
// Create a simple deferred (one callbacks list)
_Deferred: function() {
var // callbacks list
callbacks = [],
// stored [ context , args ]
fired,
// to avoid firing when already doing so
firing,
// flag to know if the deferred has been cancelled
cancelled,
// the deferred itself
deferred = {
// done( f1, f2, ...)
done: function() {
if ( !cancelled ) {
var args = arguments,
i,
length,
elem,
type,
_fired;
if ( fired ) {
_fired = fired;
fired = 0;
}
for ( i = 0, length = args.length; i < length; i++ ) {
elem = args[ i ];
type = jQuery.type( elem );
if ( type === "array" ) {
deferred.done.apply( deferred, elem );
} else if ( type === "function" ) {
callbacks.push( elem );
}
}
if ( _fired ) {
deferred.resolveWith( _fired[ 0 ], _fired[ 1 ] );
}
}
return this;
},
// resolve with given context and args
resolveWith: function( context, args ) {
if ( !cancelled && !fired && !firing ) {
// make sure args are available (#8421)
args = args || [];
firing = 1;
try {
while( callbacks[ 0 ] ) {
callbacks.shift().apply( context, args );
}
}
finally {
fired = [ context, args ];
firing = 0;
}
}
return this;
},
// resolve with this as context and given arguments
resolve: function() {
deferred.resolveWith( this, arguments );
return this;
},
// Has this deferred been resolved?
isResolved: function() {
return !!( firing || fired );
},
// Cancel
cancel: function() {
cancelled = 1;
callbacks = [];
return this;
}
};
return deferred;
},
// Full fledged deferred (two callbacks list)
Deferred: function( func ) {
var deferred = jQuery._Deferred(),
failDeferred = jQuery._Deferred(),
promise;
// Add errorDeferred methods, then and promise
jQuery.extend( deferred, {
then: function( doneCallbacks, failCallbacks ) {
deferred.done( doneCallbacks ).fail( failCallbacks );
return this;
},
always: function() {
return deferred.done.apply( deferred, arguments ).fail.apply( this, arguments );
},
fail: failDeferred.done,
rejectWith: failDeferred.resolveWith,
reject: failDeferred.resolve,
isRejected: failDeferred.isResolved,
pipe: function( fnDone, fnFail ) {
return jQuery.Deferred(function( newDefer ) {
jQuery.each( {
done: [ fnDone, "resolve" ],
fail: [ fnFail, "reject" ]
}, function( handler, data ) {
var fn = data[ 0 ],
action = data[ 1 ],
returned;
if ( jQuery.isFunction( fn ) ) {
deferred[ handler ](function() {
returned = fn.apply( this, arguments );
if ( returned && jQuery.isFunction( returned.promise ) ) {
returned.promise().then( newDefer.resolve, newDefer.reject );
} else {
newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] );
}
});
} else {
deferred[ handler ]( newDefer[ action ] );
}
});
}).promise();
},
// Get a promise for this deferred
// If obj is provided, the promise aspect is added to the object
promise: function( obj ) {
if ( obj == null ) {
if ( promise ) {
return promise;
}
promise = obj = {};
}
var i = promiseMethods.length;
while( i-- ) {
obj[ promiseMethods[i] ] = deferred[ promiseMethods[i] ];
}
return obj;
}
});
// Make sure only one callback list will be used
deferred.done( failDeferred.cancel ).fail( deferred.cancel );
// Unexpose cancel
delete deferred.cancel;
// Call given func if any
if ( func ) {
func.call( deferred, deferred );
}
return deferred;
},
// Deferred helper
when: function( firstParam ) {
var args = arguments,
i = 0,
length = args.length,
count = length,
deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ?
firstParam :
jQuery.Deferred();
function resolveFunc( i ) {
return function( value ) {
args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;
if ( !( --count ) ) {
// Strange bug in FF4:
// Values changed onto the arguments object sometimes end up as undefined values
// outside the $.when method. Cloning the object into a fresh array solves the issue
deferred.resolveWith( deferred, sliceDeferred.call( args, 0 ) );
}
};
}
if ( length > 1 ) {
for( ; i < length; i++ ) {
if ( args[ i ] && jQuery.isFunction( args[ i ].promise ) ) {
args[ i ].promise().then( resolveFunc(i), deferred.reject );
} else {
--count;
}
}
if ( !count ) {
deferred.resolveWith( deferred, args );
}
} else if ( deferred !== firstParam ) {
deferred.resolveWith( deferred, length ? [ firstParam ] : [] );
}
return deferred.promise();
}
});
jQuery.support = (function() {
var div = document.createElement( "div" ),
documentElement = document.documentElement,
all,
a,
select,
opt,
input,
marginDiv,
support,
fragment,
body,
testElementParent,
testElement,
testElementStyle,
tds,
events,
eventName,
i,
isSupported;
// Preliminary tests
div.setAttribute("className", "t");
div.innerHTML = " <link><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type=checkbox>";
all = div.getElementsByTagName( "*" );
a = div.getElementsByTagName( "a" )[ 0 ];
// Can't get basic test support
if ( !all || !all.length || !a ) {
return {};
}
// First batch of supports tests
select = document.createElement( "select" );
opt = select.appendChild( document.createElement("option") );
input = div.getElementsByTagName( "input" )[ 0 ];
support = {
// IE strips leading whitespace when .innerHTML is used
leadingWhitespace: ( div.firstChild.nodeType === 3 ),
// Make sure that tbody elements aren't automatically inserted
// IE will insert them into empty tables
tbody: !div.getElementsByTagName( "tbody" ).length,
// Make sure that link elements get serialized correctly by innerHTML
// This requires a wrapper element in IE
htmlSerialize: !!div.getElementsByTagName( "link" ).length,
// Get the style information from getAttribute
// (IE uses .cssText instead)
style: /top/.test( a.getAttribute("style") ),
// Make sure that URLs aren't manipulated
// (IE normalizes it by default)
hrefNormalized: ( a.getAttribute( "href" ) === "/a" ),
// Make sure that element opacity exists
// (IE uses filter instead)
// Use a regex to work around a WebKit issue. See #5145
opacity: /^0.55$/.test( a.style.opacity ),
// Verify style float existence
// (IE uses styleFloat instead of cssFloat)
cssFloat: !!a.style.cssFloat,
// Make sure that if no value is specified for a checkbox
// that it defaults to "on".
// (WebKit defaults to "" instead)
checkOn: ( input.value === "on" ),
// Make sure that a selected-by-default option has a working selected property.
// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
optSelected: opt.selected,
// Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
getSetAttribute: div.className !== "t",
// Will be defined later
submitBubbles: true,
changeBubbles: true,
focusinBubbles: false,
deleteExpando: true,
noCloneEvent: true,
inlineBlockNeedsLayout: false,
shrinkWrapBlocks: false,
reliableMarginRight: 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;
// Test to see if it's possible to delete an expando from an element
// Fails in Internet Explorer
try {
delete div.test;
} catch( e ) {
support.deleteExpando = false;
}
if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
div.attachEvent( "onclick", function() {
// Cloning a node shouldn't copy over any
// bound event handlers (IE does this)
support.noCloneEvent = false;
});
div.cloneNode( true ).fireEvent( "onclick" );
}
// Check if a radio maintains it's value
// after being appended to the DOM
input = document.createElement("input");
input.value = "t";
input.setAttribute("type", "radio");
support.radioValue = input.value === "t";
input.setAttribute("checked", "checked");
div.appendChild( input );
fragment = document.createDocumentFragment();
fragment.appendChild( div.firstChild );
// WebKit doesn't clone checked state correctly in fragments
support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
div.innerHTML = "";
// Figure out if the W3C box model works as expected
div.style.width = div.style.paddingLeft = "1px";
body = document.getElementsByTagName( "body" )[ 0 ];
// We use our own, invisible, body unless the body is already present
// in which case we use a div (#9239)
testElement = document.createElement( body ? "div" : "body" );
testElementStyle = {
visibility: "hidden",
width: 0,
height: 0,
border: 0,
margin: 0,
background: "none"
};
if ( body ) {
jQuery.extend( testElementStyle, {
position: "absolute",
left: "-1000px",
top: "-1000px"
});
}
for ( i in testElementStyle ) {
testElement.style[ i ] = testElementStyle[ i ];
}
testElement.appendChild( div );
testElementParent = body || documentElement;
testElementParent.insertBefore( testElement, testElementParent.firstChild );
// Check if a disconnected checkbox will retain its checked
// value of true after appended to the DOM (IE6/7)
support.appendChecked = input.checked;
support.boxModel = div.offsetWidth === 2;
if ( "zoom" in div.style ) {
// Check if natively block-level elements act like inline-block
// elements when setting their display to 'inline' and giving
// them layout
// (IE < 8 does this)
div.style.display = "inline";
div.style.zoom = 1;
support.inlineBlockNeedsLayout = ( div.offsetWidth === 2 );
// Check if elements with layout shrink-wrap their children
// (IE 6 does this)
div.style.display = "";
div.innerHTML = "<div style='width:4px;'></div>";
support.shrinkWrapBlocks = ( div.offsetWidth !== 2 );
}
div.innerHTML = "<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";
tds = div.getElementsByTagName( "td" );
// Check if table cells still have offsetWidth/Height when they are set
// to display:none and there are still other visible table cells in a
// table row; if so, offsetWidth/Height are not reliable for use when
// determining if an element has been hidden directly using
// display:none (it is still safe to use offsets if a parent element is
// hidden; don safety goggles and see bug #4512 for more information).
// (only IE 8 fails this test)
isSupported = ( tds[ 0 ].offsetHeight === 0 );
tds[ 0 ].style.display = "";
tds[ 1 ].style.display = "none";
// Check if empty table cells still have offsetWidth/Height
// (IE < 8 fail this test)
support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
div.innerHTML = "";
// Check if div with explicit width and no margin-right incorrectly
// gets computed margin-right based on width of container. For more
// info see bug #3333
// Fails in WebKit before Feb 2011 nightlies
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
if ( document.defaultView && document.defaultView.getComputedStyle ) {
marginDiv = document.createElement( "div" );
marginDiv.style.width = "0";
marginDiv.style.marginRight = "0";
div.appendChild( marginDiv );
support.reliableMarginRight =
( parseInt( ( document.defaultView.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0;
}
// Remove the body element we added
testElement.innerHTML = "";
testElementParent.removeChild( testElement );
// Technique from Juriy Zaytsev
// http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
// We only care about the case where non-standard event systems
// are used, namely in IE. Short-circuiting here helps us to
// avoid an eval call (in setAttribute) which can cause CSP
// to go haywire. See: https://developer.mozilla.org/en/Security/CSP
if ( div.attachEvent ) {
for( i in {
submit: 1,
change: 1,
focusin: 1
} ) {
eventName = "on" + i;
isSupported = ( eventName in div );
if ( !isSupported ) {
div.setAttribute( eventName, "return;" );
isSupported = ( typeof div[ eventName ] === "function" );
}
support[ i + "Bubbles" ] = isSupported;
}
}
// Null connected elements to avoid leaks in IE
testElement = fragment = select = opt = body = marginDiv = div = input = null;
return support;
})();
// Keep track of boxModel
jQuery.boxModel = jQuery.support.boxModel;
var rbrace = /^(?:\{.*\}|\[.*\])$/,
rmultiDash = /([a-z])([A-Z])/g;
jQuery.extend({
cache: {},
// Please use with caution
uuid: 0,
// Unique for each copy of jQuery on the page
// Non-digits removed to match rinlinejQuery
expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ),
// The following elements throw uncatchable exceptions if you
// attempt to add expando properties to them.
noData: {
"embed": true,
// Ban all objects except for Flash (which handle expandos)
"object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
"applet": true
},
hasData: function( elem ) {
elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
return !!elem && !isEmptyDataObject( elem );
},
data: function( elem, name, data, pvt /* Internal Use Only */ ) {
if ( !jQuery.acceptData( elem ) ) {
return;
}
var thisCache, ret,
internalKey = jQuery.expando,
getByName = typeof name === "string",
// We have to handle DOM nodes and JS objects differently because IE6-7
// can't GC object references properly across the DOM-JS boundary
isNode = elem.nodeType,
// Only DOM nodes need the global jQuery cache; JS object data is
// attached directly to the object so GC can occur automatically
cache = isNode ? jQuery.cache : elem,
// Only defining an ID for JS objects if its cache already exists allows
// the code to shortcut on the same path as a DOM node with no cache
id = isNode ? elem[ jQuery.expando ] : elem[ jQuery.expando ] && jQuery.expando;
// 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 || (pvt && id && (cache[ id ] && !cache[ id ][ internalKey ]))) && getByName && data === undefined ) {
return;
}
if ( !id ) {
// Only DOM nodes need a new unique ID for each element since their data
// ends up in the global cache
if ( isNode ) {
elem[ jQuery.expando ] = id = ++jQuery.uuid;
} else {
id = jQuery.expando;
}
}
if ( !cache[ id ] ) {
cache[ id ] = {};
// TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery
// metadata on plain JS objects when the object is serialized using
// JSON.stringify
if ( !isNode ) {
cache[ id ].toJSON = jQuery.noop;
}
}
// An object can be passed to jQuery.data instead of a key/value pair; this gets
// shallow copied over onto the existing cache
if ( typeof name === "object" || typeof name === "function" ) {
if ( pvt ) {
cache[ id ][ internalKey ] = jQuery.extend(cache[ id ][ internalKey ], name);
} else {
cache[ id ] = jQuery.extend(cache[ id ], name);
}
}
thisCache = cache[ id ];
// Internal jQuery data is stored in a separate object inside the object's data
// cache in order to avoid key collisions between internal data and user-defined
// data
if ( pvt ) {
if ( !thisCache[ internalKey ] ) {
thisCache[ internalKey ] = {};
}
thisCache = thisCache[ internalKey ];
}
if ( data !== undefined ) {
thisCache[ jQuery.camelCase( name ) ] = data;
}
// TODO: This is a hack for 1.5 ONLY. It will be removed in 1.6. Users should
// not attempt to inspect the internal events object using jQuery.data, as this
// internal data object is undocumented and subject to change.
if ( name === "events" && !thisCache[name] ) {
return thisCache[ internalKey ] && thisCache[ internalKey ].events;
}
// Check for both converted-to-camel and non-converted data property names
// If a data property was specified
if ( getByName ) {
// First Try to find as-is property data
ret = thisCache[ name ];
// Test for null|undefined property data
if ( ret == null ) {
// Try to find the camelCased property
ret = thisCache[ jQuery.camelCase( name ) ];
}
} else {
ret = thisCache;
}
return ret;
},
removeData: function( elem, name, pvt /* Internal Use Only */ ) {
if ( !jQuery.acceptData( elem ) ) {
return;
}
var thisCache,
// Reference to internal data cache key
internalKey = jQuery.expando,
isNode = elem.nodeType,
// See jQuery.data for more information
cache = isNode ? jQuery.cache : elem,
// See jQuery.data for more information
id = isNode ? elem[ 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 ][ internalKey ] : cache[ id ];
if ( thisCache ) {
// Support interoperable removal of hyphenated or camelcased keys
if ( !thisCache[ name ] ) {
name = jQuery.camelCase( name );
}
delete thisCache[ name ];
// If there is no data left in the cache, we want to continue
// and let the cache object itself get destroyed
if ( !isEmptyDataObject(thisCache) ) {
return;
}
}
}
// See jQuery.data for more information
if ( pvt ) {
delete cache[ id ][ internalKey ];
// Don't destroy the parent cache unless the internal data object
// had been the only thing left in it
if ( !isEmptyDataObject(cache[ id ]) ) {
return;
}
}
var internalCache = cache[ id ][ internalKey ];
// Browsers that fail expando deletion also refuse to delete expandos on
// the window, but it will allow it on all other JS objects; other browsers
// don't care
// Ensure that `cache` is not a window object #10080
if ( jQuery.support.deleteExpando || !cache.setInterval ) {
delete cache[ id ];
} else {
cache[ id ] = null;
}
// We destroyed the entire user cache at once because it's faster than
// iterating through each key, but we need to continue to persist internal
// data if it existed
if ( internalCache ) {
cache[ id ] = {};
// TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery
// metadata on plain JS objects when the object is serialized using
// JSON.stringify
if ( !isNode ) {
cache[ id ].toJSON = jQuery.noop;
}
cache[ id ][ internalKey ] = internalCache;
// Otherwise, we need to eliminate the expando on the node to avoid
// false lookups in the cache for entries that no longer exist
} else if ( isNode ) {
// IE does not allow us to delete expando properties from nodes,
// nor does it have a removeAttribute function on Document nodes;
// we must handle all of these cases
if ( jQuery.support.deleteExpando ) {
delete elem[ jQuery.expando ];
} else if ( elem.removeAttribute ) {
elem.removeAttribute( jQuery.expando );
} else {
elem[ jQuery.expando ] = null;
}
}
},
// For internal use only.
_data: function( elem, name, data ) {
return jQuery.data( elem, name, data, true );
},
// A method for determining if a DOM node can handle the data expando
acceptData: function( elem ) {
if ( elem.nodeName ) {
var match = jQuery.noData[ elem.nodeName.toLowerCase() ];
if ( match ) {
return !(match === true || elem.getAttribute("classid") !== match);
}
}
return true;
}
});
jQuery.fn.extend({
data: function( key, value ) {
var data = null;
if ( typeof key === "undefined" ) {
if ( this.length ) {
data = jQuery.data( this[0] );
if ( this[0].nodeType === 1 ) {
var attr = this[0].attributes, name;
for ( var i = 0, l = attr.length; i < l; i++ ) {
name = attr[i].name;
if ( name.indexOf( "data-" ) === 0 ) {
name = jQuery.camelCase( name.substring(5) );
dataAttr( this[0], name, data[ name ] );
}
}
}
}
return data;
} else if ( typeof key === "object" ) {
return this.each(function() {
jQuery.data( this, key );
});
}
var parts = key.split(".");
parts[1] = parts[1] ? "." + parts[1] : "";
if ( value === undefined ) {
data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
// Try to fetch any internally stored data first
if ( data === undefined && this.length ) {
data = jQuery.data( this[0], key );
data = dataAttr( this[0], key, data );
}
return data === undefined && parts[1] ?
this.data( parts[0] ) :
data;
} else {
return this.each(function() {
var $this = jQuery( this ),
args = [ parts[0], value ];
$this.triggerHandler( "setData" + parts[1] + "!", args );
jQuery.data( this, key, value );
$this.triggerHandler( "changeData" + parts[1] + "!", args );
});
}
},
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-$2" ).toLowerCase();
data = elem.getAttribute( name );
if ( typeof data === "string" ) {
try {
data = data === "true" ? true :
data === "false" ? false :
data === "null" ? null :
!jQuery.isNaN( data ) ? parseFloat( 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;
}
// TODO: This is a hack for 1.5 ONLY to allow objects with a single toJSON
// property to be considered empty objects; this property always exists in
// order to make sure JSON.stringify does not expose internal metadata
function isEmptyDataObject( obj ) {
for ( var name in obj ) {
if ( name !== "toJSON" ) {
return false;
}
}
return true;
}
function handleQueueMarkDefer( elem, type, src ) {
var deferDataKey = type + "defer",
queueDataKey = type + "queue",
markDataKey = type + "mark",
defer = jQuery.data( elem, deferDataKey, undefined, true );
if ( defer &&
( src === "queue" || !jQuery.data( elem, queueDataKey, undefined, true ) ) &&
( src === "mark" || !jQuery.data( elem, markDataKey, undefined, true ) ) ) {
// Give room for hard-coded callbacks to fire first
// and eventually mark/queue something else on the element
setTimeout( function() {
if ( !jQuery.data( elem, queueDataKey, undefined, true ) &&
!jQuery.data( elem, markDataKey, undefined, true ) ) {
jQuery.removeData( elem, deferDataKey, true );
defer.resolve();
}
}, 0 );
}
}
jQuery.extend({
_mark: function( elem, type ) {
if ( elem ) {
type = (type || "fx") + "mark";
jQuery.data( elem, type, (jQuery.data(elem,type,undefined,true) || 0) + 1, true );
}
},
_unmark: function( force, elem, type ) {
if ( force !== true ) {
type = elem;
elem = force;
force = false;
}
if ( elem ) {
type = type || "fx";
var key = type + "mark",
count = force ? 0 : ( (jQuery.data( elem, key, undefined, true) || 1 ) - 1 );
if ( count ) {
jQuery.data( elem, key, count, true );
} else {
jQuery.removeData( elem, key, true );
handleQueueMarkDefer( elem, type, "mark" );
}
}
},
queue: function( elem, type, data ) {
if ( elem ) {
type = (type || "fx") + "queue";
var q = jQuery.data( elem, type, undefined, true );
// Speed up dequeue by getting out quickly if this is just a lookup
if ( data ) {
if ( !q || jQuery.isArray(data) ) {
q = jQuery.data( elem, type, jQuery.makeArray(data), true );
} else {
q.push( data );
}
}
return q || [];
}
},
dequeue: function( elem, type ) {
type = type || "fx";
var queue = jQuery.queue( elem, type ),
fn = queue.shift(),
defer;
// If the fx queue is dequeued, always remove the progress sentinel
if ( fn === "inprogress" ) {
fn = queue.shift();
}
if ( fn ) {
// Add a progress sentinel to prevent the fx queue from being
// automatically dequeued
if ( type === "fx" ) {
queue.unshift("inprogress");
}
fn.call(elem, function() {
jQuery.dequeue(elem, type);
});
}
if ( !queue.length ) {
jQuery.removeData( elem, type + "queue", true );
handleQueueMarkDefer( elem, type, "queue" );
}
}
});
jQuery.fn.extend({
queue: function( type, data ) {
if ( typeof type !== "string" ) {
data = type;
type = "fx";
}
if ( data === undefined ) {
return jQuery.queue( this[0], type );
}
return this.each(function() {
var queue = jQuery.queue( this, type, data );
if ( type === "fx" && queue[0] !== "inprogress" ) {
jQuery.dequeue( this, type );
}
});
},
dequeue: function( type ) {
return this.each(function() {
jQuery.dequeue( this, type );
});
},
// Based off of the plugin by Clint Helfers, with permission.
// http://blindsignals.com/index.php/2009/07/jquery-delay/
delay: function( time, type ) {
time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
type = type || "fx";
return this.queue( type, function() {
var elem = this;
setTimeout(function() {
jQuery.dequeue( elem, type );
}, time );
});
},
clearQueue: function( type ) {
return this.queue( type || "fx", [] );
},
// Get a promise resolved when queues of a certain type
// are emptied (fx is the type by default)
promise: function( type, object ) {
if ( typeof type !== "string" ) {
object = type;
type = undefined;
}
type = type || "fx";
var defer = jQuery.Deferred(),
elements = this,
i = elements.length,
count = 1,
deferDataKey = type + "defer",
queueDataKey = type + "queue",
markDataKey = type + "mark",
tmp;
function resolve() {
if ( !( --count ) ) {
defer.resolveWith( elements, [ elements ] );
}
}
while( i-- ) {
if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) ||
( jQuery.data( elements[ i ], queueDataKey, undefined, true ) ||
jQuery.data( elements[ i ], markDataKey, undefined, true ) ) &&
jQuery.data( elements[ i ], deferDataKey, jQuery._Deferred(), true ) )) {
count++;
tmp.done( resolve );
}
}
resolve();
return defer.promise();
}
});
var rclass = /[\n\t\r]/g,
rspace = /\s+/,
rreturn = /\r/g,
rtype = /^(?:button|input)$/i,
rfocusable = /^(?:button|input|object|select|textarea)$/i,
rclickable = /^a(?:rea)?$/i,
rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
nodeHook, boolHook;
jQuery.fn.extend({
attr: function( name, value ) {
return jQuery.access( this, name, value, true, jQuery.attr );
},
removeAttr: function( name ) {
return this.each(function() {
jQuery.removeAttr( this, name );
});
},
prop: function( name, value ) {
return jQuery.access( this, name, value, true, jQuery.prop );
},
removeProp: function( name ) {
name = jQuery.propFix[ name ] || name;
return this.each(function() {
// try/catch handles cases where IE balks (such as removing a property on window)
try {
this[ name ] = undefined;
delete this[ name ];
} catch( e ) {}
});
},
addClass: function( value ) {
var classNames, i, l, elem,
setClass, c, cl;
if ( jQuery.isFunction( value ) ) {
return this.each(function( j ) {
jQuery( this ).addClass( value.call(this, j, this.className) );
});
}
if ( value && typeof value === "string" ) {
classNames = value.split( rspace );
for ( i = 0, l = this.length; i < l; i++ ) {
elem = this[ i ];
if ( elem.nodeType === 1 ) {
if ( !elem.className && classNames.length === 1 ) {
elem.className = value;
} else {
setClass = " " + elem.className + " ";
for ( c = 0, cl = classNames.length; c < cl; c++ ) {
if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) {
setClass += classNames[ c ] + " ";
}
}
elem.className = jQuery.trim( setClass );
}
}
}
}
return this;
},
removeClass: function( value ) {
var classNames, i, l, elem, className, c, cl;
if ( jQuery.isFunction( value ) ) {
return this.each(function( j ) {
jQuery( this ).removeClass( value.call(this, j, this.className) );
});
}
if ( (value && typeof value === "string") || value === undefined ) {
classNames = (value || "").split( rspace );
for ( i = 0, l = this.length; i < l; i++ ) {
elem = this[ i ];
if ( elem.nodeType === 1 && elem.className ) {
if ( value ) {
className = (" " + elem.className + " ").replace( rclass, " " );
for ( c = 0, cl = classNames.length; c < cl; c++ ) {
className = className.replace(" " + classNames[ c ] + " ", " ");
}
elem.className = jQuery.trim( className );
} else {
elem.className = "";
}
}
}
}
return this;
},
toggleClass: function( value, stateVal ) {
var type = typeof value,
isBool = typeof stateVal === "boolean";
if ( jQuery.isFunction( value ) ) {
return this.each(function( i ) {
jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
});
}
return this.each(function() {
if ( type === "string" ) {
// toggle individual class names
var className,
i = 0,
self = jQuery( this ),
state = stateVal,
classNames = value.split( rspace );
while ( (className = classNames[ i++ ]) ) {
// check each className given, space seperated list
state = isBool ? state : !self.hasClass( className );
self[ state ? "addClass" : "removeClass" ]( className );
}
} else if ( type === "undefined" || type === "boolean" ) {
if ( this.className ) {
// store className if set
jQuery._data( this, "__className__", this.className );
}
// toggle whole className
this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
}
});
},
hasClass: function( selector ) {
var className = " " + selector + " ";
for ( var i = 0, l = this.length; i < l; i++ ) {
if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {
return true;
}
}
return false;
},
val: function( value ) {
var hooks, ret,
elem = this[0];
if ( !arguments.length ) {
if ( elem ) {
hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ];
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 undefined;
}
var isFunction = jQuery.isFunction( value );
return this.each(function( i ) {
var self = jQuery(this), val;
if ( this.nodeType !== 1 ) {
return;
}
if ( isFunction ) {
val = value.call( this, i, self.val() );
} else {
val = value;
}
// Treat null/undefined as ""; convert numbers to string
if ( val == null ) {
val = "";
} else if ( typeof val === "number" ) {
val += "";
} else if ( jQuery.isArray( val ) ) {
val = jQuery.map(val, function ( value ) {
return value == null ? "" : value + "";
});
}
hooks = jQuery.valHooks[ this.nodeName.toLowerCase() ] || jQuery.valHooks[ this.type ];
// If set returns undefined, fall back to normal setting
if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
this.value = val;
}
});
}
});
jQuery.extend({
valHooks: {
option: {
get: function( elem ) {
// attributes.value is undefined in Blackberry 4.7 but
// uses .value. See #6932
var val = elem.attributes.value;
return !val || val.specified ? elem.value : elem.text;
}
},
select: {
get: function( elem ) {
var value,
index = elem.selectedIndex,
values = [],
options = elem.options,
one = elem.type === "select-one";
// Nothing was selected
if ( index < 0 ) {
return null;
}
// Loop through all the selected options
for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
var option = options[ i ];
// Don't return options that are disabled or in a disabled optgroup
if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
(!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
// Get the specific value for the option
value = jQuery( option ).val();
// We don't need an array for one selects
if ( one ) {
return value;
}
// Multi-Selects return an array
values.push( value );
}
}
// Fixes Bug #2551 -- select.val() broken in IE after form.reset()
if ( one && !values.length && options.length ) {
return jQuery( options[ index ] ).val();
}
return values;
},
set: function( elem, value ) {
var values = jQuery.makeArray( value );
jQuery(elem).find("option").each(function() {
this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
});
if ( !values.length ) {
elem.selectedIndex = -1;
}
return values;
}
}
},
attrFn: {
val: true,
css: true,
html: true,
text: true,
data: true,
width: true,
height: true,
offset: true
},
attrFix: {
// Always normalize to ensure hook usage
tabindex: "tabIndex"
},
attr: function( elem, name, value, pass ) {
var nType = elem.nodeType;
// don't get/set attributes on text, comment and attribute nodes
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
return undefined;
}
if ( pass && name in jQuery.attrFn ) {
return jQuery( elem )[ name ]( value );
}
// Fallback to prop when attributes are not supported
if ( !("getAttribute" in elem) ) {
return jQuery.prop( elem, name, value );
}
var ret, hooks,
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
// Normalize the name if needed
if ( notxml ) {
name = jQuery.attrFix[ name ] || name;
hooks = jQuery.attrHooks[ name ];
if ( !hooks ) {
// Use boolHook for boolean attributes
if ( rboolean.test( name ) ) {
hooks = boolHook;
// Use nodeHook if available( IE6/7 )
} else if ( nodeHook ) {
hooks = nodeHook;
}
}
}
if ( value !== undefined ) {
if ( value === null ) {
jQuery.removeAttr( elem, name );
return undefined;
} else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) {
return ret;
} else {
elem.setAttribute( name, "" + value );
return value;
}
} else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) {
return ret;
} else {
ret = elem.getAttribute( name );
// Non-existent attributes return null, we normalize to undefined
return ret === null ?
undefined :
ret;
}
},
removeAttr: function( elem, name ) {
var propName;
if ( elem.nodeType === 1 ) {
name = jQuery.attrFix[ name ] || name;
jQuery.attr( elem, name, "" );
elem.removeAttribute( name );
// Set corresponding property to false for boolean attributes
if ( rboolean.test( name ) && (propName = jQuery.propFix[ name ] || name) in elem ) {
elem[ propName ] = false;
}
}
},
attrHooks: {
type: {
set: function( elem, value ) {
// We can't allow the type property to be changed (since it causes problems in IE)
if ( rtype.test( elem.nodeName ) && elem.parentNode ) {
jQuery.error( "type property can't be changed" );
} else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
// Setting the type on a radio button after the value resets the value in IE6-9
// Reset value to it's default in case type is set after value
// This is for element creation
var val = elem.value;
elem.setAttribute( "type", value );
if ( val ) {
elem.value = val;
}
return value;
}
}
},
// Use the value property for back compat
// Use the nodeHook for button elements in IE6/7 (#1954)
value: {
get: function( elem, name ) {
if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
return nodeHook.get( elem, name );
}
return name in elem ?
elem.value :
null;
},
set: function( elem, value, name ) {
if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
return nodeHook.set( elem, value, name );
}
// Does not return so that setAttribute is also used
elem.value = value;
}
}
},
propFix: {
tabindex: "tabIndex",
readonly: "readOnly",
"for": "htmlFor",
"class": "className",
maxlength: "maxLength",
cellspacing: "cellSpacing",
cellpadding: "cellPadding",
rowspan: "rowSpan",
colspan: "colSpan",
usemap: "useMap",
frameborder: "frameBorder",
contenteditable: "contentEditable"
},
prop: function( elem, name, value ) {
var nType = elem.nodeType;
// don't get/set properties on text, comment and attribute nodes
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
return undefined;
}
var ret, hooks,
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
if ( notxml ) {
// Fix name and attach hooks
name = jQuery.propFix[ name ] || name;
hooks = jQuery.propHooks[ name ];
}
if ( value !== undefined ) {
if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
return ret;
} else {
return (elem[ name ] = value);
}
} else {
if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
return ret;
} else {
return elem[ name ];
}
}
},
propHooks: {
tabIndex: {
get: function( elem ) {
// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
var attributeNode = elem.getAttributeNode("tabindex");
return attributeNode && attributeNode.specified ?
parseInt( attributeNode.value, 10 ) :
rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
0 :
undefined;
}
}
}
});
// Add the tabindex propHook to attrHooks for back-compat
jQuery.attrHooks.tabIndex = jQuery.propHooks.tabIndex;
// Hook for boolean attributes
boolHook = {
get: function( elem, name ) {
// Align boolean attributes with corresponding properties
// Fall back to attribute presence where some booleans are not supported
var attrNode;
return jQuery.prop( elem, name ) === true || ( attrNode = elem.getAttributeNode( name ) ) && attrNode.nodeValue !== false ?
name.toLowerCase() :
undefined;
},
set: function( elem, value, name ) {
var propName;
if ( value === false ) {
// Remove boolean attributes when set to false
jQuery.removeAttr( elem, name );
} else {
// value is true since we know at this point it's type boolean and not false
// Set boolean attributes to the same name and set the DOM property
propName = jQuery.propFix[ name ] || name;
if ( propName in elem ) {
// Only set the IDL specifically if it already exists on the element
elem[ propName ] = true;
}
elem.setAttribute( name, name.toLowerCase() );
}
return name;
}
};
// IE6/7 do not support getting/setting some attributes with get/setAttribute
if ( !jQuery.support.getSetAttribute ) {
// Use this for any attribute in IE6/7
// This fixes almost every IE6/7 issue
nodeHook = jQuery.valHooks.button = {
get: function( elem, name ) {
var ret;
ret = elem.getAttributeNode( name );
// Return undefined if nodeValue is empty string
return ret && ret.nodeValue !== "" ?
ret.nodeValue :
undefined;
},
set: function( elem, value, name ) {
// Set the existing or create a new attribute node
var ret = elem.getAttributeNode( name );
if ( !ret ) {
ret = document.createAttribute( name );
elem.setAttributeNode( ret );
}
return (ret.nodeValue = value + "");
}
};
// Set width and height to auto instead of 0 on empty string( Bug #8150 )
// This is for removals
jQuery.each([ "width", "height" ], function( i, name ) {
jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
set: function( elem, value ) {
if ( value === "" ) {
elem.setAttribute( name, "auto" );
return value;
}
}
});
});
}
// Some attributes require a special call on IE
if ( !jQuery.support.hrefNormalized ) {
jQuery.each([ "href", "src", "width", "height" ], function( i, name ) {
jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
get: function( elem ) {
var ret = elem.getAttribute( name, 2 );
return ret === null ? undefined : ret;
}
});
});
}
if ( !jQuery.support.style ) {
jQuery.attrHooks.style = {
get: function( elem ) {
// Return undefined in the case of empty string
// Normalize to lowercase since IE uppercases css property names
return elem.style.cssText.toLowerCase() || undefined;
},
set: function( elem, value ) {
return (elem.style.cssText = "" + value);
}
};
}
// Safari mis-reports the default selected property of an option
// Accessing the parent's selectedIndex property fixes it
if ( !jQuery.support.optSelected ) {
jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {
get: function( elem ) {
var parent = elem.parentNode;
if ( parent ) {
parent.selectedIndex;
// Make sure that it also works with optgroups, see #5701
if ( parent.parentNode ) {
parent.parentNode.selectedIndex;
}
}
return null;
}
});
}
// Radios and checkboxes getter/setter
if ( !jQuery.support.checkOn ) {
jQuery.each([ "radio", "checkbox" ], function() {
jQuery.valHooks[ this ] = {
get: function( elem ) {
// Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
return elem.getAttribute("value") === null ? "on" : elem.value;
}
};
});
}
jQuery.each([ "radio", "checkbox" ], function() {
jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {
set: function( elem, value ) {
if ( jQuery.isArray( value ) ) {
return (elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0);
}
}
});
});
var rnamespaces = /\.(.*)$/,
rformElems = /^(?:textarea|input|select)$/i,
rperiod = /\./g,
rspaces = / /g,
rescape = /[^\w\s.|`]/g,
fcleanup = function( nm ) {
return nm.replace(rescape, "\\$&");
};
/*
* A number of helper functions used for managing events.
* Many of the ideas behind this code originated from
* Dean Edwards' addEvent library.
*/
jQuery.event = {
// Bind an event to an element
// Original by Dean Edwards
add: function( elem, types, handler, data ) {
if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
return;
}
if ( handler === false ) {
handler = returnFalse;
} else if ( !handler ) {
// Fixes bug #7229. Fix recommended by jdalton
return;
}
var handleObjIn, handleObj;
if ( handler.handler ) {
handleObjIn = handler;
handler = handleObjIn.handler;
}
// Make sure that the function being executed has a unique ID
if ( !handler.guid ) {
handler.guid = jQuery.guid++;
}
// Init the element's event structure
var elemData = jQuery._data( elem );
// If no elemData is found then we must be trying to bind to one of the
// banned noData elements
if ( !elemData ) {
return;
}
var events = elemData.events,
eventHandle = elemData.handle;
if ( !events ) {
elemData.events = events = {};
}
if ( !eventHandle ) {
elemData.handle = eventHandle = function( e ) {
// Discard the second event of a jQuery.event.trigger() and
// when an event is called after a page has unloaded
return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ?
jQuery.event.handle.apply( eventHandle.elem, arguments ) :
undefined;
};
}
// Add elem as a property of the handle function
// This is to prevent a memory leak with non-native events in IE.
eventHandle.elem = elem;
// Handle multiple events separated by a space
// jQuery(...).bind("mouseover mouseout", fn);
types = types.split(" ");
var type, i = 0, namespaces;
while ( (type = types[ i++ ]) ) {
handleObj = handleObjIn ?
jQuery.extend({}, handleObjIn) :
{ handler: handler, data: data };
// Namespaced event handlers
if ( type.indexOf(".") > -1 ) {
namespaces = type.split(".");
type = namespaces.shift();
handleObj.namespace = namespaces.slice(0).sort().join(".");
} else {
namespaces = [];
handleObj.namespace = "";
}
handleObj.type = type;
if ( !handleObj.guid ) {
handleObj.guid = handler.guid;
}
// Get the current list of functions bound to this event
var handlers = events[ type ],
special = jQuery.event.special[ type ] || {};
// Init the event handler queue
if ( !handlers ) {
handlers = events[ type ] = [];
// Check for a special event handler
// 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 the function to the element's handler list
handlers.push( handleObj );
// Keep track of which events have been used, for event optimization
jQuery.event.global[ type ] = true;
}
// Nullify elem to prevent memory leaks in IE
elem = null;
},
global: {},
// Detach an event or set of events from an element
remove: function( elem, types, handler, pos ) {
// don't do events on text and comment nodes
if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
return;
}
if ( handler === false ) {
handler = returnFalse;
}
var ret, type, fn, j, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType,
elemData = jQuery.hasData( elem ) && jQuery._data( elem ),
events = elemData && elemData.events;
if ( !elemData || !events ) {
return;
}
// types is actually an event object here
if ( types && types.type ) {
handler = types.handler;
types = types.type;
}
// Unbind all events for the element
if ( !types || typeof types === "string" && types.charAt(0) === "." ) {
types = types || "";
for ( type in events ) {
jQuery.event.remove( elem, type + types );
}
return;
}
// Handle multiple events separated by a space
// jQuery(...).unbind("mouseover mouseout", fn);
types = types.split(" ");
while ( (type = types[ i++ ]) ) {
origType = type;
handleObj = null;
all = type.indexOf(".") < 0;
namespaces = [];
if ( !all ) {
// Namespaced event handlers
namespaces = type.split(".");
type = namespaces.shift();
namespace = new RegExp("(^|\\.)" +
jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)");
}
eventType = events[ type ];
if ( !eventType ) {
continue;
}
if ( !handler ) {
for ( j = 0; j < eventType.length; j++ ) {
handleObj = eventType[ j ];
if ( all || namespace.test( handleObj.namespace ) ) {
jQuery.event.remove( elem, origType, handleObj.handler, j );
eventType.splice( j--, 1 );
}
}
continue;
}
special = jQuery.event.special[ type ] || {};
for ( j = pos || 0; j < eventType.length; j++ ) {
handleObj = eventType[ j ];
if ( handler.guid === handleObj.guid ) {
// remove the given handler for the given type
if ( all || namespace.test( handleObj.namespace ) ) {
if ( pos == null ) {
eventType.splice( j--, 1 );
}
if ( special.remove ) {
special.remove.call( elem, handleObj );
}
}
if ( pos != null ) {
break;
}
}
}
// remove generic event handler if no more handlers exist
if ( eventType.length === 0 || pos != null && eventType.length === 1 ) {
if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
jQuery.removeEvent( elem, type, elemData.handle );
}
ret = null;
delete events[ type ];
}
}
// Remove the expando if it's no longer used
if ( jQuery.isEmptyObject( events ) ) {
var handle = elemData.handle;
if ( handle ) {
handle.elem = null;
}
delete elemData.events;
delete elemData.handle;
if ( jQuery.isEmptyObject( elemData ) ) {
jQuery.removeData( elem, undefined, true );
}
}
},
// Events that are safe to short-circuit if no handlers are attached.
// Native DOM events should not be added, they may have inline handlers.
customEvent: {
"getData": true,
"setData": true,
"changeData": true
},
trigger: function( event, data, elem, onlyHandlers ) {
// Event object or event type
var type = event.type || event,
namespaces = [],
exclusive;
if ( type.indexOf("!") >= 0 ) {
// Exclusive events trigger only for the exact event (no namespaces)
type = type.slice(0, -1);
exclusive = true;
}
if ( type.indexOf(".") >= 0 ) {
// Namespaced trigger; create a regexp to match event type in handle()
namespaces = type.split(".");
type = namespaces.shift();
namespaces.sort();
}
if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) {
// No jQuery handlers for this event type, and it can't have inline handlers
return;
}
// Caller can pass in an Event, Object, or just an event type string
event = typeof event === "object" ?
// jQuery.Event object
event[ jQuery.expando ] ? event :
// Object literal
new jQuery.Event( type, event ) :
// Just the event type (string)
new jQuery.Event( type );
event.type = type;
event.exclusive = exclusive;
event.namespace = namespaces.join(".");
event.namespace_re = new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)");
// triggerHandler() and global events don't bubble or run the default action
if ( onlyHandlers || !elem ) {
event.preventDefault();
event.stopPropagation();
}
// Handle a global trigger
if ( !elem ) {
// TODO: Stop taunting the data cache; remove global events and always attach to document
jQuery.each( jQuery.cache, function() {
// internalKey variable is just used to make it easier to find
// and potentially change this stuff later; currently it just
// points to jQuery.expando
var internalKey = jQuery.expando,
internalCache = this[ internalKey ];
if ( internalCache && internalCache.events && internalCache.events[ type ] ) {
jQuery.event.trigger( event, data, internalCache.handle.elem );
}
});
return;
}
// Don't do events on text and comment nodes
if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
return;
}
// Clean up the event in case it is being reused
event.result = undefined;
event.target = elem;
// Clone any incoming data and prepend the event, creating the handler arg list
data = data != null ? jQuery.makeArray( data ) : [];
data.unshift( event );
var cur = elem,
// IE doesn't like method names with a colon (#3533, #8272)
ontype = type.indexOf(":") < 0 ? "on" + type : "";
// Fire event on the current element, then bubble up the DOM tree
do {
var handle = jQuery._data( cur, "handle" );
event.currentTarget = cur;
if ( handle ) {
handle.apply( cur, data );
}
// Trigger an inline bound script
if ( ontype && jQuery.acceptData( cur ) && cur[ ontype ] && cur[ ontype ].apply( cur, data ) === false ) {
event.result = false;
event.preventDefault();
}
// Bubble up to document, then to window
cur = cur.parentNode || cur.ownerDocument || cur === event.target.ownerDocument && window;
} while ( cur && !event.isPropagationStopped() );
// If nobody prevented the default action, do it now
if ( !event.isDefaultPrevented() ) {
var old,
special = jQuery.event.special[ type ] || {};
if ( (!special._default || special._default.call( elem.ownerDocument, event ) === false) &&
!(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {
// Call a native DOM method on the target with the same name name as the event.
// Can't use an .isFunction)() check here because IE6/7 fails that test.
// IE<9 dies on focus to hidden element (#1486), may want to revisit a try/catch.
try {
if ( ontype && elem[ type ] ) {
// Don't re-trigger an onFOO event when we call its FOO() method
old = elem[ ontype ];
if ( old ) {
elem[ ontype ] = null;
}
jQuery.event.triggered = type;
elem[ type ]();
}
} catch ( ieError ) {}
if ( old ) {
elem[ ontype ] = old;
}
jQuery.event.triggered = undefined;
}
}
return event.result;
},
handle: function( event ) {
event = jQuery.event.fix( event || window.event );
// Snapshot the handlers list since a called handler may add/remove events.
var handlers = ((jQuery._data( this, "events" ) || {})[ event.type ] || []).slice(0),
run_all = !event.exclusive && !event.namespace,
args = Array.prototype.slice.call( arguments, 0 );
// Use the fix-ed Event rather than the (read-only) native event
args[0] = event;
event.currentTarget = this;
for ( var j = 0, l = handlers.length; j < l; j++ ) {
var handleObj = handlers[ j ];
// Triggered event must 1) be non-exclusive and have no namespace, or
// 2) have namespace(s) a subset or equal to those in the bound event.
if ( run_all || event.namespace_re.test( handleObj.namespace ) ) {
// Pass in a reference to the handler function itself
// So that we can later remove it
event.handler = handleObj.handler;
event.data = handleObj.data;
event.handleObj = handleObj;
var ret = handleObj.handler.apply( this, args );
if ( ret !== undefined ) {
event.result = ret;
if ( ret === false ) {
event.preventDefault();
event.stopPropagation();
}
}
if ( event.isImmediatePropagationStopped() ) {
break;
}
}
}
return event.result;
},
props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
fix: function( event ) {
if ( event[ jQuery.expando ] ) {
return event;
}
// store a copy of the original event object
// and "clone" to set read-only properties
var originalEvent = event;
event = jQuery.Event( originalEvent );
for ( var i = this.props.length, prop; i; ) {
prop = this.props[ --i ];
event[ prop ] = originalEvent[ prop ];
}
// Fix target property, if necessary
if ( !event.target ) {
// Fixes #1925 where srcElement might not be defined either
event.target = event.srcElement || document;
}
// check if target is a textnode (safari)
if ( event.target.nodeType === 3 ) {
event.target = event.target.parentNode;
}
// Add relatedTarget, if necessary
if ( !event.relatedTarget && event.fromElement ) {
event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement;
}
// Calculate pageX/Y if missing and clientX/Y available
if ( event.pageX == null && event.clientX != null ) {
var eventDocument = event.target.ownerDocument || document,
doc = eventDocument.documentElement,
body = eventDocument.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);
}
// Add which for key events
if ( event.which == null && (event.charCode != null || event.keyCode != null) ) {
event.which = event.charCode != null ? event.charCode : event.keyCode;
}
// Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
if ( !event.metaKey && event.ctrlKey ) {
event.metaKey = event.ctrlKey;
}
// Add which for click: 1 === left; 2 === middle; 3 === right
// Note: button is not normalized, so don't use it
if ( !event.which && event.button !== undefined ) {
event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
}
return event;
},
// Deprecated, use jQuery.guid instead
guid: 1E8,
// Deprecated, use jQuery.proxy instead
proxy: jQuery.proxy,
special: {
ready: {
// Make sure the ready event is setup
setup: jQuery.bindReady,
teardown: jQuery.noop
},
live: {
add: function( handleObj ) {
jQuery.event.add( this,
liveConvert( handleObj.origType, handleObj.selector ),
jQuery.extend({}, handleObj, {handler: liveHandler, guid: handleObj.handler.guid}) );
},
remove: function( handleObj ) {
jQuery.event.remove( this, liveConvert( handleObj.origType, handleObj.selector ), handleObj );
}
},
beforeunload: {
setup: function( data, namespaces, eventHandle ) {
// We only want to do this special case on windows
if ( jQuery.isWindow( this ) ) {
this.onbeforeunload = eventHandle;
}
},
teardown: function( namespaces, eventHandle ) {
if ( this.onbeforeunload === eventHandle ) {
this.onbeforeunload = null;
}
}
}
}
};
jQuery.removeEvent = document.removeEventListener ?
function( elem, type, handle ) {
if ( elem.removeEventListener ) {
elem.removeEventListener( type, handle, false );
}
} :
function( elem, type, handle ) {
if ( elem.detachEvent ) {
elem.detachEvent( "on" + type, handle );
}
};
jQuery.Event = function( src, props ) {
// Allow instantiation without the 'new' keyword
if ( !this.preventDefault ) {
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 );
}
// timeStamp is buggy for some events on Firefox(#3843)
// So we won't rely on the native value
this.timeStamp = jQuery.now();
// Mark it as fixed
this[ jQuery.expando ] = true;
};
function returnFalse() {
return false;
}
function returnTrue() {
return true;
}
// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
jQuery.Event.prototype = {
preventDefault: function() {
this.isDefaultPrevented = returnTrue;
var e = this.originalEvent;
if ( !e ) {
return;
}
// if preventDefault exists run it on the original event
if ( e.preventDefault ) {
e.preventDefault();
// otherwise set the returnValue property of the original event to false (IE)
} else {
e.returnValue = false;
}
},
stopPropagation: function() {
this.isPropagationStopped = returnTrue;
var e = this.originalEvent;
if ( !e ) {
return;
}
// if stopPropagation exists run it on the original event
if ( e.stopPropagation ) {
e.stopPropagation();
}
// otherwise set the cancelBubble property of the original event to true (IE)
e.cancelBubble = true;
},
stopImmediatePropagation: function() {
this.isImmediatePropagationStopped = returnTrue;
this.stopPropagation();
},
isDefaultPrevented: returnFalse,
isPropagationStopped: returnFalse,
isImmediatePropagationStopped: returnFalse
};
// Checks if an event happened on an element within another element
// Used in jQuery.event.special.mouseenter and mouseleave handlers
var withinElement = function( event ) {
// Check if mouse(over|out) are still within the same parent element
var related = event.relatedTarget,
inside = false,
eventType = event.type;
event.type = event.data;
if ( related !== this ) {
if ( related ) {
inside = jQuery.contains( this, related );
}
if ( !inside ) {
jQuery.event.handle.apply( this, arguments );
event.type = eventType;
}
}
},
// In case of event delegation, we only need to rename the event.type,
// liveHandler will take care of the rest.
delegate = function( event ) {
event.type = event.data;
jQuery.event.handle.apply( this, arguments );
};
// Create mouseenter and mouseleave events
jQuery.each({
mouseenter: "mouseover",
mouseleave: "mouseout"
}, function( orig, fix ) {
jQuery.event.special[ orig ] = {
setup: function( data ) {
jQuery.event.add( this, fix, data && data.selector ? delegate : withinElement, orig );
},
teardown: function( data ) {
jQuery.event.remove( this, fix, data && data.selector ? delegate : withinElement );
}
};
});
// submit delegation
if ( !jQuery.support.submitBubbles ) {
jQuery.event.special.submit = {
setup: function( data, namespaces ) {
if ( !jQuery.nodeName( this, "form" ) ) {
jQuery.event.add(this, "click.specialSubmit", function( e ) {
var elem = e.target,
type = jQuery.nodeName( elem, "input" ) ? elem.type : "";
if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) {
trigger( "submit", this, arguments );
}
});
jQuery.event.add(this, "keypress.specialSubmit", function( e ) {
var elem = e.target,
type = jQuery.nodeName( elem, "input" ) ? elem.type : "";
if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) {
trigger( "submit", this, arguments );
}
});
} else {
return false;
}
},
teardown: function( namespaces ) {
jQuery.event.remove( this, ".specialSubmit" );
}
};
}
// change delegation, happens here so we have bind.
if ( !jQuery.support.changeBubbles ) {
var changeFilters,
getVal = function( elem ) {
var type = jQuery.nodeName( elem, "input" ) ? elem.type : "",
val = elem.value;
if ( type === "radio" || type === "checkbox" ) {
val = elem.checked;
} else if ( type === "select-multiple" ) {
val = elem.selectedIndex > -1 ?
jQuery.map( elem.options, function( elem ) {
return elem.selected;
}).join("-") :
"";
} else if ( jQuery.nodeName( elem, "select" ) ) {
val = elem.selectedIndex;
}
return val;
},
testChange = function testChange( e ) {
var elem = e.target, data, val;
if ( !rformElems.test( elem.nodeName ) || elem.readOnly ) {
return;
}
data = jQuery._data( elem, "_change_data" );
val = getVal(elem);
// the current data will be also retrieved by beforeactivate
if ( e.type !== "focusout" || elem.type !== "radio" ) {
jQuery._data( elem, "_change_data", val );
}
if ( data === undefined || val === data ) {
return;
}
if ( data != null || val ) {
e.type = "change";
e.liveFired = undefined;
jQuery.event.trigger( e, arguments[1], elem );
}
};
jQuery.event.special.change = {
filters: {
focusout: testChange,
beforedeactivate: testChange,
click: function( e ) {
var elem = e.target, type = jQuery.nodeName( elem, "input" ) ? elem.type : "";
if ( type === "radio" || type === "checkbox" || jQuery.nodeName( elem, "select" ) ) {
testChange.call( this, e );
}
},
// Change has to be called before submit
// Keydown will be called before keypress, which is used in submit-event delegation
keydown: function( e ) {
var elem = e.target, type = jQuery.nodeName( elem, "input" ) ? elem.type : "";
if ( (e.keyCode === 13 && !jQuery.nodeName( elem, "textarea" ) ) ||
(e.keyCode === 32 && (type === "checkbox" || type === "radio")) ||
type === "select-multiple" ) {
testChange.call( this, e );
}
},
// Beforeactivate happens also before the previous element is blurred
// with this event you can't trigger a change event, but you can store
// information
beforeactivate: function( e ) {
var elem = e.target;
jQuery._data( elem, "_change_data", getVal(elem) );
}
},
setup: function( data, namespaces ) {
if ( this.type === "file" ) {
return false;
}
for ( var type in changeFilters ) {
jQuery.event.add( this, type + ".specialChange", changeFilters[type] );
}
return rformElems.test( this.nodeName );
},
teardown: function( namespaces ) {
jQuery.event.remove( this, ".specialChange" );
return rformElems.test( this.nodeName );
}
};
changeFilters = jQuery.event.special.change.filters;
// Handle when the input is .focus()'d
changeFilters.focus = changeFilters.beforeactivate;
}
function trigger( type, elem, args ) {
// 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.
// Don't pass args or remember liveFired; they apply to the donor event.
var event = jQuery.extend( {}, args[ 0 ] );
event.type = type;
event.originalEvent = {};
event.liveFired = undefined;
jQuery.event.handle.call( elem, event );
if ( event.isDefaultPrevented() ) {
args[ 0 ].preventDefault();
}
}
// 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;
jQuery.event.special[ fix ] = {
setup: function() {
if ( attaches++ === 0 ) {
document.addEventListener( orig, handler, true );
}
},
teardown: function() {
if ( --attaches === 0 ) {
document.removeEventListener( orig, handler, true );
}
}
};
function handler( donor ) {
// Donor event is always a native one; fix it and switch its type.
// Let focusin/out handler cancel the donor focus/blur event.
var e = jQuery.event.fix( donor );
e.type = fix;
e.originalEvent = {};
jQuery.event.trigger( e, null, e.target );
if ( e.isDefaultPrevented() ) {
donor.preventDefault();
}
}
});
}
jQuery.each(["bind", "one"], function( i, name ) {
jQuery.fn[ name ] = function( type, data, fn ) {
var handler;
// Handle object literals
if ( typeof type === "object" ) {
for ( var key in type ) {
this[ name ](key, data, type[key], fn);
}
return this;
}
if ( arguments.length === 2 || data === false ) {
fn = data;
data = undefined;
}
if ( name === "one" ) {
handler = function( event ) {
jQuery( this ).unbind( event, handler );
return fn.apply( this, arguments );
};
handler.guid = fn.guid || jQuery.guid++;
} else {
handler = fn;
}
if ( type === "unload" && name !== "one" ) {
this.one( type, data, fn );
} else {
for ( var i = 0, l = this.length; i < l; i++ ) {
jQuery.event.add( this[i], type, handler, data );
}
}
return this;
};
});
jQuery.fn.extend({
unbind: function( type, fn ) {
// Handle object literals
if ( typeof type === "object" && !type.preventDefault ) {
for ( var key in type ) {
this.unbind(key, type[key]);
}
} else {
for ( var i = 0, l = this.length; i < l; i++ ) {
jQuery.event.remove( this[i], type, fn );
}
}
return this;
},
delegate: function( selector, types, data, fn ) {
return this.live( types, data, fn, selector );
},
undelegate: function( selector, types, fn ) {
if ( arguments.length === 0 ) {
return this.unbind( "live" );
} else {
return this.die( types, null, fn, selector );
}
},
trigger: function( type, data ) {
return this.each(function() {
jQuery.event.trigger( type, data, this );
});
},
triggerHandler: function( type, data ) {
if ( this[0] ) {
return jQuery.event.trigger( type, data, this[0], true );
}
},
toggle: function( fn ) {
// Save reference to arguments for access in closure
var args = arguments,
guid = fn.guid || jQuery.guid++,
i = 0,
toggler = function( event ) {
// Figure out which function to execute
var lastToggle = ( jQuery.data( this, "lastToggle" + fn.guid ) || 0 ) % i;
jQuery.data( this, "lastToggle" + fn.guid, lastToggle + 1 );
// Make sure that clicks stop
event.preventDefault();
// and execute the function
return args[ lastToggle ].apply( this, arguments ) || false;
};
// link all the functions, so any of them can unbind this click handler
toggler.guid = guid;
while ( i < args.length ) {
args[ i++ ].guid = guid;
}
return this.click( toggler );
},
hover: function( fnOver, fnOut ) {
return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
}
});
var liveMap = {
focus: "focusin",
blur: "focusout",
mouseenter: "mouseover",
mouseleave: "mouseout"
};
jQuery.each(["live", "die"], function( i, name ) {
jQuery.fn[ name ] = function( types, data, fn, origSelector /* Internal Use Only */ ) {
var type, i = 0, match, namespaces, preType,
selector = origSelector || this.selector,
context = origSelector ? this : jQuery( this.context );
if ( typeof types === "object" && !types.preventDefault ) {
for ( var key in types ) {
context[ name ]( key, data, types[key], selector );
}
return this;
}
if ( name === "die" && !types &&
origSelector && origSelector.charAt(0) === "." ) {
context.unbind( origSelector );
return this;
}
if ( data === false || jQuery.isFunction( data ) ) {
fn = data || returnFalse;
data = undefined;
}
types = (types || "").split(" ");
while ( (type = types[ i++ ]) != null ) {
match = rnamespaces.exec( type );
namespaces = "";
if ( match ) {
namespaces = match[0];
type = type.replace( rnamespaces, "" );
}
if ( type === "hover" ) {
types.push( "mouseenter" + namespaces, "mouseleave" + namespaces );
continue;
}
preType = type;
if ( liveMap[ type ] ) {
types.push( liveMap[ type ] + namespaces );
type = type + namespaces;
} else {
type = (liveMap[ type ] || type) + namespaces;
}
if ( name === "live" ) {
// bind live handler
for ( var j = 0, l = context.length; j < l; j++ ) {
jQuery.event.add( context[j], "live." + liveConvert( type, selector ),
{ data: data, selector: selector, handler: fn, origType: type, origHandler: fn, preType: preType } );
}
} else {
// unbind live handler
context.unbind( "live." + liveConvert( type, selector ), fn );
}
}
return this;
};
});
function liveHandler( event ) {
var stop, maxLevel, related, match, handleObj, elem, j, i, l, data, close, namespace, ret,
elems = [],
selectors = [],
events = jQuery._data( this, "events" );
// Make sure we avoid non-left-click bubbling in Firefox (#3861) and disabled elements in IE (#6911)
if ( event.liveFired === this || !events || !events.live || event.target.disabled || event.button && event.type === "click" ) {
return;
}
if ( event.namespace ) {
namespace = new RegExp("(^|\\.)" + event.namespace.split(".").join("\\.(?:.*\\.)?") + "(\\.|$)");
}
event.liveFired = this;
var live = events.live.slice(0);
for ( j = 0; j < live.length; j++ ) {
handleObj = live[j];
if ( handleObj.origType.replace( rnamespaces, "" ) === event.type ) {
selectors.push( handleObj.selector );
} else {
live.splice( j--, 1 );
}
}
match = jQuery( event.target ).closest( selectors, event.currentTarget );
for ( i = 0, l = match.length; i < l; i++ ) {
close = match[i];
for ( j = 0; j < live.length; j++ ) {
handleObj = live[j];
if ( close.selector === handleObj.selector && (!namespace || namespace.test( handleObj.namespace )) && !close.elem.disabled ) {
elem = close.elem;
related = null;
// Those two events require additional checking
if ( handleObj.preType === "mouseenter" || handleObj.preType === "mouseleave" ) {
event.type = handleObj.preType;
related = jQuery( event.relatedTarget ).closest( handleObj.selector )[0];
// Make sure not to accidentally match a child element with the same selector
if ( related && jQuery.contains( elem, related ) ) {
related = elem;
}
}
if ( !related || related !== elem ) {
elems.push({ elem: elem, handleObj: handleObj, level: close.level });
}
}
}
}
for ( i = 0, l = elems.length; i < l; i++ ) {
match = elems[i];
if ( maxLevel && match.level > maxLevel ) {
break;
}
event.currentTarget = match.elem;
event.data = match.handleObj.data;
event.handleObj = match.handleObj;
ret = match.handleObj.origHandler.apply( match.elem, arguments );
if ( ret === false || event.isPropagationStopped() ) {
maxLevel = match.level;
if ( ret === false ) {
stop = false;
}
if ( event.isImmediatePropagationStopped() ) {
break;
}
}
}
return stop;
}
function liveConvert( type, selector ) {
return (type && type !== "*" ? type + "." : "") + selector.replace(rperiod, "`").replace(rspaces, "&");
}
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").split(" "), function( i, name ) {
// Handle event binding
jQuery.fn[ name ] = function( data, fn ) {
if ( fn == null ) {
fn = data;
data = null;
}
return arguments.length > 0 ?
this.bind( name, data, fn ) :
this.trigger( name );
};
if ( jQuery.attrFn ) {
jQuery.attrFn[ name ] = true;
}
});
/*!
* Sizzle CSS Selector Engine
* Copyright 2011, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
* More information: http://sizzlejs.com/
*/
(function(){
var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
done = 0,
toString = Object.prototype.toString,
hasDuplicate = false,
baseHasDuplicate = true,
rBackslash = /\\/g,
rNonWord = /\W/;
// Here we check if the JavaScript engine is using some sort of
// optimization where it does not always call our comparision
// function. If that is the case, discard the hasDuplicate value.
// Thus far that includes Google Chrome.
[0, 0].sort(function() {
baseHasDuplicate = false;
return 0;
});
var Sizzle = function( selector, context, results, seed ) {
results = results || [];
context = context || document;
var origContext = context;
if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
return [];
}
if ( !selector || typeof selector !== "string" ) {
return results;
}
var m, set, checkSet, extra, ret, cur, pop, i,
prune = true,
contextXML = Sizzle.isXML( context ),
parts = [],
soFar = selector;
// Reset the position of the chunker regexp (start from head)
do {
chunker.exec( "" );
m = chunker.exec( soFar );
if ( m ) {
soFar = m[3];
parts.push( m[1] );
if ( m[2] ) {
extra = m[3];
break;
}
}
} while ( m );
if ( parts.length > 1 && origPOS.exec( selector ) ) {
if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
set = posProcess( parts[0] + parts[1], context );
} else {
set = Expr.relative[ parts[0] ] ?
[ context ] :
Sizzle( parts.shift(), context );
while ( parts.length ) {
selector = parts.shift();
if ( Expr.relative[ selector ] ) {
selector += parts.shift();
}
set = posProcess( selector, set );
}
}
} else {
// Take a shortcut and set the context if the root selector is an ID
// (but not if it'll be faster if the inner selector is an ID)
if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
ret = Sizzle.find( parts.shift(), context, contextXML );
context = ret.expr ?
Sizzle.filter( ret.expr, ret.set )[0] :
ret.set[0];
}
if ( context ) {
ret = seed ?
{ expr: parts.pop(), set: makeArray(seed) } :
Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );
set = ret.expr ?
Sizzle.filter( ret.expr, ret.set ) :
ret.set;
if ( parts.length > 0 ) {
checkSet = makeArray( set );
} else {
prune = false;
}
while ( parts.length ) {
cur = parts.pop();
pop = cur;
if ( !Expr.relative[ cur ] ) {
cur = "";
} else {
pop = parts.pop();
}
if ( pop == null ) {
pop = context;
}
Expr.relative[ cur ]( checkSet, pop, contextXML );
}
} else {
checkSet = parts = [];
}
}
if ( !checkSet ) {
checkSet = set;
}
if ( !checkSet ) {
Sizzle.error( cur || selector );
}
if ( toString.call(checkSet) === "[object Array]" ) {
if ( !prune ) {
results.push.apply( results, checkSet );
} else if ( context && context.nodeType === 1 ) {
for ( i = 0; checkSet[i] != null; i++ ) {
if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) {
results.push( set[i] );
}
}
} else {
for ( i = 0; checkSet[i] != null; i++ ) {
if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
results.push( set[i] );
}
}
}
} else {
makeArray( checkSet, results );
}
if ( extra ) {
Sizzle( extra, origContext, results, seed );
Sizzle.uniqueSort( results );
}
return results;
};
Sizzle.uniqueSort = function( results ) {
if ( sortOrder ) {
hasDuplicate = baseHasDuplicate;
results.sort( sortOrder );
if ( hasDuplicate ) {
for ( var i = 1; i < results.length; i++ ) {
if ( results[i] === results[ i - 1 ] ) {
results.splice( i--, 1 );
}
}
}
}
return results;
};
Sizzle.matches = function( expr, set ) {
return Sizzle( expr, null, null, set );
};
Sizzle.matchesSelector = function( node, expr ) {
return Sizzle( expr, null, null, [node] ).length > 0;
};
Sizzle.find = function( expr, context, isXML ) {
var set;
if ( !expr ) {
return [];
}
for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
var match,
type = Expr.order[i];
if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
var left = match[1];
match.splice( 1, 1 );
if ( left.substr( left.length - 1 ) !== "\\" ) {
match[1] = (match[1] || "").replace( rBackslash, "" );
set = Expr.find[ type ]( match, context, isXML );
if ( set != null ) {
expr = expr.replace( Expr.match[ type ], "" );
break;
}
}
}
}
if ( !set ) {
set = typeof context.getElementsByTagName !== "undefined" ?
context.getElementsByTagName( "*" ) :
[];
}
return { set: set, expr: expr };
};
Sizzle.filter = function( expr, set, inplace, not ) {
var match, anyFound,
old = expr,
result = [],
curLoop = set,
isXMLFilter = set && set[0] && Sizzle.isXML( set[0] );
while ( expr && set.length ) {
for ( var type in Expr.filter ) {
if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {
var found, item,
filter = Expr.filter[ type ],
left = match[1];
anyFound = false;
match.splice(1,1);
if ( left.substr( left.length - 1 ) === "\\" ) {
continue;
}
if ( curLoop === result ) {
result = [];
}
if ( Expr.preFilter[ type ] ) {
match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
if ( !match ) {
anyFound = found = true;
} else if ( match === true ) {
continue;
}
}
if ( match ) {
for ( var i = 0; (item = curLoop[i]) != null; i++ ) {
if ( item ) {
found = filter( item, match, i, curLoop );
var pass = not ^ !!found;
if ( inplace && found != null ) {
if ( pass ) {
anyFound = true;
} else {
curLoop[i] = false;
}
} else if ( pass ) {
result.push( item );
anyFound = true;
}
}
}
}
if ( found !== undefined ) {
if ( !inplace ) {
curLoop = result;
}
expr = expr.replace( Expr.match[ type ], "" );
if ( !anyFound ) {
return [];
}
break;
}
}
}
// Improper expression
if ( expr === old ) {
if ( anyFound == null ) {
Sizzle.error( expr );
} else {
break;
}
}
old = expr;
}
return curLoop;
};
Sizzle.error = function( msg ) {
throw "Syntax error, unrecognized expression: " + msg;
};
var Expr = Sizzle.selectors = {
order: [ "ID", "NAME", "TAG" ],
match: {
ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,
ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,
TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,
CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,
POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,
PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
},
leftMatch: {},
attrMap: {
"class": "className",
"for": "htmlFor"
},
attrHandle: {
href: function( elem ) {
return elem.getAttribute( "href" );
},
type: function( elem ) {
return elem.getAttribute( "type" );
}
},
relative: {
"+": function(checkSet, part){
var isPartStr = typeof part === "string",
isTag = isPartStr && !rNonWord.test( part ),
isPartStrNotTag = isPartStr && !isTag;
if ( isTag ) {
part = part.toLowerCase();
}
for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
if ( (elem = checkSet[i]) ) {
while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ?
elem || false :
elem === part;
}
}
if ( isPartStrNotTag ) {
Sizzle.filter( part, checkSet, true );
}
},
">": function( checkSet, part ) {
var elem,
isPartStr = typeof part === "string",
i = 0,
l = checkSet.length;
if ( isPartStr && !rNonWord.test( part ) ) {
part = part.toLowerCase();
for ( ; i < l; i++ ) {
elem = checkSet[i];
if ( elem ) {
var parent = elem.parentNode;
checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;
}
}
} else {
for ( ; i < l; i++ ) {
elem = checkSet[i];
if ( elem ) {
checkSet[i] = isPartStr ?
elem.parentNode :
elem.parentNode === part;
}
}
if ( isPartStr ) {
Sizzle.filter( part, checkSet, true );
}
}
},
"": function(checkSet, part, isXML){
var nodeCheck,
doneName = done++,
checkFn = dirCheck;
if ( typeof part === "string" && !rNonWord.test( part ) ) {
part = part.toLowerCase();
nodeCheck = part;
checkFn = dirNodeCheck;
}
checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML );
},
"~": function( checkSet, part, isXML ) {
var nodeCheck,
doneName = done++,
checkFn = dirCheck;
if ( typeof part === "string" && !rNonWord.test( part ) ) {
part = part.toLowerCase();
nodeCheck = part;
checkFn = dirNodeCheck;
}
checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML );
}
},
find: {
ID: function( match, context, isXML ) {
if ( typeof context.getElementById !== "undefined" && !isXML ) {
var m = context.getElementById(match[1]);
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
return m && m.parentNode ? [m] : [];
}
},
NAME: function( match, context ) {
if ( typeof context.getElementsByName !== "undefined" ) {
var ret = [],
results = context.getElementsByName( match[1] );
for ( var i = 0, l = results.length; i < l; i++ ) {
if ( results[i].getAttribute("name") === match[1] ) {
ret.push( results[i] );
}
}
return ret.length === 0 ? null : ret;
}
},
TAG: function( match, context ) {
if ( typeof context.getElementsByTagName !== "undefined" ) {
return context.getElementsByTagName( match[1] );
}
}
},
preFilter: {
CLASS: function( match, curLoop, inplace, result, not, isXML ) {
match = " " + match[1].replace( rBackslash, "" ) + " ";
if ( isXML ) {
return match;
}
for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
if ( elem ) {
if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) {
if ( !inplace ) {
result.push( elem );
}
} else if ( inplace ) {
curLoop[i] = false;
}
}
}
return false;
},
ID: function( match ) {
return match[1].replace( rBackslash, "" );
},
TAG: function( match, curLoop ) {
return match[1].replace( rBackslash, "" ).toLowerCase();
},
CHILD: function( match ) {
if ( match[1] === "nth" ) {
if ( !match[2] ) {
Sizzle.error( match[0] );
}
match[2] = match[2].replace(/^\+|\s*/g, '');
// parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec(
match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||
!/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
// calculate the numbers (first)n+(last) including if they are negative
match[2] = (test[1] + (test[2] || 1)) - 0;
match[3] = test[3] - 0;
}
else if ( match[2] ) {
Sizzle.error( match[0] );
}
// TODO: Move to normal caching system
match[0] = done++;
return match;
},
ATTR: function( match, curLoop, inplace, result, not, isXML ) {
var name = match[1] = match[1].replace( rBackslash, "" );
if ( !isXML && Expr.attrMap[name] ) {
match[1] = Expr.attrMap[name];
}
// Handle if an un-quoted value was used
match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" );
if ( match[2] === "~=" ) {
match[4] = " " + match[4] + " ";
}
return match;
},
PSEUDO: function( match, curLoop, inplace, result, not ) {
if ( match[1] === "not" ) {
// If we're dealing with a complex expression, or a simple one
if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {
match[3] = Sizzle(match[3], null, null, curLoop);
} else {
var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
if ( !inplace ) {
result.push.apply( result, ret );
}
return false;
}
} else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
return true;
}
return match;
},
POS: function( match ) {
match.unshift( true );
return match;
}
},
filters: {
enabled: function( elem ) {
return elem.disabled === false && elem.type !== "hidden";
},
disabled: function( elem ) {
return elem.disabled === true;
},
checked: function( elem ) {
return elem.checked === true;
},
selected: function( elem ) {
// Accessing this property makes selected-by-default
// options in Safari work properly
if ( elem.parentNode ) {
elem.parentNode.selectedIndex;
}
return elem.selected === true;
},
parent: function( elem ) {
return !!elem.firstChild;
},
empty: function( elem ) {
return !elem.firstChild;
},
has: function( elem, i, match ) {
return !!Sizzle( match[3], elem ).length;
},
header: function( elem ) {
return (/h\d/i).test( elem.nodeName );
},
text: function( elem ) {
var attr = elem.getAttribute( "type" ), type = elem.type;
// IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
// use getAttribute instead to test this case
return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null );
},
radio: function( elem ) {
return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type;
},
checkbox: function( elem ) {
return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type;
},
file: function( elem ) {
return elem.nodeName.toLowerCase() === "input" && "file" === elem.type;
},
password: function( elem ) {
return elem.nodeName.toLowerCase() === "input" && "password" === elem.type;
},
submit: function( elem ) {
var name = elem.nodeName.toLowerCase();
return (name === "input" || name === "button") && "submit" === elem.type;
},
image: function( elem ) {
return elem.nodeName.toLowerCase() === "input" && "image" === elem.type;
},
reset: function( elem ) {
var name = elem.nodeName.toLowerCase();
return (name === "input" || name === "button") && "reset" === elem.type;
},
button: function( elem ) {
var name = elem.nodeName.toLowerCase();
return name === "input" && "button" === elem.type || name === "button";
},
input: function( elem ) {
return (/input|select|textarea|button/i).test( elem.nodeName );
},
focus: function( elem ) {
return elem === elem.ownerDocument.activeElement;
}
},
setFilters: {
first: function( elem, i ) {
return i === 0;
},
last: function( elem, i, match, array ) {
return i === array.length - 1;
},
even: function( elem, i ) {
return i % 2 === 0;
},
odd: function( elem, i ) {
return i % 2 === 1;
},
lt: function( elem, i, match ) {
return i < match[3] - 0;
},
gt: function( elem, i, match ) {
return i > match[3] - 0;
},
nth: function( elem, i, match ) {
return match[3] - 0 === i;
},
eq: function( elem, i, match ) {
return match[3] - 0 === i;
}
},
filter: {
PSEUDO: function( elem, match, i, array ) {
var name = match[1],
filter = Expr.filters[ name ];
if ( filter ) {
return filter( elem, i, match, array );
} else if ( name === "contains" ) {
return (elem.textContent || elem.innerText || Sizzle.getText([ elem ]) || "").indexOf(match[3]) >= 0;
} else if ( name === "not" ) {
var not = match[3];
for ( var j = 0, l = not.length; j < l; j++ ) {
if ( not[j] === elem ) {
return false;
}
}
return true;
} else {
Sizzle.error( name );
}
},
CHILD: function( elem, match ) {
var type = match[1],
node = elem;
switch ( type ) {
case "only":
case "first":
while ( (node = node.previousSibling) ) {
if ( node.nodeType === 1 ) {
return false;
}
}
if ( type === "first" ) {
return true;
}
node = elem;
case "last":
while ( (node = node.nextSibling) ) {
if ( node.nodeType === 1 ) {
return false;
}
}
return true;
case "nth":
var first = match[2],
last = match[3];
if ( first === 1 && last === 0 ) {
return true;
}
var doneName = match[0],
parent = elem.parentNode;
if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {
var count = 0;
for ( node = parent.firstChild; node; node = node.nextSibling ) {
if ( node.nodeType === 1 ) {
node.nodeIndex = ++count;
}
}
parent.sizcache = doneName;
}
var diff = elem.nodeIndex - last;
if ( first === 0 ) {
return diff === 0;
} else {
return ( diff % first === 0 && diff / first >= 0 );
}
}
},
ID: function( elem, match ) {
return elem.nodeType === 1 && elem.getAttribute("id") === match;
},
TAG: function( elem, match ) {
return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match;
},
CLASS: function( elem, match ) {
return (" " + (elem.className || elem.getAttribute("class")) + " ")
.indexOf( match ) > -1;
},
ATTR: function( elem, match ) {
var name = match[1],
result = Expr.attrHandle[ name ] ?
Expr.attrHandle[ name ]( elem ) :
elem[ name ] != null ?
elem[ name ] :
elem.getAttribute( name ),
value = result + "",
type = match[2],
check = match[4];
return result == null ?
type === "!=" :
type === "=" ?
value === check :
type === "*=" ?
value.indexOf(check) >= 0 :
type === "~=" ?
(" " + value + " ").indexOf(check) >= 0 :
!check ?
value && result !== false :
type === "!=" ?
value !== check :
type === "^=" ?
value.indexOf(check) === 0 :
type === "$=" ?
value.substr(value.length - check.length) === check :
type === "|=" ?
value === check || value.substr(0, check.length + 1) === check + "-" :
false;
},
POS: function( elem, match, i, array ) {
var name = match[2],
filter = Expr.setFilters[ name ];
if ( filter ) {
return filter( elem, i, match, array );
}
}
}
};
var origPOS = Expr.match.POS,
fescape = function(all, num){
return "\\" + (num - 0 + 1);
};
for ( var type in Expr.match ) {
Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );
Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) );
}
var makeArray = function( array, results ) {
array = Array.prototype.slice.call( array, 0 );
if ( results ) {
results.push.apply( results, array );
return results;
}
return array;
};
// Perform a simple check to determine if the browser is capable of
// converting a NodeList to an array using builtin methods.
// Also verifies that the returned array holds DOM nodes
// (which is not the case in the Blackberry browser)
try {
Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;
// Provide a fallback method if it does not work
} catch( e ) {
makeArray = function( array, results ) {
var i = 0,
ret = results || [];
if ( toString.call(array) === "[object Array]" ) {
Array.prototype.push.apply( ret, array );
} else {
if ( typeof array.length === "number" ) {
for ( var l = array.length; i < l; i++ ) {
ret.push( array[i] );
}
} else {
for ( ; array[i]; i++ ) {
ret.push( array[i] );
}
}
}
return ret;
};
}
var sortOrder, siblingCheck;
if ( document.documentElement.compareDocumentPosition ) {
sortOrder = function( a, b ) {
if ( a === b ) {
hasDuplicate = true;
return 0;
}
if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {
return a.compareDocumentPosition ? -1 : 1;
}
return a.compareDocumentPosition(b) & 4 ? -1 : 1;
};
} else {
sortOrder = function( a, b ) {
// The nodes are identical, we can exit early
if ( a === b ) {
hasDuplicate = true;
return 0;
// Fallback to using sourceIndex (in IE) if it's available on both nodes
} else if ( a.sourceIndex && b.sourceIndex ) {
return a.sourceIndex - b.sourceIndex;
}
var al, bl,
ap = [],
bp = [],
aup = a.parentNode,
bup = b.parentNode,
cur = aup;
// If the nodes are siblings (or identical) we can do a quick check
if ( aup === bup ) {
return siblingCheck( a, b );
// If no parents were found then the nodes are disconnected
} else if ( !aup ) {
return -1;
} else if ( !bup ) {
return 1;
}
// Otherwise they're somewhere else in the tree so we need
// to build up a full list of the parentNodes for comparison
while ( cur ) {
ap.unshift( cur );
cur = cur.parentNode;
}
cur = bup;
while ( cur ) {
bp.unshift( cur );
cur = cur.parentNode;
}
al = ap.length;
bl = bp.length;
// Start walking down the tree looking for a discrepancy
for ( var i = 0; i < al && i < bl; i++ ) {
if ( ap[i] !== bp[i] ) {
return siblingCheck( ap[i], bp[i] );
}
}
// We ended someplace up the tree so do a sibling check
return i === al ?
siblingCheck( a, bp[i], -1 ) :
siblingCheck( ap[i], b, 1 );
};
siblingCheck = function( a, b, ret ) {
if ( a === b ) {
return ret;
}
var cur = a.nextSibling;
while ( cur ) {
if ( cur === b ) {
return -1;
}
cur = cur.nextSibling;
}
return 1;
};
}
// Utility function for retreiving the text value of an array of DOM nodes
Sizzle.getText = function( elems ) {
var ret = "", elem;
for ( var i = 0; elems[i]; i++ ) {
elem = elems[i];
// Get the text from text nodes and CDATA nodes
if ( elem.nodeType === 3 || elem.nodeType === 4 ) {
ret += elem.nodeValue;
// Traverse everything else, except comment nodes
} else if ( elem.nodeType !== 8 ) {
ret += Sizzle.getText( elem.childNodes );
}
}
return ret;
};
// Check to see if the browser returns elements by name when
// querying by getElementById (and provide a workaround)
(function(){
// We're going to inject a fake input element with a specified name
var form = document.createElement("div"),
id = "script" + (new Date()).getTime(),
root = document.documentElement;
form.innerHTML = "<a name='" + id + "'/>";
// Inject it into the root element, check its status, and remove it quickly
root.insertBefore( form, root.firstChild );
// The workaround has to do additional checks after a getElementById
// Which slows things down for other browsers (hence the branching)
if ( document.getElementById( id ) ) {
Expr.find.ID = function( match, context, isXML ) {
if ( typeof context.getElementById !== "undefined" && !isXML ) {
var m = context.getElementById(match[1]);
return m ?
m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ?
[m] :
undefined :
[];
}
};
Expr.filter.ID = function( elem, match ) {
var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
return elem.nodeType === 1 && node && node.nodeValue === match;
};
}
root.removeChild( form );
// release memory in IE
root = form = null;
})();
(function(){
// Check to see if the browser returns only elements
// when doing getElementsByTagName("*")
// Create a fake element
var div = document.createElement("div");
div.appendChild( document.createComment("") );
// Make sure no comments are found
if ( div.getElementsByTagName("*").length > 0 ) {
Expr.find.TAG = function( match, context ) {
var results = context.getElementsByTagName( match[1] );
// Filter out possible comments
if ( match[1] === "*" ) {
var tmp = [];
for ( var i = 0; results[i]; i++ ) {
if ( results[i].nodeType === 1 ) {
tmp.push( results[i] );
}
}
results = tmp;
}
return results;
};
}
// Check to see if an attribute returns normalized href attributes
div.innerHTML = "<a href='#'></a>";
if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
div.firstChild.getAttribute("href") !== "#" ) {
Expr.attrHandle.href = function( elem ) {
return elem.getAttribute( "href", 2 );
};
}
// release memory in IE
div = null;
})();
if ( document.querySelectorAll ) {
(function(){
var oldSizzle = Sizzle,
div = document.createElement("div"),
id = "__sizzle__";
div.innerHTML = "<p class='TEST'></p>";
// Safari can't handle uppercase or unicode characters when
// in quirks mode.
if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
return;
}
Sizzle = function( query, context, extra, seed ) {
context = context || document;
// Only use querySelectorAll on non-XML documents
// (ID selectors don't work in non-HTML documents)
if ( !seed && !Sizzle.isXML(context) ) {
// See if we find a selector to speed up
var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query );
if ( match && (context.nodeType === 1 || context.nodeType === 9) ) {
// Speed-up: Sizzle("TAG")
if ( match[1] ) {
return makeArray( context.getElementsByTagName( query ), extra );
// Speed-up: Sizzle(".CLASS")
} else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) {
return makeArray( context.getElementsByClassName( match[2] ), extra );
}
}
if ( context.nodeType === 9 ) {
// Speed-up: Sizzle("body")
// The body element only exists once, optimize finding it
if ( query === "body" && context.body ) {
return makeArray( [ context.body ], extra );
// Speed-up: Sizzle("#ID")
} else if ( match && match[3] ) {
var elem = context.getElementById( match[3] );
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
if ( elem && elem.parentNode ) {
// Handle the case where IE and Opera return items
// by name instead of ID
if ( elem.id === match[3] ) {
return makeArray( [ elem ], extra );
}
} else {
return makeArray( [], extra );
}
}
try {
return makeArray( context.querySelectorAll(query), extra );
} catch(qsaError) {}
// qSA works strangely on Element-rooted queries
// We can work around this by specifying an extra ID on the root
// and working up from there (Thanks to Andrew Dupont for the technique)
// IE 8 doesn't work on object elements
} else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
var oldContext = context,
old = context.getAttribute( "id" ),
nid = old || id,
hasParent = context.parentNode,
relativeHierarchySelector = /^\s*[+~]/.test( query );
if ( !old ) {
context.setAttribute( "id", nid );
} else {
nid = nid.replace( /'/g, "\\$&" );
}
if ( relativeHierarchySelector && hasParent ) {
context = context.parentNode;
}
try {
if ( !relativeHierarchySelector || hasParent ) {
return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra );
}
} catch(pseudoError) {
} finally {
if ( !old ) {
oldContext.removeAttribute( "id" );
}
}
}
}
return oldSizzle(query, context, extra, seed);
};
for ( var prop in oldSizzle ) {
Sizzle[ prop ] = oldSizzle[ prop ];
}
// release memory in IE
div = null;
})();
}
(function(){
var html = document.documentElement,
matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector;
if ( matches ) {
// Check to see if it's possible to do matchesSelector
// on a disconnected node (IE 9 fails this)
var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ),
pseudoWorks = false;
try {
// This should fail with an exception
// Gecko does not error, returns false instead
matches.call( document.documentElement, "[test!='']:sizzle" );
} catch( pseudoError ) {
pseudoWorks = true;
}
Sizzle.matchesSelector = function( node, expr ) {
// Make sure that attribute selectors are quoted
expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
if ( !Sizzle.isXML( node ) ) {
try {
if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {
var ret = matches.call( node, expr );
// IE 9's matchesSelector returns false on disconnected nodes
if ( ret || !disconnectedMatch ||
// As well, disconnected nodes are said to be in a document
// fragment in IE 9, so check for that
node.document && node.document.nodeType !== 11 ) {
return ret;
}
}
} catch(e) {}
}
return Sizzle(expr, null, null, [node]).length > 0;
};
}
})();
(function(){
var div = document.createElement("div");
div.innerHTML = "<div class='test e'></div><div class='test'></div>";
// Opera can't find a second classname (in 9.6)
// Also, make sure that getElementsByClassName actually exists
if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) {
return;
}
// Safari caches class attributes, doesn't catch changes (in 3.2)
div.lastChild.className = "e";
if ( div.getElementsByClassName("e").length === 1 ) {
return;
}
Expr.order.splice(1, 0, "CLASS");
Expr.find.CLASS = function( match, context, isXML ) {
if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
return context.getElementsByClassName(match[1]);
}
};
// release memory in IE
div = null;
})();
function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
for ( var i = 0, l = checkSet.length; i < l; i++ ) {
var elem = checkSet[i];
if ( elem ) {
var match = false;
elem = elem[dir];
while ( elem ) {
if ( elem.sizcache === doneName ) {
match = checkSet[elem.sizset];
break;
}
if ( elem.nodeType === 1 && !isXML ){
elem.sizcache = doneName;
elem.sizset = i;
}
if ( elem.nodeName.toLowerCase() === cur ) {
match = elem;
break;
}
elem = elem[dir];
}
checkSet[i] = match;
}
}
}
function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
for ( var i = 0, l = checkSet.length; i < l; i++ ) {
var elem = checkSet[i];
if ( elem ) {
var match = false;
elem = elem[dir];
while ( elem ) {
if ( elem.sizcache === doneName ) {
match = checkSet[elem.sizset];
break;
}
if ( elem.nodeType === 1 ) {
if ( !isXML ) {
elem.sizcache = doneName;
elem.sizset = i;
}
if ( typeof cur !== "string" ) {
if ( elem === cur ) {
match = true;
break;
}
} else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
match = elem;
break;
}
}
elem = elem[dir];
}
checkSet[i] = match;
}
}
}
if ( document.documentElement.contains ) {
Sizzle.contains = function( a, b ) {
return a !== b && (a.contains ? a.contains(b) : true);
};
} else if ( document.documentElement.compareDocumentPosition ) {
Sizzle.contains = function( a, b ) {
return !!(a.compareDocumentPosition(b) & 16);
};
} else {
Sizzle.contains = function() {
return false;
};
}
Sizzle.isXML = function( elem ) {
// documentElement is verified for cases where it doesn't yet exist
// (such as loading iframes in IE - #4833)
var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
return documentElement ? documentElement.nodeName !== "HTML" : false;
};
var posProcess = function( selector, context ) {
var match,
tmpSet = [],
later = "",
root = context.nodeType ? [context] : context;
// Position selectors must be done after the filter
// And so must :not(positional) so we move all PSEUDOs to the end
while ( (match = Expr.match.PSEUDO.exec( selector )) ) {
later += match[0];
selector = selector.replace( Expr.match.PSEUDO, "" );
}
selector = Expr.relative[selector] ? selector + "*" : selector;
for ( var i = 0, l = root.length; i < l; i++ ) {
Sizzle( selector, root[i], tmpSet );
}
return Sizzle.filter( later, tmpSet );
};
// EXPOSE
jQuery.find = Sizzle;
jQuery.expr = Sizzle.selectors;
jQuery.expr[":"] = jQuery.expr.filters;
jQuery.unique = Sizzle.uniqueSort;
jQuery.text = Sizzle.getText;
jQuery.isXMLDoc = Sizzle.isXML;
jQuery.contains = Sizzle.contains;
})();
var runtil = /Until$/,
rparentsprev = /^(?:parents|prevUntil|prevAll)/,
// Note: This RegExp should be improved, or likely pulled from Sizzle
rmultiselector = /,/,
isSimple = /^.[^:#\[\.,]*$/,
slice = Array.prototype.slice,
POS = jQuery.expr.match.POS,
// methods guaranteed to produce a unique set when starting from a unique set
guaranteedUnique = {
children: true,
contents: true,
next: true,
prev: true
};
jQuery.fn.extend({
find: function( selector ) {
var self = this,
i, l;
if ( typeof selector !== "string" ) {
return jQuery( selector ).filter(function() {
for ( i = 0, l = self.length; i < l; i++ ) {
if ( jQuery.contains( self[ i ], this ) ) {
return true;
}
}
});
}
var ret = this.pushStack( "", "find", selector ),
length, n, r;
for ( i = 0, l = this.length; i < l; i++ ) {
length = ret.length;
jQuery.find( selector, this[i], ret );
if ( i > 0 ) {
// Make sure that the results are unique
for ( n = length; n < ret.length; n++ ) {
for ( r = 0; r < length; r++ ) {
if ( ret[r] === ret[n] ) {
ret.splice(n--, 1);
break;
}
}
}
}
}
return ret;
},
has: function( target ) {
var targets = jQuery( target );
return this.filter(function() {
for ( var i = 0, l = targets.length; i < l; i++ ) {
if ( jQuery.contains( this, targets[i] ) ) {
return true;
}
}
});
},
not: function( selector ) {
return this.pushStack( winnow(this, selector, false), "not", selector);
},
filter: function( selector ) {
return this.pushStack( winnow(this, selector, true), "filter", selector );
},
is: function( selector ) {
return !!selector && ( typeof selector === "string" ?
jQuery.filter( selector, this ).length > 0 :
this.filter( selector ).length > 0 );
},
closest: function( selectors, context ) {
var ret = [], i, l, cur = this[0];
// Array
if ( jQuery.isArray( selectors ) ) {
var match, selector,
matches = {},
level = 1;
if ( cur && selectors.length ) {
for ( i = 0, l = selectors.length; i < l; i++ ) {
selector = selectors[i];
if ( !matches[ selector ] ) {
matches[ selector ] = POS.test( selector ) ?
jQuery( selector, context || this.context ) :
selector;
}
}
while ( cur && cur.ownerDocument && cur !== context ) {
for ( selector in matches ) {
match = matches[ selector ];
if ( match.jquery ? match.index( cur ) > -1 : jQuery( cur ).is( match ) ) {
ret.push({ selector: selector, elem: cur, level: level });
}
}
cur = cur.parentNode;
level++;
}
}
return ret;
}
// String
var pos = POS.test( selectors ) || typeof selectors !== "string" ?
jQuery( selectors, context || this.context ) :
0;
for ( i = 0, l = this.length; i < l; i++ ) {
cur = this[i];
while ( cur ) {
if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
ret.push( cur );
break;
} else {
cur = cur.parentNode;
if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) {
break;
}
}
}
}
ret = ret.length > 1 ? jQuery.unique( ret ) : ret;
return this.pushStack( ret, "closest", selectors );
},
// Determine the position of an element within
// the matched set of elements
index: function( elem ) {
// No argument, return index in parent
if ( !elem ) {
return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1;
}
// index in selector
if ( typeof elem === "string" ) {
return jQuery.inArray( this[0], jQuery( elem ) );
}
// Locate the position of the desired element
return jQuery.inArray(
// If it receives a jQuery object, the first element is used
elem.jquery ? elem[0] : elem, this );
},
add: function( selector, context ) {
var set = typeof selector === "string" ?
jQuery( selector, context ) :
jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
all = jQuery.merge( this.get(), set );
return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?
all :
jQuery.unique( all ) );
},
andSelf: function() {
return this.add( this.prevObject );
}
});
// A painfully simple check to see if an element is disconnected
// from a document (should be improved, where feasible).
function isDisconnected( node ) {
return !node || !node.parentNode || node.parentNode.nodeType === 11;
}
jQuery.each({
parent: function( elem ) {
var parent = elem.parentNode;
return parent && parent.nodeType !== 11 ? parent : null;
},
parents: function( elem ) {
return jQuery.dir( elem, "parentNode" );
},
parentsUntil: function( elem, i, until ) {
return jQuery.dir( elem, "parentNode", until );
},
next: function( elem ) {
return jQuery.nth( elem, 2, "nextSibling" );
},
prev: function( elem ) {
return jQuery.nth( elem, 2, "previousSibling" );
},
nextAll: function( elem ) {
return jQuery.dir( elem, "nextSibling" );
},
prevAll: function( elem ) {
return jQuery.dir( elem, "previousSibling" );
},
nextUntil: function( elem, i, until ) {
return jQuery.dir( elem, "nextSibling", until );
},
prevUntil: function( elem, i, until ) {
return jQuery.dir( elem, "previousSibling", until );
},
siblings: function( elem ) {
return jQuery.sibling( elem.parentNode.firstChild, elem );
},
children: function( elem ) {
return jQuery.sibling( elem.firstChild );
},
contents: function( elem ) {
return jQuery.nodeName( elem, "iframe" ) ?
elem.contentDocument || elem.contentWindow.document :
jQuery.makeArray( elem.childNodes );
}
}, function( name, fn ) {
jQuery.fn[ name ] = function( until, selector ) {
var ret = jQuery.map( this, fn, until ),
// The variable 'args' was introduced in
// https://github.com/jquery/jquery/commit/52a0238
// to work around a bug in Chrome 10 (Dev) and should be removed when the bug is fixed.
// http://code.google.com/p/v8/issues/detail?id=1050
args = slice.call(arguments);
if ( !runtil.test( name ) ) {
selector = until;
}
if ( selector && typeof selector === "string" ) {
ret = jQuery.filter( selector, ret );
}
ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;
if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) {
ret = ret.reverse();
}
return this.pushStack( ret, name, args.join(",") );
};
});
jQuery.extend({
filter: function( expr, elems, not ) {
if ( not ) {
expr = ":not(" + expr + ")";
}
return elems.length === 1 ?
jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
jQuery.find.matches(expr, elems);
},
dir: function( elem, dir, until ) {
var matched = [],
cur = elem[ dir ];
while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
if ( cur.nodeType === 1 ) {
matched.push( cur );
}
cur = cur[dir];
}
return matched;
},
nth: function( cur, result, dir, elem ) {
result = result || 1;
var num = 0;
for ( ; cur; cur = cur[dir] ) {
if ( cur.nodeType === 1 && ++num === result ) {
break;
}
}
return cur;
},
sibling: function( n, elem ) {
var r = [];
for ( ; n; n = n.nextSibling ) {
if ( n.nodeType === 1 && n !== elem ) {
r.push( n );
}
}
return r;
}
});
// Implement the identical functionality for filter and not
function winnow( elements, qualifier, keep ) {
// Can't pass null or undefined to indexOf in Firefox 4
// Set to 0 to skip string check
qualifier = qualifier || 0;
if ( jQuery.isFunction( qualifier ) ) {
return jQuery.grep(elements, function( elem, i ) {
var retVal = !!qualifier.call( elem, i, elem );
return retVal === keep;
});
} else if ( qualifier.nodeType ) {
return jQuery.grep(elements, function( elem, i ) {
return (elem === qualifier) === keep;
});
} else if ( typeof qualifier === "string" ) {
var filtered = jQuery.grep(elements, function( elem ) {
return elem.nodeType === 1;
});
if ( isSimple.test( qualifier ) ) {
return jQuery.filter(qualifier, filtered, !keep);
} else {
qualifier = jQuery.filter( qualifier, filtered );
}
}
return jQuery.grep(elements, function( elem, i ) {
return (jQuery.inArray( elem, qualifier ) >= 0) === keep;
});
}
var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
rleadingWhitespace = /^\s+/,
rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,
rtagName = /<([\w:]+)/,
rtbody = /<tbody/i,
rhtml = /<|&#?\w+;/,
rnocache = /<(?:script|object|embed|option|style)/i,
// checked="checked" or checked
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
rscriptType = /\/(java|ecma)script/i,
rcleanScript = /^\s*<!(?:\[CDATA\[|\-\-)/,
wrapMap = {
option: [ 1, "<select multiple='multiple'>", "</select>" ],
legend: [ 1, "<fieldset>", "</fieldset>" ],
thead: [ 1, "<table>", "</table>" ],
tr: [ 2, "<table><tbody>", "</tbody></table>" ],
td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
area: [ 1, "<map>", "</map>" ],
_default: [ 0, "", "" ]
};
wrapMap.optgroup = wrapMap.option;
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
wrapMap.th = wrapMap.td;
// IE can't serialize <link> and <script> tags normally
if ( !jQuery.support.htmlSerialize ) {
wrapMap._default = [ 1, "div<div>", "</div>" ];
}
jQuery.fn.extend({
text: function( text ) {
if ( jQuery.isFunction(text) ) {
return this.each(function(i) {
var self = jQuery( this );
self.text( text.call(this, i, self.text()) );
});
}
if ( typeof text !== "object" && text !== undefined ) {
return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
}
return jQuery.text( this );
},
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 ) {
return this.each(function() {
jQuery( this ).wrapAll( html );
});
},
unwrap: function() {
return this.parent().each(function() {
if ( !jQuery.nodeName( this, "body" ) ) {
jQuery( this ).replaceWith( this.childNodes );
}
}).end();
},
append: function() {
return this.domManip(arguments, true, function( elem ) {
if ( this.nodeType === 1 ) {
this.appendChild( elem );
}
});
},
prepend: function() {
return this.domManip(arguments, true, function( elem ) {
if ( this.nodeType === 1 ) {
this.insertBefore( elem, this.firstChild );
}
});
},
before: function() {
if ( this[0] && this[0].parentNode ) {
return this.domManip(arguments, false, function( elem ) {
this.parentNode.insertBefore( elem, this );
});
} else if ( arguments.length ) {
var set = jQuery(arguments[0]);
set.push.apply( set, this.toArray() );
return this.pushStack( set, "before", arguments );
}
},
after: function() {
if ( this[0] && this[0].parentNode ) {
return this.domManip(arguments, false, function( elem ) {
this.parentNode.insertBefore( elem, this.nextSibling );
});
} else if ( arguments.length ) {
var set = this.pushStack( this, "after", arguments );
set.push.apply( set, jQuery(arguments[0]).toArray() );
return set;
}
},
// keepData is for internal use only--do not document
remove: function( selector, keepData ) {
for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
if ( !selector || jQuery.filter( selector, [ elem ] ).length ) {
if ( !keepData && elem.nodeType === 1 ) {
jQuery.cleanData( elem.getElementsByTagName("*") );
jQuery.cleanData( [ elem ] );
}
if ( elem.parentNode ) {
elem.parentNode.removeChild( elem );
}
}
}
return this;
},
empty: function() {
for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
// Remove element nodes and prevent memory leaks
if ( elem.nodeType === 1 ) {
jQuery.cleanData( elem.getElementsByTagName("*") );
}
// Remove any remaining nodes
while ( elem.firstChild ) {
elem.removeChild( elem.firstChild );
}
}
return this;
},
clone: function( dataAndEvents, deepDataAndEvents ) {
dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
return this.map( function () {
return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
});
},
html: function( value ) {
if ( value === undefined ) {
return this[0] && this[0].nodeType === 1 ?
this[0].innerHTML.replace(rinlinejQuery, "") :
null;
// See if we can take a shortcut and just use innerHTML
} else if ( typeof value === "string" && !rnocache.test( value ) &&
(jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) &&
!wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) {
value = value.replace(rxhtmlTag, "<$1></$2>");
try {
for ( var i = 0, l = this.length; i < l; i++ ) {
// Remove element nodes and prevent memory leaks
if ( this[i].nodeType === 1 ) {
jQuery.cleanData( this[i].getElementsByTagName("*") );
this[i].innerHTML = value;
}
}
// If using innerHTML throws an exception, use the fallback method
} catch(e) {
this.empty().append( value );
}
} else if ( jQuery.isFunction( value ) ) {
this.each(function(i){
var self = jQuery( this );
self.html( value.call(this, i, self.html()) );
});
} else {
this.empty().append( value );
}
return this;
},
replaceWith: function( value ) {
if ( this[0] && this[0].parentNode ) {
// Make sure that the elements are removed from the DOM before they are inserted
// this can help fix replacing a parent with child elements
if ( jQuery.isFunction( value ) ) {
return this.each(function(i) {
var self = jQuery(this), old = self.html();
self.replaceWith( value.call( this, i, old ) );
});
}
if ( typeof value !== "string" ) {
value = jQuery( value ).detach();
}
return this.each(function() {
var next = this.nextSibling,
parent = this.parentNode;
jQuery( this ).remove();
if ( next ) {
jQuery(next).before( value );
} else {
jQuery(parent).append( value );
}
});
} else {
return this.length ?
this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) :
this;
}
},
detach: function( selector ) {
return this.remove( selector, true );
},
domManip: function( args, table, callback ) {
var results, first, fragment, parent,
value = args[0],
scripts = [];
// We can't cloneNode fragments that contain checked, in WebKit
if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) {
return this.each(function() {
jQuery(this).domManip( args, table, callback, true );
});
}
if ( jQuery.isFunction(value) ) {
return this.each(function(i) {
var self = jQuery(this);
args[0] = value.call(this, i, table ? self.html() : undefined);
self.domManip( args, table, callback );
});
}
if ( this[0] ) {
parent = value && value.parentNode;
// If we're in a fragment, just use that instead of building a new one
if ( jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) {
results = { fragment: parent };
} else {
results = jQuery.buildFragment( args, this, scripts );
}
fragment = results.fragment;
if ( fragment.childNodes.length === 1 ) {
first = fragment = fragment.firstChild;
} else {
first = fragment.firstChild;
}
if ( first ) {
table = table && jQuery.nodeName( first, "tr" );
for ( var i = 0, l = this.length, lastIndex = l - 1; i < l; i++ ) {
callback.call(
table ?
root(this[i], first) :
this[i],
// Make sure that we do not leak memory by inadvertently discarding
// the original fragment (which might have attached data) instead of
// using it; in addition, use the original fragment object for the last
// item instead of first because it can end up being emptied incorrectly
// in certain situations (Bug #8070).
// Fragments from the fragment cache must always be cloned and never used
// in place.
results.cacheable || (l > 1 && i < lastIndex) ?
jQuery.clone( fragment, true, true ) :
fragment
);
}
}
if ( scripts.length ) {
jQuery.each( scripts, evalScript );
}
}
return this;
}
});
function root( elem, cur ) {
return jQuery.nodeName(elem, "table") ?
(elem.getElementsByTagName("tbody")[0] ||
elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
elem;
}
function cloneCopyEvent( src, dest ) {
if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
return;
}
var internalKey = jQuery.expando,
oldData = jQuery.data( src ),
curData = jQuery.data( dest, oldData );
// Switch to use the internal data object, if it exists, for the next
// stage of data copying
if ( (oldData = oldData[ internalKey ]) ) {
var events = oldData.events;
curData = curData[ internalKey ] = jQuery.extend({}, oldData);
if ( events ) {
delete curData.handle;
curData.events = {};
for ( var type in events ) {
for ( var i = 0, l = events[ type ].length; i < l; i++ ) {
jQuery.event.add( dest, type + ( events[ type ][ i ].namespace ? "." : "" ) + events[ type ][ i ].namespace, events[ type ][ i ], events[ type ][ i ].data );
}
}
}
}
}
function cloneFixAttributes( src, dest ) {
var nodeName;
// We do not need to do anything for non-Elements
if ( dest.nodeType !== 1 ) {
return;
}
// clearAttributes removes the attributes, which we don't want,
// but also removes the attachEvent events, which we *do* want
if ( dest.clearAttributes ) {
dest.clearAttributes();
}
// mergeAttributes, in contrast, only merges back on the
// original attributes, not the events
if ( dest.mergeAttributes ) {
dest.mergeAttributes( src );
}
nodeName = dest.nodeName.toLowerCase();
// IE6-8 fail to clone children inside object elements that use
// the proprietary classid attribute value (rather than the type
// attribute) to identify the type of content to display
if ( nodeName === "object" ) {
dest.outerHTML = src.outerHTML;
} else if ( nodeName === "input" && (src.type === "checkbox" || src.type === "radio") ) {
// IE6-8 fails to persist the checked state of a cloned checkbox
// or radio button. Worse, IE6-7 fail to give the cloned element
// a checked appearance if the defaultChecked value isn't also set
if ( src.checked ) {
dest.defaultChecked = dest.checked = src.checked;
}
// IE6-7 get confused and end up setting the value of a cloned
// checkbox/radio button to an empty string instead of "on"
if ( dest.value !== src.value ) {
dest.value = src.value;
}
// IE6-8 fails to return the selected option to the default selected
// state when cloning options
} else if ( nodeName === "option" ) {
dest.selected = src.defaultSelected;
// IE6-8 fails to set the defaultValue to the correct value when
// cloning other types of input fields
} else if ( nodeName === "input" || nodeName === "textarea" ) {
dest.defaultValue = src.defaultValue;
}
// Event data gets referenced instead of copied if the expando
// gets copied too
dest.removeAttribute( jQuery.expando );
}
jQuery.buildFragment = function( args, nodes, scripts ) {
var fragment, cacheable, cacheresults, doc;
// nodes may contain either an explicit document object,
// a jQuery collection or context object.
// If nodes[0] contains a valid object to assign to doc
if ( nodes && nodes[0] ) {
doc = nodes[0].ownerDocument || nodes[0];
}
// Ensure that an attr object doesn't incorrectly stand in as a document object
// Chrome and Firefox seem to allow this to occur and will throw exception
// Fixes #8950
if ( !doc.createDocumentFragment ) {
doc = document;
}
// Only cache "small" (1/2 KB) HTML strings that are associated with the main document
// Cloning options loses the selected state, so don't cache them
// IE 6 doesn't like it when you put <object> or <embed> elements in a fragment
// Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache
if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && doc === document &&
args[0].charAt(0) === "<" && !rnocache.test( args[0] ) && (jQuery.support.checkClone || !rchecked.test( args[0] )) ) {
cacheable = true;
cacheresults = jQuery.fragments[ args[0] ];
if ( cacheresults && cacheresults !== 1 ) {
fragment = cacheresults;
}
}
if ( !fragment ) {
fragment = doc.createDocumentFragment();
jQuery.clean( args, doc, fragment, scripts );
}
if ( cacheable ) {
jQuery.fragments[ args[0] ] = cacheresults ? fragment : 1;
}
return { fragment: fragment, cacheable: cacheable };
};
jQuery.fragments = {};
jQuery.each({
appendTo: "append",
prependTo: "prepend",
insertBefore: "before",
insertAfter: "after",
replaceAll: "replaceWith"
}, function( name, original ) {
jQuery.fn[ name ] = function( selector ) {
var ret = [],
insert = jQuery( selector ),
parent = this.length === 1 && this[0].parentNode;
if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {
insert[ original ]( this[0] );
return this;
} else {
for ( var i = 0, l = insert.length; i < l; i++ ) {
var elems = (i > 0 ? this.clone(true) : this).get();
jQuery( insert[i] )[ original ]( elems );
ret = ret.concat( elems );
}
return this.pushStack( ret, name, insert.selector );
}
};
});
function getAll( elem ) {
if ( "getElementsByTagName" in elem ) {
return elem.getElementsByTagName( "*" );
} else if ( "querySelectorAll" in elem ) {
return elem.querySelectorAll( "*" );
} else {
return [];
}
}
// Used in clean, fixes the defaultChecked property
function fixDefaultChecked( elem ) {
if ( elem.type === "checkbox" || elem.type === "radio" ) {
elem.defaultChecked = elem.checked;
}
}
// Finds all inputs and passes them to fixDefaultChecked
function findInputs( elem ) {
if ( jQuery.nodeName( elem, "input" ) ) {
fixDefaultChecked( elem );
} else if ( "getElementsByTagName" in elem ) {
jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked );
}
}
jQuery.extend({
clone: function( elem, dataAndEvents, deepDataAndEvents ) {
var clone = elem.cloneNode(true),
srcElements,
destElements,
i;
if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
(elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
// IE copies events bound via attachEvent when using cloneNode.
// Calling detachEvent on the clone will also remove the events
// from the original. In order to get around this, we use some
// proprietary methods to clear the events. Thanks to MooTools
// guys for this hotness.
cloneFixAttributes( elem, clone );
// Using Sizzle here is crazy slow, so we use getElementsByTagName
// instead
srcElements = getAll( elem );
destElements = getAll( clone );
// Weird iteration because IE will replace the length property
// with an element if you are cloning the body and one of the
// elements on the page has a name or id of "length"
for ( i = 0; srcElements[i]; ++i ) {
// Ensure that the destination node is not null; Fixes #9587
if ( destElements[i] ) {
cloneFixAttributes( srcElements[i], destElements[i] );
}
}
}
// Copy the events from the original to the clone
if ( dataAndEvents ) {
cloneCopyEvent( elem, clone );
if ( deepDataAndEvents ) {
srcElements = getAll( elem );
destElements = getAll( clone );
for ( i = 0; srcElements[i]; ++i ) {
cloneCopyEvent( srcElements[i], destElements[i] );
}
}
}
srcElements = destElements = null;
// Return the cloned set
return clone;
},
clean: function( elems, context, fragment, scripts ) {
var checkScriptType;
context = context || document;
// !context.createElement fails in IE with an error but returns typeof 'object'
if ( typeof context.createElement === "undefined" ) {
context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
}
var ret = [], j;
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
if ( typeof elem === "number" ) {
elem += "";
}
if ( !elem ) {
continue;
}
// Convert html string into DOM nodes
if ( typeof elem === "string" ) {
if ( !rhtml.test( elem ) ) {
elem = context.createTextNode( elem );
} else {
// Fix "XHTML"-style tags in all browsers
elem = elem.replace(rxhtmlTag, "<$1></$2>");
// Trim whitespace, otherwise indexOf won't work as expected
var tag = (rtagName.exec( elem ) || ["", ""])[1].toLowerCase(),
wrap = wrapMap[ tag ] || wrapMap._default,
depth = wrap[0],
div = context.createElement("div");
// Go to html and back, then peel off extra wrappers
div.innerHTML = wrap[1] + elem + wrap[2];
// Move to the right depth
while ( depth-- ) {
div = div.lastChild;
}
// Remove IE's autoinserted <tbody> from table fragments
if ( !jQuery.support.tbody ) {
// String was a <table>, *may* have spurious <tbody>
var hasBody = rtbody.test(elem),
tbody = tag === "table" && !hasBody ?
div.firstChild && div.firstChild.childNodes :
// String was a bare <thead> or <tfoot>
wrap[1] === "<table>" && !hasBody ?
div.childNodes :
[];
for ( j = tbody.length - 1; j >= 0 ; --j ) {
if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) {
tbody[ j ].parentNode.removeChild( tbody[ j ] );
}
}
}
// IE completely kills leading whitespace when innerHTML is used
if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild );
}
elem = div.childNodes;
}
}
// Resets defaultChecked for any radios and checkboxes
// about to be appended to the DOM in IE 6/7 (#8060)
var len;
if ( !jQuery.support.appendChecked ) {
if ( elem[0] && typeof (len = elem.length) === "number" ) {
for ( j = 0; j < len; j++ ) {
findInputs( elem[j] );
}
} else {
findInputs( elem );
}
}
if ( elem.nodeType ) {
ret.push( elem );
} else {
ret = jQuery.merge( ret, elem );
}
}
if ( fragment ) {
checkScriptType = function( elem ) {
return !elem.type || rscriptType.test( elem.type );
};
for ( i = 0; ret[i]; i++ ) {
if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
} else {
if ( ret[i].nodeType === 1 ) {
var jsTags = jQuery.grep( ret[i].getElementsByTagName( "script" ), checkScriptType );
ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
}
fragment.appendChild( ret[i] );
}
}
}
return ret;
},
cleanData: function( elems ) {
var data, id, cache = jQuery.cache, internalKey = jQuery.expando, special = jQuery.event.special,
deleteExpando = jQuery.support.deleteExpando;
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
continue;
}
id = elem[ jQuery.expando ];
if ( id ) {
data = cache[ id ] && cache[ id ][ internalKey ];
if ( data && data.events ) {
for ( var type in data.events ) {
if ( special[ type ] ) {
jQuery.event.remove( elem, type );
// This is a shortcut to avoid jQuery.event.remove's overhead
} else {
jQuery.removeEvent( elem, type, data.handle );
}
}
// Null the DOM reference to avoid IE6/7/8 leak (#7054)
if ( data.handle ) {
data.handle.elem = null;
}
}
if ( deleteExpando ) {
delete elem[ jQuery.expando ];
} else if ( elem.removeAttribute ) {
elem.removeAttribute( jQuery.expando );
}
delete cache[ id ];
}
}
}
});
function evalScript( i, elem ) {
if ( elem.src ) {
jQuery.ajax({
url: elem.src,
async: false,
dataType: "script"
});
} else {
jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "/*$0*/" ) );
}
if ( elem.parentNode ) {
elem.parentNode.removeChild( elem );
}
}
var ralpha = /alpha\([^)]*\)/i,
ropacity = /opacity=([^)]*)/,
// fixed for IE9, see #8346
rupper = /([A-Z]|^ms)/g,
rnumpx = /^-?\d+(?:px)?$/i,
rnum = /^-?\d/,
rrelNum = /^([\-+])=([\-+.\de]+)/,
cssShow = { position: "absolute", visibility: "hidden", display: "block" },
cssWidth = [ "Left", "Right" ],
cssHeight = [ "Top", "Bottom" ],
curCSS,
getComputedStyle,
currentStyle;
jQuery.fn.css = function( name, value ) {
// Setting 'undefined' is a no-op
if ( arguments.length === 2 && value === undefined ) {
return this;
}
return jQuery.access( this, name, value, true, function( elem, name, value ) {
return value !== undefined ?
jQuery.style( elem, name, value ) :
jQuery.css( elem, name );
});
};
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", "opacity" );
return ret === "" ? "1" : ret;
} else {
return elem.style.opacity;
}
}
}
},
// Exclude the following css properties to add px
cssNumber: {
"fillOpacity": true,
"fontWeight": true,
"lineHeight": true,
"opacity": true,
"orphans": true,
"widows": true,
"zIndex": true,
"zoom": true
},
// Add in properties whose names you wish to fix before
// setting or getting the value
cssProps: {
// normalize float css property
"float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
},
// Get and set the style property on a DOM Node
style: function( elem, name, value, extra ) {
// Don't set styles on text and comment nodes
if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
return;
}
// Make sure that we're working with the right name
var ret, type, origName = jQuery.camelCase( name ),
style = elem.style, hooks = jQuery.cssHooks[ origName ];
name = jQuery.cssProps[ origName ] || origName;
// Check if we're setting a value
if ( value !== undefined ) {
type = typeof value;
// convert relative number strings (+= or -=) to relative numbers. #7345
if ( type === "string" && (ret = rrelNum.exec( value )) ) {
value = ( +( ret[1] + 1) * +ret[2] ) + parseFloat( jQuery.css( elem, name ) );
// Fixes bug #9237
type = "number";
}
// Make sure that NaN and null values aren't set. See: #7116
if ( value == null || type === "number" && isNaN( value ) ) {
return;
}
// If a number was passed in, add 'px' to the (except for certain CSS properties)
if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
value += "px";
}
// If a hook was provided, use that value, otherwise just set the specified value
if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value )) !== undefined ) {
// Wrapped to prevent IE from throwing errors when 'invalid' values are provided
// Fixes bug #5509
try {
style[ name ] = value;
} catch(e) {}
}
} else {
// If a hook was provided get the non-computed value from there
if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
return ret;
}
// Otherwise just get the value from the style object
return style[ name ];
}
},
css: function( elem, name, extra ) {
var ret, hooks;
// Make sure that we're working with the right name
name = jQuery.camelCase( name );
hooks = jQuery.cssHooks[ name ];
name = jQuery.cssProps[ name ] || name;
// cssFloat needs a special treatment
if ( name === "cssFloat" ) {
name = "float";
}
// If a hook was provided get the computed value from there
if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) {
return ret;
// Otherwise, if a way to get the computed value exists, use that
} else if ( curCSS ) {
return curCSS( elem, name );
}
},
// A method for quickly swapping in/out CSS properties to get correct calculations
swap: function( elem, options, callback ) {
var old = {};
// Remember the old values, and insert the new ones
for ( var name in options ) {
old[ name ] = elem.style[ name ];
elem.style[ name ] = options[ name ];
}
callback.call( elem );
// Revert the old values
for ( name in options ) {
elem.style[ name ] = old[ name ];
}
}
});
// DEPRECATED, Use jQuery.css() instead
jQuery.curCSS = jQuery.css;
jQuery.each(["height", "width"], function( i, name ) {
jQuery.cssHooks[ name ] = {
get: function( elem, computed, extra ) {
var val;
if ( computed ) {
if ( elem.offsetWidth !== 0 ) {
return getWH( elem, name, extra );
} else {
jQuery.swap( elem, cssShow, function() {
val = getWH( elem, name, extra );
});
}
return val;
}
},
set: function( elem, value ) {
if ( rnumpx.test( value ) ) {
// ignore negative width and height values #1599
value = parseFloat( value );
if ( value >= 0 ) {
return value + "px";
}
} else {
return value;
}
}
};
});
if ( !jQuery.support.opacity ) {
jQuery.cssHooks.opacity = {
get: function( elem, computed ) {
// IE uses filters for opacity
return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
( parseFloat( RegExp.$1 ) / 100 ) + "" :
computed ? "1" : "";
},
set: function( elem, value ) {
var style = elem.style,
currentStyle = elem.currentStyle,
opacity = jQuery.isNaN( value ) ? "" : "alpha(opacity=" + value * 100 + ")",
filter = currentStyle && currentStyle.filter || style.filter || "";
// IE has trouble with opacity if it does not have layout
// Force it by setting the zoom level
style.zoom = 1;
// if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652
if ( value >= 1 && jQuery.trim( filter.replace( ralpha, "" ) ) === "" ) {
// Setting style.filter to null, "" & " " still leave "filter:" in the cssText
// if "filter:" is present at all, clearType is disabled, we want to avoid this
// style.removeAttribute is IE Only, but so apparently is this code path...
style.removeAttribute( "filter" );
// if there there is no filter style applied in a css rule, we are done
if ( currentStyle && !currentStyle.filter ) {
return;
}
}
// otherwise, set new filter values
style.filter = ralpha.test( filter ) ?
filter.replace( ralpha, opacity ) :
filter + " " + opacity;
}
};
}
jQuery(function() {
// This hook cannot be added until DOM ready because the support test
// for it is not run until after DOM ready
if ( !jQuery.support.reliableMarginRight ) {
jQuery.cssHooks.marginRight = {
get: function( elem, computed ) {
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
// Work around by temporarily setting element display to inline-block
var ret;
jQuery.swap( elem, { "display": "inline-block" }, function() {
if ( computed ) {
ret = curCSS( elem, "margin-right", "marginRight" );
} else {
ret = elem.style.marginRight;
}
});
return ret;
}
};
}
});
if ( document.defaultView && document.defaultView.getComputedStyle ) {
getComputedStyle = function( elem, name ) {
var ret, defaultView, computedStyle;
name = name.replace( rupper, "-$1" ).toLowerCase();
if ( !(defaultView = elem.ownerDocument.defaultView) ) {
return undefined;
}
if ( (computedStyle = defaultView.getComputedStyle( elem, null )) ) {
ret = computedStyle.getPropertyValue( name );
if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
ret = jQuery.style( elem, name );
}
}
return ret;
};
}
if ( document.documentElement.currentStyle ) {
currentStyle = function( elem, name ) {
var left,
ret = elem.currentStyle && elem.currentStyle[ name ],
rsLeft = elem.runtimeStyle && elem.runtimeStyle[ name ],
style = elem.style;
// From the awesome hack by Dean Edwards
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
// If we're not dealing with a regular pixel number
// but a number that has a weird ending, we need to convert it to pixels
if ( !rnumpx.test( ret ) && rnum.test( ret ) ) {
// Remember the original values
left = style.left;
// Put in the new values to get a computed value out
if ( rsLeft ) {
elem.runtimeStyle.left = elem.currentStyle.left;
}
style.left = name === "fontSize" ? "1em" : (ret || 0);
ret = style.pixelLeft + "px";
// Revert the changed values
style.left = left;
if ( rsLeft ) {
elem.runtimeStyle.left = rsLeft;
}
}
return ret === "" ? "auto" : ret;
};
}
curCSS = getComputedStyle || currentStyle;
function getWH( elem, name, extra ) {
// Start with offset property
var val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
which = name === "width" ? cssWidth : cssHeight;
if ( val > 0 ) {
if ( extra !== "border" ) {
jQuery.each( which, function() {
if ( !extra ) {
val -= parseFloat( jQuery.css( elem, "padding" + this ) ) || 0;
}
if ( extra === "margin" ) {
val += parseFloat( jQuery.css( elem, extra + this ) ) || 0;
} else {
val -= parseFloat( jQuery.css( elem, "border" + this + "Width" ) ) || 0;
}
});
}
return val + "px";
}
// Fall back to computed then uncomputed css if necessary
val = curCSS( elem, name, name );
if ( val < 0 || val == null ) {
val = elem.style[ name ] || 0;
}
// Normalize "", auto, and prepare for extra
val = parseFloat( val ) || 0;
// Add padding, border, margin
if ( extra ) {
jQuery.each( which, function() {
val += parseFloat( jQuery.css( elem, "padding" + this ) ) || 0;
if ( extra !== "padding" ) {
val += parseFloat( jQuery.css( elem, "border" + this + "Width" ) ) || 0;
}
if ( extra === "margin" ) {
val += parseFloat( jQuery.css( elem, extra + this ) ) || 0;
}
});
}
return val + "px";
}
if ( jQuery.expr && jQuery.expr.filters ) {
jQuery.expr.filters.hidden = function( elem ) {
var width = elem.offsetWidth,
height = elem.offsetHeight;
return (width === 0 && height === 0) || (!jQuery.support.reliableHiddenOffsets && (elem.style.display || jQuery.css( elem, "display" )) === "none");
};
jQuery.expr.filters.visible = function( elem ) {
return !jQuery.expr.filters.hidden( elem );
};
}
var r20 = /%20/g,
rbracket = /\[\]$/,
rCRLF = /\r?\n/g,
rhash = /#.*$/,
rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
// #7653, #8125, #8152: local protocol detection
rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,
rnoContent = /^(?:GET|HEAD)$/,
rprotocol = /^\/\//,
rquery = /\?/,
rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
rselectTextarea = /^(?:select|textarea)/i,
rspacesAjax = /\s+/,
rts = /([?&])_=[^&]*/,
rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,
// Keep a copy of the old load method
_load = jQuery.fn.load,
/* Prefilters
* 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
* 2) These are called:
* - BEFORE asking for a transport
* - AFTER param serialization (s.data is a string if s.processData is true)
* 3) key is the dataType
* 4) the catchall symbol "*" can be used
* 5) execution will start with transport dataType and THEN continue down to "*" if needed
*/
prefilters = {},
/* Transports bindings
* 1) key is the dataType
* 2) the catchall symbol "*" can be used
* 3) selection will start with transport dataType and THEN go to "*" if needed
*/
transports = {},
// Document location
ajaxLocation,
// Document location segments
ajaxLocParts,
// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
allTypes = ["*/"] + ["*"];
// #8138, IE may throw an exception when accessing
// a field from window.location if document.domain has been set
try {
ajaxLocation = location.href;
} catch( e ) {
// Use the href attribute of an A element
// since IE will modify it given document.location
ajaxLocation = document.createElement( "a" );
ajaxLocation.href = "";
ajaxLocation = ajaxLocation.href;
}
// Segment location into parts
ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
function addToPrefiltersOrTransports( structure ) {
// dataTypeExpression is optional and defaults to "*"
return function( dataTypeExpression, func ) {
if ( typeof dataTypeExpression !== "string" ) {
func = dataTypeExpression;
dataTypeExpression = "*";
}
if ( jQuery.isFunction( func ) ) {
var dataTypes = dataTypeExpression.toLowerCase().split( rspacesAjax ),
i = 0,
length = dataTypes.length,
dataType,
list,
placeBefore;
// For each dataType in the dataTypeExpression
for(; i < length; i++ ) {
dataType = dataTypes[ i ];
// We control if we're asked to add before
// any existing element
placeBefore = /^\+/.test( dataType );
if ( placeBefore ) {
dataType = dataType.substr( 1 ) || "*";
}
list = structure[ dataType ] = structure[ dataType ] || [];
// then we add to the structure accordingly
list[ placeBefore ? "unshift" : "push" ]( func );
}
}
};
}
// Base inspection function for prefilters and transports
function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR,
dataType /* internal */, inspected /* internal */ ) {
dataType = dataType || options.dataTypes[ 0 ];
inspected = inspected || {};
inspected[ dataType ] = true;
var list = structure[ dataType ],
i = 0,
length = list ? list.length : 0,
executeOnly = ( structure === prefilters ),
selection;
for(; i < length && ( executeOnly || !selection ); i++ ) {
selection = list[ i ]( options, originalOptions, jqXHR );
// If we got redirected to another dataType
// we try there if executing only and not done already
if ( typeof selection === "string" ) {
if ( !executeOnly || inspected[ selection ] ) {
selection = undefined;
} else {
options.dataTypes.unshift( selection );
selection = inspectPrefiltersOrTransports(
structure, options, originalOptions, jqXHR, selection, inspected );
}
}
}
// If we're only executing or nothing was selected
// we try the catchall dataType if not done already
if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) {
selection = inspectPrefiltersOrTransports(
structure, options, originalOptions, jqXHR, "*", inspected );
}
// unnecessary when only executing (prefilters)
// but it'll be ignored by the caller in that case
return selection;
}
// A special extend for ajax options
// that takes "flat" options (not to be deep extended)
// Fixes #9887
function ajaxExtend( target, src ) {
var key, deep,
flatOptions = jQuery.ajaxSettings.flatOptions || {};
for( key in src ) {
if ( src[ key ] !== undefined ) {
( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
}
}
if ( deep ) {
jQuery.extend( true, target, deep );
}
}
jQuery.fn.extend({
load: function( url, params, callback ) {
if ( typeof url !== "string" && _load ) {
return _load.apply( this, arguments );
// Don't do a request if no elements are being requested
} else if ( !this.length ) {
return this;
}
var off = url.indexOf( " " );
if ( off >= 0 ) {
var selector = url.slice( off, url.length );
url = url.slice( 0, off );
}
// Default to a GET request
var type = "GET";
// If the second parameter was provided
if ( params ) {
// If it's a function
if ( jQuery.isFunction( params ) ) {
// We assume that it's the callback
callback = params;
params = undefined;
// Otherwise, build a param string
} else if ( typeof params === "object" ) {
params = jQuery.param( params, jQuery.ajaxSettings.traditional );
type = "POST";
}
}
var self = this;
// Request the remote document
jQuery.ajax({
url: url,
type: type,
dataType: "html",
data: params,
// Complete callback (responseText is used internally)
complete: function( jqXHR, status, responseText ) {
// Store the response as specified by the jqXHR object
responseText = jqXHR.responseText;
// If successful, inject the HTML into all the matched elements
if ( jqXHR.isResolved() ) {
// #4825: Get the actual response in case
// a dataFilter is present in ajaxSettings
jqXHR.done(function( r ) {
responseText = r;
});
// See if a selector was specified
self.html( selector ?
// Create a dummy div to hold the results
jQuery("<div>")
// inject the contents of the document in, removing the scripts
// to avoid any 'Permission Denied' errors in IE
.append(responseText.replace(rscript, ""))
// Locate the specified elements
.find(selector) :
// If not, just inject the full result
responseText );
}
if ( callback ) {
self.each( callback, [ responseText, status, jqXHR ] );
}
}
});
return this;
},
serialize: function() {
return jQuery.param( this.serializeArray() );
},
serializeArray: function() {
return this.map(function(){
return this.elements ? jQuery.makeArray( this.elements ) : this;
})
.filter(function(){
return this.name && !this.disabled &&
( this.checked || rselectTextarea.test( this.nodeName ) ||
rinput.test( this.type ) );
})
.map(function( i, elem ){
var val = jQuery( this ).val();
return val == null ?
null :
jQuery.isArray( val ) ?
jQuery.map( val, function( val, i ){
return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
}) :
{ name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
}).get();
}
});
// Attach a bunch of functions for handling common AJAX events
jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){
jQuery.fn[ o ] = function( f ){
return this.bind( o, f );
};
});
jQuery.each( [ "get", "post" ], function( i, method ) {
jQuery[ method ] = function( url, data, callback, type ) {
// shift arguments if data argument was omitted
if ( jQuery.isFunction( data ) ) {
type = type || callback;
callback = data;
data = undefined;
}
return jQuery.ajax({
type: method,
url: url,
data: data,
success: callback,
dataType: type
});
};
});
jQuery.extend({
getScript: function( url, callback ) {
return jQuery.get( url, undefined, callback, "script" );
},
getJSON: function( url, data, callback ) {
return jQuery.get( url, data, callback, "json" );
},
// Creates a full fledged settings object into target
// with both ajaxSettings and settings fields.
// If target is omitted, writes into ajaxSettings.
ajaxSetup: function( target, settings ) {
if ( settings ) {
// Building a settings object
ajaxExtend( target, jQuery.ajaxSettings );
} else {
// Extending ajaxSettings
settings = target;
target = jQuery.ajaxSettings;
}
ajaxExtend( target, settings );
return target;
},
ajaxSettings: {
url: ajaxLocation,
isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
global: true,
type: "GET",
contentType: "application/x-www-form-urlencoded",
processData: true,
async: true,
/*
timeout: 0,
data: null,
dataType: null,
username: null,
password: null,
cache: null,
traditional: false,
headers: {},
*/
accepts: {
xml: "application/xml, text/xml",
html: "text/html",
text: "text/plain",
json: "application/json, text/javascript",
"*": allTypes
},
contents: {
xml: /xml/,
html: /html/,
json: /json/
},
responseFields: {
xml: "responseXML",
text: "responseText"
},
// List of data converters
// 1) key format is "source_type destination_type" (a single space in-between)
// 2) the catchall symbol "*" can be used for source_type
converters: {
// Convert anything to text
"* text": window.String,
// Text to html (true = no transformation)
"text html": true,
// Evaluate text as a json expression
"text json": jQuery.parseJSON,
// Parse text as xml
"text xml": jQuery.parseXML
},
// For options that shouldn't be deep extended:
// you can add your own custom options here if
// and when you create one that shouldn't be
// deep extended (see ajaxExtend)
flatOptions: {
context: true,
url: true
}
},
ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
ajaxTransport: addToPrefiltersOrTransports( transports ),
// Main method
ajax: function( url, options ) {
// If url is an object, simulate pre-1.5 signature
if ( typeof url === "object" ) {
options = url;
url = undefined;
}
// Force options to be an object
options = options || {};
var // Create the final options object
s = jQuery.ajaxSetup( {}, options ),
// Callbacks context
callbackContext = s.context || s,
// Context for global events
// It's the callbackContext if one was provided in the options
// and if it's a DOM node or a jQuery collection
globalEventContext = callbackContext !== s &&
( callbackContext.nodeType || callbackContext instanceof jQuery ) ?
jQuery( callbackContext ) : jQuery.event,
// Deferreds
deferred = jQuery.Deferred(),
completeDeferred = jQuery._Deferred(),
// Status-dependent callbacks
statusCode = s.statusCode || {},
// ifModified key
ifModifiedKey,
// Headers (they are sent all at once)
requestHeaders = {},
requestHeadersNames = {},
// Response headers
responseHeadersString,
responseHeaders,
// transport
transport,
// timeout handle
timeoutTimer,
// Cross-domain detection vars
parts,
// The jqXHR state
state = 0,
// To know if global events are to be dispatched
fireGlobals,
// Loop variable
i,
// Fake xhr
jqXHR = {
readyState: 0,
// Caches the header
setRequestHeader: function( name, value ) {
if ( !state ) {
var lname = name.toLowerCase();
name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
requestHeaders[ name ] = value;
}
return this;
},
// Raw string
getAllResponseHeaders: function() {
return state === 2 ? responseHeadersString : null;
},
// Builds headers hashtable if needed
getResponseHeader: function( key ) {
var match;
if ( state === 2 ) {
if ( !responseHeaders ) {
responseHeaders = {};
while( ( match = rheaders.exec( responseHeadersString ) ) ) {
responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
}
}
match = responseHeaders[ key.toLowerCase() ];
}
return match === undefined ? null : match;
},
// Overrides response content-type header
overrideMimeType: function( type ) {
if ( !state ) {
s.mimeType = type;
}
return this;
},
// Cancel the request
abort: function( statusText ) {
statusText = statusText || "abort";
if ( transport ) {
transport.abort( statusText );
}
done( 0, statusText );
return this;
}
};
// Callback for when everything is done
// It is defined here because jslint complains if it is declared
// at the end of the function (which would be more logical and readable)
function done( status, nativeStatusText, responses, headers ) {
// Called once
if ( state === 2 ) {
return;
}
// State is "done" now
state = 2;
// Clear timeout if it exists
if ( timeoutTimer ) {
clearTimeout( timeoutTimer );
}
// Dereference transport for early garbage collection
// (no matter how long the jqXHR object will be used)
transport = undefined;
// Cache response headers
responseHeadersString = headers || "";
// Set readyState
jqXHR.readyState = status > 0 ? 4 : 0;
var isSuccess,
success,
error,
statusText = nativeStatusText,
response = responses ? ajaxHandleResponses( s, jqXHR, responses ) : undefined,
lastModified,
etag;
// If successful, handle type chaining
if ( status >= 200 && status < 300 || status === 304 ) {
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if ( s.ifModified ) {
if ( ( lastModified = jqXHR.getResponseHeader( "Last-Modified" ) ) ) {
jQuery.lastModified[ ifModifiedKey ] = lastModified;
}
if ( ( etag = jqXHR.getResponseHeader( "Etag" ) ) ) {
jQuery.etag[ ifModifiedKey ] = etag;
}
}
// If not modified
if ( status === 304 ) {
statusText = "notmodified";
isSuccess = true;
// If we have data
} else {
try {
success = ajaxConvert( s, response );
statusText = "success";
isSuccess = true;
} catch(e) {
// We have a parsererror
statusText = "parsererror";
error = e;
}
}
} else {
// We extract error from statusText
// then normalize statusText and status for non-aborts
error = statusText;
if( !statusText || status ) {
statusText = "error";
if ( status < 0 ) {
status = 0;
}
}
}
// Set data for the fake xhr object
jqXHR.status = status;
jqXHR.statusText = "" + ( nativeStatusText || statusText );
// Success/Error
if ( isSuccess ) {
deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
} else {
deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
}
// Status-dependent callbacks
jqXHR.statusCode( statusCode );
statusCode = undefined;
if ( fireGlobals ) {
globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ),
[ jqXHR, s, isSuccess ? success : error ] );
}
// Complete
completeDeferred.resolveWith( callbackContext, [ jqXHR, statusText ] );
if ( fireGlobals ) {
globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
// Handle the global AJAX counter
if ( !( --jQuery.active ) ) {
jQuery.event.trigger( "ajaxStop" );
}
}
}
// Attach deferreds
deferred.promise( jqXHR );
jqXHR.success = jqXHR.done;
jqXHR.error = jqXHR.fail;
jqXHR.complete = completeDeferred.done;
// Status-dependent callbacks
jqXHR.statusCode = function( map ) {
if ( map ) {
var tmp;
if ( state < 2 ) {
for( tmp in map ) {
statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ];
}
} else {
tmp = map[ jqXHR.status ];
jqXHR.then( tmp, tmp );
}
}
return this;
};
// Remove hash character (#7531: and string promotion)
// Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
// We also use the url parameter if available
s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
// Extract dataTypes list
s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( rspacesAjax );
// Determine if a cross-domain request is in order
if ( s.crossDomain == null ) {
parts = rurl.exec( s.url.toLowerCase() );
s.crossDomain = !!( parts &&
( parts[ 1 ] != ajaxLocParts[ 1 ] || parts[ 2 ] != ajaxLocParts[ 2 ] ||
( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=
( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) )
);
}
// Convert data if not already a string
if ( s.data && s.processData && typeof s.data !== "string" ) {
s.data = jQuery.param( s.data, s.traditional );
}
// Apply prefilters
inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
// If request was aborted inside a prefiler, stop there
if ( state === 2 ) {
return false;
}
// We can fire global events as of now if asked to
fireGlobals = s.global;
// Uppercase the type
s.type = s.type.toUpperCase();
// Determine if request has content
s.hasContent = !rnoContent.test( s.type );
// Watch for a new set of requests
if ( fireGlobals && jQuery.active++ === 0 ) {
jQuery.event.trigger( "ajaxStart" );
}
// More options handling for requests with no content
if ( !s.hasContent ) {
// If data is available, append data to url
if ( s.data ) {
s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data;
// #9682: remove data so that it's not used in an eventual retry
delete s.data;
}
// Get ifModifiedKey before adding the anti-cache parameter
ifModifiedKey = s.url;
// Add anti-cache in url if needed
if ( s.cache === false ) {
var ts = jQuery.now(),
// try replacing _= if it is there
ret = s.url.replace( rts, "$1_=" + ts );
// if nothing was replaced, add timestamp to the end
s.url = ret + ( (ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" );
}
}
// Set the correct header, if data is being sent
if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
jqXHR.setRequestHeader( "Content-Type", s.contentType );
}
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if ( s.ifModified ) {
ifModifiedKey = ifModifiedKey || s.url;
if ( jQuery.lastModified[ ifModifiedKey ] ) {
jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ ifModifiedKey ] );
}
if ( jQuery.etag[ ifModifiedKey ] ) {
jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ ifModifiedKey ] );
}
}
// Set the Accepts header for the server, depending on the dataType
jqXHR.setRequestHeader(
"Accept",
s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
s.accepts[ "*" ]
);
// Check for headers option
for ( i in s.headers ) {
jqXHR.setRequestHeader( i, s.headers[ i ] );
}
// Allow custom headers/mimetypes and early abort
if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
// Abort if not done already
jqXHR.abort();
return false;
}
// Install callbacks on deferreds
for ( i in { success: 1, error: 1, complete: 1 } ) {
jqXHR[ i ]( s[ i ] );
}
// Get transport
transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
// If no transport, we auto-abort
if ( !transport ) {
done( -1, "No Transport" );
} else {
jqXHR.readyState = 1;
// Send global event
if ( fireGlobals ) {
globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
}
// Timeout
if ( s.async && s.timeout > 0 ) {
timeoutTimer = setTimeout( function(){
jqXHR.abort( "timeout" );
}, s.timeout );
}
try {
state = 1;
transport.send( requestHeaders, done );
} catch (e) {
// Propagate exception as error if not done
if ( state < 2 ) {
done( -1, e );
// Simply rethrow otherwise
} else {
jQuery.error( e );
}
}
}
return jqXHR;
},
// Serialize an array of form elements or a set of
// key/values into a query string
param: function( a, traditional ) {
var s = [],
add = function( key, value ) {
// If value is a function, invoke it and return its value
value = jQuery.isFunction( value ) ? value() : value;
s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
};
// Set traditional to true for jQuery <= 1.3.2 behavior.
if ( traditional === undefined ) {
traditional = jQuery.ajaxSettings.traditional;
}
// If an array was passed in, assume that it is an array of form elements.
if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
// Serialize the form elements
jQuery.each( a, function() {
add( this.name, this.value );
});
} else {
// If traditional, encode the "old" way (the way 1.3.2 or older
// did it), otherwise encode params recursively.
for ( var prefix in a ) {
buildParams( prefix, a[ prefix ], traditional, add );
}
}
// Return the resulting serialization
return s.join( "&" ).replace( r20, "+" );
}
});
function buildParams( prefix, obj, traditional, add ) {
if ( jQuery.isArray( obj ) ) {
// Serialize array item.
jQuery.each( obj, function( i, v ) {
if ( traditional || rbracket.test( prefix ) ) {
// Treat each array item as a scalar.
add( prefix, v );
} else {
// If array item is non-scalar (array or object), encode its
// numeric index to resolve deserialization ambiguity issues.
// Note that rack (as of 1.0.0) can't currently deserialize
// nested arrays properly, and attempting to do so may cause
// a server error. Possible fixes are to modify rack's
// deserialization algorithm or to provide an option or flag
// to force array serialization to be shallow.
buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v, traditional, add );
}
});
} else if ( !traditional && obj != null && typeof obj === "object" ) {
// Serialize object item.
for ( var name in obj ) {
buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
}
} else {
// Serialize scalar item.
add( prefix, obj );
}
}
// This is still on the jQuery object... for now
// Want to move this to jQuery.ajax some day
jQuery.extend({
// Counter for holding the number of active queries
active: 0,
// Last-Modified header cache for next request
lastModified: {},
etag: {}
});
/* Handles responses to an ajax request:
* - sets all responseXXX fields accordingly
* - finds the right dataType (mediates between content-type and expected dataType)
* - returns the corresponding response
*/
function ajaxHandleResponses( s, jqXHR, responses ) {
var contents = s.contents,
dataTypes = s.dataTypes,
responseFields = s.responseFields,
ct,
type,
finalDataType,
firstDataType;
// Fill responseXXX fields
for( type in responseFields ) {
if ( type in responses ) {
jqXHR[ responseFields[type] ] = responses[ type ];
}
}
// Remove auto dataType and get content-type in the process
while( dataTypes[ 0 ] === "*" ) {
dataTypes.shift();
if ( ct === undefined ) {
ct = s.mimeType || jqXHR.getResponseHeader( "content-type" );
}
}
// Check if we're dealing with a known content-type
if ( ct ) {
for ( type in contents ) {
if ( contents[ type ] && contents[ type ].test( ct ) ) {
dataTypes.unshift( type );
break;
}
}
}
// Check to see if we have a response for the expected dataType
if ( dataTypes[ 0 ] in responses ) {
finalDataType = dataTypes[ 0 ];
} else {
// Try convertible dataTypes
for ( type in responses ) {
if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
finalDataType = type;
break;
}
if ( !firstDataType ) {
firstDataType = type;
}
}
// Or just use first one
finalDataType = finalDataType || firstDataType;
}
// If we found a dataType
// We add the dataType to the list if needed
// and return the corresponding response
if ( finalDataType ) {
if ( finalDataType !== dataTypes[ 0 ] ) {
dataTypes.unshift( finalDataType );
}
return responses[ finalDataType ];
}
}
// Chain conversions given the request and the original response
function ajaxConvert( s, response ) {
// Apply the dataFilter if provided
if ( s.dataFilter ) {
response = s.dataFilter( response, s.dataType );
}
var dataTypes = s.dataTypes,
converters = {},
i,
key,
length = dataTypes.length,
tmp,
// Current and previous dataTypes
current = dataTypes[ 0 ],
prev,
// Conversion expression
conversion,
// Conversion function
conv,
// Conversion functions (transitive conversion)
conv1,
conv2;
// For each dataType in the chain
for( i = 1; i < length; i++ ) {
// Create converters map
// with lowercased keys
if ( i === 1 ) {
for( key in s.converters ) {
if( typeof key === "string" ) {
converters[ key.toLowerCase() ] = s.converters[ key ];
}
}
}
// Get the dataTypes
prev = current;
current = dataTypes[ i ];
// If current is auto dataType, update it to prev
if( current === "*" ) {
current = prev;
// If no auto and dataTypes are actually different
} else if ( prev !== "*" && prev !== current ) {
// Get the converter
conversion = prev + " " + current;
conv = converters[ conversion ] || converters[ "* " + current ];
// If there is no direct converter, search transitively
if ( !conv ) {
conv2 = undefined;
for( conv1 in converters ) {
tmp = conv1.split( " " );
if ( tmp[ 0 ] === prev || tmp[ 0 ] === "*" ) {
conv2 = converters[ tmp[1] + " " + current ];
if ( conv2 ) {
conv1 = converters[ conv1 ];
if ( conv1 === true ) {
conv = conv2;
} else if ( conv2 === true ) {
conv = conv1;
}
break;
}
}
}
}
// If we found no converter, dispatch an error
if ( !( conv || conv2 ) ) {
jQuery.error( "No conversion from " + conversion.replace(" "," to ") );
}
// If found converter is not an equivalence
if ( conv !== true ) {
// Convert with 1 or 2 converters accordingly
response = conv ? conv( response ) : conv2( conv1(response) );
}
}
}
return response;
}
var jsc = jQuery.now(),
jsre = /(\=)\?(&|$)|\?\?/i;
// Default jsonp settings
jQuery.ajaxSetup({
jsonp: "callback",
jsonpCallback: function() {
return jQuery.expando + "_" + ( jsc++ );
}
});
// Detect, normalize options and install callbacks for jsonp requests
jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
var inspectData = s.contentType === "application/x-www-form-urlencoded" &&
( typeof s.data === "string" );
if ( s.dataTypes[ 0 ] === "jsonp" ||
s.jsonp !== false && ( jsre.test( s.url ) ||
inspectData && jsre.test( s.data ) ) ) {
var responseContainer,
jsonpCallback = s.jsonpCallback =
jQuery.isFunction( s.jsonpCallback ) ? s.jsonpCallback() : s.jsonpCallback,
previous = window[ jsonpCallback ],
url = s.url,
data = s.data,
replace = "$1" + jsonpCallback + "$2";
if ( s.jsonp !== false ) {
url = url.replace( jsre, replace );
if ( s.url === url ) {
if ( inspectData ) {
data = data.replace( jsre, replace );
}
if ( s.data === data ) {
// Add callback manually
url += (/\?/.test( url ) ? "&" : "?") + s.jsonp + "=" + jsonpCallback;
}
}
}
s.url = url;
s.data = data;
// Install callback
window[ jsonpCallback ] = function( response ) {
responseContainer = [ response ];
};
// Clean-up function
jqXHR.always(function() {
// Set callback back to previous value
window[ jsonpCallback ] = previous;
// Call if it was a function and we have a response
if ( responseContainer && jQuery.isFunction( previous ) ) {
window[ jsonpCallback ]( responseContainer[ 0 ] );
}
});
// Use data converter to retrieve json after script execution
s.converters["script json"] = function() {
if ( !responseContainer ) {
jQuery.error( jsonpCallback + " was not called" );
}
return responseContainer[ 0 ];
};
// force json dataType
s.dataTypes[ 0 ] = "json";
// Delegate to script
return "script";
}
});
// Install script dataType
jQuery.ajaxSetup({
accepts: {
script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
},
contents: {
script: /javascript|ecmascript/
},
converters: {
"text script": function( text ) {
jQuery.globalEval( text );
return text;
}
}
});
// Handle cache's special case and global
jQuery.ajaxPrefilter( "script", function( s ) {
if ( s.cache === undefined ) {
s.cache = false;
}
if ( s.crossDomain ) {
s.type = "GET";
s.global = false;
}
});
// Bind script tag hack transport
jQuery.ajaxTransport( "script", function(s) {
// This transport only deals with cross domain requests
if ( s.crossDomain ) {
var script,
head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement;
return {
send: function( _, callback ) {
script = document.createElement( "script" );
script.async = "async";
if ( s.scriptCharset ) {
script.charset = s.scriptCharset;
}
script.src = s.url;
// Attach handlers for all browsers
script.onload = script.onreadystatechange = function( _, isAbort ) {
if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
// Handle memory leak in IE
script.onload = script.onreadystatechange = null;
// Remove the script
if ( head && script.parentNode ) {
head.removeChild( script );
}
// Dereference the script
script = undefined;
// Callback if not abort
if ( !isAbort ) {
callback( 200, "success" );
}
}
};
// Use insertBefore instead of appendChild to circumvent an IE6 bug.
// This arises when a base node is used (#2709 and #4378).
head.insertBefore( script, head.firstChild );
},
abort: function() {
if ( script ) {
script.onload( 0, 1 );
}
}
};
}
});
var // #5280: Internet Explorer will keep connections alive if we don't abort on unload
xhrOnUnloadAbort = window.ActiveXObject ? function() {
// Abort all pending requests
for ( var key in xhrCallbacks ) {
xhrCallbacks[ key ]( 0, 1 );
}
} : false,
xhrId = 0,
xhrCallbacks;
// Functions to create xhrs
function createStandardXHR() {
try {
return new window.XMLHttpRequest();
} catch( e ) {}
}
function createActiveXHR() {
try {
return new window.ActiveXObject( "Microsoft.XMLHTTP" );
} catch( e ) {}
}
// Create the request object
// (This is still attached to ajaxSettings for backward compatibility)
jQuery.ajaxSettings.xhr = window.ActiveXObject ?
/* Microsoft failed to properly
* implement the XMLHttpRequest in IE7 (can't request local files),
* so we use the ActiveXObject when it is available
* Additionally XMLHttpRequest can be disabled in IE7/IE8 so
* we need a fallback.
*/
function() {
return !this.isLocal && createStandardXHR() || createActiveXHR();
} :
// For all other browsers, use the standard XMLHttpRequest object
createStandardXHR;
// Determine support properties
(function( xhr ) {
jQuery.extend( jQuery.support, {
ajax: !!xhr,
cors: !!xhr && ( "withCredentials" in xhr )
});
})( jQuery.ajaxSettings.xhr() );
// Create transport if the browser can provide an xhr
if ( jQuery.support.ajax ) {
jQuery.ajaxTransport(function( s ) {
// Cross domain only allowed if supported through XMLHttpRequest
if ( !s.crossDomain || jQuery.support.cors ) {
var callback;
return {
send: function( headers, complete ) {
// Get a new xhr
var xhr = s.xhr(),
handle,
i;
// Open the socket
// Passing null username, generates a login popup on Opera (#2865)
if ( s.username ) {
xhr.open( s.type, s.url, s.async, s.username, s.password );
} else {
xhr.open( s.type, s.url, s.async );
}
// Apply custom fields if provided
if ( s.xhrFields ) {
for ( i in s.xhrFields ) {
xhr[ i ] = s.xhrFields[ i ];
}
}
// Override mime type if needed
if ( s.mimeType && xhr.overrideMimeType ) {
xhr.overrideMimeType( s.mimeType );
}
// X-Requested-With header
// For cross-domain requests, seeing as conditions for a preflight are
// akin to a jigsaw puzzle, we simply never set it to be sure.
// (it can always be set on a per-request basis or even using ajaxSetup)
// For same-domain requests, won't change header if already provided.
if ( !s.crossDomain && !headers["X-Requested-With"] ) {
headers[ "X-Requested-With" ] = "XMLHttpRequest";
}
// Need an extra try/catch for cross domain requests in Firefox 3
try {
for ( i in headers ) {
xhr.setRequestHeader( i, headers[ i ] );
}
} catch( _ ) {}
// Do send the request
// This may raise an exception which is actually
// handled in jQuery.ajax (so no try/catch here)
xhr.send( ( s.hasContent && s.data ) || null );
// Listener
callback = function( _, isAbort ) {
var status,
statusText,
responseHeaders,
responses,
xml;
// Firefox throws exceptions when accessing properties
// of an xhr when a network error occured
// http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)
try {
// Was never called and is aborted or complete
if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
// Only called once
callback = undefined;
// Do not keep as active anymore
if ( handle ) {
xhr.onreadystatechange = jQuery.noop;
if ( xhrOnUnloadAbort ) {
delete xhrCallbacks[ handle ];
}
}
// If it's an abort
if ( isAbort ) {
// Abort it manually if needed
if ( xhr.readyState !== 4 ) {
xhr.abort();
}
} else {
status = xhr.status;
responseHeaders = xhr.getAllResponseHeaders();
responses = {};
xml = xhr.responseXML;
// Construct response list
if ( xml && xml.documentElement /* #4958 */ ) {
responses.xml = xml;
}
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 we're in sync mode or it's in cache
// and has been retrieved directly (IE6 & IE7)
// we need to manually fire the callback
if ( !s.async || xhr.readyState === 4 ) {
callback();
} else {
handle = ++xhrId;
if ( xhrOnUnloadAbort ) {
// Create the active xhrs callbacks list if needed
// and attach the unload handler
if ( !xhrCallbacks ) {
xhrCallbacks = {};
jQuery( window ).unload( xhrOnUnloadAbort );
}
// Add to list of active xhrs callbacks
xhrCallbacks[ handle ] = callback;
}
xhr.onreadystatechange = callback;
}
},
abort: function() {
if ( callback ) {
callback(0,1);
}
}
};
}
});
}
var elemdisplay = {},
iframe, iframeDoc,
rfxtypes = /^(?:toggle|show|hide)$/,
rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,
timerId,
fxAttrs = [
// height animations
[ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ],
// width animations
[ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],
// opacity animations
[ "opacity" ]
],
fxNow;
jQuery.fn.extend({
show: function( speed, easing, callback ) {
var elem, display;
if ( speed || speed === 0 ) {
return this.animate( genFx("show", 3), speed, easing, callback);
} else {
for ( var i = 0, j = this.length; i < j; i++ ) {
elem = this[i];
if ( elem.style ) {
display = elem.style.display;
// Reset the inline display of this element to learn if it is
// being hidden by cascaded rules or not
if ( !jQuery._data(elem, "olddisplay") && display === "none" ) {
display = elem.style.display = "";
}
// Set elements which have been overridden with display: none
// in a stylesheet to whatever the default browser style is
// for such an element
if ( display === "" && jQuery.css( elem, "display" ) === "none" ) {
jQuery._data(elem, "olddisplay", defaultDisplay(elem.nodeName));
}
}
}
// Set the display of most of the elements in a second loop
// to avoid the constant reflow
for ( i = 0; i < j; i++ ) {
elem = this[i];
if ( elem.style ) {
display = elem.style.display;
if ( display === "" || display === "none" ) {
elem.style.display = jQuery._data(elem, "olddisplay") || "";
}
}
}
return this;
}
},
hide: function( speed, easing, callback ) {
if ( speed || speed === 0 ) {
return this.animate( genFx("hide", 3), speed, easing, callback);
} else {
for ( var i = 0, j = this.length; i < j; i++ ) {
if ( this[i].style ) {
var display = jQuery.css( this[i], "display" );
if ( display !== "none" && !jQuery._data( this[i], "olddisplay" ) ) {
jQuery._data( this[i], "olddisplay", display );
}
}
}
// Set the display of the elements in a second loop
// to avoid the constant reflow
for ( i = 0; i < j; i++ ) {
if ( this[i].style ) {
this[i].style.display = "none";
}
}
return this;
}
},
// Save the old toggle function
_toggle: jQuery.fn.toggle,
toggle: function( fn, fn2, callback ) {
var bool = typeof fn === "boolean";
if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) {
this._toggle.apply( this, arguments );
} else if ( fn == null || bool ) {
this.each(function() {
var state = bool ? fn : jQuery(this).is(":hidden");
jQuery(this)[ state ? "show" : "hide" ]();
});
} else {
this.animate(genFx("toggle", 3), fn, fn2, callback);
}
return this;
},
fadeTo: function( speed, to, easing, callback ) {
return this.filter(":hidden").css("opacity", 0).show().end()
.animate({opacity: to}, speed, easing, callback);
},
animate: function( prop, speed, easing, callback ) {
var optall = jQuery.speed(speed, easing, callback);
if ( jQuery.isEmptyObject( prop ) ) {
return this.each( optall.complete, [ false ] );
}
// Do not change referenced properties as per-property easing will be lost
prop = jQuery.extend( {}, prop );
return this[ optall.queue === false ? "each" : "queue" ](function() {
// XXX 'this' does not always have a nodeName when running the
// test suite
if ( optall.queue === false ) {
jQuery._mark( this );
}
var opt = jQuery.extend( {}, optall ),
isElement = this.nodeType === 1,
hidden = isElement && jQuery(this).is(":hidden"),
name, val, p,
display, e,
parts, start, end, unit;
// will store per property easing and be used to determine when an animation is complete
opt.animatedProperties = {};
for ( p in prop ) {
// property name normalization
name = jQuery.camelCase( p );
if ( p !== name ) {
prop[ name ] = prop[ p ];
delete prop[ p ];
}
val = prop[ name ];
// easing resolution: per property > opt.specialEasing > opt.easing > 'swing' (default)
if ( jQuery.isArray( val ) ) {
opt.animatedProperties[ name ] = val[ 1 ];
val = prop[ name ] = val[ 0 ];
} else {
opt.animatedProperties[ name ] = opt.specialEasing && opt.specialEasing[ name ] || opt.easing || 'swing';
}
if ( val === "hide" && hidden || val === "show" && !hidden ) {
return opt.complete.call( this );
}
if ( isElement && ( name === "height" || name === "width" ) ) {
// Make sure that nothing sneaks out
// Record all 3 overflow attributes because IE does not
// change the overflow attribute when overflowX and
// overflowY are set to the same value
opt.overflow = [ this.style.overflow, this.style.overflowX, this.style.overflowY ];
// Set display property to inline-block for height/width
// animations on inline elements that are having width/height
// animated
if ( jQuery.css( this, "display" ) === "inline" &&
jQuery.css( this, "float" ) === "none" ) {
if ( !jQuery.support.inlineBlockNeedsLayout ) {
this.style.display = "inline-block";
} else {
display = defaultDisplay( this.nodeName );
// inline-level elements accept inline-block;
// block-level elements need to be inline with layout
if ( display === "inline" ) {
this.style.display = "inline-block";
} else {
this.style.display = "inline";
this.style.zoom = 1;
}
}
}
}
}
if ( opt.overflow != null ) {
this.style.overflow = "hidden";
}
for ( p in prop ) {
e = new jQuery.fx( this, opt, p );
val = prop[ p ];
if ( rfxtypes.test(val) ) {
e[ val === "toggle" ? hidden ? "show" : "hide" : val ]();
} else {
parts = rfxnum.exec( val );
start = e.cur();
if ( parts ) {
end = parseFloat( parts[2] );
unit = parts[3] || ( jQuery.cssNumber[ p ] ? "" : "px" );
// We need to compute starting value
if ( unit !== "px" ) {
jQuery.style( this, p, (end || 1) + unit);
start = ((end || 1) / e.cur()) * start;
jQuery.style( this, p, start + unit);
}
// If a +=/-= token was provided, we're doing a relative animation
if ( parts[1] ) {
end = ( (parts[ 1 ] === "-=" ? -1 : 1) * end ) + start;
}
e.custom( start, end, unit );
} else {
e.custom( start, val, "" );
}
}
}
// For JS strict compliance
return true;
});
},
stop: function( clearQueue, gotoEnd ) {
if ( clearQueue ) {
this.queue([]);
}
this.each(function() {
var timers = jQuery.timers,
i = timers.length;
// clear marker counters if we know they won't be
if ( !gotoEnd ) {
jQuery._unmark( true, this );
}
while ( i-- ) {
if ( timers[i].elem === this ) {
if (gotoEnd) {
// force the next step to be the last
timers[i](true);
}
timers.splice(i, 1);
}
}
});
// start the next in the queue if the last step wasn't forced
if ( !gotoEnd ) {
this.dequeue();
}
return this;
}
});
// Animations created synchronously will run synchronously
function createFxNow() {
setTimeout( clearFxNow, 0 );
return ( fxNow = jQuery.now() );
}
function clearFxNow() {
fxNow = undefined;
}
// Generate parameters to create a standard animation
function genFx( type, num ) {
var obj = {};
jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function() {
obj[ this ] = type;
});
return obj;
}
// Generate shortcuts for custom animations
jQuery.each({
slideDown: genFx("show", 1),
slideUp: genFx("hide", 1),
slideToggle: genFx("toggle", 1),
fadeIn: { opacity: "show" },
fadeOut: { opacity: "hide" },
fadeToggle: { opacity: "toggle" }
}, function( name, props ) {
jQuery.fn[ name ] = function( speed, easing, callback ) {
return this.animate( props, speed, easing, callback );
};
});
jQuery.extend({
speed: function( speed, easing, fn ) {
var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : {
complete: fn || !fn && easing ||
jQuery.isFunction( speed ) && speed,
duration: speed,
easing: fn && easing || easing && !jQuery.isFunction(easing) && easing
};
opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[opt.duration] : jQuery.fx.speeds._default;
// Queueing
opt.old = opt.complete;
opt.complete = function( noUnmark ) {
if ( jQuery.isFunction( opt.old ) ) {
opt.old.call( this );
}
if ( opt.queue !== false ) {
jQuery.dequeue( this );
} else if ( noUnmark !== false ) {
jQuery._unmark( this );
}
};
return opt;
},
easing: {
linear: function( p, n, firstNum, diff ) {
return firstNum + diff * p;
},
swing: function( p, n, firstNum, diff ) {
return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;
}
},
timers: [],
fx: function( elem, options, prop ) {
this.options = options;
this.elem = elem;
this.prop = prop;
options.orig = options.orig || {};
}
});
jQuery.fx.prototype = {
// Simple function for setting a style value
update: function() {
if ( this.options.step ) {
this.options.step.call( this.elem, this.now, this );
}
(jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );
},
// Get the current size
cur: function() {
if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) {
return this.elem[ this.prop ];
}
var parsed,
r = jQuery.css( this.elem, this.prop );
// Empty strings, null, undefined and "auto" are converted to 0,
// complex values such as "rotate(1rad)" are returned as is,
// simple values such as "10px" are parsed to Float.
return isNaN( parsed = parseFloat( r ) ) ? !r || r === "auto" ? 0 : r : parsed;
},
// Start an animation from one number to another
custom: function( from, to, unit ) {
var self = this,
fx = jQuery.fx;
this.startTime = fxNow || createFxNow();
this.start = from;
this.end = to;
this.unit = unit || this.unit || ( jQuery.cssNumber[ this.prop ] ? "" : "px" );
this.now = this.start;
this.pos = this.state = 0;
function t( gotoEnd ) {
return self.step(gotoEnd);
}
t.elem = this.elem;
if ( t() && jQuery.timers.push(t) && !timerId ) {
timerId = setInterval( fx.tick, fx.interval );
}
},
// Simple 'show' function
show: function() {
// Remember where we started, so that we can go back to it later
this.options.orig[this.prop] = jQuery.style( this.elem, this.prop );
this.options.show = true;
// Begin the animation
// Make sure that we start at a small width/height to avoid any
// flash of content
this.custom(this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur());
// Start by showing the element
jQuery( this.elem ).show();
},
// Simple 'hide' function
hide: function() {
// Remember where we started, so that we can go back to it later
this.options.orig[this.prop] = jQuery.style( this.elem, this.prop );
this.options.hide = true;
// Begin the animation
this.custom(this.cur(), 0);
},
// Each step of an animation
step: function( gotoEnd ) {
var t = fxNow || createFxNow(),
done = true,
elem = this.elem,
options = this.options,
i, n;
if ( gotoEnd || t >= options.duration + this.startTime ) {
this.now = this.end;
this.pos = this.state = 1;
this.update();
options.animatedProperties[ this.prop ] = true;
for ( i in options.animatedProperties ) {
if ( options.animatedProperties[i] !== true ) {
done = false;
}
}
if ( done ) {
// Reset the overflow
if ( options.overflow != null && !jQuery.support.shrinkWrapBlocks ) {
jQuery.each( [ "", "X", "Y" ], function (index, value) {
elem.style[ "overflow" + value ] = options.overflow[index];
});
}
// Hide the element if the "hide" operation was done
if ( options.hide ) {
jQuery(elem).hide();
}
// Reset the properties, if the item has been hidden or shown
if ( options.hide || options.show ) {
for ( var p in options.animatedProperties ) {
jQuery.style( elem, p, options.orig[p] );
}
}
// Execute the complete function
options.complete.call( elem );
}
return false;
} else {
// classical easing cannot be used with an Infinity duration
if ( options.duration == Infinity ) {
this.now = t;
} else {
n = t - this.startTime;
this.state = n / options.duration;
// Perform the easing function, defaults to swing
this.pos = jQuery.easing[ options.animatedProperties[ this.prop ] ]( this.state, n, 0, 1, options.duration );
this.now = this.start + ((this.end - this.start) * this.pos);
}
// Perform the next step of the animation
this.update();
}
return true;
}
};
jQuery.extend( jQuery.fx, {
tick: function() {
for ( var timers = jQuery.timers, i = 0 ; i < timers.length ; ++i ) {
if ( !timers[i]() ) {
timers.splice(i--, 1);
}
}
if ( !timers.length ) {
jQuery.fx.stop();
}
},
interval: 13,
stop: function() {
clearInterval( timerId );
timerId = null;
},
speeds: {
slow: 600,
fast: 200,
// Default speed
_default: 400
},
step: {
opacity: function( fx ) {
jQuery.style( fx.elem, "opacity", fx.now );
},
_default: function( fx ) {
if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) {
fx.elem.style[ fx.prop ] = (fx.prop === "width" || fx.prop === "height" ? Math.max(0, fx.now) : fx.now) + fx.unit;
} else {
fx.elem[ fx.prop ] = fx.now;
}
}
}
});
if ( jQuery.expr && jQuery.expr.filters ) {
jQuery.expr.filters.animated = function( elem ) {
return jQuery.grep(jQuery.timers, function( fn ) {
return elem === fn.elem;
}).length;
};
}
// Try to restore the default display value of an element
function defaultDisplay( nodeName ) {
if ( !elemdisplay[ nodeName ] ) {
var body = document.body,
elem = jQuery( "<" + nodeName + ">" ).appendTo( body ),
display = elem.css( "display" );
elem.remove();
// If the simple way fails,
// get element's real default display by attaching it to a temp iframe
if ( display === "none" || display === "" ) {
// No iframe to use yet, so create it
if ( !iframe ) {
iframe = document.createElement( "iframe" );
iframe.frameBorder = iframe.width = iframe.height = 0;
}
body.appendChild( iframe );
// Create a cacheable copy of the iframe document on first call.
// IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML
// document to it; WebKit & Firefox won't allow reusing the iframe document.
if ( !iframeDoc || !iframe.createElement ) {
iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;
iframeDoc.write( ( document.compatMode === "CSS1Compat" ? "<!doctype html>" : "" ) + "<html><body>" );
iframeDoc.close();
}
elem = iframeDoc.createElement( nodeName );
iframeDoc.body.appendChild( elem );
display = jQuery.css( elem, "display" );
body.removeChild( iframe );
}
// Store the correct default display
elemdisplay[ nodeName ] = display;
}
return elemdisplay[ nodeName ];
}
var rtable = /^t(?:able|d|h)$/i,
rroot = /^(?:body|html)$/i;
if ( "getBoundingClientRect" in document.documentElement ) {
jQuery.fn.offset = function( options ) {
var elem = this[0], box;
if ( options ) {
return this.each(function( i ) {
jQuery.offset.setOffset( this, options, i );
});
}
if ( !elem || !elem.ownerDocument ) {
return null;
}
if ( elem === elem.ownerDocument.body ) {
return jQuery.offset.bodyOffset( elem );
}
try {
box = elem.getBoundingClientRect();
} catch(e) {}
var doc = elem.ownerDocument,
docElem = doc.documentElement;
// Make sure we're not dealing with a disconnected DOM node
if ( !box || !jQuery.contains( docElem, elem ) ) {
return box ? { top: box.top, left: box.left } : { top: 0, left: 0 };
}
var body = doc.body,
win = getWindow(doc),
clientTop = docElem.clientTop || body.clientTop || 0,
clientLeft = docElem.clientLeft || body.clientLeft || 0,
scrollTop = win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop,
scrollLeft = win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft,
top = box.top + scrollTop - clientTop,
left = box.left + scrollLeft - clientLeft;
return { top: top, left: left };
};
} else {
jQuery.fn.offset = function( options ) {
var elem = this[0];
if ( options ) {
return this.each(function( i ) {
jQuery.offset.setOffset( this, options, i );
});
}
if ( !elem || !elem.ownerDocument ) {
return null;
}
if ( elem === elem.ownerDocument.body ) {
return jQuery.offset.bodyOffset( elem );
}
jQuery.offset.initialize();
var computedStyle,
offsetParent = elem.offsetParent,
prevOffsetParent = elem,
doc = elem.ownerDocument,
docElem = doc.documentElement,
body = doc.body,
defaultView = doc.defaultView,
prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle,
top = elem.offsetTop,
left = elem.offsetLeft;
while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) {
break;
}
computedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle;
top -= elem.scrollTop;
left -= elem.scrollLeft;
if ( elem === offsetParent ) {
top += elem.offsetTop;
left += elem.offsetLeft;
if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) {
top += parseFloat( computedStyle.borderTopWidth ) || 0;
left += parseFloat( computedStyle.borderLeftWidth ) || 0;
}
prevOffsetParent = offsetParent;
offsetParent = elem.offsetParent;
}
if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) {
top += parseFloat( computedStyle.borderTopWidth ) || 0;
left += parseFloat( computedStyle.borderLeftWidth ) || 0;
}
prevComputedStyle = computedStyle;
}
if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) {
top += body.offsetTop;
left += body.offsetLeft;
}
if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) {
top += Math.max( docElem.scrollTop, body.scrollTop );
left += Math.max( docElem.scrollLeft, body.scrollLeft );
}
return { top: top, left: left };
};
}
jQuery.offset = {
initialize: function() {
var body = document.body, container = document.createElement("div"), innerDiv, checkDiv, table, td, bodyMarginTop = parseFloat( jQuery.css(body, "marginTop") ) || 0,
html = "<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";
jQuery.extend( container.style, { position: "absolute", top: 0, left: 0, margin: 0, border: 0, width: "1px", height: "1px", visibility: "hidden" } );
container.innerHTML = html;
body.insertBefore( container, body.firstChild );
innerDiv = container.firstChild;
checkDiv = innerDiv.firstChild;
td = innerDiv.nextSibling.firstChild.firstChild;
this.doesNotAddBorder = (checkDiv.offsetTop !== 5);
this.doesAddBorderForTableAndCells = (td.offsetTop === 5);
checkDiv.style.position = "fixed";
checkDiv.style.top = "20px";
// safari subtracts parent border width here which is 5px
this.supportsFixedPosition = (checkDiv.offsetTop === 20 || checkDiv.offsetTop === 15);
checkDiv.style.position = checkDiv.style.top = "";
innerDiv.style.overflow = "hidden";
innerDiv.style.position = "relative";
this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5);
this.doesNotIncludeMarginInBodyOffset = (body.offsetTop !== bodyMarginTop);
body.removeChild( container );
jQuery.offset.initialize = jQuery.noop;
},
bodyOffset: function( body ) {
var top = body.offsetTop,
left = body.offsetLeft;
jQuery.offset.initialize();
if ( jQuery.offset.doesNotIncludeMarginInBodyOffset ) {
top += parseFloat( jQuery.css(body, "marginTop") ) || 0;
left += parseFloat( jQuery.css(body, "marginLeft") ) || 0;
}
return { top: top, left: left };
},
setOffset: function( elem, options, i ) {
var position = jQuery.css( elem, "position" );
// set position first, in-case top/left are set even on static elem
if ( position === "static" ) {
elem.style.position = "relative";
}
var curElem = jQuery( elem ),
curOffset = curElem.offset(),
curCSSTop = jQuery.css( elem, "top" ),
curCSSLeft = jQuery.css( elem, "left" ),
calculatePosition = (position === "absolute" || position === "fixed") && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1,
props = {}, curPosition = {}, curTop, curLeft;
// need to be able to calculate position if either top or left is auto and position is either absolute or fixed
if ( calculatePosition ) {
curPosition = curElem.position();
curTop = curPosition.top;
curLeft = curPosition.left;
} else {
curTop = parseFloat( curCSSTop ) || 0;
curLeft = parseFloat( curCSSLeft ) || 0;
}
if ( jQuery.isFunction( options ) ) {
options = options.call( elem, i, curOffset );
}
if (options.top != null) {
props.top = (options.top - curOffset.top) + curTop;
}
if (options.left != null) {
props.left = (options.left - curOffset.left) + curLeft;
}
if ( "using" in options ) {
options.using.call( elem, props );
} else {
curElem.css( props );
}
}
};
jQuery.fn.extend({
position: function() {
if ( !this[0] ) {
return null;
}
var elem = this[0],
// Get *real* offsetParent
offsetParent = this.offsetParent(),
// Get correct offsets
offset = this.offset(),
parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();
// Subtract element margins
// note: when an element has margin: auto the offsetLeft and marginLeft
// are the same in Safari causing offset.left to incorrectly be 0
offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0;
offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0;
// Add offsetParent borders
parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0;
parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0;
// Subtract the two offsets
return {
top: offset.top - parentOffset.top,
left: offset.left - parentOffset.left
};
},
offsetParent: function() {
return this.map(function() {
var offsetParent = this.offsetParent || document.body;
while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) {
offsetParent = offsetParent.offsetParent;
}
return offsetParent;
});
}
});
// Create scrollLeft and scrollTop methods
jQuery.each( ["Left", "Top"], function( i, name ) {
var method = "scroll" + name;
jQuery.fn[ method ] = function( val ) {
var elem, win;
if ( val === undefined ) {
elem = this[ 0 ];
if ( !elem ) {
return null;
}
win = getWindow( elem );
// Return the scroll offset
return win ? ("pageXOffset" in win) ? win[ i ? "pageYOffset" : "pageXOffset" ] :
jQuery.support.boxModel && win.document.documentElement[ method ] ||
win.document.body[ method ] :
elem[ method ];
}
// Set the scroll offset
return this.each(function() {
win = getWindow( this );
if ( win ) {
win.scrollTo(
!i ? val : jQuery( win ).scrollLeft(),
i ? val : jQuery( win ).scrollTop()
);
} else {
this[ method ] = val;
}
});
};
});
function getWindow( elem ) {
return jQuery.isWindow( elem ) ?
elem :
elem.nodeType === 9 ?
elem.defaultView || elem.parentWindow :
false;
}
// Create width, height, innerHeight, innerWidth, outerHeight and outerWidth methods
jQuery.each([ "Height", "Width" ], function( i, name ) {
var type = name.toLowerCase();
// innerHeight and innerWidth
jQuery.fn[ "inner" + name ] = function() {
var elem = this[0];
return elem && elem.style ?
parseFloat( jQuery.css( elem, type, "padding" ) ) :
null;
};
// outerHeight and outerWidth
jQuery.fn[ "outer" + name ] = function( margin ) {
var elem = this[0];
return elem && elem.style ?
parseFloat( jQuery.css( elem, type, margin ? "margin" : "border" ) ) :
null;
};
jQuery.fn[ type ] = function( size ) {
// Get window width or height
var elem = this[0];
if ( !elem ) {
return size == null ? null : this;
}
if ( jQuery.isFunction( size ) ) {
return this.each(function( i ) {
var self = jQuery( this );
self[ type ]( size.call( this, i, self[ type ]() ) );
});
}
if ( jQuery.isWindow( elem ) ) {
// Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
// 3rd condition allows Nokia support, as it supports the docElem prop but not CSS1Compat
var docElemProp = elem.document.documentElement[ "client" + name ],
body = elem.document.body;
return elem.document.compatMode === "CSS1Compat" && docElemProp ||
body && body[ "client" + name ] || docElemProp;
// Get document width or height
} else if ( elem.nodeType === 9 ) {
// Either scroll[Width/Height] or offset[Width/Height], whichever is greater
return Math.max(
elem.documentElement["client" + name],
elem.body["scroll" + name], elem.documentElement["scroll" + name],
elem.body["offset" + name], elem.documentElement["offset" + name]
);
// Get or set width or height on the element
} else if ( size === undefined ) {
var orig = jQuery.css( elem, type ),
ret = parseFloat( orig );
return jQuery.isNaN( ret ) ? orig : ret;
// Set the width or height on the element (default to pixels if value is unitless)
} else {
return this.css( type, typeof size === "string" ? size : size + "px" );
}
};
});
// Expose jQuery to the global object
window.jQuery = window.$ = jQuery;
})(window);
// Underscore.js 1.1.7
// (c) 2011 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 **CommonJS**, with backwards-compatibility
// for the old `require()` API. If we're not in CommonJS, add `_` to the
// global object.
if (typeof module !== 'undefined' && module.exports) {
module.exports = _;
_._ = _;
} else {
// Exported as a string, for Closure Compiler "advanced" mode.
root['_'] = _;
}
// Current version.
_.VERSION = '1.1.7';
// 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 (hasOwnProperty.call(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 = 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);
});
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 = memo !== void 0;
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) {
if (obj == null) obj = [];
if (nativeReduceRight && obj.reduceRight === nativeReduceRight) {
if (context) iterator = _.bind(iterator, context);
return memo !== void 0 ? obj.reduceRight(iterator, memo) : obj.reduceRight(iterator);
}
var reversed = (_.isArray(obj) ? obj.slice() : _.toArray(obj)).reverse();
return _.reduce(reversed, iterator, memo, context);
};
// 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 |= 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;
any(obj, function(value) {
if (found = value === target) return true;
});
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 (method.call ? 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)) return Math.max.apply(Math, obj);
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)) return Math.min.apply(Math, obj);
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;
};
// Sort the object's values by a criterion produced by an iterator.
_.sortBy = function(obj, iterator, context) {
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;
return a < b ? -1 : a > b ? 1 : 0;
}), 'value');
};
// Groups the object's values by a criterion produced by an iterator
_.groupBy = function(obj, iterator) {
var result = {};
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(iterable) {
if (!iterable) return [];
if (iterable.toArray) return iterable.toArray();
if (_.isArray(iterable)) return slice.call(iterable);
if (_.isArguments(iterable)) return slice.call(iterable);
return _.values(iterable);
};
// Return the number of elements in an object.
_.size = function(obj) {
return _.toArray(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`. The **guard** check allows it to work
// with `_.map`.
_.first = _.head = function(array, n, guard) {
return (n != null) && !guard ? slice.call(array, 0, n) : array[0];
};
// 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);
};
// Get the last element of an array.
_.last = function(array) {
return array[array.length - 1];
};
// 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) {
return _.reduce(array, function(memo, value) {
if (_.isArray(value)) return memo.concat(_.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) {
return _.reduce(array, function(memo, el, i) {
if (0 == i || (isSorted === true ? _.last(memo) != el : !_.include(memo, el))) memo[memo.length] = el;
return memo;
}, []);
};
// Produce an array that contains the union: each distinct element from all of
// the passed-in arrays.
_.union = function() {
return _.uniq(_.flatten(arguments));
};
// 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 another.
// Only the elements present in just the first array will remain.
_.difference = function(array, other) {
return _.filter(array, function(value){ return !_.include(other, 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 (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 (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
// ------------------
// 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(func, obj) {
if (func.bind === nativeBind && nativeBind) return nativeBind.apply(func, slice.call(arguments, 1));
var args = slice.call(arguments, 2);
return function() {
return func.apply(obj, args.concat(slice.call(arguments)));
};
};
// 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 hasOwnProperty.call(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(func, 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)));
};
// Internal function used to implement `_.throttle` and `_.debounce`.
var limit = function(func, wait, debounce) {
var timeout;
return function() {
var context = this, args = arguments;
var throttler = function() {
timeout = null;
func.apply(context, args);
};
if (debounce) clearTimeout(timeout);
if (debounce || !timeout) timeout = setTimeout(throttler, wait);
};
};
// Returns a function, that, when invoked, will only be triggered at most once
// during a given window of time.
_.throttle = function(func, wait) {
return limit(func, wait, false);
};
// 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.
_.debounce = function(func, wait) {
return limit(func, wait, true);
};
// 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));
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 = slice.call(arguments);
return function() {
var args = slice.call(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) {
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 (hasOwnProperty.call(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) {
if (source[prop] !== void 0) obj[prop] = source[prop];
}
});
return obj;
};
// 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) {
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;
};
// Perform a deep comparison to check if two objects are equal.
_.isEqual = function(a, b) {
// Check object identity.
if (a === b) return true;
// Different types?
var atype = typeof(a), btype = typeof(b);
if (atype != btype) return false;
// Basic equality test (watch out for coercions).
if (a == b) return true;
// One is falsy and the other truthy.
if ((!a && b) || (a && !b)) return false;
// Unwrap any wrapped objects.
if (a._chain) a = a._wrapped;
if (b._chain) b = b._wrapped;
// One of them implements an isEqual()?
if (a.isEqual) return a.isEqual(b);
if (b.isEqual) return b.isEqual(a);
// Check dates' integer values.
if (_.isDate(a) && _.isDate(b)) return a.getTime() === b.getTime();
// Both are NaN?
if (_.isNaN(a) && _.isNaN(b)) return false;
// Compare regular expressions.
if (_.isRegExp(a) && _.isRegExp(b))
return a.source === b.source &&
a.global === b.global &&
a.ignoreCase === b.ignoreCase &&
a.multiline === b.multiline;
// If a is not an object by this point, we can't handle it.
if (atype !== 'object') return false;
// Check for different array lengths before comparing contents.
if (a.length && (a.length !== b.length)) return false;
// Nothing else worked, deep compare the contents.
var aKeys = _.keys(a), bKeys = _.keys(b);
// Different object sizes?
if (aKeys.length != bKeys.length) return false;
// Recursive comparison of contents.
for (var key in a) if (!(key in b) || !_.isEqual(a[key], b[key])) return false;
return true;
};
// Is a given array or object empty?
_.isEmpty = function(obj) {
if (_.isArray(obj) || _.isString(obj)) return obj.length === 0;
for (var key in obj) if (hasOwnProperty.call(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 !!(obj && hasOwnProperty.call(obj, 'callee'));
};
// Is a given value a function?
_.isFunction = function(obj) {
return !!(obj && obj.constructor && obj.call && obj.apply);
};
// Is a given value a string?
_.isString = function(obj) {
return !!(obj === '' || (obj && obj.charCodeAt && obj.substr));
};
// Is a given value a number?
_.isNumber = function(obj) {
return !!(obj === 0 || (obj && obj.toExponential && obj.toFixed));
};
// Is the given value `NaN`? `NaN` happens to be the only value in JavaScript
// that does not equal itself.
_.isNaN = function(obj) {
return obj !== obj;
};
// Is a given value a boolean?
_.isBoolean = function(obj) {
return obj === true || obj === false;
};
// Is a given value a date?
_.isDate = function(obj) {
return !!(obj && obj.getTimezoneOffset && obj.setUTCFullYear);
};
// Is the given value a regular expression?
_.isRegExp = function(obj) {
return !!(obj && obj.test && obj.exec && (obj.ignoreCase || obj.ignoreCase === false));
};
// 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;
};
// 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);
};
// 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
};
// 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(str, data) {
var c = _.templateSettings;
var tmpl = 'var __p=[],print=function(){__p.push.apply(__p,arguments);};' +
'with(obj||{}){__p.push(\'' +
str.replace(/\\/g, '\\\\')
.replace(/'/g, "\\'")
.replace(c.interpolate, function(match, code) {
return "'," + code.replace(/\\'/g, "'") + ",'";
})
.replace(c.evaluate || null, function(match, code) {
return "');" + code.replace(/\\'/g, "'")
.replace(/[\r\n\t]/g, ' ') + "__p.push('";
})
.replace(/\r/g, '\\r')
.replace(/\n/g, '\\n')
.replace(/\t/g, '\\t')
+ "');}return __p.join('');";
var func = new Function('obj', tmpl);
return data ? func(data) : func;
};
// 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() {
method.apply(this._wrapped, arguments);
return result(this._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;
};
})();
// Backbone.js 0.5.3
// (c) 2010 Jeremy Ashkenas, DocumentCloud Inc.
// Backbone may be freely distributed under the MIT license.
// For all details and documentation:
// http://documentcloud.github.com/backbone
(function(){
// Initial Setup
// -------------
// Save a reference to the global object.
var root = this;
// Save the previous value of the `Backbone` variable.
var previousBackbone = root.Backbone;
// The top-level namespace. All public Backbone classes and modules will
// be attached to this. Exported for both CommonJS and the browser.
var Backbone;
if (typeof exports !== 'undefined') {
Backbone = exports;
} else {
Backbone = root.Backbone = {};
}
// Current version of the library. Keep in sync with `package.json`.
Backbone.VERSION = '0.5.3';
// Require Underscore, if we're on the server, and it's not already present.
var _ = root._;
if (!_ && (typeof require !== 'undefined')) _ = require('underscore')._;
// For Backbone's purposes, jQuery or Zepto owns the `$` variable.
var $ = root.jQuery || root.Zepto;
// Runs Backbone.js in *noConflict* mode, returning the `Backbone` variable
// to its previous owner. Returns a reference to this Backbone object.
Backbone.noConflict = function() {
root.Backbone = previousBackbone;
return this;
};
// Turn on `emulateHTTP` to support legacy HTTP servers. Setting this option will
// fake `"PUT"` and `"DELETE"` requests via the `_method` parameter and set a
// `X-Http-Method-Override` header.
Backbone.emulateHTTP = false;
// Turn on `emulateJSON` to support legacy servers that can't deal with direct
// `application/json` requests ... will encode the body as
// `application/x-www-form-urlencoded` instead and will send the model in a
// form param named `model`.
Backbone.emulateJSON = false;
// Backbone.Events
// -----------------
// A module that can be mixed in to *any object* in order to provide it with
// custom events. You may `bind` or `unbind` a callback function to an event;
// `trigger`-ing an event fires all callbacks in succession.
//
// var object = {};
// _.extend(object, Backbone.Events);
// object.bind('expand', function(){ alert('expanded'); });
// object.trigger('expand');
//
Backbone.Events = {
// Bind an event, specified by a string name, `ev`, to a `callback` function.
// Passing `"all"` will bind the callback to all events fired.
bind : function(ev, callback, context) {
var calls = this._callbacks || (this._callbacks = {});
var list = calls[ev] || (calls[ev] = []);
list.push([callback, context]);
return this;
},
// Remove one or many callbacks. If `callback` is null, removes all
// callbacks for the event. If `ev` is null, removes all bound callbacks
// for all events.
unbind : function(ev, callback) {
var calls;
if (!ev) {
this._callbacks = {};
} else if (calls = this._callbacks) {
if (!callback) {
calls[ev] = [];
} else {
var list = calls[ev];
if (!list) return this;
for (var i = 0, l = list.length; i < l; i++) {
if (list[i] && callback === list[i][0]) {
list[i] = null;
break;
}
}
}
}
return this;
},
// Trigger an event, firing all bound callbacks. Callbacks are passed the
// same arguments as `trigger` is, apart from the event name.
// Listening for `"all"` passes the true event name as the first argument.
trigger : function(eventName) {
var list, calls, ev, callback, args;
var both = 2;
if (!(calls = this._callbacks)) return this;
while (both--) {
ev = both ? eventName : 'all';
if (list = calls[ev]) {
for (var i = 0, l = list.length; i < l; i++) {
if (!(callback = list[i])) {
list.splice(i, 1); i--; l--;
} else {
args = both ? Array.prototype.slice.call(arguments, 1) : arguments;
callback[0].apply(callback[1] || this, args);
}
}
}
}
return this;
}
};
// Backbone.Model
// --------------
// Create a new model, with defined attributes. A client id (`cid`)
// is automatically generated and assigned for you.
Backbone.Model = function(attributes, options) {
var defaults;
attributes || (attributes = {});
if (defaults = this.defaults) {
if (_.isFunction(defaults)) defaults = defaults.call(this);
attributes = _.extend({}, defaults, attributes);
}
this.attributes = {};
this._escapedAttributes = {};
this.cid = _.uniqueId('c');
this.set(attributes, {silent : true});
this._changed = false;
this._previousAttributes = _.clone(this.attributes);
if (options && options.collection) this.collection = options.collection;
this.initialize(attributes, options);
};
// Attach all inheritable methods to the Model prototype.
_.extend(Backbone.Model.prototype, Backbone.Events, {
// A snapshot of the model's previous attributes, taken immediately
// after the last `"change"` event was fired.
_previousAttributes : null,
// Has the item been changed since the last `"change"` event?
_changed : false,
// The default name for the JSON `id` attribute is `"id"`. MongoDB and
// CouchDB users may want to set this to `"_id"`.
idAttribute : 'id',
// Initialize is an empty function by default. Override it with your own
// initialization logic.
initialize : function(){},
// Return a copy of the model's `attributes` object.
toJSON : function() {
return _.clone(this.attributes);
},
// Get the value of an attribute.
get : function(attr) {
return this.attributes[attr];
},
// Get the HTML-escaped value of an attribute.
escape : function(attr) {
var html;
if (html = this._escapedAttributes[attr]) return html;
var val = this.attributes[attr];
return this._escapedAttributes[attr] = escapeHTML(val == null ? '' : '' + val);
},
// Returns `true` if the attribute contains a value that is not null
// or undefined.
has : function(attr) {
return this.attributes[attr] != null;
},
// Set a hash of model attributes on the object, firing `"change"` unless you
// choose to silence it.
set : function(attrs, options) {
// Extract attributes and options.
options || (options = {});
if (!attrs) return this;
if (attrs.attributes) attrs = attrs.attributes;
var now = this.attributes, escaped = this._escapedAttributes;
// Run validation.
if (!options.silent && this.validate && !this._performValidation(attrs, options)) return false;
// Check for changes of `id`.
if (this.idAttribute in attrs) this.id = attrs[this.idAttribute];
// We're about to start triggering change events.
var alreadyChanging = this._changing;
this._changing = true;
// Update attributes.
for (var attr in attrs) {
var val = attrs[attr];
if (!_.isEqual(now[attr], val)) {
now[attr] = val;
delete escaped[attr];
this._changed = true;
if (!options.silent) this.trigger('change:' + attr, this, val, options);
}
}
// Fire the `"change"` event, if the model has been changed.
if (!alreadyChanging && !options.silent && this._changed) this.change(options);
this._changing = false;
return this;
},
// Remove an attribute from the model, firing `"change"` unless you choose
// to silence it. `unset` is a noop if the attribute doesn't exist.
unset : function(attr, options) {
if (!(attr in this.attributes)) return this;
options || (options = {});
var value = this.attributes[attr];
// Run validation.
var validObj = {};
validObj[attr] = void 0;
if (!options.silent && this.validate && !this._performValidation(validObj, options)) return false;
// Remove the attribute.
delete this.attributes[attr];
delete this._escapedAttributes[attr];
if (attr == this.idAttribute) delete this.id;
this._changed = true;
if (!options.silent) {
this.trigger('change:' + attr, this, void 0, options);
this.change(options);
}
return this;
},
// Clear all attributes on the model, firing `"change"` unless you choose
// to silence it.
clear : function(options) {
options || (options = {});
var attr;
var old = this.attributes;
// Run validation.
var validObj = {};
for (attr in old) validObj[attr] = void 0;
if (!options.silent && this.validate && !this._performValidation(validObj, options)) return false;
this.attributes = {};
this._escapedAttributes = {};
this._changed = true;
if (!options.silent) {
for (attr in old) {
this.trigger('change:' + attr, this, void 0, options);
}
this.change(options);
}
return this;
},
// Fetch the model from the server. If the server's representation of the
// model differs from its current attributes, they will be overriden,
// triggering a `"change"` event.
fetch : function(options) {
options || (options = {});
var model = this;
var success = options.success;
options.success = function(resp, status, xhr) {
if (!model.set(model.parse(resp, xhr), options)) return false;
if (success) success(model, resp);
};
options.error = wrapError(options.error, model, options);
return (this.sync || Backbone.sync).call(this, 'read', this, options);
},
// Set a hash of model attributes, and sync the model to the server.
// If the server returns an attributes hash that differs, the model's
// state will be `set` again.
save : function(attrs, options) {
options || (options = {});
if (attrs && !this.set(attrs, options)) return false;
var model = this;
var success = options.success;
options.success = function(resp, status, xhr) {
if (!model.set(model.parse(resp, xhr), options)) return false;
if (success) success(model, resp, xhr);
};
options.error = wrapError(options.error, model, options);
var method = this.isNew() ? 'create' : 'update';
return (this.sync || Backbone.sync).call(this, method, this, options);
},
// Destroy this model on the server if it was already persisted. Upon success, the model is removed
// from its collection, if it has one.
destroy : function(options) {
options || (options = {});
if (this.isNew()) return this.trigger('destroy', this, this.collection, options);
var model = this;
var success = options.success;
options.success = function(resp) {
model.trigger('destroy', model, model.collection, options);
if (success) success(model, resp);
};
options.error = wrapError(options.error, model, options);
return (this.sync || Backbone.sync).call(this, 'delete', this, options);
},
// Default URL for the model's representation on the server -- if you're
// using Backbone's restful methods, override this to change the endpoint
// that will be called.
url : function() {
var base = getUrl(this.collection) || this.urlRoot || urlError();
if (this.isNew()) return base;
return base + (base.charAt(base.length - 1) == '/' ? '' : '/') + encodeURIComponent(this.id);
},
// **parse** converts a response into the hash of attributes to be `set` on
// the model. The default implementation is just to pass the response along.
parse : function(resp, xhr) {
return resp;
},
// Create a new model with identical attributes to this one.
clone : function() {
return new this.constructor(this);
},
// A model is new if it has never been saved to the server, and lacks an id.
isNew : function() {
return this.id == null;
},
// Call this method to manually fire a `change` event for this model.
// Calling this will cause all objects observing the model to update.
change : function(options) {
this.trigger('change', this, options);
this._previousAttributes = _.clone(this.attributes);
this._changed = false;
},
// Determine if the model has changed since the last `"change"` event.
// If you specify an attribute name, determine if that attribute has changed.
hasChanged : function(attr) {
if (attr) return this._previousAttributes[attr] != this.attributes[attr];
return this._changed;
},
// Return an object containing all the attributes that have changed, or false
// if there are no changed attributes. Useful for determining what parts of a
// view need to be updated and/or what attributes need to be persisted to
// the server.
changedAttributes : function(now) {
now || (now = this.attributes);
var old = this._previousAttributes;
var changed = false;
for (var attr in now) {
if (!_.isEqual(old[attr], now[attr])) {
changed = changed || {};
changed[attr] = now[attr];
}
}
return changed;
},
// Get the previous value of an attribute, recorded at the time the last
// `"change"` event was fired.
previous : function(attr) {
if (!attr || !this._previousAttributes) return null;
return this._previousAttributes[attr];
},
// Get all of the attributes of the model at the time of the previous
// `"change"` event.
previousAttributes : function() {
return _.clone(this._previousAttributes);
},
// Run validation against a set of incoming attributes, returning `true`
// if all is well. If a specific `error` callback has been passed,
// call that instead of firing the general `"error"` event.
_performValidation : function(attrs, options) {
var error = this.validate(attrs);
if (error) {
if (options.error) {
options.error(this, error, options);
} else {
this.trigger('error', this, error, options);
}
return false;
}
return true;
}
});
// Backbone.Collection
// -------------------
// Provides a standard collection class for our sets of models, ordered
// or unordered. If a `comparator` is specified, the Collection will maintain
// its models in sort order, as they're added and removed.
Backbone.Collection = function(models, options) {
options || (options = {});
if (options.comparator) this.comparator = options.comparator;
_.bindAll(this, '_onModelEvent', '_removeReference');
this._reset();
if (models) this.reset(models, {silent: true});
this.initialize.apply(this, arguments);
};
// Define the Collection's inheritable methods.
_.extend(Backbone.Collection.prototype, Backbone.Events, {
// The default model for a collection is just a **Backbone.Model**.
// This should be overridden in most cases.
model : Backbone.Model,
// Initialize is an empty function by default. Override it with your own
// initialization logic.
initialize : function(){},
// The JSON representation of a Collection is an array of the
// models' attributes.
toJSON : function() {
return this.map(function(model){ return model.toJSON(); });
},
// Add a model, or list of models to the set. Pass **silent** to avoid
// firing the `added` event for every new model.
add : function(models, options) {
if (_.isArray(models)) {
for (var i = 0, l = models.length; i < l; i++) {
this._add(models[i], options);
}
} else {
this._add(models, options);
}
return this;
},
// Remove a model, or a list of models from the set. Pass silent to avoid
// firing the `removed` event for every model removed.
remove : function(models, options) {
if (_.isArray(models)) {
for (var i = 0, l = models.length; i < l; i++) {
this._remove(models[i], options);
}
} else {
this._remove(models, options);
}
return this;
},
// Get a model from the set by id.
get : function(id) {
if (id == null) return null;
return this._byId[id.id != null ? id.id : id];
},
// Get a model from the set by client id.
getByCid : function(cid) {
return cid && this._byCid[cid.cid || cid];
},
// Get the model at the given index.
at: function(index) {
return this.models[index];
},
// Force the collection to re-sort itself. You don't need to call this under normal
// circumstances, as the set will maintain sort order as each item is added.
sort : function(options) {
options || (options = {});
if (!this.comparator) throw new Error('Cannot sort a set without a comparator');
this.models = this.sortBy(this.comparator);
if (!options.silent) this.trigger('reset', this, options);
return this;
},
// Pluck an attribute from each model in the collection.
pluck : function(attr) {
return _.map(this.models, function(model){ return model.get(attr); });
},
// When you have more items than you want to add or remove individually,
// you can reset the entire set with a new list of models, without firing
// any `added` or `removed` events. Fires `reset` when finished.
reset : function(models, options) {
models || (models = []);
options || (options = {});
this.each(this._removeReference);
this._reset();
this.add(models, {silent: true});
if (!options.silent) this.trigger('reset', this, options);
return this;
},
// Fetch the default set of models for this collection, resetting the
// collection when they arrive. If `add: true` is passed, appends the
// models to the collection instead of resetting.
fetch : function(options) {
options || (options = {});
var collection = this;
var success = options.success;
options.success = function(resp, status, xhr) {
collection[options.add ? 'add' : 'reset'](collection.parse(resp, xhr), options);
if (success) success(collection, resp);
};
options.error = wrapError(options.error, collection, options);
return (this.sync || Backbone.sync).call(this, 'read', this, options);
},
// Create a new instance of a model in this collection. After the model
// has been created on the server, it will be added to the collection.
// Returns the model, or 'false' if validation on a new model fails.
create : function(model, options) {
var coll = this;
options || (options = {});
model = this._prepareModel(model, options);
if (!model) return false;
var success = options.success;
options.success = function(nextModel, resp, xhr) {
coll.add(nextModel, options);
if (success) success(nextModel, resp, xhr);
};
model.save(null, options);
return model;
},
// **parse** converts a response into a list of models to be added to the
// collection. The default implementation is just to pass it through.
parse : function(resp, xhr) {
return resp;
},
// Proxy to _'s chain. Can't be proxied the same way the rest of the
// underscore methods are proxied because it relies on the underscore
// constructor.
chain: function () {
return _(this.models).chain();
},
// Reset all internal state. Called when the collection is reset.
_reset : function(options) {
this.length = 0;
this.models = [];
this._byId = {};
this._byCid = {};
},
// Prepare a model to be added to this collection
_prepareModel: function(model, options) {
if (!(model instanceof Backbone.Model)) {
var attrs = model;
model = new this.model(attrs, {collection: this});
if (model.validate && !model._performValidation(attrs, options)) model = false;
} else if (!model.collection) {
model.collection = this;
}
return model;
},
// Internal implementation of adding a single model to the set, updating
// hash indexes for `id` and `cid` lookups.
// Returns the model, or 'false' if validation on a new model fails.
_add : function(model, options) {
options || (options = {});
model = this._prepareModel(model, options);
if (!model) return false;
var already = this.getByCid(model);
if (already) throw new Error(["Can't add the same model to a set twice", already.id]);
this._byId[model.id] = model;
this._byCid[model.cid] = model;
var index = options.at != null ? options.at :
this.comparator ? this.sortedIndex(model, this.comparator) :
this.length;
this.models.splice(index, 0, model);
model.bind('all', this._onModelEvent);
this.length++;
if (!options.silent) model.trigger('add', model, this, options);
return model;
},
// Internal implementation of removing a single model from the set, updating
// hash indexes for `id` and `cid` lookups.
_remove : function(model, options) {
options || (options = {});
model = this.getByCid(model) || this.get(model);
if (!model) return null;
delete this._byId[model.id];
delete this._byCid[model.cid];
this.models.splice(this.indexOf(model), 1);
this.length--;
if (!options.silent) model.trigger('remove', model, this, options);
this._removeReference(model);
return model;
},
// Internal method to remove a model's ties to a collection.
_removeReference : function(model) {
if (this == model.collection) {
delete model.collection;
}
model.unbind('all', this._onModelEvent);
},
// Internal method called every time a model in the set fires an event.
// Sets need to update their indexes when models change ids. All other
// events simply proxy through. "add" and "remove" events that originate
// in other collections are ignored.
_onModelEvent : function(ev, model, collection, options) {
if ((ev == 'add' || ev == 'remove') && collection != this) return;
if (ev == 'destroy') {
this._remove(model, options);
}
if (model && ev === 'change:' + model.idAttribute) {
delete this._byId[model.previous(model.idAttribute)];
this._byId[model.id] = model;
}
this.trigger.apply(this, arguments);
}
});
// Underscore methods that we want to implement on the Collection.
var methods = ['forEach', 'each', 'map', 'reduce', 'reduceRight', 'find', 'detect',
'filter', 'select', 'reject', 'every', 'all', 'some', 'any', 'include',
'contains', 'invoke', 'max', 'min', 'sortBy', 'sortedIndex', 'toArray', 'size',
'first', 'rest', 'last', 'without', 'indexOf', 'lastIndexOf', 'isEmpty', 'groupBy'];
// Mix in each Underscore method as a proxy to `Collection#models`.
_.each(methods, function(method) {
Backbone.Collection.prototype[method] = function() {
return _[method].apply(_, [this.models].concat(_.toArray(arguments)));
};
});
// Backbone.Router
// -------------------
// Routers map faux-URLs to actions, and fire events when routes are
// matched. Creating a new one sets its `routes` hash, if not set statically.
Backbone.Router = function(options) {
options || (options = {});
if (options.routes) this.routes = options.routes;
this._bindRoutes();
this.initialize.apply(this, arguments);
};
// Cached regular expressions for matching named param parts and splatted
// parts of route strings.
var namedParam = /:([\w\d]+)/g;
var splatParam = /\*([\w\d]+)/g;
var escapeRegExp = /[-[\]{}()+?.,\\^$|#\s]/g;
// Set up all inheritable **Backbone.Router** properties and methods.
_.extend(Backbone.Router.prototype, Backbone.Events, {
// Initialize is an empty function by default. Override it with your own
// initialization logic.
initialize : function(){},
// Manually bind a single named route to a callback. For example:
//
// this.route('search/:query/p:num', 'search', function(query, num) {
// ...
// });
//
route : function(route, name, callback) {
Backbone.history || (Backbone.history = new Backbone.History);
if (!_.isRegExp(route)) route = this._routeToRegExp(route);
Backbone.history.route(route, _.bind(function(fragment) {
var args = this._extractParameters(route, fragment);
callback.apply(this, args);
this.trigger.apply(this, ['route:' + name].concat(args));
}, this));
},
// Simple proxy to `Backbone.history` to save a fragment into the history.
navigate : function(fragment, triggerRoute) {
Backbone.history.navigate(fragment, triggerRoute);
},
// Bind all defined routes to `Backbone.history`. We have to reverse the
// order of the routes here to support behavior where the most general
// routes can be defined at the bottom of the route map.
_bindRoutes : function() {
if (!this.routes) return;
var routes = [];
for (var route in this.routes) {
routes.unshift([route, this.routes[route]]);
}
for (var i = 0, l = routes.length; i < l; i++) {
this.route(routes[i][0], routes[i][1], this[routes[i][1]]);
}
},
// Convert a route string into a regular expression, suitable for matching
// against the current location hash.
_routeToRegExp : function(route) {
route = route.replace(escapeRegExp, "\\$&")
.replace(namedParam, "([^\/]*)")
.replace(splatParam, "(.*?)");
return new RegExp('^' + route + '$');
},
// Given a route, and a URL fragment that it matches, return the array of
// extracted parameters.
_extractParameters : function(route, fragment) {
return route.exec(fragment).slice(1);
}
});
// Backbone.History
// ----------------
// Handles cross-browser history management, based on URL fragments. If the
// browser does not support `onhashchange`, falls back to polling.
Backbone.History = function() {
this.handlers = [];
_.bindAll(this, 'checkUrl');
};
// Cached regex for cleaning hashes.
var hashStrip = /^#*/;
// Cached regex for detecting MSIE.
var isExplorer = /msie [\w.]+/;
// Has the history handling already been started?
var historyStarted = false;
// Set up all inheritable **Backbone.History** properties and methods.
_.extend(Backbone.History.prototype, {
// The default interval to poll for hash changes, if necessary, is
// twenty times a second.
interval: 50,
// Get the cross-browser normalized URL fragment, either from the URL,
// the hash, or the override.
getFragment : function(fragment, forcePushState) {
if (fragment == null) {
if (this._hasPushState || forcePushState) {
fragment = window.location.pathname;
var search = window.location.search;
if (search) fragment += search;
if (fragment.indexOf(this.options.root) == 0) fragment = fragment.substr(this.options.root.length);
} else {
fragment = window.location.hash;
}
}
return decodeURIComponent(fragment.replace(hashStrip, ''));
},
// Start the hash change handling, returning `true` if the current URL matches
// an existing route, and `false` otherwise.
start : function(options) {
// Figure out the initial configuration. Do we need an iframe?
// Is pushState desired ... is it available?
if (historyStarted) throw new Error("Backbone.history has already been started");
this.options = _.extend({}, {root: '/'}, this.options, options);
this._wantsPushState = !!this.options.pushState;
this._hasPushState = !!(this.options.pushState && window.history && window.history.pushState);
var fragment = this.getFragment();
var docMode = document.documentMode;
var oldIE = (isExplorer.exec(navigator.userAgent.toLowerCase()) && (!docMode || docMode <= 7));
if (oldIE) {
this.iframe = $('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo('body')[0].contentWindow;
this.navigate(fragment);
}
// Depending on whether we're using pushState or hashes, and whether
// 'onhashchange' is supported, determine how we check the URL state.
if (this._hasPushState) {
$(window).bind('popstate', this.checkUrl);
} else if ('onhashchange' in window && !oldIE) {
$(window).bind('hashchange', this.checkUrl);
} else {
setInterval(this.checkUrl, this.interval);
}
// Determine if we need to change the base url, for a pushState link
// opened by a non-pushState browser.
this.fragment = fragment;
historyStarted = true;
var loc = window.location;
var atRoot = loc.pathname == this.options.root;
if (this._wantsPushState && !this._hasPushState && !atRoot) {
this.fragment = this.getFragment(null, true);
window.location.replace(this.options.root + '#' + this.fragment);
// Return immediately as browser will do redirect to new url
return true;
} else if (this._wantsPushState && this._hasPushState && atRoot && loc.hash) {
this.fragment = loc.hash.replace(hashStrip, '');
window.history.replaceState({}, document.title, loc.protocol + '//' + loc.host + this.options.root + this.fragment);
}
if (!this.options.silent) {
return this.loadUrl();
}
},
// Add a route to be tested when the fragment changes. Routes added later may
// override previous routes.
route : function(route, callback) {
this.handlers.unshift({route : route, callback : callback});
},
// Checks the current URL to see if it has changed, and if it has,
// calls `loadUrl`, normalizing across the hidden iframe.
checkUrl : function(e) {
var current = this.getFragment();
if (current == this.fragment && this.iframe) current = this.getFragment(this.iframe.location.hash);
if (current == this.fragment || current == decodeURIComponent(this.fragment)) return false;
if (this.iframe) this.navigate(current);
this.loadUrl() || this.loadUrl(window.location.hash);
},
// Attempt to load the current URL fragment. If a route succeeds with a
// match, returns `true`. If no defined routes matches the fragment,
// returns `false`.
loadUrl : function(fragmentOverride) {
var fragment = this.fragment = this.getFragment(fragmentOverride);
var matched = _.any(this.handlers, function(handler) {
if (handler.route.test(fragment)) {
handler.callback(fragment);
return true;
}
});
return matched;
},
// Save a fragment into the hash history. You are responsible for properly
// URL-encoding the fragment in advance. This does not trigger
// a `hashchange` event.
navigate : function(fragment, triggerRoute) {
var frag = (fragment || '').replace(hashStrip, '');
if (this.fragment == frag || this.fragment == decodeURIComponent(frag)) return;
if (this._hasPushState) {
var loc = window.location;
if (frag.indexOf(this.options.root) != 0) frag = this.options.root + frag;
this.fragment = frag;
window.history.pushState({}, document.title, loc.protocol + '//' + loc.host + frag);
} else {
window.location.hash = this.fragment = frag;
if (this.iframe && (frag != this.getFragment(this.iframe.location.hash))) {
this.iframe.document.open().close();
this.iframe.location.hash = frag;
}
}
if (triggerRoute) this.loadUrl(fragment);
}
});
// Backbone.View
// -------------
// Creating a Backbone.View creates its initial element outside of the DOM,
// if an existing element is not provided...
Backbone.View = function(options) {
this.cid = _.uniqueId('view');
this._configure(options || {});
this._ensureElement();
this.delegateEvents();
this.initialize.apply(this, arguments);
};
// Element lookup, scoped to DOM elements within the current view.
// This should be prefered to global lookups, if you're dealing with
// a specific view.
var selectorDelegate = function(selector) {
return $(selector, this.el);
};
// Cached regex to split keys for `delegate`.
var eventSplitter = /^(\S+)\s*(.*)$/;
// List of view options to be merged as properties.
var viewOptions = ['model', 'collection', 'el', 'id', 'attributes', 'className', 'tagName'];
// Set up all inheritable **Backbone.View** properties and methods.
_.extend(Backbone.View.prototype, Backbone.Events, {
// The default `tagName` of a View's element is `"div"`.
tagName : 'div',
// Attach the `selectorDelegate` function as the `$` property.
$ : selectorDelegate,
// Initialize is an empty function by default. Override it with your own
// initialization logic.
initialize : function(){},
// **render** is the core function that your view should override, in order
// to populate its element (`this.el`), with the appropriate HTML. The
// convention is for **render** to always return `this`.
render : function() {
return this;
},
// Remove this view from the DOM. Note that the view isn't present in the
// DOM by default, so calling this method may be a no-op.
remove : function() {
$(this.el).remove();
return this;
},
// For small amounts of DOM Elements, where a full-blown template isn't
// needed, use **make** to manufacture elements, one at a time.
//
// var el = this.make('li', {'class': 'row'}, this.model.escape('title'));
//
make : function(tagName, attributes, content) {
var el = document.createElement(tagName);
if (attributes) $(el).attr(attributes);
if (content) $(el).html(content);
return el;
},
// Set callbacks, where `this.callbacks` is a hash of
//
// *{"event selector": "callback"}*
//
// {
// 'mousedown .title': 'edit',
// 'click .button': 'save'
// }
//
// pairs. Callbacks will be bound to the view, with `this` set properly.
// Uses event delegation for efficiency.
// Omitting the selector binds the event to `this.el`.
// This only works for delegate-able events: not `focus`, `blur`, and
// not `change`, `submit`, and `reset` in Internet Explorer.
delegateEvents : function(events) {
if (!(events || (events = this.events))) return;
if (_.isFunction(events)) events = events.call(this);
$(this.el).unbind('.delegateEvents' + this.cid);
for (var key in events) {
var method = this[events[key]];
if (!method) throw new Error('Event "' + events[key] + '" does not exist');
var match = key.match(eventSplitter);
var eventName = match[1], selector = match[2];
method = _.bind(method, this);
eventName += '.delegateEvents' + this.cid;
if (selector === '') {
$(this.el).bind(eventName, method);
} else {
$(this.el).delegate(selector, eventName, method);
}
}
},
// Performs the initial configuration of a View with a set of options.
// Keys with special meaning *(model, collection, id, className)*, are
// attached directly to the view.
_configure : function(options) {
if (this.options) options = _.extend({}, this.options, options);
for (var i = 0, l = viewOptions.length; i < l; i++) {
var attr = viewOptions[i];
if (options[attr]) this[attr] = options[attr];
}
this.options = options;
},
// Ensure that the View has a DOM element to render into.
// If `this.el` is a string, pass it through `$()`, take the first
// matching element, and re-assign it to `el`. Otherwise, create
// an element from the `id`, `className` and `tagName` proeprties.
_ensureElement : function() {
if (!this.el) {
var attrs = this.attributes || {};
if (this.id) attrs.id = this.id;
if (this.className) attrs['class'] = this.className;
this.el = this.make(this.tagName, attrs);
} else if (_.isString(this.el)) {
this.el = $(this.el).get(0);
}
}
});
// The self-propagating extend function that Backbone classes use.
var extend = function (protoProps, classProps) {
var child = inherits(this, protoProps, classProps);
child.extend = this.extend;
return child;
};
// Set up inheritance for the model, collection, and view.
Backbone.Model.extend = Backbone.Collection.extend =
Backbone.Router.extend = Backbone.View.extend = extend;
// Map from CRUD to HTTP for our default `Backbone.sync` implementation.
var methodMap = {
'create': 'POST',
'update': 'PUT',
'delete': 'DELETE',
'read' : 'GET'
};
// Backbone.sync
// -------------
// Override this function to change the manner in which Backbone persists
// models to the server. You will be passed the type of request, and the
// model in question. By default, uses makes a RESTful Ajax request
// to the model's `url()`. Some possible customizations could be:
//
// * Use `setTimeout` to batch rapid-fire updates into a single request.
// * Send up the models as XML instead of JSON.
// * Persist models via WebSockets instead of Ajax.
//
// Turn on `Backbone.emulateHTTP` in order to send `PUT` and `DELETE` requests
// as `POST`, with a `_method` parameter containing the true HTTP method,
// as well as all requests with the body as `application/x-www-form-urlencoded` instead of
// `application/json` with the model in a param named `model`.
// Useful when interfacing with server-side languages like **PHP** that make
// it difficult to read the body of `PUT` requests.
Backbone.sync = function(method, model, options) {
var type = methodMap[method];
// Default JSON-request options.
var params = _.extend({
type: type,
dataType: 'json'
}, options);
// Ensure that we have a URL.
if (!params.url) {
params.url = getUrl(model) || urlError();
}
// Ensure that we have the appropriate request data.
if (!params.data && model && (method == 'create' || method == 'update')) {
params.contentType = 'application/json';
params.data = JSON.stringify(model.toJSON());
}
// For older servers, emulate JSON by encoding the request into an HTML-form.
if (Backbone.emulateJSON) {
params.contentType = 'application/x-www-form-urlencoded';
params.data = params.data ? {model : params.data} : {};
}
// For older servers, emulate HTTP by mimicking the HTTP method with `_method`
// And an `X-HTTP-Method-Override` header.
if (Backbone.emulateHTTP) {
if (type === 'PUT' || type === 'DELETE') {
if (Backbone.emulateJSON) params.data._method = type;
params.type = 'POST';
params.beforeSend = function(xhr) {
xhr.setRequestHeader('X-HTTP-Method-Override', type);
};
}
}
// Don't process data on a non-GET request.
if (params.type !== 'GET' && !Backbone.emulateJSON) {
params.processData = false;
}
// Make the request.
return $.ajax(params);
};
// Helpers
// -------
// Shared empty constructor function to aid in prototype-chain creation.
var ctor = function(){};
// Helper function to correctly set up the prototype chain, for subclasses.
// Similar to `goog.inherits`, but uses a hash of prototype properties and
// class properties to be extended.
var inherits = function(parent, protoProps, staticProps) {
var child;
// The constructor function for the new subclass is either defined by you
// (the "constructor" property in your `extend` definition), or defaulted
// by us to simply call `super()`.
if (protoProps && protoProps.hasOwnProperty('constructor')) {
child = protoProps.constructor;
} else {
child = function(){ return parent.apply(this, arguments); };
}
// Inherit class (static) properties from parent.
_.extend(child, parent);
// Set the prototype chain to inherit from `parent`, without calling
// `parent`'s constructor function.
ctor.prototype = parent.prototype;
child.prototype = new ctor();
// Add prototype properties (instance properties) to the subclass,
// if supplied.
if (protoProps) _.extend(child.prototype, protoProps);
// Add static properties to the constructor function, if supplied.
if (staticProps) _.extend(child, staticProps);
// Correctly set child's `prototype.constructor`.
child.prototype.constructor = child;
// Set a convenience property in case the parent's prototype is needed later.
child.__super__ = parent.prototype;
return child;
};
// Helper function to get a URL from a Model or Collection as a property
// or as a function.
var getUrl = function(object) {
if (!(object && object.url)) return null;
return _.isFunction(object.url) ? object.url() : object.url;
};
// Throw an error when a URL is needed, and none is supplied.
var urlError = function() {
throw new Error('A "url" property or function must be specified');
};
// Wrap an optional error callback with a fallback error event.
var wrapError = function(onError, model, options) {
return function(resp) {
if (onError) {
onError(model, resp, options);
} else {
model.trigger('error', model, resp, options);
}
};
};
// Helper function to escape a string for HTML rendering.
var escapeHTML = function(string) {
return string.replace(/&(?!\w+;|#\d+;|#x[\da-f]+;)/gi, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, ''').replace(/\//g,'/');
};
}).call(this);
/**
* Castor - a cross site POSTing JavaScript logging library for Loggly
*
* Copyright (c) 2011 Loggly, Inc.
* All rights reserved.
*
* Author: Kord Campbell <kord@loggly.com>
* Date: May 2, 2011
*
* Uses methods from janky.post, copyright(c) 2011 Thomas Rampelberg <thomas@saunter.org>
*
* Sample usage (replace with your own Loggly HTTP input URL):
<script src="/js/loggly.js" type="text/javascript"></script>
<script type="text/javascript">
window.onload=function(){
castor = new loggly({ url: 'http://logs.loggly.com/inputs/a4e839e9-4227-49aa-9d28-e18e5ba5a818?rt=1', level: 'WARN'});
castor.log("url="+window.location.href + " browser=" + castor.user_agent + " height=" + castor.browser_size.height);
}
</script>
*/
(function() {
this.loggly = function(opts) {
this.user_agent = get_agent();
this.browser_size = get_size();
log_methods = {'error': 5, 'warn': 4, 'info': 3, 'debug': 2, 'log': 1};
if (!opts.url) throw new Error("Please include a Loggly HTTP URL.");
if (!opts.level) {
this.level = log_methods['info'];
} else {
this.level = log_methods[opts.level];
}
this.log = function(data) {
if (log_methods['log'] == this.level) {
opts.data = data;
janky(opts);
}
};
this.debug = function(data) {
if (log_methods['debug'] >= this.level) {
opts.data = data;
janky(opts);
}
};
this.info = function(data) {
if (log_methods['info'] >= this.level) {
opts.data = data;
janky(opts);
}
};
this.warn = function(data) {
if (log_methods['warn'] >= this.level) {
opts.data = data;
janky(opts);
}
};
this.error = function(data) {
if (log_methods['error'] >= this.level) {
opts.data = data;
janky(opts);
}
};
};
this.janky = function(opts) {
janky._form(function(iframe, form) {
form.setAttribute("action", opts.url);
form.setAttribute("method", "post");
janky._input(iframe, form, opts.data);
form.submit();
setTimeout(function(){
document.body.removeChild(iframe);
}, 2000);
});
};
this.janky._form = function(cb) {
var iframe = document.createElement("iframe");
document.body.appendChild(iframe);
iframe.style.display = "none";
setTimeout(function() {
var form = iframe.contentWindow.document.createElement("form");
iframe.contentWindow.document.body.appendChild(form);
cb(iframe, form);
}, 0);
};
this.janky._input = function(iframe, form, data) {
var inp = iframe.contentWindow.document.createElement("input");
inp.setAttribute("type", "hidden");
inp.setAttribute("name", "source");
inp.value = "castor " + data;
form.appendChild(inp);
};
this.get_agent = function () {
return navigator.appCodeName + navigator.appName + navigator.appVersion;
};
this.get_size = function () {
var width = 0; var height = 0;
if( typeof( window.innerWidth ) == 'number' ) {
width = window.innerWidth; height = window.innerHeight;
} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
width = document.documentElement.clientWidth; height = document.documentElement.clientHeight;
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
width = document.body.clientWidth; height = document.body.clientHeight;
}
return {'height': height, 'width': width};
};
})();
jsworld={};jsworld.formatIsoDateTime=function(a,b){if(typeof a==="undefined")a=new Date;if(typeof b==="undefined")b=false;var c=jsworld.formatIsoDate(a)+" "+jsworld.formatIsoTime(a);if(b){var d=a.getHours()-a.getUTCHours();var e=Math.abs(d);var f=a.getUTCMinutes();var g=a.getMinutes();if(g!=f&&f<30&&d<0)e--;if(g!=f&&f>30&&d>0)e--;var h;if(g!=f)h=":30";else h=":00";var i;if(e<10)i="0"+e+h;else i=""+e+h;if(d<0)i="-"+i;else i="+"+i;c=c+i}return c};jsworld.formatIsoDate=function(a){if(typeof a==="undefined")a=new Date;var b=a.getFullYear();var c=a.getMonth()+1;var d=a.getDate();return b+"-"+jsworld._zeroPad(c,2)+"-"+jsworld._zeroPad(d,2)};jsworld.formatIsoTime=function(a){if(typeof a==="undefined")a=new Date;var b=a.getHours();var c=a.getMinutes();var d=a.getSeconds();return jsworld._zeroPad(b,2)+":"+jsworld._zeroPad(c,2)+":"+jsworld._zeroPad(d,2)};jsworld.parseIsoDateTime=function(a){if(typeof a!="string")throw"Error: The parameter must be a string";var b=a.match(/^(\d\d\d\d)-(\d\d)-(\d\d)[T ](\d\d):(\d\d):(\d\d)/);if(b===null)b=a.match(/^(\d\d\d\d)(\d\d)(\d\d)[T ](\d\d)(\d\d)(\d\d)/);if(b===null)b=a.match(/^(\d\d\d\d)-(\d\d)-(\d\d)[T ](\d\d)(\d\d)(\d\d)/);if(b===null)b=a.match(/^(\d\d\d\d)-(\d\d)-(\d\d)[T ](\d\d):(\d\d):(\d\d)/);if(b===null)throw"Error: Invalid ISO-8601 date/time string";var c=parseInt(b[1],10);var d=parseInt(b[2],10);var e=parseInt(b[3],10);var f=parseInt(b[4],10);var g=parseInt(b[5],10);var h=parseInt(b[6],10);if(d<1||d>12||e<1||e>31||f<0||f>23||g<0||g>59||h<0||h>59)throw"Error: Invalid ISO-8601 date/time value";var i=new Date(c,d-1,e,f,g,h);if(i.getDate()!=e||i.getMonth()+1!=d)throw"Error: Invalid date";return i};jsworld.parseIsoDate=function(a){if(typeof a!="string")throw"Error: The parameter must be a string";var b=a.match(/^(\d\d\d\d)-(\d\d)-(\d\d)/);if(b===null)b=a.match(/^(\d\d\d\d)(\d\d)(\d\d)/);if(b===null)throw"Error: Invalid ISO-8601 date string";var c=parseInt(b[1],10);var d=parseInt(b[2],10);var e=parseInt(b[3],10);if(d<1||d>12||e<1||e>31)throw"Error: Invalid ISO-8601 date value";var f=new Date(c,d-1,e);if(f.getDate()!=e||f.getMonth()+1!=d)throw"Error: Invalid date";return f};jsworld.parseIsoTime=function(a){if(typeof a!="string")throw"Error: The parameter must be a string";var b=a.match(/^(\d\d):(\d\d):(\d\d)/);if(b===null)b=a.match(/^(\d\d)(\d\d)(\d\d)/);if(b===null)throw"Error: Invalid ISO-8601 date/time string";var c=parseInt(b[1],10);var d=parseInt(b[2],10);var e=parseInt(b[3],10);if(c<0||c>23||d<0||d>59||e<0||e>59)throw"Error: Invalid ISO-8601 time value";return new Date(0,0,0,c,d,e)};jsworld._trim=function(a){var b=" \n\r\t\f \u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000";for(var c=0;c<a.length;c++){if(b.indexOf(a.charAt(c))===-1){a=a.substring(c);break}}for(c=a.length-1;c>=0;c--){if(b.indexOf(a.charAt(c))===-1){a=a.substring(0,c+1);break}}return b.indexOf(a.charAt(0))===-1?a:""};jsworld._isNumber=function(a){if(typeof a=="number")return true;if(typeof a!="string")return false;var b=a+"";return/^-?(\d+|\d*\.\d+)$/.test(b)};jsworld._isInteger=function(a){if(typeof a!="number"&&typeof a!="string")return false;var b=a+"";return/^-?\d+$/.test(b)};jsworld._isFloat=function(a){if(typeof a!="number"&&typeof a!="string")return false;var b=a+"";return/^-?\.\d+?$/.test(b)};jsworld._hasOption=function(a,b){if(typeof a!="string"||typeof b!="string")return false;if(b.indexOf(a)!=-1)return true;else return false};jsworld._stringReplaceAll=function(a,b,c){var d;if(b.length==1&&c.length==1){d="";for(var e=0;e<a.length;e++){if(a.charAt(e)==b.charAt(0))d=d+c.charAt(0);else d=d+a.charAt(e)}return d}else{d=a;var f=d.indexOf(b);while(f!=-1){d=d.replace(b,c);f=d.indexOf(b)}return d}};jsworld._stringStartsWith=function(a,b){if(a.length<b.length)return false;for(var c=0;c<b.length;c++){if(a.charAt(c)!=b.charAt(c))return false}return true};jsworld._getPrecision=function(a){if(typeof a!="string")return-1;var b=a.match(/\.(\d)/);if(b)return parseInt(b[1],10);else return-1};jsworld._splitNumber=function(a){if(typeof a=="number")a=a+"";var b={};if(a.charAt(0)=="-")a=a.substring(1);var c=a.split(".");if(!c[1])c[1]="";b.integer=c[0];b.fraction=c[1];return b};jsworld._formatIntegerPart=function(a,b,c){if(c==""||b=="-1")return a;var d=b.split(";");var e="";var f=a.length;var g;while(f>0){if(d.length>0)g=parseInt(d.shift(),10);if(isNaN(g))throw"Error: Invalid grouping";if(g==-1){e=a.substring(0,f)+e;break}f-=g;if(f<1){e=a.substring(0,f+g)+e;break}e=c+a.substring(f,f+g)+e}return e};jsworld._formatFractionPart=function(a,b){for(var c=0;a.length<b;c++)a=a+"0";return a};jsworld._zeroPad=function(a,b){var c=a+"";while(c.length<b)c="0"+c;return c};jsworld._spacePad=function(a,b){var c=a+"";while(c.length<b)c=" "+c;return c};jsworld.Locale=function(a){this._className="jsworld.Locale";this._parseList=function(a,b){var c=[];if(a==null){throw"Names not defined"}else if(typeof a=="object"){c=a}else if(typeof a=="string"){c=a.split(";",b);for(var d=0;d<c.length;d++){if(c[d][0]=='"'&&c[d][c[d].length-1]=='"')c[d]=c[d].slice(1,-1);else throw"Missing double quotes"}}else{throw"Names must be an array or a string"}if(c.length!=b)throw"Expected "+b+" items, got "+c.length;return c};this._validateFormatString=function(a){if(typeof a=="string"&&a.length>0)return a;else throw"Empty or no string"};if(a==null||typeof a!="object")throw"Error: Invalid/missing locale properties";if(typeof a.decimal_point!="string")throw"Error: Invalid/missing decimal_point property";this.decimal_point=a.decimal_point;if(typeof a.thousands_sep!="string")throw"Error: Invalid/missing thousands_sep property";this.thousands_sep=a.thousands_sep;if(typeof a.grouping!="string")throw"Error: Invalid/missing grouping property";this.grouping=a.grouping;if(typeof a.int_curr_symbol!="string")throw"Error: Invalid/missing int_curr_symbol property";if(!/[A-Za-z]{3}.?/.test(a.int_curr_symbol))throw"Error: Invalid int_curr_symbol property";this.int_curr_symbol=a.int_curr_symbol;if(typeof a.currency_symbol!="string")throw"Error: Invalid/missing currency_symbol property";this.currency_symbol=a.currency_symbol;if(typeof a.frac_digits!="number"&&a.frac_digits<0)throw"Error: Invalid/missing frac_digits property";this.frac_digits=a.frac_digits;if(a.mon_decimal_point===null||a.mon_decimal_point==""){if(this.frac_digits>0)throw"Error: Undefined mon_decimal_point property";else a.mon_decimal_point=""}if(typeof a.mon_decimal_point!="string")throw"Error: Invalid/missing mon_decimal_point property";this.mon_decimal_point=a.mon_decimal_point;if(typeof a.mon_thousands_sep!="string")throw"Error: Invalid/missing mon_thousands_sep property";this.mon_thousands_sep=a.mon_thousands_sep;if(typeof a.mon_grouping!="string")throw"Error: Invalid/missing mon_grouping property";this.mon_grouping=a.mon_grouping;if(typeof a.positive_sign!="string")throw"Error: Invalid/missing positive_sign property";this.positive_sign=a.positive_sign;if(typeof a.negative_sign!="string")throw"Error: Invalid/missing negative_sign property";this.negative_sign=a.negative_sign;if(a.p_cs_precedes!==0&&a.p_cs_precedes!==1)throw"Error: Invalid/missing p_cs_precedes property, must be 0 or 1";this.p_cs_precedes=a.p_cs_precedes;if(a.n_cs_precedes!==0&&a.n_cs_precedes!==1)throw"Error: Invalid/missing n_cs_precedes, must be 0 or 1";this.n_cs_precedes=a.n_cs_precedes;if(a.p_sep_by_space!==0&&a.p_sep_by_space!==1&&a.p_sep_by_space!==2)throw"Error: Invalid/missing p_sep_by_space property, must be 0, 1 or 2";this.p_sep_by_space=a.p_sep_by_space;if(a.n_sep_by_space!==0&&a.n_sep_by_space!==1&&a.n_sep_by_space!==2)throw"Error: Invalid/missing n_sep_by_space property, must be 0, 1, or 2";this.n_sep_by_space=a.n_sep_by_space;if(a.p_sign_posn!==0&&a.p_sign_posn!==1&&a.p_sign_posn!==2&&a.p_sign_posn!==3&&a.p_sign_posn!==4)throw"Error: Invalid/missing p_sign_posn property, must be 0, 1, 2, 3 or 4";this.p_sign_posn=a.p_sign_posn;if(a.n_sign_posn!==0&&a.n_sign_posn!==1&&a.n_sign_posn!==2&&a.n_sign_posn!==3&&a.n_sign_posn!==4)throw"Error: Invalid/missing n_sign_posn property, must be 0, 1, 2, 3 or 4";this.n_sign_posn=a.n_sign_posn;if(typeof a.int_frac_digits!="number"&&a.int_frac_digits<0)throw"Error: Invalid/missing int_frac_digits property";this.int_frac_digits=a.int_frac_digits;if(a.int_p_cs_precedes!==0&&a.int_p_cs_precedes!==1)throw"Error: Invalid/missing int_p_cs_precedes property, must be 0 or 1";this.int_p_cs_precedes=a.int_p_cs_precedes;if(a.int_n_cs_precedes!==0&&a.int_n_cs_precedes!==1)throw"Error: Invalid/missing int_n_cs_precedes property, must be 0 or 1";this.int_n_cs_precedes=a.int_n_cs_precedes;if(a.int_p_sep_by_space!==0&&a.int_p_sep_by_space!==1&&a.int_p_sep_by_space!==2)throw"Error: Invalid/missing int_p_sep_by_spacev, must be 0, 1 or 2";this.int_p_sep_by_space=a.int_p_sep_by_space;if(a.int_n_sep_by_space!==0&&a.int_n_sep_by_space!==1&&a.int_n_sep_by_space!==2)throw"Error: Invalid/missing int_n_sep_by_space property, must be 0, 1, or 2";this.int_n_sep_by_space=a.int_n_sep_by_space;if(a.int_p_sign_posn!==0&&a.int_p_sign_posn!==1&&a.int_p_sign_posn!==2&&a.int_p_sign_posn!==3&&a.int_p_sign_posn!==4)throw"Error: Invalid/missing int_p_sign_posn property, must be 0, 1, 2, 3 or 4";this.int_p_sign_posn=a.int_p_sign_posn;if(a.int_n_sign_posn!==0&&a.int_n_sign_posn!==1&&a.int_n_sign_posn!==2&&a.int_n_sign_posn!==3&&a.int_n_sign_posn!==4)throw"Error: Invalid/missing int_n_sign_posn property, must be 0, 1, 2, 3 or 4";this.int_n_sign_posn=a.int_n_sign_posn;if(a==null||typeof a!="object")throw"Error: Invalid/missing time locale properties";try{this.abday=this._parseList(a.abday,7)}catch(b){throw"Error: Invalid abday property: "+b}try{this.day=this._parseList(a.day,7)}catch(b){throw"Error: Invalid day property: "+b}try{this.abmon=this._parseList(a.abmon,12)}catch(b){throw"Error: Invalid abmon property: "+b}try{this.mon=this._parseList(a.mon,12)}catch(b){throw"Error: Invalid mon property: "+b}try{this.d_fmt=this._validateFormatString(a.d_fmt)}catch(b){throw"Error: Invalid d_fmt property: "+b}try{this.t_fmt=this._validateFormatString(a.t_fmt)}catch(b){throw"Error: Invalid t_fmt property: "+b}try{this.d_t_fmt=this._validateFormatString(a.d_t_fmt)}catch(b){throw"Error: Invalid d_t_fmt property: "+b}try{var c=this._parseList(a.am_pm,2);this.am=c[0];this.pm=c[1]}catch(b){this.am="";this.pm=""}this.getAbbreviatedWeekdayName=function(a){if(typeof a=="undefined"||a===null)return this.abday;if(!jsworld._isInteger(a)||a<0||a>6)throw"Error: Invalid weekday argument, must be an integer [0..6]";return this.abday[a]};this.getWeekdayName=function(a){if(typeof a=="undefined"||a===null)return this.day;if(!jsworld._isInteger(a)||a<0||a>6)throw"Error: Invalid weekday argument, must be an integer [0..6]";return this.day[a]};this.getAbbreviatedMonthName=function(a){if(typeof a=="undefined"||a===null)return this.abmon;if(!jsworld._isInteger(a)||a<0||a>11)throw"Error: Invalid month argument, must be an integer [0..11]";return this.abmon[a]};this.getMonthName=function(a){if(typeof a=="undefined"||a===null)return this.mon;if(!jsworld._isInteger(a)||a<0||a>11)throw"Error: Invalid month argument, must be an integer [0..11]";return this.mon[a]};this.getDecimalPoint=function(){return this.decimal_point};this.getCurrencySymbol=function(){return this.currency_symbol};this.getIntCurrencySymbol=function(){return this.int_curr_symbol.substring(0,3)};this.currencySymbolPrecedes=function(){if(this.p_cs_precedes==1)return true;else return false};this.intCurrencySymbolPrecedes=function(){if(this.int_p_cs_precedes==1)return true;else return false};this.getMonetaryDecimalPoint=function(){return this.mon_decimal_point};this.getFractionalDigits=function(){return this.frac_digits};this.getIntFractionalDigits=function(){return this.int_frac_digits}};jsworld.NumericFormatter=function(a){if(typeof a!="object"||a._className!="jsworld.Locale")throw"Constructor error: You must provide a valid jsworld.Locale instance";this.lc=a;this.format=function(a,b){if(typeof a=="string")a=jsworld._trim(a);if(!jsworld._isNumber(a))throw"Error: The input is not a number";var c=parseFloat(a,10);var d=jsworld._getPrecision(b);if(d!=-1)c=Math.round(c*Math.pow(10,d))/Math.pow(10,d);var e=jsworld._splitNumber(String(c));var f;if(c===0)f="0";else f=jsworld._hasOption("^",b)?e.integer:jsworld._formatIntegerPart(e.integer,this.lc.grouping,this.lc.thousands_sep);var g=d!=-1?jsworld._formatFractionPart(e.fraction,d):e.fraction;var h=g.length?f+this.lc.decimal_point+g:f;if(jsworld._hasOption("~",b)||c===0){return h}else{if(jsworld._hasOption("+",b)||c<0){if(c>0)return"+"+h;else if(c<0)return"-"+h;else return h}else{return h}}}};jsworld.DateTimeFormatter=function(a){if(typeof a!="object"||a._className!="jsworld.Locale")throw"Constructor error: You must provide a valid jsworld.Locale instance.";this.lc=a;this.formatDate=function(a){var b=null;if(typeof a=="string"){try{b=jsworld.parseIsoDate(a)}catch(c){b=jsworld.parseIsoDateTime(a)}}else if(a!==null&&typeof a=="object"){b=a}else{throw"Error: Invalid date argument, must be a Date object or an ISO-8601 date/time string"}return this._applyFormatting(b,this.lc.d_fmt)};this.formatTime=function(a){var b=null;if(typeof a=="string"){try{b=jsworld.parseIsoTime(a)}catch(c){b=jsworld.parseIsoDateTime(a)}}else if(a!==null&&typeof a=="object"){b=a}else{throw"Error: Invalid date argument, must be a Date object or an ISO-8601 date/time string"}return this._applyFormatting(b,this.lc.t_fmt)};this.formatDateTime=function(a){var b=null;if(typeof a=="string"){b=jsworld.parseIsoDateTime(a)}else if(a!==null&&typeof a=="object"){b=a}else{throw"Error: Invalid date argument, must be a Date object or an ISO-8601 date/time string"}return this._applyFormatting(b,this.lc.d_t_fmt)};this._applyFormatting=function(a,b){b=b.replace(/%%/g,"%");b=b.replace(/%a/g,this.lc.abday[a.getDay()]);b=b.replace(/%A/g,this.lc.day[a.getDay()]);b=b.replace(/%b/g,this.lc.abmon[a.getMonth()]);b=b.replace(/%B/g,this.lc.mon[a.getMonth()]);b=b.replace(/%d/g,jsworld._zeroPad(a.getDate(),2));b=b.replace(/%e/g,jsworld._spacePad(a.getDate(),2));b=b.replace(/%F/g,a.getFullYear()+"-"+jsworld._zeroPad(a.getMonth()+1,2)+"-"+jsworld._zeroPad(a.getDate(),2));b=b.replace(/%h/g,this.lc.abmon[a.getMonth()]);b=b.replace(/%H/g,jsworld._zeroPad(a.getHours(),2));b=b.replace(/%I/g,jsworld._zeroPad(this._hours12(a.getHours()),2));b=b.replace(/%k/g,a.getHours());b=b.replace(/%l/g,this._hours12(a.getHours()));b=b.replace(/%m/g,jsworld._zeroPad(a.getMonth()+1,2));b=b.replace(/%n/g,"\n");b=b.replace(/%M/g,jsworld._zeroPad(a.getMinutes(),2));b=b.replace(/%p/g,this._getAmPm(a.getHours()));b=b.replace(/%P/g,this._getAmPm(a.getHours()).toLocaleLowerCase());b=b.replace(/%R/g,jsworld._zeroPad(a.getHours(),2)+":"+jsworld._zeroPad(a.getMinutes(),2));b=b.replace(/%S/g,jsworld._zeroPad(a.getSeconds(),2));b=b.replace(/%T/g,jsworld._zeroPad(a.getHours(),2)+":"+jsworld._zeroPad(a.getMinutes(),2)+":"+jsworld._zeroPad(a.getSeconds(),2));b=b.replace(/%w/g,this.lc.day[a.getDay()]);b=b.replace(/%y/g,(new String(a.getFullYear())).substring(2));b=b.replace(/%Y/g,a.getFullYear());b=b.replace(/%Z/g,"");b=b.replace(/%[a-zA-Z]/g,"");return b};this._hours12=function(a){if(a===0)return 12;else if(a>12)return a-12;else return a};this._getAmPm=function(a){if(a===0||a>12)return this.lc.pm;else return this.lc.am}};jsworld.MonetaryFormatter=function(a,b,c){if(typeof a!="object"||a._className!="jsworld.Locale")throw"Constructor error: You must provide a valid jsworld.Locale instance";this.lc=a;this.currencyFractionDigits={AFN:0,ALL:0,AMD:0,BHD:3,BIF:0,BYR:0,CLF:0,CLP:0,COP:0,CRC:0,DJF:0,GNF:0,GYD:0,HUF:0,IDR:0,IQD:0,IRR:0,ISK:0,JOD:3,JPY:0,KMF:0,KRW:0,KWD:3,LAK:0,LBP:0,LYD:3,MGA:0,MMK:0,MNT:0,MRO:0,MUR:0,OMR:3,PKR:0,PYG:0,RSD:0,RWF:0,SLL:0,SOS:0,STD:0,SYP:0,TND:3,TWD:0,TZS:0,UGX:0,UZS:0,VND:0,VUV:0,XAF:0,XOF:0,XPF:0,YER:0,ZMK:0};if(typeof b=="string"){this.currencyCode=b.toUpperCase();var d=this.currencyFractionDigits[this.currencyCode];if(typeof d!="number")d=2;this.lc.frac_digits=d;this.lc.int_frac_digits=d}else{this.currencyCode=this.lc.int_curr_symbol.substring(0,3).toUpperCase()}this.intSep=this.lc.int_curr_symbol.charAt(3);if(this.currencyCode==this.lc.int_curr_symbol.substring(0,3)){this.internationalFormatting=false;this.curSym=this.lc.currency_symbol}else{if(typeof c=="string"){this.curSym=c;this.internationalFormatting=false}else{this.internationalFormatting=true}}this.getCurrencySymbol=function(){return this.curSym};this.currencySymbolPrecedes=function(a){if(typeof a=="string"&&a=="i"){if(this.lc.int_p_cs_precedes==1)return true;else return false}else{if(this.internationalFormatting){if(this.lc.int_p_cs_precedes==1)return true;else return false}else{if(this.lc.p_cs_precedes==1)return true;else return false}}};this.getDecimalPoint=function(){return this.lc.mon_decimal_point};this.getFractionalDigits=function(a){if(typeof a=="string"&&a=="i"){return this.lc.int_frac_digits}else{if(this.internationalFormatting)return this.lc.int_frac_digits;else return this.lc.frac_digits}};this.format=function(a,b){var c;if(typeof a=="string"){a=jsworld._trim(a);c=parseFloat(a);if(typeof c!="number"||isNaN(c))throw"Error: Amount string not a number"}else if(typeof a=="number"){c=a}else{throw"Error: Amount not a number"}var d=jsworld._getPrecision(b);if(d==-1){if(this.internationalFormatting||jsworld._hasOption("i",b))d=this.lc.int_frac_digits;else d=this.lc.frac_digits}c=Math.round(c*Math.pow(10,d))/Math.pow(10,d);var e=jsworld._splitNumber(String(c));var f;if(c===0)f="0";else f=jsworld._hasOption("^",b)?e.integer:jsworld._formatIntegerPart(e.integer,this.lc.mon_grouping,this.lc.mon_thousands_sep);var g;if(d==-1){if(this.internationalFormatting||jsworld._hasOption("i",b))g=jsworld._formatFractionPart(e.fraction,this.lc.int_frac_digits);else g=jsworld._formatFractionPart(e.fraction,this.lc.frac_digits)}else{g=jsworld._formatFractionPart(e.fraction,d)}var h;if(this.lc.frac_digits>0||g.length)h=f+this.lc.mon_decimal_point+g;else h=f;if(jsworld._hasOption("~",b)){return h}else{var i=jsworld._hasOption("!",b)?true:false;var j=c<0?"-":"+";if(this.internationalFormatting||jsworld._hasOption("i",b)){if(i)return this._formatAsInternationalCurrencyWithNoSym(j,h);else return this._formatAsInternationalCurrency(j,h)}else{if(i)return this._formatAsLocalCurrencyWithNoSym(j,h);else return this._formatAsLocalCurrency(j,h)}}};this._formatAsLocalCurrency=function(a,b){if(a=="+"){if(this.lc.p_sign_posn===0&&this.lc.p_sep_by_space===0&&this.lc.p_cs_precedes===0){return"("+b+this.curSym+")"}else if(this.lc.p_sign_posn===0&&this.lc.p_sep_by_space===0&&this.lc.p_cs_precedes===1){return"("+this.curSym+b+")"}else if(this.lc.p_sign_posn===0&&this.lc.p_sep_by_space===1&&this.lc.p_cs_precedes===0){return"("+b+" "+this.curSym+")"}else if(this.lc.p_sign_posn===0&&this.lc.p_sep_by_space===1&&this.lc.p_cs_precedes===1){return"("+this.curSym+" "+b+")"}else if(this.lc.p_sign_posn===1&&this.lc.p_sep_by_space===0&&this.lc.p_cs_precedes===0){return this.lc.positive_sign+b+this.curSym}else if(this.lc.p_sign_posn===1&&this.lc.p_sep_by_space===0&&this.lc.p_cs_precedes===1){return this.lc.positive_sign+this.curSym+b}else if(this.lc.p_sign_posn===1&&this.lc.p_sep_by_space===1&&this.lc.p_cs_precedes===0){return this.lc.positive_sign+b+" "+this.curSym}else if(this.lc.p_sign_posn===1&&this.lc.p_sep_by_space===1&&this.lc.p_cs_precedes===1){return this.lc.positive_sign+this.curSym+" "+b}else if(this.lc.p_sign_posn===1&&this.lc.p_sep_by_space===2&&this.lc.p_cs_precedes===0){return this.lc.positive_sign+" "+b+this.curSym}else if(this.lc.p_sign_posn===1&&this.lc.p_sep_by_space===2&&this.lc.p_cs_precedes===1){return this.lc.positive_sign+" "+this.curSym+b}else if(this.lc.p_sign_posn===2&&this.lc.p_sep_by_space===0&&this.lc.p_cs_precedes===0){return b+this.curSym+this.lc.positive_sign}else if(this.lc.p_sign_posn===2&&this.lc.p_sep_by_space===0&&this.lc.p_cs_precedes===1){return this.curSym+b+this.lc.positive_sign}else if(this.lc.p_sign_posn===2&&this.lc.p_sep_by_space===1&&this.lc.p_cs_precedes===0){return b+" "+this.curSym+this.lc.positive_sign}else if(this.lc.p_sign_posn===2&&this.lc.p_sep_by_space===1&&this.lc.p_cs_precedes===1){return this.curSym+" "+b+this.lc.positive_sign}else if(this.lc.p_sign_posn===2&&this.lc.p_sep_by_space===2&&this.lc.p_cs_precedes===0){return b+this.curSym+" "+this.lc.positive_sign}else if(this.lc.p_sign_posn===2&&this.lc.p_sep_by_space===2&&this.lc.p_cs_precedes===1){return this.curSym+b+" "+this.lc.positive_sign}else if(this.lc.p_sign_posn===3&&this.lc.p_sep_by_space===0&&this.lc.p_cs_precedes===0){return b+this.lc.positive_sign+this.curSym}else if(this.lc.p_sign_posn===3&&this.lc.p_sep_by_space===0&&this.lc.p_cs_precedes===1){return this.lc.positive_sign+this.curSym+b}else if(this.lc.p_sign_posn===3&&this.lc.p_sep_by_space===1&&this.lc.p_cs_precedes===0){return b+" "+this.lc.positive_sign+this.curSym}else if(this.lc.p_sign_posn===3&&this.lc.p_sep_by_space===1&&this.lc.p_cs_precedes===1){return this.lc.positive_sign+this.curSym+" "+b}else if(this.lc.p_sign_posn===3&&this.lc.p_sep_by_space===2&&this.lc.p_cs_precedes===0){return b+this.lc.positive_sign+" "+this.curSym}else if(this.lc.p_sign_posn===3&&this.lc.p_sep_by_space===2&&this.lc.p_cs_precedes===1){return this.lc.positive_sign+" "+this.curSym+b}else if(this.lc.p_sign_posn===4&&this.lc.p_sep_by_space===0&&this.lc.p_cs_precedes===0){return b+this.curSym+this.lc.positive_sign}else if(this.lc.p_sign_posn===4&&this.lc.p_sep_by_space===0&&this.lc.p_cs_precedes===1){return this.curSym+this.lc.positive_sign+b}else if(this.lc.p_sign_posn===4&&this.lc.p_sep_by_space===1&&this.lc.p_cs_precedes===0){return b+" "+this.curSym+this.lc.positive_sign}else if(this.lc.p_sign_posn===4&&this.lc.p_sep_by_space===1&&this.lc.p_cs_precedes===1){return this.curSym+this.lc.positive_sign+" "+b}else if(this.lc.p_sign_posn===4&&this.lc.p_sep_by_space===2&&this.lc.p_cs_precedes===0){return b+this.curSym+" "+this.lc.positive_sign}else if(this.lc.p_sign_posn===4&&this.lc.p_sep_by_space===2&&this.lc.p_cs_precedes===1){return this.curSym+" "+this.lc.positive_sign+b}}else if(a=="-"){if(this.lc.n_sign_posn===0&&this.lc.n_sep_by_space===0&&this.lc.n_cs_precedes===0){return"("+b+this.curSym+")"}else if(this.lc.n_sign_posn===0&&this.lc.n_sep_by_space===0&&this.lc.n_cs_precedes===1){return"("+this.curSym+b+")"}else if(this.lc.n_sign_posn===0&&this.lc.n_sep_by_space===1&&this.lc.n_cs_precedes===0){return"("+b+" "+this.curSym+")"}else if(this.lc.n_sign_posn===0&&this.lc.n_sep_by_space===1&&this.lc.n_cs_precedes===1){return"("+this.curSym+" "+b+")"}else if(this.lc.n_sign_posn===1&&this.lc.n_sep_by_space===0&&this.lc.n_cs_precedes===0){return this.lc.negative_sign+b+this.curSym}else if(this.lc.n_sign_posn===1&&this.lc.n_sep_by_space===0&&this.lc.n_cs_precedes===1){return this.lc.negative_sign+this.curSym+b}else if(this.lc.n_sign_posn===1&&this.lc.n_sep_by_space===1&&this.lc.n_cs_precedes===0){return this.lc.negative_sign+b+" "+this.curSym}else if(this.lc.n_sign_posn===1&&this.lc.n_sep_by_space===1&&this.lc.n_cs_precedes===1){return this.lc.negative_sign+this.curSym+" "+b}else if(this.lc.n_sign_posn===1&&this.lc.n_sep_by_space===2&&this.lc.n_cs_precedes===0){return this.lc.negative_sign+" "+b+this.curSym}else if(this.lc.n_sign_posn===1&&this.lc.n_sep_by_space===2&&this.lc.n_cs_precedes===1){return this.lc.negative_sign+" "+this.curSym+b}else if(this.lc.n_sign_posn===2&&this.lc.n_sep_by_space===0&&this.lc.n_cs_precedes===0){return b+this.curSym+this.lc.negative_sign}else if(this.lc.n_sign_posn===2&&this.lc.n_sep_by_space===0&&this.lc.n_cs_precedes===1){return this.curSym+b+this.lc.negative_sign}else if(this.lc.n_sign_posn===2&&this.lc.n_sep_by_space===1&&this.lc.n_cs_precedes===0){return b+" "+this.curSym+this.lc.negative_sign}else if(this.lc.n_sign_posn===2&&this.lc.n_sep_by_space===1&&this.lc.n_cs_precedes===1){return this.curSym+" "+b+this.lc.negative_sign}else if(this.lc.n_sign_posn===2&&this.lc.n_sep_by_space===2&&this.lc.n_cs_precedes===0){return b+this.curSym+" "+this.lc.negative_sign}else if(this.lc.n_sign_posn===2&&this.lc.n_sep_by_space===2&&this.lc.n_cs_precedes===1){return this.curSym+b+" "+this.lc.negative_sign}else if(this.lc.n_sign_posn===3&&this.lc.n_sep_by_space===0&&this.lc.n_cs_precedes===0){return b+this.lc.negative_sign+this.curSym}else if(this.lc.n_sign_posn===3&&this.lc.n_sep_by_space===0&&this.lc.n_cs_precedes===1){return this.lc.negative_sign+this.curSym+b}else if(this.lc.n_sign_posn===3&&this.lc.n_sep_by_space===1&&this.lc.n_cs_precedes===0){return b+" "+this.lc.negative_sign+this.curSym}else if(this.lc.n_sign_posn===3&&this.lc.n_sep_by_space===1&&this.lc.n_cs_precedes===1){return this.lc.negative_sign+this.curSym+" "+b}else if(this.lc.n_sign_posn===3&&this.lc.n_sep_by_space===2&&this.lc.n_cs_precedes===0){return b+this.lc.negative_sign+" "+this.curSym}else if(this.lc.n_sign_posn===3&&this.lc.n_sep_by_space===2&&this.lc.n_cs_precedes===1){return this.lc.negative_sign+" "+this.curSym+b}else if(this.lc.n_sign_posn===4&&this.lc.n_sep_by_space===0&&this.lc.n_cs_precedes===0){return b+this.curSym+this.lc.negative_sign}else if(this.lc.n_sign_posn===4&&this.lc.n_sep_by_space===0&&this.lc.n_cs_precedes===1){return this.curSym+this.lc.negative_sign+b}else if(this.lc.n_sign_posn===4&&this.lc.n_sep_by_space===1&&this.lc.n_cs_precedes===0){return b+" "+this.curSym+this.lc.negative_sign}else if(this.lc.n_sign_posn===4&&this.lc.n_sep_by_space===1&&this.lc.n_cs_precedes===1){return this.curSym+this.lc.negative_sign+" "+b}else if(this.lc.n_sign_posn===4&&this.lc.n_sep_by_space===2&&this.lc.n_cs_precedes===0){return b+this.curSym+" "+this.lc.negative_sign}else if(this.lc.n_sign_posn===4&&this.lc.n_sep_by_space===2&&this.lc.n_cs_precedes===1){return this.curSym+" "+this.lc.negative_sign+b}}throw"Error: Invalid POSIX LC MONETARY definition"};this._formatAsInternationalCurrency=function(a,b){if(a=="+"){if(this.lc.int_p_sign_posn===0&&this.lc.int_p_sep_by_space===0&&this.lc.int_p_cs_precedes===0){return"("+b+this.currencyCode+")"}else if(this.lc.int_p_sign_posn===0&&this.lc.int_p_sep_by_space===0&&this.lc.int_p_cs_precedes===1){return"("+this.currencyCode+b+")"}else if(this.lc.int_p_sign_posn===0&&this.lc.int_p_sep_by_space===1&&this.lc.int_p_cs_precedes===0){return"("+b+this.intSep+this.currencyCode+")"}else if(this.lc.int_p_sign_posn===0&&this.lc.int_p_sep_by_space===1&&this.lc.int_p_cs_precedes===1){return"("+this.currencyCode+this.intSep+b+")"}else if(this.lc.int_p_sign_posn===1&&this.lc.int_p_sep_by_space===0&&this.lc.int_p_cs_precedes===0){return this.lc.positive_sign+b+this.currencyCode}else if(this.lc.int_p_sign_posn===1&&this.lc.int_p_sep_by_space===0&&this.lc.int_p_cs_precedes===1){return this.lc.positive_sign+this.currencyCode+b}else if(this.lc.int_p_sign_posn===1&&this.lc.int_p_sep_by_space===1&&this.lc.int_p_cs_precedes===0){return this.lc.positive_sign+b+this.intSep+this.currencyCode}else if(this.lc.int_p_sign_posn===1&&this.lc.int_p_sep_by_space===1&&this.lc.int_p_cs_precedes===1){return this.lc.positive_sign+this.currencyCode+this.intSep+b}else if(this.lc.int_p_sign_posn===1&&this.lc.int_p_sep_by_space===2&&this.lc.int_p_cs_precedes===0){return this.lc.positive_sign+this.intSep+b+this.currencyCode}else if(this.lc.int_p_sign_posn===1&&this.lc.int_p_sep_by_space===2&&this.lc.int_p_cs_precedes===1){return this.lc.positive_sign+this.intSep+this.currencyCode+b}else if(this.lc.int_p_sign_posn===2&&this.lc.int_p_sep_by_space===0&&this.lc.int_p_cs_precedes===0){return b+this.currencyCode+this.lc.positive_sign}else if(this.lc.int_p_sign_posn===2&&this.lc.int_p_sep_by_space===0&&this.lc.int_p_cs_precedes===1){return this.currencyCode+b+this.lc.positive_sign}else if(this.lc.int_p_sign_posn===2&&this.lc.int_p_sep_by_space===1&&this.lc.int_p_cs_precedes===0){return b+this.intSep+this.currencyCode+this.lc.positive_sign}else if(this.lc.int_p_sign_posn===2&&this.lc.int_p_sep_by_space===1&&this.lc.int_p_cs_precedes===1){return this.currencyCode+this.intSep+b+this.lc.positive_sign}else if(this.lc.int_p_sign_posn===2&&this.lc.int_p_sep_by_space===2&&this.lc.int_p_cs_precedes===0){return b+this.currencyCode+this.intSep+this.lc.positive_sign}else if(this.lc.int_p_sign_posn===2&&this.lc.int_p_sep_by_space===2&&this.lc.int_p_cs_precedes===1){return this.currencyCode+b+this.intSep+this.lc.positive_sign}else if(this.lc.int_p_sign_posn===3&&this.lc.int_p_sep_by_space===0&&this.lc.int_p_cs_precedes===0){return b+this.lc.positive_sign+this.currencyCode}else if(this.lc.int_p_sign_posn===3&&this.lc.int_p_sep_by_space===0&&this.lc.int_p_cs_precedes===1){return this.lc.positive_sign+this.currencyCode+b}else if(this.lc.int_p_sign_posn===3&&this.lc.int_p_sep_by_space===1&&this.lc.int_p_cs_precedes===0){return b+this.intSep+this.lc.positive_sign+this.currencyCode}else if(this.lc.int_p_sign_posn===3&&this.lc.int_p_sep_by_space===1&&this.lc.int_p_cs_precedes===1){return this.lc.positive_sign+this.currencyCode+this.intSep+b}else if(this.lc.int_p_sign_posn===3&&this.lc.int_p_sep_by_space===2&&this.lc.int_p_cs_precedes===0){return b+this.lc.positive_sign+this.intSep+this.currencyCode}else if(this.lc.int_p_sign_posn===3&&this.lc.int_p_sep_by_space===2&&this.lc.int_p_cs_precedes===1){return this.lc.positive_sign+this.intSep+this.currencyCode+b}else if(this.lc.int_p_sign_posn===4&&this.lc.int_p_sep_by_space===0&&this.lc.int_p_cs_precedes===0){return b+this.currencyCode+this.lc.positive_sign}else if(this.lc.int_p_sign_posn===4&&this.lc.int_p_sep_by_space===0&&this.lc.int_p_cs_precedes===1){return this.currencyCode+this.lc.positive_sign+b}else if(this.lc.int_p_sign_posn===4&&this.lc.int_p_sep_by_space===1&&this.lc.int_p_cs_precedes===0){return b+this.intSep+this.currencyCode+this.lc.positive_sign}else if(this.lc.int_p_sign_posn===4&&this.lc.int_p_sep_by_space===1&&this.lc.int_p_cs_precedes===1){return this.currencyCode+this.lc.positive_sign+this.intSep+b}else if(this.lc.int_p_sign_posn===4&&this.lc.int_p_sep_by_space===2&&this.lc.int_p_cs_precedes===0){return b+this.currencyCode+this.intSep+this.lc.positive_sign}else if(this.lc.int_p_sign_posn===4&&this.lc.int_p_sep_by_space===2&&this.lc.int_p_cs_precedes===1){return this.currencyCode+this.intSep+this.lc.positive_sign+b}}else if(a=="-"){if(this.lc.int_n_sign_posn===0&&this.lc.int_n_sep_by_space===0&&this.lc.int_n_cs_precedes===0){return"("+b+this.currencyCode+")"}else if(this.lc.int_n_sign_posn===0&&this.lc.int_n_sep_by_space===0&&this.lc.int_n_cs_precedes===1){return"("+this.currencyCode+b+")"}else if(this.lc.int_n_sign_posn===0&&this.lc.int_n_sep_by_space===1&&this.lc.int_n_cs_precedes===0){return"("+b+this.intSep+this.currencyCode+")"}else if(this.lc.int_n_sign_posn===0&&this.lc.int_n_sep_by_space===1&&this.lc.int_n_cs_precedes===1){return"("+this.currencyCode+this.intSep+b+")"}else if(this.lc.int_n_sign_posn===1&&this.lc.int_n_sep_by_space===0&&this.lc.int_n_cs_precedes===0){return this.lc.negative_sign+b+this.currencyCode}else if(this.lc.int_n_sign_posn===1&&this.lc.int_n_sep_by_space===0&&this.lc.int_n_cs_precedes===1){return this.lc.negative_sign+this.currencyCode+b}else if(this.lc.int_n_sign_posn===1&&this.lc.int_n_sep_by_space===1&&this.lc.int_n_cs_precedes===0){return this.lc.negative_sign+b+this.intSep+this.currencyCode}else if(this.lc.int_n_sign_posn===1&&this.lc.int_n_sep_by_space===1&&this.lc.int_n_cs_precedes===1){return this.lc.negative_sign+this.currencyCode+this.intSep+b}else if(this.lc.int_n_sign_posn===1&&this.lc.int_n_sep_by_space===2&&this.lc.int_n_cs_precedes===0){return this.lc.negative_sign+this.intSep+b+this.currencyCode}else if(this.lc.int_n_sign_posn===1&&this.lc.int_n_sep_by_space===2&&this.lc.int_n_cs_precedes===1){return this.lc.negative_sign+this.intSep+this.currencyCode+b}else if(this.lc.int_n_sign_posn===2&&this.lc.int_n_sep_by_space===0&&this.lc.int_n_cs_precedes===0){return b+this.currencyCode+this.lc.negative_sign}else if(this.lc.int_n_sign_posn===2&&this.lc.int_n_sep_by_space===0&&this.lc.int_n_cs_precedes===1){return this.currencyCode+b+this.lc.negative_sign}else if(this.lc.int_n_sign_posn===2&&this.lc.int_n_sep_by_space===1&&this.lc.int_n_cs_precedes===0){return b+this.intSep+this.currencyCode+this.lc.negative_sign}else if(this.lc.int_n_sign_posn===2&&this.lc.int_n_sep_by_space===1&&this.lc.int_n_cs_precedes===1){return this.currencyCode+this.intSep+b+this.lc.negative_sign}else if(this.lc.int_n_sign_posn===2&&this.lc.int_n_sep_by_space===2&&this.lc.int_n_cs_precedes===0){return b+this.currencyCode+this.intSep+this.lc.negative_sign}else if(this.lc.int_n_sign_posn===2&&this.lc.int_n_sep_by_space===2&&this.lc.int_n_cs_precedes===1){return this.currencyCode+b+this.intSep+this.lc.negative_sign}else if(this.lc.int_n_sign_posn===3&&this.lc.int_n_sep_by_space===0&&this.lc.int_n_cs_precedes===0){return b+this.lc.negative_sign+this.currencyCode}else if(this.lc.int_n_sign_posn===3&&this.lc.int_n_sep_by_space===0&&this.lc.int_n_cs_precedes===1){return this.lc.negative_sign+this.currencyCode+b}else if(this.lc.int_n_sign_posn===3&&this.lc.int_n_sep_by_space===1&&this.lc.int_n_cs_precedes===0){return b+this.intSep+this.lc.negative_sign+this.currencyCode}else if(this.lc.int_n_sign_posn===3&&this.lc.int_n_sep_by_space===1&&this.lc.int_n_cs_precedes===1){return this.lc.negative_sign+this.currencyCode+this.intSep+b}else if(this.lc.int_n_sign_posn===3&&this.lc.int_n_sep_by_space===2&&this.lc.int_n_cs_precedes===0){return b+this.lc.negative_sign+this.intSep+this.currencyCode}else if(this.lc.int_n_sign_posn===3&&this.lc.int_n_sep_by_space===2&&this.lc.int_n_cs_precedes===1){return this.lc.negative_sign+this.intSep+this.currencyCode+b}else if(this.lc.int_n_sign_posn===4&&this.lc.int_n_sep_by_space===0&&this.lc.int_n_cs_precedes===0){return b+this.currencyCode+this.lc.negative_sign}else if(this.lc.int_n_sign_posn===4&&this.lc.int_n_sep_by_space===0&&this.lc.int_n_cs_precedes===1){return this.currencyCode+this.lc.negative_sign+b}else if(this.lc.int_n_sign_posn===4&&this.lc.int_n_sep_by_space===1&&this.lc.int_n_cs_precedes===0){return b+this.intSep+this.currencyCode+this.lc.negative_sign}else if(this.lc.int_n_sign_posn===4&&this.lc.int_n_sep_by_space===1&&this.lc.int_n_cs_precedes===1){return this.currencyCode+this.lc.negative_sign+this.intSep+b}else if(this.lc.int_n_sign_posn===4&&this.lc.int_n_sep_by_space===2&&this.lc.int_n_cs_precedes===0){return b+this.currencyCode+this.intSep+this.lc.negative_sign}else if(this.lc.int_n_sign_posn===4&&this.lc.int_n_sep_by_space===2&&this.lc.int_n_cs_precedes===1){return this.currencyCode+this.intSep+this.lc.negative_sign+b}}throw"Error: Invalid POSIX LC MONETARY definition"};this._formatAsLocalCurrencyWithNoSym=function(a,b){if(a=="+"){if(this.lc.p_sign_posn===0){return"("+b+")"}else if(this.lc.p_sign_posn===1&&this.lc.p_sep_by_space===0&&this.lc.p_cs_precedes===0){return this.lc.positive_sign+b}else if(this.lc.p_sign_posn===1&&this.lc.p_sep_by_space===0&&this.lc.p_cs_precedes===1){return this.lc.positive_sign+b}else if(this.lc.p_sign_posn===1&&this.lc.p_sep_by_space===1&&this.lc.p_cs_precedes===0){return this.lc.positive_sign+b}else if(this.lc.p_sign_posn===1&&this.lc.p_sep_by_space===1&&this.lc.p_cs_precedes===1){return this.lc.positive_sign+b}else if(this.lc.p_sign_posn===1&&this.lc.p_sep_by_space===2&&this.lc.p_cs_precedes===0){return this.lc.positive_sign+" "+b}else if(this.lc.p_sign_posn===1&&this.lc.p_sep_by_space===2&&this.lc.p_cs_precedes===1){return this.lc.positive_sign+" "+b}else if(this.lc.p_sign_posn===2&&this.lc.p_sep_by_space===0&&this.lc.p_cs_precedes===0){return b+this.lc.positive_sign}else if(this.lc.p_sign_posn===2&&this.lc.p_sep_by_space===0&&this.lc.p_cs_precedes===1){return b+this.lc.positive_sign}else if(this.lc.p_sign_posn===2&&this.lc.p_sep_by_space===1&&this.lc.p_cs_precedes===0){return b+" "+this.lc.positive_sign}else if(this.lc.p_sign_posn===2&&this.lc.p_sep_by_space===1&&this.lc.p_cs_precedes===1){return b+this.lc.positive_sign}else if(this.lc.p_sign_posn===2&&this.lc.p_sep_by_space===2&&this.lc.p_cs_precedes===0){return b+this.lc.positive_sign}else if(this.lc.p_sign_posn===2&&this.lc.p_sep_by_space===2&&this.lc.p_cs_precedes===1){return b+" "+this.lc.positive_sign}else if(this.lc.p_sign_posn===3&&this.lc.p_sep_by_space===0&&this.lc.p_cs_precedes===0){return b+this.lc.positive_sign}else if(this.lc.p_sign_posn===3&&this.lc.p_sep_by_space===0&&this.lc.p_cs_precedes===1){return this.lc.positive_sign+b}else if(this.lc.p_sign_posn===3&&this.lc.p_sep_by_space===1&&this.lc.p_cs_precedes===0){return b+" "+this.lc.positive_sign}else if(this.lc.p_sign_posn===3&&this.lc.p_sep_by_space===1&&this.lc.p_cs_precedes===1){return this.lc.positive_sign+" "+b}else if(this.lc.p_sign_posn===3&&this.lc.p_sep_by_space===2&&this.lc.p_cs_precedes===0){return b+this.lc.positive_sign}else if(this.lc.p_sign_posn===3&&this.lc.p_sep_by_space===2&&this.lc.p_cs_precedes===1){return this.lc.positive_sign+" "+b}else if(this.lc.p_sign_posn===4&&this.lc.p_sep_by_space===0&&this.lc.p_cs_precedes===0){return b+this.lc.positive_sign}else if(this.lc.p_sign_posn===4&&this.lc.p_sep_by_space===0&&this.lc.p_cs_precedes===1){return this.lc.positive_sign+b}else if(this.lc.p_sign_posn===4&&this.lc.p_sep_by_space===1&&this.lc.p_cs_precedes===0){return b+" "+this.lc.positive_sign}else if(this.lc.p_sign_posn===4&&this.lc.p_sep_by_space===1&&this.lc.p_cs_precedes===1){return this.lc.positive_sign+" "+b}else if(this.lc.p_sign_posn===4&&this.lc.p_sep_by_space===2&&this.lc.p_cs_precedes===0){return b+" "+this.lc.positive_sign}else if(this.lc.p_sign_posn===4&&this.lc.p_sep_by_space===2&&this.lc.p_cs_precedes===1){return this.lc.positive_sign+b}}else if(a=="-"){if(this.lc.n_sign_posn===0){return"("+b+")"}else if(this.lc.n_sign_posn===1&&this.lc.n_sep_by_space===0&&this.lc.n_cs_precedes===0){return this.lc.negative_sign+b}else if(this.lc.n_sign_posn===1&&this.lc.n_sep_by_space===0&&this.lc.n_cs_precedes===1){return this.lc.negative_sign+b}else if(this.lc.n_sign_posn===1&&this.lc.n_sep_by_space===1&&this.lc.n_cs_precedes===0){return this.lc.negative_sign+b}else if(this.lc.n_sign_posn===1&&this.lc.n_sep_by_space===1&&this.lc.n_cs_precedes===1){return this.lc.negative_sign+" "+b}else if(this.lc.n_sign_posn===1&&this.lc.n_sep_by_space===2&&this.lc.n_cs_precedes===0){return this.lc.negative_sign+" "+b}else if(this.lc.n_sign_posn===1&&this.lc.n_sep_by_space===2&&this.lc.n_cs_precedes===1){return this.lc.negative_sign+" "+b}else if(this.lc.n_sign_posn===2&&this.lc.n_sep_by_space===0&&this.lc.n_cs_precedes===0){return b+this.lc.negative_sign}else if(this.lc.n_sign_posn===2&&this.lc.n_sep_by_space===0&&this.lc.n_cs_precedes===1){return b+this.lc.negative_sign}else if(this.lc.n_sign_posn===2&&this.lc.n_sep_by_space===1&&this.lc.n_cs_precedes===0){return b+" "+this.lc.negative_sign}else if(this.lc.n_sign_posn===2&&this.lc.n_sep_by_space===1&&this.lc.n_cs_precedes===1){return b+this.lc.negative_sign}else if(this.lc.n_sign_posn===2&&this.lc.n_sep_by_space===2&&this.lc.n_cs_precedes===0){return b+" "+this.lc.negative_sign}else if(this.lc.n_sign_posn===2&&this.lc.n_sep_by_space===2&&this.lc.n_cs_precedes===1){return b+" "+this.lc.negative_sign}else if(this.lc.n_sign_posn===3&&this.lc.n_sep_by_space===0&&this.lc.n_cs_precedes===0){return b+this.lc.negative_sign}else if(this.lc.n_sign_posn===3&&this.lc.n_sep_by_space===0&&this.lc.n_cs_precedes===1){return this.lc.negative_sign+b}else if(this.lc.n_sign_posn===3&&this.lc.n_sep_by_space===1&&this.lc.n_cs_precedes===0){return b+" "+this.lc.negative_sign}else if(this.lc.n_sign_posn===3&&this.lc.n_sep_by_space===1&&this.lc.n_cs_precedes===1){return this.lc.negative_sign+" "+b}else if(this.lc.n_sign_posn===3&&this.lc.n_sep_by_space===2&&this.lc.n_cs_precedes===0){return b+this.lc.negative_sign}else if(this.lc.n_sign_posn===3&&this.lc.n_sep_by_space===2&&this.lc.n_cs_precedes===1){return this.lc.negative_sign+" "+b}else if(this.lc.n_sign_posn===4&&this.lc.n_sep_by_space===0&&this.lc.n_cs_precedes===0){return b+this.lc.negative_sign}else if(this.lc.n_sign_posn===4&&this.lc.n_sep_by_space===0&&this.lc.n_cs_precedes===1){return this.lc.negative_sign+b}else if(this.lc.n_sign_posn===4&&this.lc.n_sep_by_space===1&&this.lc.n_cs_precedes===0){return b+" "+this.lc.negative_sign}else if(this.lc.n_sign_posn===4&&this.lc.n_sep_by_space===1&&this.lc.n_cs_precedes===1){return this.lc.negative_sign+" "+b}else if(this.lc.n_sign_posn===4&&this.lc.n_sep_by_space===2&&this.lc.n_cs_precedes===0){return b+" "+this.lc.negative_sign}else if(this.lc.n_sign_posn===4&&this.lc.n_sep_by_space===2&&this.lc.n_cs_precedes===1){return this.lc.negative_sign+b}}throw"Error: Invalid POSIX LC MONETARY definition"};this._formatAsInternationalCurrencyWithNoSym=function(a,b){if(a=="+"){if(this.lc.int_p_sign_posn===0){return"("+b+")"}else if(this.lc.int_p_sign_posn===1&&this.lc.int_p_sep_by_space===0&&this.lc.int_p_cs_precedes===0){return this.lc.positive_sign+b}else if(this.lc.int_p_sign_posn===1&&this.lc.int_p_sep_by_space===0&&this.lc.int_p_cs_precedes===1){return this.lc.positive_sign+b}else if(this.lc.int_p_sign_posn===1&&this.lc.int_p_sep_by_space===1&&this.lc.int_p_cs_precedes===0){return this.lc.positive_sign+b}else if(this.lc.int_p_sign_posn===1&&this.lc.int_p_sep_by_space===1&&this.lc.int_p_cs_precedes===1){return this.lc.positive_sign+this.intSep+b}else if(this.lc.int_p_sign_posn===1&&this.lc.int_p_sep_by_space===2&&this.lc.int_p_cs_precedes===0){return this.lc.positive_sign+this.intSep+b}else if(this.lc.int_p_sign_posn===1&&this.lc.int_p_sep_by_space===2&&this.lc.int_p_cs_precedes===1){return this.lc.positive_sign+this.intSep+b}else if(this.lc.int_p_sign_posn===2&&this.lc.int_p_sep_by_space===0&&this.lc.int_p_cs_precedes===0){return b+this.lc.positive_sign}else if(this.lc.int_p_sign_posn===2&&this.lc.int_p_sep_by_space===0&&this.lc.int_p_cs_precedes===1){return b+this.lc.positive_sign}else if(this.lc.int_p_sign_posn===2&&this.lc.int_p_sep_by_space===1&&this.lc.int_p_cs_precedes===0){return b+this.intSep+this.lc.positive_sign}else if(this.lc.int_p_sign_posn===2&&this.lc.int_p_sep_by_space===1&&this.lc.int_p_cs_precedes===1){return b+this.lc.positive_sign}else if(this.lc.int_p_sign_posn===2&&this.lc.int_p_sep_by_space===2&&this.lc.int_p_cs_precedes===0){return b+this.intSep+this.lc.positive_sign}else if(this.lc.int_p_sign_posn===2&&this.lc.int_p_sep_by_space===2&&this.lc.int_p_cs_precedes===1){return b+this.intSep+this.lc.positive_sign}else if(this.lc.int_p_sign_posn===3&&this.lc.int_p_sep_by_space===0&&this.lc.int_p_cs_precedes===0){return b+this.lc.positive_sign}else if(this.lc.int_p_sign_posn===3&&this.lc.int_p_sep_by_space===0&&this.lc.int_p_cs_precedes===1){return this.lc.positive_sign+b}else if(this.lc.int_p_sign_posn===3&&this.lc.int_p_sep_by_space===1&&this.lc.int_p_cs_precedes===0){return b+this.intSep+this.lc.positive_sign}else if(this.lc.int_p_sign_posn===3&&this.lc.int_p_sep_by_space===1&&this.lc.int_p_cs_precedes===1){return this.lc.positive_sign+this.intSep+b}else if(this.lc.int_p_sign_posn===3&&this.lc.int_p_sep_by_space===2&&this.lc.int_p_cs_precedes===0){return b+this.lc.positive_sign}else if(this.lc.int_p_sign_posn===3&&this.lc.int_p_sep_by_space===2&&this.lc.int_p_cs_precedes===1){return this.lc.positive_sign+this.intSep+b}else if(this.lc.int_p_sign_posn===4&&this.lc.int_p_sep_by_space===0&&this.lc.int_p_cs_precedes===0){return b+this.lc.positive_sign}else if(this.lc.int_p_sign_posn===4&&this.lc.int_p_sep_by_space===0&&this.lc.int_p_cs_precedes===1){return this.lc.positive_sign+b}else if(this.lc.int_p_sign_posn===4&&this.lc.int_p_sep_by_space===1&&this.lc.int_p_cs_precedes===0){return b+this.intSep+this.lc.positive_sign}else if(this.lc.int_p_sign_posn===4&&this.lc.int_p_sep_by_space===1&&this.lc.int_p_cs_precedes===1){return this.lc.positive_sign+this.intSep+b}else if(this.lc.int_p_sign_posn===4&&this.lc.int_p_sep_by_space===2&&this.lc.int_p_cs_precedes===0){return b+this.intSep+this.lc.positive_sign}else if(this.lc.int_p_sign_posn===4&&this.lc.int_p_sep_by_space===2&&this.lc.int_p_cs_precedes===1){return this.lc.positive_sign+b}}else if(a=="-"){if(this.lc.int_n_sign_posn===0){return"("+b+")"}else if(this.lc.int_n_sign_posn===1&&this.lc.int_n_sep_by_space===0&&this.lc.int_n_cs_precedes===0){return this.lc.negative_sign+b}else if(this.lc.int_n_sign_posn===1&&this.lc.int_n_sep_by_space===0&&this.lc.int_n_cs_precedes===1){return this.lc.negative_sign+b}else if(this.lc.int_n_sign_posn===1&&this.lc.int_n_sep_by_space===1&&this.lc.int_n_cs_precedes===0){return this.lc.negative_sign+b}else if(this.lc.int_n_sign_posn===1&&this.lc.int_n_sep_by_space===1&&this.lc.int_n_cs_precedes===1){return this.lc.negative_sign+this.intSep+b}else if(this.lc.int_n_sign_posn===1&&this.lc.int_n_sep_by_space===2&&this.lc.int_n_cs_precedes===0){return this.lc.negative_sign+this.intSep+b}else if(this.lc.int_n_sign_posn===1&&this.lc.int_n_sep_by_space===2&&this.lc.int_n_cs_precedes===1){return this.lc.negative_sign+this.intSep+b}else if(this.lc.int_n_sign_posn===2&&this.lc.int_n_sep_by_space===0&&this.lc.int_n_cs_precedes===0){return b+this.lc.negative_sign}else if(this.lc.int_n_sign_posn===2&&this.lc.int_n_sep_by_space===0&&this.lc.int_n_cs_precedes===1){return b+this.lc.negative_sign}else if(this.lc.int_n_sign_posn===2&&this.lc.int_n_sep_by_space===1&&this.lc.int_n_cs_precedes===0){return b+this.intSep+this.lc.negative_sign}else if(this.lc.int_n_sign_posn===2&&this.lc.int_n_sep_by_space===1&&this.lc.int_n_cs_precedes===1){return b+this.lc.negative_sign}else if(this.lc.int_n_sign_posn===2&&this.lc.int_n_sep_by_space===2&&this.lc.int_n_cs_precedes===0){return b+this.intSep+this.lc.negative_sign}else if(this.lc.int_n_sign_posn===2&&this.lc.int_n_sep_by_space===2&&this.lc.int_n_cs_precedes===1){return b+this.intSep+this.lc.negative_sign}else if(this.lc.int_n_sign_posn===3&&this.lc.int_n_sep_by_space===0&&this.lc.int_n_cs_precedes===0){return b+this.lc.negative_sign}else if(this.lc.int_n_sign_posn===3&&this.lc.int_n_sep_by_space===0&&this.lc.int_n_cs_precedes===1){return this.lc.negative_sign+b}else if(this.lc.int_n_sign_posn===3&&this.lc.int_n_sep_by_space===1&&this.lc.int_n_cs_precedes===0){return b+this.intSep+this.lc.negative_sign}else if(this.lc.int_n_sign_posn===3&&this.lc.int_n_sep_by_space===1&&this.lc.int_n_cs_precedes===1){return this.lc.negative_sign+this.intSep+b}else if(this.lc.int_n_sign_posn===3&&this.lc.int_n_sep_by_space===2&&this.lc.int_n_cs_precedes===0){return b+this.lc.negative_sign}else if(this.lc.int_n_sign_posn===3&&this.lc.int_n_sep_by_space===2&&this.lc.int_n_cs_precedes===1){return this.lc.negative_sign+this.intSep+b}else if(this.lc.int_n_sign_posn===4&&this.lc.int_n_sep_by_space===0&&this.lc.int_n_cs_precedes===0){return b+this.lc.negative_sign}else if(this.lc.int_n_sign_posn===4&&this.lc.int_n_sep_by_space===0&&this.lc.int_n_cs_precedes===1){return this.lc.negative_sign+b}else if(this.lc.int_n_sign_posn===4&&this.lc.int_n_sep_by_space===1&&this.lc.int_n_cs_precedes===0){return b+this.intSep+this.lc.negative_sign}else if(this.lc.int_n_sign_posn===4&&this.lc.int_n_sep_by_space===1&&this.lc.int_n_cs_precedes===1){return this.lc.negative_sign+this.intSep+b}else if(this.lc.int_n_sign_posn===4&&this.lc.int_n_sep_by_space===2&&this.lc.int_n_cs_precedes===0){return b+this.intSep+this.lc.negative_sign}else if(this.lc.int_n_sign_posn===4&&this.lc.int_n_sep_by_space===2&&this.lc.int_n_cs_precedes===1){return this.lc.negative_sign+b}}throw"Error: Invalid POSIX LC_MONETARY definition"}};jsworld.NumericParser=function(a){if(typeof a!="object"||a._className!="jsworld.Locale")throw"Constructor error: You must provide a valid jsworld.Locale instance";this.lc=a;this.parse=function(a){if(typeof a!="string")throw"Parse error: Argument must be a string";var b=jsworld._trim(a);b=jsworld._stringReplaceAll(a,this.lc.thousands_sep,"");b=jsworld._stringReplaceAll(b,this.lc.decimal_point,".");if(jsworld._isNumber(b))return parseFloat(b,10);else throw"Parse error: Invalid number string"}};jsworld.DateTimeParser=function(a){if(typeof a!="object"||a._className!="jsworld.Locale")throw"Constructor error: You must provide a valid jsworld.Locale instance.";this.lc=a;this.parseTime=function(a){if(typeof a!="string")throw"Parse error: Argument must be a string";var b=this._extractTokens(this.lc.t_fmt,a);var c=false;if(b.hour!==null&&b.minute!==null&&b.second!==null){c=true}else if(b.hourAmPm!==null&&b.am!==null&&b.minute!==null&&b.second!==null){if(b.am){b.hour=parseInt(b.hourAmPm,10)}else{if(b.hourAmPm==12)b.hour=0;else b.hour=parseInt(b.hourAmPm,10)+12}c=true}if(c)return jsworld._zeroPad(b.hour,2)+":"+jsworld._zeroPad(b.minute,2)+":"+jsworld._zeroPad(b.second,2);else throw"Parse error: Invalid/ambiguous time string"};this.parseDate=function(a){if(typeof a!="string")throw"Parse error: Argument must be a string";var b=this._extractTokens(this.lc.d_fmt,a);var c=false;if(b.year!==null&&b.month!==null&&b.day!==null){c=true}if(c)return jsworld._zeroPad(b.year,4)+"-"+jsworld._zeroPad(b.month,2)+"-"+jsworld._zeroPad(b.day,2);else throw"Parse error: Invalid date string"};this.parseDateTime=function(a){if(typeof a!="string")throw"Parse error: Argument must be a string";var b=this._extractTokens(this.lc.d_t_fmt,a);var c=false;var d=false;if(b.hour!==null&&b.minute!==null&&b.second!==null){c=true}else if(b.hourAmPm!==null&&b.am!==null&&b.minute!==null&&b.second!==null){if(b.am){b.hour=parseInt(b.hourAmPm,10)}else{if(b.hourAmPm==12)b.hour=0;else b.hour=parseInt(b.hourAmPm,10)+12}c=true}if(b.year!==null&&b.month!==null&&b.day!==null){d=true}if(d&&c)return jsworld._zeroPad(b.year,4)+"-"+jsworld._zeroPad(b.month,2)+"-"+jsworld._zeroPad(b.day,2)+" "+jsworld._zeroPad(b.hour,2)+":"+jsworld._zeroPad(b.minute,2)+":"+jsworld._zeroPad(b.second,2);else throw"Parse error: Invalid/ambiguous date/time string"};this._extractTokens=function(a,b){var c={year:null,month:null,day:null,hour:null,hourAmPm:null,am:null,minute:null,second:null,weekday:null};while(a.length>0){if(a.charAt(0)=="%"&&a.charAt(1)!=""){var d=a.substring(0,2);if(d=="%%"){b=b.substring(1)}else if(d=="%a"){for(var e=0;e<this.lc.abday.length;e++){if(jsworld._stringStartsWith(b,this.lc.abday[e])){c.weekday=e;b=b.substring(this.lc.abday[e].length);break}}if(c.weekday===null)throw"Parse error: Unrecognised abbreviated weekday name (%a)"}else if(d=="%A"){for(var e=0;e<this.lc.day.length;e++){if(jsworld._stringStartsWith(b,this.lc.day[e])){c.weekday=e;b=b.substring(this.lc.day[e].length);break}}if(c.weekday===null)throw"Parse error: Unrecognised weekday name (%A)"}else if(d=="%b"||d=="%h"){for(var e=0;e<this.lc.abmon.length;e++){if(jsworld._stringStartsWith(b,this.lc.abmon[e])){c.month=e+1;b=b.substring(this.lc.abmon[e].length);break}}if(c.month===null)throw"Parse error: Unrecognised abbreviated month name (%b)"}else if(d=="%B"){for(var e=0;e<this.lc.mon.length;e++){if(jsworld._stringStartsWith(b,this.lc.mon[e])){c.month=e+1;b=b.substring(this.lc.mon[e].length);break}}if(c.month===null)throw"Parse error: Unrecognised month name (%B)"}else if(d=="%d"){if(/^0[1-9]|[1-2][0-9]|3[0-1]/.test(b)){c.day=parseInt(b.substring(0,2),10);b=b.substring(2)}else throw"Parse error: Unrecognised day of the month (%d)"}else if(d=="%e"){var f=b.match(/^\s?(\d{1,2})/);c.day=parseInt(f,10);if(isNaN(c.day)||c.day<1||c.day>31)throw"Parse error: Unrecognised day of the month (%e)";b=b.substring(f.length)}else if(d=="%F"){if(/^\d\d\d\d/.test(b)){c.year=parseInt(b.substring(0,4),10);b=b.substring(4)}else{throw"Parse error: Unrecognised date (%F)"}if(jsworld._stringStartsWith(b,"-"))b=b.substring(1);else throw"Parse error: Unrecognised date (%F)";if(/^0[1-9]|1[0-2]/.test(b)){c.month=parseInt(b.substring(0,2),10);b=b.substring(2)}else throw"Parse error: Unrecognised date (%F)";if(jsworld._stringStartsWith(b,"-"))b=b.substring(1);else throw"Parse error: Unrecognised date (%F)";if(/^0[1-9]|[1-2][0-9]|3[0-1]/.test(b)){c.day=parseInt(b.substring(0,2),10);b=b.substring(2)}else throw"Parse error: Unrecognised date (%F)"}else if(d=="%H"){if(/^[0-1][0-9]|2[0-3]/.test(b)){c.hour=parseInt(b.substring(0,2),10);b=b.substring(2)}else throw"Parse error: Unrecognised hour (%H)"}else if(d=="%I"){if(/^0[1-9]|1[0-2]/.test(b)){c.hourAmPm=parseInt(b.substring(0,2),10);b=b.substring(2)}else throw"Parse error: Unrecognised hour (%I)"}else if(d=="%k"){var g=b.match(/^(\d{1,2})/);c.hour=parseInt(g,10);if(isNaN(c.hour)||c.hour<0||c.hour>23)throw"Parse error: Unrecognised hour (%k)";b=b.substring(g.length)}else if(d=="%l"){var g=b.match(/^(\d{1,2})/);c.hourAmPm=parseInt(g,10);if(isNaN(c.hourAmPm)||c.hourAmPm<1||c.hourAmPm>12)throw"Parse error: Unrecognised hour (%l)";b=b.substring(g.length)}else if(d=="%m"){if(/^0[1-9]|1[0-2]/.test(b)){c.month=parseInt(b.substring(0,2),10);b=b.substring(2)}else throw"Parse error: Unrecognised month (%m)"}else if(d=="%M"){if(/^[0-5][0-9]/.test(b)){c.minute=parseInt(b.substring(0,2),10);b=b.substring(2)}else throw"Parse error: Unrecognised minute (%M)"}else if(d=="%n"){if(b.charAt(0)=="\n")b=b.substring(1);else throw"Parse error: Unrecognised new line (%n)"}else if(d=="%p"){if(jsworld._stringStartsWith(b,this.lc.am)){c.am=true;b=b.substring(this.lc.am.length)}else if(jsworld._stringStartsWith(b,this.lc.pm)){c.am=false;b=b.substring(this.lc.pm.length)}else throw"Parse error: Unrecognised AM/PM value (%p)"}else if(d=="%P"){if(jsworld._stringStartsWith(b,this.lc.am.toLowerCase())){c.am=true;b=b.substring(this.lc.am.length)}else if(jsworld._stringStartsWith(b,this.lc.pm.toLowerCase())){c.am=false;b=b.substring(this.lc.pm.length)}else throw"Parse error: Unrecognised AM/PM value (%P)"}else if(d=="%R"){if(/^[0-1][0-9]|2[0-3]/.test(b)){c.hour=parseInt(b.substring(0,2),10);b=b.substring(2)}else throw"Parse error: Unrecognised time (%R)";if(jsworld._stringStartsWith(b,":"))b=b.substring(1);else throw"Parse error: Unrecognised time (%R)";if(/^[0-5][0-9]/.test(b)){c.minute=parseInt(b.substring(0,2),10);b=b.substring(2)}else throw"Parse error: Unrecognised time (%R)"}else if(d=="%S"){if(/^[0-5][0-9]/.test(b)){c.second=parseInt(b.substring(0,2),10);b=b.substring(2)}else throw"Parse error: Unrecognised second (%S)"}else if(d=="%T"){if(/^[0-1][0-9]|2[0-3]/.test(b)){c.hour=parseInt(b.substring(0,2),10);b=b.substring(2)}else throw"Parse error: Unrecognised time (%T)";if(jsworld._stringStartsWith(b,":"))b=b.substring(1);else throw"Parse error: Unrecognised time (%T)";if(/^[0-5][0-9]/.test(b)){c.minute=parseInt(b.substring(0,2),10);b=b.substring(2)}else throw"Parse error: Unrecognised time (%T)";if(jsworld._stringStartsWith(b,":"))b=b.substring(1);else throw"Parse error: Unrecognised time (%T)";if(/^[0-5][0-9]/.test(b)){c.second=parseInt(b.substring(0,2),10);b=b.substring(2)}else throw"Parse error: Unrecognised time (%T)"}else if(d=="%w"){if(/^\d/.test(b)){c.weekday=parseInt(b.substring(0,1),10);b=b.substring(1)}else throw"Parse error: Unrecognised weekday number (%w)"}else if(d=="%y"){if(/^\d\d/.test(b)){var h=parseInt(b.substring(0,2),10);if(h>50)c.year=1900+h;else c.year=2e3+h;b=b.substring(2)}else throw"Parse error: Unrecognised year (%y)"}else if(d=="%Y"){if(/^\d\d\d\d/.test(b)){c.year=parseInt(b.substring(0,4),10);b=b.substring(4)}else throw"Parse error: Unrecognised year (%Y)"}else if(d=="%Z"){if(a.length===0)break}a=a.substring(2)}else{if(a.charAt(0)!=b.charAt(0))throw'Parse error: Unexpected symbol "'+b.charAt(0)+'" in date/time string';a=a.substring(1);b=b.substring(1)}}return c}};jsworld.MonetaryParser=function(a){if(typeof a!="object"||a._className!="jsworld.Locale")throw"Constructor error: You must provide a valid jsworld.Locale instance";this.lc=a;this.parse=function(a){if(typeof a!="string")throw"Parse error: Argument must be a string";var b=this._detectCurrencySymbolType(a);var c,d;if(b=="local"){c="local";d=a.replace(this.lc.getCurrencySymbol(),"")}else if(b=="int"){c="int";d=a.replace(this.lc.getIntCurrencySymbol(),"")}else if(b=="none"){c="local";d=a}else throw"Parse error: Internal assert failure";d=jsworld._stringReplaceAll(d,this.lc.mon_thousands_sep,"");d=d.replace(this.lc.mon_decimal_point,".");d=d.replace(/\s*/g,"");d=this._removeLocalNonNegativeSign(d,c);d=this._normaliseNegativeSign(d,c);if(jsworld._isNumber(d))return parseFloat(d,10);else throw"Parse error: Invalid currency amount string"};this._detectCurrencySymbolType=function(a){if(this.lc.getCurrencySymbol().length>this.lc.getIntCurrencySymbol().length){if(a.indexOf(this.lc.getCurrencySymbol())!=-1)return"local";else if(a.indexOf(this.lc.getIntCurrencySymbol())!=-1)return"int";else return"none"}else{if(a.indexOf(this.lc.getIntCurrencySymbol())!=-1)return"int";else if(a.indexOf(this.lc.getCurrencySymbol())!=-1)return"local";else return"none"}};this._removeLocalNonNegativeSign=function(a,b){a=a.replace(this.lc.positive_sign,"");if((b=="local"&&this.lc.p_sign_posn===0||b=="int"&&this.lc.int_p_sign_posn===0)&&/\(\d+\.?\d*\)/.test(a)){a=a.replace("(","");a=a.replace(")","")}return a};this._normaliseNegativeSign=function(a,b){a=a.replace(this.lc.negative_sign,"-");if(b=="local"&&this.lc.n_sign_posn===0||b=="int"&&this.lc.int_n_sign_posn===0){if(/^\(\d+\.?\d*\)$/.test(a)){a=a.replace("(","");a=a.replace(")","");return"-"+a}}if(b=="local"&&this.lc.n_sign_posn==2||b=="int"&&this.lc.int_n_sign_posn==2){if(/^\d+\.?\d*-$/.test(a)){a=a.replace("-","");return"-"+a}}if(b=="local"&&this.lc.n_cs_precedes===0&&this.lc.n_sign_posn==3||b=="local"&&this.lc.n_cs_precedes===0&&this.lc.n_sign_posn==4||b=="int"&&this.lc.int_n_cs_precedes===0&&this.lc.int_n_sign_posn==3||b=="int"&&this.lc.int_n_cs_precedes===0&&this.lc.int_n_sign_posn==4){if(/^\d+\.?\d*-$/.test(a)){a=a.replace("-","");return"-"+a}}return a}}
if(typeof POSIX_LC == "undefined") var POSIX_LC = {};
POSIX_LC.en_US = {
"decimal_point" : ".",
"thousands_sep" : ",",
"grouping" : "3",
"abday" : ["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],
"day" : ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],
"abmon" : ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],
"mon" : ["January","February","March","April","May","June","July","August","September","October","November","December"],
"d_fmt" : "%m/%e/%y",
"t_fmt" : "%I:%M:%S %p",
"d_t_fmt" : "%B %e, %Y %I:%M:%S %p %Z",
"am_pm" : ["AM","PM"],
"int_curr_symbol" : "USD ",
"currency_symbol" : "\u0024",
"mon_decimal_point" : ".",
"mon_thousands_sep" : ",",
"mon_grouping" : "3",
"positive_sign" : "",
"negative_sign" : "-",
"int_frac_digits" : 2,
"frac_digits" : 2,
"p_cs_precedes" : 1,
"n_cs_precedes" : 1,
"p_sep_by_space" : 0,
"n_sep_by_space" : 0,
"p_sign_posn" : 1,
"n_sign_posn" : 1,
"int_p_cs_precedes" : 1,
"int_n_cs_precedes" : 1,
"int_p_sep_by_space" : 0,
"int_n_sep_by_space" : 0,
"int_p_sign_posn" : 1,
"int_n_sign_posn" : 1
}
if(typeof POSIX_LC == "undefined") var POSIX_LC = {};
POSIX_LC.fr_FR = {
"decimal_point" : ",",
"thousands_sep" : "\u00a0",
"grouping" : "3",
"abday" : ["dim.","lun.","mar.",
"mer.","jeu.","ven.",
"sam."],
"day" : ["dimanche","lundi","mardi",
"mercredi","jeudi","vendredi",
"samedi"],
"abmon" : ["janv.","f\u00e9vr.","mars",
"avr.","mai","juin",
"juil.","ao\u00fbt","sept.",
"oct.","nov.","d\u00e9c."],
"mon" : ["janvier","f\u00e9vrier","mars",
"avril","mai","juin",
"juillet","ao\u00fbt","septembre",
"octobre","novembre","d\u00e9cembre"],
"d_fmt" : "%d/%m/%y",
"t_fmt" : "%H:%M:%S",
"d_t_fmt" : "%e %B %Y %H:%M:%S %Z",
"am_pm" : ["AM","PM"],
"int_curr_symbol" : "EUR ",
"currency_symbol" : "\u20ac",
"mon_decimal_point" : ",",
"mon_thousands_sep" : "\u00a0",
"mon_grouping" : "3",
"positive_sign" : "",
"negative_sign" : "-",
"int_frac_digits" : 2,
"frac_digits" : 2,
"p_cs_precedes" : 0,
"n_cs_precedes" : 0,
"p_sep_by_space" : 1,
"n_sep_by_space" : 1,
"p_sign_posn" : 1,
"n_sign_posn" : 1,
"int_p_cs_precedes" : 0,
"int_n_cs_precedes" : 0,
"int_p_sep_by_space" : 1,
"int_n_sep_by_space" : 1,
"int_p_sign_posn" : 1,
"int_n_sign_posn" : 1
};
/** https://github.com/csnover/js-iso8601 */(function(n,f){var u=n.parse,c=[1,4,5,6,7,10,11];n.parse=function(t){var i,o,a=0;if(o=/^(\d{4}|[+\-]\d{6})(?:-(\d{2})(?:-(\d{2}))?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/.exec(t)){for(var v=0,r;r=c[v];++v)o[r]=+o[r]||0;o[2]=(+o[2]||1)-1,o[3]=+o[3]||1,o[8]!=="Z"&&o[9]!==f&&(a=o[10]*60+o[11],o[9]==="+"&&(a=0-a)),i=n.UTC(o[1],o[2],o[3],o[4],o[5]+a,o[6],o[7])}else i=u?u(t):NaN;return i}})(Date)
/*!
* geo-location-javascript v0.4.3
* http://code.google.com/p/geo-location-javascript/
*
* Copyright (c) 2009 Stan Wiechers
* Licensed under the MIT licenses.
*
* Revision: $Rev: 68 $:
* Author: $Author: whoisstan $:
* Date: $Date: 2010-02-15 13:42:19 +0100 (Mon, 15 Feb 2010) $:
*/
var geo_position_js=function() {
var pub = {};
var provider=null;
pub.getCurrentPosition = function(successCallback,errorCallback,options)
{
provider.getCurrentPosition(successCallback, errorCallback,options);
}
pub.init = function()
{
try
{
if (typeof(geo_position_js_simulator)!="undefined")
{
provider=geo_position_js_simulator;
}
else if (typeof(bondi)!="undefined" && typeof(bondi.geolocation)!="undefined")
{
provider=bondi.geolocation;
}
else if (typeof(navigator.geolocation)!="undefined")
{
provider=navigator.geolocation;
pub.getCurrentPosition = function(successCallback, errorCallback, options)
{
function _successCallback(p)
{
//for mozilla geode,it returns the coordinates slightly differently
if(typeof(p.latitude)!="undefined")
{
successCallback({timestamp:p.timestamp, coords: {latitude:p.latitude,longitude:p.longitude}});
}
else
{
successCallback(p);
}
}
provider.getCurrentPosition(_successCallback,errorCallback,options);
}
}
else if(typeof(window.google)!="undefined" && typeof(google.gears)!="undefined")
{
provider=google.gears.factory.create('beta.geolocation');
}
else if ( typeof(Mojo) !="undefined" && typeof(Mojo.Service.Request)!="Mojo.Service.Request")
{
provider=true;
pub.getCurrentPosition = function(successCallback, errorCallback, options)
{
parameters={};
if(options)
{
//http://developer.palm.com/index.php?option=com_content&view=article&id=1673#GPS-getCurrentPosition
if (options.enableHighAccuracy && options.enableHighAccuracy==true)
{
parameters.accuracy=1;
}
if (options.maximumAge)
{
parameters.maximumAge=options.maximumAge;
}
if (options.responseTime)
{
if(options.responseTime<5)
{
parameters.responseTime=1;
}
else if (options.responseTime<20)
{
parameters.responseTime=2;
}
else
{
parameters.timeout=3;
}
}
}
r=new Mojo.Service.Request('palm://com.palm.location', {
method:"getCurrentPosition",
parameters:parameters,
onSuccess: function(p){successCallback({timestamp:p.timestamp, coords: {latitude:p.latitude, longitude:p.longitude,heading:p.heading}});},
onFailure: function(e){
if (e.errorCode==1)
{
errorCallback({code:3,message:"Timeout"});
}
else if (e.errorCode==2)
{
errorCallback({code:2,message:"Position Unavailable"});
}
else
{
errorCallback({code:0,message:"Unknown Error: webOS-code"+errorCode});
}
}
});
}
}
else if (typeof(device)!="undefined" && typeof(device.getServiceObject)!="undefined")
{
provider=device.getServiceObject("Service.Location", "ILocation");
//override default method implementation
pub.getCurrentPosition = function(successCallback, errorCallback, options)
{
function callback(transId, eventCode, result) {
if (eventCode == 4)
{
errorCallback({message:"Position unavailable", code:2});
}
else
{
//no timestamp of location given?
successCallback({timestamp:null, coords: {latitude:result.ReturnValue.Latitude, longitude:result.ReturnValue.Longitude, altitude:result.ReturnValue.Altitude,heading:result.ReturnValue.Heading}});
}
}
//location criteria
var criteria = new Object();
criteria.LocationInformationClass = "BasicLocationInformation";
//make the call
provider.ILocation.GetLocation(criteria,callback);
}
}
}
catch (e){
alert("error="+e);
if(typeof(console)!="undefined")
{
console.log(e);
}
return false;
}
return provider!=null;
}
return pub;
}();
// Couldn't get unminified version to work , go here for docs => https://github.com/iamnoah/writeCapture
(function(E,a){var j=a.document;function A(Q){var Z=j.createElement("div");j.body.insertBefore(Z,null);E.replaceWith(Z,'<script type="text/javascript">'+Q+"<\/script>")}E=E||(function(Q){return{ajax:Q.ajax,$:function(Z){return Q(Z)[0]},replaceWith:function(Z,ad){var ac=Q(Z)[0];var ab=ac.nextSibling,aa=ac.parentNode;Q(ac).remove();if(ab){Q(ab).before(ad)}else{Q(aa).append(ad)}},onLoad:function(Z){Q(Z)},copyAttrs:function(af,ab){var ad=Q(ab),aa=af.attributes;for(var ac=0,Z=aa.length;ac<Z;ac++){if(aa[ac]&&aa[ac].value){try{ad.attr(aa[ac].name,aa[ac].value)}catch(ae){}}}}}})(a.jQuery);E.copyAttrs=E.copyAttrs||function(){};E.onLoad=E.onLoad||function(){throw"error: autoAsync cannot be used without jQuery or defining writeCaptureSupport.onLoad"};function P(ab,aa){for(var Z=0,Q=ab.length;Z<Q;Z++){if(aa(ab[Z])===false){return}}}function v(Q){return Object.prototype.toString.call(Q)==="[object Function]"}function p(Q){return Object.prototype.toString.call(Q)==="[object String]"}function u(aa,Z,Q){return Array.prototype.slice.call(aa,Z||0,Q||aa&&aa.length)}function D(ab,aa){var Q=false;P(ab,Z);function Z(ac){return !(Q=aa(ac))}return Q}function L(Q){this._queue=[];this._children=[];this._parent=Q;if(Q){Q._addChild(this)}}L.prototype={_addChild:function(Q){this._children.push(Q)},push:function(Q){this._queue.push(Q);this._bubble("_doRun")},pause:function(){this._bubble("_doPause")},resume:function(){this._bubble("_doResume")},_bubble:function(Z){var Q=this;while(!Q[Z]){Q=Q._parent}return Q[Z]()},_next:function(){if(D(this._children,Q)){return true}function Q(aa){return aa._next()}var Z=this._queue.shift();if(Z){Z()}return !!Z}};function i(Q){if(Q){return new L(Q)}L.call(this);this.paused=0}i.prototype=(function(){function Q(){}Q.prototype=L.prototype;return new Q()})();i.prototype._doRun=function(){if(!this.running){this.running=true;try{while(this.paused<1&&this._next()){}}finally{this.running=false}}};i.prototype._doPause=function(){this.paused++};i.prototype._doResume=function(){this.paused--;this._doRun()};function M(){}M.prototype={_html:"",open:function(){this._opened=true;if(this._delegate){this._delegate.open()}},write:function(Q){if(this._closed){return}this._written=true;if(this._delegate){this._delegate.write(Q)}else{this._html+=Q}},writeln:function(Q){this.write(Q+"\n")},close:function(){this._closed=true;if(this._delegate){this._delegate.close()}},copyTo:function(Q){this._delegate=Q;Q.foobar=true;if(this._opened){Q.open()}if(this._written){Q.write(this._html)}if(this._closed){Q.close()}}};var e=(function(){var Q={f:j.getElementById};try{Q.f.call(j,"abc");return true}catch(Z){return false}})();function I(Q){P(Q,function(Z){var aa=j.getElementById(Z.id);if(!aa){l("<proxyGetElementById - finish>","no element in writen markup with id "+Z.id);return}P(Z.el.childNodes,function(ab){aa.appendChild(ab)});if(aa.contentWindow){a.setTimeout(function(){Z.el.contentWindow.document.copyTo(aa.contentWindow.document)},1)}E.copyAttrs(Z.el,aa)})}function s(Z,Q){if(Q&&Q[Z]===false){return false}return Q&&Q[Z]||o[Z]}function x(Z,ai){var ae=[],ad=s("proxyGetElementById",ai),ag=s("writeOnGetElementById",ai),Q={write:j.write,writeln:j.writeln,finish:function(){},out:""};Z.state=Q;j.write=ah;j.writeln=aa;if(ad||ag){Q.getEl=j.getElementById;j.getElementById=ab;if(ag){findEl=af}else{findEl=ac;Q.finish=function(){I(ae)}}}function ah(aj){Q.out+=aj}function aa(aj){Q.out+=aj+"\n"}function ac(ak){var aj=j.createElement("div");ae.push({id:ak,el:aj});aj.contentWindow={document:new M()};return aj}function af(al){var aj=E.$(Z.target);var ak=j.createElement("div");aj.parentNode.insertBefore(ak,aj);E.replaceWith(ak,Q.out);Q.out="";return e?Q.getEl.call(j,al):Q.getEl(al)}function ab(ak){var aj=e?Q.getEl.call(j,ak):Q.getEl(ak);return aj||findEl(ak)}return Q}function V(Q){j.write=Q.write;j.writeln=Q.writeln;if(Q.getEl){j.getElementById=Q.getEl}return Q.out}function N(Q){return Q&&Q.replace(/^\s*<!(\[CDATA\[|--)/,"").replace(/(\]\]|--)>\s*$/,"")}function b(){}function d(Z,Q){console.error("Error",Q,"executing code:",Z)}var l=v(a.console&&console.error)?d:b;function S(aa,Z,Q){var ab=x(Z,Q);try{A(N(aa))}catch(ac){l(aa,ac)}finally{V(ab)}return ab}function O(Z){var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(Z);return Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)}function T(Q){return new RegExp(Q+"=(?:([\"'])([\\s\\S]*?)\\1|([^\\s>]+))","i")}function k(Q){var Z=T(Q);return function(aa){var ab=Z.exec(aa)||[];return ab[2]||ab[3]}}var r=/(<script[\s\S]*?>)([\s\S]*?)<\/script>/ig,n=T("src"),X=k("src"),q=k("type"),Y=k("language"),C="__document_write_ajax_callbacks__",B="__document_write_ajax_div-",g="window['"+C+"']['%d']();",m=a[C]={},w='<script type="text/javascript">'+g+"<\/script>",H=0;function c(){return(++H).toString()}function G(Z,aa){var Q;if(v(Z)){Q=Z;Z=null}Z=Z||{};Q=Q||Z&&Z.done;Z.done=aa?function(){aa(Q)}:Q;return Z}var z=new i();var y=[];var f=window._debugWriteCapture?function(){}:function(Q,aa,Z){y.push({type:Q,src:aa,data:Z})};var K=window._debugWriteCapture?function(){}:function(){y.push(arguments)};function W(Q){var Z=c();m[Z]=function(){Q();delete m[Z]};return Z}function J(Q){return w.replace(/%d/,W(Q))}function R(ac,ag,aa,ae){var ad=aa&&new i(aa)||z;ag=G(ag);var ab=s("done",ag);var Q="";var Z=s("fixUrls",ag);if(!v(Z)){Z=function(ah){return ah}}if(v(ab)){Q=J(function(){ad.push(ab)})}return ac.replace(r,af)+Q;function af(aj,av,ai){var an=X(av),am=q(av)||"",aB=Y(av)||"",aA=(!am&&!aB)||am.toLowerCase().indexOf("javascript")!==-1||aB.toLowerCase().indexOf("javascript")!==-1;f("replace",an,aj);if(!aA){return aj}var aw=W(ap),ao=B+aw,au,al={target:"#"+ao,parent:ae};function ap(){ad.push(au)}if(an){an=Z(an);av=av.replace(n,"");if(O(an)){au=az}else{if(s("asyncAll",ag)){au=ay()}else{au=at}}}else{au=ax}function ax(){ah(ai)}function at(){E.ajax({url:an,type:"GET",dataType:"text",async:false,success:function(aC){ah(aC)}})}function ak(aE,aC,aD){l("<XHR for "+an+">",aD);ad.resume()}function aq(){return J(function(){ad.resume()})}function ay(){var aE,aD;function aC(aG,aF){if(!aE){aD=aG;return}try{ah(aG,aq())}catch(aH){l(aG,aH)}}E.ajax({url:an,type:"GET",dataType:"text",async:true,success:aC,error:ak});return function(){aE=true;if(aD){ah(aD)}else{ad.pause()}}}function az(aC){var aE=x(al,ag);ad.pause();f("pause",an);E.ajax({url:an,type:"GET",dataType:"script",success:aD,error:ak});function aD(aH,aG,aF){f("out",an,aE.out);ar(V(aE),J(aE.finish)+aq());f("resume",an)}}function ah(aD,aC){var aE=S(aD,al,ag);aC=J(aE.finish)+(aC||"");ar(aE.out,aC)}function ar(aD,aC){E.replaceWith(al.target,R(aD,null,ad,al)+(aC||""))}return'<div style="display: none" id="'+ao+'"></div>'+av+g.replace(/%d/,aw)+"<\/script>"}}function F(Z,aa){var Q=z;P(Z,function(ab){Q.push(ac);function ac(){ab.action(R(ab.html,ab.options,Q),ab)}});if(aa){Q.push(aa)}}function U(Q){var Z=Q;while(Z&&Z.nodeType===1){Q=Z;Z=Z.lastChild;while(Z&&Z.nodeType!==1){Z=Z.previousSibling}}return Q}function h(Q){var aa=j.write,ad=j.writeln,Z,ab=[];j.writeln=function(ae){j.write(ae+"\n")};var ac;j.write=function(af){var ae=U(j.body);if(ae!==Z){Z=ae;ab.push(ac={el:ae,out:[]})}ac.out.push(af)};E.onLoad(function(){var ah,ak,af,aj,ai;Q=G(Q);ai=Q.done;Q.done=function(){j.write=aa;j.writeln=ad;if(ai){ai()}};for(var ag=0,ae=ab.length;ag<ae;ag++){ah=ab[ag].el;ak=j.createElement("div");ah.parentNode.insertBefore(ak,ah.nextSibling);af=ab[ag].out.join("");aj=ae-ag===1?R(af,Q):R(af);E.replaceWith(ak,aj)}})}var t="writeCapture";var o=a[t]={_original:a[t],fixUrls:function(Q){return Q.replace(/&/g,"&")},noConflict:function(){a[t]=this._original;return this},debug:y,proxyGetElementById:false,_forTest:{Q:i,GLOBAL_Q:z,$:E,matchAttr:k,slice:u,capture:x,uncapture:V,captureWrite:S},replaceWith:function(Q,aa,Z){E.replaceWith(Q,R(aa,Z))},html:function(Q,ab,Z){var aa=E.$(Q);aa.innerHTML="<span/>";E.replaceWith(aa.firstChild,R(ab,Z))},load:function(Q,aa,Z){E.ajax({url:aa,dataType:"text",type:"GET",success:function(ab){o.html(Q,ab,Z)}})},autoAsync:h,sanitize:R,sanitizeSerial:F}})(this.writeCaptureSupport,this);(function(g,d,n){var c={html:h};g.each(["append","prepend","after","before","wrap","wrapAll","replaceWith","wrapInner"],function(){c[this]=i(this)});function a(q){return Object.prototype.toString.call(q)=="[object String]"}function p(u,t,s,r){if(arguments.length==0){return o.call(this)}var q=c[u];if(u=="load"){return l.call(this,t,s,r)}if(!q){j(u)}return b.call(this,t,s,q)}g.fn.writeCapture=p;var k="__writeCaptureJsProxied-fghebd__";function o(){if(this[k]){return this}var r=this;function q(){var t=this,s=false;this[k]=true;g.each(c,function(v){var u=r[v];if(!u){return}t[v]=function(y,x,w){if(!s&&a(y)){try{s=true;return p.call(t,v,y,x,w)}finally{s=false}}return u.apply(t,arguments)}});this.pushStack=function(){return o.call(r.pushStack.apply(t,arguments))};this.endCapture=function(){return r}}q.prototype=r;return new q()}function b(t,s,u){var q,r=this;if(s&&s.done){q=s.done;delete s.done}else{if(g.isFunction(s)){q=s;s=null}}d.sanitizeSerial(g.map(this,function(v){return{html:t,options:s,action:function(w){u.call(v,w)}}}),q&&function(){q.call(r)}||q);return this}function h(q){g(this).html(q)}function i(q){return function(r){g(this)[q](r)}}function l(t,s,v){var r=this,q,u=t.indexOf(" ");if(u>=0){q=t.slice(u,t.length);t=t.slice(0,u)}if(g.isFunction(v)){s=s||{};s.done=v}return g.ajax({url:t,type:s&&s.type||"GET",dataType:"html",data:s&&s.params,complete:f(r,s,q)})}function f(r,s,q){return function(u,t){if(t=="success"||t=="notmodified"){var v=m(u.responseText,q);b.call(r,v,s,h)}}}var e=/jquery-writeCapture-script-placeholder-(\d+)-wc/g;function m(s,r){if(!r||!s){return s}var t=0,q={};return g("<div/>").append(s.replace(/<script(.|\s)*?\/script>/g,function(u){q[t]=u;return"jquery-writeCapture-script-placeholder-"+(t++)+"-wc"})).find(r).html().replace(e,function(u,v){return q[v]})}function j(q){throw"invalid method parameter "+q}g.writeCapture=d})(jQuery,writeCapture.noConflict());
/*!
* Amplify Store - Persistent Client-Side Storage 1.0.0
*
* Copyright 2011 appendTo LLC. (http://appendto.com/team)
* Dual licensed under the MIT or GPL licenses.
* http://appendto.com/open-source-licenses
*
* http://amplifyjs.com
*/
(function( amplify, undefined ) {
var store = amplify.store = function( key, value, options, type ) {
var type = store.type;
if ( options && options.type && options.type in store.types ) {
type = options.type;
}
return store.types[ type ]( key, value, options || {} );
};
store.types = {};
store.type = null;
store.addType = function( type, storage ) {
if ( !store.type ) {
store.type = type;
}
store.types[ type ] = storage;
store[ type ] = function( key, value, options ) {
options = options || {};
options.type = type;
return store( key, value, options );
};
}
store.error = function() {
return "amplify.store quota exceeded";
};
var rprefix = /^__amplify__/;
function createFromStorageInterface( storageType, storage ) {
store.addType( storageType, function( key, value, options ) {
var storedValue, parsed, i, remove,
ret = value,
now = (new Date()).getTime();
if ( !key ) {
ret = {};
remove = [];
i = 0;
try {
// accessing the length property works around a localStorage bug
// in Firefox 4.0 where the keys don't update cross-page
// we assign to key just to avoid Closure Compiler from removing
// the access as "useless code"
// https://bugzilla.mozilla.org/show_bug.cgi?id=662511
key = storage.length;
while ( key = storage.key( i++ ) ) {
if ( rprefix.test( key ) ) {
parsed = JSON.parse( storage.getItem( key ) );
if ( parsed.expires && parsed.expires <= now ) {
remove.push( key );
} else {
ret[ key.replace( rprefix, "" ) ] = parsed.data;
}
}
}
while ( key = remove.pop() ) {
storage.removeItem( key );
}
} catch ( error ) {}
return ret;
}
// protect against name collisions with direct storage
key = "__amplify__" + key;
if ( value === undefined ) {
storedValue = storage.getItem( key );
parsed = storedValue ? JSON.parse( storedValue ) : { expires: -1 };
if ( parsed.expires && parsed.expires <= now ) {
storage.removeItem( key );
} else {
return parsed.data;
}
} else {
if ( value === null ) {
storage.removeItem( key );
} else {
parsed = JSON.stringify({
data: value,
expires: options.expires ? now + options.expires : null
});
try {
storage.setItem( key, parsed );
// quota exceeded
} catch( error ) {
// expire old data and try again
store[ storageType ]();
try {
storage.setItem( key, parsed );
} catch( error ) {
throw store.error();
}
}
}
}
return ret;
});
}
// localStorage + sessionStorage
// IE 8+, Firefox 3.5+, Safari 4+, Chrome 4+, Opera 10.5+, iPhone 2+, Android 2+
for ( var webStorageType in { localStorage: 1, sessionStorage: 1 } ) {
// try/catch for file protocol in Firefox
try {
if ( window[ webStorageType ].getItem ) {
createFromStorageInterface( webStorageType, window[ webStorageType ] );
}
} catch( e ) {}
}
// globalStorage
// non-standard: Firefox 2+
// https://developer.mozilla.org/en/dom/storage#globalStorage
if ( window.globalStorage ) {
// try/catch for file protocol in Firefox
try {
createFromStorageInterface( "globalStorage",
window.globalStorage[ window.location.hostname ] );
// Firefox 2.0 and 3.0 have sessionStorage and globalStorage
// make sure we default to globalStorage
// but don't default to globalStorage in 3.5+ which also has localStorage
if ( store.type === "sessionStorage" ) {
store.type = "globalStorage";
}
} catch( e ) {}
}
// userData
// non-standard: IE 5+
// http://msdn.microsoft.com/en-us/library/ms531424(v=vs.85).aspx
(function() {
// IE 9 has quirks in userData that are a huge pain
// rather than finding a way to detect these quirks
// we just don't register userData if we have localStorage
if ( store.types.localStorage ) {
return;
}
// append to html instead of body so we can do this from the head
var div = document.createElement( "div" ),
attrKey = "amplify";
div.style.display = "none";
document.getElementsByTagName( "head" )[ 0 ].appendChild( div );
if ( div.addBehavior ) {
div.addBehavior( "#default#userdata" );
store.addType( "userData", function( key, value, options ) {
div.load( attrKey );
var attr, parsed, prevValue, i, remove,
ret = value,
now = (new Date()).getTime();
if ( !key ) {
ret = {};
remove = [];
i = 0;
while ( attr = div.XMLDocument.documentElement.attributes[ i++ ] ) {
parsed = JSON.parse( attr.value );
if ( parsed.expires && parsed.expires <= now ) {
remove.push( attr.name );
} else {
ret[ attr.name ] = parsed.data;
}
}
while ( key = remove.pop() ) {
div.removeAttribute( key );
}
div.save( attrKey );
return ret;
}
// convert invalid characters to dashes
// http://www.w3.org/TR/REC-xml/#NT-Name
// simplified to assume the starting character is valid
// also removed colon as it is invalid in HTML attribute names
//key = key.replace( /[^-._0-9A-Za-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u37f-\u1fff\u200c-\u200d\u203f\u2040\u2070-\u218f]/g, "-" );
if ( value === undefined ) {
attr = div.getAttribute( key );
parsed = attr ? JSON.parse( attr ) : { expires: -1 };
if ( parsed.expires && parsed.expires <= now ) {
div.removeAttribute( key );
} else {
return parsed.data;
}
} else {
if ( value === null ) {
div.removeAttribute( key );
} else {
// we need to get the previous value in case we need to rollback
prevValue = div.getAttribute( key );
parsed = JSON.stringify({
data: value,
expires: (options.expires ? (now + options.expires) : null)
});
div.setAttribute( key, parsed );
}
}
try {
div.save( attrKey );
// quota exceeded
} catch ( error ) {
// roll the value back to the previous value
if ( prevValue === null ) {
div.removeAttribute( key );
} else {
div.setAttribute( key, prevValue );
}
// expire old data and try again
store.userData();
try {
div.setAttribute( key, parsed );
div.save( attrKey );
} catch ( error ) {
// roll the value back to the previous value
if ( prevValue === null ) {
div.removeAttribute( key );
} else {
div.setAttribute( key, prevValue );
}
throw store.error();
}
}
return ret;
});
}
}() );
// in-memory storage
// fallback for all browsers to enable the API even if we can't persist data
(function() {
var memory = {};
function copy( obj ) {
return obj === undefined ? undefined : JSON.parse( JSON.stringify( obj ) );
}
store.addType( "memory", function( key, value, options ) {
if ( !key ) {
return copy( memory );
}
if ( value === undefined ) {
return copy( memory[ key ] );
}
if ( value === null ) {
delete memory[ key ];
return null;
}
memory[ key ] = value;
if ( options.expires ) {
setTimeout(function() {
delete memory[ key ];
}, options.expires );
}
return value;
});
}() );
}( this.amplify = this.amplify || {} ) );
/*!
* Modernizr v2.0.6
* http://www.modernizr.com
*
* Copyright (c) 2009-2011 Faruk Ates, Paul Irish, Alex Sexton
* Dual-licensed under the BSD or MIT licenses: www.modernizr.com/license/
*/
/*
* Modernizr tests which native CSS3 and HTML5 features are available in
* the current UA and makes the results available to you in two ways:
* as properties on a global Modernizr object, and as classes on the
* <html> element. This information allows you to progressively enhance
* your pages with a granular level of control over the experience.
*
* Modernizr has an optional (not included) conditional resource loader
* called Modernizr.load(), based on Yepnope.js (yepnopejs.com).
* To get a build that includes Modernizr.load(), as well as choosing
* which tests to include, go to www.modernizr.com/download/
*
* Authors Faruk Ates, Paul Irish, Alex Sexton,
* Contributors Ryan Seddon, Ben Alman
*/
window.Modernizr = (function( window, document, undefined ) {
var version = '2.0.6',
Modernizr = {},
// option for enabling the HTML classes to be added
enableClasses = true,
docElement = document.documentElement,
docHead = document.head || document.getElementsByTagName('head')[0],
/**
* Create our "modernizr" element that we do most feature tests on.
*/
mod = 'modernizr',
modElem = document.createElement(mod),
mStyle = modElem.style,
/**
* Create the input element for various Web Forms feature tests.
*/
inputElem = document.createElement('input'),
smile = ':)',
toString = Object.prototype.toString,
// List of property values to set for css tests. See ticket #21
prefixes = ' -webkit- -moz- -o- -ms- -khtml- '.split(' '),
// Following spec is to expose vendor-specific style properties as:
// elem.style.WebkitBorderRadius
// and the following would be incorrect:
// elem.style.webkitBorderRadius
// Webkit ghosts their properties in lowercase but Opera & Moz do not.
// Microsoft foregoes prefixes entirely <= IE8, but appears to
// use a lowercase `ms` instead of the correct `Ms` in IE9
// More here: http://github.com/Modernizr/Modernizr/issues/issue/21
domPrefixes = 'Webkit Moz O ms Khtml'.split(' '),
ns = {'svg': 'http://www.w3.org/2000/svg'},
tests = {},
inputs = {},
attrs = {},
classes = [],
featureName, // used in testing loop
// Inject element with style element and some CSS rules
injectElementWithStyles = function( rule, callback, nodes, testnames ) {
var style, ret, node,
div = document.createElement('div');
if ( parseInt(nodes, 10) ) {
// In order not to give false positives we create a node for each test
// This also allows the method to scale for unspecified uses
while ( nodes-- ) {
node = document.createElement('div');
node.id = testnames ? testnames[nodes] : mod + (nodes + 1);
div.appendChild(node);
}
}
// <style> elements in IE6-9 are considered 'NoScope' elements and therefore will be removed
// when injected with innerHTML. To get around this you need to prepend the 'NoScope' element
// with a 'scoped' element, in our case the soft-hyphen entity as it won't mess with our measurements.
// http://msdn.microsoft.com/en-us/library/ms533897%28VS.85%29.aspx
style = ['­', '<style>', rule, '</style>'].join('');
div.id = mod;
div.innerHTML += style;
docElement.appendChild(div);
ret = callback(div, rule);
div.parentNode.removeChild(div);
return !!ret;
},
// adapted from matchMedia polyfill
// by Scott Jehl and Paul Irish
// gist.github.com/786768
testMediaQuery = function( mq ) {
if ( window.matchMedia ) {
return matchMedia(mq).matches;
}
var bool;
injectElementWithStyles('@media ' + mq + ' { #' + mod + ' { position: absolute; } }', function( node ) {
bool = (window.getComputedStyle ?
getComputedStyle(node, null) :
node.currentStyle)['position'] == 'absolute';
});
return bool;
},
/**
* isEventSupported determines if a given element supports the given event
* function from http://yura.thinkweb2.com/isEventSupported/
*/
isEventSupported = (function() {
var TAGNAMES = {
'select': 'input', 'change': 'input',
'submit': 'form', 'reset': 'form',
'error': 'img', 'load': 'img', 'abort': 'img'
};
function isEventSupported( eventName, element ) {
element = element || document.createElement(TAGNAMES[eventName] || 'div');
eventName = 'on' + eventName;
// When using `setAttribute`, IE skips "unload", WebKit skips "unload" and "resize", whereas `in` "catches" those
var isSupported = eventName in element;
if ( !isSupported ) {
// If it has no `setAttribute` (i.e. doesn't implement Node interface), try generic element
if ( !element.setAttribute ) {
element = document.createElement('div');
}
if ( element.setAttribute && element.removeAttribute ) {
element.setAttribute(eventName, '');
isSupported = is(element[eventName], 'function');
// If property was created, "remove it" (by setting value to `undefined`)
if ( !is(element[eventName], undefined) ) {
element[eventName] = undefined;
}
element.removeAttribute(eventName);
}
}
element = null;
return isSupported;
}
return isEventSupported;
})();
// hasOwnProperty shim by kangax needed for Safari 2.0 support
var _hasOwnProperty = ({}).hasOwnProperty, hasOwnProperty;
if ( !is(_hasOwnProperty, undefined) && !is(_hasOwnProperty.call, undefined) ) {
hasOwnProperty = function (object, property) {
return _hasOwnProperty.call(object, property);
};
}
else {
hasOwnProperty = function (object, property) { /* yes, this can give false positives/negatives, but most of the time we don't care about those */
return ((property in object) && is(object.constructor.prototype[property], undefined));
};
}
/**
* setCss applies given styles to the Modernizr DOM node.
*/
function setCss( str ) {
mStyle.cssText = str;
}
/**
* setCssAll extrapolates all vendor-specific css strings.
*/
function setCssAll( str1, str2 ) {
return setCss(prefixes.join(str1 + ';') + ( str2 || '' ));
}
/**
* is returns a boolean for if typeof obj is exactly type.
*/
function is( obj, type ) {
return typeof obj === type;
}
/**
* contains returns a boolean for if substr is found within str.
*/
function contains( str, substr ) {
return !!~('' + str).indexOf(substr);
}
/**
* testProps is a generic CSS / DOM property test; if a browser supports
* a certain property, it won't return undefined for it.
* A supported CSS property returns empty string when its not yet set.
*/
function testProps( props, prefixed ) {
for ( var i in props ) {
if ( mStyle[ props[i] ] !== undefined ) {
return prefixed == 'pfx' ? props[i] : true;
}
}
return false;
}
/**
* testPropsAll tests a list of DOM properties we want to check against.
* We specify literally ALL possible (known and/or likely) properties on
* the element including the non-vendor prefixed one, for forward-
* compatibility.
*/
function testPropsAll( prop, prefixed ) {
var ucProp = prop.charAt(0).toUpperCase() + prop.substr(1),
props = (prop + ' ' + domPrefixes.join(ucProp + ' ') + ucProp).split(' ');
return testProps(props, prefixed);
}
/**
* testBundle tests a list of CSS features that require element and style injection.
* By bundling them together we can reduce the need to touch the DOM multiple times.
*/
/*>>testBundle*/
var testBundle = (function( styles, tests ) {
var style = styles.join(''),
len = tests.length;
injectElementWithStyles(style, function( node, rule ) {
var style = document.styleSheets[document.styleSheets.length - 1],
// IE8 will bork if you create a custom build that excludes both fontface and generatedcontent tests.
// So we check for cssRules and that there is a rule available
// More here: https://github.com/Modernizr/Modernizr/issues/288 & https://github.com/Modernizr/Modernizr/issues/293
cssText = style.cssRules && style.cssRules[0] ? style.cssRules[0].cssText : style.cssText || "",
children = node.childNodes, hash = {};
while ( len-- ) {
hash[children[len].id] = children[len];
}
/*>>touch*/ Modernizr['touch'] = ('ontouchstart' in window) || hash['touch'].offsetTop === 9; /*>>touch*/
/*>>csstransforms3d*/ Modernizr['csstransforms3d'] = hash['csstransforms3d'].offsetLeft === 9; /*>>csstransforms3d*/
/*>>generatedcontent*/Modernizr['generatedcontent'] = hash['generatedcontent'].offsetHeight >= 1; /*>>generatedcontent*/
/*>>fontface*/ Modernizr['fontface'] = /src/i.test(cssText) &&
cssText.indexOf(rule.split(' ')[0]) === 0; /*>>fontface*/
}, len, tests);
})([
// Pass in styles to be injected into document
/*>>fontface*/ '@font-face {font-family:"font";src:url("https://")}' /*>>fontface*/
/*>>touch*/ ,['@media (',prefixes.join('touch-enabled),('),mod,')',
'{#touch{top:9px;position:absolute}}'].join('') /*>>touch*/
/*>>csstransforms3d*/ ,['@media (',prefixes.join('transform-3d),('),mod,')',
'{#csstransforms3d{left:9px;position:absolute}}'].join('')/*>>csstransforms3d*/
/*>>generatedcontent*/,['#generatedcontent:after{content:"',smile,'";visibility:hidden}'].join('') /*>>generatedcontent*/
],
[
/*>>fontface*/ 'fontface' /*>>fontface*/
/*>>touch*/ ,'touch' /*>>touch*/
/*>>csstransforms3d*/ ,'csstransforms3d' /*>>csstransforms3d*/
/*>>generatedcontent*/,'generatedcontent' /*>>generatedcontent*/
]);/*>>testBundle*/
/**
* Tests
* -----
*/
tests['flexbox'] = function() {
/**
* setPrefixedValueCSS sets the property of a specified element
* adding vendor prefixes to the VALUE of the property.
* @param {Element} element
* @param {string} property The property name. This will not be prefixed.
* @param {string} value The value of the property. This WILL be prefixed.
* @param {string=} extra Additional CSS to append unmodified to the end of
* the CSS string.
*/
function setPrefixedValueCSS( element, property, value, extra ) {
property += ':';
element.style.cssText = (property + prefixes.join(value + ';' + property)).slice(0, -property.length) + (extra || '');
}
/**
* setPrefixedPropertyCSS sets the property of a specified element
* adding vendor prefixes to the NAME of the property.
* @param {Element} element
* @param {string} property The property name. This WILL be prefixed.
* @param {string} value The value of the property. This will not be prefixed.
* @param {string=} extra Additional CSS to append unmodified to the end of
* the CSS string.
*/
function setPrefixedPropertyCSS( element, property, value, extra ) {
element.style.cssText = prefixes.join(property + ':' + value + ';') + (extra || '');
}
var c = document.createElement('div'),
elem = document.createElement('div');
setPrefixedValueCSS(c, 'display', 'box', 'width:42px;padding:0;');
setPrefixedPropertyCSS(elem, 'box-flex', '1', 'width:10px;');
c.appendChild(elem);
docElement.appendChild(c);
var ret = elem.offsetWidth === 42;
c.removeChild(elem);
docElement.removeChild(c);
return ret;
};
// On the S60 and BB Storm, getContext exists, but always returns undefined
// http://github.com/Modernizr/Modernizr/issues/issue/97/
tests['canvas'] = function() {
var elem = document.createElement('canvas');
return !!(elem.getContext && elem.getContext('2d'));
};
tests['canvastext'] = function() {
return !!(Modernizr['canvas'] && is(document.createElement('canvas').getContext('2d').fillText, 'function'));
};
// This WebGL test may false positive.
// But really it's quite impossible to know whether webgl will succeed until after you create the context.
// You might have hardware that can support a 100x100 webgl canvas, but will not support a 1000x1000 webgl
// canvas. So this feature inference is weak, but intentionally so.
// It is known to false positive in FF4 with certain hardware and the iPad 2.
tests['webgl'] = function() {
return !!window.WebGLRenderingContext;
};
/*
* The Modernizr.touch test only indicates if the browser supports
* touch events, which does not necessarily reflect a touchscreen
* device, as evidenced by tablets running Windows 7 or, alas,
* the Palm Pre / WebOS (touch) phones.
*
* Additionally, Chrome (desktop) used to lie about its support on this,
* but that has since been rectified: http://crbug.com/36415
*
* We also test for Firefox 4 Multitouch Support.
*
* For more info, see: http://modernizr.github.com/Modernizr/touch.html
*/
tests['touch'] = function() {
return Modernizr['touch'];
};
/**
* geolocation tests for the new Geolocation API specification.
* This test is a standards compliant-only test; for more complete
* testing, including a Google Gears fallback, please see:
* http://code.google.com/p/geo-location-javascript/
* or view a fallback solution using google's geo API:
* http://gist.github.com/366184
*/
tests['geolocation'] = function() {
return !!navigator.geolocation;
};
// Per 1.6:
// This used to be Modernizr.crosswindowmessaging but the longer
// name has been deprecated in favor of a shorter and property-matching one.
// The old API is still available in 1.6, but as of 2.0 will throw a warning,
// and in the first release thereafter disappear entirely.
tests['postmessage'] = function() {
return !!window.postMessage;
};
// Web SQL database detection is tricky:
// In chrome incognito mode, openDatabase is truthy, but using it will
// throw an exception: http://crbug.com/42380
// We can create a dummy database, but there is no way to delete it afterwards.
// Meanwhile, Safari users can get prompted on any database creation.
// If they do, any page with Modernizr will give them a prompt:
// http://github.com/Modernizr/Modernizr/issues/closed#issue/113
// We have chosen to allow the Chrome incognito false positive, so that Modernizr
// doesn't litter the web with these test databases. As a developer, you'll have
// to account for this gotcha yourself.
tests['websqldatabase'] = function() {
var result = !!window.openDatabase;
/* if (result){
try {
result = !!openDatabase( mod + "testdb", "1.0", mod + "testdb", 2e4);
} catch(e) {
}
} */
return result;
};
// Vendors had inconsistent prefixing with the experimental Indexed DB:
// - Webkit's implementation is accessible through webkitIndexedDB
// - Firefox shipped moz_indexedDB before FF4b9, but since then has been mozIndexedDB
// For speed, we don't test the legacy (and beta-only) indexedDB
tests['indexedDB'] = function() {
for ( var i = -1, len = domPrefixes.length; ++i < len; ){
if ( window[domPrefixes[i].toLowerCase() + 'IndexedDB'] ){
return true;
}
}
return !!window.indexedDB;
};
// documentMode logic from YUI to filter out IE8 Compat Mode
// which false positives.
tests['hashchange'] = function() {
return isEventSupported('hashchange', window) && (document.documentMode === undefined || document.documentMode > 7);
};
// Per 1.6:
// This used to be Modernizr.historymanagement but the longer
// name has been deprecated in favor of a shorter and property-matching one.
// The old API is still available in 1.6, but as of 2.0 will throw a warning,
// and in the first release thereafter disappear entirely.
tests['history'] = function() {
return !!(window.history && history.pushState);
};
tests['draganddrop'] = function() {
return isEventSupported('dragstart') && isEventSupported('drop');
};
// Mozilla is targeting to land MozWebSocket for FF6
// bugzil.la/659324
tests['websockets'] = function() {
for ( var i = -1, len = domPrefixes.length; ++i < len; ){
if ( window[domPrefixes[i] + 'WebSocket'] ){
return true;
}
}
return 'WebSocket' in window;
};
// http://css-tricks.com/rgba-browser-support/
tests['rgba'] = function() {
// Set an rgba() color and check the returned value
setCss('background-color:rgba(150,255,150,.5)');
return contains(mStyle.backgroundColor, 'rgba');
};
tests['hsla'] = function() {
// Same as rgba(), in fact, browsers re-map hsla() to rgba() internally,
// except IE9 who retains it as hsla
setCss('background-color:hsla(120,40%,100%,.5)');
return contains(mStyle.backgroundColor, 'rgba') || contains(mStyle.backgroundColor, 'hsla');
};
tests['multiplebgs'] = function() {
// Setting multiple images AND a color on the background shorthand property
// and then querying the style.background property value for the number of
// occurrences of "url(" is a reliable method for detecting ACTUAL support for this!
setCss('background:url(https://),url(https://),red url(https://)');
// If the UA supports multiple backgrounds, there should be three occurrences
// of the string "url(" in the return value for elemStyle.background
return /(url\s*\(.*?){3}/.test(mStyle.background);
};
// In testing support for a given CSS property, it's legit to test:
// `elem.style[styleName] !== undefined`
// If the property is supported it will return an empty string,
// if unsupported it will return undefined.
// We'll take advantage of this quick test and skip setting a style
// on our modernizr element, but instead just testing undefined vs
// empty string.
tests['backgroundsize'] = function() {
return testPropsAll('backgroundSize');
};
tests['borderimage'] = function() {
return testPropsAll('borderImage');
};
// Super comprehensive table about all the unique implementations of
// border-radius: http://muddledramblings.com/table-of-css3-border-radius-compliance
tests['borderradius'] = function() {
return testPropsAll('borderRadius');
};
// WebOS unfortunately false positives on this test.
tests['boxshadow'] = function() {
return testPropsAll('boxShadow');
};
// FF3.0 will false positive on this test
tests['textshadow'] = function() {
return document.createElement('div').style.textShadow === '';
};
tests['opacity'] = function() {
// Browsers that actually have CSS Opacity implemented have done so
// according to spec, which means their return values are within the
// range of [0.0,1.0] - including the leading zero.
setCssAll('opacity:.55');
// The non-literal . in this regex is intentional:
// German Chrome returns this value as 0,55
// https://github.com/Modernizr/Modernizr/issues/#issue/59/comment/516632
return /^0.55$/.test(mStyle.opacity);
};
tests['cssanimations'] = function() {
return testPropsAll('animationName');
};
tests['csscolumns'] = function() {
return testPropsAll('columnCount');
};
tests['cssgradients'] = function() {
/**
* For CSS Gradients syntax, please see:
* http://webkit.org/blog/175/introducing-css-gradients/
* https://developer.mozilla.org/en/CSS/-moz-linear-gradient
* https://developer.mozilla.org/en/CSS/-moz-radial-gradient
* http://dev.w3.org/csswg/css3-images/#gradients-
*/
var str1 = 'background-image:',
str2 = 'gradient(linear,left top,right bottom,from(#9f9),to(white));',
str3 = 'linear-gradient(left top,#9f9, white);';
setCss(
(str1 + prefixes.join(str2 + str1) + prefixes.join(str3 + str1)).slice(0, -str1.length)
);
return contains(mStyle.backgroundImage, 'gradient');
};
tests['cssreflections'] = function() {
return testPropsAll('boxReflect');
};
tests['csstransforms'] = function() {
return !!testProps(['transformProperty', 'WebkitTransform', 'MozTransform', 'OTransform', 'msTransform']);
};
tests['csstransforms3d'] = function() {
var ret = !!testProps(['perspectiveProperty', 'WebkitPerspective', 'MozPerspective', 'OPerspective', 'msPerspective']);
// Webkit’s 3D transforms are passed off to the browser's own graphics renderer.
// It works fine in Safari on Leopard and Snow Leopard, but not in Chrome in
// some conditions. As a result, Webkit typically recognizes the syntax but
// will sometimes throw a false positive, thus we must do a more thorough check:
if ( ret && 'webkitPerspective' in docElement.style ) {
// Webkit allows this media query to succeed only if the feature is enabled.
// `@media (transform-3d),(-o-transform-3d),(-moz-transform-3d),(-ms-transform-3d),(-webkit-transform-3d),(modernizr){ ... }`
ret = Modernizr['csstransforms3d'];
}
return ret;
};
tests['csstransitions'] = function() {
return testPropsAll('transitionProperty');
};
/*>>fontface*/
// @font-face detection routine by Diego Perini
// http://javascript.nwbox.com/CSSSupport/
tests['fontface'] = function() {
return Modernizr['fontface'];
};
/*>>fontface*/
// CSS generated content detection
tests['generatedcontent'] = function() {
return Modernizr['generatedcontent'];
};
// These tests evaluate support of the video/audio elements, as well as
// testing what types of content they support.
//
// We're using the Boolean constructor here, so that we can extend the value
// e.g. Modernizr.video // true
// Modernizr.video.ogg // 'probably'
//
// Codec values from : http://github.com/NielsLeenheer/html5test/blob/9106a8/index.html#L845
// thx to NielsLeenheer and zcorpan
// Note: in FF 3.5.1 and 3.5.0, "no" was a return value instead of empty string.
// Modernizr does not normalize for that.
tests['video'] = function() {
var elem = document.createElement('video'),
bool = false;
// IE9 Running on Windows Server SKU can cause an exception to be thrown, bug #224
try {
if ( bool = !!elem.canPlayType ) {
bool = new Boolean(bool);
bool.ogg = elem.canPlayType('video/ogg; codecs="theora"');
// Workaround required for IE9, which doesn't report video support without audio codec specified.
// bug 599718 @ msft connect
var h264 = 'video/mp4; codecs="avc1.42E01E';
bool.h264 = elem.canPlayType(h264 + '"') || elem.canPlayType(h264 + ', mp4a.40.2"');
bool.webm = elem.canPlayType('video/webm; codecs="vp8, vorbis"');
}
} catch(e) { }
return bool;
};
tests['audio'] = function() {
var elem = document.createElement('audio'),
bool = false;
try {
if ( bool = !!elem.canPlayType ) {
bool = new Boolean(bool);
bool.ogg = elem.canPlayType('audio/ogg; codecs="vorbis"');
bool.mp3 = elem.canPlayType('audio/mpeg;');
// Mimetypes accepted:
// https://developer.mozilla.org/En/Media_formats_supported_by_the_audio_and_video_elements
// http://bit.ly/iphoneoscodecs
bool.wav = elem.canPlayType('audio/wav; codecs="1"');
bool.m4a = elem.canPlayType('audio/x-m4a;') || elem.canPlayType('audio/aac;');
}
} catch(e) { }
return bool;
};
// Firefox has made these tests rather unfun.
// In FF4, if disabled, window.localStorage should === null.
// Normally, we could not test that directly and need to do a
// `('localStorage' in window) && ` test first because otherwise Firefox will
// throw http://bugzil.la/365772 if cookies are disabled
// However, in Firefox 4 betas, if dom.storage.enabled == false, just mentioning
// the property will throw an exception. http://bugzil.la/599479
// This looks to be fixed for FF4 Final.
// Because we are forced to try/catch this, we'll go aggressive.
// FWIW: IE8 Compat mode supports these features completely:
// http://www.quirksmode.org/dom/html5.html
// But IE8 doesn't support either with local files
tests['localstorage'] = function() {
try {
return !!localStorage.getItem;
} catch(e) {
return false;
}
};
tests['sessionstorage'] = function() {
try {
return !!sessionStorage.getItem;
} catch(e){
return false;
}
};
tests['webworkers'] = function() {
return !!window.Worker;
};
tests['applicationcache'] = function() {
return !!window.applicationCache;
};
// Thanks to Erik Dahlstrom
tests['svg'] = function() {
return !!document.createElementNS && !!document.createElementNS(ns.svg, 'svg').createSVGRect;
};
// specifically for SVG inline in HTML, not within XHTML
// test page: paulirish.com/demo/inline-svg
tests['inlinesvg'] = function() {
var div = document.createElement('div');
div.innerHTML = '<svg/>';
return (div.firstChild && div.firstChild.namespaceURI) == ns.svg;
};
// Thanks to F1lt3r and lucideer, ticket #35
tests['smil'] = function() {
return !!document.createElementNS && /SVG/.test(toString.call(document.createElementNS(ns.svg, 'animate')));
};
tests['svgclippaths'] = function() {
// Possibly returns a false positive in Safari 3.2?
return !!document.createElementNS && /SVG/.test(toString.call(document.createElementNS(ns.svg, 'clipPath')));
};
// input features and input types go directly onto the ret object, bypassing the tests loop.
// Hold this guy to execute in a moment.
function webforms() {
// Run through HTML5's new input attributes to see if the UA understands any.
// We're using f which is the <input> element created early on
// Mike Taylr has created a comprehensive resource for testing these attributes
// when applied to all input types:
// http://miketaylr.com/code/input-type-attr.html
// spec: http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary
// Only input placeholder is tested while textarea's placeholder is not.
// Currently Safari 4 and Opera 11 have support only for the input placeholder
// Both tests are available in feature-detects/forms-placeholder.js
Modernizr['input'] = (function( props ) {
for ( var i = 0, len = props.length; i < len; i++ ) {
attrs[ props[i] ] = !!(props[i] in inputElem);
}
return attrs;
})('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' '));
// Run through HTML5's new input types to see if the UA understands any.
// This is put behind the tests runloop because it doesn't return a
// true/false like all the other tests; instead, it returns an object
// containing each input type with its corresponding true/false value
// Big thanks to @miketaylr for the html5 forms expertise. http://miketaylr.com/
Modernizr['inputtypes'] = (function(props) {
for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) {
inputElem.setAttribute('type', inputElemType = props[i]);
bool = inputElem.type !== 'text';
// We first check to see if the type we give it sticks..
// If the type does, we feed it a textual value, which shouldn't be valid.
// If the value doesn't stick, we know there's input sanitization which infers a custom UI
if ( bool ) {
inputElem.value = smile;
inputElem.style.cssText = 'position:absolute;visibility:hidden;';
if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) {
docElement.appendChild(inputElem);
defaultView = document.defaultView;
// Safari 2-4 allows the smiley as a value, despite making a slider
bool = defaultView.getComputedStyle &&
defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' &&
// Mobile android web browser has false positive, so must
// check the height to see if the widget is actually there.
(inputElem.offsetHeight !== 0);
docElement.removeChild(inputElem);
} else if ( /^(search|tel)$/.test(inputElemType) ){
// Spec doesnt define any special parsing or detectable UI
// behaviors so we pass these through as true
// Interestingly, opera fails the earlier test, so it doesn't
// even make it here.
} else if ( /^(url|email)$/.test(inputElemType) ) {
// Real url and email support comes with prebaked validation.
bool = inputElem.checkValidity && inputElem.checkValidity() === false;
} else if ( /^color$/.test(inputElemType) ) {
// chuck into DOM and force reflow for Opera bug in 11.00
// github.com/Modernizr/Modernizr/issues#issue/159
docElement.appendChild(inputElem);
docElement.offsetWidth;
bool = inputElem.value != smile;
docElement.removeChild(inputElem);
} else {
// If the upgraded input compontent rejects the :) text, we got a winner
bool = inputElem.value != smile;
}
}
inputs[ props[i] ] = !!bool;
}
return inputs;
})('search tel url email datetime date month week time datetime-local number range color'.split(' '));
}
// End of test definitions
// -----------------------
// Run through all tests and detect their support in the current UA.
// todo: hypothetically we could be doing an array of tests and use a basic loop here.
for ( var feature in tests ) {
if ( hasOwnProperty(tests, feature) ) {
// run the test, throw the return value into the Modernizr,
// then based on that boolean, define an appropriate className
// and push it into an array of classes we'll join later.
featureName = feature.toLowerCase();
Modernizr[featureName] = tests[feature]();
classes.push((Modernizr[featureName] ? '' : 'no-') + featureName);
}
}
// input tests need to run.
Modernizr.input || webforms();
/**
* addTest allows the user to define their own feature tests
* the result will be added onto the Modernizr object,
* as well as an appropriate className set on the html element
*
* @param feature - String naming the feature
* @param test - Function returning true if feature is supported, false if not
*/
Modernizr.addTest = function ( feature, test ) {
if ( typeof feature == "object" ) {
for ( var key in feature ) {
if ( hasOwnProperty( feature, key ) ) {
Modernizr.addTest( key, feature[ key ] );
}
}
} else {
feature = feature.toLowerCase();
if ( Modernizr[feature] !== undefined ) {
// we're going to quit if you're trying to overwrite an existing test
// if we were to allow it, we'd do this:
// var re = new RegExp("\\b(no-)?" + feature + "\\b");
// docElement.className = docElement.className.replace( re, '' );
// but, no rly, stuff 'em.
return;
}
test = typeof test == "boolean" ? test : !!test();
docElement.className += ' ' + (test ? '' : 'no-') + feature;
Modernizr[feature] = test;
}
return Modernizr; // allow chaining.
};
// Reset modElem.cssText to nothing to reduce memory footprint.
setCss('');
modElem = inputElem = null;
//>>BEGIN IEPP
// Enable HTML 5 elements for styling (and printing) in IE.
if ( window.attachEvent && (function(){ var elem = document.createElement('div');
elem.innerHTML = '<elem></elem>';
return elem.childNodes.length !== 1; })() ) {
// iepp v2 by @jon_neal & afarkas : github.com/aFarkas/iepp/
(function(win, doc) {
win.iepp = win.iepp || {};
var iepp = win.iepp,
elems = iepp.html5elements || 'abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video',
elemsArr = elems.split('|'),
elemsArrLen = elemsArr.length,
elemRegExp = new RegExp('(^|\\s)('+elems+')', 'gi'),
tagRegExp = new RegExp('<(\/*)('+elems+')', 'gi'),
filterReg = /^\s*[\{\}]\s*$/,
ruleRegExp = new RegExp('(^|[^\\n]*?\\s)('+elems+')([^\\n]*)({[\\n\\w\\W]*?})', 'gi'),
docFrag = doc.createDocumentFragment(),
html = doc.documentElement,
head = html.firstChild,
bodyElem = doc.createElement('body'),
styleElem = doc.createElement('style'),
printMedias = /print|all/,
body;
function shim(doc) {
var a = -1;
while (++a < elemsArrLen)
// Use createElement so IE allows HTML5-named elements in a document
doc.createElement(elemsArr[a]);
}
iepp.getCSS = function(styleSheetList, mediaType) {
if(styleSheetList+'' === undefined){return '';}
var a = -1,
len = styleSheetList.length,
styleSheet,
cssTextArr = [];
while (++a < len) {
styleSheet = styleSheetList[a];
//currently no test for disabled/alternate stylesheets
if(styleSheet.disabled){continue;}
mediaType = styleSheet.media || mediaType;
// Get css from all non-screen stylesheets and their imports
if (printMedias.test(mediaType)) cssTextArr.push(iepp.getCSS(styleSheet.imports, mediaType), styleSheet.cssText);
//reset mediaType to all with every new *not imported* stylesheet
mediaType = 'all';
}
return cssTextArr.join('');
};
iepp.parseCSS = function(cssText) {
var cssTextArr = [],
rule;
while ((rule = ruleRegExp.exec(cssText)) != null){
// Replace all html5 element references with iepp substitute classnames
cssTextArr.push(( (filterReg.exec(rule[1]) ? '\n' : rule[1]) +rule[2]+rule[3]).replace(elemRegExp, '$1.iepp_$2')+rule[4]);
}
return cssTextArr.join('\n');
};
iepp.writeHTML = function() {
var a = -1;
body = body || doc.body;
while (++a < elemsArrLen) {
var nodeList = doc.getElementsByTagName(elemsArr[a]),
nodeListLen = nodeList.length,
b = -1;
while (++b < nodeListLen)
if (nodeList[b].className.indexOf('iepp_') < 0)
// Append iepp substitute classnames to all html5 elements
nodeList[b].className += ' iepp_'+elemsArr[a];
}
docFrag.appendChild(body);
html.appendChild(bodyElem);
// Write iepp substitute print-safe document
bodyElem.className = body.className;
bodyElem.id = body.id;
// Replace HTML5 elements with <font> which is print-safe and shouldn't conflict since it isn't part of html5
bodyElem.innerHTML = body.innerHTML.replace(tagRegExp, '<$1font');
};
iepp._beforePrint = function() {
// Write iepp custom print CSS
styleElem.styleSheet.cssText = iepp.parseCSS(iepp.getCSS(doc.styleSheets, 'all'));
iepp.writeHTML();
};
iepp.restoreHTML = function(){
// Undo everything done in onbeforeprint
bodyElem.innerHTML = '';
html.removeChild(bodyElem);
html.appendChild(body);
};
iepp._afterPrint = function(){
// Undo everything done in onbeforeprint
iepp.restoreHTML();
styleElem.styleSheet.cssText = '';
};
// Shim the document and iepp fragment
shim(doc);
shim(docFrag);
//
if(iepp.disablePP){return;}
// Add iepp custom print style element
head.insertBefore(styleElem, head.firstChild);
styleElem.media = 'print';
styleElem.className = 'iepp-printshim';
win.attachEvent(
'onbeforeprint',
iepp._beforePrint
);
win.attachEvent(
'onafterprint',
iepp._afterPrint
);
})(window, document);
}
//>>END IEPP
// Assign private properties to the return object with prefix
Modernizr._version = version;
// expose these for the plugin API. Look in the source for how to join() them against your input
Modernizr._prefixes = prefixes;
Modernizr._domPrefixes = domPrefixes;
// Modernizr.mq tests a given media query, live against the current state of the window
// A few important notes:
// * If a browser does not support media queries at all (eg. oldIE) the mq() will always return false
// * A max-width or orientation query will be evaluated against the current state, which may change later.
// * You must specify values. Eg. If you are testing support for the min-width media query use:
// Modernizr.mq('(min-width:0)')
// usage:
// Modernizr.mq('only screen and (max-width:768)')
Modernizr.mq = testMediaQuery;
// Modernizr.hasEvent() detects support for a given event, with an optional element to test on
// Modernizr.hasEvent('gesturestart', elem)
Modernizr.hasEvent = isEventSupported;
// Modernizr.testProp() investigates whether a given style property is recognized
// Note that the property names must be provided in the camelCase variant.
// Modernizr.testProp('pointerEvents')
Modernizr.testProp = function(prop){
return testProps([prop]);
};
// Modernizr.testAllProps() investigates whether a given style property,
// or any of its vendor-prefixed variants, is recognized
// Note that the property names must be provided in the camelCase variant.
// Modernizr.testAllProps('boxSizing')
Modernizr.testAllProps = testPropsAll;
// Modernizr.testStyles() allows you to add custom styles to the document and test an element afterwards
// Modernizr.testStyles('#modernizr { position:absolute }', function(elem, rule){ ... })
Modernizr.testStyles = injectElementWithStyles;
// Modernizr.prefixed() returns the prefixed or nonprefixed property name variant of your input
// Modernizr.prefixed('boxSizing') // 'MozBoxSizing'
// Properties must be passed as dom-style camelcase, rather than `box-sizing` hypentated style.
// Return values will also be the camelCase variant, if you need to translate that to hypenated style use:
//
// str.replace(/([A-Z])/g, function(str,m1){ return '-' + m1.toLowerCase(); }).replace(/^ms-/,'-ms-');
// If you're trying to ascertain which transition end event to bind to, you might do something like...
//
// var transEndEventNames = {
// 'WebkitTransition' : 'webkitTransitionEnd',
// 'MozTransition' : 'transitionend',
// 'OTransition' : 'oTransitionEnd',
// 'msTransition' : 'msTransitionEnd', // maybe?
// 'transition' : 'transitionEnd'
// },
// transEndEventName = transEndEventNames[ Modernizr.prefixed('transition') ];
Modernizr.prefixed = function(prop){
return testPropsAll(prop, 'pfx');
};
// Remove "no-js" class from <html> element, if it exists:
docElement.className = docElement.className.replace(/\bno-js\b/, '')
// Add the new classes to the <html> element.
+ (enableClasses ? ' js ' + classes.join(' ') : '');
return Modernizr;
})(this, this.document);
/**
* Array prototype extensions.
* Extends array prototype with the following methods:
* contains, every, exfiltrate, filter, forEach, getRange, inArray, indexOf, insertAt, map, randomize, removeAt, some, unique
*
* This extensions doesn't depend on any other code or overwrite existing methods.
*
*
* Copyright (c) 2007 Harald Hanek (http://js-methods.googlecode.com)
*
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
* and GPL (http://www.gnu.org/licenses/gpl.html) licenses.
*
* @author Harald Hanek
* @version 0.9
* @lastchangeddate 10. October 2007 15:46:06
* @revision 876
*/
(function(){
/**
* Extend the array prototype with the method under the given name if it doesn't currently exist.
*
* @private
*/
function append(name, method)
{
if(!Array.prototype[name])
Array.prototype[name] = method;
};
/**
* Returns true if every element in 'elements' is in the array.
*
* @example [1, 2, 1, 4, 5, 4].contains([1, 2, 4]);
* @result true
*
* @name contains
* @param Array elements
* @return Boolean
*/
append("contains", function(elements){
return this.every(function(element){
return this.indexOf(element) >= 0; }, elements);
});
/**
* Returns the array without the elements in 'elements'.
*
* @example [1, 2, 1, 4, 5, 4].contains([1, 2, 4]);
* @result true
*
* @name exfiltrate
* @param Array elements
* @return Boolean
*/
append("exfiltrate", function(elements){
return this.filter(function(element){
return this.indexOf(element) < 0; }, elements);
});
/**
* Tests whether all elements in the array pass the test implemented by the provided function.
*
* @example [22, 72, 16, 99, 254].every(function(element, index, array) {
* return element >= 15;
* });
* @result true;
*
* @example [12, 72, 16, 99, 254].every(function(element, index, array) {
* return element >= 15;
* });
* @result false;
*
* @name every
* @param Function fn The function to be called for each element.
* @param Object scope (optional) The scope of the function (defaults to this).
* @return Boolean
*/
append("every", function(fn, scope){
for(var i = 0; i < this.length; i++)
if(!fn.call(scope || window, this[i], i, this))
return false;
return true;
});
/**
* Creates a new array with all elements that pass the test implemented by the provided function.
*
* Natively supported in Gecko since version 1.8.
* http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Objects:Array:filter
*
* @example [12, 5, 8, 1, 44].filter(function(element, index, array) {
* return element >= 10;
* });
* @result [12, 44];
*
* @name filter
* @param Function fn The function to be called for each element.
* @param Object scope (optional) The scope of the function (defaults to this).
* @return Array
*/
append("filter", function(fn, scope){
var r = [];
for(var i = 0; i < this.length; i++)
if(fn.call(scope || window, this[i], i, this))
r.push(this[i]);
return r;
});
/**
* Executes a provided function once per array element.
*
* Natively supported in Gecko since version 1.8.
* http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Objects:Array:forEach
*
* @example var stuff = "";
* ["Java", "Script"].forEach(function(element, index, array) {
* stuff += element;
* });
* @result "JavaScript";
*
* @name forEach
* @param Function fn The function to be called for each element.
* @param Object scope (optional) The scope of the function (defaults to this).
* @return void
*/
append("forEach", function(fn, scope){
for(var i = 0; i < this.length; i++)
fn.call(scope || window, this[i], i, this);
});
/**
* Returns a range of items in this collection
*
* @example [1, 2, 1, 4, 5, 4].getRange(2, 4);
* @result [1, 4, 5]
*
* @name getRange
* @param Number startIndex (optional) defaults to 0
* @param Number endIndex (optional) default to the last item
* @return Array
*/
append("getRange", function(start, end){
var items = this;
if(items.length < 1)
return [];
start = start || 0;
end = Math.min(typeof end == "undefined" ? this.length-1 : end, this.length-1);
var r = [];
if(start <= end)
for(var i = start; i <= end; i++)
r[r.length] = items[i];
else
for(var i = start; i >= end; i--)
r[r.length] = items[i];
return r;
});
/**
* Returns the first index at which a given element can be found in the array, or -1 if it is not present.
*
* @example [12, 5, 8, 5, 44].indexOf(5);
* @result 1;
*
* @example [12, 5, 8, 5, 44].indexOf(5, 2);
* @result 3;
*
* @name indexOf
* @param Object subject Object to search for
* @param Number offset (optional) Index at which to start searching
* @return Int
*/
append("indexOf", function(subject, offset){
for(var i = offset || 0; i < this.length; i++)
if(this[i] === subject)
return i;
return -1;
});
/**
* Checks if a given subject can be found in the array.
*
* @example [12, 5, 7, 5].inArray(7);
* @result true;
*
* @example [12, 5, 7, 5].inArray(9);
* @result false;
*
* @name inArray
* @param Object subject Object to search for
* @return Boolean
*/
append("inArray", function(subject){
for(var i = 0; i < this.length; i++)
if(subject == this[i])
return true;
return false;
});
/**
* Inserts an item at the specified index in the array.
*
* @example ['dog', 'cat', 'horse'].insertAt(2, 'mouse');
* @result ['dog', 'cat', 'mouse', 'horse']
*
* @name insertAt
* @param Number index Position where to insert the element into the array
* @param Object element The element to insert
* @return Array
*/
append("insertAt", function(index, element){
for(var k = this.length; k > index; k--)
this[k] = this[k-1];
this[index] = element;
return this;
});
/**
* Creates a new array with the results of calling a provided function on every element in this array.
*
* Natively supported in Gecko since version 1.8.
* http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Objects:Array:map
*
* @example ["my", "Name", "is", "HARRY"].map(function(element, index, array) {
* return element.toUpperCase();
* });
* @result ["MY", "NAME", "IS", "HARRY"];
*
* @example [1, 4, 9].map(Math.sqrt);
* @result [1, 2, 3];
*
* @name map
* @param Function fn The function to be called for each element.
* @param Object scope (optional) The scope of the function (defaults to this).
* @return Array
*/
append("map", function(fn, scope){
scope = scope || window;
var r = [];
for(var i = 0; i < this.length; i++)
r[r.length] = fn.call(scope, this[i], i, this);
return r;
});
/**
* Remove an item from a specified index in the array.
*
* @example ['dog', 'cat', 'mouse', 'horse'].deleteAt(2);
* @result ['dog', 'cat', 'horse']
*
* @name removeAt
* @param Number index The index within the array of the item to remove.
* @return Array
*/
append("removeAt", function(index){
for(var k = index; k < this.length-1; k++)
this[k] = this[k+1];
this.length--;
return this;
});
/**
* Randomize the order of the elements in the Array.
*
* @example [2, 3, 4, 5].randomize();
* @result [5, 2, 3, 4] randomized result
*
* @name randomize
* @return Array
*/
append("randomize", function(){
return this.sort(function(){return(Math.round(Math.random())-0.5)});
//return this.sort(function(){return(Math.round(Math.random())-0.5)}, true);
});
/**
* Tests whether some element in the array passes the test implemented by the provided function.
*
* Natively supported in Gecko since version 1.8.
* http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Objects:Array:some
*
* @example [101, 199, 250, 200].some(function(element, index, array) {
* return element >= 100;
* });
* @result true;
*
* @example [101, 99, 250, 200].some(function(element, index, array) {
* return element >= 100;
* });
* @result false;
*
* @name some
* @param Function fn The function to be called for each element.
* @param Object scope (optional) The scope of the function (defaults to this).
* @return Boolean
*/
append("some", function(fn, scope){
for(var i = 0; i < this.length; i++)
if(fn.call(scope || window, this[i], i, this))
return true;
return false;
});
/**
* Returns a new array that contains all unique elements of this array.
*
* @example [1, 2, 1, 4, 5, 4].unique();
* @result [1, 2, 4, 5]
*
* @name unique
* @return Array
*/
append("unique", function(){
return this.filter(function(element, index, array){
return array.indexOf(element) >= index;
});
});
})();
/*
Copyright 2011 The greplin-exception-catcher Authors.
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.
====
This Javascript file lets web applications get stacktraces for all uncaught JS exceptions and send them to Greplin
Exception Catcher.
Features include:
- Stacktraces in IE 6-8, as well as modern versions of Firefox, Chrome, and Opera
- Javascript execution entry point information (such as event type and listener) on IE 6-9 and modern versions of
Firefox, Chrome, Safari, and Opera
- Redaction of URLs and strings in stacktraces to avoid logging sensitive user information
Things that aren't done yet:
- Aggregation. Due to the way GEC works now, this would be impossible to do without losing potentially useful
information. To do this, GEC needs to be able to aggregate based upon a normalized stacktrace while still providing detailed information for each specific incident of the exception.
- Can't wrap DOM0 events (<div onclick> for example).
- Some code cleanup: Since this is a small, self-contained project, I took sort of a "hack it until it works" approach
to coding it. I'd like to go back and structure the code better sometime, but I probably wont' get around to it
anytime soon since it works very reliably as it is.
How to use it:
1. Create an endpoint at your server to send this stuff to GEC.
2. Modify the call to g.errorCatcher at the end of the file to pass in functions that pass exceptions to GEC and that
redact URLs respectively. (Note: your URL redaction function will be passed strings that may contain URLs, not bare
URLs, so keep that in mind)
3. Wrap your JS files if you want to capture errors during their initial execution:
try {
var your_js_here
}
catch(e) { window.g && g.handleInitialException && g.handleInitialException(e, '(script filename here)') }
If you use Closure Compiler, just do
--output_wrapper="window.COMPILED = true; try { %%output%% } catch(e) { window.g && g.handleInitialException && g.handleInitialException(e, '(script filename here)') }"
4. This exception catching script can't see exceptions that happen before it's loaded, so make sure it's loaded early in
your page before most of your other scripts.
*/
var g = g || {};
/**
* Captures uncaught JS exceptions on the page and passes them to GEC.
* Can capture stacktraces in IE 6-8, Firefox, Chrome, and Opera, and can capture only the top of the stack in IE 9.
* In Safari, only basic event information is captured.
* Uses both window.onerror and wrapped DOM prototype interfaces to capture as much information as possible without
* requiring JS code changes.
*/
g.errorCatcher = function(reportHandler, redactQueryStrings) {
g.errorCatcher.reportHandler_ = reportHandler;
g.errorCatcher.redactQueryStrings_ = redactQueryStrings;
// commented out part is for weird cases where you have two exception catchers.
// i haven't tested that case at all though, so i'm commenting it out for now.
var wrappedProperty = 'WrappedListener'; //+ Math.floor(Math.random() * 10000000).toString(30);
var supportsJsErrorStack;
try {
({})['undefinedMethod']();
} catch(error) {
supportsJsErrorStack = 'stack' in error || 'stacktrace' in error;
}
var supportsWindowOnerror = 'onerror' in window && !/^Opera/.test(navigator.userAgent);
var supportsWindowOnerrorStack = /MSIE /.test(navigator.userAgent);
// Detecting support based on a whitelist sucks, but we don't want to accidentally log personal information, so we
// only allow browsers that we know that we can redact stacktrace strings for.
var supportsDOMWrapping =
// Chrome
/Chrom(e|ium)/.test(navigator.userAgent) ||
// IE 9+
/MSIE (9\.|[1-9][0-9]+\.)/.test(navigator.userAgent) || // XXX compat mode?
// Firefox 6+
/Gecko\/[0-9]/.test(navigator.userAgent) && (parseInt(navigator['buildID'], 10) >= 20110830092941) ||
// Safari 5.1+ (AppleWebKit/534+)
/AppleWebKit\/(53[4-9]|5[4-9][0-9]|[6-9][0-9]{2}|[1-9][0-9]{3})/.test(navigator.userAgent) ||
// Opera 11.50+
/^Opera.*Presto\/(2\.9|[3-9]|[1-9][0-9])/.test(navigator.userAgent);
if (supportsDOMWrapping) {
wrapTimeouts();
wrapDOMEvents();
wrapXMLHttpRequest();
}
if (supportsWindowOnerror &&
(!supportsDOMWrapping || (!supportsJsErrorStack && supportsWindowOnerrorStack))) {
window.onerror = function(errorMessage, url, lineNumber) {
// Grab the error provided by DOM wrappings, if it's available
var errorObject = g.errorCatcher.lastDomWrapperError_ || {};
delete g.errorCatcher.lastDomWrapperError_;
errorObject.message = errorObject.message || errorMessage;
errorObject.url = errorObject.url || url;
errorObject.line = errorObject.line || lineNumber;
// In IE, get the character offset inside the line of the error from window.event.
if (window.event && typeof window.event['errorCharacter'] == 'number') {
errorObject.character = (errorObject.character || window.event['errorCharacter']) + '';
}
// If there isn't already a stacktrace generated by the DOM wrappers, try to generate one using the old-fashioned
// caller method. This only works in IE 6-8. It partially works in IE 9 -- but it only lets you get the top of the
// stack.
if (!errorObject.stacktrace && supportsWindowOnerrorStack) {
try {
errorObject.stacktrace = g.errorCatcher.getStacktrace(arguments.callee.caller);
} catch(exception) {
errorObject.stacktrace = '[error generating stacktrace: ' + exception.message + ']';
}
}
g.errorCatcher.reportException(errorObject);
};
}
/**
* Wraps setTimeout and setInterval to handle uncaught exceptions in listeners.
*/
function wrapTimeouts() {
wrapTimeoutsHelper('setTimeout');
wrapTimeoutsHelper('setInterval');
function wrapTimeoutsHelper(timeoutMethodName) {
var original = window[timeoutMethodName];
window[timeoutMethodName] = function(listener, delay) {
if (typeof listener == 'function') {
var newArgs = Array.prototype.slice.call(arguments);
newArgs[0] = function() {
try {
listener.apply(this, arguments);
} catch(exception) {
g.errorCatcher.handleCatchException(
exception, timeoutMethodName + '(' + g.errorCatcher.stringify(listener) + ', ' + delay + ')');
}
};
return original.apply(this, newArgs);
} else {
// If someone passes a string to setTimeout, don't bother wrapping it.
return original.apply(this, arguments);
}
}
}
}
/**
* Wraps DOM event interfaces (addEventListener and removeEventListener) to add try/catch wrappers to all event
* listeners.
*/
function wrapDOMEvents() {
var eventsWrappedProperty = 'events' + wrappedProperty;
wrapDOMEventsHelper(window.XMLHttpRequest.prototype);
wrapDOMEventsHelper(window.Element.prototype);
wrapDOMEventsHelper(window);
wrapDOMEventsHelper(window.document);
// Workaround for Firefox bug https://bugzilla.mozilla.org/show_bug.cgi?id=456151
if (document.documentElement.addEventListener != window.Element.prototype.addEventListener) {
var elementNames =
('Unknown,Anchor,Applet,Area,BR,Base,Body,Button,DList,Directory,Div,Embed,FieldSet,Font,Form,Frame,' +
'FrameSet,HR,Head,Heading,Html,IFrame,Image,Input,IsIndex,LI,Label,Legend,Link,Map,Menu,Meta,Span,OList,' +
'Object,OptGroup,Option,Paragraph,Param,Pre,Quote,Script,Select,Style,TableCaption,TableCell,TableCol,' +
'Table,TableRow,TableSection,TextArea,Title,UList,Canvas').split(',');
elementNames.forEach(function(elementName) {
var constructor = window['HTML' + elementName + 'Element'];
if (constructor && constructor.prototype) {
wrapDOMEventsHelper(constructor.prototype);
}
});
}
function wrapDOMEventsHelper(object) {
var originalAddEventListener = object.addEventListener;
var originalRemoveEventListener = object.removeEventListener;
if (!originalAddEventListener || !originalRemoveEventListener) {
return;
}
object.addEventListener = function(eventType, listener, useCapture) {
// Dedupe the listener in case it is already listening unwrapped.
originalRemoveEventListener.apply(this, arguments);
if (typeof listener != 'function') {
// TODO(david): Handle a listener that is not a function, but instead an object that implements the
// EventListener interface (see http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-EventListener ).
originalAddEventListener.apply(this, arguments);
return;
}
listener[eventsWrappedProperty] = listener[eventsWrappedProperty] || {
innerListener: listener,
'handleEvent': g.errorCatcher.listenerWrapper_
};
originalAddEventListener.call(this, eventType, listener[eventsWrappedProperty], useCapture);
};
object.removeEventListener = function(eventType, listener, useCapture) {
// Remove unwrapped listener, just to be sure.
originalRemoveEventListener.apply(this, arguments);
if (typeof listener != 'function') {
return;
}
if (listener[eventsWrappedProperty]) {
originalRemoveEventListener.call(this, eventType, listener[eventsWrappedProperty], useCapture);
}
};
}
}
/**
* Wrap XMLHttpRequest onreadystatechange listeners to handle uncaught JS exceptions.
* This only affects the .onreadystatechange property. The addEventListener property is handled by wrapDOMEvents.
*/
function wrapXMLHttpRequest() {
var xhrWrappedProperty = 'xhr' + wrappedProperty;
var ctor = XMLHttpRequest, instance = new XMLHttpRequest;
if (!/(AppleWebKit|MSIE)/.test(navigator.userAgent) ||
(Object.getOwnPropertyDescriptor(ctor.prototype, 'onreadystatechange') || {}).configurable &&
instance.__lookupSetter__ && instance.__lookupSetter__('onreadystatechange')) {
// The browser has good support for manipulating XMLHttpRequest prototypes.
var onreadystatechangeSetter = instance.__lookupSetter__('onreadystatechange');
ctor.prototype.__defineGetter__('onreadystatechange', function() {
return this[xhrWrappedProperty];
});
ctor.prototype.__defineSetter__('onreadystatechange', function(listener) {
this[xhrWrappedProperty] = listener;
onreadystatechangeSetter.call(this, wrappedReadyStateChange);
});
} else {
// Chrome and Safari have problems with this. Instead, check to see if onreadystatechange needs to be wrapped
// from a readystatechange event listener.
var send = instance.send;
var addEventListener = instance.addEventListener;
XMLHttpRequest.prototype.send = function() {
addEventListener.call(this, 'readystatechange', wrapReadyStateChange, true);
return send.apply(this, arguments);
}
}
function wrappedReadyStateChange() {
try {
var onreadystatechange =
(this.onreadystatechange == arguments.callee ?
this[xhrWrappedProperty] : this.onreadystatechange);
this[xhrWrappedProperty].apply(this, arguments);
} catch(exception) {
// TODO(david): Expose some information about the xmlhttprequest to the exception logging (maybe request url)
g.errorCatcher.handleCatchException(exception, 'onreadystatechange');
}
}
// Used in the wrapped XHR::send handler to wrap onreadystatechange in response to addEventListener
// readystatechange events that fire first.
function wrapReadyStateChange() {
if (this.onreadystatechange && this.onreadystatechange != wrappedReadyStateChange) {
this[xhrWrappedProperty] = this.onreadystatechange;
this.onreadystatechange = wrappedReadyStateChange;
}
}
}
};
/**
* Time that the last error was reported. Used for rate-limiting.
* @type {number}
*/
g.errorCatcher.lastError_ = 0;
/**
* Delay between reporting errors. Increases dynamically.
* @type {number}
*/
g.errorCatcher.errorDelay_ = 10;
/**
* Wrapper for addEventListener/removeEventListener listeners. Global to avoid potential memory/performance impacts of a
* function closure for each event listener. This is a handleEvent property of the EventHandler object passed to
* addEventListener. It accesses other properties of that object to read exception information.
* @param {Event} eventObject The DOM event.
*/
g.errorCatcher.listenerWrapper_ = function(eventObject) {
try {
return this.innerListener.apply(eventObject.target, arguments);
} catch(exception) {
g.errorCatcher.handleCatchException(
exception, eventObject.type + ' listener ' + g.errorCatcher.stringify(this.innerListener) + ' on ' +
g.errorCatcher.stringify(eventObject.currentTarget));
}
};
/**
* Passes an exception to GEC.
* TODO(david): show a message to the user. Let the user elect to send more detailed error information (un-redacted
* strings).
* @param {Object} errorObject An object describing the error.
*/
g.errorCatcher.reportException = function(errorObject) {
var d = (new Date).getTime();
if (d - g.errorCatcher.lastError_ < g.errorCatcher.errorDelay_) {
// Rate limited
return;
}
g.errorCatcher.lastError_ = d;
g.errorCatcher.errorDelay_ = g.errorCatcher.errorDelay_ * 2;
errorObj = {
'msg':g.errorCatcher.redactQueryStrings_(errorObject.message || ''),
'line': errorObject.line + (typeof errorObject.character == 'string' ? ':' + errorObject.character : ''),
'trace':'Type: ' + errorObject.name + '\nUser-agent: ' + navigator.userAgent +
'\nURL: ' + g.errorCatcher.redactQueryStrings_(location.href) + '\n\n' +
g.errorCatcher.redactQueryStrings_(errorObject.stacktrace || ''),
'ts': Math.floor(new Date().getTime() / 1000),
'name':g.errorCatcher.redactQueryStrings_(errorObject.context || '') || 'unidentified JS thread'};
g.errorCatcher.reportHandler_(errorObj);
};
/**
* Handles exceptions from the try { } catch { } block added around all of our compiled JS by our Closure Compiler
* configuration. This handles exceptions that occur during the intiial execution of the script.
* @param {Error} caughtException The caught exception.
* @param {string} fileName The name of the JS file where the exception occured.
*/
g.errorCatcher.handleInitialException = function(caughtException, fileName) {
g.errorCatcher.handleCatchException(caughtException, 'Initial execution of ' + fileName);
};
/**
* Handles a caught exception. When window.onerror is available, the exception is re-thrown so that additional
* information from window.onerror can be added. Otherwise, the exception is passed to reportException, where it is
* sent to GEC and potentially displayed to the user.
* @param {Error} caughtException The caught JS exception.
* @param context
*/
g.errorCatcher.handleCatchException = function(caughtException, context) {
if (!(caughtException instanceof window.Error)) {
caughtException = new Error(caughtException);
}
var errorObject = {};
errorObject.context = context;
errorObject.name = caughtException.name;
// Opera has both stacktrace and stack. Stacktrace is much more detailed, so use that when available.
errorObject.stacktrace = caughtException['stacktrace'] || caughtException['stack'];
if (/Gecko/.test(navigator.userAgent) && !/AppleWebKit/.test(navigator.userAgent)) {
errorObject.stacktrace = g.errorCatcher.redactFirefoxStacktraceStrings(errorObject.stacktrace);
}
errorObject.message = caughtException.message;
errorObject.number = caughtException.number;
var matches;
if ('lineNumber' in caughtException) {
errorObject.line = caughtException['lineNumber'];
} else if ('line' in caughtException) {
errorObject.line = caughtException['line'];
} else if (/Chrom(e|ium)/.test(navigator.userAgent)) {
matches = caughtException.stack.match(/\:(\d+)\:(\d+)\)(\n|$)/);
if (matches) {
errorObject.line = matches[1];
errorObject.character = matches[2];
}
} else if (/Opera/.test(navigator.userAgent)) {
matches = (errorObject['stacktrace'] || '').match(/Error thrown at line (\d+), column (\d+)/);
if (matches) {
errorObject.line = matches[1];
errorObject.character = matches[2];
} else {
matches = (errorObject['stacktrace'] || '').match(/Error thrown at line (\d+)/);
if (matches){
errorObject.line = matches[1];
}
}
}
if (window.onerror) {
// window.onerror is still needed to get stack in IE, so we need to re-throw the error to that.
g.errorCatcher.lastDomWrapperError_ = errorObject;
throw caughtException;
} else {
g.errorCatcher.reportException(errorObject);
}
};
/**
* @param {Function} opt_topFunction The function at the top of the stack; if omitted, the caller of makeStacktrace is
* used.
* @return {string} A string showing the stack of functions and arguments.
*/
g.errorCatcher.getStacktrace = function(opt_topFunction) {
var stacktrace = '';
var func = opt_topFunction || arguments.callee.caller;
var used = [];
var length = 0;
stacktraceLoop: do {
stacktrace += g.errorCatcher.getFunctionName(func) + g.errorCatcher.getFunctionArgumentsString(func) + '\n';
used.push(func);
try {
func = func.caller;
for (var i = 0; i < used.length; i++) {
if (used[i] == func) {
stacktrace += g.errorCatcher.getFunctionName(func) + '(???)\n(...)\n';
break stacktraceLoop;
}
}
} catch(exception) {
stacktrace += '(???' + exception.message + ')\n';
break stacktraceLoop;
}
if (length > 50) {
stacktrace += '(...)\n';
}
} while (func);
return stacktrace;
};
/**
* @param {string} string The string to shorten.
* @param {number} maxLength The maximum length of the new string.
* @return {string} The string, shortened if it exceeds maxLength.
*/
g.errorCatcher.shortenString = function(string, maxLength) {
if (string.length > maxLength) {
string = string.substr(0, maxLength) + '...';
}
return string;
};
/**
* @param {Function} func The function to get the name of.
* @return {string} The name of the function, or a snippet of the function's source code if it is an anonymous function.
*/
g.errorCatcher.getFunctionName = function(func) {
var name;
try {
if ('name' in Function.prototype && func.name) {
name = func.name;
} else {
var funcStr = func.toString();
var matches = /function ([^\(]+)/.exec(funcStr);
name = matches && matches[1] || '[anonymous function: ' + g.errorCatcher.shortenString(func.toString(), 90) + ']';
}
} catch(exception) {
name = '[inaccessible function]'
}
return name;
};
/**
* @param func The function to get a string describing the arguments for. Must be in the current callstack.
* @return {string} A string of the arguments passed to the function.
*/
g.errorCatcher.getFunctionArgumentsString = function(func) {
var argsStrings = [];
try {
var args = func.arguments;
if (args) {
for (var i = 0, length = args.length; i < length; i++) {
argsStrings.push(g.errorCatcher.stringify(args[i]));
}
}
} catch(exception) {
argsStrings.push('...?');
}
return '(' + argsStrings.join(',') + ')';
};
/**
* Converts objects and primitives to strings describing them. String inputs are redacted.
* @param {*} thing The object or primitive to describe.
* @return {string} String describing the input.
*/
g.errorCatcher.stringify = function(thing) {
var string = '[???]';
try {
var type = typeof thing;
string = '[' + type + '?]';
switch (type) {
case 'undefined':
string = 'undefined';
break;
case 'number':
case 'boolean':
string = thing.toString();
break;
case 'object':
if (thing == null) {
string = 'null';
break;
}
if (thing instanceof Date) {
string = 'new Date("' + thing.toString() + '")';
break;
}
var toStringValue = thing.toString();
if (/^\[[a-z ]*\]$/i.test(toStringValue)) {
string = toStringValue;
break;
}
if (typeof thing.length == 'number') {
string = '[arraylike object, length = ' + thing.length + ']';
break;
}
string = '[object]';
break;
case 'string':
string = '"' + g.errorCatcher.redactString(thing) + '"';
break;
case 'function':
string = '/* function */ ' + g.errorCatcher.getFunctionName(thing);
break;
default:
string = '[' + type + '???]';
break;
}
} catch(exception) { }
return string;
};
/**
* Finds quoted strings in a Firefox stacktrace and replaces them with redacted versions. Handles pesky escaped quotes
* too. This relies on Firefox's specific stringification/escaping behavior and might not work as consistently in other
* browsers.
* @param {string} stacktraceStr The stacktrace to redact strings from.
* @return {string} The stacktrace, with strings redacted.
*/
g.errorCatcher.redactFirefoxStacktraceStrings = function(stacktraceStr) {
if (!/\"/.test(stacktraceStr)) {
return stacktraceStr;
}
// We can safely use new ecmascript array methods because this code only runs in Firefox.
return stacktraceStr.split('\n').map(function(stacktraceLine) {
var quoteLocations = [];
var index = 0;
do {
index = (stacktraceLine.indexOf('"', index + 1));
if (index != -1) {
quoteLocations.push(index);
}
} while (index != -1);
quoteLocations = quoteLocations.filter(function(quoteLocation) {
var backslashCount = 0, index = quoteLocation;
while (index--) {
if (stacktraceLine.charAt(index) != '\\') {
break;
}
backslashCount = backslashCount + 1;
}
// If a quotation mark is preceded by a non-even number of backslashes, it is escaped. Otherwise, only the
// backslashes are escaped.
// \" escaped quote
// \\" escaped backslash, unescaped quote
// \\\" escaped backslash, escaped quote
// (etc)
return (backslashCount % 2 == 0);
});
if (quoteLocations.length % 2 == 1) {
quoteLocations.push(stacktraceLine.length);
}
for (var i = quoteLocations.length - 1; i > 0; i -= 2) {
stacktraceLine = stacktraceLine.substr(0, quoteLocations[i - 1] + 1) +
g.errorCatcher.redactString(stacktraceLine.substring(quoteLocations[i - 1] + 1, quoteLocations[i])) +
stacktraceLine.substr(quoteLocations[i]);
}
return stacktraceLine;
}).join('\n');
};
/**
* Redacts a string for user privacy.
* @param {string} str The string to redact.
* @return {string} The redacted string.
*/
g.errorCatcher.redactString = function(str) {
return '[string redacted]';
// This commented out alternative attempts to at least make certain types of string (HTML, for example) maintain a
// recognizable pattern.
// return g.errorCatcher.shortenString(str.replace(/[a-z]/g, 'x').replace(/[A-Z]/g, 'X').replace(/[0-9]/g, '#').replace(
// /[^\\\s\[\]<>xX\"\'\(\)\.\,\?\!\#\=\:\;\&\|\@\_\-]/g, '*'), 150).replace(/\r/g, '').replace(/\n/g, '\\n');
};
// g.errorCatcher can cause problems with debuggers (it breaks the Firebug console, for example), so it should be
// disabled in development environments. This if statements g.errorCatcher if you're using
if (!/dev/.test(window.location.host)) {
g.errorCatcher(function(errorObj) {
var key = '27461631-f992-4f72-b94d-b98996ef1a53';
var host = 'https://logs.loggly.com';
castor = new loggly({url: host+'/inputs/'+key+'?rt=1', level: 'log'});
castor.error(JSON.stringify({host: window.location.host, error: errorObj}));
}, function(str) {
// this is the URL redaction function. this one just removes ?q= paramter values, but you should adapt this to your own application if needed.
return str.replace(/([\#\?\&][Qq]\=)[^\=\&\#\s]*/g, '$1[redacted]');
});
}
/*
* Copyright 2010 Matthew Eernisse (mde@fleegix.org)
* and Open Source Applications Foundation
*
* 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.
*
* Credits: Ideas included from incomplete JS implementation of Olson
* parser, "XMLDAte" by Philippe Goetz (philippe.goetz@wanadoo.fr)
*
* Contributions:
* Jan Niehusmann
* Ricky Romero
* Preston Hunt (prestonhunt@gmail.com),
* Dov. B Katz (dov.katz@morganstanley.com),
* Peter Bergström (pbergstr@mac.com)
*/
if (typeof timezoneJS == 'undefined') { timezoneJS = {}; }
timezoneJS.Date = function () {
var args = Array.prototype.slice.apply(arguments);
var t = null;
var dt = null;
var tz = null;
var utc = false;
// No args -- create a floating date based on the current local offset
if (args.length === 0) {
dt = new Date();
}
// Date string or timestamp -- assumes floating
else if (args.length == 1) {
dt = new Date(args[0]);
}
// year, month, [date,] [hours,] [minutes,] [seconds,] [milliseconds,] [tzId,] [utc]
else {
t = args[args.length-1];
// Last arg is utc
if (typeof t == 'boolean') {
utc = args.pop();
tz = args.pop();
}
// Last arg is tzId
else if (typeof t == 'string') {
tz = args.pop();
if (tz == 'Etc/UTC' || tz == 'Etc/GMT') {
utc = true;
}
}
// Date string (e.g., '12/27/2006')
t = args[args.length-1];
if (typeof t == 'string') {
dt = new Date(args[0]);
}
// Date part numbers
else {
var a = [];
for (var i = 0; i < 8; i++) {
a[i] = args[i] || 0;
}
dt = new Date(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7]);
}
}
this._useCache = false;
this._tzInfo = {};
this._tzAbbr = '';
this._day = 0;
this.year = 0;
this.month = 0;
this.date = 0;
this.hours= 0;
this.minutes = 0;
this.seconds = 0;
this.milliseconds = 0;
this.timezone = tz || null;
this.utc = utc || false;
this.setFromDateObjProxy(dt);
};
timezoneJS.Date.prototype = {
getDate: function () { return this.date; },
getDay: function () { return this._day; },
getFullYear: function () { return this.year; },
getMonth: function () { return this.month; },
getYear: function () { return this.year; },
getHours: function () {
return this.hours;
},
getMilliseconds: function () {
return this.milliseconds;
},
getMinutes: function () {
return this.minutes;
},
getSeconds: function () {
return this.seconds;
},
getTime: function () {
var dt = Date.UTC(this.year, this.month, this.date,
this.hours, this.minutes, this.seconds, this.milliseconds);
return dt + (this.getTimezoneOffset()*60*1000);
},
getTimezone: function () {
return this.timezone;
},
getTimezoneOffset: function () {
var info = this.getTimezoneInfo();
return info.tzOffset;
},
getTimezoneAbbreviation: function () {
var info = this.getTimezoneInfo();
return info.tzAbbr;
},
getTimezoneInfo: function () {
var res;
if (this.utc) {
res = { tzOffset: 0,
tzAbbr: 'UTC' };
}
else {
if (this._useCache) {
res = this._tzInfo;
}
else {
if (this.timezone) {
var dt = new Date(Date.UTC(this.year, this.month, this.date,
this.hours, this.minutes, this.seconds, this.milliseconds));
var tz = this.timezone;
res = timezoneJS.timezone.getTzInfo(dt, tz);
}
// Floating -- use local offset
else {
res = { tzOffset: this.getLocalOffset(),
tzAbbr: null };
}
this._tzInfo = res;
this._useCache = true;
}
}
return res;
},
getUTCDate: function () {
return this.getUTCDateProxy().getUTCDate();
},
getUTCDay: function () {
return this.getUTCDateProxy().getUTCDay();
},
getUTCFullYear: function () {
return this.getUTCDateProxy().getUTCFullYear();
},
getUTCHours: function () {
return this.getUTCDateProxy().getUTCHours();
},
getUTCMilliseconds: function () {
return this.getUTCDateProxy().getUTCMilliseconds();
},
getUTCMinutes: function () {
return this.getUTCDateProxy().getUTCMinutes();
},
getUTCMonth: function () {
return this.getUTCDateProxy().getUTCMonth();
},
getUTCSeconds: function () {
return this.getUTCDateProxy().getUTCSeconds();
},
setDate: function (n) {
this.setAttribute('date', n);
},
setFullYear: function (n) {
this.setAttribute('year', n);
},
setMonth: function (n) {
this.setAttribute('month', n);
},
setYear: function (n) {
this.setUTCAttribute('year', n);
},
setHours: function (n) {
this.setAttribute('hours', n);
},
setMilliseconds: function (n) {
this.setAttribute('milliseconds', n);
},
setMinutes: function (n) {
this.setAttribute('minutes', n);
},
setSeconds: function (n) {
this.setAttribute('seconds', n);
},
setTime: function (n) {
if (isNaN(n)) { throw new Error('Units must be a number.'); }
var dt = new Date(0);
dt.setUTCMilliseconds(n - (this.getTimezoneOffset()*60*1000));
this.setFromDateObjProxy(dt, true);
},
setUTCDate: function (n) {
this.setUTCAttribute('date', n);
},
setUTCFullYear: function (n) {
this.setUTCAttribute('year', n);
},
setUTCHours: function (n) {
this.setUTCAttribute('hours', n);
},
setUTCMilliseconds: function (n) {
this.setUTCAttribute('milliseconds', n);
},
setUTCMinutes: function (n) {
this.setUTCAttribute('minutes', n);
},
setUTCMonth: function (n) {
this.setUTCAttribute('month', n);
},
setUTCSeconds: function (n) {
this.setUTCAttribute('seconds', n);
},
toGMTString: function () {},
toLocaleString: function () {},
toLocaleDateString: function () {},
toLocaleTimeString: function () {},
toSource: function () {},
toString: function () {
// Get a quick looky at what's in there
var str = this.getFullYear() + '-' + (this.getMonth()+1) + '-' + this.getDate();
var hou = this.getHours() || 12;
hou = String(hou);
var min = String(this.getMinutes());
if (min.length == 1) { min = '0' + min; }
var sec = String(this.getSeconds());
if (sec.length == 1) { sec = '0' + sec; }
str += ' ' + hou;
str += ':' + min;
str += ':' + sec;
return str;
},
toUTCString: function () {},
valueOf: function () {
return this.getTime();
},
clone: function () {
return new timezoneJS.Date(this.year, this.month, this.date,
this.hours, this.minutes, this.seconds, this.milliseconds,
this.timezone);
},
setFromDateObjProxy: function (dt, fromUTC) {
this.year = fromUTC ? dt.getUTCFullYear() : dt.getFullYear();
this.month = fromUTC ? dt.getUTCMonth() : dt.getMonth();
this.date = fromUTC ? dt.getUTCDate() : dt.getDate();
this.hours = fromUTC ? dt.getUTCHours() : dt.getHours();
this.minutes = fromUTC ? dt.getUTCMinutes() : dt.getMinutes();
this.seconds = fromUTC ? dt.getUTCSeconds() : dt.getSeconds();
this.milliseconds = fromUTC ? dt.getUTCMilliseconds() : dt.getMilliseconds();
this._day = fromUTC ? dt.getUTCDay() : dt.getDay();
this._useCache = false;
},
getUTCDateProxy: function () {
var dt = new Date(Date.UTC(this.year, this.month, this.date,
this.hours, this.minutes, this.seconds, this.milliseconds));
dt.setUTCMinutes(dt.getUTCMinutes() + this.getTimezoneOffset());
return dt;
},
setAttribute: function (unit, n) {
if (isNaN(n)) { throw new Error('Units must be a number.'); }
var dt = new Date(this.year, this.month, this.date,
this.hours, this.minutes, this.seconds, this.milliseconds);
var meth = unit == 'year' ? 'FullYear' : unit.substr(0, 1).toUpperCase() +
unit.substr(1);
dt['set' + meth](n);
this.setFromDateObjProxy(dt);
},
setUTCAttribute: function (unit, n) {
if (isNaN(n)) { throw new Error('Units must be a number.'); }
var meth = unit == 'year' ? 'FullYear' : unit.substr(0, 1).toUpperCase() +
unit.substr(1);
var dt = this.getUTCDateProxy();
dt['setUTC' + meth](n);
dt.setUTCMinutes(dt.getUTCMinutes() - this.getTimezoneOffset());
this.setFromDateObjProxy(dt, true);
},
setTimezone: function (tz) {
if (tz == 'Etc/UTC' || tz == 'Etc/GMT') {
this.utc = true;
} else {
this.utc = false;
}
this.timezone = tz;
this._useCache = false;
},
removeTimezone: function () {
this.utc = false;
this.timezone = null;
this._useCache = false;
},
civilToJulianDayNumber: function (y, m, d) {
var a;
// Adjust for zero-based JS-style array
m++;
if (m > 12) {
a = parseInt(m/12, 10);
m = m % 12;
y += a;
}
if (m <= 2) {
y -= 1;
m += 12;
}
a = Math.floor(y / 100);
var b = 2 - a + Math.floor(a / 4);
jDt = Math.floor(365.25 * (y + 4716)) +
Math.floor(30.6001 * (m + 1)) +
d + b - 1524;
return jDt;
},
getLocalOffset: function () {
var dt = this;
var d = new Date(dt.getYear(), dt.getMonth(), dt.getDate(),
dt.getHours(), dt.getMinutes(), dt.getSeconds());
return d.getTimezoneOffset();
},
convertToTimezone: function(tz) {
var dt = new Date();
res = timezoneJS.timezone.getTzInfo(dt, tz);
convert_offset = this.getTimezoneOffset() - res.tzOffset // offset in minutes
converted_date = new timezoneJS.Date(this + convert_offset*60*1000)
this.setFromDateObjProxy(converted_date, true)
this.setTimezone(tz)
}
};
timezoneJS.timezone = new function() {
var _this = this;
var monthMap = { 'jan': 0, 'feb': 1, 'mar': 2, 'apr': 3,'may': 4, 'jun': 5, 'jul': 6, 'aug': 7, 'sep': 8, 'oct': 9, 'nov': 10, 'dec': 11 };
var dayMap = {'sun': 0,'mon' :1, 'tue': 2, 'wed': 3, 'thu': 4, 'fri': 5, 'sat': 6 };
var regionMap = {'EST':'northamerica','MST':'northamerica','HST':'northamerica','EST5EDT':'northamerica','CST6CDT':'northamerica','MST7MDT':'northamerica','PST8PDT':'northamerica','America':'northamerica','Pacific':'australasia','Atlantic':'europe','Africa':'africa','Indian':'africa','Antarctica':'antarctica','Asia':'asia','Australia':'australasia','Europe':'europe','WET':'europe','CET':'europe','MET':'europe','EET':'europe'};
var regionExceptions = {'Pacific/Honolulu':'northamerica','Atlantic/Bermuda':'northamerica','Atlantic/Cape_Verde':'africa','Atlantic/St_Helena':'africa','Indian/Kerguelen':'antarctica','Indian/Chagos':'asia','Indian/Maldives':'asia','Indian/Christmas':'australasia','Indian/Cocos':'australasia','America/Danmarkshavn':'europe','America/Scoresbysund':'europe','America/Godthab':'europe','America/Thule':'europe','Asia/Yekaterinburg':'europe','Asia/Omsk':'europe','Asia/Novosibirsk':'europe','Asia/Krasnoyarsk':'europe','Asia/Irkutsk':'europe','Asia/Yakutsk':'europe','Asia/Vladivostok':'europe','Asia/Sakhalin':'europe','Asia/Magadan':'europe','Asia/Kamchatka':'europe','Asia/Anadyr':'europe','Africa/Ceuta':'europe','America/Argentina/Buenos_Aires':'southamerica','America/Argentina/Cordoba':'southamerica','America/Argentina/Tucuman':'southamerica','America/Argentina/La_Rioja':'southamerica','America/Argentina/San_Juan':'southamerica','America/Argentina/Jujuy':'southamerica','America/Argentina/Catamarca':'southamerica','America/Argentina/Mendoza':'southamerica','America/Argentina/Rio_Gallegos':'southamerica','America/Argentina/Ushuaia':'southamerica','America/Aruba':'southamerica','America/La_Paz':'southamerica','America/Noronha':'southamerica','America/Belem':'southamerica','America/Fortaleza':'southamerica','America/Recife':'southamerica','America/Araguaina':'southamerica','America/Maceio':'southamerica','America/Bahia':'southamerica','America/Sao_Paulo':'southamerica','America/Campo_Grande':'southamerica','America/Cuiaba':'southamerica','America/Porto_Velho':'southamerica','America/Boa_Vista':'southamerica','America/Manaus':'southamerica','America/Eirunepe':'southamerica','America/Rio_Branco':'southamerica','America/Santiago':'southamerica','Pacific/Easter':'southamerica','America/Bogota':'southamerica','America/Curacao':'southamerica','America/Guayaquil':'southamerica','Pacific/Galapagos':'southamerica','Atlantic/Stanley':'southamerica','America/Cayenne':'southamerica','America/Guyana':'southamerica','America/Asuncion':'southamerica','America/Lima':'southamerica','Atlantic/South_Georgia':'southamerica','America/Paramaribo':'southamerica','America/Port_of_Spain':'southamerica','America/Montevideo':'southamerica','America/Caracas':'southamerica'};
function invalidTZError(t) {
throw new Error('Timezone "' + t + '" is either incorrect, or not loaded in the timezone registry.');
}
function getRegionForTimezone(tz) {
var exc = regionExceptions[tz];
var ret;
if (exc) {
return exc;
}
else {
reg = tz.split('/')[0];
ret = regionMap[reg];
// If there's nothing listed in the main regions for
// this TZ, check the 'backward' links
if (!ret) {
var link = _this.zones[tz];
if (typeof link == 'string') {
return getRegionForTimezone(link);
}
}
return ret;
}
}
function parseTimeString(str) {
var pat = /(\d+)(?::0*(\d*))?(?::0*(\d*))?([wsugz])?$/;
var hms = str.match(pat);
hms[1] = parseInt(hms[1], 10);
hms[2] = hms[2] ? parseInt(hms[2], 10) : 0;
hms[3] = hms[3] ? parseInt(hms[3], 10) : 0;
return hms;
}
function getZone(dt, tz) {
var t = tz;
var zoneList = _this.zones[t];
// Follow links to get to an acutal zone
while (typeof zoneList == "string") {
t = zoneList;
zoneList = _this.zones[t];
}
for(var i = 0; i < zoneList.length; i++) {
var z = zoneList[i];
if (!z[3]) { break; }
var yea = parseInt(z[3], 10);
var mon = 11;
var dat = 31;
if (z[4]) {
mon = monthMap[z[4].substr(0, 3).toLowerCase()];
dat = parseInt(z[5], 10);
}
var t = z[6] ? z[6] : '23:59:59';
t = parseTimeString(t);
var d = Date.UTC(yea, mon, dat, t[1], t[2], t[3]);
if (dt.getTime() < d) { break; }
}
if (i == zoneList.length) { throw new Error('No Zone found for "' + timezone + '" on ' + dt); }
return zoneList[i];
}
function getBasicOffset(z) {
var off = parseTimeString(z[0]);
var adj = z[0].indexOf('-') == 0 ? -1 : 1
off = adj * (((off[1] * 60 + off[2]) *60 + off[3]) * 1000);
return -off/60/1000;
}
// if isUTC is true, date is given in UTC, otherwise it's given
// in local time (ie. date.getUTC*() returns local time components)
function getRule( date, zone, isUTC ) {
var ruleset = zone[1];
var basicOffset = getBasicOffset( zone );
// Convert a date to UTC. Depending on the 'type' parameter, the date
// parameter may be:
// 'u', 'g', 'z': already UTC (no adjustment)
// 's': standard time (adjust for time zone offset but not for DST)
// 'w': wall clock time (adjust for both time zone and DST offset)
//
// DST adjustment is done using the rule given as third argument
var convertDateToUTC = function( date, type, rule ) {
var offset = 0;
if(type == 'u' || type == 'g' || type == 'z') { // UTC
offset = 0;
} else if(type == 's') { // Standard Time
offset = basicOffset;
} else if(type == 'w' || !type ) { // Wall Clock Time
offset = getAdjustedOffset(basicOffset,rule);
} else {
throw("unknown type "+type);
}
offset *= 60*1000; // to millis
return new Date( date.getTime() + offset );
}
// Step 1: Find applicable rules for this year.
// Step 2: Sort the rules by effective date.
// Step 3: Check requested date to see if a rule has yet taken effect this year. If not,
// Step 4: Get the rules for the previous year. If there isn't an applicable rule for last year, then
// there probably is no current time offset since they seem to explicitly turn off the offset
// when someone stops observing DST.
// FIXME if this is not the case and we'll walk all the way back (ugh).
// Step 5: Sort the rules by effective date.
// Step 6: Apply the most recent rule before the current time.
var convertRuleToExactDateAndTime = function( yearAndRule, prevRule )
{
var year = yearAndRule[0];
var rule = yearAndRule[1];
// Assume that the rule applies to the year of the given date.
var months = {
"Jan": 0, "Feb": 1, "Mar": 2, "Apr": 3, "May": 4, "Jun": 5,
"Jul": 6, "Aug": 7, "Sep": 8, "Oct": 9, "Nov": 10, "Dec": 11
};
var days = {
"sun": 0, "mon": 1, "tue": 2, "wed": 3, "thu": 4, "fri": 5, "sat": 6
}
var hms = parseTimeString( rule[ 5 ] );
var effectiveDate;
if ( !isNaN( rule[ 4 ] ) ) // If we have a specific date, use that!
{
effectiveDate = new Date( Date.UTC( year, months[ rule[ 3 ] ], rule[ 4 ], hms[ 1 ], hms[ 2 ], hms[ 3 ], 0 ) );
}
else // Let's hunt for the date.
{
var targetDay,
operator;
if ( rule[ 4 ].substr( 0, 4 ) === "last" ) // Example: lastThu
{
// Start at the last day of the month and work backward.
effectiveDate = new Date( Date.UTC( year, months[ rule[ 3 ] ] + 1, 1, hms[ 1 ] - 24, hms[ 2 ], hms[ 3 ], 0 ) );
targetDay = days[ rule[ 4 ].substr( 4, 3 ).toLowerCase( ) ];
operator = "<=";
}
else // Example: Sun>=15
{
// Start at the specified date.
effectiveDate = new Date( Date.UTC( year, months[ rule[ 3 ] ], rule[ 4 ].substr( 5 ), hms[ 1 ], hms[ 2 ], hms[ 3 ], 0 ) );
targetDay = days[ rule[ 4 ].substr( 0, 3 ).toLowerCase( ) ];
operator = rule[ 4 ].substr( 3, 2 );
}
var ourDay = effectiveDate.getUTCDay( );
if ( operator === ">=" ) // Go forwards.
{
effectiveDate.setUTCDate( effectiveDate.getUTCDate( ) + ( targetDay - ourDay + ( ( targetDay < ourDay ) ? 7 : 0 ) ) );
}
else // Go backwards. Looking for the last of a certain day, or operator is "<=" (less likely).
{
effectiveDate.setUTCDate( effectiveDate.getUTCDate( ) + ( targetDay - ourDay - ( ( targetDay > ourDay ) ? 7 : 0 ) ) );
}
}
// if previous rule is given, correct for the fact that the starting time of the current
// rule may be specified in local time
if(prevRule) {
effectiveDate = convertDateToUTC(effectiveDate, hms[4], prevRule);
}
return effectiveDate;
}
var findApplicableRules = function( year, ruleset )
{
var applicableRules = [];
for ( var i in ruleset )
{
if ( Number( ruleset[ i ][ 0 ] ) <= year ) // Exclude future rules.
{
if (
Number( ruleset[ i ][ 1 ] ) >= year // Date is in a set range.
|| ( Number( ruleset[ i ][ 0 ] ) === year && ruleset[ i ][ 1 ] === "only" ) // Date is in an "only" year.
|| ruleset[ i ][ 1 ] === "max" // We're in a range from the start year to infinity.
)
{
// It's completely okay to have any number of matches here.
// Normally we should only see two, but that doesn't preclude other numbers of matches.
// These matches are applicable to this year.
applicableRules.push( [year, ruleset[ i ]] );
}
}
}
return applicableRules;
}
var compareDates = function( a, b, prev )
{
if ( a.constructor !== Date ) {
a = convertRuleToExactDateAndTime( a, prev );
} else if(prev) {
a = convertDateToUTC(a, isUTC?'u':'w', prev);
}
if ( b.constructor !== Date ) {
b = convertRuleToExactDateAndTime( b, prev );
} else if(prev) {
b = convertDateToUTC(b, isUTC?'u':'w', prev);
}
a = Number( a );
b = Number( b );
return a - b;
}
var year = date.getUTCFullYear( );
var applicableRules;
applicableRules = findApplicableRules( year, _this.rules[ ruleset ] );
applicableRules.push( date );
// While sorting, the time zone in which the rule starting time is specified
// is ignored. This is ok as long as the timespan between two DST changes is
// larger than the DST offset, which is probably always true.
// As the given date may indeed be close to a DST change, it may get sorted
// to a wrong position (off by one), which is corrected below.
applicableRules.sort( compareDates );
if ( applicableRules.indexOf( date ) < 2 ) { // If there are not enough past DST rules...
applicableRules = applicableRules.concat(findApplicableRules( year-1, _this.rules[ ruleset ] ));
applicableRules.sort( compareDates );
}
var pinpoint = applicableRules.indexOf( date );
if ( pinpoint > 1 && compareDates( date, applicableRules[pinpoint-1], applicableRules[pinpoint-2][1] ) < 0 ) {
// the previous rule does not really apply, take the one before that
return applicableRules[ pinpoint - 2 ][1];
} else if ( pinpoint > 0 && pinpoint < applicableRules.length - 1 && compareDates( date, applicableRules[pinpoint+1], applicableRules[pinpoint-1][1] ) > 0) {
// the next rule does already apply, take that one
return applicableRules[ pinpoint + 1 ][1];
} else if ( pinpoint === 0 ) {
// no applicable rule found in this and in previous year
return null;
} else {
return applicableRules[ pinpoint - 1 ][1];
}
}
function getAdjustedOffset(off, rule) {
var save = rule[6];
var t = parseTimeString(save);
var adj = save.indexOf('-') == 0 ? -1 : 1;
var ret = (adj*(((t[1] *60 + t[2]) * 60 + t[3]) * 1000));
ret = ret/60/1000;
ret -= off
ret = -Math.ceil(ret);
return ret;
}
function getAbbreviation(zone, rule) {
var res;
var base = zone[2];
if (base.indexOf('%s') > -1) {
var repl;
if (rule) {
repl = rule[7]=='-'?'':rule[7];
}
// FIXME: Right now just falling back to Standard --
// apparently ought to use the last valid rule,
// although in practice that always ought to be Standard
else {
repl = 'S';
}
res = base.replace('%s', repl);
}
else if (base.indexOf('/') > -1) {
// chose one of two alternative strings
var t = parseTimeString(rule[6]);
var isDst = (t[1])||(t[2])||(t[3]);
res = base.split("/",2)[isDst?1:0];
} else {
res = base;
}
return res;
}
this.getTzInfo = function(dt, tz, isUTC) {
var zone = getZone(dt, tz);
var off = getBasicOffset(zone);
// See if the offset needs adjustment
var rule = getRule(dt, zone, isUTC);
if (rule) {
off = getAdjustedOffset(off, rule);
}
var abbr = getAbbreviation(zone, rule);
return { tzOffset: off, tzAbbr: abbr };
}
}
// Timezone data for: northamerica,europe
timezoneJS.timezone.zones = {"Europe/London":[["-0:01:15","-","LMT","1847","Dec","1","0:00s"],["0:00","GB-Eire","%s","1968","Oct","27"],["1:00","-","BST","1971","Oct","31","2:00u"],["0:00","GB-Eire","%s","1996"],["0:00","EU","GMT/BST"]],"Europe/Jersey":"Europe/London","Europe/Guernsey":"Europe/London","Europe/Isle_of_Man":"Europe/London","Europe/Dublin":[["-0:25:00","-","LMT","1880","Aug","2"],["-0:25:21","-","DMT","1916","May","21","2:00"],["-0:25:21","1:00","IST","1916","Oct","1","2:00s"],["0:00","GB-Eire","%s","1921","Dec","6",""],["0:00","GB-Eire","GMT/IST","1940","Feb","25","2:00"],["0:00","1:00","IST","1946","Oct","6","2:00"],["0:00","-","GMT","1947","Mar","16","2:00"],["0:00","1:00","IST","1947","Nov","2","2:00"],["0:00","-","GMT","1948","Apr","18","2:00"],["0:00","GB-Eire","GMT/IST","1968","Oct","27"],["1:00","-","IST","1971","Oct","31","2:00u"],["0:00","GB-Eire","GMT/IST","1996"],["0:00","EU","GMT/IST"]],"WET":[["0:00","EU","WE%sT"]],"CET":[["1:00","C-Eur","CE%sT"]],"MET":[["1:00","C-Eur","ME%sT"]],"EET":[["2:00","EU","EE%sT"]],"Europe/Tirane":[["1:19:20","-","LMT","1914"],["1:00","-","CET","1940","Jun","16"],["1:00","Albania","CE%sT","1984","Jul"],["1:00","EU","CE%sT"]],"Europe/Andorra":[["0:06:04","-","LMT","1901"],["0:00","-","WET","1946","Sep","30"],["1:00","-","CET","1985","Mar","31","2:00"],["1:00","EU","CE%sT"]],"Europe/Vienna":[["1:05:20","-","LMT","1893","Apr"],["1:00","C-Eur","CE%sT","1920"],["1:00","Austria","CE%sT","1940","Apr","1","2:00s"],["1:00","C-Eur","CE%sT","1945","Apr","2","2:00s"],["1:00","1:00","CEST","1945","Apr","12","2:00s"],["1:00","-","CET","1946"],["1:00","Austria","CE%sT","1981"],["1:00","EU","CE%sT"]],"Europe/Minsk":[["1:50:16","-","LMT","1880"],["1:50","-","MMT","1924","May","2",""],["2:00","-","EET","1930","Jun","21"],["3:00","-","MSK","1941","Jun","28"],["1:00","C-Eur","CE%sT","1944","Jul","3"],["3:00","Russia","MSK/MSD","1990"],["3:00","-","MSK","1991","Mar","31","2:00s"],["2:00","1:00","EEST","1991","Sep","29","2:00s"],["2:00","-","EET","1992","Mar","29","0:00s"],["2:00","1:00","EEST","1992","Sep","27","0:00s"],["2:00","Russia","EE%sT"]],"Europe/Brussels":[["0:17:30","-","LMT","1880"],["0:17:30","-","BMT","1892","May","1","12:00",""],["0:00","-","WET","1914","Nov","8"],["1:00","-","CET","1916","May","1","0:00"],["1:00","C-Eur","CE%sT","1918","Nov","11","11:00u"],["0:00","Belgium","WE%sT","1940","May","20","2:00s"],["1:00","C-Eur","CE%sT","1944","Sep","3"],["1:00","Belgium","CE%sT","1977"],["1:00","EU","CE%sT"]],"Europe/Sofia":[["1:33:16","-","LMT","1880"],["1:56:56","-","IMT","1894","Nov","30",""],["2:00","-","EET","1942","Nov","2","3:00"],["1:00","C-Eur","CE%sT","1945"],["1:00","-","CET","1945","Apr","2","3:00"],["2:00","-","EET","1979","Mar","31","23:00"],["2:00","Bulg","EE%sT","1982","Sep","26","2:00"],["2:00","C-Eur","EE%sT","1991"],["2:00","E-Eur","EE%sT","1997"],["2:00","EU","EE%sT"]],"Europe/Prague":[["0:57:44","-","LMT","1850"],["0:57:44","-","PMT","1891","Oct",""],["1:00","C-Eur","CE%sT","1944","Sep","17","2:00s"],["1:00","Czech","CE%sT","1979"],["1:00","EU","CE%sT"]],"Europe/Copenhagen":[["0:50:20","-","LMT","1890"],["0:50:20","-","CMT","1894","Jan","1",""],["1:00","Denmark","CE%sT","1942","Nov","2","2:00s"],["1:00","C-Eur","CE%sT","1945","Apr","2","2:00"],["1:00","Denmark","CE%sT","1980"],["1:00","EU","CE%sT"]],"Atlantic/Faroe":[["-0:27:04","-","LMT","1908","Jan","11",""],["0:00","-","WET","1981"],["0:00","EU","WE%sT"]],"America/Danmarkshavn":[["-1:14:40","-","LMT","1916","Jul","28"],["-3:00","-","WGT","1980","Apr","6","2:00"],["-3:00","EU","WG%sT","1996"],["0:00","-","GMT"]],"America/Scoresbysund":[["-1:27:52","-","LMT","1916","Jul","28",""],["-2:00","-","CGT","1980","Apr","6","2:00"],["-2:00","C-Eur","CG%sT","1981","Mar","29"],["-1:00","EU","EG%sT"]],"America/Godthab":[["-3:26:56","-","LMT","1916","Jul","28",""],["-3:00","-","WGT","1980","Apr","6","2:00"],["-3:00","EU","WG%sT"]],"America/Thule":[["-4:35:08","-","LMT","1916","Jul","28",""],["-4:00","Thule","A%sT"]],"Europe/Tallinn":[["1:39:00","-","LMT","1880"],["1:39:00","-","TMT","1918","Feb",""],["1:00","C-Eur","CE%sT","1919","Jul"],["1:39:00","-","TMT","1921","May"],["2:00","-","EET","1940","Aug","6"],["3:00","-","MSK","1941","Sep","15"],["1:00","C-Eur","CE%sT","1944","Sep","22"],["3:00","Russia","MSK/MSD","1989","Mar","26","2:00s"],["2:00","1:00","EEST","1989","Sep","24","2:00s"],["2:00","C-Eur","EE%sT","1998","Sep","22"],["2:00","EU","EE%sT","1999","Nov","1"],["2:00","-","EET","2002","Feb","21"],["2:00","EU","EE%sT"]],"Europe/Helsinki":[["1:39:52","-","LMT","1878","May","31"],["1:39:52","-","HMT","1921","May",""],["2:00","Finland","EE%sT","1983"],["2:00","EU","EE%sT"]],"Europe/Mariehamn":"Europe/Helsinki","Europe/Paris":[["0:09:21","-","LMT","1891","Mar","15","0:01"],["0:09:21","-","PMT","1911","Mar","11","0:01",""],["0:00","France","WE%sT","1940","Jun","14","23:00"],["1:00","C-Eur","CE%sT","1944","Aug","25"],["0:00","France","WE%sT","1945","Sep","16","3:00"],["1:00","France","CE%sT","1977"],["1:00","EU","CE%sT"]],"Europe/Berlin":[["0:53:28","-","LMT","1893","Apr"],["1:00","C-Eur","CE%sT","1945","May","24","2:00"],["1:00","SovietZone","CE%sT","1946"],["1:00","Germany","CE%sT","1980"],["1:00","EU","CE%sT"]],"Europe/Gibraltar":[["-0:21:24","-","LMT","1880","Aug","2","0:00s"],["0:00","GB-Eire","%s","1957","Apr","14","2:00"],["1:00","-","CET","1982"],["1:00","EU","CE%sT"]],"Europe/Athens":[["1:34:52","-","LMT","1895","Sep","14"],["1:34:52","-","AMT","1916","Jul","28","0:01",""],["2:00","Greece","EE%sT","1941","Apr","30"],["1:00","Greece","CE%sT","1944","Apr","4"],["2:00","Greece","EE%sT","1981"],[""],[""],["2:00","EU","EE%sT"]],"Europe/Budapest":[["1:16:20","-","LMT","1890","Oct"],["1:00","C-Eur","CE%sT","1918"],["1:00","Hungary","CE%sT","1941","Apr","6","2:00"],["1:00","C-Eur","CE%sT","1945"],["1:00","Hungary","CE%sT","1980","Sep","28","2:00s"],["1:00","EU","CE%sT"]],"Atlantic/Reykjavik":[["-1:27:24","-","LMT","1837"],["-1:27:48","-","RMT","1908",""],["-1:00","Iceland","IS%sT","1968","Apr","7","1:00s"],["0:00","-","GMT"]],"Europe/Rome":[["0:49:56","-","LMT","1866","Sep","22"],["0:49:56","-","RMT","1893","Nov","1","0:00s",""],["1:00","Italy","CE%sT","1942","Nov","2","2:00s"],["1:00","C-Eur","CE%sT","1944","Jul"],["1:00","Italy","CE%sT","1980"],["1:00","EU","CE%sT"]],"Europe/Vatican":"Europe/Rome","Europe/San_Marino":"Europe/Rome","Europe/Riga":[["1:36:24","-","LMT","1880"],["1:36:24","-","RMT","1918","Apr","15","2:00",""],["1:36:24","1:00","LST","1918","Sep","16","3:00",""],["1:36:24","-","RMT","1919","Apr","1","2:00"],["1:36:24","1:00","LST","1919","May","22","3:00"],["1:36:24","-","RMT","1926","May","11"],["2:00","-","EET","1940","Aug","5"],["3:00","-","MSK","1941","Jul"],["1:00","C-Eur","CE%sT","1944","Oct","13"],["3:00","Russia","MSK/MSD","1989","Mar","lastSun","2:00s"],["2:00","1:00","EEST","1989","Sep","lastSun","2:00s"],["2:00","Latvia","EE%sT","1997","Jan","21"],["2:00","EU","EE%sT","2000","Feb","29"],["2:00","-","EET","2001","Jan","2"],["2:00","EU","EE%sT"]],"Europe/Vaduz":[["0:38:04","-","LMT","1894","Jun"],["1:00","-","CET","1981"],["1:00","EU","CE%sT"]],"Europe/Vilnius":[["1:41:16","-","LMT","1880"],["1:24:00","-","WMT","1917",""],["1:35:36","-","KMT","1919","Oct","10",""],["1:00","-","CET","1920","Jul","12"],["2:00","-","EET","1920","Oct","9"],["1:00","-","CET","1940","Aug","3"],["3:00","-","MSK","1941","Jun","24"],["1:00","C-Eur","CE%sT","1944","Aug"],["3:00","Russia","MSK/MSD","1991","Mar","31","2:00s"],["2:00","1:00","EEST","1991","Sep","29","2:00s"],["2:00","C-Eur","EE%sT","1998"],["2:00","-","EET","1998","Mar","29","1:00u"],["1:00","EU","CE%sT","1999","Oct","31","1:00u"],["2:00","-","EET","2003","Jan","1"],["2:00","EU","EE%sT"]],"Europe/Luxembourg":[["0:24:36","-","LMT","1904","Jun"],["1:00","Lux","CE%sT","1918","Nov","25"],["0:00","Lux","WE%sT","1929","Oct","6","2:00s"],["0:00","Belgium","WE%sT","1940","May","14","3:00"],["1:00","C-Eur","WE%sT","1944","Sep","18","3:00"],["1:00","Belgium","CE%sT","1977"],["1:00","EU","CE%sT"]],"Europe/Malta":[["0:58:04","-","LMT","1893","Nov","2","0:00s",""],["1:00","Italy","CE%sT","1942","Nov","2","2:00s"],["1:00","C-Eur","CE%sT","1945","Apr","2","2:00s"],["1:00","Italy","CE%sT","1973","Mar","31"],["1:00","Malta","CE%sT","1981"],["1:00","EU","CE%sT"]],"Europe/Chisinau":[["1:55:20","-","LMT","1880"],["1:55","-","CMT","1918","Feb","15",""],["1:44:24","-","BMT","1931","Jul","24",""],["2:00","Romania","EE%sT","1940","Aug","15"],["2:00","1:00","EEST","1941","Jul","17"],["1:00","C-Eur","CE%sT","1944","Aug","24"],["3:00","Russia","MSK/MSD","1990"],["3:00","-","MSK","1990","May","6"],["2:00","-","EET","1991"],["2:00","Russia","EE%sT","1992"],["2:00","E-Eur","EE%sT","1997"],["2:00","EU","EE%sT"]],"Europe/Monaco":[["0:29:32","-","LMT","1891","Mar","15"],["0:09:21","-","PMT","1911","Mar","11",""],["0:00","France","WE%sT","1945","Sep","16","3:00"],["1:00","France","CE%sT","1977"],["1:00","EU","CE%sT"]],"Europe/Amsterdam":[["0:19:32","-","LMT","1835"],["0:19:32","Neth","%s","1937","Jul","1"],["0:20","Neth","NE%sT","1940","May","16","0:00",""],["1:00","C-Eur","CE%sT","1945","Apr","2","2:00"],["1:00","Neth","CE%sT","1977"],["1:00","EU","CE%sT"]],"Europe/Oslo":[["0:43:00","-","LMT","1895","Jan","1"],["1:00","Norway","CE%sT","1940","Aug","10","23:00"],["1:00","C-Eur","CE%sT","1945","Apr","2","2:00"],["1:00","Norway","CE%sT","1980"],["1:00","EU","CE%sT"]],"Arctic/Longyearbyen":"Europe/Oslo","Europe/Warsaw":[["1:24:00","-","LMT","1880"],["1:24:00","-","WMT","1915","Aug","5",""],["1:00","C-Eur","CE%sT","1918","Sep","16","3:00"],["2:00","Poland","EE%sT","1922","Jun"],["1:00","Poland","CE%sT","1940","Jun","23","2:00"],["1:00","C-Eur","CE%sT","1944","Oct"],["1:00","Poland","CE%sT","1977"],["1:00","W-Eur","CE%sT","1988"],["1:00","EU","CE%sT"]],"Europe/Lisbon":[["-0:36:32","-","LMT","1884"],["-0:36:32","-","LMT","1912","Jan","1",""],["0:00","Port","WE%sT","1966","Apr","3","2:00"],["1:00","-","CET","1976","Sep","26","1:00"],["0:00","Port","WE%sT","1983","Sep","25","1:00s"],["0:00","W-Eur","WE%sT","1992","Sep","27","1:00s"],["1:00","EU","CE%sT","1996","Mar","31","1:00u"],["0:00","EU","WE%sT"]],"Atlantic/Azores":[["-1:42:40","-","LMT","1884",""],["-1:54:32","-","HMT","1911","May","24",""],["-2:00","Port","AZO%sT","1966","Apr","3","2:00",""],["-1:00","Port","AZO%sT","1983","Sep","25","1:00s"],["-1:00","W-Eur","AZO%sT","1992","Sep","27","1:00s"],["0:00","EU","WE%sT","1993","Mar","28","1:00u"],["-1:00","EU","AZO%sT"]],"Atlantic/Madeira":[["-1:07:36","-","LMT","1884",""],["-1:07:36","-","FMT","1911","May","24",""],["-1:00","Port","MAD%sT","1966","Apr","3","2:00",""],["0:00","Port","WE%sT","1983","Sep","25","1:00s"],["0:00","EU","WE%sT"]],"Europe/Bucharest":[["1:44:24","-","LMT","1891","Oct"],["1:44:24","-","BMT","1931","Jul","24",""],["2:00","Romania","EE%sT","1981","Mar","29","2:00s"],["2:00","C-Eur","EE%sT","1991"],["2:00","Romania","EE%sT","1994"],["2:00","E-Eur","EE%sT","1997"],["2:00","EU","EE%sT"]],"Europe/Kaliningrad":[["1:22:00","-","LMT","1893","Apr"],["1:00","C-Eur","CE%sT","1945"],["2:00","Poland","CE%sT","1946"],["3:00","Russia","MSK/MSD","1991","Mar","31","2:00s"],["2:00","Russia","EE%sT","2011","Mar","27","2:00s"],["3:00","-","EET"]],"Europe/Moscow":[["2:30:20","-","LMT","1880"],["2:30","-","MMT","1916","Jul","3",""],["2:30:48","Russia","%s","1919","Jul","1","2:00"],["3:00","Russia","MSK/MSD","1922","Oct"],["2:00","-","EET","1930","Jun","21"],["3:00","Russia","MSK/MSD","1991","Mar","31","2:00s"],["2:00","Russia","EE%sT","1992","Jan","19","2:00s"],["3:00","Russia","MSK/MSD","2011","Mar","27","2:00s"],["4:00","-","MSK"]],"Europe/Volgograd":[["2:57:40","-","LMT","1920","Jan","3"],["3:00","-","TSAT","1925","Apr","6",""],["3:00","-","STAT","1930","Jun","21",""],["4:00","-","STAT","1961","Nov","11"],["4:00","Russia","VOL%sT","1989","Mar","26","2:00s",""],["3:00","Russia","VOL%sT","1991","Mar","31","2:00s"],["4:00","-","VOLT","1992","Mar","29","2:00s"],["3:00","Russia","VOL%sT","2011","Mar","27","2:00s"],["4:00","-","VOLT"]],"Europe/Samara":[["3:20:36","-","LMT","1919","Jul","1","2:00"],["3:00","-","SAMT","1930","Jun","21"],["4:00","-","SAMT","1935","Jan","27"],["4:00","Russia","KUY%sT","1989","Mar","26","2:00s",""],["3:00","Russia","KUY%sT","1991","Mar","31","2:00s"],["2:00","Russia","KUY%sT","1991","Sep","29","2:00s"],["3:00","-","KUYT","1991","Oct","20","3:00"],["4:00","Russia","SAM%sT","2010","Mar","28","2:00s",""],["3:00","Russia","SAM%sT","2011","Mar","27","2:00s"],["4:00","-","SAMT"]],"Asia/Yekaterinburg":[["4:02:24","-","LMT","1919","Jul","15","4:00"],["4:00","-","SVET","1930","Jun","21",""],["5:00","Russia","SVE%sT","1991","Mar","31","2:00s"],["4:00","Russia","SVE%sT","1992","Jan","19","2:00s"],["5:00","Russia","YEK%sT","2011","Mar","27","2:00s"],["6:00","-","YEKT",""]],"Asia/Omsk":[["4:53:36","-","LMT","1919","Nov","14"],["5:00","-","OMST","1930","Jun","21",""],["6:00","Russia","OMS%sT","1991","Mar","31","2:00s"],["5:00","Russia","OMS%sT","1992","Jan","19","2:00s"],["6:00","Russia","OMS%sT","2011","Mar","27","2:00s"],["7:00","-","OMST"]],"Asia/Novosibirsk":[["5:31:40","-","LMT","1919","Dec","14","6:00"],["6:00","-","NOVT","1930","Jun","21",""],["7:00","Russia","NOV%sT","1991","Mar","31","2:00s"],["6:00","Russia","NOV%sT","1992","Jan","19","2:00s"],["7:00","Russia","NOV%sT","1993","May","23",""],["6:00","Russia","NOV%sT","2011","Mar","27","2:00s"],["7:00","-","NOVT"]],"Asia/Novokuznetsk":[["5:48:48","-","NMT","1920","Jan","6"],["6:00","-","KRAT","1930","Jun","21",""],["7:00","Russia","KRA%sT","1991","Mar","31","2:00s"],["6:00","Russia","KRA%sT","1992","Jan","19","2:00s"],["7:00","Russia","KRA%sT","2010","Mar","28","2:00s"],["6:00","Russia","NOV%sT","2011","Mar","27","2:00s"],["7:00","-","NOVT",""]],"Asia/Krasnoyarsk":[["6:11:20","-","LMT","1920","Jan","6"],["6:00","-","KRAT","1930","Jun","21",""],["7:00","Russia","KRA%sT","1991","Mar","31","2:00s"],["6:00","Russia","KRA%sT","1992","Jan","19","2:00s"],["7:00","Russia","KRA%sT","2011","Mar","27","2:00s"],["8:00","-","KRAT"]],"Asia/Irkutsk":[["6:57:20","-","LMT","1880"],["6:57:20","-","IMT","1920","Jan","25",""],["7:00","-","IRKT","1930","Jun","21",""],["8:00","Russia","IRK%sT","1991","Mar","31","2:00s"],["7:00","Russia","IRK%sT","1992","Jan","19","2:00s"],["8:00","Russia","IRK%sT","2011","Mar","27","2:00s"],["9:00","-","IRKT"]],"Asia/Yakutsk":[["8:38:40","-","LMT","1919","Dec","15"],["8:00","-","YAKT","1930","Jun","21",""],["9:00","Russia","YAK%sT","1991","Mar","31","2:00s"],["8:00","Russia","YAK%sT","1992","Jan","19","2:00s"],["9:00","Russia","YAK%sT","2011","Mar","27","2:00s"],["10:00","-","YAKT"]],"Asia/Vladivostok":[["8:47:44","-","LMT","1922","Nov","15"],["9:00","-","VLAT","1930","Jun","21",""],["10:00","Russia","VLA%sT","1991","Mar","31","2:00s"],["9:00","Russia","VLA%sST","1992","Jan","19","2:00s"],["10:00","Russia","VLA%sT","2011","Mar","27","2:00s"],["11:00","-","VLAT"]],"Asia/Sakhalin":[["9:30:48","-","LMT","1905","Aug","23"],["9:00","-","CJT","1938"],["9:00","-","JST","1945","Aug","25"],["11:00","Russia","SAK%sT","1991","Mar","31","2:00s",""],["10:00","Russia","SAK%sT","1992","Jan","19","2:00s"],["11:00","Russia","SAK%sT","1997","Mar","lastSun","2:00s"],["10:00","Russia","SAK%sT","2011","Mar","27","2:00s"],["11:00","-","SAKT"]],"Asia/Magadan":[["10:03:12","-","LMT","1924","May","2"],["10:00","-","MAGT","1930","Jun","21",""],["11:00","Russia","MAG%sT","1991","Mar","31","2:00s"],["10:00","Russia","MAG%sT","1992","Jan","19","2:00s"],["11:00","Russia","MAG%sT","2011","Mar","27","2:00s"],["12:00","-","MAGT"]],"Asia/Kamchatka":[["10:34:36","-","LMT","1922","Nov","10"],["11:00","-","PETT","1930","Jun","21",""],["12:00","Russia","PET%sT","1991","Mar","31","2:00s"],["11:00","Russia","PET%sT","1992","Jan","19","2:00s"],["12:00","Russia","PET%sT","2010","Mar","28","2:00s"],["11:00","Russia","PET%sT","2011","Mar","27","2:00s"],["12:00","-","PETT"]],"Asia/Anadyr":[["11:49:56","-","LMT","1924","May","2"],["12:00","-","ANAT","1930","Jun","21",""],["13:00","Russia","ANA%sT","1982","Apr","1","0:00s"],["12:00","Russia","ANA%sT","1991","Mar","31","2:00s"],["11:00","Russia","ANA%sT","1992","Jan","19","2:00s"],["12:00","Russia","ANA%sT","2010","Mar","28","2:00s"],["11:00","Russia","ANA%sT","2011","Mar","27","2:00s"],["12:00","-","ANAT"]],"Europe/Belgrade":[["1:22:00","-","LMT","1884"],["1:00","-","CET","1941","Apr","18","23:00"],["1:00","C-Eur","CE%sT","1945"],["1:00","-","CET","1945","May","8","2:00s"],["1:00","1:00","CEST","1945","Sep","16","2:00s"],["1:00","-","CET","1982","Nov","27"],["1:00","EU","CE%sT"]],"Europe/Ljubljana":"Europe/Belgrade","Europe/Podgorica":"Europe/Belgrade","Europe/Sarajevo":"Europe/Belgrade","Europe/Skopje":"Europe/Belgrade","Europe/Zagreb":"Europe/Belgrade","Europe/Bratislava":"Europe/Prague","Europe/Madrid":[["-0:14:44","-","LMT","1901","Jan","1","0:00s"],["0:00","Spain","WE%sT","1946","Sep","30"],["1:00","Spain","CE%sT","1979"],["1:00","EU","CE%sT"]],"Africa/Ceuta":[["-0:21:16","-","LMT","1901"],["0:00","-","WET","1918","May","6","23:00"],["0:00","1:00","WEST","1918","Oct","7","23:00"],["0:00","-","WET","1924"],["0:00","Spain","WE%sT","1929"],["0:00","SpainAfrica","WE%sT","1984","Mar","16"],["1:00","-","CET","1986"],["1:00","EU","CE%sT"]],"Atlantic/Canary":[["-1:01:36","-","LMT","1922","Mar",""],["-1:00","-","CANT","1946","Sep","30","1:00",""],["0:00","-","WET","1980","Apr","6","0:00s"],["0:00","1:00","WEST","1980","Sep","28","0:00s"],["0:00","EU","WE%sT"]],"Europe/Stockholm":[["1:12:12","-","LMT","1879","Jan","1"],["1:00:14","-","SET","1900","Jan","1",""],["1:00","-","CET","1916","May","14","23:00"],["1:00","1:00","CEST","1916","Oct","1","01:00"],["1:00","-","CET","1980"],["1:00","EU","CE%sT"]],"Europe/Zurich":[["0:34:08","-","LMT","1848","Sep","12"],["0:29:44","-","BMT","1894","Jun",""],["1:00","Swiss","CE%sT","1981"],["1:00","EU","CE%sT"]],"Europe/Istanbul":[["1:55:52","-","LMT","1880"],["1:56:56","-","IMT","1910","Oct",""],["2:00","Turkey","EE%sT","1978","Oct","15"],["3:00","Turkey","TR%sT","1985","Apr","20",""],["2:00","Turkey","EE%sT","2007"],["2:00","EU","EE%sT","2011","Mar","27","1:00u"],["2:00","-","EET","2011","Mar","28","1:00u"],["2:00","EU","EE%sT"]],"Asia/Istanbul":"Europe/Istanbul","Europe/Kiev":[["2:02:04","-","LMT","1880"],["2:02:04","-","KMT","1924","May","2",""],["2:00","-","EET","1930","Jun","21"],["3:00","-","MSK","1941","Sep","20"],["1:00","C-Eur","CE%sT","1943","Nov","6"],["3:00","Russia","MSK/MSD","1990"],["3:00","-","MSK","1990","Jul","1","2:00"],["2:00","-","EET","1992"],["2:00","E-Eur","EE%sT","1995"],["2:00","EU","EE%sT"]],"Europe/Uzhgorod":[["1:29:12","-","LMT","1890","Oct"],["1:00","-","CET","1940"],["1:00","C-Eur","CE%sT","1944","Oct"],["1:00","1:00","CEST","1944","Oct","26"],["1:00","-","CET","1945","Jun","29"],["3:00","Russia","MSK/MSD","1990"],["3:00","-","MSK","1990","Jul","1","2:00"],["1:00","-","CET","1991","Mar","31","3:00"],["2:00","-","EET","1992"],["2:00","E-Eur","EE%sT","1995"],["2:00","EU","EE%sT"]],"Europe/Zaporozhye":[["2:20:40","-","LMT","1880"],["2:20","-","CUT","1924","May","2",""],["2:00","-","EET","1930","Jun","21"],["3:00","-","MSK","1941","Aug","25"],["1:00","C-Eur","CE%sT","1943","Oct","25"],["3:00","Russia","MSK/MSD","1991","Mar","31","2:00"],["2:00","E-Eur","EE%sT","1995"],["2:00","EU","EE%sT"]],"Europe/Simferopol":[["2:16:24","-","LMT","1880"],["2:16","-","SMT","1924","May","2",""],["2:00","-","EET","1930","Jun","21"],["3:00","-","MSK","1941","Nov"],["1:00","C-Eur","CE%sT","1944","Apr","13"],["3:00","Russia","MSK/MSD","1990"],["3:00","-","MSK","1990","Jul","1","2:00"],["2:00","-","EET","1992"],["2:00","E-Eur","EE%sT","1994","May"],["3:00","E-Eur","MSK/MSD","1996","Mar","31","3:00s"],["3:00","1:00","MSD","1996","Oct","27","3:00s"],["3:00","Russia","MSK/MSD","1997"],["3:00","-","MSK","1997","Mar","lastSun","1:00u"],["2:00","EU","EE%sT"]],"EST":[["-5:00","-","EST"]],"MST":[["-7:00","-","MST"]],"HST":[["-10:00","-","HST"]],"EST5EDT":[["-5:00","US","E%sT"]],"CST6CDT":[["-6:00","US","C%sT"]],"MST7MDT":[["-7:00","US","M%sT"]],"PST8PDT":[["-8:00","US","P%sT"]],"America/New_York":[["-4:56:02","-","LMT","1883","Nov","18","12:03:58"],["-5:00","US","E%sT","1920"],["-5:00","NYC","E%sT","1942"],["-5:00","US","E%sT","1946"],["-5:00","NYC","E%sT","1967"],["-5:00","US","E%sT"]],"America/Chicago":[["-5:50:36","-","LMT","1883","Nov","18","12:09:24"],["-6:00","US","C%sT","1920"],["-6:00","Chicago","C%sT","1936","Mar","1","2:00"],["-5:00","-","EST","1936","Nov","15","2:00"],["-6:00","Chicago","C%sT","1942"],["-6:00","US","C%sT","1946"],["-6:00","Chicago","C%sT","1967"],["-6:00","US","C%sT"]],"America/North_Dakota/Center":[["-6:45:12","-","LMT","1883","Nov","18","12:14:48"],["-7:00","US","M%sT","1992","Oct","25","02:00"],["-6:00","US","C%sT"]],"America/North_Dakota/New_Salem":[["-6:45:39","-","LMT","1883","Nov","18","12:14:21"],["-7:00","US","M%sT","2003","Oct","26","02:00"],["-6:00","US","C%sT"]],"America/North_Dakota/Beulah":[["-6:47:07","-","LMT","1883","Nov","18","12:12:53"],["-7:00","US","M%sT","2010","Nov","7","2:00"],["-6:00","US","C%sT"]],"America/Denver":[["-6:59:56","-","LMT","1883","Nov","18","12:00:04"],["-7:00","US","M%sT","1920"],["-7:00","Denver","M%sT","1942"],["-7:00","US","M%sT","1946"],["-7:00","Denver","M%sT","1967"],["-7:00","US","M%sT"]],"America/Los_Angeles":[["-7:52:58","-","LMT","1883","Nov","18","12:07:02"],["-8:00","US","P%sT","1946"],["-8:00","CA","P%sT","1967"],["-8:00","US","P%sT"]],"America/Juneau":[["15:02:19","-","LMT","1867","Oct","18"],["-8:57:41","-","LMT","1900","Aug","20","12:00"],["-8:00","-","PST","1942"],["-8:00","US","P%sT","1946"],["-8:00","-","PST","1969"],["-8:00","US","P%sT","1980","Apr","27","2:00"],["-9:00","US","Y%sT","1980","Oct","26","2:00",""],["-8:00","US","P%sT","1983","Oct","30","2:00"],["-9:00","US","Y%sT","1983","Nov","30"],["-9:00","US","AK%sT"]],"America/Sitka":[["-14:58:47","-","LMT","1867","Oct","18"],["-9:01:13","-","LMT","1900","Aug","20","12:00"],["-8:00","-","PST","1942"],["-8:00","US","P%sT","1946"],["-8:00","-","PST","1969"],["-8:00","US","P%sT","1983","Oct","30","2:00"],["-9:00","US","Y%sT","1983","Nov","30"],["-9:00","US","AK%sT"]],"America/Metlakatla":[["15:13:42","-","LMT","1867","Oct","18"],["-8:46:18","-","LMT","1900","Aug","20","12:00"],["-8:00","-","PST","1942"],["-8:00","US","P%sT","1946"],["-8:00","-","PST","1969"],["-8:00","US","P%sT","1983","Oct","30","2:00"],["-8:00","US","MeST"]],"America/Yakutat":[["14:41:05","-","LMT","1867","Oct","18"],["-9:18:55","-","LMT","1900","Aug","20","12:00"],["-9:00","-","YST","1942"],["-9:00","US","Y%sT","1946"],["-9:00","-","YST","1969"],["-9:00","US","Y%sT","1983","Nov","30"],["-9:00","US","AK%sT"]],"America/Anchorage":[["14:00:24","-","LMT","1867","Oct","18"],["-9:59:36","-","LMT","1900","Aug","20","12:00"],["-10:00","-","CAT","1942"],["-10:00","US","CAT/CAWT","1945","Aug","14","23:00u"],["-10:00","US","CAT/CAPT","1946",""],["-10:00","-","CAT","1967","Apr"],["-10:00","-","AHST","1969"],["-10:00","US","AH%sT","1983","Oct","30","2:00"],["-9:00","US","Y%sT","1983","Nov","30"],["-9:00","US","AK%sT"]],"America/Nome":[["12:58:21","-","LMT","1867","Oct","18"],["-11:01:38","-","LMT","1900","Aug","20","12:00"],["-11:00","-","NST","1942"],["-11:00","US","N%sT","1946"],["-11:00","-","NST","1967","Apr"],["-11:00","-","BST","1969"],["-11:00","US","B%sT","1983","Oct","30","2:00"],["-9:00","US","Y%sT","1983","Nov","30"],["-9:00","US","AK%sT"]],"America/Adak":[["12:13:21","-","LMT","1867","Oct","18"],["-11:46:38","-","LMT","1900","Aug","20","12:00"],["-11:00","-","NST","1942"],["-11:00","US","N%sT","1946"],["-11:00","-","NST","1967","Apr"],["-11:00","-","BST","1969"],["-11:00","US","B%sT","1983","Oct","30","2:00"],["-10:00","US","AH%sT","1983","Nov","30"],["-10:00","US","HA%sT"]],"Pacific/Honolulu":[["-10:31:26","-","LMT","1896","Jan","13","12:00",""],["-10:30","-","HST","1933","Apr","30","2:00",""],["-10:30","1:00","HDT","1933","May","21","12:00",""],["-10:30","-","HST","1942","Feb","09","2:00",""],["-10:30","1:00","HDT","1945","Sep","30","2:00",""],["-10:30","US","H%sT","1947","Jun","8","2:00",""],["-10:00","-","HST"]],"America/Phoenix":[["-7:28:18","-","LMT","1883","Nov","18","11:31:42"],["-7:00","US","M%sT","1944","Jan","1","00:01"],["-7:00","-","MST","1944","Apr","1","00:01"],["-7:00","US","M%sT","1944","Oct","1","00:01"],["-7:00","-","MST","1967"],["-7:00","US","M%sT","1968","Mar","21"],["-7:00","-","MST"]],"America/Shiprock":"America/Denver","America/Boise":[["-7:44:49","-","LMT","1883","Nov","18","12:15:11"],["-8:00","US","P%sT","1923","May","13","2:00"],["-7:00","US","M%sT","1974"],["-7:00","-","MST","1974","Feb","3","2:00"],["-7:00","US","M%sT"]],"America/Indiana/Indianapolis":[["-5:44:38","-","LMT","1883","Nov","18","12:15:22"],["-6:00","US","C%sT","1920"],["-6:00","Indianapolis","C%sT","1942"],["-6:00","US","C%sT","1946"],["-6:00","Indianapolis","C%sT","1955","Apr","24","2:00"],["-5:00","-","EST","1957","Sep","29","2:00"],["-6:00","-","CST","1958","Apr","27","2:00"],["-5:00","-","EST","1969"],["-5:00","US","E%sT","1971"],["-5:00","-","EST","2006"],["-5:00","US","E%sT"]],"America/Indiana/Marengo":[["-5:45:23","-","LMT","1883","Nov","18","12:14:37"],["-6:00","US","C%sT","1951"],["-6:00","Marengo","C%sT","1961","Apr","30","2:00"],["-5:00","-","EST","1969"],["-5:00","US","E%sT","1974","Jan","6","2:00"],["-6:00","1:00","CDT","1974","Oct","27","2:00"],["-5:00","US","E%sT","1976"],["-5:00","-","EST","2006"],["-5:00","US","E%sT"]],"America/Indiana/Vincennes":[["-5:50:07","-","LMT","1883","Nov","18","12:09:53"],["-6:00","US","C%sT","1946"],["-6:00","Vincennes","C%sT","1964","Apr","26","2:00"],["-5:00","-","EST","1969"],["-5:00","US","E%sT","1971"],["-5:00","-","EST","2006","Apr","2","2:00"],["-6:00","US","C%sT","2007","Nov","4","2:00"],["-5:00","US","E%sT"]],"America/Indiana/Tell_City":[["-5:47:03","-","LMT","1883","Nov","18","12:12:57"],["-6:00","US","C%sT","1946"],["-6:00","Perry","C%sT","1964","Apr","26","2:00"],["-5:00","-","EST","1969"],["-5:00","US","E%sT","1971"],["-5:00","-","EST","2006","Apr","2","2:00"],["-6:00","US","C%sT"]],"America/Indiana/Petersburg":[["-5:49:07","-","LMT","1883","Nov","18","12:10:53"],["-6:00","US","C%sT","1955"],["-6:00","Pike","C%sT","1965","Apr","25","2:00"],["-5:00","-","EST","1966","Oct","30","2:00"],["-6:00","US","C%sT","1977","Oct","30","2:00"],["-5:00","-","EST","2006","Apr","2","2:00"],["-6:00","US","C%sT","2007","Nov","4","2:00"],["-5:00","US","E%sT"]],"America/Indiana/Knox":[["-5:46:30","-","LMT","1883","Nov","18","12:13:30"],["-6:00","US","C%sT","1947"],["-6:00","Starke","C%sT","1962","Apr","29","2:00"],["-5:00","-","EST","1963","Oct","27","2:00"],["-6:00","US","C%sT","1991","Oct","27","2:00"],["-5:00","-","EST","2006","Apr","2","2:00"],["-6:00","US","C%sT"]],"America/Indiana/Winamac":[["-5:46:25","-","LMT","1883","Nov","18","12:13:35"],["-6:00","US","C%sT","1946"],["-6:00","Pulaski","C%sT","1961","Apr","30","2:00"],["-5:00","-","EST","1969"],["-5:00","US","E%sT","1971"],["-5:00","-","EST","2006","Apr","2","2:00"],["-6:00","US","C%sT","2007","Mar","11","2:00"],["-5:00","US","E%sT"]],"America/Indiana/Vevay":[["-5:40:16","-","LMT","1883","Nov","18","12:19:44"],["-6:00","US","C%sT","1954","Apr","25","2:00"],["-5:00","-","EST","1969"],["-5:00","US","E%sT","1973"],["-5:00","-","EST","2006"],["-5:00","US","E%sT"]],"America/Kentucky/Louisville":[["-5:43:02","-","LMT","1883","Nov","18","12:16:58"],["-6:00","US","C%sT","1921"],["-6:00","Louisville","C%sT","1942"],["-6:00","US","C%sT","1946"],["-6:00","Louisville","C%sT","1961","Jul","23","2:00"],["-5:00","-","EST","1968"],["-5:00","US","E%sT","1974","Jan","6","2:00"],["-6:00","1:00","CDT","1974","Oct","27","2:00"],["-5:00","US","E%sT"]],"America/Kentucky/Monticello":[["-5:39:24","-","LMT","1883","Nov","18","12:20:36"],["-6:00","US","C%sT","1946"],["-6:00","-","CST","1968"],["-6:00","US","C%sT","2000","Oct","29","2:00"],["-5:00","US","E%sT"]],"America/Detroit":[["-5:32:11","-","LMT","1905"],["-6:00","-","CST","1915","May","15","2:00"],["-5:00","-","EST","1942"],["-5:00","US","E%sT","1946"],["-5:00","Detroit","E%sT","1973"],["-5:00","US","E%sT","1975"],["-5:00","-","EST","1975","Apr","27","2:00"],["-5:00","US","E%sT"]],"America/Menominee":[["-5:50:27","-","LMT","1885","Sep","18","12:00"],["-6:00","US","C%sT","1946"],["-6:00","Menominee","C%sT","1969","Apr","27","2:00"],["-5:00","-","EST","1973","Apr","29","2:00"],["-6:00","US","C%sT"]],"America/St_Johns":[["-3:30:52","-","LMT","1884"],["-3:30:52","StJohns","N%sT","1918"],["-3:30:52","Canada","N%sT","1919"],["-3:30:52","StJohns","N%sT","1935","Mar","30"],["-3:30","StJohns","N%sT","1942","May","11"],["-3:30","Canada","N%sT","1946"],["-3:30","StJohns","N%sT"]],"America/Goose_Bay":[["-4:01:40","-","LMT","1884",""],["-3:30:52","-","NST","1918"],["-3:30:52","Canada","N%sT","1919"],["-3:30:52","-","NST","1935","Mar","30"],["-3:30","-","NST","1936"],["-3:30","StJohns","N%sT","1942","May","11"],["-3:30","Canada","N%sT","1946"],["-3:30","StJohns","N%sT","1966","Mar","15","2:00"],["-4:00","StJohns","A%sT"]],"America/Halifax":[["-4:14:24","-","LMT","1902","Jun","15"],["-4:00","Halifax","A%sT","1918"],["-4:00","Canada","A%sT","1919"],["-4:00","Halifax","A%sT","1942","Feb","9","2:00s"],["-4:00","Canada","A%sT","1946"],["-4:00","Halifax","A%sT","1974"],["-4:00","Canada","A%sT"]],"America/Glace_Bay":[["-3:59:48","-","LMT","1902","Jun","15"],["-4:00","Canada","A%sT","1953"],["-4:00","Halifax","A%sT","1954"],["-4:00","-","AST","1972"],["-4:00","Halifax","A%sT","1974"],["-4:00","Canada","A%sT"]],"America/Moncton":[["-4:19:08","-","LMT","1883","Dec","9"],["-5:00","-","EST","1902","Jun","15"],["-4:00","Canada","A%sT","1933"],["-4:00","Moncton","A%sT","1942"],["-4:00","Canada","A%sT","1946"],["-4:00","Moncton","A%sT","1973"],["-4:00","Canada","A%sT","1993"],["-4:00","Moncton","A%sT","2007"],["-4:00","Canada","A%sT"]],"America/Blanc-Sablon":[["-3:48:28","-","LMT","1884"],["-4:00","Canada","A%sT","1970"],["-4:00","-","AST"]],"America/Montreal":[["-4:54:16","-","LMT","1884"],["-5:00","Mont","E%sT","1918"],["-5:00","Canada","E%sT","1919"],["-5:00","Mont","E%sT","1942","Feb","9","2:00s"],["-5:00","Canada","E%sT","1946"],["-5:00","Mont","E%sT","1974"],["-5:00","Canada","E%sT"]],"America/Toronto":[["-5:17:32","-","LMT","1895"],["-5:00","Canada","E%sT","1919"],["-5:00","Toronto","E%sT","1942","Feb","9","2:00s"],["-5:00","Canada","E%sT","1946"],["-5:00","Toronto","E%sT","1974"],["-5:00","Canada","E%sT"]],"America/Thunder_Bay":[["-5:57:00","-","LMT","1895"],["-6:00","-","CST","1910"],["-5:00","-","EST","1942"],["-5:00","Canada","E%sT","1970"],["-5:00","Mont","E%sT","1973"],["-5:00","-","EST","1974"],["-5:00","Canada","E%sT"]],"America/Nipigon":[["-5:53:04","-","LMT","1895"],["-5:00","Canada","E%sT","1940","Sep","29"],["-5:00","1:00","EDT","1942","Feb","9","2:00s"],["-5:00","Canada","E%sT"]],"America/Rainy_River":[["-6:18:16","-","LMT","1895"],["-6:00","Canada","C%sT","1940","Sep","29"],["-6:00","1:00","CDT","1942","Feb","9","2:00s"],["-6:00","Canada","C%sT"]],"America/Atikokan":[["-6:06:28","-","LMT","1895"],["-6:00","Canada","C%sT","1940","Sep","29"],["-6:00","1:00","CDT","1942","Feb","9","2:00s"],["-6:00","Canada","C%sT","1945","Sep","30","2:00"],["-5:00","-","EST"]],"America/Winnipeg":[["-6:28:36","-","LMT","1887","Jul","16"],["-6:00","Winn","C%sT","2006"],["-6:00","Canada","C%sT"]],"America/Regina":[["-6:58:36","-","LMT","1905","Sep"],["-7:00","Regina","M%sT","1960","Apr","lastSun","2:00"],["-6:00","-","CST"]],"America/Swift_Current":[["-7:11:20","-","LMT","1905","Sep"],["-7:00","Canada","M%sT","1946","Apr","lastSun","2:00"],["-7:00","Regina","M%sT","1950"],["-7:00","Swift","M%sT","1972","Apr","lastSun","2:00"],["-6:00","-","CST"]],"America/Edmonton":[["-7:33:52","-","LMT","1906","Sep"],["-7:00","Edm","M%sT","1987"],["-7:00","Canada","M%sT"]],"America/Vancouver":[["-8:12:28","-","LMT","1884"],["-8:00","Vanc","P%sT","1987"],["-8:00","Canada","P%sT"]],"America/Dawson_Creek":[["-8:00:56","-","LMT","1884"],["-8:00","Canada","P%sT","1947"],["-8:00","Vanc","P%sT","1972","Aug","30","2:00"],["-7:00","-","MST"]],"America/Pangnirtung":[["0","-","zzz","1921",""],["-4:00","NT_YK","A%sT","1995","Apr","Sun>=1","2:00"],["-5:00","Canada","E%sT","1999","Oct","31","2:00"],["-6:00","Canada","C%sT","2000","Oct","29","2:00"],["-5:00","Canada","E%sT"]],"America/Iqaluit":[["0","-","zzz","1942","Aug",""],["-5:00","NT_YK","E%sT","1999","Oct","31","2:00"],["-6:00","Canada","C%sT","2000","Oct","29","2:00"],["-5:00","Canada","E%sT"]],"America/Resolute":[["0","-","zzz","1947","Aug","31",""],["-6:00","NT_YK","C%sT","2000","Oct","29","2:00"],["-5:00","-","EST","2001","Apr","1","3:00"],["-6:00","Canada","C%sT","2006","Oct","29","2:00"],["-5:00","Resolute","%sT"]],"America/Rankin_Inlet":[["0","-","zzz","1957",""],["-6:00","NT_YK","C%sT","2000","Oct","29","2:00"],["-5:00","-","EST","2001","Apr","1","3:00"],["-6:00","Canada","C%sT"]],"America/Cambridge_Bay":[["0","-","zzz","1920",""],["-7:00","NT_YK","M%sT","1999","Oct","31","2:00"],["-6:00","Canada","C%sT","2000","Oct","29","2:00"],["-5:00","-","EST","2000","Nov","5","0:00"],["-6:00","-","CST","2001","Apr","1","3:00"],["-7:00","Canada","M%sT"]],"America/Yellowknife":[["0","-","zzz","1935",""],["-7:00","NT_YK","M%sT","1980"],["-7:00","Canada","M%sT"]],"America/Inuvik":[["0","-","zzz","1953",""],["-8:00","NT_YK","P%sT","1979","Apr","lastSun","2:00"],["-7:00","NT_YK","M%sT","1980"],["-7:00","Canada","M%sT"]],"America/Whitehorse":[["-9:00:12","-","LMT","1900","Aug","20"],["-9:00","NT_YK","Y%sT","1966","Jul","1","2:00"],["-8:00","NT_YK","P%sT","1980"],["-8:00","Canada","P%sT"]],"America/Dawson":[["-9:17:40","-","LMT","1900","Aug","20"],["-9:00","NT_YK","Y%sT","1973","Oct","28","0:00"],["-8:00","NT_YK","P%sT","1980"],["-8:00","Canada","P%sT"]],"America/Cancun":[["-5:47:04","-","LMT","1922","Jan","1","0:12:56"],["-6:00","-","CST","1981","Dec","23"],["-5:00","Mexico","E%sT","1998","Aug","2","2:00"],["-6:00","Mexico","C%sT"]],"America/Merida":[["-5:58:28","-","LMT","1922","Jan","1","0:01:32"],["-6:00","-","CST","1981","Dec","23"],["-5:00","-","EST","1982","Dec","2"],["-6:00","Mexico","C%sT"]],"America/Matamoros":[["-6:40:00","-","LMT","1921","Dec","31","23:20:00"],["-6:00","-","CST","1988"],["-6:00","US","C%sT","1989"],["-6:00","Mexico","C%sT","2010"],["-6:00","US","C%sT"]],"America/Monterrey":[["-6:41:16","-","LMT","1921","Dec","31","23:18:44"],["-6:00","-","CST","1988"],["-6:00","US","C%sT","1989"],["-6:00","Mexico","C%sT"]],"America/Mexico_City":[["-6:36:36","-","LMT","1922","Jan","1","0:23:24"],["-7:00","-","MST","1927","Jun","10","23:00"],["-6:00","-","CST","1930","Nov","15"],["-7:00","-","MST","1931","May","1","23:00"],["-6:00","-","CST","1931","Oct"],["-7:00","-","MST","1932","Apr","1"],["-6:00","Mexico","C%sT","2001","Sep","30","02:00"],["-6:00","-","CST","2002","Feb","20"],["-6:00","Mexico","C%sT"]],"America/Ojinaga":[["-6:57:40","-","LMT","1922","Jan","1","0:02:20"],["-7:00","-","MST","1927","Jun","10","23:00"],["-6:00","-","CST","1930","Nov","15"],["-7:00","-","MST","1931","May","1","23:00"],["-6:00","-","CST","1931","Oct"],["-7:00","-","MST","1932","Apr","1"],["-6:00","-","CST","1996"],["-6:00","Mexico","C%sT","1998"],["-6:00","-","CST","1998","Apr","Sun>=1","3:00"],["-7:00","Mexico","M%sT","2010"],["-7:00","US","M%sT"]],"America/Chihuahua":[["-7:04:20","-","LMT","1921","Dec","31","23:55:40"],["-7:00","-","MST","1927","Jun","10","23:00"],["-6:00","-","CST","1930","Nov","15"],["-7:00","-","MST","1931","May","1","23:00"],["-6:00","-","CST","1931","Oct"],["-7:00","-","MST","1932","Apr","1"],["-6:00","-","CST","1996"],["-6:00","Mexico","C%sT","1998"],["-6:00","-","CST","1998","Apr","Sun>=1","3:00"],["-7:00","Mexico","M%sT"]],"America/Hermosillo":[["-7:23:52","-","LMT","1921","Dec","31","23:36:08"],["-7:00","-","MST","1927","Jun","10","23:00"],["-6:00","-","CST","1930","Nov","15"],["-7:00","-","MST","1931","May","1","23:00"],["-6:00","-","CST","1931","Oct"],["-7:00","-","MST","1932","Apr","1"],["-6:00","-","CST","1942","Apr","24"],["-7:00","-","MST","1949","Jan","14"],["-8:00","-","PST","1970"],["-7:00","Mexico","M%sT","1999"],["-7:00","-","MST"]],"America/Mazatlan":[["-7:05:40","-","LMT","1921","Dec","31","23:54:20"],["-7:00","-","MST","1927","Jun","10","23:00"],["-6:00","-","CST","1930","Nov","15"],["-7:00","-","MST","1931","May","1","23:00"],["-6:00","-","CST","1931","Oct"],["-7:00","-","MST","1932","Apr","1"],["-6:00","-","CST","1942","Apr","24"],["-7:00","-","MST","1949","Jan","14"],["-8:00","-","PST","1970"],["-7:00","Mexico","M%sT"]],"America/Bahia_Banderas":[["-7:01:00","-","LMT","1921","Dec","31","23:59:00"],["-7:00","-","MST","1927","Jun","10","23:00"],["-6:00","-","CST","1930","Nov","15"],["-7:00","-","MST","1931","May","1","23:00"],["-6:00","-","CST","1931","Oct"],["-7:00","-","MST","1932","Apr","1"],["-6:00","-","CST","1942","Apr","24"],["-7:00","-","MST","1949","Jan","14"],["-8:00","-","PST","1970"],["-7:00","Mexico","M%sT","2010","Apr","4","2:00"],["-6:00","Mexico","C%sT"]],"America/Tijuana":[["-7:48:04","-","LMT","1922","Jan","1","0:11:56"],["-7:00","-","MST","1924"],["-8:00","-","PST","1927","Jun","10","23:00"],["-7:00","-","MST","1930","Nov","15"],["-8:00","-","PST","1931","Apr","1"],["-8:00","1:00","PDT","1931","Sep","30"],["-8:00","-","PST","1942","Apr","24"],["-8:00","1:00","PWT","1945","Aug","14","23:00u"],["-8:00","1:00","PPT","1945","Nov","12",""],["-8:00","-","PST","1948","Apr","5"],["-8:00","1:00","PDT","1949","Jan","14"],["-8:00","-","PST","1954"],["-8:00","CA","P%sT","1961"],["-8:00","-","PST","1976"],["-8:00","US","P%sT","1996"],["-8:00","Mexico","P%sT","2001"],["-8:00","US","P%sT","2002","Feb","20"],["-8:00","Mexico","P%sT","2010"],["-8:00","US","P%sT"]],"America/Santa_Isabel":[["-7:39:28","-","LMT","1922","Jan","1","0:20:32"],["-7:00","-","MST","1924"],["-8:00","-","PST","1927","Jun","10","23:00"],["-7:00","-","MST","1930","Nov","15"],["-8:00","-","PST","1931","Apr","1"],["-8:00","1:00","PDT","1931","Sep","30"],["-8:00","-","PST","1942","Apr","24"],["-8:00","1:00","PWT","1945","Aug","14","23:00u"],["-8:00","1:00","PPT","1945","Nov","12",""],["-8:00","-","PST","1948","Apr","5"],["-8:00","1:00","PDT","1949","Jan","14"],["-8:00","-","PST","1954"],["-8:00","CA","P%sT","1961"],["-8:00","-","PST","1976"],["-8:00","US","P%sT","1996"],["-8:00","Mexico","P%sT","2001"],["-8:00","US","P%sT","2002","Feb","20"],["-8:00","Mexico","P%sT"]],"America/Anguilla":[["-4:12:16","-","LMT","1912","Mar","2"],["-4:00","-","AST"]],"America/Antigua":[["-4:07:12","-","LMT","1912","Mar","2"],["-5:00","-","EST","1951"],["-4:00","-","AST"]],"America/Nassau":[["-5:09:24","-","LMT","1912","Mar","2"],["-5:00","Bahamas","E%sT","1976"],["-5:00","US","E%sT"]],"America/Barbados":[["-3:58:28","-","LMT","1924",""],["-3:58:28","-","BMT","1932",""],["-4:00","Barb","A%sT"]],"America/Belize":[["-5:52:48","-","LMT","1912","Apr"],["-6:00","Belize","C%sT"]],"Atlantic/Bermuda":[["-4:19:04","-","LMT","1930","Jan","1","2:00",""],["-4:00","-","AST","1974","Apr","28","2:00"],["-4:00","Bahamas","A%sT","1976"],["-4:00","US","A%sT"]],"America/Cayman":[["-5:25:32","-","LMT","1890",""],["-5:07:12","-","KMT","1912","Feb",""],["-5:00","-","EST"]],"America/Costa_Rica":[["-5:36:20","-","LMT","1890",""],["-5:36:20","-","SJMT","1921","Jan","15",""],["-6:00","CR","C%sT"]],"America/Havana":[["-5:29:28","-","LMT","1890"],["-5:29:36","-","HMT","1925","Jul","19","12:00",""],["-5:00","Cuba","C%sT"]],"America/Dominica":[["-4:05:36","-","LMT","1911","Jul","1","0:01",""],["-4:00","-","AST"]],"America/Santo_Domingo":[["-4:39:36","-","LMT","1890"],["-4:40","-","SDMT","1933","Apr","1","12:00",""],["-5:00","DR","E%sT","1974","Oct","27"],["-4:00","-","AST","2000","Oct","29","02:00"],["-5:00","US","E%sT","2000","Dec","3","01:00"],["-4:00","-","AST"]],"America/El_Salvador":[["-5:56:48","-","LMT","1921",""],["-6:00","Salv","C%sT"]],"America/Grenada":[["-4:07:00","-","LMT","1911","Jul",""],["-4:00","-","AST"]],"America/Guadeloupe":[["-4:06:08","-","LMT","1911","Jun","8",""],["-4:00","-","AST"]],"America/St_Barthelemy":"America/Guadeloupe","America/Marigot":"America/Guadeloupe","America/Guatemala":[["-6:02:04","-","LMT","1918","Oct","5"],["-6:00","Guat","C%sT"]],"America/Port-au-Prince":[["-4:49:20","-","LMT","1890"],["-4:49","-","PPMT","1917","Jan","24","12:00",""],["-5:00","Haiti","E%sT"]],"America/Tegucigalpa":[["-5:48:52","-","LMT","1921","Apr"],["-6:00","Hond","C%sT"]],"America/Jamaica":[["-5:07:12","-","LMT","1890",""],["-5:07:12","-","KMT","1912","Feb",""],["-5:00","-","EST","1974","Apr","28","2:00"],["-5:00","US","E%sT","1984"],["-5:00","-","EST"]],"America/Martinique":[["-4:04:20","-","LMT","1890",""],["-4:04:20","-","FFMT","1911","May",""],["-4:00","-","AST","1980","Apr","6"],["-4:00","1:00","ADT","1980","Sep","28"],["-4:00","-","AST"]],"America/Montserrat":[["-4:08:52","-","LMT","1911","Jul","1","0:01",""],["-4:00","-","AST"]],"America/Managua":[["-5:45:08","-","LMT","1890"],["-5:45:12","-","MMT","1934","Jun","23",""],["-6:00","-","CST","1973","May"],["-5:00","-","EST","1975","Feb","16"],["-6:00","Nic","C%sT","1992","Jan","1","4:00"],["-5:00","-","EST","1992","Sep","24"],["-6:00","-","CST","1993"],["-5:00","-","EST","1997"],["-6:00","Nic","C%sT"]],"America/Panama":[["-5:18:08","-","LMT","1890"],["-5:19:36","-","CMT","1908","Apr","22",""],["-5:00","-","EST"]],"America/Puerto_Rico":[["-4:24:25","-","LMT","1899","Mar","28","12:00",""],["-4:00","-","AST","1942","May","3"],["-4:00","US","A%sT","1946"],["-4:00","-","AST"]],"America/St_Kitts":[["-4:10:52","-","LMT","1912","Mar","2",""],["-4:00","-","AST"]],"America/St_Lucia":[["-4:04:00","-","LMT","1890",""],["-4:04:00","-","CMT","1912",""],["-4:00","-","AST"]],"America/Miquelon":[["-3:44:40","-","LMT","1911","May","15",""],["-4:00","-","AST","1980","May"],["-3:00","-","PMST","1987",""],["-3:00","Canada","PM%sT"]],"America/St_Vincent":[["-4:04:56","-","LMT","1890",""],["-4:04:56","-","KMT","1912",""],["-4:00","-","AST"]],"America/Grand_Turk":[["-4:44:32","-","LMT","1890"],["-5:07:12","-","KMT","1912","Feb",""],["-5:00","TC","E%sT"]],"America/Tortola":[["-4:18:28","-","LMT","1911","Jul",""],["-4:00","-","AST"]],"America/St_Thomas":[["-4:19:44","-","LMT","1911","Jul",""],["-4:00","-","AST"]]};
timezoneJS.timezone.rules = {"GB-Eire":[["1916","only","-","May","21","2:00s","1:00","BST"],["1916","only","-","Oct","1","2:00s","0","GMT"],["1917","only","-","Apr","8","2:00s","1:00","BST"],["1917","only","-","Sep","17","2:00s","0","GMT"],["1918","only","-","Mar","24","2:00s","1:00","BST"],["1918","only","-","Sep","30","2:00s","0","GMT"],["1919","only","-","Mar","30","2:00s","1:00","BST"],["1919","only","-","Sep","29","2:00s","0","GMT"],["1920","only","-","Mar","28","2:00s","1:00","BST"],["1920","only","-","Oct","25","2:00s","0","GMT"],["1921","only","-","Apr","3","2:00s","1:00","BST"],["1921","only","-","Oct","3","2:00s","0","GMT"],["1922","only","-","Mar","26","2:00s","1:00","BST"],["1922","only","-","Oct","8","2:00s","0","GMT"],["1923","only","-","Apr","Sun>=16","2:00s","1:00","BST"],["1923","1924","-","Sep","Sun>=16","2:00s","0","GMT"],["1924","only","-","Apr","Sun>=9","2:00s","1:00","BST"],["1925","1926","-","Apr","Sun>=16","2:00s","1:00","BST"],["1925","1938","-","Oct","Sun>=2","2:00s","0","GMT"],["1927","only","-","Apr","Sun>=9","2:00s","1:00","BST"],["1928","1929","-","Apr","Sun>=16","2:00s","1:00","BST"],["1930","only","-","Apr","Sun>=9","2:00s","1:00","BST"],["1931","1932","-","Apr","Sun>=16","2:00s","1:00","BST"],["1933","only","-","Apr","Sun>=9","2:00s","1:00","BST"],["1934","only","-","Apr","Sun>=16","2:00s","1:00","BST"],["1935","only","-","Apr","Sun>=9","2:00s","1:00","BST"],["1936","1937","-","Apr","Sun>=16","2:00s","1:00","BST"],["1938","only","-","Apr","Sun>=9","2:00s","1:00","BST"],["1939","only","-","Apr","Sun>=16","2:00s","1:00","BST"],["1939","only","-","Nov","Sun>=16","2:00s","0","GMT"],["1940","only","-","Feb","Sun>=23","2:00s","1:00","BST"],["1941","only","-","May","Sun>=2","1:00s","2:00","BDST"],["1941","1943","-","Aug","Sun>=9","1:00s","1:00","BST"],["1942","1944","-","Apr","Sun>=2","1:00s","2:00","BDST"],["1944","only","-","Sep","Sun>=16","1:00s","1:00","BST"],["1945","only","-","Apr","Mon>=2","1:00s","2:00","BDST"],["1945","only","-","Jul","Sun>=9","1:00s","1:00","BST"],["1945","1946","-","Oct","Sun>=2","2:00s","0","GMT"],["1946","only","-","Apr","Sun>=9","2:00s","1:00","BST"],["1947","only","-","Mar","16","2:00s","1:00","BST"],["1947","only","-","Apr","13","1:00s","2:00","BDST"],["1947","only","-","Aug","10","1:00s","1:00","BST"],["1947","only","-","Nov","2","2:00s","0","GMT"],["1948","only","-","Mar","14","2:00s","1:00","BST"],["1948","only","-","Oct","31","2:00s","0","GMT"],["1949","only","-","Apr","3","2:00s","1:00","BST"],["1949","only","-","Oct","30","2:00s","0","GMT"],["1950","1952","-","Apr","Sun>=14","2:00s","1:00","BST"],["1950","1952","-","Oct","Sun>=21","2:00s","0","GMT"],["1953","only","-","Apr","Sun>=16","2:00s","1:00","BST"],["1953","1960","-","Oct","Sun>=2","2:00s","0","GMT"],["1954","only","-","Apr","Sun>=9","2:00s","1:00","BST"],["1955","1956","-","Apr","Sun>=16","2:00s","1:00","BST"],["1957","only","-","Apr","Sun>=9","2:00s","1:00","BST"],["1958","1959","-","Apr","Sun>=16","2:00s","1:00","BST"],["1960","only","-","Apr","Sun>=9","2:00s","1:00","BST"],["1961","1963","-","Mar","lastSun","2:00s","1:00","BST"],["1961","1968","-","Oct","Sun>=23","2:00s","0","GMT"],["1964","1967","-","Mar","Sun>=19","2:00s","1:00","BST"],["1968","only","-","Feb","18","2:00s","1:00","BST"],["1972","1980","-","Mar","Sun>=16","2:00s","1:00","BST"],["1972","1980","-","Oct","Sun>=23","2:00s","0","GMT"],["1981","1995","-","Mar","lastSun","1:00u","1:00","BST"],["1981","1989","-","Oct","Sun>=23","1:00u","0","GMT"],["1990","1995","-","Oct","Sun>=22","1:00u","0","GMT"]],"EU":[["1977","1980","-","Apr","Sun>=1","1:00u","1:00","S"],["1977","only","-","Sep","lastSun","1:00u","0","-"],["1978","only","-","Oct","1","1:00u","0","-"],["1979","1995","-","Sep","lastSun","1:00u","0","-"],["1981","max","-","Mar","lastSun","1:00u","1:00","S"],["1996","max","-","Oct","lastSun","1:00u","0","-"]],"W-Eur":[["1977","1980","-","Apr","Sun>=1","1:00s","1:00","S"],["1977","only","-","Sep","lastSun","1:00s","0","-"],["1978","only","-","Oct","1","1:00s","0","-"],["1979","1995","-","Sep","lastSun","1:00s","0","-"],["1981","max","-","Mar","lastSun","1:00s","1:00","S"],["1996","max","-","Oct","lastSun","1:00s","0","-"]],"C-Eur":[["1916","only","-","Apr","30","23:00","1:00","S"],["1916","only","-","Oct","1","1:00","0","-"],["1917","1918","-","Apr","Mon>=15","2:00s","1:00","S"],["1917","1918","-","Sep","Mon>=15","2:00s","0","-"],["1940","only","-","Apr","1","2:00s","1:00","S"],["1942","only","-","Nov","2","2:00s","0","-"],["1943","only","-","Mar","29","2:00s","1:00","S"],["1943","only","-","Oct","4","2:00s","0","-"],["1944","1945","-","Apr","Mon>=1","2:00s","1:00","S"],["1944","only","-","Oct","2","2:00s","0","-"],["1945","only","-","Sep","16","2:00s","0","-"],["1977","1980","-","Apr","Sun>=1","2:00s","1:00","S"],["1977","only","-","Sep","lastSun","2:00s","0","-"],["1978","only","-","Oct","1","2:00s","0","-"],["1979","1995","-","Sep","lastSun","2:00s","0","-"],["1981","max","-","Mar","lastSun","2:00s","1:00","S"],["1996","max","-","Oct","lastSun","2:00s","0","-"]],"E-Eur":[["1977","1980","-","Apr","Sun>=1","0:00","1:00","S"],["1977","only","-","Sep","lastSun","0:00","0","-"],["1978","only","-","Oct","1","0:00","0","-"],["1979","1995","-","Sep","lastSun","0:00","0","-"],["1981","max","-","Mar","lastSun","0:00","1:00","S"],["1996","max","-","Oct","lastSun","0:00","0","-"]],"Russia":[["1917","only","-","Jul","1","23:00","1:00","MST",""],["1917","only","-","Dec","28","0:00","0","MMT",""],["1918","only","-","May","31","22:00","2:00","MDST",""],["1918","only","-","Sep","16","1:00","1:00","MST"],["1919","only","-","May","31","23:00","2:00","MDST"],["1919","only","-","Jul","1","2:00","1:00","S"],["1919","only","-","Aug","16","0:00","0","-"],["1921","only","-","Feb","14","23:00","1:00","S"],["1921","only","-","Mar","20","23:00","2:00","M",""],["1921","only","-","Sep","1","0:00","1:00","S"],["1921","only","-","Oct","1","0:00","0","-"],["1981","1984","-","Apr","1","0:00","1:00","S"],["1981","1983","-","Oct","1","0:00","0","-"],["1984","1991","-","Sep","lastSun","2:00s","0","-"],["1985","1991","-","Mar","lastSun","2:00s","1:00","S"],["1992","only","-","Mar","lastSat","23:00","1:00","S"],["1992","only","-","Sep","lastSat","23:00","0","-"],["1993","max","-","Mar","lastSun","2:00s","1:00","S"],["1993","1995","-","Sep","lastSun","2:00s","0","-"],["1996","max","-","Oct","lastSun","2:00s","0","-"]],"Albania":[["1940","only","-","Jun","16","0:00","1:00","S"],["1942","only","-","Nov","2","3:00","0","-"],["1943","only","-","Mar","29","2:00","1:00","S"],["1943","only","-","Apr","10","3:00","0","-"],["1974","only","-","May","4","0:00","1:00","S"],["1974","only","-","Oct","2","0:00","0","-"],["1975","only","-","May","1","0:00","1:00","S"],["1975","only","-","Oct","2","0:00","0","-"],["1976","only","-","May","2","0:00","1:00","S"],["1976","only","-","Oct","3","0:00","0","-"],["1977","only","-","May","8","0:00","1:00","S"],["1977","only","-","Oct","2","0:00","0","-"],["1978","only","-","May","6","0:00","1:00","S"],["1978","only","-","Oct","1","0:00","0","-"],["1979","only","-","May","5","0:00","1:00","S"],["1979","only","-","Sep","30","0:00","0","-"],["1980","only","-","May","3","0:00","1:00","S"],["1980","only","-","Oct","4","0:00","0","-"],["1981","only","-","Apr","26","0:00","1:00","S"],["1981","only","-","Sep","27","0:00","0","-"],["1982","only","-","May","2","0:00","1:00","S"],["1982","only","-","Oct","3","0:00","0","-"],["1983","only","-","Apr","18","0:00","1:00","S"],["1983","only","-","Oct","1","0:00","0","-"],["1984","only","-","Apr","1","0:00","1:00","S"]],"Austria":[["1920","only","-","Apr","5","2:00s","1:00","S"],["1920","only","-","Sep","13","2:00s","0","-"],["1946","only","-","Apr","14","2:00s","1:00","S"],["1946","1948","-","Oct","Sun>=1","2:00s","0","-"],["1947","only","-","Apr","6","2:00s","1:00","S"],["1948","only","-","Apr","18","2:00s","1:00","S"],["1980","only","-","Apr","6","0:00","1:00","S"],["1980","only","-","Sep","28","0:00","0","-"]],"Belgium":[["1918","only","-","Mar","9","0:00s","1:00","S"],["1918","1919","-","Oct","Sat>=1","23:00s","0","-"],["1919","only","-","Mar","1","23:00s","1:00","S"],["1920","only","-","Feb","14","23:00s","1:00","S"],["1920","only","-","Oct","23","23:00s","0","-"],["1921","only","-","Mar","14","23:00s","1:00","S"],["1921","only","-","Oct","25","23:00s","0","-"],["1922","only","-","Mar","25","23:00s","1:00","S"],["1922","1927","-","Oct","Sat>=1","23:00s","0","-"],["1923","only","-","Apr","21","23:00s","1:00","S"],["1924","only","-","Mar","29","23:00s","1:00","S"],["1925","only","-","Apr","4","23:00s","1:00","S"],["1926","only","-","Apr","17","23:00s","1:00","S"],["1927","only","-","Apr","9","23:00s","1:00","S"],["1928","only","-","Apr","14","23:00s","1:00","S"],["1928","1938","-","Oct","Sun>=2","2:00s","0","-"],["1929","only","-","Apr","21","2:00s","1:00","S"],["1930","only","-","Apr","13","2:00s","1:00","S"],["1931","only","-","Apr","19","2:00s","1:00","S"],["1932","only","-","Apr","3","2:00s","1:00","S"],["1933","only","-","Mar","26","2:00s","1:00","S"],["1934","only","-","Apr","8","2:00s","1:00","S"],["1935","only","-","Mar","31","2:00s","1:00","S"],["1936","only","-","Apr","19","2:00s","1:00","S"],["1937","only","-","Apr","4","2:00s","1:00","S"],["1938","only","-","Mar","27","2:00s","1:00","S"],["1939","only","-","Apr","16","2:00s","1:00","S"],["1939","only","-","Nov","19","2:00s","0","-"],["1940","only","-","Feb","25","2:00s","1:00","S"],["1944","only","-","Sep","17","2:00s","0","-"],["1945","only","-","Apr","2","2:00s","1:00","S"],["1945","only","-","Sep","16","2:00s","0","-"],["1946","only","-","May","19","2:00s","1:00","S"],["1946","only","-","Oct","7","2:00s","0","-"]],"Bulg":[["1979","only","-","Mar","31","23:00","1:00","S"],["1979","only","-","Oct","1","1:00","0","-"],["1980","1982","-","Apr","Sat>=1","23:00","1:00","S"],["1980","only","-","Sep","29","1:00","0","-"],["1981","only","-","Sep","27","2:00","0","-"]],"Czech":[["1945","only","-","Apr","8","2:00s","1:00","S"],["1945","only","-","Nov","18","2:00s","0","-"],["1946","only","-","May","6","2:00s","1:00","S"],["1946","1949","-","Oct","Sun>=1","2:00s","0","-"],["1947","only","-","Apr","20","2:00s","1:00","S"],["1948","only","-","Apr","18","2:00s","1:00","S"],["1949","only","-","Apr","9","2:00s","1:00","S"]],"Denmark":[["1916","only","-","May","14","23:00","1:00","S"],["1916","only","-","Sep","30","23:00","0","-"],["1940","only","-","May","15","0:00","1:00","S"],["1945","only","-","Apr","2","2:00s","1:00","S"],["1945","only","-","Aug","15","2:00s","0","-"],["1946","only","-","May","1","2:00s","1:00","S"],["1946","only","-","Sep","1","2:00s","0","-"],["1947","only","-","May","4","2:00s","1:00","S"],["1947","only","-","Aug","10","2:00s","0","-"],["1948","only","-","May","9","2:00s","1:00","S"],["1948","only","-","Aug","8","2:00s","0","-"]],"Thule":[["1991","1992","-","Mar","lastSun","2:00","1:00","D"],["1991","1992","-","Sep","lastSun","2:00","0","S"],["1993","2006","-","Apr","Sun>=1","2:00","1:00","D"],["1993","2006","-","Oct","lastSun","2:00","0","S"],["2007","max","-","Mar","Sun>=8","2:00","1:00","D"],["2007","max","-","Nov","Sun>=1","2:00","0","S"]],"Finland":[["1942","only","-","Apr","3","0:00","1:00","S"],["1942","only","-","Oct","3","0:00","0","-"],["1981","1982","-","Mar","lastSun","2:00","1:00","S"],["1981","1982","-","Sep","lastSun","3:00","0","-"]],"France":[["1916","only","-","Jun","14","23:00s","1:00","S"],["1916","1919","-","Oct","Sun>=1","23:00s","0","-"],["1917","only","-","Mar","24","23:00s","1:00","S"],["1918","only","-","Mar","9","23:00s","1:00","S"],["1919","only","-","Mar","1","23:00s","1:00","S"],["1920","only","-","Feb","14","23:00s","1:00","S"],["1920","only","-","Oct","23","23:00s","0","-"],["1921","only","-","Mar","14","23:00s","1:00","S"],["1921","only","-","Oct","25","23:00s","0","-"],["1922","only","-","Mar","25","23:00s","1:00","S"],["1922","1938","-","Oct","Sat>=1","23:00s","0","-"],["1923","only","-","May","26","23:00s","1:00","S"],["1924","only","-","Mar","29","23:00s","1:00","S"],["1925","only","-","Apr","4","23:00s","1:00","S"],["1926","only","-","Apr","17","23:00s","1:00","S"],["1927","only","-","Apr","9","23:00s","1:00","S"],["1928","only","-","Apr","14","23:00s","1:00","S"],["1929","only","-","Apr","20","23:00s","1:00","S"],["1930","only","-","Apr","12","23:00s","1:00","S"],["1931","only","-","Apr","18","23:00s","1:00","S"],["1932","only","-","Apr","2","23:00s","1:00","S"],["1933","only","-","Mar","25","23:00s","1:00","S"],["1934","only","-","Apr","7","23:00s","1:00","S"],["1935","only","-","Mar","30","23:00s","1:00","S"],["1936","only","-","Apr","18","23:00s","1:00","S"],["1937","only","-","Apr","3","23:00s","1:00","S"],["1938","only","-","Mar","26","23:00s","1:00","S"],["1939","only","-","Apr","15","23:00s","1:00","S"],["1939","only","-","Nov","18","23:00s","0","-"],["1940","only","-","Feb","25","2:00","1:00","S"],["1941","only","-","May","5","0:00","2:00","M",""],["1941","only","-","Oct","6","0:00","1:00","S"],["1942","only","-","Mar","9","0:00","2:00","M"],["1942","only","-","Nov","2","3:00","1:00","S"],["1943","only","-","Mar","29","2:00","2:00","M"],["1943","only","-","Oct","4","3:00","1:00","S"],["1944","only","-","Apr","3","2:00","2:00","M"],["1944","only","-","Oct","8","1:00","1:00","S"],["1945","only","-","Apr","2","2:00","2:00","M"],["1945","only","-","Sep","16","3:00","0","-"],["1976","only","-","Mar","28","1:00","1:00","S"],["1976","only","-","Sep","26","1:00","0","-"]],"Germany":[["1946","only","-","Apr","14","2:00s","1:00","S"],["1946","only","-","Oct","7","2:00s","0","-"],["1947","1949","-","Oct","Sun>=1","2:00s","0","-"],["1947","only","-","Apr","6","3:00s","1:00","S"],["1947","only","-","May","11","2:00s","2:00","M"],["1947","only","-","Jun","29","3:00","1:00","S"],["1948","only","-","Apr","18","2:00s","1:00","S"],["1949","only","-","Apr","10","2:00s","1:00","S"]],"SovietZone":[["1945","only","-","May","24","2:00","2:00","M",""],["1945","only","-","Sep","24","3:00","1:00","S"],["1945","only","-","Nov","18","2:00s","0","-"]],"Greece":[["1932","only","-","Jul","7","0:00","1:00","S"],["1932","only","-","Sep","1","0:00","0","-"],["1941","only","-","Apr","7","0:00","1:00","S"],["1942","only","-","Nov","2","3:00","0","-"],["1943","only","-","Mar","30","0:00","1:00","S"],["1943","only","-","Oct","4","0:00","0","-"],["1952","only","-","Jul","1","0:00","1:00","S"],["1952","only","-","Nov","2","0:00","0","-"],["1975","only","-","Apr","12","0:00s","1:00","S"],["1975","only","-","Nov","26","0:00s","0","-"],["1976","only","-","Apr","11","2:00s","1:00","S"],["1976","only","-","Oct","10","2:00s","0","-"],["1977","1978","-","Apr","Sun>=1","2:00s","1:00","S"],["1977","only","-","Sep","26","2:00s","0","-"],["1978","only","-","Sep","24","4:00","0","-"],["1979","only","-","Apr","1","9:00","1:00","S"],["1979","only","-","Sep","29","2:00","0","-"],["1980","only","-","Apr","1","0:00","1:00","S"],["1980","only","-","Sep","28","0:00","0","-"]],"Hungary":[["1918","only","-","Apr","1","3:00","1:00","S"],["1918","only","-","Sep","29","3:00","0","-"],["1919","only","-","Apr","15","3:00","1:00","S"],["1919","only","-","Sep","15","3:00","0","-"],["1920","only","-","Apr","5","3:00","1:00","S"],["1920","only","-","Sep","30","3:00","0","-"],["1945","only","-","May","1","23:00","1:00","S"],["1945","only","-","Nov","3","0:00","0","-"],["1946","only","-","Mar","31","2:00s","1:00","S"],["1946","1949","-","Oct","Sun>=1","2:00s","0","-"],["1947","1949","-","Apr","Sun>=4","2:00s","1:00","S"],["1950","only","-","Apr","17","2:00s","1:00","S"],["1950","only","-","Oct","23","2:00s","0","-"],["1954","1955","-","May","23","0:00","1:00","S"],["1954","1955","-","Oct","3","0:00","0","-"],["1956","only","-","Jun","Sun>=1","0:00","1:00","S"],["1956","only","-","Sep","lastSun","0:00","0","-"],["1957","only","-","Jun","Sun>=1","1:00","1:00","S"],["1957","only","-","Sep","lastSun","3:00","0","-"],["1980","only","-","Apr","6","1:00","1:00","S"]],"Iceland":[["1917","1918","-","Feb","19","23:00","1:00","S"],["1917","only","-","Oct","21","1:00","0","-"],["1918","only","-","Nov","16","1:00","0","-"],["1939","only","-","Apr","29","23:00","1:00","S"],["1939","only","-","Nov","29","2:00","0","-"],["1940","only","-","Feb","25","2:00","1:00","S"],["1940","only","-","Nov","3","2:00","0","-"],["1941","only","-","Mar","2","1:00s","1:00","S"],["1941","only","-","Nov","2","1:00s","0","-"],["1942","only","-","Mar","8","1:00s","1:00","S"],["1942","only","-","Oct","25","1:00s","0","-"],["1943","1946","-","Mar","Sun>=1","1:00s","1:00","S"],["1943","1948","-","Oct","Sun>=22","1:00s","0","-"],["1947","1967","-","Apr","Sun>=1","1:00s","1:00","S"],["1949","only","-","Oct","30","1:00s","0","-"],["1950","1966","-","Oct","Sun>=22","1:00s","0","-"],["1967","only","-","Oct","29","1:00s","0","-"]],"Italy":[["1916","only","-","Jun","3","0:00s","1:00","S"],["1916","only","-","Oct","1","0:00s","0","-"],["1917","only","-","Apr","1","0:00s","1:00","S"],["1917","only","-","Sep","30","0:00s","0","-"],["1918","only","-","Mar","10","0:00s","1:00","S"],["1918","1919","-","Oct","Sun>=1","0:00s","0","-"],["1919","only","-","Mar","2","0:00s","1:00","S"],["1920","only","-","Mar","21","0:00s","1:00","S"],["1920","only","-","Sep","19","0:00s","0","-"],["1940","only","-","Jun","15","0:00s","1:00","S"],["1944","only","-","Sep","17","0:00s","0","-"],["1945","only","-","Apr","2","2:00","1:00","S"],["1945","only","-","Sep","15","0:00s","0","-"],["1946","only","-","Mar","17","2:00s","1:00","S"],["1946","only","-","Oct","6","2:00s","0","-"],["1947","only","-","Mar","16","0:00s","1:00","S"],["1947","only","-","Oct","5","0:00s","0","-"],["1948","only","-","Feb","29","2:00s","1:00","S"],["1948","only","-","Oct","3","2:00s","0","-"],["1966","1968","-","May","Sun>=22","0:00","1:00","S"],["1966","1969","-","Sep","Sun>=22","0:00","0","-"],["1969","only","-","Jun","1","0:00","1:00","S"],["1970","only","-","May","31","0:00","1:00","S"],["1970","only","-","Sep","lastSun","0:00","0","-"],["1971","1972","-","May","Sun>=22","0:00","1:00","S"],["1971","only","-","Sep","lastSun","1:00","0","-"],["1972","only","-","Oct","1","0:00","0","-"],["1973","only","-","Jun","3","0:00","1:00","S"],["1973","1974","-","Sep","lastSun","0:00","0","-"],["1974","only","-","May","26","0:00","1:00","S"],["1975","only","-","Jun","1","0:00s","1:00","S"],["1975","1977","-","Sep","lastSun","0:00s","0","-"],["1976","only","-","May","30","0:00s","1:00","S"],["1977","1979","-","May","Sun>=22","0:00s","1:00","S"],["1978","only","-","Oct","1","0:00s","0","-"],["1979","only","-","Sep","30","0:00s","0","-"]],"Latvia":[["1989","1996","-","Mar","lastSun","2:00s","1:00","S"],["1989","1996","-","Sep","lastSun","2:00s","0","-"]],"Lux":[["1916","only","-","May","14","23:00","1:00","S"],["1916","only","-","Oct","1","1:00","0","-"],["1917","only","-","Apr","28","23:00","1:00","S"],["1917","only","-","Sep","17","1:00","0","-"],["1918","only","-","Apr","Mon>=15","2:00s","1:00","S"],["1918","only","-","Sep","Mon>=15","2:00s","0","-"],["1919","only","-","Mar","1","23:00","1:00","S"],["1919","only","-","Oct","5","3:00","0","-"],["1920","only","-","Feb","14","23:00","1:00","S"],["1920","only","-","Oct","24","2:00","0","-"],["1921","only","-","Mar","14","23:00","1:00","S"],["1921","only","-","Oct","26","2:00","0","-"],["1922","only","-","Mar","25","23:00","1:00","S"],["1922","only","-","Oct","Sun>=2","1:00","0","-"],["1923","only","-","Apr","21","23:00","1:00","S"],["1923","only","-","Oct","Sun>=2","2:00","0","-"],["1924","only","-","Mar","29","23:00","1:00","S"],["1924","1928","-","Oct","Sun>=2","1:00","0","-"],["1925","only","-","Apr","5","23:00","1:00","S"],["1926","only","-","Apr","17","23:00","1:00","S"],["1927","only","-","Apr","9","23:00","1:00","S"],["1928","only","-","Apr","14","23:00","1:00","S"],["1929","only","-","Apr","20","23:00","1:00","S"]],"Malta":[["1973","only","-","Mar","31","0:00s","1:00","S"],["1973","only","-","Sep","29","0:00s","0","-"],["1974","only","-","Apr","21","0:00s","1:00","S"],["1974","only","-","Sep","16","0:00s","0","-"],["1975","1979","-","Apr","Sun>=15","2:00","1:00","S"],["1975","1980","-","Sep","Sun>=15","2:00","0","-"],["1980","only","-","Mar","31","2:00","1:00","S"]],"Neth":[["1916","only","-","May","1","0:00","1:00","NST",""],["1916","only","-","Oct","1","0:00","0","AMT",""],["1917","only","-","Apr","16","2:00s","1:00","NST"],["1917","only","-","Sep","17","2:00s","0","AMT"],["1918","1921","-","Apr","Mon>=1","2:00s","1:00","NST"],["1918","1921","-","Sep","lastMon","2:00s","0","AMT"],["1922","only","-","Mar","lastSun","2:00s","1:00","NST"],["1922","1936","-","Oct","Sun>=2","2:00s","0","AMT"],["1923","only","-","Jun","Fri>=1","2:00s","1:00","NST"],["1924","only","-","Mar","lastSun","2:00s","1:00","NST"],["1925","only","-","Jun","Fri>=1","2:00s","1:00","NST"],["1926","1931","-","May","15","2:00s","1:00","NST"],["1932","only","-","May","22","2:00s","1:00","NST"],["1933","1936","-","May","15","2:00s","1:00","NST"],["1937","only","-","May","22","2:00s","1:00","NST"],["1937","only","-","Jul","1","0:00","1:00","S"],["1937","1939","-","Oct","Sun>=2","2:00s","0","-"],["1938","1939","-","May","15","2:00s","1:00","S"],["1945","only","-","Apr","2","2:00s","1:00","S"],["1945","only","-","Sep","16","2:00s","0","-"]],"Norway":[["1916","only","-","May","22","1:00","1:00","S"],["1916","only","-","Sep","30","0:00","0","-"],["1945","only","-","Apr","2","2:00s","1:00","S"],["1945","only","-","Oct","1","2:00s","0","-"],["1959","1964","-","Mar","Sun>=15","2:00s","1:00","S"],["1959","1965","-","Sep","Sun>=15","2:00s","0","-"],["1965","only","-","Apr","25","2:00s","1:00","S"]],"Poland":[["1918","1919","-","Sep","16","2:00s","0","-"],["1919","only","-","Apr","15","2:00s","1:00","S"],["1944","only","-","Apr","3","2:00s","1:00","S"],["1944","only","-","Oct","4","2:00","0","-"],["1945","only","-","Apr","29","0:00","1:00","S"],["1945","only","-","Nov","1","0:00","0","-"],["1946","only","-","Apr","14","0:00s","1:00","S"],["1946","only","-","Oct","7","2:00s","0","-"],["1947","only","-","May","4","2:00s","1:00","S"],["1947","1949","-","Oct","Sun>=1","2:00s","0","-"],["1948","only","-","Apr","18","2:00s","1:00","S"],["1949","only","-","Apr","10","2:00s","1:00","S"],["1957","only","-","Jun","2","1:00s","1:00","S"],["1957","1958","-","Sep","lastSun","1:00s","0","-"],["1958","only","-","Mar","30","1:00s","1:00","S"],["1959","only","-","May","31","1:00s","1:00","S"],["1959","1961","-","Oct","Sun>=1","1:00s","0","-"],["1960","only","-","Apr","3","1:00s","1:00","S"],["1961","1964","-","May","lastSun","1:00s","1:00","S"],["1962","1964","-","Sep","lastSun","1:00s","0","-"]],"Port":[["1916","only","-","Jun","17","23:00","1:00","S"],["1916","only","-","Nov","1","1:00","0","-"],["1917","only","-","Feb","28","23:00s","1:00","S"],["1917","1921","-","Oct","14","23:00s","0","-"],["1918","only","-","Mar","1","23:00s","1:00","S"],["1919","only","-","Feb","28","23:00s","1:00","S"],["1920","only","-","Feb","29","23:00s","1:00","S"],["1921","only","-","Feb","28","23:00s","1:00","S"],["1924","only","-","Apr","16","23:00s","1:00","S"],["1924","only","-","Oct","14","23:00s","0","-"],["1926","only","-","Apr","17","23:00s","1:00","S"],["1926","1929","-","Oct","Sat>=1","23:00s","0","-"],["1927","only","-","Apr","9","23:00s","1:00","S"],["1928","only","-","Apr","14","23:00s","1:00","S"],["1929","only","-","Apr","20","23:00s","1:00","S"],["1931","only","-","Apr","18","23:00s","1:00","S"],["1931","1932","-","Oct","Sat>=1","23:00s","0","-"],["1932","only","-","Apr","2","23:00s","1:00","S"],["1934","only","-","Apr","7","23:00s","1:00","S"],["1934","1938","-","Oct","Sat>=1","23:00s","0","-"],["1935","only","-","Mar","30","23:00s","1:00","S"],["1936","only","-","Apr","18","23:00s","1:00","S"],["1937","only","-","Apr","3","23:00s","1:00","S"],["1938","only","-","Mar","26","23:00s","1:00","S"],["1939","only","-","Apr","15","23:00s","1:00","S"],["1939","only","-","Nov","18","23:00s","0","-"],["1940","only","-","Feb","24","23:00s","1:00","S"],["1940","1941","-","Oct","5","23:00s","0","-"],["1941","only","-","Apr","5","23:00s","1:00","S"],["1942","1945","-","Mar","Sat>=8","23:00s","1:00","S"],["1942","only","-","Apr","25","22:00s","2:00","M",""],["1942","only","-","Aug","15","22:00s","1:00","S"],["1942","1945","-","Oct","Sat>=24","23:00s","0","-"],["1943","only","-","Apr","17","22:00s","2:00","M"],["1943","1945","-","Aug","Sat>=25","22:00s","1:00","S"],["1944","1945","-","Apr","Sat>=21","22:00s","2:00","M"],["1946","only","-","Apr","Sat>=1","23:00s","1:00","S"],["1946","only","-","Oct","Sat>=1","23:00s","0","-"],["1947","1949","-","Apr","Sun>=1","2:00s","1:00","S"],["1947","1949","-","Oct","Sun>=1","2:00s","0","-"],["1951","1965","-","Apr","Sun>=1","2:00s","1:00","S"],["1951","1965","-","Oct","Sun>=1","2:00s","0","-"],["1977","only","-","Mar","27","0:00s","1:00","S"],["1977","only","-","Sep","25","0:00s","0","-"],["1978","1979","-","Apr","Sun>=1","0:00s","1:00","S"],["1978","only","-","Oct","1","0:00s","0","-"],["1979","1982","-","Sep","lastSun","1:00s","0","-"],["1980","only","-","Mar","lastSun","0:00s","1:00","S"],["1981","1982","-","Mar","lastSun","1:00s","1:00","S"],["1983","only","-","Mar","lastSun","2:00s","1:00","S"]],"Romania":[["1932","only","-","May","21","0:00s","1:00","S"],["1932","1939","-","Oct","Sun>=1","0:00s","0","-"],["1933","1939","-","Apr","Sun>=2","0:00s","1:00","S"],["1979","only","-","May","27","0:00","1:00","S"],["1979","only","-","Sep","lastSun","0:00","0","-"],["1980","only","-","Apr","5","23:00","1:00","S"],["1980","only","-","Sep","lastSun","1:00","0","-"],["1991","1993","-","Mar","lastSun","0:00s","1:00","S"],["1991","1993","-","Sep","lastSun","0:00s","0","-"]],"Spain":[["1917","only","-","May","5","23:00s","1:00","S"],["1917","1919","-","Oct","6","23:00s","0","-"],["1918","only","-","Apr","15","23:00s","1:00","S"],["1919","only","-","Apr","5","23:00s","1:00","S"],["1924","only","-","Apr","16","23:00s","1:00","S"],["1924","only","-","Oct","4","23:00s","0","-"],["1926","only","-","Apr","17","23:00s","1:00","S"],["1926","1929","-","Oct","Sat>=1","23:00s","0","-"],["1927","only","-","Apr","9","23:00s","1:00","S"],["1928","only","-","Apr","14","23:00s","1:00","S"],["1929","only","-","Apr","20","23:00s","1:00","S"],["1937","only","-","May","22","23:00s","1:00","S"],["1937","1939","-","Oct","Sat>=1","23:00s","0","-"],["1938","only","-","Mar","22","23:00s","1:00","S"],["1939","only","-","Apr","15","23:00s","1:00","S"],["1940","only","-","Mar","16","23:00s","1:00","S"],["1942","only","-","May","2","22:00s","2:00","M",""],["1942","only","-","Sep","1","22:00s","1:00","S"],["1943","1946","-","Apr","Sat>=13","22:00s","2:00","M"],["1943","only","-","Oct","3","22:00s","1:00","S"],["1944","only","-","Oct","10","22:00s","1:00","S"],["1945","only","-","Sep","30","1:00","1:00","S"],["1946","only","-","Sep","30","0:00","0","-"],["1949","only","-","Apr","30","23:00","1:00","S"],["1949","only","-","Sep","30","1:00","0","-"],["1974","1975","-","Apr","Sat>=13","23:00","1:00","S"],["1974","1975","-","Oct","Sun>=1","1:00","0","-"],["1976","only","-","Mar","27","23:00","1:00","S"],["1976","1977","-","Sep","lastSun","1:00","0","-"],["1977","1978","-","Apr","2","23:00","1:00","S"],["1978","only","-","Oct","1","1:00","0","-"]],"SpainAfrica":[["1967","only","-","Jun","3","12:00","1:00","S"],["1967","only","-","Oct","1","0:00","0","-"],["1974","only","-","Jun","24","0:00","1:00","S"],["1974","only","-","Sep","1","0:00","0","-"],["1976","1977","-","May","1","0:00","1:00","S"],["1976","only","-","Aug","1","0:00","0","-"],["1977","only","-","Sep","28","0:00","0","-"],["1978","only","-","Jun","1","0:00","1:00","S"],["1978","only","-","Aug","4","0:00","0","-"]],"Swiss":[["1941","1942","-","May","Mon>=1","1:00","1:00","S"],["1941","1942","-","Oct","Mon>=1","2:00","0","-"]],"Turkey":[["1916","only","-","May","1","0:00","1:00","S"],["1916","only","-","Oct","1","0:00","0","-"],["1920","only","-","Mar","28","0:00","1:00","S"],["1920","only","-","Oct","25","0:00","0","-"],["1921","only","-","Apr","3","0:00","1:00","S"],["1921","only","-","Oct","3","0:00","0","-"],["1922","only","-","Mar","26","0:00","1:00","S"],["1922","only","-","Oct","8","0:00","0","-"],["1924","only","-","May","13","0:00","1:00","S"],["1924","1925","-","Oct","1","0:00","0","-"],["1925","only","-","May","1","0:00","1:00","S"],["1940","only","-","Jun","30","0:00","1:00","S"],["1940","only","-","Oct","5","0:00","0","-"],["1940","only","-","Dec","1","0:00","1:00","S"],["1941","only","-","Sep","21","0:00","0","-"],["1942","only","-","Apr","1","0:00","1:00","S"],["1942","only","-","Nov","1","0:00","0","-"],["1945","only","-","Apr","2","0:00","1:00","S"],["1945","only","-","Oct","8","0:00","0","-"],["1946","only","-","Jun","1","0:00","1:00","S"],["1946","only","-","Oct","1","0:00","0","-"],["1947","1948","-","Apr","Sun>=16","0:00","1:00","S"],["1947","1950","-","Oct","Sun>=2","0:00","0","-"],["1949","only","-","Apr","10","0:00","1:00","S"],["1950","only","-","Apr","19","0:00","1:00","S"],["1951","only","-","Apr","22","0:00","1:00","S"],["1951","only","-","Oct","8","0:00","0","-"],["1962","only","-","Jul","15","0:00","1:00","S"],["1962","only","-","Oct","8","0:00","0","-"],["1964","only","-","May","15","0:00","1:00","S"],["1964","only","-","Oct","1","0:00","0","-"],["1970","1972","-","May","Sun>=2","0:00","1:00","S"],["1970","1972","-","Oct","Sun>=2","0:00","0","-"],["1973","only","-","Jun","3","1:00","1:00","S"],["1973","only","-","Nov","4","3:00","0","-"],["1974","only","-","Mar","31","2:00","1:00","S"],["1974","only","-","Nov","3","5:00","0","-"],["1975","only","-","Mar","30","0:00","1:00","S"],["1975","1976","-","Oct","lastSun","0:00","0","-"],["1976","only","-","Jun","1","0:00","1:00","S"],["1977","1978","-","Apr","Sun>=1","0:00","1:00","S"],["1977","only","-","Oct","16","0:00","0","-"],["1979","1980","-","Apr","Sun>=1","3:00","1:00","S"],["1979","1982","-","Oct","Mon>=11","0:00","0","-"],["1981","1982","-","Mar","lastSun","3:00","1:00","S"],["1983","only","-","Jul","31","0:00","1:00","S"],["1983","only","-","Oct","2","0:00","0","-"],["1985","only","-","Apr","20","0:00","1:00","S"],["1985","only","-","Sep","28","0:00","0","-"],["1986","1990","-","Mar","lastSun","2:00s","1:00","S"],["1986","1990","-","Sep","lastSun","2:00s","0","-"],["1991","2006","-","Mar","lastSun","1:00s","1:00","S"],["1991","1995","-","Sep","lastSun","1:00s","0","-"],["1996","2006","-","Oct","lastSun","1:00s","0","-"]],"US":[["1918","1919","-","Mar","lastSun","2:00","1:00","D"],["1918","1919","-","Oct","lastSun","2:00","0","S"],["1942","only","-","Feb","9","2:00","1:00","W",""],["1945","only","-","Aug","14","23:00u","1:00","P",""],["1945","only","-","Sep","30","2:00","0","S"],["1967","2006","-","Oct","lastSun","2:00","0","S"],["1967","1973","-","Apr","lastSun","2:00","1:00","D"],["1974","only","-","Jan","6","2:00","1:00","D"],["1975","only","-","Feb","23","2:00","1:00","D"],["1976","1986","-","Apr","lastSun","2:00","1:00","D"],["1987","2006","-","Apr","Sun>=1","2:00","1:00","D"],["2007","max","-","Mar","Sun>=8","2:00","1:00","D"],["2007","max","-","Nov","Sun>=1","2:00","0","S"]],"NYC":[["1920","only","-","Mar","lastSun","2:00","1:00","D"],["1920","only","-","Oct","lastSun","2:00","0","S"],["1921","1966","-","Apr","lastSun","2:00","1:00","D"],["1921","1954","-","Sep","lastSun","2:00","0","S"],["1955","1966","-","Oct","lastSun","2:00","0","S"]],"Chicago":[["1920","only","-","Jun","13","2:00","1:00","D"],["1920","1921","-","Oct","lastSun","2:00","0","S"],["1921","only","-","Mar","lastSun","2:00","1:00","D"],["1922","1966","-","Apr","lastSun","2:00","1:00","D"],["1922","1954","-","Sep","lastSun","2:00","0","S"],["1955","1966","-","Oct","lastSun","2:00","0","S"]],"Denver":[["1920","1921","-","Mar","lastSun","2:00","1:00","D"],["1920","only","-","Oct","lastSun","2:00","0","S"],["1921","only","-","May","22","2:00","0","S"],["1965","1966","-","Apr","lastSun","2:00","1:00","D"],["1965","1966","-","Oct","lastSun","2:00","0","S"]],"CA":[["1948","only","-","Mar","14","2:00","1:00","D"],["1949","only","-","Jan","1","2:00","0","S"],["1950","1966","-","Apr","lastSun","2:00","1:00","D"],["1950","1961","-","Sep","lastSun","2:00","0","S"],["1962","1966","-","Oct","lastSun","2:00","0","S"]],"Indianapolis":[["1941","only","-","Jun","22","2:00","1:00","D"],["1941","1954","-","Sep","lastSun","2:00","0","S"],["1946","1954","-","Apr","lastSun","2:00","1:00","D"]],"Marengo":[["1951","only","-","Apr","lastSun","2:00","1:00","D"],["1951","only","-","Sep","lastSun","2:00","0","S"],["1954","1960","-","Apr","lastSun","2:00","1:00","D"],["1954","1960","-","Sep","lastSun","2:00","0","S"]],"Vincennes":[["1946","only","-","Apr","lastSun","2:00","1:00","D"],["1946","only","-","Sep","lastSun","2:00","0","S"],["1953","1954","-","Apr","lastSun","2:00","1:00","D"],["1953","1959","-","Sep","lastSun","2:00","0","S"],["1955","only","-","May","1","0:00","1:00","D"],["1956","1963","-","Apr","lastSun","2:00","1:00","D"],["1960","only","-","Oct","lastSun","2:00","0","S"],["1961","only","-","Sep","lastSun","2:00","0","S"],["1962","1963","-","Oct","lastSun","2:00","0","S"]],"Perry":[["1946","only","-","Apr","lastSun","2:00","1:00","D"],["1946","only","-","Sep","lastSun","2:00","0","S"],["1953","1954","-","Apr","lastSun","2:00","1:00","D"],["1953","1959","-","Sep","lastSun","2:00","0","S"],["1955","only","-","May","1","0:00","1:00","D"],["1956","1963","-","Apr","lastSun","2:00","1:00","D"],["1960","only","-","Oct","lastSun","2:00","0","S"],["1961","only","-","Sep","lastSun","2:00","0","S"],["1962","1963","-","Oct","lastSun","2:00","0","S"]],"Pike":[["1955","only","-","May","1","0:00","1:00","D"],["1955","1960","-","Sep","lastSun","2:00","0","S"],["1956","1964","-","Apr","lastSun","2:00","1:00","D"],["1961","1964","-","Oct","lastSun","2:00","0","S"]],"Starke":[["1947","1961","-","Apr","lastSun","2:00","1:00","D"],["1947","1954","-","Sep","lastSun","2:00","0","S"],["1955","1956","-","Oct","lastSun","2:00","0","S"],["1957","1958","-","Sep","lastSun","2:00","0","S"],["1959","1961","-","Oct","lastSun","2:00","0","S"]],"Pulaski":[["1946","1960","-","Apr","lastSun","2:00","1:00","D"],["1946","1954","-","Sep","lastSun","2:00","0","S"],["1955","1956","-","Oct","lastSun","2:00","0","S"],["1957","1960","-","Sep","lastSun","2:00","0","S"]],"Louisville":[["1921","only","-","May","1","2:00","1:00","D"],["1921","only","-","Sep","1","2:00","0","S"],["1941","1961","-","Apr","lastSun","2:00","1:00","D"],["1941","only","-","Sep","lastSun","2:00","0","S"],["1946","only","-","Jun","2","2:00","0","S"],["1950","1955","-","Sep","lastSun","2:00","0","S"],["1956","1960","-","Oct","lastSun","2:00","0","S"]],"Detroit":[["1948","only","-","Apr","lastSun","2:00","1:00","D"],["1948","only","-","Sep","lastSun","2:00","0","S"],["1967","only","-","Jun","14","2:00","1:00","D"],["1967","only","-","Oct","lastSun","2:00","0","S"]],"Menominee":[["1946","only","-","Apr","lastSun","2:00","1:00","D"],["1946","only","-","Sep","lastSun","2:00","0","S"],["1966","only","-","Apr","lastSun","2:00","1:00","D"],["1966","only","-","Oct","lastSun","2:00","0","S"]],"Canada":[["1918","only","-","Apr","14","2:00","1:00","D"],["1918","only","-","Oct","31","2:00","0","S"],["1942","only","-","Feb","9","2:00","1:00","W",""],["1945","only","-","Aug","14","23:00u","1:00","P",""],["1945","only","-","Sep","30","2:00","0","S"],["1974","1986","-","Apr","lastSun","2:00","1:00","D"],["1974","2006","-","Oct","lastSun","2:00","0","S"],["1987","2006","-","Apr","Sun>=1","2:00","1:00","D"],["2007","max","-","Mar","Sun>=8","2:00","1:00","D"],["2007","max","-","Nov","Sun>=1","2:00","0","S"]],"StJohns":[["1917","only","-","Apr","8","2:00","1:00","D"],["1917","only","-","Sep","17","2:00","0","S"],["1919","only","-","May","5","23:00","1:00","D"],["1919","only","-","Aug","12","23:00","0","S"],["1920","1935","-","May","Sun>=1","23:00","1:00","D"],["1920","1935","-","Oct","lastSun","23:00","0","S"],["1936","1941","-","May","Mon>=9","0:00","1:00","D"],["1936","1941","-","Oct","Mon>=2","0:00","0","S"],["1946","1950","-","May","Sun>=8","2:00","1:00","D"],["1946","1950","-","Oct","Sun>=2","2:00","0","S"],["1951","1986","-","Apr","lastSun","2:00","1:00","D"],["1951","1959","-","Sep","lastSun","2:00","0","S"],["1960","1986","-","Oct","lastSun","2:00","0","S"],["1987","only","-","Apr","Sun>=1","0:01","1:00","D"],["1987","2006","-","Oct","lastSun","0:01","0","S"],["1988","only","-","Apr","Sun>=1","0:01","2:00","DD"],["1989","2006","-","Apr","Sun>=1","0:01","1:00","D"],["2007","max","-","Mar","Sun>=8","0:01","1:00","D"],["2007","max","-","Nov","Sun>=1","0:01","0","S"]],"Halifax":[["1916","only","-","Apr","1","0:00","1:00","D"],["1916","only","-","Oct","1","0:00","0","S"],["1920","only","-","May","9","0:00","1:00","D"],["1920","only","-","Aug","29","0:00","0","S"],["1921","only","-","May","6","0:00","1:00","D"],["1921","1922","-","Sep","5","0:00","0","S"],["1922","only","-","Apr","30","0:00","1:00","D"],["1923","1925","-","May","Sun>=1","0:00","1:00","D"],["1923","only","-","Sep","4","0:00","0","S"],["1924","only","-","Sep","15","0:00","0","S"],["1925","only","-","Sep","28","0:00","0","S"],["1926","only","-","May","16","0:00","1:00","D"],["1926","only","-","Sep","13","0:00","0","S"],["1927","only","-","May","1","0:00","1:00","D"],["1927","only","-","Sep","26","0:00","0","S"],["1928","1931","-","May","Sun>=8","0:00","1:00","D"],["1928","only","-","Sep","9","0:00","0","S"],["1929","only","-","Sep","3","0:00","0","S"],["1930","only","-","Sep","15","0:00","0","S"],["1931","1932","-","Sep","Mon>=24","0:00","0","S"],["1932","only","-","May","1","0:00","1:00","D"],["1933","only","-","Apr","30","0:00","1:00","D"],["1933","only","-","Oct","2","0:00","0","S"],["1934","only","-","May","20","0:00","1:00","D"],["1934","only","-","Sep","16","0:00","0","S"],["1935","only","-","Jun","2","0:00","1:00","D"],["1935","only","-","Sep","30","0:00","0","S"],["1936","only","-","Jun","1","0:00","1:00","D"],["1936","only","-","Sep","14","0:00","0","S"],["1937","1938","-","May","Sun>=1","0:00","1:00","D"],["1937","1941","-","Sep","Mon>=24","0:00","0","S"],["1939","only","-","May","28","0:00","1:00","D"],["1940","1941","-","May","Sun>=1","0:00","1:00","D"],["1946","1949","-","Apr","lastSun","2:00","1:00","D"],["1946","1949","-","Sep","lastSun","2:00","0","S"],["1951","1954","-","Apr","lastSun","2:00","1:00","D"],["1951","1954","-","Sep","lastSun","2:00","0","S"],["1956","1959","-","Apr","lastSun","2:00","1:00","D"],["1956","1959","-","Sep","lastSun","2:00","0","S"],["1962","1973","-","Apr","lastSun","2:00","1:00","D"],["1962","1973","-","Oct","lastSun","2:00","0","S"]],"Moncton":[["1933","1935","-","Jun","Sun>=8","1:00","1:00","D"],["1933","1935","-","Sep","Sun>=8","1:00","0","S"],["1936","1938","-","Jun","Sun>=1","1:00","1:00","D"],["1936","1938","-","Sep","Sun>=1","1:00","0","S"],["1939","only","-","May","27","1:00","1:00","D"],["1939","1941","-","Sep","Sat>=21","1:00","0","S"],["1940","only","-","May","19","1:00","1:00","D"],["1941","only","-","May","4","1:00","1:00","D"],["1946","1972","-","Apr","lastSun","2:00","1:00","D"],["1946","1956","-","Sep","lastSun","2:00","0","S"],["1957","1972","-","Oct","lastSun","2:00","0","S"],["1993","2006","-","Apr","Sun>=1","0:01","1:00","D"],["1993","2006","-","Oct","lastSun","0:01","0","S"]],"Mont":[["1917","only","-","Mar","25","2:00","1:00","D"],["1917","only","-","Apr","24","0:00","0","S"],["1919","only","-","Mar","31","2:30","1:00","D"],["1919","only","-","Oct","25","2:30","0","S"],["1920","only","-","May","2","2:30","1:00","D"],["1920","1922","-","Oct","Sun>=1","2:30","0","S"],["1921","only","-","May","1","2:00","1:00","D"],["1922","only","-","Apr","30","2:00","1:00","D"],["1924","only","-","May","17","2:00","1:00","D"],["1924","1926","-","Sep","lastSun","2:30","0","S"],["1925","1926","-","May","Sun>=1","2:00","1:00","D"],["1927","only","-","May","1","0:00","1:00","D"],["1927","1932","-","Sep","lastSun","0:00","0","S"],["1928","1931","-","Apr","lastSun","0:00","1:00","D"],["1932","only","-","May","1","0:00","1:00","D"],["1933","1940","-","Apr","lastSun","0:00","1:00","D"],["1933","only","-","Oct","1","0:00","0","S"],["1934","1939","-","Sep","lastSun","0:00","0","S"],["1946","1973","-","Apr","lastSun","2:00","1:00","D"],["1945","1948","-","Sep","lastSun","2:00","0","S"],["1949","1950","-","Oct","lastSun","2:00","0","S"],["1951","1956","-","Sep","lastSun","2:00","0","S"],["1957","1973","-","Oct","lastSun","2:00","0","S"]],"Toronto":[["1919","only","-","Mar","30","23:30","1:00","D"],["1919","only","-","Oct","26","0:00","0","S"],["1920","only","-","May","2","2:00","1:00","D"],["1920","only","-","Sep","26","0:00","0","S"],["1921","only","-","May","15","2:00","1:00","D"],["1921","only","-","Sep","15","2:00","0","S"],["1922","1923","-","May","Sun>=8","2:00","1:00","D"],["1922","1926","-","Sep","Sun>=15","2:00","0","S"],["1924","1927","-","May","Sun>=1","2:00","1:00","D"],["1927","1932","-","Sep","lastSun","2:00","0","S"],["1928","1931","-","Apr","lastSun","2:00","1:00","D"],["1932","only","-","May","1","2:00","1:00","D"],["1933","1940","-","Apr","lastSun","2:00","1:00","D"],["1933","only","-","Oct","1","2:00","0","S"],["1934","1939","-","Sep","lastSun","2:00","0","S"],["1945","1946","-","Sep","lastSun","2:00","0","S"],["1946","only","-","Apr","lastSun","2:00","1:00","D"],["1947","1949","-","Apr","lastSun","0:00","1:00","D"],["1947","1948","-","Sep","lastSun","0:00","0","S"],["1949","only","-","Nov","lastSun","0:00","0","S"],["1950","1973","-","Apr","lastSun","2:00","1:00","D"],["1950","only","-","Nov","lastSun","2:00","0","S"],["1951","1956","-","Sep","lastSun","2:00","0","S"],["1957","1973","-","Oct","lastSun","2:00","0","S"]],"Winn":[["1916","only","-","Apr","23","0:00","1:00","D"],["1916","only","-","Sep","17","0:00","0","S"],["1918","only","-","Apr","14","2:00","1:00","D"],["1918","only","-","Oct","31","2:00","0","S"],["1937","only","-","May","16","2:00","1:00","D"],["1937","only","-","Sep","26","2:00","0","S"],["1942","only","-","Feb","9","2:00","1:00","W",""],["1945","only","-","Aug","14","23:00u","1:00","P",""],["1945","only","-","Sep","lastSun","2:00","0","S"],["1946","only","-","May","12","2:00","1:00","D"],["1946","only","-","Oct","13","2:00","0","S"],["1947","1949","-","Apr","lastSun","2:00","1:00","D"],["1947","1949","-","Sep","lastSun","2:00","0","S"],["1950","only","-","May","1","2:00","1:00","D"],["1950","only","-","Sep","30","2:00","0","S"],["1951","1960","-","Apr","lastSun","2:00","1:00","D"],["1951","1958","-","Sep","lastSun","2:00","0","S"],["1959","only","-","Oct","lastSun","2:00","0","S"],["1960","only","-","Sep","lastSun","2:00","0","S"],["1963","only","-","Apr","lastSun","2:00","1:00","D"],["1963","only","-","Sep","22","2:00","0","S"],["1966","1986","-","Apr","lastSun","2:00s","1:00","D"],["1966","2005","-","Oct","lastSun","2:00s","0","S"],["1987","2005","-","Apr","Sun>=1","2:00s","1:00","D"]],"Regina":[["1918","only","-","Apr","14","2:00","1:00","D"],["1918","only","-","Oct","31","2:00","0","S"],["1930","1934","-","May","Sun>=1","0:00","1:00","D"],["1930","1934","-","Oct","Sun>=1","0:00","0","S"],["1937","1941","-","Apr","Sun>=8","0:00","1:00","D"],["1937","only","-","Oct","Sun>=8","0:00","0","S"],["1938","only","-","Oct","Sun>=1","0:00","0","S"],["1939","1941","-","Oct","Sun>=8","0:00","0","S"],["1942","only","-","Feb","9","2:00","1:00","W",""],["1945","only","-","Aug","14","23:00u","1:00","P",""],["1945","only","-","Sep","lastSun","2:00","0","S"],["1946","only","-","Apr","Sun>=8","2:00","1:00","D"],["1946","only","-","Oct","Sun>=8","2:00","0","S"],["1947","1957","-","Apr","lastSun","2:00","1:00","D"],["1947","1957","-","Sep","lastSun","2:00","0","S"],["1959","only","-","Apr","lastSun","2:00","1:00","D"],["1959","only","-","Oct","lastSun","2:00","0","S"]],"Swift":[["1957","only","-","Apr","lastSun","2:00","1:00","D"],["1957","only","-","Oct","lastSun","2:00","0","S"],["1959","1961","-","Apr","lastSun","2:00","1:00","D"],["1959","only","-","Oct","lastSun","2:00","0","S"],["1960","1961","-","Sep","lastSun","2:00","0","S"]],"Edm":[["1918","1919","-","Apr","Sun>=8","2:00","1:00","D"],["1918","only","-","Oct","31","2:00","0","S"],["1919","only","-","May","27","2:00","0","S"],["1920","1923","-","Apr","lastSun","2:00","1:00","D"],["1920","only","-","Oct","lastSun","2:00","0","S"],["1921","1923","-","Sep","lastSun","2:00","0","S"],["1942","only","-","Feb","9","2:00","1:00","W",""],["1945","only","-","Aug","14","23:00u","1:00","P",""],["1945","only","-","Sep","lastSun","2:00","0","S"],["1947","only","-","Apr","lastSun","2:00","1:00","D"],["1947","only","-","Sep","lastSun","2:00","0","S"],["1967","only","-","Apr","lastSun","2:00","1:00","D"],["1967","only","-","Oct","lastSun","2:00","0","S"],["1969","only","-","Apr","lastSun","2:00","1:00","D"],["1969","only","-","Oct","lastSun","2:00","0","S"],["1972","1986","-","Apr","lastSun","2:00","1:00","D"],["1972","2006","-","Oct","lastSun","2:00","0","S"]],"Vanc":[["1918","only","-","Apr","14","2:00","1:00","D"],["1918","only","-","Oct","31","2:00","0","S"],["1942","only","-","Feb","9","2:00","1:00","W",""],["1945","only","-","Aug","14","23:00u","1:00","P",""],["1945","only","-","Sep","30","2:00","0","S"],["1946","1986","-","Apr","lastSun","2:00","1:00","D"],["1946","only","-","Oct","13","2:00","0","S"],["1947","1961","-","Sep","lastSun","2:00","0","S"],["1962","2006","-","Oct","lastSun","2:00","0","S"]],"NT_YK":[["1918","only","-","Apr","14","2:00","1:00","D"],["1918","only","-","Oct","27","2:00","0","S"],["1919","only","-","May","25","2:00","1:00","D"],["1919","only","-","Nov","1","0:00","0","S"],["1942","only","-","Feb","9","2:00","1:00","W",""],["1945","only","-","Aug","14","23:00u","1:00","P",""],["1945","only","-","Sep","30","2:00","0","S"],["1965","only","-","Apr","lastSun","0:00","2:00","DD"],["1965","only","-","Oct","lastSun","2:00","0","S"],["1980","1986","-","Apr","lastSun","2:00","1:00","D"],["1980","2006","-","Oct","lastSun","2:00","0","S"],["1987","2006","-","Apr","Sun>=1","2:00","1:00","D"]],"Resolute":[["2006","max","-","Nov","Sun>=1","2:00","0","ES"],["2007","max","-","Mar","Sun>=8","2:00","0","CD"]],"Mexico":[["1939","only","-","Feb","5","0:00","1:00","D"],["1939","only","-","Jun","25","0:00","0","S"],["1940","only","-","Dec","9","0:00","1:00","D"],["1941","only","-","Apr","1","0:00","0","S"],["1943","only","-","Dec","16","0:00","1:00","W",""],["1944","only","-","May","1","0:00","0","S"],["1950","only","-","Feb","12","0:00","1:00","D"],["1950","only","-","Jul","30","0:00","0","S"],["1996","2000","-","Apr","Sun>=1","2:00","1:00","D"],["1996","2000","-","Oct","lastSun","2:00","0","S"],["2001","only","-","May","Sun>=1","2:00","1:00","D"],["2001","only","-","Sep","lastSun","2:00","0","S"],["2002","max","-","Apr","Sun>=1","2:00","1:00","D"],["2002","max","-","Oct","lastSun","2:00","0","S"]],"Bahamas":[["1964","1975","-","Oct","lastSun","2:00","0","S"],["1964","1975","-","Apr","lastSun","2:00","1:00","D"]],"Barb":[["1977","only","-","Jun","12","2:00","1:00","D"],["1977","1978","-","Oct","Sun>=1","2:00","0","S"],["1978","1980","-","Apr","Sun>=15","2:00","1:00","D"],["1979","only","-","Sep","30","2:00","0","S"],["1980","only","-","Sep","25","2:00","0","S"]],"Belize":[["1918","1942","-","Oct","Sun>=2","0:00","0:30","HD"],["1919","1943","-","Feb","Sun>=9","0:00","0","S"],["1973","only","-","Dec","5","0:00","1:00","D"],["1974","only","-","Feb","9","0:00","0","S"],["1982","only","-","Dec","18","0:00","1:00","D"],["1983","only","-","Feb","12","0:00","0","S"]],"CR":[["1979","1980","-","Feb","lastSun","0:00","1:00","D"],["1979","1980","-","Jun","Sun>=1","0:00","0","S"],["1991","1992","-","Jan","Sat>=15","0:00","1:00","D"],["1991","only","-","Jul","1","0:00","0","S"],["1992","only","-","Mar","15","0:00","0","S"]],"Cuba":[["1928","only","-","Jun","10","0:00","1:00","D"],["1928","only","-","Oct","10","0:00","0","S"],["1940","1942","-","Jun","Sun>=1","0:00","1:00","D"],["1940","1942","-","Sep","Sun>=1","0:00","0","S"],["1945","1946","-","Jun","Sun>=1","0:00","1:00","D"],["1945","1946","-","Sep","Sun>=1","0:00","0","S"],["1965","only","-","Jun","1","0:00","1:00","D"],["1965","only","-","Sep","30","0:00","0","S"],["1966","only","-","May","29","0:00","1:00","D"],["1966","only","-","Oct","2","0:00","0","S"],["1967","only","-","Apr","8","0:00","1:00","D"],["1967","1968","-","Sep","Sun>=8","0:00","0","S"],["1968","only","-","Apr","14","0:00","1:00","D"],["1969","1977","-","Apr","lastSun","0:00","1:00","D"],["1969","1971","-","Oct","lastSun","0:00","0","S"],["1972","1974","-","Oct","8","0:00","0","S"],["1975","1977","-","Oct","lastSun","0:00","0","S"],["1978","only","-","May","7","0:00","1:00","D"],["1978","1990","-","Oct","Sun>=8","0:00","0","S"],["1979","1980","-","Mar","Sun>=15","0:00","1:00","D"],["1981","1985","-","May","Sun>=5","0:00","1:00","D"],["1986","1989","-","Mar","Sun>=14","0:00","1:00","D"],["1990","1997","-","Apr","Sun>=1","0:00","1:00","D"],["1991","1995","-","Oct","Sun>=8","0:00s","0","S"],["1996","only","-","Oct","6","0:00s","0","S"],["1997","only","-","Oct","12","0:00s","0","S"],["1998","1999","-","Mar","lastSun","0:00s","1:00","D"],["1998","2003","-","Oct","lastSun","0:00s","0","S"],["2000","2004","-","Apr","Sun>=1","0:00s","1:00","D"],["2006","max","-","Oct","lastSun","0:00s","0","S"],["2007","only","-","Mar","Sun>=8","0:00s","1:00","D"],["2008","only","-","Mar","Sun>=15","0:00s","1:00","D"],["2009","2010","-","Mar","Sun>=8","0:00s","1:00","D"],["2011","only","-","Mar","Sun>=15","0:00s","1:00","D"],["2012","max","-","Mar","Sun>=8","0:00s","1:00","D"]],"DR":[["1966","only","-","Oct","30","0:00","1:00","D"],["1967","only","-","Feb","28","0:00","0","S"],["1969","1973","-","Oct","lastSun","0:00","0:30","HD"],["1970","only","-","Feb","21","0:00","0","S"],["1971","only","-","Jan","20","0:00","0","S"],["1972","1974","-","Jan","21","0:00","0","S"]],"Salv":[["1987","1988","-","May","Sun>=1","0:00","1:00","D"],["1987","1988","-","Sep","lastSun","0:00","0","S"]],"Guat":[["1973","only","-","Nov","25","0:00","1:00","D"],["1974","only","-","Feb","24","0:00","0","S"],["1983","only","-","May","21","0:00","1:00","D"],["1983","only","-","Sep","22","0:00","0","S"],["1991","only","-","Mar","23","0:00","1:00","D"],["1991","only","-","Sep","7","0:00","0","S"],["2006","only","-","Apr","30","0:00","1:00","D"],["2006","only","-","Oct","1","0:00","0","S"]],"Haiti":[["1983","only","-","May","8","0:00","1:00","D"],["1984","1987","-","Apr","lastSun","0:00","1:00","D"],["1983","1987","-","Oct","lastSun","0:00","0","S"],["1988","1997","-","Apr","Sun>=1","1:00s","1:00","D"],["1988","1997","-","Oct","lastSun","1:00s","0","S"],["2005","2006","-","Apr","Sun>=1","0:00","1:00","D"],["2005","2006","-","Oct","lastSun","0:00","0","S"]],"Hond":[["1987","1988","-","May","Sun>=1","0:00","1:00","D"],["1987","1988","-","Sep","lastSun","0:00","0","S"],["2006","only","-","May","Sun>=1","0:00","1:00","D"],["2006","only","-","Aug","Mon>=1","0:00","0","S"]],"Nic":[["1979","1980","-","Mar","Sun>=16","0:00","1:00","D"],["1979","1980","-","Jun","Mon>=23","0:00","0","S"],["2005","only","-","Apr","10","0:00","1:00","D"],["2005","only","-","Oct","Sun>=1","0:00","0","S"],["2006","only","-","Apr","30","2:00","1:00","D"],["2006","only","-","Oct","Sun>=1","1:00","0","S"]],"TC":[["1979","1986","-","Apr","lastSun","2:00","1:00","D"],["1979","2006","-","Oct","lastSun","2:00","0","S"],["1987","2006","-","Apr","Sun>=1","2:00","1:00","D"],["2007","max","-","Mar","Sun>=8","2:00","1:00","D"],["2007","max","-","Nov","Sun>=1","2:00","0","S"]]};
/*
* jQuery Impromptu
* By: Trent Richardson [http://trentrichardson.com]
* Version 3.1
* Last Modified: 3/30/2010
*
* Copyright 2010 Trent Richardson
* Dual licensed under the MIT and GPL licenses.
* http://trentrichardson.com/Impromptu/GPL-LICENSE.txt
* http://trentrichardson.com/Impromptu/MIT-LICENSE.txt
*
*/
(function($) {
$.prompt = function(message, options) {
options = $.extend({},$.prompt.defaults,options);
$.prompt.currentPrefix = options.prefix;
var ie6 = ($.browser.msie && $.browser.version < 7);
var $body = $(document.body);
var $window = $(window);
options.classes = $.trim(options.classes);
if(options.classes != '')
options.classes = ' '+ options.classes;
//build the box and fade
var msgbox = '<div class="'+ options.prefix +'box'+ options.classes +'" id="'+ options.prefix +'box">';
if(options.useiframe && (($('object, applet').length > 0) || ie6)) {
msgbox += '<iframe src="javascript:false;" style="display:block;position:absolute;z-index:-1;" class="'+ options.prefix +'fade" id="'+ options.prefix +'fade"></iframe>';
} else {
if(ie6) {
$('select').css('visibility','hidden');
}
msgbox +='<div class="'+ options.prefix +'fade" id="'+ options.prefix +'fade"></div>';
}
msgbox += '<div class="'+ options.prefix +'" id="'+ options.prefix +'"><div class="'+ options.prefix +'container"><div class="';
msgbox += options.prefix +'close">X</div><div id="'+ options.prefix +'states"></div>';
msgbox += '</div></div></div>';
var $jqib = $(msgbox).appendTo($body);
var $jqi = $jqib.children('#'+ options.prefix);
var $jqif = $jqib.children('#'+ options.prefix +'fade');
//if a string was passed, convert to a single state
if(message.constructor == String){
message = {
state0: {
html: message,
buttons: options.buttons,
focus: options.focus,
submit: options.submit
}
};
}
//build the states
var states = "";
$.each(message,function(statename,stateobj){
stateobj = $.extend({},$.prompt.defaults.state,stateobj);
message[statename] = stateobj;
states += '<div id="'+ options.prefix +'_state_'+ statename +'" class="'+ options.prefix + '_state" style="display:none;"><div class="'+ options.prefix +'message">' + stateobj.html +'</div><div class="'+ options.prefix +'buttons">';
$.each(stateobj.buttons, function(k, v){
if(typeof v == 'object')
states += '<button name="' + options.prefix + '_' + statename + '_button' + v.title.replace(/[^a-z0-9]+/gi,'') + '" id="' + options.prefix + '_' + statename + '_button' + v.title.replace(/[^a-z0-9]+/gi,'') + '" value="' + v.value + '">' + v.title + '</button>';
else states += '<button name="' + options.prefix + '_' + statename + '_button' + k + '" id="' + options.prefix + '_' + statename + '_button' + k + '" value="' + v + '">' + k + '</button>';
});
states += '</div></div>';
});
//insert the states...
$jqi.find('#'+ options.prefix +'states').html(states).children('.'+ options.prefix +'_state:first').css('display','block');
$jqi.find('.'+ options.prefix +'buttons:empty').css('display','none');
//Events
$.each(message,function(statename,stateobj){
var $state = $jqi.find('#'+ options.prefix +'_state_'+ statename);
$state.children('.'+ options.prefix +'buttons').children('button').click(function(){
var msg = $state.children('.'+ options.prefix +'message');
var clicked = stateobj.buttons[$(this).text()];
if(clicked == undefined){
for(var i in stateobj.buttons)
if(stateobj.buttons[i].title == $(this).text())
clicked = stateobj.buttons[i].value;
}
if(typeof clicked == 'object')
clicked = clicked.value;
var forminputs = {};
//collect all form element values from all states
$.each($jqi.find('#'+ options.prefix +'states :input').serializeArray(),function(i,obj){
if (forminputs[obj.name] === undefined) {
forminputs[obj.name] = obj.value;
} else if (typeof forminputs[obj.name] == Array || typeof forminputs[obj.name] == 'object') {
forminputs[obj.name].push(obj.value);
} else {
forminputs[obj.name] = [forminputs[obj.name],obj.value];
}
});
var close = stateobj.submit(clicked,msg,forminputs);
if(close === undefined || close) {
removePrompt(true,clicked,msg,forminputs);
}
});
$state.find('.'+ options.prefix +'buttons button:eq('+ stateobj.focus +')').addClass(options.prefix +'defaultbutton');
});
var ie6scroll = function(){
$jqib.css({ top: $window.scrollTop() });
};
var fadeClicked = function(){
if(options.persistent){
var i = 0;
$jqib.addClass(options.prefix +'warning');
var intervalid = setInterval(function(){
$jqib.toggleClass(options.prefix +'warning');
if(i++ > 1){
clearInterval(intervalid);
$jqib.removeClass(options.prefix +'warning');
}
}, 100);
}
else {
removePrompt();
}
};
var keyPressEventHandler = function(e){
var key = (window.event) ? event.keyCode : e.keyCode; // MSIE or Firefox?
//escape key closes
if(key==27) {
fadeClicked();
}
//constrain tabs
if (key == 9){
var $inputels = $(':input:enabled:visible',$jqib);
var fwd = !e.shiftKey && e.target == $inputels[$inputels.length-1];
var back = e.shiftKey && e.target == $inputels[0];
if (fwd || back) {
setTimeout(function(){
if (!$inputels)
return;
var el = $inputels[back===true ? $inputels.length-1 : 0];
if (el)
el.focus();
},10);
return false;
}
}
};
var positionPrompt = function(){
$jqib.css({
position: (ie6) ? "absolute" : "fixed",
height: $window.height(),
width: "100%",
top: (ie6)? $window.scrollTop() : 0,
left: 0,
right: 0,
bottom: 0
});
$jqif.css({
position: "absolute",
height: $window.height(),
width: "100%",
top: 0,
left: 0,
right: 0,
bottom: 0
});
$jqi.css({
position: "absolute",
top: options.top,
left: "50%",
marginLeft: (($jqi.outerWidth()/2)*-1)
});
};
var stylePrompt = function(){
$jqif.css({
zIndex: options.zIndex,
display: "none",
opacity: options.opacity
});
$jqi.css({
zIndex: options.zIndex+1,
display: "none"
});
$jqib.css({
zIndex: options.zIndex
});
};
var removePrompt = function(callCallback, clicked, msg, formvals){
$jqi.remove();
//ie6, remove the scroll event
if(ie6) {
$body.unbind('scroll',ie6scroll);
}
$window.unbind('resize',positionPrompt);
$jqif.fadeOut(options.overlayspeed,function(){
$jqif.unbind('click',fadeClicked);
$jqif.remove();
if(callCallback) {
options.callback(clicked,msg,formvals);
}
$jqib.unbind('keypress',keyPressEventHandler);
$jqib.remove();
if(ie6 && !options.useiframe) {
$('select').css('visibility','visible');
}
});
};
positionPrompt();
stylePrompt();
//ie6, add a scroll event to fix position:fixed
if(ie6) {
$window.scroll(ie6scroll);
}
$jqif.click(fadeClicked);
$window.resize(positionPrompt);
$jqib.bind("keydown keypress",keyPressEventHandler);
$jqi.find('.'+ options.prefix +'close').click(removePrompt);
//Show it
$jqif.fadeIn(options.overlayspeed);
$jqi[options.show](options.promptspeed,options.loaded);
$jqi.find('#'+ options.prefix +'states .'+ options.prefix +'_state:first .'+ options.prefix +'defaultbutton').focus();
if(options.timeout > 0)
setTimeout($.prompt.close,options.timeout);
return $jqib;
};
$.prompt.defaults = {
prefix:'jqi',
classes: '',
buttons: {
Ok: true
},
loaded: function(){
},
submit: function(){
return true;
},
callback: function(){
},
opacity: 0.6,
zIndex: 999,
overlayspeed: 'slow',
promptspeed: 'fast',
show: 'fadeIn',
focus: 0,
useiframe: false,
top: "15%",
persistent: true,
timeout: 0,
state: {
html: '',
buttons: {
Ok: true
},
focus: 0,
submit: function(){
return true;
}
}
};
$.prompt.currentPrefix = $.prompt.defaults.prefix;
$.prompt.setDefaults = function(o) {
$.prompt.defaults = $.extend({}, $.prompt.defaults, o);
};
$.prompt.setStateDefaults = function(o) {
$.prompt.defaults.state = $.extend({}, $.prompt.defaults.state, o);
};
$.prompt.getStateContent = function(state) {
return $('#'+ $.prompt.currentPrefix +'_state_'+ state);
};
$.prompt.getCurrentState = function() {
return $('.'+ $.prompt.currentPrefix +'_state:visible');
};
$.prompt.getCurrentStateName = function() {
var stateid = $.prompt.getCurrentState().attr('id');
return stateid.replace($.prompt.currentPrefix +'_state_','');
};
$.prompt.goToState = function(state, callback) {
$('.'+ $.prompt.currentPrefix +'_state').slideUp('slow');
$('#'+ $.prompt.currentPrefix +'_state_'+ state).slideDown('slow',function(){
$(this).find('.'+ $.prompt.currentPrefix +'defaultbutton').focus();
if (typeof callback == 'function')
callback();
});
};
$.prompt.nextState = function(callback) {
var $next = $('.'+ $.prompt.currentPrefix +'_state:visible').next();
$('.'+ $.prompt.currentPrefix +'_state').slideUp('slow');
$next.slideDown('slow',function(){
$next.find('.'+ $.prompt.currentPrefix +'defaultbutton').focus();
if (typeof callback == 'function')
callback();
});
};
$.prompt.prevState = function(callback) {
var $next = $('.'+ $.prompt.currentPrefix +'_state:visible').prev();
$('.'+ $.prompt.currentPrefix +'_state').slideUp('slow');
$next.slideDown('slow',function(){
$next.find('.'+ $.prompt.currentPrefix +'defaultbutton').focus();
if (typeof callback == 'function')
callback();
});
};
$.prompt.close = function() {
$('#'+ $.prompt.currentPrefix +'box').fadeOut('fast',function(){
$(this).remove();
});
};
$.fn.prompt = function(options){
if(options == undefined)
options = {};
if(options.withDataAndEvents == undefined)
options.withDataAndEvents = false;
$.prompt($(this).clone(options.withDataAndEvents).html(),options);
}
})(jQuery);
(function($) {
$.fn.serializeToJson = function() {
attrs = {};
this.find('[name]').each(function(i, field) {
$field = $(field);
if ($field.is(':checkbox')) {
val = $field.is(':checked');
} else {
val = $field.val();
}
attrs[$field.attr('name')] = val;
});
return attrs;
};
})(jQuery);
/*
http://www.JSON.org/json2.js
2011-02-23
Public Domain.
NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
See http://www.JSON.org/js.html
This code should be minified before deployment.
See http://javascript.crockford.com/jsmin.html
USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
NOT CONTROL.
This file creates a global JSON object containing two methods: stringify
and parse.
JSON.stringify(value, replacer, space)
value any JavaScript value, usually an object or array.
replacer an optional parameter that determines how object
values are stringified for objects. It can be a
function or an array of strings.
space an optional parameter that specifies the indentation
of nested structures. If it is omitted, the text will
be packed without extra whitespace. If it is a number,
it will specify the number of spaces to indent at each
level. If it is a string (such as '\t' or ' '),
it contains the characters used to indent at each level.
This method produces a JSON text from a JavaScript value.
When an object value is found, if the object contains a toJSON
method, its toJSON method will be called and the result will be
stringified. A toJSON method does not serialize: it returns the
value represented by the name/value pair that should be serialized,
or undefined if nothing should be serialized. The toJSON method
will be passed the key associated with the value, and this will be
bound to the value
For example, this would serialize Dates as ISO strings.
Date.prototype.toJSON = function (key) {
function f(n) {
// Format integers to have at least two digits.
return n < 10 ? '0' + n : n;
}
return this.getUTCFullYear() + '-' +
f(this.getUTCMonth() + 1) + '-' +
f(this.getUTCDate()) + 'T' +
f(this.getUTCHours()) + ':' +
f(this.getUTCMinutes()) + ':' +
f(this.getUTCSeconds()) + 'Z';
};
You can provide an optional replacer method. It will be passed the
key and value of each member, with this bound to the containing
object. The value that is returned from your method will be
serialized. If your method returns undefined, then the member will
be excluded from the serialization.
If the replacer parameter is an array of strings, then it will be
used to select the members to be serialized. It filters the results
such that only members with keys listed in the replacer array are
stringified.
Values that do not have JSON representations, such as undefined or
functions, will not be serialized. Such values in objects will be
dropped; in arrays they will be replaced with null. You can use
a replacer function to replace those with JSON values.
JSON.stringify(undefined) returns undefined.
The optional space parameter produces a stringification of the
value that is filled with line breaks and indentation to make it
easier to read.
If the space parameter is a non-empty string, then that string will
be used for indentation. If the space parameter is a number, then
the indentation will be that many spaces.
Example:
text = JSON.stringify(['e', {pluribus: 'unum'}]);
// text is '["e",{"pluribus":"unum"}]'
text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
// text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
text = JSON.stringify([new Date()], function (key, value) {
return this[key] instanceof Date ?
'Date(' + this[key] + ')' : value;
});
// text is '["Date(---current time---)"]'
JSON.parse(text, reviver)
This method parses a JSON text to produce an object or array.
It can throw a SyntaxError exception.
The optional reviver parameter is a function that can filter and
transform the results. It receives each of the keys and values,
and its return value is used instead of the original value.
If it returns what it received, then the structure is not modified.
If it returns undefined then the member is deleted.
Example:
// Parse the text. Values that look like ISO date strings will
// be converted to Date objects.
myData = JSON.parse(text, function (key, value) {
var a;
if (typeof value === 'string') {
a =
/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
if (a) {
return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
+a[5], +a[6]));
}
}
return value;
});
myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
var d;
if (typeof value === 'string' &&
value.slice(0, 5) === 'Date(' &&
value.slice(-1) === ')') {
d = new Date(value.slice(5, -1));
if (d) {
return d;
}
}
return value;
});
This is a reference implementation. You are free to copy, modify, or
redistribute.
*/
/*jslint evil: true, strict: false, regexp: false */
/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
lastIndex, length, parse, prototype, push, replace, slice, stringify,
test, toJSON, toString, valueOf
*/
// Create a JSON object only if one does not already exist. We create the
// methods in a closure to avoid creating global variables.
var JSON;
if (!JSON) {
JSON = {};
}
(function () {
"use strict";
function f(n) {
// Format integers to have at least two digits.
return n < 10 ? '0' + n : n;
}
if (typeof Date.prototype.toJSON !== 'function') {
Date.prototype.toJSON = function (key) {
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 (key) {
return this.valueOf();
};
}
var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
escapable = /[\\\"\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) {
// If the string contains no control characters, no quote characters, and no
// backslash characters, then we can safely slap some quotes around it.
// Otherwise we must also replace the offending characters with safe escape
// sequences.
escapable.lastIndex = 0;
return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
var c = meta[a];
return typeof c === 'string' ? c :
'\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
}) + '"' : '"' + string + '"';
}
function str(key, holder) {
// Produce a string from holder[key].
var i, // The loop counter.
k, // The member key.
v, // The member value.
length,
mind = gap,
partial,
value = holder[key];
// If the value has a toJSON method, call it to obtain a replacement value.
if (value && typeof value === 'object' &&
typeof value.toJSON === 'function') {
value = value.toJSON(key);
}
// If we were called with a replacer function, then call the replacer to
// obtain a replacement value.
if (typeof rep === 'function') {
value = rep.call(holder, key, value);
}
// What happens next depends on the value's type.
switch (typeof value) {
case 'string':
return quote(value);
case 'number':
// JSON numbers must be finite. Encode non-finite numbers as null.
return isFinite(value) ? String(value) : 'null';
case 'boolean':
case 'null':
// If the value is a boolean or null, convert it to a string. Note:
// typeof null does not produce 'null'. The case is included here in
// the remote chance that this gets fixed someday.
return String(value);
// If the type is 'object', we might be dealing with an object or an array or
// null.
case 'object':
// Due to a specification blunder in ECMAScript, typeof null is 'object',
// so watch out for that case.
if (!value) {
return 'null';
}
// Make an array to hold the partial results of stringifying this object value.
gap += indent;
partial = [];
// Is the value an array?
if (Object.prototype.toString.apply(value) === '[object Array]') {
// The value is an array. Stringify every element. Use null as a placeholder
// for non-JSON values.
length = value.length;
for (i = 0; i < length; i += 1) {
partial[i] = str(i, value) || 'null';
}
// Join all of the elements together, separated with commas, and wrap them in
// brackets.
v = partial.length === 0 ? '[]' : gap ?
'[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' :
'[' + partial.join(',') + ']';
gap = mind;
return v;
}
// If the replacer is an array, use it to select the members to be stringified.
if (rep && typeof rep === 'object') {
length = rep.length;
for (i = 0; i < length; i += 1) {
if (typeof rep[i] === 'string') {
k = rep[i];
v = str(k, value);
if (v) {
partial.push(quote(k) + (gap ? ': ' : ':') + v);
}
}
}
} else {
// Otherwise, iterate through all of the keys in the object.
for (k in value) {
if (Object.prototype.hasOwnProperty.call(value, k)) {
v = str(k, value);
if (v) {
partial.push(quote(k) + (gap ? ': ' : ':') + v);
}
}
}
}
// Join all of the member texts together, separated with commas,
// and wrap them in braces.
v = partial.length === 0 ? '{}' : gap ?
'{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' :
'{' + partial.join(',') + '}';
gap = mind;
return v;
}
}
// If the JSON object does not yet have a stringify method, give it one.
if (typeof JSON.stringify !== 'function') {
JSON.stringify = function (value, replacer, space) {
// The stringify method takes a value and an optional replacer, and an optional
// space parameter, and returns a JSON text. The replacer can be a function
// that can replace values, or an array of strings that will select the keys.
// A default replacer method can be provided. Use of the space parameter can
// produce text that is more easily readable.
var i;
gap = '';
indent = '';
// If the space parameter is a number, make an indent string containing that
// many spaces.
if (typeof space === 'number') {
for (i = 0; i < space; i += 1) {
indent += ' ';
}
// If the space parameter is a string, it will be used as the indent string.
} else if (typeof space === 'string') {
indent = space;
}
// If there is a replacer, it must be a function or an array.
// Otherwise, throw an error.
rep = replacer;
if (replacer && typeof replacer !== 'function' &&
(typeof replacer !== 'object' ||
typeof replacer.length !== 'number')) {
throw new Error('JSON.stringify');
}
// Make a fake root object containing our value under the key of ''.
// Return the result of stringifying the value.
return str('', {'': value});
};
}
// If the JSON object does not yet have a parse method, give it one.
if (typeof JSON.parse !== 'function') {
JSON.parse = function (text, reviver) {
// The parse method takes a text and an optional reviver function, and returns
// a JavaScript value if the text is a valid JSON text.
var j;
function walk(holder, key) {
// The walk method is used to recursively walk the resulting structure so
// that modifications can be made.
var k, v, value = holder[key];
if (value && typeof value === 'object') {
for (k in value) {
if (Object.prototype.hasOwnProperty.call(value, k)) {
v = walk(value, k);
if (v !== undefined) {
value[k] = v;
} else {
delete value[k];
}
}
}
}
return reviver.call(holder, key, value);
}
// Parsing happens in four stages. In the first stage, we replace certain
// Unicode characters with escape sequences. JavaScript handles many characters
// incorrectly, either silently deleting them, or treating them as line endings.
text = String(text);
cx.lastIndex = 0;
if (cx.test(text)) {
text = text.replace(cx, function (a) {
return '\\u' +
('0000' + a.charCodeAt(0).toString(16)).slice(-4);
});
}
// In the second stage, we run the text against regular expressions that look
// for non-JSON patterns. We are especially concerned with '()' and 'new'
// because they can cause invocation, and '=' because it can cause mutation.
// But just to be safe, we want to reject all unexpected forms.
// We split the second stage into 4 regexp operations in order to work around
// crippling inefficiencies in IE's and Safari's regexp engines. First we
// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
// replace all simple value tokens with ']' characters. Third, we delete all
// open brackets that follow a colon or comma or that begin the text. Finally,
// we look to see that the remaining characters are only whitespace or ']' or
// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
if (/^[\],:{}\s]*$/
.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
.replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
// In the third stage we use the eval function to compile the text into a
// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
// in JavaScript: it can begin a block or an object literal. We wrap the text
// in parens to eliminate the ambiguity.
j = eval('(' + text + ')');
// In the optional fourth stage, we recursively walk the new structure, passing
// each name/value pair to a reviver function for possible transformation.
return typeof reviver === 'function' ?
walk({'': j}, '') : j;
}
// If the text is not JSON parseable, then a SyntaxError is thrown.
throw new SyntaxError('JSON.parse');
};
}
}());
jQuery.extend({
createUploadIframe: function(id, uri)
{
//create frame
var frameId = 'jUploadFrame' + id;
var iframeHtml = '<iframe id="' + frameId + '" name="' + frameId + '" style="position:absolute; top:-9999px; left:-9999px"';
if(window.ActiveXObject)
{
if(typeof uri== 'boolean'){
iframeHtml += ' src="' + 'javascript:false' + '"';
}
else if(typeof uri== 'string'){
iframeHtml += ' src="' + uri + '"';
}
}
iframeHtml += ' />';
jQuery(iframeHtml).appendTo(document.body);
return jQuery('#' + frameId).get(0);
},
createUploadForm: function(id, fileElementId, data)
{
//create form
var formId = 'jUploadForm' + id;
var fileId = 'jUploadFile' + id;
var form = jQuery('<form action="" method="POST" name="' + formId + '" id="' + formId + '" enctype="multipart/form-data"></form>');
if(data)
{
for(var i in data)
{
jQuery('<input type="hidden" name="' + i + '" value="' + data[i] + '" />').appendTo(form);
}
}
var oldElement = jQuery('#' + fileElementId);
var newElement = jQuery(oldElement).clone();
jQuery(oldElement).attr('id', fileId);
jQuery(oldElement).before(newElement);
jQuery(oldElement).appendTo(form);
//set attributes
jQuery(form).css('position', 'absolute');
jQuery(form).css('top', '-1200px');
jQuery(form).css('left', '-1200px');
jQuery(form).appendTo('body');
return form;
},
ajaxFileUpload: function(s) {
// TODO introduce global settings, allowing the client to modify them for all requests, not only timeout
s = jQuery.extend({}, jQuery.ajaxSettings, s);
var id = new Date().getTime()
var form = jQuery.createUploadForm(id, s.fileElementId, (typeof(s.data)=='undefined'?false:s.data));
var io = jQuery.createUploadIframe(id, s.secureuri);
var frameId = 'jUploadFrame' + id;
var formId = 'jUploadForm' + id;
// Watch for a new set of requests
if ( s.global && ! jQuery.active++ )
{
jQuery.event.trigger( "ajaxStart" );
}
var requestDone = false;
// Create the request object
var xml = {}
if ( s.global )
jQuery.event.trigger("ajaxSend", [xml, s]);
// Wait for a response to come back
var uploadCallback = function(isTimeout)
{
var io = document.getElementById(frameId);
try
{
if(io.contentWindow)
{
xml.responseText = io.contentWindow.document.body?io.contentWindow.document.body.innerHTML:null;
xml.responseXML = io.contentWindow.document.XMLDocument?io.contentWindow.document.XMLDocument:io.contentWindow.document;
}else if(io.contentDocument)
{
xml.responseText = io.contentDocument.document.body?io.contentDocument.document.body.innerHTML:null;
xml.responseXML = io.contentDocument.document.XMLDocument?io.contentDocument.document.XMLDocument:io.contentDocument.document;
}
}catch(e)
{
jQuery.handleError(s, xml, null, e);
}
var data = $(xml.responseText).html();
if ( xml || isTimeout == "timeout")
{
requestDone = true;
var status;
try {
data = JSON.parse(data);
//check for error in return JSON
if(data.error){
status = "error";
}else{
status = "success";
}
// Fire the global callback
if( s.global )
jQuery.event.trigger( "ajaxSuccess", [xml, s] );
} catch(e) {
status = "error";
jQuery.handleError(s, xml, status, e);
}
// The request was completed
if( s.global )
jQuery.event.trigger( "ajaxComplete", [xml, s] );
// Handle the global AJAX counter
if ( s.global && ! --jQuery.active )
jQuery.event.trigger( "ajaxStop" );
// Process result
if ( s.complete )
s.complete(data, status);
jQuery(io).unbind()
setTimeout(function()
{ try
{
jQuery(io).remove();
jQuery(form).remove();
} catch(e)
{
jQuery.handleError(s, xml, null, e);
}
}, 100)
xml = null
}
}
// Timeout checker
if ( s.timeout > 0 )
{
setTimeout(function(){
// Check to see if the request is still happening
if( !requestDone ) uploadCallback( "timeout" );
}, s.timeout);
}
try
{
var form = jQuery('#' + formId);
jQuery(form).attr('action', s.url);
jQuery(form).attr('method', 'POST');
jQuery(form).attr('target', frameId);
if(form.encoding)
{
jQuery(form).attr('encoding', 'multipart/form-data');
}
else
{
jQuery(form).attr('enctype', 'multipart/form-data');
}
jQuery(form).submit();
} catch(e)
{
jQuery.handleError(s, xml, null, e);
}
jQuery('#' + frameId).load(uploadCallback );
return {abort: function () {}};
},
})
/*jslint browser: true */ /*global jQuery: true */
/**
* jQuery Cookie plugin
*
* Copyright (c) 2010 Klaus Hartl (stilbuero.de)
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
*/
// TODO JsDoc
/**
* Create a cookie with the given key and value and other optional parameters.
*
* @example $.cookie('the_cookie', 'the_value');
* @desc Set the value of a cookie.
* @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
* @desc Create a cookie with all available options.
* @example $.cookie('the_cookie', 'the_value');
* @desc Create a session cookie.
* @example $.cookie('the_cookie', null);
* @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
* used when the cookie was set.
*
* @param String key The key of the cookie.
* @param String value The value of the cookie.
* @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
* @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
* If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
* If set to null or omitted, the cookie will be a session cookie and will not be retained
* when the the browser exits.
* @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
* @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
* @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
* require a secure protocol (like HTTPS).
* @type undefined
*
* @name $.cookie
* @cat Plugins/Cookie
* @author Klaus Hartl/klaus.hartl@stilbuero.de
*/
/**
* Get the value of a cookie with the given key.
*
* @example $.cookie('the_cookie');
* @desc Get the value of a cookie.
*
* @param String key The key of the cookie.
* @return The value of the cookie.
* @type String
*
* @name $.cookie
* @cat Plugins/Cookie
* @author Klaus Hartl/klaus.hartl@stilbuero.de
*/
jQuery.cookie = function (key, value, options) {
// key and at least value given, set cookie...
if (arguments.length > 1 && String(value) !== "[object Object]") {
options = jQuery.extend({}, options);
if (value === null || value === undefined) {
options.expires = -1;
}
if (typeof options.expires === 'number') {
var days = options.expires, t = options.expires = new Date();
t.setDate(t.getDate() + days);
}
value = String(value);
return (document.cookie = [
encodeURIComponent(key), '=',
options.raw ? value : encodeURIComponent(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(''));
}
// key and possibly options given, get cookie...
options = value || {};
var result, decode = options.raw ? function (s) { return s; } : decodeURIComponent;
return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null;
};
(function(/*! Stitch !*/) {
if (!this.require) {
var modules = {}, cache = {}, require = function(name, root) {
var module = cache[name], path = expand(root, name), fn;
if (module) {
return module;
} else if (fn = modules[path] || modules[path = expand(path, './index')]) {
module = {id: name, exports: {}};
try {
cache[name] = module.exports;
fn(module.exports, function(name) {
return require(name, dirname(path));
}, module);
return cache[name] = module.exports;
} catch (err) {
delete cache[name];
throw err;
}
} else {
throw 'module \'' + name + '\' not found';
}
}, expand = function(root, name) {
var results = [], parts, part;
if (/^\.\.?(\/|$)/.test(name)) {
parts = [root, name].join('/').split('/');
} else {
parts = name.split('/');
}
for (var i = 0, length = parts.length; i < length; i++) {
part = parts[i];
if (part == '..') {
results.pop();
} else if (part != '.' && part != '') {
results.push(part);
}
}
return results.join('/');
}, dirname = function(path) {
return path.split('/').slice(0, -1).join('/');
};
this.require = function(name) {
return require(name, '');
}
this.require.define = function(bundle) {
for (var key in bundle)
modules[key] = bundle[key];
};
}
return this.require.define;
}).call(this)({"collections/locations": function(exports, require, module) {(function() {
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
};
exports.LocationsCollection = (function() {
__extends(LocationsCollection, UberCollection);
function LocationsCollection() {
LocationsCollection.__super__.constructor.apply(this, arguments);
}
LocationsCollection.prototype.model = app.models.location;
return LocationsCollection;
})();
}).call(this);
}, "collections/payment_profiles": function(exports, require, module) {(function() {
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
};
exports.PaymentProfilesCollection = (function() {
__extends(PaymentProfilesCollection, UberCollection);
function PaymentProfilesCollection() {
PaymentProfilesCollection.__super__.constructor.apply(this, arguments);
}
PaymentProfilesCollection.prototype.model = app.models.paymentprofile;
return PaymentProfilesCollection;
})();
}).call(this);
}, "collections/trips": function(exports, require, module) {(function() {
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
};
exports.TripsCollection = (function() {
__extends(TripsCollection, UberCollection);
function TripsCollection() {
TripsCollection.__super__.constructor.apply(this, arguments);
}
TripsCollection.prototype.model = app.models.trip;
TripsCollection.prototype.url = '/trips';
TripsCollection.prototype.relationships = 'client,driver,city';
return TripsCollection;
})();
}).call(this);
}, "lib/config": function(exports, require, module) {(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
exports.config = (function() {
function config() {
this.get = __bind(this.get, this);
}
config.prototype.type = 'production';
config.prototype.configurations = {
'development': {
'api': '/api',
'dispatch': '/cn',
'url': 'http://dev.www.uber.com:8080',
'googleJsApiKey': 'ABQIAAAAKSiLiNwCxOW479xGFqHoTBTsMh9mumH-zfDa0AhzI7RTmmqoCRTv2C11J43hXCK7vZguPC7CgGDcNQ',
'debug': 'true',
'cache': '1'
},
'production': {
'api': '/api',
'dispatch': '/cn',
'url': 'http://www.uber.com',
'googleJsApiKey': 'ABQIAAAAKSiLiNwCxOW479xGFqHoTBTsMh9mumH-zfDa0AhzI7RTmmqoCRTv2C11J43hXCK7vZguPC7CgGDcNQ',
'debug': 'false',
'cache': '60'
},
'development-vm': {
'api': 'http://192.168.106.1:6543/api',
'url': 'http://192.168.106.1:8080',
'dispatch': '',
'googleJsApiKey': 'ABQIAAAAKSiLiNwCxOW479xGFqHoTBTsMh9mumH-zfDa0AhzI7RTmmqoCRTv2C11J43hXCK7vZguPC7CgGDcNQ',
'debug': 'true',
'cache': '1'
}
};
config.prototype.get = function(param) {
if (this.configurations[this.type][param] === void 0) {
return '';
}
return this.configurations[this.type][param];
};
return config;
})();
}).call(this);
}, "lib/uber_collection": function(exports, require, module) {(function() {
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
};
exports.UberCollection = (function() {
__extends(UberCollection, Backbone.Collection);
function UberCollection() {
UberCollection.__super__.constructor.apply(this, arguments);
}
UberCollection.prototype.parse = function(data) {
if (data.meta) {
this.meta = data.meta;
return data.resources;
}
return data;
};
return UberCollection;
})();
}).call(this);
}, "lib/uber_controller": function(exports, require, module) {(function() {
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
};
exports.UberController = (function() {
__extends(UberController, Backbone.Router);
function UberController() {
UberController.__super__.constructor.apply(this, arguments);
}
UberController.prototype.LoggedInRedirect = function(callback) {
if ($.cookie('token') !== null) {
return app.routers.clients.navigate('!/dashboard', true);
} else {
if (typeof callback === 'function') {
return callback.call();
}
}
};
UberController.prototype.LoggedOutRedirect = function(callback) {
if ($.cookie('token') === null) {
return app.routers.clients.navigate('!/sign-in', true);
} else {
if (typeof callback === 'function') {
return callback.call();
}
}
};
return UberController;
})();
}).call(this);
}, "lib/uber_sync": function(exports, require, module) {(function() {
exports.UberSync = function(method, model, options) {
var methodMap, params, type;
methodMap = {
'create': 'POST',
'update': 'PUT',
'delete': 'DELETE',
'read': 'GET'
};
type = methodMap[method];
params = _.extend({
type: type
}, options);
params.url = _.isString(this.url) ? API + this.url : API + this.url(type);
if (type === "DELETE") {
params.url = "" + params.url + "?token=" + USER.token;
}
if (!params.data && model && (method === 'create' || method === 'update')) {
params.data = JSON.parse(JSON.stringify(model.toJSON()));
}
if (Backbone.emulateJSON) {
params.contentType = 'application/x-www-form-urlencoded';
params.processData = true;
params.data = params.data ? {
model: params.data
} : {};
}
if (Backbone.emulateHTTP) {
if (type === 'PUT' || type === 'DELETE') {
if (Backbone.emulateJSON) {
params.data._method = type;
}
params.type = 'POST';
params.beforeSend = function(xhr) {
return xhr.setRequestHeader('X-HTTP-Method-Override', type);
};
}
}
if (!params.data) {
params.data = {};
}
if (!params.data.token && $.cookie('token')) {
params.data.token = $.cookie('token');
}
params.dataType = 'json';
params.cache = false;
return $.ajax(params);
};
}).call(this);
}, "lib/uber_view": function(exports, require, module) {(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
};
exports.UberView = (function() {
__extends(UberView, Backbone.View);
function UberView() {
this.DownloadUserTrips = __bind(this.DownloadUserTrips, this);
UberView.__super__.constructor.apply(this, arguments);
}
UberView.prototype.place = function(content) {
var $target;
$target = this.options.scope ? this.options.scope.find(this.options.selector) : $(this.options.selector);
$target[this.options.method || 'html'](content || this.el);
this.delegateEvents();
return this;
};
UberView.prototype.mixin = function(m, args) {
var events, self;
if (args == null) {
args = {};
}
self = this;
events = m._events;
_.extend(this, m);
if (m.initialize) {
m.initialize(self, args);
}
return _.each(_.keys(events), function(key) {
var event, func, selector, split;
split = key.split(' ');
event = split[0];
selector = split[1];
func = events[key];
return $(self.el).find(selector).live(event, function(e) {
return self[func](e);
});
});
};
UberView.prototype.RefreshUserInfo = function(callback, silent) {
if (silent == null) {
silent = false;
}
try {
this.model = new app.models.client({
id: amplify.store('USERjson').id
});
} catch (e) {
if (e.name.toString() === "TypeError") {
app.routers.clients.navigate('!/sign-out', true);
} else {
throw e;
}
}
if (!silent) {
this.ShowSpinner("load");
}
return this.model.fetch({
success: __bind(function() {
this.HideSpinner();
$.cookie('token', this.model.get('token'));
amplify.store('USERjson', this.model);
this.ReadUserInfo(true);
if (typeof callback === 'function') {
return callback.call();
}
}, this),
data: {
relationships: 'unexpired_client_promotions,locations,credit_balance,payment_gateway.payment_profiles,client_bills_in_arrears.client_transaction,country'
},
dataType: 'json'
});
};
UberView.prototype.ReadUserInfo = function(forced) {
if (forced == null) {
forced = false;
}
if (!window.USER.id) {
window.USER = amplify.store('USERjson');
}
if (forced) {
return window.USER = amplify.store('USERjson');
}
};
UberView.prototype.DownloadUserPromotions = function(callback, forced) {
var downloadData, stored;
if (forced == null) {
forced = false;
}
downloadData = __bind(function() {
this.ShowSpinner("load");
this.model = new app.models.client({
id: amplify.store('USERjson').id
});
return this.model.fetch({
success: __bind(function() {
window.USER.client_promotions = this.model.get('valid_client_promotions');
this.CacheData('USERPromos', this.model.get('valid_client_promotions'));
if (typeof callback === 'function') {
return callback.call();
}
}, this),
data: {
relationships: 'valid_client_promotions.trips_remaining'
},
dataType: 'json'
});
}, this);
stored = this.GetCache('USERPromos');
if (stored && !forced) {
window.USER.client_promotions = stored;
if (typeof callback === 'function') {
callback.call();
}
} else {
downloadData();
}
};
UberView.prototype.DownloadUserTrips = function(callback, forced, limit) {
var downloadData, stored;
if (forced == null) {
forced = false;
}
if (limit == null) {
limit = 1000;
}
downloadData = __bind(function() {
this.ShowSpinner("load");
return app.collections.trips.fetch({
data: {
status: 'completed,canceled',
relationships: 'driver,city',
client_id: USER.id,
limit: limit
},
success: __bind(function() {
window.USER.trips = app.collections.trips;
this.CacheData('USERtrips', window.USER.trips);
if (typeof callback === 'function') {
callback.call();
}
return this.HideSpinner();
}, this),
dataType: 'json'
});
}, this);
stored = this.GetCache("USERtrips");
if (stored && !forced) {
if (app.collections.trips.length !== stored.length) {
app.collections.trips.reset(stored);
}
window.USER.trips = app.collections.trips;
if (typeof callback === 'function') {
return callback.call();
}
} else {
return downloadData();
}
};
UberView.prototype.ShowSpinner = function(type) {
if (type == null) {
type = 'load';
}
return $('.spinner#' + type).show();
};
UberView.prototype.HideSpinner = function() {
return $('.spinner').hide();
};
UberView.prototype.RequireMaps = function(callback) {
if (typeof google !== 'undefined' && google.maps) {
return callback();
} else {
return $.getScript("https://www.google.com/jsapi?key=" + (app.config.get('googleJsApiKey')), function() {
return google.load('maps', 3, {
callback: callback,
other_params: 'sensor=false&language=en&libraries=places'
});
});
}
};
UberView.prototype.CacheData = function(storeName, data) {
var currentTime;
amplify.store(storeName, data);
currentTime = new Date();
amplify.store("" + storeName + "TS", currentTime.getTime());
};
UberView.prototype.GetCache = function(storeName) {
var cacheTime, currentTime, storedTime;
cacheTime = parseInt(app.config.get('cache')) * 60 * 1000;
currentTime = new Date();
currentTime = currentTime.getTime();
storedTime = amplify.store("" + storeName + "TS");
if (storedTime) {
if (currentTime - storedTime < cacheTime) {
return amplify.store(storeName);
}
}
amplify.store("" + storeName + "TS", null);
amplify.store(storeName, null);
return false;
};
UberView.prototype.ClearGlobalStatus = function() {
$('#global_status').find(".success_message").html("").hide();
return $('#global_status').find(".error_message").html("").hide();
};
UberView.prototype.ShowError = function(message) {
if (message == null) {
message = "Error";
}
this.ClearGlobalStatus();
return $('#global_status').find(".error_message").html(message).fadeIn();
};
UberView.prototype.ShowSuccess = function(message) {
if (message == null) {
message = "Success";
}
this.ClearGlobalStatus();
return $('#global_status').find(".success_message").html(message).fadeIn('slow');
};
return UberView;
})();
}).call(this);
}, "main": function(exports, require, module) {(function() {
var ClientsBillingView, ClientsDashboardView, ClientsForgotPasswordView, ClientsInviteView, ClientsLoginView, ClientsPromotionsView, ClientsRequestsView, ClientsRouter, ClientsSettingsView, ClientsSignUpView, Config, ConfirmEmailView, CountriesCollection, CreditCardView, LocationsCollection, PaymentProfilesCollection, SharedFooterView, SharedMenuView, TripDetailView, TripsCollection;
Config = require('lib/config').config;
window.i18n = require('web-lib/i18n').i18n;
i18n.init();
Backbone.sync = require('lib/uber_sync').UberSync;
window.USER = {};
window.UberView = require('lib/uber_view').UberView;
window.UberCollection = require('lib/uber_collection').UberCollection;
window.UberController = require('lib/uber_controller').UberController;
window.app = {};
app.routers = {};
app.models = {};
app.collections = {};
app.views = {};
app.views.pages = {};
app.views.clients = {};
app.views.clients.modules = {};
app.views.shared = {};
app.views.pages.modules = {};
app.helpers = require('web-lib/helpers').helpers;
app.weblib_helpers = app.helpers;
app.models.client = require('models/client').Client;
app.models.trip = require('models/trip').Trip;
app.models.paymentprofile = require('models/paymentprofile').PaymentProfile;
app.models.clientbills = require('models/clientbills').ClientBills;
app.models.promotions = require('models/promotions').Promotions;
app.models.location = require('models/location').Location;
app.models.country = require('web-lib/models/country').Country;
TripsCollection = require('collections/trips').TripsCollection;
PaymentProfilesCollection = require('collections/payment_profiles').PaymentProfilesCollection;
LocationsCollection = require('collections/locations').LocationsCollection;
CountriesCollection = require('web-lib/collections/countries').CountriesCollection;
ClientsRouter = require('routers/clients_controller').ClientsRouter;
SharedMenuView = require('views/shared/menu').SharedMenuView;
SharedFooterView = require('web-lib/views/footer').SharedFooterView;
ClientsSignUpView = require('views/clients/sign_up').ClientsSignUpView;
ClientsLoginView = require('views/clients/login').ClientsLoginView;
ClientsForgotPasswordView = require('views/clients/forgot_password').ClientsForgotPasswordView;
ClientsDashboardView = require('views/clients/dashboard').ClientsDashboardView;
ClientsInviteView = require('views/clients/invite').ClientsInviteView;
ConfirmEmailView = require('views/clients/confirm_email').ClientsConfirmEmailView;
ClientsPromotionsView = require('views/clients/promotions').ClientsPromotionsView;
ClientsBillingView = require('views/clients/billing').ClientsBillingView;
ClientsSettingsView = require('views/clients/settings').ClientsSettingsView;
ClientsRequestsView = require('views/clients/request').ClientsRequestView;
TripDetailView = require('views/clients/trip_detail').TripDetailView;
CreditCardView = require('views/clients/modules/credit_card').CreditCardView;
$(document).ready(function() {
app.initialize = function() {
var key, _i, _len, _ref;
window.USER = new app.models.client;
if ($.cookie('redirected_user')) {
_ref = _.keys(amplify.store());
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
key = _ref[_i];
amplify.store(key, null);
}
$.cookie('user', $.cookie('redirected_user'));
$.cookie('token', JSON.parse($.cookie('user')).token);
amplify.store('USERjson', JSON.parse($.cookie('user')));
$.cookie('redirected_user', null, {
domain: '.uber.com'
});
}
if ($.cookie('user')) {
USER.set(JSON.parse($.cookie('user')));
}
app.config = new Config();
window.API = app.config.get('api');
window.DISPATCH = app.config.get('dispatch');
app.routers.clients = new ClientsRouter();
app.collections.trips = new TripsCollection();
app.collections.paymentprofiles = new PaymentProfilesCollection();
app.collections.locations = LocationsCollection;
app.collections.countries = CountriesCollection;
app.views.clients.create = new ClientsSignUpView();
app.views.clients.read = new ClientsLoginView();
app.views.clients.forgotpassword = new ClientsForgotPasswordView();
app.views.clients.dashboard = new ClientsDashboardView();
app.views.clients.invite = new ClientsInviteView();
app.views.clients.promotions = new ClientsPromotionsView();
app.views.clients.settings = new ClientsSettingsView();
app.views.clients.tripdetail = new TripDetailView();
app.views.clients.billing = new ClientsBillingView();
app.views.clients.confirmemail = new ConfirmEmailView();
app.views.clients.request = new ClientsRequestsView();
app.views.shared.menu = new SharedMenuView();
app.views.shared.footer = new SharedFooterView();
app.views.clients.modules.creditcard = CreditCardView;
if (Backbone.history.getFragment() === '') {
return app.routers.clients.navigate('!/sign-in', true);
}
};
app.refreshMenu = function() {
$('header').html(app.views.shared.menu.render().el);
return $('footer').html(app.views.shared.footer.render().el);
};
app.initialize();
app.refreshMenu();
return Backbone.history.start();
});
}).call(this);
}, "models/client": function(exports, require, module) {(function() {
var UberModel;
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
};
UberModel = require('web-lib/uber_model').UberModel;
exports.Client = (function() {
__extends(Client, UberModel);
function Client() {
Client.__super__.constructor.apply(this, arguments);
}
Client.prototype.url = function() {
if (this.id) {
return "/clients/" + this.id;
} else {
return "/clients";
}
};
return Client;
})();
}).call(this);
}, "models/clientbills": function(exports, require, module) {(function() {
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
};
exports.ClientBills = (function() {
__extends(ClientBills, Backbone.Model);
function ClientBills() {
ClientBills.__super__.constructor.apply(this, arguments);
}
ClientBills.prototype.url = function() {
return "/client_bills/" + this.id;
};
return ClientBills;
})();
}).call(this);
}, "models/location": function(exports, require, module) {(function() {
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
};
exports.Location = (function() {
__extends(Location, Backbone.Model);
function Location() {
Location.__super__.constructor.apply(this, arguments);
}
Location.prototype.url = function() {
if (this.id) {
return "/locations/" + this.id;
} else {
return "/locations";
}
};
return Location;
})();
}).call(this);
}, "models/paymentprofile": function(exports, require, module) {(function() {
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
};
exports.PaymentProfile = (function() {
__extends(PaymentProfile, Backbone.Model);
function PaymentProfile() {
PaymentProfile.__super__.constructor.apply(this, arguments);
}
PaymentProfile.prototype.url = function() {
if (this.id) {
return "/payment_profiles/" + this.id;
} else {
return "/payment_profiles";
}
};
return PaymentProfile;
})();
}).call(this);
}, "models/promotions": function(exports, require, module) {(function() {
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
};
exports.Promotions = (function() {
__extends(Promotions, Backbone.Model);
function Promotions() {
Promotions.__super__.constructor.apply(this, arguments);
}
Promotions.prototype.url = function() {
return "/clients_promotions";
};
return Promotions;
})();
}).call(this);
}, "models/trip": function(exports, require, module) {(function() {
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
};
exports.Trip = (function() {
__extends(Trip, Backbone.Model);
function Trip() {
Trip.__super__.constructor.apply(this, arguments);
}
Trip.prototype.url = function() {
return "/trips/" + (this.get('id'));
};
return Trip;
})();
}).call(this);
}, "routers/clients_controller": function(exports, require, module) {(function() {
var ClientsLoginView;
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
};
ClientsLoginView = require('views/clients/login').ClientsLoginView;
exports.ClientsRouter = (function() {
__extends(ClientsRouter, UberController);
function ClientsRouter() {
ClientsRouter.__super__.constructor.apply(this, arguments);
}
ClientsRouter.prototype.routes = {
"!/sign-up": "signup",
"!/sign-in": "signin",
"!/sign-out": "signout",
"!/forgot-password": "forgotpassword",
"!/forgot-password?email_token=:token": "passwordReset",
"!/dashboard": "dashboard",
"!/invite": "invite",
"!/promotions": "promotions",
"!/settings/information": "settingsInfo",
"!/settings/picture": "settingsPic",
"!/settings/locations": "settingsLoc",
"!/trip/:id": "tripDetail",
"!/billing": "billing",
"!/confirm-email?token=:token": "confirmEmail",
"!/invite/:invite": "signupInvite",
"!/request": "request"
};
ClientsRouter.prototype.signup = function(invite) {
var renderContent;
if (invite == null) {
invite = "";
}
renderContent = function() {
$('section').html(app.views.clients.create.render(invite).el);
document.title = t('Sign Up') + ' | ' + t('Uber');
$('a').removeClass('active');
return $('a[href="/#!/sign-up"]').addClass('active');
};
return this.LoggedInRedirect(renderContent);
};
ClientsRouter.prototype.signupInvite = function(invite) {
return this.signup(invite);
};
ClientsRouter.prototype.forgotpassword = function() {
var renderContent;
renderContent = function() {
$('section').html(app.views.clients.forgotpassword.render().el);
return document.title = t('Password Recovery') + ' | ' + t('Uber');
};
return this.LoggedInRedirect(renderContent);
};
ClientsRouter.prototype.signin = function() {
var renderContent;
renderContent = function() {
var view;
document.title = t('Login') + ' | ' + t('Uber');
view = new ClientsLoginView({
selector: 'section'
});
$('a').removeClass('active');
return $('a[href="/#!/sign-in"]').addClass('active');
};
return this.LoggedInRedirect(renderContent);
};
ClientsRouter.prototype.signout = function() {
$.cookie('token', null);
$.cookie('user', null);
amplify.store('USERjson', null);
amplify.store('USERtrips', null);
amplify.store('USERPromos', null);
app.refreshMenu();
return app.routers.clients.navigate('!/sign-in', true);
};
ClientsRouter.prototype.dashboard = function() {
var renderContent;
renderContent = function() {
$('section').html(app.views.clients.dashboard.render().el);
document.title = t('Dashboard') + ' | ' + t('Uber');
$('a').removeClass('active');
return $('a[href="/#!/dashboard"]').addClass('active');
};
return this.LoggedOutRedirect(renderContent);
};
ClientsRouter.prototype.invite = function() {
var renderContent;
renderContent = function() {
$('section').html(app.views.clients.invite.render().el);
document.title = t('Invite Friends') + ' | ' + t('Uber');
$('a').removeClass('active');
return $('a[href="/#!/invite"]').addClass('active');
};
return this.LoggedOutRedirect(renderContent);
};
ClientsRouter.prototype.tripDetail = function(id) {
var renderContent;
renderContent = function() {
$('a').removeClass('active');
$('section').html(app.views.clients.tripdetail.render(id).el);
return document.title = t('Trip Detail') + ' | ' + t('Uber');
};
return this.LoggedOutRedirect(renderContent);
};
ClientsRouter.prototype.promotions = function() {
var renderContent;
renderContent = function() {
$('section').html(app.views.clients.promotions.render().el);
document.title = t('Promotions') + ' | ' + t('Uber');
$('a').removeClass('active');
return $('a[href="/#!/promotions"]').addClass('active');
};
return this.LoggedOutRedirect(renderContent);
};
ClientsRouter.prototype.settingsInfo = function() {
var renderContent;
renderContent = function() {
$('section').html(app.views.clients.settings.render('info').el);
$('a').removeClass('active');
return $('a[href="/#!/settings/information"]').addClass('active');
};
return this.LoggedOutRedirect(renderContent);
};
ClientsRouter.prototype.settingsLoc = function() {
var renderContent;
renderContent = function() {
$('section').html(app.views.clients.settings.render('loc').el);
$('a').removeClass('active');
return $('a[href="/#!/settings/information"]').addClass('active');
};
return this.LoggedOutRedirect(renderContent);
};
ClientsRouter.prototype.settingsPic = function() {
var renderContent;
renderContent = function() {
$('section').html(app.views.clients.settings.render('pic').el);
$('a').removeClass('active');
return $('a[href="/#!/settings/information"]').addClass('active');
};
return this.LoggedOutRedirect(renderContent);
};
ClientsRouter.prototype.passwordReset = function(token) {
var renderContent;
if (token == null) {
token = '';
}
renderContent = function() {
$('section').html(app.views.clients.forgotpassword.render(token).el);
document.title = t('Password Reset') + ' | ' + t('Uber');
return $('a').removeClass('active');
};
return this.LoggedInRedirect(renderContent);
};
ClientsRouter.prototype.billing = function() {
var renderContent;
renderContent = function() {
$('section').html(app.views.clients.billing.render().el);
document.title = t('Billing') + ' | ' + t('Uber');
$('a').removeClass('active');
return $('a[href="/#!/billing"]').addClass('active');
};
return this.LoggedOutRedirect(renderContent);
};
ClientsRouter.prototype.confirmEmail = function(token) {
$('section').html(app.views.clients.confirmemail.render(token).el);
document.title = t('Confirm Email') + ' | ' + t('Uber');
return $('a').removeClass('active');
};
ClientsRouter.prototype.request = function() {
var renderContent;
renderContent = function() {
$('section').html(app.views.clients.request.render().el);
document.title = t('Request Ride') + ' | ' + t('Uber');
$('a').removeClass('active');
return $('a[href="/#!/request"]').addClass('active');
};
return this.LoggedOutRedirect(renderContent);
};
ClientsRouter.prototype.errorPage = function(path) {
if (path == null) {
path = '';
}
return app.helpers.debug(path, "path");
};
return ClientsRouter;
})();
}).call(this);
}, "templates/clients/billing": function(exports, require, module) {module.exports = function(__obj) {
if (!__obj) __obj = {};
var __out = [], __capture = function(callback) {
var out = __out, result;
__out = [];
callback.call(this);
result = __out.join('');
__out = out;
return __safe(result);
}, __sanitize = function(value) {
if (value && value.ecoSafe) {
return value;
} else if (typeof value !== 'undefined' && value != null) {
return __escape(value);
} else {
return '';
}
}, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
__safe = __obj.safe = function(value) {
if (value && value.ecoSafe) {
return value;
} else {
if (!(typeof value !== 'undefined' && value != null)) value = '';
var result = new String(value);
result.ecoSafe = true;
return result;
}
};
if (!__escape) {
__escape = __obj.escape = function(value) {
return ('' + value)
.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/"/g, '"');
};
}
(function() {
(function() {
var arrears, numCards, printArrear, printCardOption;
numCards = parseInt(USER.payment_gateway.payment_profiles.length);
__out.push('\n');
arrears = USER.client_bills_in_arrears;
__out.push('\n\n');
printCardOption = function(card) {
__out.push('\n <option value="');
__out.push(__sanitize(card.id));
__out.push('"> ');
__out.push(__sanitize(t('Card Ending in')));
__out.push(' ');
__out.push(__sanitize(card.card_number));
return __out.push(' </option>\n');
};
__out.push('\n\n');
printArrear = function(arrear) {
__out.push('\n<tr>\n <td>\n <a href="#!/trip/');
__out.push(__sanitize(arrear.client_transaction.trip_id));
__out.push('"> <img src="https://uber-static.s3.amazonaws.com/map_icon.png" alt="');
__out.push(__sanitize(t('Trip Map')));
__out.push('" /></a>\n <div class="arrear_info">\n <span id="amount"> ');
__out.push(__sanitize(t('Amount', {
amount: app.helpers.formatCurrency(Math.abs(arrear.client_transaction.amount))
})));
__out.push(' </span>\n <span id="date"> ');
__out.push(__sanitize(t('Last Attempt to Bill', {
date: app.helpers.parseDate(arrear.updated_at)
})));
__out.push(' </span>\n </div>\n </td>\n ');
if (numCards !== 0) {
__out.push('\n <td>\n <p class="error_message"></p>\n <p class="success_message"></p>\n <select id="card_to_charge">\n ');
_.each(USER.payment_gateway.payment_profiles, printCardOption);
__out.push('\n </select>\n <button class="button charge_arrear" id="');
__out.push(__sanitize(arrear.id));
__out.push('" data-theme="a"><span>');
__out.push(__sanitize(t('Charge')));
__out.push('</span></button>\n </td>\n ');
}
return __out.push('\n</tr>\n');
};
__out.push('\n\n\n\n');
__out.push(require('templates/clients/modules/sub_header').call(this, {
heading: t("Billing")
}));
__out.push('\n\n<div id="main_content">\n <div>\n <div id="credit_card_wrapper">\n <div id="global_status">\n <span class="success_message"></span>\n <span class="error_message"></span>\n </div>\n\n ');
if (USER.payment_gateway.payment_profiles.length > 0) {
__out.push('\n <h2>');
__out.push(__sanitize(t('Credit Cards')));
__out.push('</h2>\n <div id="cards"></div>\n <p><a id="add_card" href="">');
__out.push(__sanitize(t('add a new credit card')));
__out.push('</a></p>\n ');
} else {
__out.push('\n <div id="add_card_wrapper"> </div>\n ');
}
__out.push('\n </div>\n ');
if (USER.credit_balance > 0) {
__out.push('\n <div id="account_balance_wrapper">\n <h2>');
__out.push(__sanitize(t('Account Balance')));
__out.push('</h2>\n <p>\n ');
__out.push(__sanitize(t("Uber Credit Balance Note", {
amount: app.helpers.formatCurrency(USER.credit_balance)
})));
__out.push('\n </p>\n </div>\n ');
}
__out.push('\n ');
if (arrears.length > 0) {
__out.push('\n <div id="arrears_wrapper">\n <h2>');
__out.push(__sanitize(t('Arrears')));
__out.push('</h2>\n ');
if (numCards === 0) {
__out.push('\n <strong> ');
__out.push(__sanitize(t('Please Add Credit Card')));
__out.push(' </strong>\n ');
}
__out.push('\n <table>\n <tbody>\n ');
_.each(arrears, printArrear);
__out.push('\n </tbody>\n </table>\n </div>\n ');
}
__out.push('\n </div>\n</div>\n<div id="main_shadow"></div>\n\n');
}).call(this);
}).call(__obj);
__obj.safe = __objSafe, __obj.escape = __escape;
return __out.join('');
}}, "templates/clients/confirm_email": function(exports, require, module) {module.exports = function(__obj) {
if (!__obj) __obj = {};
var __out = [], __capture = function(callback) {
var out = __out, result;
__out = [];
callback.call(this);
result = __out.join('');
__out = out;
return __safe(result);
}, __sanitize = function(value) {
if (value && value.ecoSafe) {
return value;
} else if (typeof value !== 'undefined' && value != null) {
return __escape(value);
} else {
return '';
}
}, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
__safe = __obj.safe = function(value) {
if (value && value.ecoSafe) {
return value;
} else {
if (!(typeof value !== 'undefined' && value != null)) value = '';
var result = new String(value);
result.ecoSafe = true;
return result;
}
};
if (!__escape) {
__escape = __obj.escape = function(value) {
return ('' + value)
.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/"/g, '"');
};
}
(function() {
(function() {
__out.push('<div id="sub_header">\n <h1>');
__out.push(__sanitize(t('Confirm Email')));
__out.push('</h1>\n</div>\n\n<div id="main_content">\n <div>\n <h3 id="attempt_text">');
__out.push(__sanitize(t('Confirm Email Message')));
__out.push('</h3>\n <h3 class="success_message" style="display:none">');
__out.push(__sanitize(t('Confirm Email Succeeded')));
__out.push('</h3>\n <h3 class="already_confirmed_message" style="display:none">');
__out.push(__sanitize(t('Email Already Confirmed')));
__out.push('</h3>\n <h3 class="error_message" style="display:none">');
__out.push(__sanitize(t('Confirm Email Failed')));
__out.push('</h3>\n </div>\n</div>\n<div id="main_shadow"></div>\n\n');
}).call(this);
}).call(__obj);
__obj.safe = __objSafe, __obj.escape = __escape;
return __out.join('');
}}, "templates/clients/dashboard": function(exports, require, module) {module.exports = function(__obj) {
if (!__obj) __obj = {};
var __out = [], __capture = function(callback) {
var out = __out, result;
__out = [];
callback.call(this);
result = __out.join('');
__out = out;
return __safe(result);
}, __sanitize = function(value) {
if (value && value.ecoSafe) {
return value;
} else if (typeof value !== 'undefined' && value != null) {
return __escape(value);
} else {
return '';
}
}, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
__safe = __obj.safe = function(value) {
if (value && value.ecoSafe) {
return value;
} else {
if (!(typeof value !== 'undefined' && value != null)) value = '';
var result = new String(value);
result.ecoSafe = true;
return result;
}
};
if (!__escape) {
__escape = __obj.escape = function(value) {
return ('' + value)
.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/"/g, '"');
};
}
(function() {
(function() {
var printStar, trip, _i, _len, _ref, _ref2, _ref3, _ref4;
printStar = function() {
return __out.push('\n <img alt="Star" src="/web/img/star.png"/>\n');
};
__out.push('\n\n');
__out.push(require('templates/clients/modules/sub_header').call(this, {
heading: t("Dashboard")
}));
__out.push('\n\n\n<div id="main_content">\n <div>\n <div id="confirmation">\n ');
if (((_ref = USER.payment_gateway) != null ? (_ref2 = _ref.payment_profiles) != null ? _ref2.length : void 0 : void 0) > 0) {
__out.push('\n <div id="confirmed_credit_card" class="true left">');
__out.push(__sanitize(t('Credit Card Added')));
__out.push('</div>\n ');
} else {
__out.push('\n <div id="confirmed_credit_card" class="false left"><a id="card" class="confirmation" href="">');
__out.push(__sanitize(t('No Credit Card')));
__out.push('</a></div>\n ');
}
__out.push('\n\n ');
if (USER.confirm_mobile === true) {
__out.push('\n <div id="confirmed_mobile" class="true">');
__out.push(__sanitize(t('Mobile Number Confirmed')));
__out.push('</div>\n ');
} else {
__out.push('\n <div id="confirmed_mobile" class="false"><a id="mobile" class="confirmation" href="">');
__out.push(__sanitize(t('No Confirmed Mobile')));
__out.push('</a></div>\n ');
}
__out.push('\n\n ');
if (USER.confirm_email === true) {
__out.push('\n <div id="confirmed_email" class="true right">');
__out.push(__sanitize(t('E-mail Address Confirmed')));
__out.push('</div>\n ');
} else {
__out.push('\n <div id="confirmed_email" class="false right"><a id="email" class="confirmation" href="">');
__out.push(__sanitize(t('No Confirmed E-mail')));
__out.push('</a></div>\n ');
}
__out.push('\n\n <div id="more_info" style="display:none;">\n <div id="mobile" class="info">\n <span>');
__out.push(__sanitize(t('Reply to sign up text')));
__out.push('</span>\n <a id="resend_mobile" class="resend" href="">');
__out.push(__sanitize(t('Resend text message')));
__out.push('</a>\n </div>\n <div id="email" class="info">\n <span>');
__out.push(__sanitize(t('Click sign up link')));
__out.push('</span>\n <a id="resend_email" class="resend" href="">');
__out.push(__sanitize(t('Resend email')));
__out.push('</a>\n </div>\n <div id="card" class="info">\n <span>');
__out.push(__sanitize(t("Add a credit card to ride")));
__out.push('</span>\n </div>\n </div>\n </div>\n\n <div id="dashboard_trips">\n ');
if (USER.trips.length > 0) {
__out.push('\n <div id="trip_details_map"></div>\n <div id="trip_details_info">\n <h2>');
__out.push(__sanitize(t('Your Most Recent Trip')));
__out.push('</h2>\n <span><a href="#!/trip/');
__out.push(__sanitize(_.first(USER.trips.models).get('random_id')));
__out.push('">');
__out.push(__sanitize(t('details')));
__out.push('</a></span>\n\n <div id="avatars">\n <img alt="Driver image" height="45" src="');
__out.push(__sanitize(_.first(USER.trips.models).get('driver').picture_url));
__out.push('" width="45"/>\n <span>');
__out.push(__sanitize("" + (_.first(USER.trips.models).get('driver').first_name)));
__out.push('</span>\n <div class="clear">\n </div>\n </div>\n <h3>');
__out.push(__sanitize(t('Rating')));
__out.push('</h3>\n ');
_(_.first(USER.trips.models).get('driver_rating')).times(printStar);
__out.push('\n </div>\n <div class="clear">\n </div>\n <div class="table_wrapper">\n <h2>');
__out.push(__sanitize(t('Your Trip History ')));
__out.push('</h2>\n <table class="zebra">\n <colgroup>\n <col width="*" />\n <col width="200" />\n <col width="120" />\n <col width="100" />\n </colgroup>\n <thead>\n <tr>\n <td class="text">\n ');
__out.push(__sanitize(t('Pickup Time')));
__out.push('\n </td>\n <td class="text">\n ');
__out.push(__sanitize(t('Status')));
__out.push('\n </td>\n <td class="text">\n ');
__out.push(__sanitize(t('Driver')));
__out.push('\n </td>\n <td class="graphic">\n ');
__out.push(__sanitize(t('Rating')));
__out.push('\n </td>\n <td class="num">\n ');
__out.push(__sanitize(t('Fare')));
__out.push('\n </td>\n </tr>\n </thead>\n <tbody>\n ');
_ref3 = USER.trips.models;
for (_i = 0, _len = _ref3.length; _i < _len; _i++) {
trip = _ref3[_i];
__out.push('\n <tr>\n <td class="text"><a href="#!/trip/');
__out.push(__sanitize(trip.get('random_id')));
__out.push('">');
__out.push(__sanitize(app.helpers.formatDate(trip.get('request_at'), true, trip.get('city').timezone)));
__out.push('</a></td>\n <td class="text">');
__out.push(__sanitize(trip.get('status')));
__out.push('</td>\n <td class="text">');
__out.push(__sanitize((_ref4 = trip.get('driver')) != null ? _ref4.first_name : void 0));
__out.push('</td>\n <td class="graphic">');
_(trip.get('driver_rating')).times(printStar);
__out.push('</td>\n <td class="num">');
__out.push(__sanitize(app.helpers.formatTripFare(trip)));
__out.push('</td>\n </tr>\n ');
}
__out.push('\n </tbody>\n </table>\n <a id="show_all_trips" href="">');
__out.push(__sanitize(t('Show all trips')));
__out.push('</a>\n </div>\n ');
} else {
__out.push('\n <p><strong>');
__out.push(__sanitize(t("Here's how it works:")));
__out.push('</strong></p>\n <ol class="spaced">\n <li>\n ');
__out.push(__sanitize(t('Set your location:')));
__out.push('\n <ul>\n <li>');
__out.push(__sanitize(t('App search for address')));
__out.push('</li>\n <li>');
__out.push(__sanitize(t('SMS text address')));
__out.push('</li>\n </ul>\n </li>\n <li>');
__out.push(__sanitize(t('Confirm pickup request')));
__out.push('</li>\n <li>');
__out.push(__sanitize(t('Uber sends ETA')));
__out.push('</li>\n <li>');
__out.push(__sanitize(t('Car arrives')));
__out.push('</li>\n <li>');
__out.push(__sanitize(t('Ride to destination')));
__out.push('</li>\n </ol>\n <p>');
__out.push(__sanitize(t('Thank your driver')));
__out.push('</p>\n ');
}
__out.push('\n </div>\n\n </div>\n</div>\n<div id="main_shadow"></div>\n');
}).call(this);
}).call(__obj);
__obj.safe = __objSafe, __obj.escape = __escape;
return __out.join('');
}}, "templates/clients/forgot_password": function(exports, require, module) {module.exports = function(__obj) {
if (!__obj) __obj = {};
var __out = [], __capture = function(callback) {
var out = __out, result;
__out = [];
callback.call(this);
result = __out.join('');
__out = out;
return __safe(result);
}, __sanitize = function(value) {
if (value && value.ecoSafe) {
return value;
} else if (typeof value !== 'undefined' && value != null) {
return __escape(value);
} else {
return '';
}
}, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
__safe = __obj.safe = function(value) {
if (value && value.ecoSafe) {
return value;
} else {
if (!(typeof value !== 'undefined' && value != null)) value = '';
var result = new String(value);
result.ecoSafe = true;
return result;
}
};
if (!__escape) {
__escape = __obj.escape = function(value) {
return ('' + value)
.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/"/g, '"');
};
}
(function() {
(function() {
__out.push('<div id="form_container">\n ');
if (this.token) {
__out.push('\n <h1>');
__out.push(__sanitize(t('Password Reset')));
__out.push('</h1>\n <div id="standard_form">\n\n <p>');
__out.push(__sanitize(t('Please choose a new password.')));
__out.push('</p>\n\n <p class="error_message" style="display:none;">');
__out.push(__sanitize(t('Password Reset Error')));
__out.push('</p>\n\n <form id="password_reset" action="" method="">\n\n <input id="token" type="hidden" name="token" value="');
__out.push(__sanitize(this.token));
__out.push('">\n\n <div class="form_label">\n <label for="password">');
__out.push(__sanitize(t('New Password')));
__out.push('</label>\n </div>\n\n <div class="form_input">\n <input id="password" name="password" type="password" value=""/>\n </div>\n\n <div class="form_clear"></div>\n\n <div class="formSubmitButton"><button id="password_reset_submit" type="submit" class="button" data-theme="a"><span>Reset Password</span></button></div>\n\n </form>\n </div>\n\n ');
} else {
__out.push('\n <h1>');
__out.push(__sanitize(t('Forgot Password')));
__out.push('</h1>\n <div id="standard_form">\n\n <p>');
__out.push(t('Forgot Password Enter Email'));
__out.push('\n\n <p class="error_message" style="display:none;">');
__out.push(__sanitize(t('Forgot Password Error')));
__out.push('</p>\n\n <p class="success_message" style="display:none;">');
__out.push(__sanitize(t('Forgot Password Success')));
__out.push('</p>\n\n <form id="forgot_password" action="" method="">\n\n <div class="form_label">\n <label for="login">');
__out.push(__sanitize(t('Email Address')));
__out.push('</label>\n </div>\n\n <div class="form_input">\n <input id="login" name="login" type="text" value=""/>\n </div>\n\n <div class="form_clear"></div>\n\n <div class="formSubmitButton"><button type="submit" class="button" data-theme="a"><span>');
__out.push(__sanitize(t('Reset Password')));
__out.push('</span></button></div>\n </form>\n\n </div>\n ');
}
__out.push('\n\n</div>\n\n<div id="small_container_shadow"><div class="left"></div><div class="right"></div></div>\n');
}).call(this);
}).call(__obj);
__obj.safe = __objSafe, __obj.escape = __escape;
return __out.join('');
}}, "templates/clients/invite": function(exports, require, module) {module.exports = function(__obj) {
if (!__obj) __obj = {};
var __out = [], __capture = function(callback) {
var out = __out, result;
__out = [];
callback.call(this);
result = __out.join('');
__out = out;
return __safe(result);
}, __sanitize = function(value) {
if (value && value.ecoSafe) {
return value;
} else if (typeof value !== 'undefined' && value != null) {
return __escape(value);
} else {
return '';
}
}, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
__safe = __obj.safe = function(value) {
if (value && value.ecoSafe) {
return value;
} else {
if (!(typeof value !== 'undefined' && value != null)) value = '';
var result = new String(value);
result.ecoSafe = true;
return result;
}
};
if (!__escape) {
__escape = __obj.escape = function(value) {
return ('' + value)
.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/"/g, '"');
};
}
(function() {
(function() {
__out.push(require('templates/clients/modules/sub_header').call(this, {
heading: t("Invite friends")
}));
__out.push('\n\n<div id="main_content">\n <div>\n <h2>');
__out.push(__sanitize(t('Give $ Get $')));
__out.push('</h2>\n\n <p>\n ');
__out.push(__sanitize(t('Give $ Get $ Description')));
__out.push('\n </p>\n\n <p>');
__out.push(__sanitize(t('What are you waiting for?')));
__out.push('</p>\n <div id="social_icons">\n <div>\n <a style="float:left" href="https://twitter.com/share" class="twitter-share-button" data-url="');
__out.push(__sanitize(USER.referral_url));
__out.push('" data-text="Sign up for @uber with my link and get $10 off your first ride! " data-count="none">');
__out.push(__sanitize(t('Tweet')));
__out.push('</a><script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>\n </div>\n <div>\n <div id="fb-root"></div>\n <script>(function(d, s, id) {\n var js, fjs = d.getElementsByTagName(s)[0];\n js = d.createElement(s); js.id = id;\n js.src = "//connect.facebook.net/" + window.i18n.getLocale() + "/all.js#appId=124678754298965&xfbml=1";\n fjs.parentNode.insertBefore(js, fjs);\n }(document, \'script\', \'facebook-jssdk\'));</script>\n\n <div class="fb-like" data-href="');
__out.push(__sanitize(USER.referral_url));
__out.push('" data-send="true" data-layout="button_count" data-width="180" data-show-faces="false" data-action="recommend" data-font="lucida grande"></div>\n </div>\n </div>\n <br>\n <p>');
__out.push(__sanitize(t('Invite Link')));
__out.push(' <a href="');
__out.push(__sanitize(USER.referral_url));
__out.push('">');
__out.push(__sanitize(USER.referral_url));
__out.push('</a> </p>\n\n </div>\n</div>\n<div id="main_shadow"></div>\n\n');
}).call(this);
}).call(__obj);
__obj.safe = __objSafe, __obj.escape = __escape;
return __out.join('');
}}, "templates/clients/login": function(exports, require, module) {module.exports = function(__obj) {
if (!__obj) __obj = {};
var __out = [], __capture = function(callback) {
var out = __out, result;
__out = [];
callback.call(this);
result = __out.join('');
__out = out;
return __safe(result);
}, __sanitize = function(value) {
if (value && value.ecoSafe) {
return value;
} else if (typeof value !== 'undefined' && value != null) {
return __escape(value);
} else {
return '';
}
}, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
__safe = __obj.safe = function(value) {
if (value && value.ecoSafe) {
return value;
} else {
if (!(typeof value !== 'undefined' && value != null)) value = '';
var result = new String(value);
result.ecoSafe = true;
return result;
}
};
if (!__escape) {
__escape = __obj.escape = function(value) {
return ('' + value)
.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/"/g, '"');
};
}
(function() {
(function() {
__out.push('<div id="form_container">\n\t<h1>');
__out.push(__sanitize(t('Sign In')));
__out.push('</h1>\n\t<div id="standard_form">\n\t\t<form method="post">\n\n\t\t\t<p class="error_message" style="display:none;"></span>\n\n\t\t\t<div class="form_label">\n\t\t\t\t<label for="login">');
__out.push(__sanitize(t('Email Address')));
__out.push('</label>\n\t\t\t</div>\n\t\t\t<div class="form_input">\n\t\t\t\t<input id="login" name="login" type="text" value=""/>\n\t\t\t</div>\n\n\t\t\t<div class="form_clear"></div>\n\n\t\t\t<div class="form_label">\n\t\t\t\t<label for="password">');
__out.push(__sanitize(t('Password')));
__out.push('</label>\n\t\t\t</div>\n\t\t\t<div class="form_input">\n\t\t\t\t<input id="password" name="password" type="password" value=""/>\n\t\t\t</div>\n\n\t\t\t<div class="form_clear"></div>\n\n <div class="formSubmitButton"><button type="submit" class="button" data-theme="a"><span>');
__out.push(__sanitize(t('Sign In')));
__out.push('</span></button></div>\n\n <h2><a href=\'/#!/forgot-password\'>');
__out.push(__sanitize(t('Forgot Password?')));
__out.push('</a></h2>\n\n\t\t</form>\n\t</div>\n</div>\n\n<div class="clear"></div>\n<div id="small_container_shadow"><div class="left"></div><div class="right"></div></div>\n');
}).call(this);
}).call(__obj);
__obj.safe = __objSafe, __obj.escape = __escape;
return __out.join('');
}}, "templates/clients/modules/credit_card": function(exports, require, module) {module.exports = function(__obj) {
if (!__obj) __obj = {};
var __out = [], __capture = function(callback) {
var out = __out, result;
__out = [];
callback.call(this);
result = __out.join('');
__out = out;
return __safe(result);
}, __sanitize = function(value) {
if (value && value.ecoSafe) {
return value;
} else if (typeof value !== 'undefined' && value != null) {
return __escape(value);
} else {
return '';
}
}, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
__safe = __obj.safe = function(value) {
if (value && value.ecoSafe) {
return value;
} else {
if (!(typeof value !== 'undefined' && value != null)) value = '';
var result = new String(value);
result.ecoSafe = true;
return result;
}
};
if (!__escape) {
__escape = __obj.escape = function(value) {
return ('' + value)
.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/"/g, '"');
};
}
(function() {
(function() {
var printCard;
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
if (this.cards === "new") {
__out.push('\n <div id="cc_form_wrapper" class="inline_label_form wider_inline_label_form">\n <form action="" id="credit_card_form" method="">\n <div id="top_of_form" class="error_message"></div>\n <div id="card_logos"></div>\n <div id="credit_card_number_wrapper" data-role="fieldcontain">\n <div class="error_message"></div>\n <label>');
__out.push(__sanitize(t('Credit Card Number')));
__out.push('</label>\n <input id="card_number" name="card_number" type="text"/>\n </div>\n <div class="clear"></div>\n <div id="expiration_wrapper" data-role="fieldcontain">\n <div class="error_message"></div>\n <label for="expiration_month">');
__out.push(__sanitize(t('Expiration')));
__out.push('</label>\n <select id="card_expiration_month" name="expiration_month">\n <option value="">');
__out.push(__sanitize(t('month')));
__out.push('</option>\n <option value="01">');
__out.push(__sanitize(t('01-Jan')));
__out.push('</option>\n <option value="02">');
__out.push(__sanitize(t('02-Feb')));
__out.push('</option>\n <option value="03">');
__out.push(__sanitize(t('03-Mar')));
__out.push('</option>\n <option value="04">');
__out.push(__sanitize(t('04-Apr')));
__out.push('</option>\n <option value="05">');
__out.push(__sanitize(t('05-May')));
__out.push('</option>\n <option value="06">');
__out.push(__sanitize(t('06-Jun')));
__out.push('</option>\n <option value="07">');
__out.push(__sanitize(t('07-Jul')));
__out.push('</option>\n <option value="08">');
__out.push(__sanitize(t('08-Aug')));
__out.push('</option>\n <option value="09">');
__out.push(__sanitize(t('09-Sep')));
__out.push('</option>\n <option value="10">');
__out.push(__sanitize(t('10-Oct')));
__out.push('</option>\n <option value="11">');
__out.push(__sanitize(t('11-Nov')));
__out.push('</option>\n <option value="12">');
__out.push(__sanitize(t('12-Dec')));
__out.push('</option>\n </select>\n </div>\n <div>\n <span style="display:inline" class="error_message"></span>\n <select id="card_expiration_year" name="expiration_year">\n <option selected="selected" value="">');
__out.push(__sanitize(t('year')));
__out.push('</option>\n <option value="2011">');
__out.push(__sanitize(t('2011')));
__out.push('</option>\n <option value="2012">');
__out.push(__sanitize(t('2012')));
__out.push('</option>\n <option value="2013">');
__out.push(__sanitize(t('2013')));
__out.push('</option>\n <option value="2014">');
__out.push(__sanitize(t('2014')));
__out.push('</option>\n <option value="2015">');
__out.push(__sanitize(t('2015')));
__out.push('</option>\n <option value="2016">');
__out.push(__sanitize(t('2016')));
__out.push('</option>\n <option value="2017">');
__out.push(__sanitize(t('2017')));
__out.push('</option>\n <option value="2018">');
__out.push(__sanitize(t('2018')));
__out.push('</option>\n <option value="2019">');
__out.push(__sanitize(t('2019')));
__out.push('</option>\n <option value="2020">');
__out.push(__sanitize(t('2020')));
__out.push('</option>\n </select>\n </div>\n <div class="clear"></div>\n <div id="cvv_wrapper" data-role="fieldcontain">\n <div class="error_message"></div>\n <label for="card_code">');
__out.push(__sanitize(t('CVV')));
__out.push('</label>\n <input id="card_code" name="card_code" type="text"/>\n </div>\n <div class="clear"></div>\n <div>\n <label for="use_case">');
__out.push(__sanitize(t('Category')));
__out.push('</label>\n <select id="use_case">\n <option value="personal" selected="true">');
__out.push(__sanitize(t('personal')));
__out.push('</option>\n <option value="business">');
__out.push(__sanitize(t('business')));
__out.push('</option>\n </select>\n </div>\n <div class="clear"></div>\n <div id="default_wrapper" data-role="fieldcontain">\n <label for="default">');
__out.push(__sanitize(t('Default Credit Card')));
__out.push('</label>\n <input id="default_check" type="checkbox" name="default" value="true"/>\n </div>\n <div class="clear"></div>\n <div>\n <button id="new_card" type="submit" class="button" data-theme="a"><span>');
__out.push(__sanitize(t('Add Credit Card')));
__out.push('</span></button>\n </div>\n </form>\n </div>\n');
} else {
__out.push('\n ');
printCard = __bind(function(card, index) {
var exp, style;
__out.push('\n <tr id="');
__out.push(__sanitize("d" + index));
__out.push('">\n <td>\n ');
style = "background-position:-173px";
__out.push('\n ');
if (card.get("card_type") === "Visa") {
style = "background-position:0px";
}
__out.push('\n ');
if (card.get("card_type") === "MasterCard") {
style = "background-position:-42px";
}
__out.push('\n ');
if (card.get("card_type") === "American Express") {
style = "background-position:-130px";
}
__out.push('\n ');
if (card.get("card_type") === "Discover Card") {
style = "background-position:-85px";
}
__out.push('\n <div class="card_type" style="');
__out.push(__sanitize(style));
__out.push('"></div>\n </td>\n <td>\n ****');
__out.push(__sanitize(card.get("card_number")));
__out.push('\n </td>\n <td>\n ');
if (card.get("card_expiration")) {
__out.push('\n ');
__out.push(__sanitize(t('Expiry')));
__out.push('\n ');
exp = card.get('card_expiration').split('-');
__out.push('\n ');
__out.push(__sanitize("" + exp[0] + "-" + exp[1]));
__out.push('\n ');
}
__out.push('\n </td>\n <td>\n <select class="use_case">\n <option ');
__out.push(__sanitize(card.get("use_case") === "personal" ? "selected" : void 0));
__out.push(' value="personal">');
__out.push(__sanitize(t('personal')));
__out.push('</option>\n <option ');
__out.push(__sanitize(card.get("use_case") === "business" ? "selected" : void 0));
__out.push(' value="business">');
__out.push(__sanitize(t('business')));
__out.push('</option>\n </select>\n </td>\n <td>\n ');
if (card.get("default")) {
__out.push('\n <strong>(');
__out.push(__sanitize(t('default card')));
__out.push(')</strong>\n ');
}
__out.push('\n ');
if (this.cards.length > 1 && !card.get("default")) {
__out.push('\n <a class="make_default" href="">');
__out.push(__sanitize(t('make default')));
__out.push('</a>\n ');
}
__out.push('\n </td>\n <td>\n <a class="edit_card_show" href="">');
__out.push(__sanitize(t('Edit')));
__out.push('</a>\n </td>\n <td>\n ');
if (this.cards.length > 1) {
__out.push('\n <a class="delete_card" href="">');
__out.push(__sanitize(t('Delete')));
__out.push('</a>\n ');
}
__out.push('\n </td>\n </tr>\n <tr id=\'');
__out.push(__sanitize("e" + index));
__out.push('\' style="display:none;"><td colspan="7">\n <form action="" method="">\n <div>\n <strong><label for="expiration_month">');
__out.push(__sanitize(t('Expiry Month')));
__out.push('</label></strong>\n <select id="card_expiration_month" name="expiration_month">\n <option value="">');
__out.push(__sanitize(t('month')));
__out.push('</option>\n <option value="01">');
__out.push(__sanitize(t('01-Jan')));
__out.push('</option>\n <option value="02">');
__out.push(__sanitize(t('02-Feb')));
__out.push('</option>\n <option value="03">');
__out.push(__sanitize(t('03-Mar')));
__out.push('</option>\n <option value="04">');
__out.push(__sanitize(t('04-Apr')));
__out.push('</option>\n <option value="05">');
__out.push(__sanitize(t('05-May')));
__out.push('</option>\n <option value="06">');
__out.push(__sanitize(t('06-Jun')));
__out.push('</option>\n <option value="07">');
__out.push(__sanitize(t('07-Jul')));
__out.push('</option>\n <option value="08">');
__out.push(__sanitize(t('08-Aug')));
__out.push('</option>\n <option value="09">');
__out.push(__sanitize(t('09-Sep')));
__out.push('</option>\n <option value="10">');
__out.push(__sanitize(t('10-Oct')));
__out.push('</option>\n <option value="11">');
__out.push(__sanitize(t('11-Nov')));
__out.push('</option>\n <option value="12">');
__out.push(__sanitize(t('12-Dec')));
__out.push('</option>\n </select>\n </div>\n <div>\n <strong><label for="expiration_year">');
__out.push(__sanitize(t('Expiry Year')));
__out.push('</label></strong>\n <select id="card_expiration_year" name="expiration_year">\n <option selected="selected" value="">');
__out.push(__sanitize(t('year')));
__out.push('</option>\n <option value="2011">');
__out.push(__sanitize(t('2011')));
__out.push('</option>\n <option value="2012">');
__out.push(__sanitize(t('2012')));
__out.push('</option>\n <option value="2013">');
__out.push(__sanitize(t('2013')));
__out.push('</option>\n <option value="2014">');
__out.push(__sanitize(t('2014')));
__out.push('</option>\n <option value="2015">');
__out.push(__sanitize(t('2015')));
__out.push('</option>\n <option value="2016">');
__out.push(__sanitize(t('2016')));
__out.push('</option>\n <option value="2017">');
__out.push(__sanitize(t('2017')));
__out.push('</option>\n <option value="2018">');
__out.push(__sanitize(t('2018')));
__out.push('</option>\n <option value="2019">');
__out.push(__sanitize(t('2019')));
__out.push('</option>\n <option value="2020">');
__out.push(__sanitize(t('2020')));
__out.push('</option>\n <option value="2021">');
__out.push(__sanitize(t('2021')));
__out.push('</option>\n <option value="2022">');
__out.push(__sanitize(t('2022')));
__out.push('</option>\n </select>\n </div>\n <div>\n <strong><label for="card_code">');
__out.push(__sanitize(t('CVV')));
__out.push('</label></strong>\n <input id="card_code" name="card_code" type="text"/>\n </div>\n <button class="button edit_card" data-theme="a"><span>');
__out.push(__sanitize(t('Save')));
return __out.push('</span></button>\n </form>\n </td></tr>\n ');
}, this);
__out.push('\n\n <div id="card_edit_form">\n <table>\n ');
_.each(this.cards.models, printCard);
__out.push('\n </table>\n </div>\n\n');
}
__out.push('\n');
}).call(this);
}).call(__obj);
__obj.safe = __objSafe, __obj.escape = __escape;
return __out.join('');
}}, "templates/clients/modules/sub_header": function(exports, require, module) {module.exports = function(__obj) {
if (!__obj) __obj = {};
var __out = [], __capture = function(callback) {
var out = __out, result;
__out = [];
callback.call(this);
result = __out.join('');
__out = out;
return __safe(result);
}, __sanitize = function(value) {
if (value && value.ecoSafe) {
return value;
} else if (typeof value !== 'undefined' && value != null) {
return __escape(value);
} else {
return '';
}
}, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
__safe = __obj.safe = function(value) {
if (value && value.ecoSafe) {
return value;
} else {
if (!(typeof value !== 'undefined' && value != null)) value = '';
var result = new String(value);
result.ecoSafe = true;
return result;
}
};
if (!__escape) {
__escape = __obj.escape = function(value) {
return ('' + value)
.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/"/g, '"');
};
}
(function() {
(function() {
__out.push('<div id="sub_header">\n <div id="title">');
__out.push(__sanitize(this.heading));
__out.push('</div>\n <div id="greeting">\n ');
if (window.USER.first_name) {
__out.push('\n ');
__out.push(__sanitize(t('Hello Greeting', {
name: USER.first_name
})));
__out.push('\n ');
}
__out.push('\n </div>\n</div>\n<div class="clear"></div>\n');
}).call(this);
}).call(__obj);
__obj.safe = __objSafe, __obj.escape = __escape;
return __out.join('');
}}, "templates/clients/promotions": function(exports, require, module) {module.exports = function(__obj) {
if (!__obj) __obj = {};
var __out = [], __capture = function(callback) {
var out = __out, result;
__out = [];
callback.call(this);
result = __out.join('');
__out = out;
return __safe(result);
}, __sanitize = function(value) {
if (value && value.ecoSafe) {
return value;
} else if (typeof value !== 'undefined' && value != null) {
return __escape(value);
} else {
return '';
}
}, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
__safe = __obj.safe = function(value) {
if (value && value.ecoSafe) {
return value;
} else {
if (!(typeof value !== 'undefined' && value != null)) value = '';
var result = new String(value);
result.ecoSafe = true;
return result;
}
};
if (!__escape) {
__escape = __obj.escape = function(value) {
return ('' + value)
.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/"/g, '"');
};
}
(function() {
(function() {
var promo, _i, _len, _ref;
__out.push(require('templates/clients/modules/sub_header').call(this, {
heading: t("Promotions")
}));
__out.push('\n\n<div id="main_content">\n <div>\n <div id="global_status">\n <span class="success_message"></span>\n <span class="error_message"></span>\n </div>\n <form action="/dashboard/promotions/create" method="post">\n <label for="code">');
__out.push(__sanitize(t('Enter Promotion Code')));
__out.push('</label>\n <input id="code" name="code" type="text" />\n\n <button type="submit" class="button"><span>');
__out.push(__sanitize(t('Submit')));
__out.push('</span></button>\n </form>\n ');
if (this.promos.length > 0) {
__out.push('\n <div class="table_wrapper">\n <h2>');
__out.push(__sanitize(t('Your Available Promotions')));
__out.push('</h2>\n <table>\n <thead>\n\n <tr>\n <td>');
__out.push(__sanitize(t('Code')));
__out.push('</td>\n <td>');
__out.push(__sanitize(t('Details')));
__out.push('</td>\n <td>');
__out.push(__sanitize(t('Starts')));
__out.push('</td>\n <td>');
__out.push(__sanitize(t('Expires')));
__out.push('</td>\n </tr>\n </thead>\n <tbody>\n ');
_ref = this.promos;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
promo = _ref[_i];
__out.push('\n <tr>\n <td>');
__out.push(__sanitize(promo.code));
__out.push('</td>\n <td>');
__out.push(__sanitize(promo.description));
__out.push('</td>\n <td>');
__out.push(__sanitize(app.helpers.formatDate(promo.starts_at, true, "America/Los_Angeles")));
__out.push('</td>\n <td>');
__out.push(__sanitize(app.helpers.formatDate(promo.ends_at, true, "America/Los_Angeles")));
__out.push('</td>\n </tr>\n ');
}
__out.push('\n </tbody>\n </table>\n </div>\n ');
} else {
__out.push('\n\n <p>');
__out.push(__sanitize(t('No Active Promotions')));
__out.push('</p>\n ');
}
__out.push('\n\n </div>\n</div>\n<div id="main_shadow"></div>\n');
}).call(this);
}).call(__obj);
__obj.safe = __objSafe, __obj.escape = __escape;
return __out.join('');
}}, "templates/clients/request": function(exports, require, module) {module.exports = function(__obj) {
if (!__obj) __obj = {};
var __out = [], __capture = function(callback) {
var out = __out, result;
__out = [];
callback.call(this);
result = __out.join('');
__out = out;
return __safe(result);
}, __sanitize = function(value) {
if (value && value.ecoSafe) {
return value;
} else if (typeof value !== 'undefined' && value != null) {
return __escape(value);
} else {
return '';
}
}, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
__safe = __obj.safe = function(value) {
if (value && value.ecoSafe) {
return value;
} else {
if (!(typeof value !== 'undefined' && value != null)) value = '';
var result = new String(value);
result.ecoSafe = true;
return result;
}
};
if (!__escape) {
__escape = __obj.escape = function(value) {
return ('' + value)
.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/"/g, '"');
};
}
(function() {
(function() {
var showFavoriteLocation;
showFavoriteLocation = function(location, index) {
var alphabet;
__out.push('\n ');
alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
__out.push('\n <tr id="f');
__out.push(__sanitize(index));
__out.push('" class="location_row">\n <td class="marker_logo">\n <img src="https://www.google.com/mapfiles/marker');
__out.push(__sanitize(alphabet[index]));
__out.push('.png" />\n </td>\n <td class="location_nickname_wrapper">\n <span >');
__out.push(__sanitize(location.nickname));
return __out.push('</span>\n </td>\n </tr>\n');
};
__out.push('\n\n');
__out.push(require('templates/clients/modules/sub_header').call(this, {
heading: t("Ride Request")
}));
__out.push('\n\n\n<div id="main_content">\n <div>\n <div id="top_bar">\n <form id="search_form" action="" method="post">\n <label for="address">');
__out.push(__sanitize(t('Where do you want us to pick you up?')));
__out.push('</label>\n <input id="address" name="address" type="text" placeholder="');
__out.push(__sanitize(t('Address to search')));
__out.push('"/>\n <button type="submit" id="address" class="button"><span>');
__out.push(__sanitize(t('Search')));
__out.push('</span></button>\n </form>\n </div>\n\n <div id="sidebar">\n <div id="waiting_riding" class="panel">\n <table>\n <tr>\n <td>\n <p class="label">');
__out.push(__sanitize(t('Driver Name:')));
__out.push('</p>\n <p id="rideName"></p>\n </td>\n </tr>\n <tr>\n <td>\n <p class="label">');
__out.push(__sanitize(t('Driver #:')));
__out.push('</p>\n <p id="ridePhone"></p>\n </td>\n </tr>\n <tr id="ride_address_wrapper">\n <td>\n <p class="label">');
__out.push(__sanitize(t('Pickup Address:')));
__out.push('</p>\n <p id="rideAddress"></p>\n </td>\n <td id="favShow">\n <img alt="');
__out.push(__sanitize(t('Add to Favorite Locations')));
__out.push('" id="addToFavButton" src="/web/img/button_plus_gray.png"/>\n </td>\n </tr>\n <tr>\n <td>\n <form id="favLoc_form" action="" method="post">\n <p class="error_message"></p>\n <span class="label">');
__out.push(__sanitize(t('Nickname:')));
__out.push('</span>\n <input type="hidden" value="" id="pickupLat" />\n <input type="hidden" value="" id="pickupLng" />\n <input id="favLocNickname" name="nickname" type="text"/>\n <button type="submit" class="button"><span>');
__out.push(__sanitize(t('Add')));
__out.push('</span></button>\n </form>\n </td>\n </tr>\n </table>\n </div>\n <div id="trip_completed_panel" class="panel">\n <h2>');
__out.push(__sanitize(t('Your last trip')));
__out.push('</h2>\n <form id="rating_form">\n <label>');
__out.push(__sanitize(t('Please rate your driver:')));
__out.push('</label>\n <img alt="');
__out.push(__sanitize(t('Star')));
__out.push('" class="stars" id="1" src="/web/img/star_inactive.png"/>\n <img alt="');
__out.push(__sanitize(t('Star')));
__out.push('" class="stars" id="2" src="/web/img/star_inactive.png"/>\n <img alt="');
__out.push(__sanitize(t('Star')));
__out.push('" class="stars" id="3" src="/web/img/star_inactive.png"/>\n <img alt="');
__out.push(__sanitize(t('Star')));
__out.push('" class="stars" id="4" src="/web/img/star_inactive.png"/>\n <img alt="');
__out.push(__sanitize(t('Star')));
__out.push('" class="stars" id="5" src="/web/img/star_inactive.png"/>\n <label>');
__out.push(__sanitize(t('Comments: (optional)')));
__out.push('</label>\n <textarea id="comments" name="comments" type="text"/>\n <button type="submit" id="rating" class="button"><span>');
__out.push(__sanitize(t('Rate Trip')));
__out.push('</span></button>\n </form>\n <table>\n <tr>\n <td class="label">');
__out.push(__sanitize(t('Pickup time:')));
__out.push('</td>\n <td id="tripTime"></td>\n </tr>\n <tr>\n <td class="label">');
__out.push(__sanitize(t('Miles:')));
__out.push('</td>\n <td id="tripDist"></td>\n </tr>\n <tr>\n <td class="label">');
__out.push(__sanitize(t('Trip time:')));
__out.push('</td>\n <td id="tripDur"></td>\n </tr>\n <tr>\n <td class="label">');
__out.push(__sanitize(t('Fare:')));
__out.push('</td>\n <td id="tripFare"></td>\n </tr>\n </table>\n </div>\n <div id="location_panel_control" class="panel">\n <a id="favorite" style="font-weight:bold;" class="locations_link" >');
__out.push(__sanitize(t('Favorite Locations')));
__out.push('</a> |\n <a href="" id="search" class="locations_link">');
__out.push(__sanitize(t('Search Results')));
__out.push('</a>\n </div>\n <div id="location_panel" class="panel">\n <div id="favorite_results">\n ');
if (USER.locations) {
__out.push('\n <table>\n ');
_.each(USER.locations, showFavoriteLocation);
__out.push('\n </table>\n ');
} else {
__out.push('\n <p>');
__out.push(__sanitize(t('You have no favorite locations saved.')));
__out.push('</p>\n ');
}
__out.push('\n </div>\n <div id="search_results">\n </div>\n </div>\n </div>\n <span id="status_message" >');
__out.push(__sanitize(t('Loading...')));
__out.push('</span>\n <div id="map_wrapper_right"></div>\n <a id="pickupHandle" type="submit" class="button_green"><span>');
__out.push(__sanitize(t('Request Pickup')));
__out.push('</span></a>\n <div class="clear"></div>\n </div>\n</div>\n<div id="main_shadow"></div>\n');
}).call(this);
}).call(__obj);
__obj.safe = __objSafe, __obj.escape = __escape;
return __out.join('');
}}, "templates/clients/settings": function(exports, require, module) {module.exports = function(__obj) {
if (!__obj) __obj = {};
var __out = [], __capture = function(callback) {
var out = __out, result;
__out = [];
callback.call(this);
result = __out.join('');
__out = out;
return __safe(result);
}, __sanitize = function(value) {
if (value && value.ecoSafe) {
return value;
} else if (typeof value !== 'undefined' && value != null) {
return __escape(value);
} else {
return '';
}
}, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
__safe = __obj.safe = function(value) {
if (value && value.ecoSafe) {
return value;
} else {
if (!(typeof value !== 'undefined' && value != null)) value = '';
var result = new String(value);
result.ecoSafe = true;
return result;
}
};
if (!__escape) {
__escape = __obj.escape = function(value) {
return ('' + value)
.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/"/g, '"');
};
}
(function() {
(function() {
var args;
__out.push(require('templates/clients/modules/sub_header').call(this, {
heading: t("settings")
}));
__out.push('\n\n<div id="tabs">\n <ul>\n <li><a href="info_div" class="setting_change">');
__out.push(__sanitize(t('Information')));
__out.push('</a></li>\n <li><a href="pic_div" class="setting_change">');
__out.push(__sanitize(t('Picture')));
__out.push('</a></li>\n </ul>\n</div>\n<div class="clear"></div>\n\n<div id="main_content">\n <div>\n <div id="global_status">\n <span class="error_message"></span>\n <span class="success_message"></span>\n </div>\n <div id="info_div" style="display:none;">\n\n <div id="form_container">\n <div id="standard_form">\n\n <form id="edit_info_form">\n\n <h2>');
__out.push(__sanitize(t('Account Information')));
__out.push('</h2>\n\n <div class="form_label">\n <label for="first_name">');
__out.push(__sanitize(t('First Name')));
__out.push('</label>\n </div>\n\n <div class="form_input">\n <input id="first_name" name="first_name" type="text" value="');
__out.push(__sanitize(USER.first_name));
__out.push('"/>\n <span class="error_message"></span>\n </div>\n\n <div class="form_clear"></div>\n\n <div class="form_label">\n <label for="last_name">');
__out.push(__sanitize(t('Last Name')));
__out.push('</label>\n </div>\n <div class="form_input">\n <input id="last_name" name="last_name" type="text" value="');
__out.push(__sanitize(USER.last_name));
__out.push('"/>\n <span class="error_message"></span>\n </div>\n\n <div class="form_clear"></div>\n\n <div class="form_label">\n <label for="email">');
__out.push(__sanitize(t('Email Address')));
__out.push('</label>\n </div>\n <div class="form_input">\n <input id="email" name="email" type="text" value="');
__out.push(__sanitize(USER.email));
__out.push('"/>\n <span class="error_message"></span>\n </div>\n\n <div class="form_clear"></div>\n\n <div class="form_label">\n <label for="password">');
__out.push(__sanitize(t('Password')));
__out.push('</label>\n </div>\n <div class="form_input">\n <a id="change_password" href="">');
__out.push(__sanitize(t('Change Your Password')));
__out.push('</a>\n <input style="display:none" id="password" name="password" type="password" value=""/>\n <span class="error_message"></span>\n </div>\n\n <div class="form_clear"></div>\n\n <div class="form_label">\n <label for="country">');
__out.push(__sanitize(t('Country')));
__out.push('</label>\n </div>\n <div class="form_input">\n ');
args = {
selected: USER['country_id']
};
__out.push('\n ');
__out.push(app.helpers.countrySelector("country_id", args));
__out.push('\n <span class="error_message"></span>\n </div>\n\n <div class="form_clear"></div>\n <div class="form_label">\n <label for="location">Zip/Postal Code</label>\n </div>\n <div class="form_input">\n <input id="location" name="location" class="half" type="text" value="');
__out.push(__sanitize(USER.location));
__out.push('"/>\n <span class="error_message"></span>\n </div>\n\n <div class="form_clear"></div>\n\n <div class="form_label">\n <label for="language_id">');
__out.push(__sanitize(t('Language')));
__out.push('</label>\n </div>\n <div class="form_input">\n <select name="language_id" id="language_id">\n <option value="1" ');
__out.push(__sanitize(USER.language_id === 1 ? 'selected="selected"' : ""));
__out.push('>English</option>\n <option value="2" ');
__out.push(__sanitize(USER.language_id === 2 ? 'selected="selected"' : ""));
__out.push('>Francais</option>\n </select>\n <span class="erro_message"></span>\n </div>\n\n <div class="form_clear"></div>\n\n <h2>');
__out.push(__sanitize(t('Mobile Phone Information')));
__out.push('</h2>\n\n <div class="form_clear"></div>\n\n <div class="form_label">\n <label for="country">');
__out.push(__sanitize(t('Country')));
__out.push('</label>\n </div>\n <div class="form_input">\n ');
args = {
countryCodePrefix: 'mobile_country_code'
};
__out.push('\n ');
args['selected'] = USER['mobile_country_code'];
__out.push('\n ');
__out.push(app.helpers.countrySelector("mobile_country_id", args));
__out.push('\n <span class="error_message"></span>\n </div>\n\n <div class="form_clear"></div>\n\n <div class="form_label">\n <label for="mobile">');
__out.push(__sanitize(t('Mobile Number')));
__out.push('</label>\n </div>\n <div class="form_input">\n <div id="mobile_country_code" class="phone_country_code">');
__out.push(__sanitize(USER['mobile_country_code']));
__out.push('</div>\n <input id="mobile" name="mobile" class="phone" type="text" value="');
__out.push(__sanitize(USER.mobile));
__out.push('"/>\n <span class="error_message"></span>\n </div>\n\n <div class="form_clear"></div>\n\n <div>\n <button id="submit_info" type="submit" class="button"><span>');
__out.push(__sanitize(t('Submit')));
__out.push('</span></button>\n </div>\n </form>\n </div>\n </div>\n </div>\n\n <div id="pic_div" style="display:none;">\n <form id="profile_pic_form" enctype="multipart/form-data" method="POST" target="">\n <input type="file" name="picture" id="picture">\n <button id="submit_pic" type="submit" class="button"><span>');
__out.push(__sanitize(t('Upload')));
__out.push('</span></button>\n </form>\n <p>');
__out.push(__sanitize(t('Your current Picture')));
__out.push('</p>\n <img id="settingsProfPic" src="');
__out.push(__sanitize("" + USER.picture_url + "?" + (new Date().getTime())));
__out.push('" />\n <div id="test"></div>\n </div>\n\n <div class="clear"></div>\n </div>\n</div>\n\n<div class="clear"></div>\n<div id="main_shadow"></div>\n');
}).call(this);
}).call(__obj);
__obj.safe = __objSafe, __obj.escape = __escape;
return __out.join('');
}}, "templates/clients/sign_up": function(exports, require, module) {module.exports = function(__obj) {
if (!__obj) __obj = {};
var __out = [], __capture = function(callback) {
var out = __out, result;
__out = [];
callback.call(this);
result = __out.join('');
__out = out;
return __safe(result);
}, __sanitize = function(value) {
if (value && value.ecoSafe) {
return value;
} else if (typeof value !== 'undefined' && value != null) {
return __escape(value);
} else {
return '';
}
}, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
__safe = __obj.safe = function(value) {
if (value && value.ecoSafe) {
return value;
} else {
if (!(typeof value !== 'undefined' && value != null)) value = '';
var result = new String(value);
result.ecoSafe = true;
return result;
}
};
if (!__escape) {
__escape = __obj.escape = function(value) {
return ('' + value)
.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/"/g, '"');
};
}
(function() {
(function() {
__out.push('<div id="form_container">\n <h1>');
__out.push(__sanitize(t('Sign Up')));
__out.push('</h1>\n <div id="standard_form">\n <form action="/" method="">\n\n <h2>');
__out.push(__sanitize(t('Personal Information')));
__out.push('</h2>\n\n <div class="form_label">\n <label for="first_name">');
__out.push(__sanitize(t('First Name')));
__out.push('</label>\n </div>\n <div class="form_input">\n <input id="first_name" name="first_name" type="text" value=""/>\n <span class="error_message"></span>\n </div>\n\n <div class="form_clear"></div>\n\n <div class="form_label">\n <label for="last_name">');
__out.push(__sanitize(t('Last Name')));
__out.push('</label>\n </div>\n <div class="form_input">\n <input id="last_name" name="last_name" type="text" value=""/>\n <span class="error_message"></span>\n </div>\n\n <div class="form_clear"></div>\n\n <div class="form_label">\n <label for="email">');
__out.push(__sanitize(t('Email Address')));
__out.push('</label>\n </div>\n <div class="form_input">\n <input id="email" name="email" type="text" value=""/>\n <span class="error_message"></span>\n </div>\n\n <div class="form_clear"></div>\n\n <div class="form_label">\n <label for="password">');
__out.push(__sanitize(t('Password')));
__out.push('</label>\n </div>\n <div class="form_input">\n <input id="password" name="password" type="password" value=""/>\n <span class="error_message"></span>\n </div>\n\n <div class="form_clear"></div>\n\n <div class="form_label">\n <label for="country">');
__out.push(__sanitize(t('Country')));
__out.push('</label>\n </div>\n <div class="form_input">\n ');
__out.push(app.helpers.countrySelector('location_country'));
__out.push('\n <span class="error_message"></span>\n </div>\n\n <div class="form_clear"></div>\n <div class="form_label">\n <label for="location">');
__out.push(__sanitize(t('Zip/Postal Code')));
__out.push('</label>\n </div>\n <div class="form_input">\n <input id="location" name="location" class="half" type="text" value=""/>\n <span class="error_message"></span>\n </div>\n\n <div class="form_clear"></div>\n\n <div class="form_clear"></div>\n <div class="form_label">\n <label for="language">');
__out.push(__sanitize(t('Language')));
__out.push('</label>\n </div>\n <div class="form_input">\n <select id="language" name="language">\n <option value="en">English (US)</option>\n <option value="fr">Français</option>\n </select>\n </div>\n\n <div class="form_clear"></div>\n\n <h2>');
__out.push(__sanitize(t('Mobile Phone Information')));
__out.push('</h2>\n\n <div class="form_clear"></div>\n\n <div class="form_label">\n <label for="country">');
__out.push(__sanitize(t('Country')));
__out.push('</label>\n </div>\n <div class="form_input">\n ');
__out.push(app.helpers.countrySelector('mobile_country', {
countryCodePrefix: 'mobile_country_code'
}));
__out.push('\n <span class="error_message"></span>\n </div>\n\n <div class="form_clear"></div>\n\n <div class="form_label">\n <label for="mobile">');
__out.push(__sanitize(t('Mobile Number')));
__out.push('</label>\n </div>\n <div class="form_input">\n <div id="mobile_country_code" class="phone_country_code">+1</div>\n <input id="mobile" name="mobile" class="phone" type="text" value=""/>\n <span class="error_message"></span>\n </div>\n\n <div class="form_clear"></div>\n\n <h2>');
__out.push(__sanitize(t('Payment Information')));
__out.push('</h2>\n\n <div class="form_clear"></div>\n\n <span><span id="top_of_form" class="error_message"></span></span>\n\n\n <div class="form_label">\n <label for="card_number">');
__out.push(__sanitize(t('Credit Card Number')));
__out.push('</label>\n </div>\n <div class="form_input">\n <input id="card_number" name="card_number" type="text" value=""/>\n <!--img id="card_icon" src="/web/img/cc_mastercard_24.png"-->\n <span class="error_message"></span>\n </div>\n\n <div class="form_clear"></div>\n\n <div class="form_label">\n <label for="card_expiration_month">');
__out.push(__sanitize(t('Expiration Date')));
__out.push('</label>\n </div>\n <div class="form_input">\n <select id="card_expiration_month" name="card_expiration_month">\n <option value="01">01</option>\n <option value="02">02</option>\n <option value="03">03</option>\n <option value="04">04</option>\n <option value="05">05</option>\n <option value="06">06</option>\n <option value="07">07</option>\n <option value="08">08</option>\n <option value="09">09</option>\n <option value="10">10</option>\n <option value="11">11</option>\n <option value="12">12</option>\n </select>\n\n <select id="card_expiration_year" name="card_expiration_year">\n <option value="2011">2011</option>\n <option value="2012">2012</option>\n <option value="2013">2013</option>\n <option value="2014">2014</option>\n <option value="2015">2015</option>\n <option value="2016">2016</option>\n <option value="2017">2017</option>\n <option value="2018">2018</option>\n <option value="2019">2019</option>\n <option value="2020">2020</option>\n <option value="2021">2021</option>\n </select>\n <span class="error_message"></span>\n </div>\n\n <div class="form_clear"></div>\n\n <div class="form_label">\n <label for="card_number">');
__out.push(__sanitize(t('Security Code')));
__out.push('</label>\n </div>\n <div class="form_input">\n <input id="card_code" name="card_code" type="text" value="" class="half" />\n <span class="error_message"></span>\n </div>\n\n <div class="form_clear"></div>\n\n <div class="form_label">\n <label for="use_case">');
__out.push(__sanitize(t('Type of Card')));
__out.push('</label>\n </div>\n <div class="form_input">\n <select id="use_case" name="use_case">\n <option value="personal">');
__out.push(__sanitize(t('Personal')));
__out.push('</option>\n <option value="business">');
__out.push(__sanitize(t('Business')));
__out.push('</option>\n </select>\n <span class="error_message"></span>\n </div>\n\n <div class="form_clear"></div>\n\n <h2>');
__out.push(__sanitize(t('Promotion Code')));
__out.push('</h2>\n\n <div class="form_label">\n <label for="promotion_code">');
__out.push(__sanitize(t('Code')));
__out.push('</label>\n </div>\n <div class="form_input">\n <input id="promotion_code" name="promotion_code" type="text" value="');
__out.push(__sanitize(this.invite));
__out.push('">\n <span class="error_message"></span>\n </div>\n\n <div class="form_clear"></div>\n\n <h2>');
__out.push(__sanitize(t('Legal Information')));
__out.push('</h2>\n\n <p>');
__out.push(t('Sign Up Agreement', {
terms_link: "<a href='https://www.uber.com/terms' target='_blank' style='line-height:11px;'>" + (t('Terms and Conditions')) + "</a>",
privacy_link: "<a href='https://www.uber.com/privacy' target='_blank' style='line-height:11px;'>" + (t('Privacy Policy')) + "</a>"
}));
__out.push('</p>\n\n <p>');
__out.push(t('Message and Data Rates Disclosure', {
help_string: "<strong>" + (t('HELP')) + "</strong>",
stop_string: "<strong>" + (t('STOP')) + "</strong>"
}));
__out.push('</p>\n\n <p style="display:none" id="terms_error" class="error_message">');
__out.push(__sanitize(t('Sign Up Agreement Error')));
__out.push('</p>\n\n <div id="signup_terms">\n <p>\n <input type="checkbox" name="signup_terms_agreement" />\n <label for="signup_terms_agreement"><strong>');
__out.push(t('I Agree'));
__out.push('</strong></label>\n </p>\n </div>\n\n <div class="formSubmitButton"><button type="submit" class="button" data-theme="a" id="sign_up_submit_button"><span>');
__out.push(__sanitize(t('Sign Up')));
__out.push('</span></button></div>\n\n </form>\n </div>\n</div>\n\n<div id="small_container_shadow"></div>\n');
}).call(this);
}).call(__obj);
__obj.safe = __objSafe, __obj.escape = __escape;
return __out.join('');
}}, "templates/clients/trip_detail": function(exports, require, module) {module.exports = function(__obj) {
if (!__obj) __obj = {};
var __out = [], __capture = function(callback) {
var out = __out, result;
__out = [];
callback.call(this);
result = __out.join('');
__out = out;
return __safe(result);
}, __sanitize = function(value) {
if (value && value.ecoSafe) {
return value;
} else if (typeof value !== 'undefined' && value != null) {
return __escape(value);
} else {
return '';
}
}, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
__safe = __obj.safe = function(value) {
if (value && value.ecoSafe) {
return value;
} else {
if (!(typeof value !== 'undefined' && value != null)) value = '';
var result = new String(value);
result.ecoSafe = true;
return result;
}
};
if (!__escape) {
__escape = __obj.escape = function(value) {
return ('' + value)
.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/"/g, '"');
};
}
(function() {
(function() {
var distance, fareBreakdown, printFares, printStar, _ref, _ref2, _ref3, _ref4, _ref5, _ref6;
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
printStar = function() {
return __out.push('\n <img alt="Star" src="/web/img/star.png"/>\n');
};
__out.push('\n');
fareBreakdown = this.trip.get('fare_breakdown');
__out.push('\n\n');
printFares = __bind(function(fare, index, list) {
var _ref;
__out.push('\n\n <li>\n <span class="fare">');
__out.push(__sanitize(app.helpers.formatCurrency(fare['amount'], false, (_ref = this.trip.get('fare_breakdown_local')) != null ? _ref.currency : void 0)));
__out.push('</span><br/>\n <span class="subtext">');
__out.push(__sanitize(fare['name']));
__out.push('</span>\n ');
if (fare['variable_rate'] !== 0) {
__out.push('\n <br><span class="subtext">');
__out.push(__sanitize("" + (app.helpers.formatCurrency(fare['variable_rate'], false, this.trip.get('fare_breakdown_local'))) + " x " + (app.helpers.roundNumber(fare['input_amount'], 3)) + " " + fare['input_type']));
__out.push('</span>\n ');
}
__out.push('\n </li>\n ');
if (index !== list.length - 1) {
__out.push('\n <li class="math">+</li>\n ');
}
return __out.push('\n');
}, this);
__out.push('\n\n');
__out.push(require('templates/clients/modules/sub_header').call(this, {
heading: t("Trip Details")
}));
__out.push('\n\n\n<div id="main_content">\n <div class="clear"></div>\n <div>\n <div id="trip_details_map"></div>\n <div id="trip_details_info">\n <h2>\n ');
__out.push(__sanitize(t('Your Trip')));
__out.push('\n </h2>\n\n <div id="avatars">\n <h3>');
__out.push(__sanitize(t('Driver')));
__out.push('</h3>\n <img alt="Driver image" height="45" src="');
__out.push(__sanitize((_ref = this.trip.get('driver')) != null ? _ref.picture_url : void 0));
__out.push('" width="45" />\n <span>');
__out.push(__sanitize((_ref2 = this.trip.get('driver')) != null ? _ref2.first_name : void 0));
__out.push('</span>\n\n <div class="clear"></div>\n </div>\n\n <h3>');
__out.push(__sanitize(t('Rating')));
__out.push('</h3>\n ');
_(this.trip.get('driver_rating')).times(printStar);
__out.push('\n <h3>');
__out.push(__sanitize(t('Trip Info')));
__out.push('</h3>\n <table>\n <tr class="first">\n <td class="label">');
__out.push(__sanitize(t('Pickup time:')));
__out.push('</td>\n <td>');
__out.push(__sanitize(app.helpers.formatDate(this.trip.get('begintrip_at'), true, this.trip.get('city').timezone)));
__out.push('</td>\n </tr>\n <tr>\n <td class="label">');
__out.push(__sanitize(t("" + (app.helpers.capitaliseFirstLetter((_ref3 = this.trip.get('city')) != null ? (_ref4 = _ref3.country) != null ? _ref4.distance_unit : void 0 : void 0)) + "s:")));
__out.push('</td>\n ');
distance = this.trip.get('distance', 0);
__out.push('\n ');
if (((_ref5 = this.trip.get('city')) != null ? (_ref6 = _ref5.country) != null ? _ref6.distance_unit : void 0 : void 0) === "kilometer") {
__out.push('\n ');
distance = distance * 1.609344;
__out.push('\n ');
}
__out.push('\n <td>');
__out.push(__sanitize(app.helpers.roundNumber(distance, 2)));
__out.push('</td>\n </tr>\n <tr>\n <td class="label">');
__out.push(__sanitize(t('Trip time:')));
__out.push('</td>\n <td>');
__out.push(__sanitize(app.helpers.formatSeconds(this.trip.get('duration'))));
__out.push('</td>\n </tr>\n <tr>\n <td class="label">');
__out.push(__sanitize(t('Fare:')));
__out.push('</td>\n <td>');
__out.push(__sanitize(app.helpers.formatTripFare(this.trip)));
__out.push('</td>\n </tr>\n </table>\n\n <p><button class="resendReceipt"><span>Resend Receipt</span></button> <span class="resendReceiptSuccess success"></span><span class="resendReceiptError error"></span></p>\n\n <p><a id="fare_review" href="">');
__out.push(__sanitize(t('Request a fare review')));
__out.push('</a></p>\n </div>\n <div class="clear"></div>\n\n <div id="fare_review_box">\n\n <span class="success_message" style="display:none;">');
__out.push(__sanitize(t("Fare Review Submitted")));
__out.push('</span>\n <div id="fare_review_form_wrapper">\n <p>');
__out.push(__sanitize(t("Fair Price Consideration")));
__out.push('</p>\n <div id="pricing_breakdown">\n <h3>');
__out.push(__sanitize(t('Your Fare Calculation')));
__out.push('</h3>\n\n <h4>');
__out.push(__sanitize(t('Charges')));
__out.push('</h4>\n <ul>\n ');
_.each(fareBreakdown['charges'], printFares);
__out.push('\n <div class="clear"></div>\n </ul>\n\n <h4>');
__out.push(__sanitize(t('Discounts')));
__out.push('</h4>\n <ul>\n ');
_.each(fareBreakdown['discounts'], printFares);
__out.push('\n <div class="clear"></div>\n </ul>\n\n <h4>');
__out.push(__sanitize(t('Total Charge')));
__out.push('</h4>\n <ul>\n <li class="math">=</li>\n <li class="valign"><span>$');
__out.push(__sanitize(this.trip.get('fare')));
__out.push('</span></li>\n <div class="clear"></div>\n </ul>\n </div>\n <ul>\n <li>');
__out.push(t('Uber Pricing Information Message', {
learn_link: "<a href='" + (app.config.get('url')) + "/learn'>" + (t('Uber pricing information')) + "</a>"
}));
__out.push('</li>\n <li>');
__out.push(__sanitize(t('GPS Point Capture Disclosure')));
__out.push('</li>\n </ul>\n\n <p>');
__out.push(__sanitize(t('Fare Review Note')));
__out.push('</p>\n <span class="error_message" style="display:none;">');
__out.push(__sanitize(t('Fare Review Error')));
__out.push('</span>\n <form id="form_review_form" action="" method="">\n <input type="hidden" id="tripid" name="tripid" value="');
__out.push(__sanitize(this.trip.get('id')));
__out.push('">\n <textarea id="form_review_message" name="message"></textarea>\n <div class="clear"></div>\n <button id="submit_fare_review" type="submit" class="button" data-theme="a"><span>');
__out.push(__sanitize(t('Submit')));
__out.push('</span></button>\n </form>\n <button class="button" id="fare_review_hide" data-theme="a"><span>');
__out.push(__sanitize(t('Cancel')));
__out.push('</span></button>\n </div>\n </div>\n <div class="clear"></div>\n </div>\n</div>\n<div id="main_shadow"></div>\n');
}).call(this);
}).call(__obj);
__obj.safe = __objSafe, __obj.escape = __escape;
return __out.join('');
}}, "templates/shared/menu": function(exports, require, module) {module.exports = function(__obj) {
if (!__obj) __obj = {};
var __out = [], __capture = function(callback) {
var out = __out, result;
__out = [];
callback.call(this);
result = __out.join('');
__out = out;
return __safe(result);
}, __sanitize = function(value) {
if (value && value.ecoSafe) {
return value;
} else if (typeof value !== 'undefined' && value != null) {
return __escape(value);
} else {
return '';
}
}, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
__safe = __obj.safe = function(value) {
if (value && value.ecoSafe) {
return value;
} else {
if (!(typeof value !== 'undefined' && value != null)) value = '';
var result = new String(value);
result.ecoSafe = true;
return result;
}
};
if (!__escape) {
__escape = __obj.escape = function(value) {
return ('' + value)
.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/"/g, '"');
};
}
(function() {
(function() {
__out.push('<div id="menu_main">\n <div class="logo">\n <a href="/"><img src="/web/img/logo-charcoal.png"></a>\n </div>\n <div class="nav">\n <ul>\n ');
if (this.type === 'guest') {
__out.push('\n <li><a class="" href="/#!/sign-up" id="">');
__out.push(__sanitize(t("Sign Up")));
__out.push('</a></li>\n <li><a class="" href="https://www.uber.com/learn" id="">');
__out.push(__sanitize(t("Learn More")));
__out.push('</a></li>\n <li><a class="" href="http://blog.uber.com" id="">');
__out.push(__sanitize(t("Blog")));
__out.push('</a></li>\n <li><a class="" href="/#!/sign-in">');
__out.push(__sanitize(t("Sign In")));
__out.push(' »</a></li>\n ');
}
__out.push('\n ');
if (this.type === 'client') {
__out.push('\n ');
if ($.cookie('user') && JSON.parse($.cookie('user')).is_admin) {
__out.push('\n <li><a class="" href="/#!/request" id="">');
__out.push(__sanitize(t("Ride Request")));
__out.push('</a></li>\n ');
}
__out.push('\n <li><a class="" href="/#!/dashboard" id="">');
__out.push(__sanitize(t("Dashboard")));
__out.push('</a></li>\n <li><a class="" href="/#!/invite" id="">');
__out.push(__sanitize(t("Invite Friends")));
__out.push('</a></li>\n <li><a class="" href="/#!/promotions" id="">');
__out.push(__sanitize(t("Promotions")));
__out.push('</a></li>\n <li><a class="" href="/#!/billing" id="">');
__out.push(__sanitize(t("Billing")));
__out.push('</a></li>\n <li><a class="" href="/#!/settings/information" id="">');
__out.push(__sanitize(t("Settings")));
__out.push('</a></li>\n <li><a class="" href="/#!/sign-out">');
__out.push(__sanitize(t("Sign Out")));
__out.push(' »</a></li>\n ');
}
__out.push('\n </ul>\n </div>\n</div>\n');
}).call(this);
}).call(__obj);
__obj.safe = __objSafe, __obj.escape = __escape;
return __out.join('');
}}, "translations/en": function(exports, require, module) {(function() {
exports.translations = {
"Uber": "Uber",
"Sign Up": "Sign Up",
"Ride Request": "Ride Request",
"Invite Friends": "Invite Friends",
"Promotions": "Promotions",
"Billing": "Billing",
"Settings": "Settings",
"Forgot Password?": "Forgot Password?",
"Password Recovery": "Password Recovery",
"Login": "Login",
"Trip Detail": "Trip Detail",
"Password Reset": "Password Reset",
"Confirm Email": "Confirm Email",
"Request Ride": "Request Ride",
"Credit Card Number": "Credit Card Number",
"month": "month",
"01-Jan": "01-Jan",
"02-Feb": "02-Feb",
"03-Mar": "03-Mar",
"04-Apr": "04-Apr",
"05-May": "05-May",
"06-Jun": "06-Jun",
"07-Jul": "07-Jul",
"08-Aug": "08-Aug",
"09-Sep": "09-Sep",
"10-Oct": "10-Oct",
"11-Nov": "11-Nov",
"12-Dec": "12-Dec",
"year": "year",
"CVV": "CVV",
"Category": "Category",
"personal": "personal",
"business": "business",
"Default Credit Card": "Default Credit Card",
"Add Credit Card": "Add Credit Card",
"Expiry": "Expiry",
"default card": "default card",
"make default": "make default",
"Edit": "Edit",
"Delete": "Delete",
"Expiry Month": "Expiry Month",
"Expiry Year": "Expiry Year",
"Unable to Verify Card": "Unable to verify card at this time. Please try again later.",
"Credit Card Update Succeeded": "Your card has been successfully updated!",
"Credit Card Update Failed": "We couldn't save your changes. Please try again in a few minutes.",
"Credit Card Delete Succeeded": "Your card has been deleted!",
"Credit Card Delete Failed": "We were unable to delete your card. Please try again later.",
"Credit Card Update Category Succeeded": "Successfully changed card category!",
"Credit Card Update Category Failed": "We couldn't change your card category. Please try again in a few minutes.",
"Credit Card Update Default Succeeded": "Successfully changed default card!",
"Credit Card Update Default Failed": "We couldn't change your default card. Please try again in a few minutes.",
"Hello Greeting": "Hello, <%= name %>",
"Card Ending in": "Card Ending in",
"Trip Map": "Trip Map",
"Amount": "Amount: <%= amount %>",
"Last Attempt to Bill": "Last Attempt to Bill: <%= date %>",
"Charge": "Charge",
"Uber Credit Balance Note": "Your account has an UberCredit balance of <%= amount %>. When billing for trips, we'll deplete your UberCredit balance before applying charges to your credit card.",
"Please Add Credit Card": "Please add a credit card to bill your outstanding charges.",
"Credit Cards": "Credit Cards",
"add a new credit card": "add a new credit card",
"Account Balance": "Account Balance",
"Arrears": "Arrears",
"Billing Succeeded": "Your card was successfully billed.",
"Confirm Email Succeeded": "Successfully confirmed email token, redirecting to log in page...",
"Confirm Email Failed": "Unable to confirm email. Please contact support@uber.com if this problem persists.",
"Email Already Confirmed": "Your email address has already been confirmed, redirecting to log in page...",
"Credit Card Added": "Credit Card Added",
"No Credit Card": "No Credit Card",
"Mobile Number Confirmed": "Mobile Number Confirmed",
"No Confirmed Mobile": "No Confirmed Mobile",
"E-mail Address Confirmed": "E-mail Address Confirmed",
"No Confirmed E-mail": "No Confirmed E-mail",
'Reply to sign up text': 'Reply "GO" to the text message you received at sign up.',
"Resend text message": "Resend text message",
"Click sign up link": "Click the link in the email you received at sign up.",
"Resend email": "Resend email",
"Add a credit card to ride": "Add a credit card and you'll be ready to ride Uber.",
"Your Most Recent Trip": "Your Most Recent Trip",
"details": "details",
"Your Trip History ": "Your Trip History ",
"Status": "Status",
"Here's how it works:": "Here's how it works:",
"Show all trips": "Show all trips",
"Set your location:": "Set your location:",
"App search for address": "iPhone/Android app: fix the pin or search for an address",
"SMS text address": "SMS: text your address to UBRCAB (827222)",
"Confirm pickup request": "Confirm your pickup request",
"Uber sends ETA": "Uber will send you an ETA (usually within 5-10 minutes)",
"Car arrives": "When your car is arriving, Uber will inform you again.",
"Ride to destination": "Hop in the car and tell the driver your destination.",
"Thank your driver": "That’s it! Please thank your driver but remember that your tip is included and no cash is necessary.",
"Trip started here": "Trip started here",
"Trip ended here": "Trip ended here",
"Sending Email": "Sending email...",
"Resend Email Succeeded": "We just sent the email. Please click on the confirmation link you recieve.",
"Resend Email Failed": "There was an error sending the email. Please contact support if the problem persists.",
"Resend Text Succeeded": 'We just sent the text message. Please reply "GO" to the message you recieve. It may take a few minutes for the message to reach you phone.',
"Resend Text Failed": "There was an error sending the text message. Please contact support if the problem persists.",
"Password Reset Error": "There was an error processing your password reset request.",
"New Password": "New Password",
"Forgot Password": "Forgot Password",
"Forgot Password Error": "Your email address could not be found. Please make sure to use the same email address you used when you signed up.",
"Forgot Password Success": "Please check your email for a link to reset your password.",
"Forgot Password Enter Email": 'Enter your email address and Uber will send you a link to reset your password. If you remember your password, you can <a href="/#!/sign-in">sign in here</a>.',
"Invite friends": "Invite friends",
"Give $ Get $": "Give $10, Get $10",
"Give $ Get $ Description": "Every friend you invite to Uber gets $10 of Uber credit. After someone you’ve invited takes his/her first ride, you get $10 of Uber credits too!",
"What are you waiting for?": "So, what are you waiting for? Invite away!",
"Tweet": "Tweet",
"Invite Link": "Email or IM this link to your friends:",
"Email Address": "Email Address",
"Reset Password": "Reset Password",
"Enter Promotion Code": "If you have a promotion code, enter it here:",
"Your Active Promotions": "Your Active Promotions",
"Code": "Code",
"Details": "Details",
"Trips Remaining": "Trips Remaining",
"Expires": "Expires",
"No Active Promotions": "There are no active promotions on your account.",
"Your Available Promotions": "Your Available Promotions",
"Where do you want us to pick you up?": "Where do you want us to pick you up?",
"Address to search": "Address to search",
"Search": "Search",
"Driver Name:": "Driver Name:",
"Driver #:": "Driver #:",
"Pickup Address:": "Pickup Address:",
"Add to Favorite Locations": "Add to Favorite Locations",
"Star": "Star",
"Nickname:": "Nickname:",
"Add": "Add",
"Your last trip": "Your last trip",
"Please rate your driver:": "Please rate your driver:",
"Comments: (optional)": "Comments: (optional)",
"Rate Trip": "Rate Trip",
"Pickup time:": "Pickup time:",
"Miles:": "Miles:",
"Trip time:": "Trip time:",
"Fare:": "Fare:",
"Favorite Locations": "Favorite Locations",
"Search Results": "Search Results",
"You have no favorite locations saved.": "You have no favorite locations saved.",
"Loading...": "Loading...",
"Request Pickup": "Request Pickup",
"Cancel Pickup": "Cancel Pickup",
"Requesting Closest Driver": "Requesting the closest driver to pick you up...",
"En Route": "You are currently en route...",
"Rate Last Trip": "Please rate your trip to make another request",
"Rate Before Submitting": "Please rate your trip before submitting the form",
"Address too short": "Address too short",
"or did you mean": "or did you mean",
"Search Address Failed": "Unable to find the given address. Please enter another address close to your location.",
"Sending pickup request...": "Sending pickup request...",
"Cancel Request Prompt": "Are you sure you want to cancel your request?",
"Cancel Request Arrived Prompt": 'Are you sure you want to cancel your request? Your driver has arrived so there is a $10 cancellation fee. It may help to call your driver now',
"Favorite Location Nickname Length Error": "Nickname has to be atleast 3 characters",
"Favorite Location Save Succeeded": "Location Saved!",
"Favorite Location Save Failed": "Unable to save your location. Please try again later.",
"Favorite Location Title": "Favorite Location <%= id %>",
"Search Location Title": "Search Location <%= id %>",
"ETA Message": "ETA: Around <%= minutes %> Minutes",
"Nearest Cab Message": "The closest driver is approximately <%= minutes %> minute(s) away",
"Arrival ETA Message": "Your Uber will arrive in about <%= minutes %> minute(s)",
"Arriving Now Message": "Your Uber is arriving now...",
"Rating Driver Failed": "Unable to contact server. Please try again later or email support if this issue persists.",
"Account Information": "Account Information",
"Mobile Phone Information": "Mobile Phone Information",
"settings": "settings",
"Information": "Information",
"Picture": "Picture",
"Change password": "Change password",
"Your current Picture": "Your current Picture",
"Your Favorite Locations": "Your Favorite Locations",
"You have no favorite locations saved.": "You have no favorite locations saved.",
"Purpose of Mobile": "We send text messages to your mobile phone to tell you when your driver is arriving. You can also request trips using text messages.",
"Country": "Country",
"Mobile Number": "Mobile Number",
"Submit": "Submit",
"Favorite Location": "Favorite Location",
"No Approximate Address": "Could not find an approximate address",
"Address:": "Address:",
"Information Update Succeeded": "Your information has been updated!",
"Information Update Failed": "We couldn't update your information. Please try again in few minutes or contact support if the problem persists.",
"Location Delete Succeeded": "Location deleted!",
"Location Delete Failed": "We were unable to delete your favorite location. Please try again later or contact support of the issue persists.",
"Location Edit Succeeded": "Changes Saved!",
"Location Edit Failed": "We couldn't save your changes. Please try again in a few minutes.",
"Picture Update Succeeded": "Your picture has been updated!",
"Picture Update Failed": "We couldn't change your picture. Please try again in a few minutes.",
"Personal Information": "Personal Information",
"Mobile Phone Number": "Mobile Phone Number",
"Payment Information": "Payment Information",
"Purpose of Credit Card": "We keep your credit card on file so that your trip go as fast as possible. You will not be charged until you take a trip.",
"Your card will not be charged until you take a trip.": "Your card will not be charged until you take a trip.",
"Credit Card Number": "Credit Card Number",
"Expiration Date": "Expiration Date",
"Promotion Code": "Promotion Code",
"Enter Promo Here": "If you have a code for a promotion, invitation or group deal, you can enter it here.",
"Promotion Code Input Label": "Promotion, Invite or Groupon Code (optional)",
"Terms and Conditions": "Terms and Conditions",
"HELP": "HELP",
"STOP": "STOP",
"Legal Information": "Legal Information",
"Sign Up Agreement": "By signing up, I agree to the Uber <%= terms_link %> and <%= privacy_link %> and understand that Uber is a request tool, not a transportation carrier.",
"Sign Up Agreement Error": "You must agree to the Uber Terms and Conditions and Privacy Policy to continue.",
"Message and Data Rates Disclosure": "Message and Data Rates May Apply. Reply <%= help_string %> to 827-222 for help. Reply <%= stop_string %> to 827-222 to stop texts. For additional assistance, visit support.uber.com or call (866) 576-1039. Supported Carriers: AT&T, Sprint, Verizon, and T-Mobile.",
"I Agree": "I agree to the Terms & Conditions and Privacy Policy",
"Security Code": "Security Code",
"Type of Card": "Type of Card",
"Personal": "Personal",
"Business": "Business",
"Code": "Code",
"Zip or Postal Code": "Zip or Postal Code",
"Your Trip": "Your Trip",
"Trip Info": "Trip Info",
"Request a fare review": "Request a fare review",
"Fare Review Submitted": "Your fare review has been submitted. We'll get back to you soon about your request. Sorry for any inconvenience this may have caused!",
"Fair Price Consideration": "We're committed to delivering Uber service at a fair price. Before requesting a fare review, please consider:",
"Your Fare Calculation": "Your Fare Calculation",
"Charges": "Charges",
"Discounts": "Discounts",
"Total Charge": "Total Charge",
"Uber pricing information": "Uber pricing information",
"Uber Pricing Information Message": "<%= learn_link %> is published on our website.",
"GPS Point Capture Disclosure": "Due to a finite number of GPS point captures, corners on your trip map may appear cut off or rounded. These minor inaccuracies result in a shorter measured distance, which always results in a cheaper trip.",
"Fare Review Note": "Please elaborate on why this trip requires a fare review. Your comments below will help us better establish the correct price for your trip:",
"Fare Review Error": "There was an error submitting the review. Please ensure that you have a message.",
"Sign In": "Sign In"
};
}).call(this);
}, "translations/fr": function(exports, require, module) {(function() {
exports.translations = {
"Uber": "Uber",
"Sign Up": "Inscription",
"Ride Request": "Passer une Commande",
"Invite Friends": "Inviter vos Amis",
"Promotions": "Promotions",
"Billing": "Paiement",
"Settings": "Paramètres",
"Forgot Password?": "Mot de passe oublié ?",
"Password Recovery": "Récupération du mot de passe",
"Login": "Connexion",
"Trip Detail": "Détail de la Course",
"Password Reset": "Réinitialisation du mot de passe",
"Confirm Email": "Confirmation de l’e-mail",
"Request Ride": "Passer une Commande",
"Credit Card Number": "Numéro de Carte de Crédit",
"month": "mois",
"01-Jan": "01-Jan",
"02-Feb": "02-Fév",
"03-Mar": "03-Mar",
"04-Apr": "04-Avr",
"05-May": "05-Mai",
"06-Jun": "06-Juin",
"07-Jul": "07-Jui",
"08-Aug": "08-Aoû",
"09-Sep": "09-Sep",
"10-Oct": "10-Oct",
"11-Nov": "11-Nov",
"12-Dec": "12-Déc",
"year": "année",
"CVV": "Code de Sécurité",
"Category": "Type",
"personal": "personnel",
"business": "entreprise",
"Default Credit Card": "Carte par Défaut",
"Add Credit Card": "Ajouter une Carte",
"Expiry": "Expire",
"default card": "carte par défaut",
"make default": "choisir par défaut",
"Edit": "Modifier",
"Delete": "Supprimer",
"Expiry Month": "Mois d’Expiration",
"Expiry Year": "Année d’Expiration",
"Unable to Verify Card": "Impossible de vérifier la carte pour le moment. Merci de réessayer un peu plus tard.",
"Credit Card Update Succeeded": "Votre carte a été mise à jour avec succès !",
"Credit Card Update Failed": "Nous ne pouvons enregistrer vos changements. Merci de réessayer dans quelques minutes.",
"Credit Card Delete Succeeded": "Votre carte a été supprimée !",
"Credit Card Delete Failed": "Nous n’avons pas été en mesure de supprimer votre carte. Merci de réessayer plus tard.",
"Credit Card Update Category Succeeded": "Changement de catégorie de carte réussi !",
"Credit Card Update Category Failed": "Nous ne pouvons pas changer la catégorie de votre carte. Merci de réessayer dans quelques minutes.",
"Credit Card Update Default Succeeded": "Carte par défaut changée avec succès !",
"Credit Card Update Default Failed": "Nous ne pouvons pas changer votre carte par défaut. Merci de réessayer dans quelques minutes.",
"Hello Greeting": "Bonjour, <%= name %>",
"Card Ending in": "La carte expire dans",
"Trip Map": "Carte des Courses",
"Amount": "Montant: <%= amount %>",
"Last Attempt to Bill": "Dernière tentative de prélèvement : <%= date %>",
"Charge": "Débit",
"Uber Credit Balance Note": "Votre compte a un solde de <%= amount %> UberCredits. Lorsque nous facturons des courses, nous réduirons votre solde d’UberCredits avant de prélever votre carte de crédit.",
"Please Add Credit Card": "Merci d’ajouter une carte de crédit pour que nous puissions vous facturer.",
"Credit Cards": "Cartes de crédit",
"add a new credit card": "Ajouter une nouvelle carte de crédit",
"Account Balance": "Solde du compte",
"Arrears": "Arriérés",
"Billing Succeeded": "Votre carte a été correctement débitée.",
"Confirm Email Succeeded": "L’adresse e-mail a bien été validée, vous êtes redirigé vers le tableau de bord...",
"Confirm Email Failed": "Impossible de confirmer l’adresse e-mail. Merci de contacter support@uber.com si le problème persiste.",
"Credit Card Added": "Carte de crédit ajoutée",
"No Credit Card": "Pas de carte de crédit",
"Mobile Number Confirmed": "Numéro de téléphone confirmé",
"No Confirmed Mobile": "Pas de numéro de téléphone confirmé",
"E-mail Address Confirmed": "Adresse e-mail confirmée",
"No Confirmed E-mail": "Pas d’adresse e-mail confirmée",
'Reply to sign up text': 'Répondre "GO" au SMS que vous avez reçu à l’inscription.',
"Resend text message": "Renvoyer le SMS",
"Click sign up link": "Cliquez sur le lien contenu dans l’e-mail reçu à l’inscription.",
"Resend email": "Renvoyer l’e-mail",
"Add a credit card to ride": "Ajouter une carte de crédit et vous serez prêt à voyager avec Uber.",
"Your Most Recent Trip": "Votre course la plus récente",
"details": "détails",
"Your Trip History": "Historique de votre trajet",
"Status": "Statut",
"Here's how it works:": "Voici comment ça marche :",
"Show all trips": "Montrer toutes les courses",
"Set your location:": "Définir votre position :",
"App search for address": "Application iPhone/Android : positionner la punaise ou rechercher une adresse",
"SMS text address": "SMS : envoyez votre adresse à UBRCAB (827222)",
"Confirm pickup request": "Validez la commande",
"Uber sends ETA": "Uber envoie un temps d’attente estimé (habituellement entre 5 et 10 minutes)",
"Car arrives": "Lorsque votre voiture arrive, Uber vous en informera encore..",
"Ride to destination": "Montez dans la voiture et donnez votre destination au chauffeur.",
"Thank your driver": "C’est tout ! Remerciez le chauffeur mais souvenez-vous que les pourboires sont compris et qu’il n’est pas nécessaire d’avoir du liquide sur soi.",
"Trip started here": "La course a commencé ici.",
"Trip ended here": "La course s’est terminée ici.",
"Sending Email": "Envoi de l’e-mail...",
"Resend Email Succeeded": "Nous venons d’envoyer l’e-mail. Merci de cliquer sur le lien de confirmation que vous avez reçu.",
"Resend Email Failed": "Il y a eu un problème lors de l’envoi de l’email. Merci de contacter le support si le problème persiste.",
"Resend Text Succeeded": 'Nous venons d’envoyer le SMS. Merci de répondre "GO" au message que vous avez reçu. Il se peut que cela prenne quelques minutes pour que le message arrive sur votre téléphone.',
"Resend Text Failed": "Il y a eu un problème lors de l’envoi du SMS. Merci de contacter le support si le problème persiste.",
"Password Reset Error": "Il y a eu une error lors de la réinitialisation de votre mot de passe.",
"New Password:": "Nouveau mot de passe:",
"Forgot Password Error": "Votre nom d’utilisateur / adresse email ne peut être trouvé. Merci d’utiliser la même qu’à l’inscription.",
"Forgot Password Success": "Merci de consulter votre boîte mail pour suivre la demande de ‘réinitialisation de mot de passe.",
"Forgot Password Enter Email": "Merci de saisir votre adresse email et nous vous enverrons un lien vous permettant de réinitialiser votre mot de passe :",
"Invite friends": "Inviter vos amis",
"Give $ Get $": "Donnez $10, Recevez $10",
"Give $ Get $ Description": "Chaque ami que vous invitez à Uber recevra $10 de crédits Uber. Dès lors qu’une personne que vous aurez invité aura utilisé Uber pour la première, vous recevrez $10 de crédits Uber également !",
"What are you waiting for?": "N’attendez plus ! Lancez les invitations !",
"Tweet": "Tweeter",
"Invite Link": "Envoyez ce lien par email ou messagerie instantanée à vos amis :",
"Enter Promotion Code": "Si vous avez un code promo, saisissez-le ici:",
"Your Active Promotions": "Vos Codes Promos Actifs",
"Code": "Code",
"Details": "Détails",
"Trips Remaining": "Courses restantes",
"Expires": "Expire",
"No Active Promotions": "Vous n’avez pas de code promo actif.",
"Your Available Promotions": "Votres Promos Disponibles",
"Where do you want us to pick you up?": "Où souhaitez-vous que nous vous prenions en charge ?",
"Address to search": "Adresse à rechercher",
"Search": "Chercher",
"Driver Name:": "Nom du chauffeur:",
"Driver #:": "# Chauffeur:",
"Pickup Address:": "Lieu de prise en charge:",
"Add to Favorite Locations": "Ajoutez aux Lieux Favoris",
"Star": "Étoiles",
"Nickname:": "Pseudo",
"Add": "Ajouter",
"Your last trip": "Votre dernière course",
"Please rate your driver:": "Merci de noter votre chauffeur :",
"Comments: (optional)": "Commentaires: (optionnel)",
"Rate Trip": "Notez votre course",
"Pickup time:": "Heure de Prise en Charge :",
"Miles:": "Kilomètres :",
"Trip time:": "Temps de course :",
"Fare:": "Tarif :",
"Favorite Locations": "Lieux Favoris",
"Search Results": "Résultats",
"You have no favorite locations saved.": "Vous n’avez pas de lieux de prise en charge favoris.",
"Loading...": "Chargement...",
"Request Pickup": "Commander ici",
"Cancel Pickup": "Annuler",
"Requesting Closest Driver": "Nous demandons au chauffeur le plus proche de vous prendre en charge...",
"En Route": "Vous êtes actuellement en route...",
"Rate Last Trip": "Merci de noter votre précédent trajet pour faire une autre course.",
"Rate Before Submitting": "Merci de noter votre trajet avant de le valider.",
"Address too short": "L’adresse est trop courte",
"or did you mean": "ou vouliez-vous dire",
"Search Address Failed": "Impossible de trouver l’adresse spécifiée. Merci de saisir une autre adresse proche de l’endroit où vous vous trouvez.",
"Sending pickup request...": "Envoi de la demande de prise en charge...",
"Cancel Request Prompt": "Voulez-vous vraiment annuler votre demande ?",
"Cancel Request Arrived Prompt": 'Voulez-vous vraiment annuler votre demande ? Votre chauffeur est arrivé, vous serez donc facturé de $10 de frais d’annulation. Il pourrait être utile que vous appeliez votre chauffeur maintenant.',
"Favorite Location Nickname Length Error": "Le pseudo doit faire au moins 3 caractères de long",
"Favorite Location Save Succeeded": "Adresse enregistrée !",
"Favorite Location Save Failed": "Impossible d’enregistrer votre adresse. Merci de réessayer ultérieurement.",
"Favorite Location Title": "Adresse favorie <%= id %>",
"Search Location Title": "Recherche d’adresse <%= id %>",
"ETA Message": "Temps d’attente estimé: environ <%= minutes %> minutes",
"Nearest Cab Message": "Le chauffeur le plus proche sera là dans <%= minutes %> minute(s)",
"Arrival ETA Message": "Votre chauffeur arrivera dans <%= minutes %> minute(s)",
"Arriving Now Message": "Votre chauffeur est en approche...",
"Rating Driver Failed": "Impossible de contacter le serveur. Merci de réessayer ultérieurement ou de contacter le support si le problème persiste.",
"settings": "Paramètres",
"Information": "Information",
"Picture": "Photo",
"Change password": "Modifier votre mot de passe",
"Your current Picture": "Votre photo",
"Your Favorite Locations": "Vos lieux favoris",
"You have no favorite locations saved.": "Vous n’avez pas de lieu favori",
"Account Information": "Informations Personnelles",
"Mobile Phone Information": "Informations de Mobile",
"Change Your Password": "Changez votre mot de passe.",
"Country": "Pays",
"Language": "Langue",
"Favorite Location": "Lieu favori",
"No Approximate Address": "Impossible de trouver une adresse même approximative",
"Address:": "Adresse :",
"Information Update Succeeded": "Vos informations ont été mises à jour !",
"Information Update Failed": "Nous n’avons pas pu mettre à jour vos informations. Merci de réessayer dans quelques instants ou de contacter le support si le problème persiste.",
"Location Delete Succeeded": "Adresse supprimée !",
"Location Delete Failed": "Nous n’avons pas pu supprimée votre adresse favorie. Merci de réessayer plus tard ou de contacter le support si le problème persiste.",
"Location Edit Succeeded": "Modifications sauvegardées !",
"Location Edit Failed": "Nous n’avons pas pu sauvegarder vos modifications. Merci de réessayer dans quelques minutes.",
"Picture Update Succeeded": "Votre photo a été mise à jour !",
"Picture Update Failed": "Nous n’avons pas pu mettre à jour votre photo. Merci de réessayer dans quelques instants.",
"Personal Information": "Informations Personnelles",
"Mobile Phone Number": "Numéro de Téléphone Portable",
"Payment Information": "Informations de Facturation",
"Your card will not be charged until you take a trip.": "Votre carte ne sera pas débitée avant votre premier trajet.",
"Card Number": "Numéro de Carte",
"Promotion Code Input Label": "Code promo, code d’invitation ou “deal” acheté en ligne (optionnel)",
"Terms and Conditions": "Conditions Générales",
"HELP": "HELP",
"STOP": "STOP",
"Sign Up Agreement": "En souscrivant, j’accepte les <%= terms_link %> et <%= privacy_link %> et comprends qu’Uber est un outil de commande de chauffeur, et non un transporteur.",
"Sign Up Agreement Error": "Vous devez accepter les Conditions Générales d’utilisation d’Uber Terms and Conditions et la Politique de Confidentialité pour continuer.",
"Message and Data Rates Disclosure": "Les frais d’envoi de SMS et de consommation de données peuvent s’appliquer. Répondez <%= help_string %> au 827-222 pour obtenir de l’aide. Répondez <%= stop_string %> au 827-222 pour ne plus recevoir de SMS. Pour plus d’aide, visitez support.uber.com ou appelez le (866) 576-1039. Opérateurs supportés: AT&T, Sprint, Verizon, T-Mobile, Orange, SFR et Bouygues Telecom.",
"Zip/Postal Code": "Code Postal",
"Expiration Date": "Date D'expiration",
"Security Code": "Code de Sécurité",
"Type of Card": "Type",
"Personal": "Personnel",
"Business": "Entreprise",
"Promotion Code": "Code Promo",
"Legal Information": "Mentions Légales",
"I Agree": "J'accepte.",
"Your Trip": "Votre Course",
"Trip Info": "Informations de la Course",
"Request a fare review": "Demander un contrôle du tarif",
"Fare Review Submitted": "Votre demande de contrôle du tarif a été soumis. Nous reviendrons vers vous rapidement concernant cette demande. Nous nous excusons pour les dérangements éventuellement occasionnés !",
"Fair Price Consideration": "Nous nous engageons à proposer Uber à un tarif juste. Avant de demander un contrôle du tarif, merci de prendre en compte :",
"Your Fare Calculation": "Calcul du Prix",
"Charges": "Coûts",
"Discounts": "Réductions",
"Total Charge": "Coût total",
"Uber pricing information": "Information sur les prix d’Uber",
"Uber Pricing Information Message": "<%= learn_link %> est disponible sur notre site web.",
"GPS Point Capture Disclosure": "A cause d’un nombre limité de coordonnées GPS sauvegardées, les angles de votre trajet sur la carte peuvent apparaître coupés ou arrondis. Ces légères incohérences débouchent sur des distances mesurées plus courtes, ce qui implique toujours un prix du trajet moins élevé.",
"Fare Review Note": "Merci de nous expliquer pourquoi le tarif de cette course nécessite d’être contrôlé. Vos commentaires ci-dessous nous aideront à établir un prix plus juste si nécessaire :",
"Fare Review Error": "Il y a eu une erreur lors de l’envoi de la demande. Assurez-vous d’avoir bien ajouté une description à votre demande."
};
}).call(this);
}, "views/clients/billing": function(exports, require, module) {(function() {
var clientsBillingTemplate;
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
}, __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
clientsBillingTemplate = require('templates/clients/billing');
exports.ClientsBillingView = (function() {
__extends(ClientsBillingView, UberView);
function ClientsBillingView() {
ClientsBillingView.__super__.constructor.apply(this, arguments);
}
ClientsBillingView.prototype.id = 'billing_view';
ClientsBillingView.prototype.className = 'view_container';
ClientsBillingView.prototype.events = {
'click a#add_card': 'addCard',
'click .charge_arrear': 'chargeArrear'
};
ClientsBillingView.prototype.render = function() {
this.RefreshUserInfo(__bind(function() {
var cards, newForm;
this.HideSpinner();
$(this.el).html(clientsBillingTemplate());
if (USER.payment_gateway.payment_profiles.length === 0) {
newForm = new app.views.clients.modules.creditcard;
$(this.el).find("#add_card_wrapper").html(newForm.render(0).el);
} else {
cards = new app.views.clients.modules.creditcard;
$("#cards").html(cards.render("all").el);
}
return this.delegateEvents();
}, this));
return this;
};
ClientsBillingView.prototype.addCard = function(e) {
var newCard;
e.preventDefault();
newCard = new app.views.clients.modules.creditcard;
$('#cards').append(newCard.render("new").el);
return $("a#add_card").hide();
};
ClientsBillingView.prototype.chargeArrear = function(e) {
var $el, arrearId, attrs, cardId, options, tryCharge;
e.preventDefault();
$(".error_message").text("");
$el = $(e.currentTarget);
arrearId = $el.attr('id');
cardId = $el.parent().find('#card_to_charge').val();
this.ShowSpinner('submit');
tryCharge = new app.models.clientbills({
id: arrearId
});
attrs = {
payment_profile_id: cardId,
dataType: 'json'
};
options = {
success: __bind(function(data, textStatus, jqXHR) {
$el.parent().find(".success_message").text(t("Billing Succeeded"));
$el.hide();
return $el.parent().find('#card_to_charge').hide();
}, this),
error: __bind(function(jqXHR, status, errorThrown) {
return $el.parent().find(".error_message").text(JSON.parse(status.responseText).error);
}, this),
complete: __bind(function() {
return this.HideSpinner();
}, this)
};
return tryCharge.save(attrs, options);
};
return ClientsBillingView;
})();
}).call(this);
}, "views/clients/confirm_email": function(exports, require, module) {(function() {
var clientsConfirmEmailTemplate;
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
}, __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
clientsConfirmEmailTemplate = require('templates/clients/confirm_email');
exports.ClientsConfirmEmailView = (function() {
__extends(ClientsConfirmEmailView, UberView);
function ClientsConfirmEmailView() {
ClientsConfirmEmailView.__super__.constructor.apply(this, arguments);
}
ClientsConfirmEmailView.prototype.id = 'confirm_email_view';
ClientsConfirmEmailView.prototype.className = 'view_container';
ClientsConfirmEmailView.prototype.render = function(token) {
var attrs;
$(this.el).html(clientsConfirmEmailTemplate());
attrs = {
data: {
email_token: token
},
success: __bind(function(data, textStatus, jqXHR) {
var show_dashboard;
this.HideSpinner();
show_dashboard = function() {
return app.routers.clients.navigate('!/dashboard', true);
};
if (data.status === 'OK') {
$('.success_message').show();
return _.delay(show_dashboard, 3000);
} else if (data.status === 'ALREADY_COMFIRMED') {
$('.already_confirmed_message').show();
return _.delay(show_dashboard, 3000);
} else {
return $('.error_message').show();
}
}, this),
error: __bind(function(e) {
this.HideSpinner();
return $('.error_message').show();
}, this),
complete: function(status) {
return $('#attempt_text').hide();
},
dataType: 'json',
type: 'PUT',
url: "" + API + "/users/self"
};
$.ajax(attrs);
this.ShowSpinner('submit');
return this;
};
return ClientsConfirmEmailView;
})();
}).call(this);
}, "views/clients/dashboard": function(exports, require, module) {(function() {
var clientsDashboardTemplate;
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
};
clientsDashboardTemplate = require('templates/clients/dashboard');
exports.ClientsDashboardView = (function() {
var displayFirstTrip;
__extends(ClientsDashboardView, UberView);
function ClientsDashboardView() {
this.showAllTrips = __bind(this.showAllTrips, this);
this.render = __bind(this.render, this);
ClientsDashboardView.__super__.constructor.apply(this, arguments);
}
ClientsDashboardView.prototype.id = 'dashboard_view';
ClientsDashboardView.prototype.className = 'view_container';
ClientsDashboardView.prototype.events = {
'click a.confirmation': 'confirmationClick',
'click #resend_email': 'resendEmail',
'click #resend_mobile': 'resendMobile',
'click #show_all_trips': 'showAllTrips'
};
ClientsDashboardView.prototype.render = function() {
var displayPage, downloadTrips;
this.HideSpinner();
displayPage = __bind(function() {
$(this.el).html(clientsDashboardTemplate());
this.confirmationsSetup();
return this.RequireMaps(__bind(function() {
if (USER.trips.models[0]) {
if (!USER.trips.models[0].get("points")) {
return USER.trips.models[0].fetch({
data: {
relationships: 'points'
},
success: __bind(function() {
this.CacheData("USERtrips", USER.trips);
return displayFirstTrip();
}, this)
});
} else {
return displayFirstTrip();
}
}
}, this));
}, this);
downloadTrips = __bind(function() {
return this.DownloadUserTrips(displayPage, false, 10);
}, this);
this.RefreshUserInfo(downloadTrips);
return this;
};
displayFirstTrip = __bind(function() {
var bounds, endPos, map, myOptions, path, polyline, startPos;
myOptions = {
zoom: 12,
mapTypeId: google.maps.MapTypeId.ROADMAP,
zoomControl: false,
rotateControl: false,
panControl: false,
mapTypeControl: false,
scrollwheel: false
};
if (USER.trips.length === 10) {
$("#show_all_trips").show();
}
if (USER.trips.length > 0) {
map = new google.maps.Map(document.getElementById("trip_details_map"), myOptions);
bounds = new google.maps.LatLngBounds();
path = [];
_.each(USER.trips.models[0].get('points'), __bind(function(point) {
path.push(new google.maps.LatLng(point.lat, point.lng));
return bounds.extend(_.last(path));
}, this));
map.fitBounds(bounds);
startPos = new google.maps.Marker({
position: _.first(path),
map: map,
title: t('Trip started here'),
icon: 'https://uber-static.s3.amazonaws.com/marker_start.png'
});
endPos = new google.maps.Marker({
position: _.last(path),
map: map,
title: t('Trip ended here'),
icon: 'https://uber-static.s3.amazonaws.com/marker_end.png'
});
polyline = new google.maps.Polyline({
path: path,
strokeColor: '#003F87',
strokeOpacity: 1,
strokeWeight: 5
});
return polyline.setMap(map);
}
}, ClientsDashboardView);
ClientsDashboardView.prototype.confirmationsSetup = function() {
var blink, cardForm, element, _ref, _ref2, _ref3, _ref4, _ref5;
blink = function(element) {
var opacity;
opacity = 0.5;
if (element.css('opacity') === "0.5") {
opacity = 1.0;
}
return element.fadeTo(2000, opacity, function() {
return blink(element);
});
};
if (((_ref = window.USER) != null ? (_ref2 = _ref.payment_gateway) != null ? (_ref3 = _ref2.payment_profiles) != null ? _ref3.length : void 0 : void 0 : void 0) === 0) {
element = $('#confirmed_credit_card');
cardForm = new app.views.clients.modules.creditcard;
$('#card.info').append(cardForm.render().el);
blink(element);
}
if (((_ref4 = window.USER) != null ? _ref4.confirm_email : void 0) === false) {
element = $('#confirmed_email');
blink(element);
}
if ((((_ref5 = window.USER) != null ? _ref5.confirm_mobile : void 0) != null) === false) {
element = $('#confirmed_mobile');
return blink(element);
}
};
ClientsDashboardView.prototype.confirmationClick = function(e) {
e.preventDefault();
$('.info').hide();
$('#more_info').show();
switch (e.currentTarget.id) {
case "card":
return $('#card.info').slideToggle();
case "mobile":
return $('#mobile.info').slideToggle();
case "email":
return $('#email.info').slideToggle();
}
};
ClientsDashboardView.prototype.resendEmail = function(e) {
var $el;
e.preventDefault();
$el = $(e.currentTarget);
$el.removeAttr('href').prop({
disabled: true
});
$el.html(t("Sending Email"));
return $.ajax({
type: 'GET',
url: API + '/users/request_confirm_email',
data: {
token: USER.token
},
dataType: 'json',
success: __bind(function(data, textStatus, jqXHR) {
return $el.html(t("Resend Email Succeeded"));
}, this),
error: __bind(function(jqXHR, textStatus, errorThrown) {
return $el.html(t("Resend Email Failed"));
}, this)
});
};
ClientsDashboardView.prototype.resendMobile = function(e) {
var $el;
e.preventDefault();
$el = $(e.currentTarget);
$el.removeAttr('href').prop({
disabled: true
});
$el.html("Sending message...");
return $.ajax({
type: 'GET',
url: API + '/users/request_confirm_mobile',
data: {
token: USER.token
},
dataType: 'json',
success: __bind(function(data, textStatus, jqXHR) {
return $el.html(t("Resend Text Succeeded"));
}, this),
error: __bind(function(jqXHR, textStatus, errorThrown) {
return $el.html(t("Resend Text Failed"));
}, this)
});
};
ClientsDashboardView.prototype.showAllTrips = function(e) {
e.preventDefault();
$(e.currentTarget).hide();
return this.DownloadUserTrips(this.render, true, 1000);
};
return ClientsDashboardView;
}).call(this);
}).call(this);
}, "views/clients/forgot_password": function(exports, require, module) {(function() {
var clientsForgotPasswordTemplate;
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
}, __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
clientsForgotPasswordTemplate = require('templates/clients/forgot_password');
exports.ClientsForgotPasswordView = (function() {
__extends(ClientsForgotPasswordView, UberView);
function ClientsForgotPasswordView() {
ClientsForgotPasswordView.__super__.constructor.apply(this, arguments);
}
ClientsForgotPasswordView.prototype.id = 'forgotpassword_view';
ClientsForgotPasswordView.prototype.className = 'view_container modal_view_container';
ClientsForgotPasswordView.prototype.events = {
"submit #password_reset": "passwordReset",
"click #password_reset_submit": "passwordReset",
"submit #forgot_password": "forgotPassword",
"click #forgot_password_submit": "forgotPassword"
};
ClientsForgotPasswordView.prototype.render = function(token) {
this.HideSpinner();
$(this.el).html(clientsForgotPasswordTemplate({
token: token
}));
this.delegateEvents();
return this;
};
ClientsForgotPasswordView.prototype.forgotPassword = function(e) {
var attrs;
e.preventDefault();
$('.success_message').hide();
$(".error_message").hide();
attrs = {
data: {
login: $("#login").val()
},
success: __bind(function(data, textStatus, jqXHR) {
this.HideSpinner();
$('.success_message').show();
return $("#forgot_password").hide();
}, this),
error: __bind(function(e) {
this.HideSpinner();
return $('.error_message').show();
}, this),
dataType: 'json',
type: 'PUT',
url: "" + API + "/users/forgot_password"
};
$.ajax(attrs);
return this.ShowSpinner('submit');
};
ClientsForgotPasswordView.prototype.passwordReset = function(e) {
var attrs;
e.preventDefault();
attrs = {
data: {
email_token: $("#token").val(),
password: $("#password").val()
},
success: __bind(function(data, textStatus, jqXHR) {
this.HideSpinner();
$.cookie('token', data.token);
amplify.store('USERjson', data);
app.refreshMenu();
return location.hash = '!/dashboard';
}, this),
error: __bind(function(e) {
this.HideSpinner();
return $('#error_reset').show();
}, this),
dataType: 'json',
type: 'PUT',
url: "" + API + "/users/self"
};
$.ajax(attrs);
return this.ShowSpinner('submit');
};
return ClientsForgotPasswordView;
})();
}).call(this);
}, "views/clients/invite": function(exports, require, module) {(function() {
var clientsInviteTemplate;
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
};
clientsInviteTemplate = require('templates/clients/invite');
exports.ClientsInviteView = (function() {
__extends(ClientsInviteView, UberView);
function ClientsInviteView() {
ClientsInviteView.__super__.constructor.apply(this, arguments);
}
ClientsInviteView.prototype.id = 'invite_view';
ClientsInviteView.prototype.className = 'view_container';
ClientsInviteView.prototype.render = function() {
this.ReadUserInfo();
this.HideSpinner();
$(this.el).html(clientsInviteTemplate());
console.log(screen);
return this;
};
return ClientsInviteView;
})();
}).call(this);
}, "views/clients/login": function(exports, require, module) {(function() {
var clientsLoginTemplate;
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
};
clientsLoginTemplate = require('templates/clients/login');
exports.ClientsLoginView = (function() {
__extends(ClientsLoginView, UberView);
function ClientsLoginView() {
ClientsLoginView.__super__.constructor.apply(this, arguments);
}
ClientsLoginView.prototype.id = 'login_view';
ClientsLoginView.prototype.className = 'view_container modal_view_container';
ClientsLoginView.prototype.events = {
'submit form': 'authenticate',
'click button': 'authenticate'
};
ClientsLoginView.prototype.initialize = function() {
_.bindAll(this, 'render');
return this.render();
};
ClientsLoginView.prototype.render = function() {
this.HideSpinner();
$(this.el).html(clientsLoginTemplate());
this.delegateEvents();
return this.place();
};
ClientsLoginView.prototype.authenticate = function(e) {
e.preventDefault();
return $.ajax({
type: 'POST',
url: API + '/auth/web_login/client',
data: {
login: $("#login").val(),
password: $("#password").val()
},
dataType: 'json',
success: function(data, textStatus, jqXHR) {
$.cookie('user', JSON.stringify(data));
$.cookie('token', data.token);
amplify.store('USERjson', data);
$('header').html(app.views.shared.menu.render().el);
return app.routers.clients.navigate('!/dashboard', true);
},
error: function(jqXHR, textStatus, errorThrown) {
$.cookie('user', null);
$.cookie('token', null);
if (jqXHR.status === 403) {
$.cookie('redirected_user', JSON.stringify(JSON.parse(jqXHR.responseText).error_obj), {
domain: '.uber.com'
});
window.location = 'http://partners.uber.com/';
}
return $('.error_message').html(JSON.parse(jqXHR.responseText).error).hide().fadeIn();
}
});
};
return ClientsLoginView;
})();
}).call(this);
}, "views/clients/modules/credit_card": function(exports, require, module) {(function() {
var creditCardTemplate;
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
}, __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
creditCardTemplate = require('templates/clients/modules/credit_card');
exports.CreditCardView = (function() {
__extends(CreditCardView, UberView);
function CreditCardView() {
CreditCardView.__super__.constructor.apply(this, arguments);
}
CreditCardView.prototype.id = 'creditcard_view';
CreditCardView.prototype.className = 'module_container';
CreditCardView.prototype.events = {
'submit #credit_card_form': 'processNewCard',
'click #new_card': 'processNewCard',
'change #card_number': 'showCardType',
'click .edit_card_show': 'showEditCard',
'click .edit_card': 'editCard',
'click .delete_card': 'deleteCard',
'click .make_default': 'makeDefault',
'change .use_case': 'saveUseCase'
};
CreditCardView.prototype.initialize = function() {
return app.collections.paymentprofiles.bind("refresh", __bind(function() {
return this.RefreshUserInfo(__bind(function() {
this.render("all");
return this.HideSpinner();
}, this));
}, this));
};
CreditCardView.prototype.render = function(cards) {
if (cards == null) {
cards = "new";
}
if (cards === "all") {
app.collections.paymentprofiles.reset(USER.payment_gateway.payment_profiles);
cards = app.collections.paymentprofiles;
}
$(this.el).html(creditCardTemplate({
cards: cards
}));
return this;
};
CreditCardView.prototype.processNewCard = function(e) {
var $el, attrs, model, options;
e.preventDefault();
this.ClearGlobalStatus();
$el = $("#credit_card_form");
$el.find('.error_message').html("");
attrs = {
card_number: $el.find('#card_number').val(),
card_code: $el.find('#card_code').val(),
card_expiration_month: $el.find('#card_expiration_month').val(),
card_expiration_year: $el.find('#card_expiration_year').val(),
use_case: $el.find('#use_case').val(),
"default": $el.find('#default_check').prop("checked")
};
options = {
statusCode: {
200: __bind(function(e) {
this.HideSpinner();
$('#cc_form_wrapper').hide();
app.collections.paymentprofiles.trigger("refresh");
$(this.el).remove();
$("a#add_card").show();
return $('section').html(app.views.clients.billing.render().el);
}, this),
406: __bind(function(e) {
var error, errors, _i, _len, _ref, _results;
this.HideSpinner();
errors = JSON.parse(e.responseText);
_ref = _.keys(errors);
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
error = _ref[_i];
_results.push(error === "top_of_form" ? $("#top_of_form").html(errors[error]) : $("#credit_card_form").find("#" + error).parent().find(".error_message").html(errors[error]));
}
return _results;
}, this),
420: __bind(function(e) {
this.HideSpinner();
return $("#top_of_form").html(t("Unable to Verify Card"));
}, this)
}
};
this.ShowSpinner("submit");
model = new app.models.paymentprofile;
model.save(attrs, options);
return app.collections.paymentprofiles.add(model);
};
CreditCardView.prototype.showCardType = function(e) {
var $el, reAmerica, reDiscover, reMaster, reVisa, validCard;
reVisa = /^4\d{3}-?\d{4}-?\d{4}-?\d{4}$/;
reMaster = /^5[1-5]\d{2}-?\d{4}-?\d{4}-?\d{4}$/;
reAmerica = /^6011-?\d{4}-?\d{4}-?\d{4}$/;
reDiscover = /^3[4,7]\d{13}$/;
$el = $("#card_logos");
validCard = false;
if (e.currentTarget.value.match(reVisa)) {
validCard = true;
} else if (e.currentTarget.value.match(reMaster)) {
$el.css('background-position', "-60px");
validCard = true;
} else if (e.currentTarget.value.match(reAmerica)) {
$el.css('background-position', "-120px");
validCard = true;
} else if (e.currentTarget.value.match(reDiscover)) {
$el.css('background-position', "-180px");
validCard = true;
}
if (validCard) {
$el.css('width', "60px");
return $el.css('margin-left', "180px");
} else {
$el.css('width', "250px");
return $el.css('margin-left', "80px");
}
};
CreditCardView.prototype.showEditCard = function(e) {
var $el, id;
e.preventDefault();
$el = $(e.currentTarget);
if ($el.html() === t("Edit")) {
id = $el.html(t("Cancel")).parents("tr").attr("id").substring(1);
return $("#e" + id).show();
} else {
id = $el.html(t("Edit")).parents("tr").attr("id").substring(1);
return $("#e" + id).hide();
}
};
CreditCardView.prototype.editCard = function(e) {
var $el, attrs, id, options;
e.preventDefault();
this.ClearGlobalStatus();
$el = $(e.currentTarget).parents("td");
id = $el.parents("tr").attr("id").substring(1);
$el.attr('disabled', 'disabled');
this.ShowSpinner('submit');
attrs = {
card_expiration_month: $el.find('#card_expiration_month').val(),
card_expiration_year: $el.find('#card_expiration_year').val(),
card_code: $el.find('#card_code').val()
};
options = {
success: __bind(function(response) {
this.HideSpinner();
this.ShowSuccess(t("Credit Card Update Succeeded"));
$("#e" + id).hide();
$("#d" + id).find(".edit_card_show").html(t("Edit"));
return app.collections.paymentprofiles.trigger("refresh");
}, this),
error: __bind(function(e) {
this.HideSpinner();
this.ShowError(t("Credit Card Update Failed"));
return $el.removeAttr('disabled');
}, this)
};
app.collections.paymentprofiles.models[id].set(attrs);
return app.collections.paymentprofiles.models[id].save({}, options);
};
CreditCardView.prototype.deleteCard = function(e) {
var $el, id, options;
e.preventDefault();
$el = $(e.currentTarget).parents("td");
id = $el.parents("tr").attr("id").substring(1);
this.ClearGlobalStatus();
this.ShowSpinner('submit');
options = {
success: __bind(function(response) {
this.ShowSuccess(t("Credit Card Delete Succeeded"));
$("form").hide();
app.collections.paymentprofiles.trigger("refresh");
return $('section').html(app.views.clients.billing.render().el);
}, this),
error: __bind(function(xhr, e) {
this.HideSpinner();
return this.ShowError(t("Credit Card Delete Failed"));
}, this)
};
return app.collections.paymentprofiles.models[id].destroy(options);
};
CreditCardView.prototype.saveUseCase = function(e) {
var $el, attrs, id, options, use_case;
this.ClearGlobalStatus();
$el = $(e.currentTarget);
use_case = $el.val();
id = $el.parents("tr").attr("id").substring(1);
attrs = {
use_case: use_case
};
options = {
success: __bind(function(response) {
return this.ShowSuccess(t("Credit Card Update Category Succeeded"));
}, this),
error: __bind(function(e) {
return this.ShowError(t("Credit Card Update Category Failed"));
}, this)
};
app.collections.paymentprofiles.models[id].set(attrs);
return app.collections.paymentprofiles.models[id].save({}, options);
};
CreditCardView.prototype.makeDefault = function(e) {
var $el, attrs, id, options;
e.preventDefault();
this.ClearGlobalStatus();
$el = $(e.currentTarget).parents("td");
id = $el.parents("tr").attr("id").substring(1);
attrs = {
"default": true
};
options = {
success: __bind(function(response) {
this.ShowSuccess(t("Credit Card Update Default Succeeded"));
return app.collections.paymentprofiles.trigger("refresh");
}, this),
error: __bind(function(e) {
return this.ShowError(t("Credit Card Update Default Failed"));
}, this)
};
app.collections.paymentprofiles.models[id].set(attrs);
return app.collections.paymentprofiles.models[id].save({}, options);
};
return CreditCardView;
})();
}).call(this);
}, "views/clients/promotions": function(exports, require, module) {(function() {
var clientsPromotionsTemplate;
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
};
clientsPromotionsTemplate = require('templates/clients/promotions');
exports.ClientsPromotionsView = (function() {
__extends(ClientsPromotionsView, UberView);
function ClientsPromotionsView() {
this.render = __bind(this.render, this);
ClientsPromotionsView.__super__.constructor.apply(this, arguments);
}
ClientsPromotionsView.prototype.id = 'promotions_view';
ClientsPromotionsView.prototype.className = 'view_container';
ClientsPromotionsView.prototype.events = {
'submit form': 'submitPromo',
'click button': 'submitPromo'
};
ClientsPromotionsView.prototype.initialize = function() {
if (this.model) {
return this.RefreshUserInfo(this.render);
}
};
ClientsPromotionsView.prototype.render = function() {
var renderTemplate;
this.ReadUserInfo();
renderTemplate = __bind(function() {
$(this.el).html(clientsPromotionsTemplate({
promos: window.USER.unexpired_client_promotions || []
}));
return this.HideSpinner();
}, this);
this.DownloadUserPromotions(renderTemplate);
return this;
};
ClientsPromotionsView.prototype.submitPromo = function(e) {
var attrs, model, options, refreshTable;
e.preventDefault();
this.ClearGlobalStatus();
refreshTable = __bind(function() {
$('section').html(this.render().el);
return this.HideSpinner();
}, this);
attrs = {
code: $('#code').val()
};
options = {
success: __bind(function(response) {
this.HideSpinner();
if (response.get('first_name')) {
return this.ShowSuccess("Your promotion has been applied in the form of an account credit. <a href='#!/billing'>Click here</a> to check your balance.");
} else {
this.ShowSuccess("Your promotion has successfully been applied");
return this.RefreshUserInfo(this.render, true);
}
}, this),
statusCode: {
400: __bind(function(e) {
this.ShowError(JSON.parse(e.responseText).error);
return this.HideSpinner();
}, this)
}
};
this.ShowSpinner("submit");
model = new app.models.promotions;
return model.save(attrs, options);
};
return ClientsPromotionsView;
})();
}).call(this);
}, "views/clients/request": function(exports, require, module) {(function() {
var clientsRequestTemplate;
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
};
clientsRequestTemplate = require('templates/clients/request');
exports.ClientsRequestView = (function() {
__extends(ClientsRequestView, UberView);
function ClientsRequestView() {
this.AjaxCall = __bind(this.AjaxCall, this);
this.AskDispatch = __bind(this.AskDispatch, this);
this.removeMarkers = __bind(this.removeMarkers, this);
this.displaySearchLoc = __bind(this.displaySearchLoc, this);
this.displayFavLoc = __bind(this.displayFavLoc, this);
this.showFavLoc = __bind(this.showFavLoc, this);
this.addToFavLoc = __bind(this.addToFavLoc, this);
this.removeCabs = __bind(this.removeCabs, this);
this.requestRide = __bind(this.requestRide, this);
this.rateTrip = __bind(this.rateTrip, this);
this.locationChange = __bind(this.locationChange, this);
this.panToLocation = __bind(this.panToLocation, this);
this.clickLocation = __bind(this.clickLocation, this);
this.searchLocation = __bind(this.searchLocation, this);
this.mouseoutLocation = __bind(this.mouseoutLocation, this);
this.mouseoverLocation = __bind(this.mouseoverLocation, this);
this.fetchTripDetails = __bind(this.fetchTripDetails, this);
this.submitRating = __bind(this.submitRating, this);
this.setStatus = __bind(this.setStatus, this);
this.initialize = __bind(this.initialize, this);
ClientsRequestView.__super__.constructor.apply(this, arguments);
}
ClientsRequestView.prototype.id = 'request_view';
ClientsRequestView.prototype.className = 'view_container';
ClientsRequestView.prototype.pollInterval = 2 * 1000;
ClientsRequestView.prototype.events = {
"submit #search_form": "searchAddress",
"click .locations_link": "locationLinkHandle",
"mouseover .location_row": "mouseoverLocation",
"mouseout .location_row": "mouseoutLocation",
"click .location_row": "clickLocation",
"click #search_location": "searchLocation",
"click #pickupHandle": "pickupHandle",
"click .stars": "rateTrip",
"submit #rating_form": "submitRating",
"click #addToFavButton": "showFavLoc",
"click #favLocNickname": "selectInputText",
"submit #favLoc_form": "addToFavLoc"
};
ClientsRequestView.prototype.status = "";
ClientsRequestView.prototype.pickupMarker = "https://uber-static.s3.amazonaws.com/pickup_marker.png";
ClientsRequestView.prototype.cabMarker = "https://uber-static.s3.amazonaws.com/cab_marker.png";
ClientsRequestView.prototype.initialize = function() {
var displayCabs;
displayCabs = __bind(function() {
return this.AskDispatch("NearestCab");
}, this);
this.showCabs = _.throttle(displayCabs, this.pollInterval);
return this.numSearchToDisplay = 1;
};
ClientsRequestView.prototype.setStatus = function(status) {
var autocomplete;
if (this.status === status) {
return;
}
try {
google.maps.event.trigger(this.map, 'resize');
} catch (_e) {}
switch (status) {
case "init":
this.AskDispatch("StatusClient");
this.status = "init";
return this.ShowSpinner("load");
case "ready":
this.HideSpinner();
$(".panel").hide();
$("#top_bar").fadeIn();
$("#location_panel").fadeIn();
$("#location_panel_control").fadeIn();
$("#pickupHandle").attr("class", "button_green").fadeIn().find("span").html(t("Request Pickup"));
this.pickup_icon.setDraggable(true);
this.map.panTo(this.pickup_icon.getPosition());
this.showCabs();
try {
this.pickup_icon.setMap(this.map);
this.displayFavLoc();
autocomplete = new google.maps.places.Autocomplete(document.getElementById('address'), {
types: ['geocode']
});
autocomplete.bindTo('bounds', this.map);
} catch (_e) {}
return this.status = "ready";
case "searching":
this.HideSpinner();
this.removeMarkers();
$(".panel").hide();
$("#top_bar").fadeOut();
$("#status_message").html(t("Requesting Closest Driver"));
$("#pickupHandle").attr("class", "button_red").fadeIn().find("span").html(t("Cancel Pickup"));
this.pickup_icon.setDraggable(false);
this.pickup_icon.setMap(this.map);
return this.status = "searching";
case "waiting":
this.HideSpinner();
this.removeMarkers();
$(".panel").hide();
$("#top_bar").fadeOut();
$("#pickupHandle").attr("class", "button_red").fadeIn().find("span").html(t("Cancel Pickup"));
$("#waiting_riding").fadeIn();
this.pickup_icon.setDraggable(false);
this.pickup_icon.setMap(this.map);
return this.status = "waiting";
case "arriving":
this.HideSpinner();
this.removeMarkers();
$(".panel").hide();
$("#top_bar").fadeOut();
$("#pickupHandle").attr("class", "button_red").fadeIn().find("span").html(t("Cancel Pickup"));
$("#waiting_riding").fadeIn();
this.pickup_icon.setDraggable(false);
this.pickup_icon.setMap(this.map);
return this.status = "arriving";
case "riding":
this.HideSpinner();
this.removeMarkers();
$(".panel").hide();
$("#top_bar").fadeOut();
$("#pickupHandle").fadeIn().attr("class", "button_red").find("span").html(t("Cancel Pickup"));
$("#waiting_riding").fadeIn();
this.pickup_icon.setDraggable(false);
this.status = "riding";
return $("#status_message").html(t("En Route"));
case "rate":
this.HideSpinner();
$(".panel").hide();
$("#pickupHandle").fadeOut();
$("#trip_completed_panel").fadeIn();
$('#status_message').html(t("Rate Last Trip"));
return this.status = "rate";
}
};
ClientsRequestView.prototype.render = function() {
this.ReadUserInfo();
this.HideSpinner();
this.ShowSpinner("load");
$(this.el).html(clientsRequestTemplate());
this.cabs = [];
this.RequireMaps(__bind(function() {
var center, myOptions, streetViewPano;
center = new google.maps.LatLng(37.7749295, -122.4194155);
this.markers = [];
this.pickup_icon = new google.maps.Marker({
position: center,
draggable: true,
clickable: true,
icon: this.pickupMarker
});
this.geocoder = new google.maps.Geocoder();
myOptions = {
zoom: 12,
center: center,
mapTypeId: google.maps.MapTypeId.ROADMAP,
rotateControl: false,
rotateControl: false,
panControl: false
};
this.map = new google.maps.Map($(this.el).find("#map_wrapper_right")[0], myOptions);
if (this.status === "ready") {
this.pickup_icon.setMap(this.map);
}
if (geo_position_js.init()) {
geo_position_js.getCurrentPosition(__bind(function(data) {
var location;
location = new google.maps.LatLng(data.coords.latitude, data.coords.longitude);
this.pickup_icon.setPosition(location);
this.map.panTo(location);
return this.map.setZoom(16);
}, this));
}
this.setStatus("init");
streetViewPano = this.map.getStreetView();
google.maps.event.addListener(streetViewPano, 'visible_changed', __bind(function() {
if (streetViewPano.getVisible()) {
this.pickupMarker = "https://uber-static.s3.amazonaws.com/pickup_marker_large.png";
this.cabMarker = "https://uber-static.s3.amazonaws.com/cab_marker_large.png";
} else {
this.pickupMarker = "https://uber-static.s3.amazonaws.com/pickup_marker.png";
this.cabMarker = "https://uber-static.s3.amazonaws.com/cab_marker.png";
}
this.pickup_icon.setIcon(this.pickupMarker);
return _.each(this.cabs, __bind(function(cab) {
return cab.setIcon(this.cabMarker);
}, this));
}, this));
if (this.status === "ready") {
return this.displayFavLoc();
}
}, this));
return this;
};
ClientsRequestView.prototype.submitRating = function(e) {
var $el, message, rating;
e.preventDefault();
$el = $(e.currentTarget);
rating = 0;
_(5).times(function(num) {
if ($el.find(".stars#" + (num + 1)).attr("src") === "/web/img/star_active.png") {
return rating = num + 1;
}
});
if (rating === 0) {
$("#status_message").html("").html(t("Rate Before Submitting"));
} else {
this.ShowSpinner("submit");
this.AskDispatch("RatingDriver", {
rating: rating
});
}
message = $el.find("#comments").val().toString();
if (message.length > 5) {
return this.AskDispatch("Feedback", {
message: message
});
}
};
ClientsRequestView.prototype.fetchTripDetails = function(id) {
var trip;
trip = new app.models.trip({
id: id
});
return trip.fetch({
data: {
relationships: 'points,driver,city'
},
dataType: 'json',
success: __bind(function() {
var bounds, endPos, path, polyline, startPos;
bounds = new google.maps.LatLngBounds();
path = [];
_.each(trip.get('points'), __bind(function(point) {
path.push(new google.maps.LatLng(point.lat, point.lng));
return bounds.extend(_.last(path));
}, this));
startPos = new google.maps.Marker({
position: _.first(path),
map: this.map,
title: t("Trip started here"),
icon: 'https://uber-static.s3.amazonaws.com/carstart.png'
});
endPos = new google.maps.Marker({
position: _.last(path),
map: this.map,
title: t("Trip ended here"),
icon: 'https://uber-static.s3.amazonaws.com/carstop.png'
});
polyline = new google.maps.Polyline({
path: path,
strokeColor: '#003F87',
strokeOpacity: 1,
strokeWeight: 5
});
polyline.setMap(this.map);
this.map.fitBounds(bounds);
$("#tripTime").html(app.helpers.parseDateTime(trip.get('pickup_local_time'), trip.get('city.timezone')));
$("#tripDist").html(app.helpers.RoundNumber(trip.get('distance'), 2));
$("#tripDur").html(app.helpers.FormatSeconds(trip.get('duration')));
return $("#tripFare").html(app.helpers.FormatCurrency(trip.get('fare')));
}, this)
});
};
ClientsRequestView.prototype.searchAddress = function(e) {
var $locationsDiv, address, alphabet, bounds, showResults;
alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
try {
e.preventDefault();
} catch (_e) {}
$('.error_message').html("");
$locationsDiv = $("<table></table>");
address = $('#address').val();
bounds = new google.maps.LatLngBounds();
if (address.length < 5) {
$('#status_message').html(t("Address too short")).fadeIn();
return false;
}
showResults = __bind(function(address, index) {
var first_cell, row, second_cell;
if (index < this.numSearchToDisplay) {
first_cell = "<td class='marker_logo'><img src='https://www.google.com/mapfiles/marker" + alphabet[index] + ".png' /></td>";
second_cell = "<td class='location_nickname_wrapper'>" + address.formatted_address + "</td>";
row = $("<tr></tr>").attr("id", "s" + index).attr("class", "location_row").html(first_cell + second_cell);
$locationsDiv.append(row);
}
if (index === this.numSearchToDisplay) {
$locationsDiv.append("<tr><td colspan=2>" + (t('or did you mean')) + " </td></tr>");
return $locationsDiv.append("<tr><td colspan=2><a id='search_location' href=''>" + address.formatted_address + "</a></td></tr>");
}
}, this);
return this.geocoder.geocode({
address: address
}, __bind(function(result, status) {
if (status !== "OK") {
$('.error_message').html(t("Search Address Failed")).fadeIn();
return;
}
_.each(result, showResults);
$("#search_results").html($locationsDiv);
this.locationChange("search");
this.searchResults = result;
return this.displaySearchLoc();
}, this));
};
ClientsRequestView.prototype.mouseoverLocation = function(e) {
var $el, id, marker;
$el = $(e.currentTarget);
id = $el.attr("id").substring(1);
marker = this.markers[id];
return marker.setAnimation(google.maps.Animation.BOUNCE);
};
ClientsRequestView.prototype.mouseoutLocation = function(e) {
var $el, id, marker;
$el = $(e.currentTarget);
id = $el.attr("id").substring(1);
marker = this.markers[id];
return marker.setAnimation(null);
};
ClientsRequestView.prototype.searchLocation = function(e) {
e.preventDefault();
$("#address").val($(e.currentTarget).html());
return this.searchAddress();
};
ClientsRequestView.prototype.favoriteClick = function(e) {
var index, location;
e.preventDefault();
$(".favorites").attr("href", "");
index = $(e.currentTarget).removeAttr("href").attr("id");
location = new google.maps.LatLng(USER.locations[index].latitude, USER.locations[index].longitude);
return this.panToLocation(location);
};
ClientsRequestView.prototype.clickLocation = function(e) {
var id;
id = $(e.currentTarget).attr("id").substring(1);
return this.panToLocation(this.markers[id].getPosition());
};
ClientsRequestView.prototype.panToLocation = function(location) {
this.map.panTo(location);
this.map.setZoom(16);
return this.pickup_icon.setPosition(location);
};
ClientsRequestView.prototype.locationLinkHandle = function(e) {
var panelName;
e.preventDefault();
panelName = $(e.currentTarget).attr("id");
return this.locationChange(panelName);
};
ClientsRequestView.prototype.locationChange = function(type) {
$(".locations_link").attr("href", "").css("font-weight", "normal");
switch (type) {
case "favorite":
$(".search_results").attr("href", "");
$(".locations_link#favorite").removeAttr("href").css("font-weight", "bold");
$("#search_results").hide();
$("#favorite_results").fadeIn();
return this.displayFavLoc();
case "search":
$(".favorites").attr("href", "");
$(".locations_link#search").removeAttr("href").css("font-weight", "bold");
$("#favorite_results").hide();
$("#search_results").fadeIn();
return this.displaySearchLoc();
}
};
ClientsRequestView.prototype.rateTrip = function(e) {
var rating;
rating = $(e.currentTarget).attr("id");
$(".stars").attr("src", "/web/img/star_inactive.png");
return _(rating).times(function(index) {
return $(".stars#" + (index + 1)).attr("src", "/web/img/star_active.png");
});
};
ClientsRequestView.prototype.pickupHandle = function(e) {
var $el, callback, message;
e.preventDefault();
$el = $(e.currentTarget).find("span");
switch ($el.html()) {
case t("Request Pickup"):
_.delay(this.requestRide, 3000);
$("#status_message").html(t("Sending pickup request..."));
$el.html(t("Cancel Pickup")).parent().attr("class", "button_red");
this.pickup_icon.setDraggable(false);
this.map.panTo(this.pickup_icon.getPosition());
return this.map.setZoom(18);
case t("Cancel Pickup"):
if (this.status === "ready") {
$el.html(t("Request Pickup")).parent().attr("class", "button_green");
return this.pickup_icon.setDraggable(true);
} else {
callback = __bind(function(v, m, f) {
if (v) {
this.AskDispatch("PickupCanceledClient");
return this.setStatus("ready");
}
}, this);
message = t("Cancel Request Prompt");
if (this.status === "arriving") {
message = 'Cancel Request Arrived Prompt';
}
return $.prompt(message, {
buttons: {
Ok: true,
Cancel: false
},
callback: callback
});
}
}
};
ClientsRequestView.prototype.requestRide = function() {
if ($("#pickupHandle").find("span").html() === t("Cancel Pickup")) {
this.AskDispatch("Pickup");
return this.setStatus("searching");
}
};
ClientsRequestView.prototype.removeCabs = function() {
_.each(this.cabs, __bind(function(point) {
return point.setMap(null);
}, this));
return this.cabs = [];
};
ClientsRequestView.prototype.addToFavLoc = function(e) {
var $el, lat, lng, nickname;
e.preventDefault();
$el = $(e.currentTarget);
$el.find(".error_message").html("");
nickname = $el.find("#favLocNickname").val().toString();
lat = $el.find("#pickupLat").val().toString();
lng = $el.find("#pickupLng").val().toString();
if (nickname.length < 3) {
$el.find(".error_message").html(t("Favorite Location Nickname Length Error"));
return;
}
this.ShowSpinner("submit");
return $.ajax({
type: 'POST',
url: API + "/locations",
dataType: 'json',
data: {
token: USER.token,
nickname: nickname,
latitude: lat,
longitude: lng
},
success: __bind(function(data, textStatus, jqXHR) {
return $el.html(t("Favorite Location Save Succeeded"));
}, this),
error: __bind(function(jqXHR, textStatus, errorThrown) {
return $el.find(".error_message").html(t("Favorite Location Save Failed"));
}, this),
complete: __bind(function(data) {
return this.HideSpinner();
}, this)
});
};
ClientsRequestView.prototype.showFavLoc = function(e) {
$(e.currentTarget).fadeOut();
return $("#favLoc_form").fadeIn();
};
ClientsRequestView.prototype.selectInputText = function(e) {
e.currentTarget.focus();
return e.currentTarget.select();
};
ClientsRequestView.prototype.displayFavLoc = function() {
var alphabet, bounds;
alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
this.removeMarkers();
bounds = new google.maps.LatLngBounds();
_.each(USER.locations, __bind(function(location, index) {
var marker;
marker = new google.maps.Marker({
position: new google.maps.LatLng(location.latitude, location.longitude),
map: this.map,
title: t("Favorite Location Title", {
id: alphabet != null ? alphabet[index] : void 0
}),
icon: "https://www.google.com/mapfiles/marker" + alphabet[index] + ".png"
});
this.markers.push(marker);
bounds.extend(marker.getPosition());
return google.maps.event.addListener(marker, 'click', __bind(function() {
return this.pickup_icon.setPosition(marker.getPosition());
}, this));
}, this));
this.pickup_icon.setPosition(_.first(this.markers).getPosition());
return this.map.fitBounds(bounds);
};
ClientsRequestView.prototype.displaySearchLoc = function() {
var alphabet;
alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
this.removeMarkers();
return _.each(this.searchResults, __bind(function(result, index) {
var marker;
if (index < this.numSearchToDisplay) {
marker = new google.maps.Marker({
position: result.geometry.location,
map: this.map,
title: t("Search Location Title", {
id: alphabet != null ? alphabet[index] : void 0
}),
icon: "https://www.google.com/mapfiles/marker" + alphabet[index] + ".png"
});
this.markers.push(marker);
return this.panToLocation(result.geometry.location);
}
}, this));
};
ClientsRequestView.prototype.removeMarkers = function() {
_.each(this.markers, __bind(function(marker) {
return marker.setMap(null);
}, this));
return this.markers = [];
};
ClientsRequestView.prototype.AskDispatch = function(ask, options) {
var attrs, lowestETA, processData, showCab;
if (ask == null) {
ask = "";
}
if (options == null) {
options = {};
}
switch (ask) {
case "NearestCab":
attrs = {
latitude: this.pickup_icon.getPosition().lat(),
longitude: this.pickup_icon.getPosition().lng()
};
lowestETA = 99999;
showCab = __bind(function(cab) {
var point;
point = new google.maps.Marker({
position: new google.maps.LatLng(cab.latitude, cab.longitude),
map: this.map,
icon: this.cabMarker,
title: t("ETA Message", {
minutes: app.helpers.FormatSeconds(cab != null ? cab.eta : void 0, true)
})
});
if (cab.eta < lowestETA) {
lowestETA = cab.eta;
}
return this.cabs.push(point);
}, this);
processData = __bind(function(data, textStatus, jqXHR) {
if (this.status === "ready") {
this.removeCabs();
if (data.sorry) {
$("#status_message").html(data.sorry).fadeIn();
} else {
_.each(data.driverLocations, showCab);
$("#status_message").html(t("Nearest Cab Message", {
minutes: app.helpers.FormatSeconds(lowestETA, true)
})).fadeIn();
}
if (Backbone.history.fragment === "!/request") {
return _.delay(this.showCabs, this.pollInterval);
}
}
}, this);
return this.AjaxCall(ask, processData, attrs);
case "StatusClient":
processData = __bind(function(data, textStatus, jqXHR) {
var bounds, cabLocation, locationSaved, point, userLocation;
if (data.messageType === "OK") {
switch (data.status) {
case "completed":
this.removeCabs();
this.setStatus("rate");
return this.fetchTripDetails(data.tripID);
case "open":
return this.setStatus("ready");
case "begintrip":
this.setStatus("riding");
cabLocation = new google.maps.LatLng(data.latitude, data.longitude);
this.removeCabs();
this.pickup_icon.setMap(null);
point = new google.maps.Marker({
position: cabLocation,
map: this.map,
icon: this.cabMarker
});
this.cabs.push(point);
this.map.panTo(point.getPosition());
$("#rideName").html(data.driverName);
$("#ridePhone").html(data.driverMobile);
$("#ride_address_wrapper").hide();
if (Backbone.history.fragment === "!/request") {
return _.delay(this.AskDispatch, this.pollInterval, "StatusClient");
}
break;
case "pending":
this.setStatus("searching");
if (Backbone.history.fragment === "!/request") {
return _.delay(this.AskDispatch, this.pollInterval, "StatusClient");
}
break;
case "accepted":
case "arrived":
if (data.status === "accepted") {
this.setStatus("waiting");
$("#status_message").html(t("Arrival ETA Message", {
minutes: app.helpers.FormatSeconds(data.eta, true)
}));
} else {
this.setStatus("arriving");
$("#status_message").html(t("Arriving Now Message"));
}
userLocation = new google.maps.LatLng(data.pickupLocation.latitude, data.pickupLocation.longitude);
cabLocation = new google.maps.LatLng(data.latitude, data.longitude);
this.pickup_icon.setPosition(userLocation);
this.removeCabs();
$("#rideName").html(data.driverName);
$("#ridePhone").html(data.driverMobile);
if ($("#rideAddress").html() === "") {
locationSaved = false;
_.each(USER.locations, __bind(function(location) {
if (parseFloat(location.latitude) === parseFloat(data.pickupLocation.latitude) && parseFloat(location.longitude) === parseFloat(data.pickupLocation.longitude)) {
return locationSaved = true;
}
}, this));
if (locationSaved) {
$("#addToFavButton").hide();
}
$("#pickupLat").val(data.pickupLocation.latitude);
$("#pickupLng").val(data.pickupLocation.longitude);
this.geocoder.geocode({
location: userLocation
}, __bind(function(result, status) {
$("#rideAddress").html(result[0].formatted_address);
return $("#favLocNickname").val("" + result[0].address_components[0].short_name + " " + result[0].address_components[1].short_name);
}, this));
}
point = new google.maps.Marker({
position: cabLocation,
map: this.map,
icon: this.cabMarker
});
this.cabs.push(point);
bounds = bounds = new google.maps.LatLngBounds();
bounds.extend(cabLocation);
bounds.extend(userLocation);
this.map.fitBounds(bounds);
if (Backbone.history.fragment === "!/request") {
return _.delay(this.AskDispatch, this.pollInterval, "StatusClient");
}
}
}
}, this);
return this.AjaxCall(ask, processData);
case "Pickup":
attrs = {
latitude: this.pickup_icon.getPosition().lat(),
longitude: this.pickup_icon.getPosition().lng()
};
processData = __bind(function(data, textStatus, jqXHR) {
if (data.messageType === "Error") {
return $("#status_message").html(data.description);
} else {
return this.AskDispatch("StatusClient");
}
}, this);
return this.AjaxCall(ask, processData, attrs);
case "PickupCanceledClient":
processData = __bind(function(data, textStatus, jqXHR) {
if (data.messageType === "OK") {
return this.setStatus("ready");
} else {
return $("#status_message").html(data.description);
}
}, this);
return this.AjaxCall(ask, processData, attrs);
case "RatingDriver":
attrs = {
rating: options.rating
};
processData = __bind(function(data, textStatus, jqXHR) {
if (data.messageType === "OK") {
this.setStatus("init");
} else {
$("status_message").html(t("Rating Driver Failed"));
}
return this.HideSpinner();
}, this);
return this.AjaxCall(ask, processData, attrs);
case "Feedback":
attrs = {
message: options.message
};
processData = __bind(function(data, textStatus, jqXHR) {
if (data.messageType === "OK") {
return alert("rated");
}
}, this);
return this.AjaxCall(ask, processData, attrs);
}
};
ClientsRequestView.prototype.AjaxCall = function(type, successCallback, attrs) {
if (attrs == null) {
attrs = {};
}
_.extend(attrs, {
token: USER.token,
messageType: type,
app: "client",
version: "1.0.60",
device: "web"
});
return $.ajax({
type: 'POST',
url: DISPATCH + "/",
processData: false,
data: JSON.stringify(attrs),
success: successCallback,
dataType: 'json',
error: __bind(function(jqXHR, textStatus, errorThrown) {
$("#status_message").html(errorThrown);
return this.HideSpinner();
}, this)
});
};
return ClientsRequestView;
})();
}).call(this);
}, "views/clients/settings": function(exports, require, module) {(function() {
var clientsSettingsTemplate;
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
};
clientsSettingsTemplate = require('templates/clients/settings');
exports.ClientsSettingsView = (function() {
__extends(ClientsSettingsView, UberView);
function ClientsSettingsView() {
this.render = __bind(this.render, this);
this.initialize = __bind(this.initialize, this);
ClientsSettingsView.__super__.constructor.apply(this, arguments);
}
ClientsSettingsView.prototype.id = 'settings_view';
ClientsSettingsView.prototype.className = 'view_container';
ClientsSettingsView.prototype.events = {
'submit #profile_pic_form': 'processPicUpload',
'click #submit_pic': 'processPicUpload',
'click a.setting_change': "changeTab",
'submit #edit_info_form': "submitInfo",
'click #change_password': 'changePass'
};
ClientsSettingsView.prototype.divs = {
'info_div': "Information",
'pic_div': "Picture"
};
ClientsSettingsView.prototype.pageTitle = t("Settings") + " | " + t("Uber");
ClientsSettingsView.prototype.tabTitle = {
'info_div': t("Information"),
'pic_div': t("Picture")
};
ClientsSettingsView.prototype.initialize = function() {
return this.mixin(require('web-lib/mixins/i18n_phone_form').i18nPhoneForm);
};
ClientsSettingsView.prototype.render = function(type) {
if (type == null) {
type = "info";
}
this.RefreshUserInfo(__bind(function() {
var $el, alphabet;
this.delegateEvents();
this.HideSpinner();
alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
$el = $(this.el);
$(this.el).html(clientsSettingsTemplate({
type: type
}));
$el.find("#" + type + "_div").show();
$el.find("a[href='" + type + "_div']").parent().addClass("active");
return document.title = "" + this.tabTitle[type + '_div'] + " " + this.pageTitle;
}, this));
this.delegateEvents();
return this;
};
ClientsSettingsView.prototype.changeTab = function(e) {
var $eTarget, $el, div, link, pageDiv, _i, _j, _len, _len2, _ref, _ref2;
e.preventDefault();
$eTarget = $(e.currentTarget);
this.ClearGlobalStatus();
$el = $(this.el);
_ref = $el.find(".setting_change");
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
link = _ref[_i];
$(link).parent().removeClass("active");
}
$eTarget.parent().addClass("active");
_ref2 = _.keys(this.divs);
for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) {
div = _ref2[_j];
$el.find("#" + div).hide();
}
pageDiv = $eTarget.attr('href');
$el.find("#" + pageDiv).show();
Backbone.history.navigate("!/settings/" + (this.divs[pageDiv].toLowerCase().replace(" ", "-")), false);
document.title = "" + this.tabTitle[pageDiv] + " " + this.pageTitle;
if (pageDiv === "loc_div") {
try {
google.maps.event.trigger(this.map, 'resize');
return this.map.fitBounds(this.bounds);
} catch (_e) {}
}
};
ClientsSettingsView.prototype.submitInfo = function(e) {
var $e, attrs, client, options;
$('#global_status').find('.success_message').text('');
$('#global_status').find('.error_message').text('');
$('.error_message').text('');
e.preventDefault();
$e = $(e.currentTarget);
attrs = $e.serializeToJson();
attrs['mobile_country_id'] = this.$('#mobile_country_id').val();
if (attrs['password'] === '') {
delete attrs['password'];
}
options = {
success: __bind(function(response) {
this.ShowSuccess(t("Information Update Succeeded"));
return this.RefreshUserInfo();
}, this),
error: __bind(function(model, data) {
var errors;
if (data.status === 406) {
errors = JSON.parse(data.responseText);
return _.each(_.keys(errors), function(field) {
return $("#" + field).parent().find('span.error_message').text(errors[field]);
});
} else {
return this.ShowError(t("Information Update Failed"));
}
}, this),
type: "PUT"
};
client = new app.models.client({
id: USER.id
});
return client.save(attrs, options);
};
ClientsSettingsView.prototype.changePass = function(e) {
e.preventDefault();
$(e.currentTarget).hide();
return $("#password").show();
};
ClientsSettingsView.prototype.processPicUpload = function(e) {
e.preventDefault();
this.ShowSpinner("submit");
return $.ajaxFileUpload({
url: API + '/user_pictures',
secureuri: false,
fileElementId: 'picture',
data: {
token: USER.token
},
dataType: 'json',
complete: __bind(function(data, status) {
this.HideSpinner();
if (status === 'success') {
this.ShowSuccess(t("Picture Update Succeeded"));
return this.RefreshUserInfo(__bind(function() {
return $("#settingsProfPic").attr("src", USER.picture_url + ("?" + (Math.floor(Math.random() * 1000))));
}, this));
} else {
if (data.error) {
return this.ShowError(data.error);
} else {
return this.ShowError("Picture Update Failed");
}
}
}, this)
});
};
return ClientsSettingsView;
})();
}).call(this);
}, "views/clients/sign_up": function(exports, require, module) {(function() {
var clientsSignUpTemplate;
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
}, __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
clientsSignUpTemplate = require('templates/clients/sign_up');
exports.ClientsSignUpView = (function() {
__extends(ClientsSignUpView, UberView);
function ClientsSignUpView() {
ClientsSignUpView.__super__.constructor.apply(this, arguments);
}
ClientsSignUpView.prototype.id = 'signup_view';
ClientsSignUpView.prototype.className = 'view_container';
ClientsSignUpView.prototype.initialize = function() {
this.mixin(require('web-lib/mixins/i18n_phone_form').i18nPhoneForm);
return $('#location_country').live('change', function() {
if (!$('#mobile').val()) {
return $('#mobile_country').find("option[value=" + ($(this).val()) + "]").attr('selected', 'selected').end().trigger('change');
}
});
};
ClientsSignUpView.prototype.events = {
'submit form': 'signup',
'click button': 'signup',
'change #card_number': 'showCardType',
'change #location_country': 'countryChange'
};
ClientsSignUpView.prototype.render = function(invite) {
this.HideSpinner();
$(this.el).html(clientsSignUpTemplate({
invite: invite
}));
return this;
};
ClientsSignUpView.prototype.signup = function(e) {
var $el, attrs, client, error_messages, options;
e.preventDefault();
$el = $("form");
$el.find('#terms_error').hide();
if (!$el.find('#signup_terms input[type=checkbox]').attr('checked')) {
$('#spinner.submit').hide();
$el.find('#terms_error').show();
return;
}
error_messages = $el.find('.error_message').html("");
attrs = {
first_name: $el.find('#first_name').val(),
last_name: $el.find('#last_name').val(),
email: $el.find('#email').val(),
password: $el.find('#password').val(),
location_country: $el.find('#location_country option:selected').attr('data-iso2'),
location: $el.find('#location').val(),
language: $el.find('#language').val(),
mobile_country: $el.find('#mobile_country option:selected').attr('data-iso2'),
mobile: $el.find('#mobile').val(),
card_number: $el.find('#card_number').val(),
card_expiration_month: $el.find('#card_expiration_month').val(),
card_expiration_year: $el.find('#card_expiration_year').val(),
card_code: $el.find('#card_code').val(),
use_case: $el.find('#use_case').val(),
promotion_code: $el.find('#promotion_code').val()
};
options = {
statusCode: {
200: function(response) {
$.cookie('token', response.token);
amplify.store('USERjson', response);
app.refreshMenu();
return app.routers.clients.navigate('!/dashboard', true);
},
406: function(e) {
var error, errors, _i, _len, _ref, _results;
errors = JSON.parse(e.responseText);
_ref = _.keys(errors);
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
error = _ref[_i];
_results.push($('#' + error).parent().find('span').html($('#' + error).parent().find('span').html() + " " + errors[error]));
}
return _results;
}
},
complete: __bind(function(response) {
return this.HideSpinner();
}, this)
};
client = new app.models.client;
$('.spinner#submit').show();
return client.save(attrs, options);
};
ClientsSignUpView.prototype.countryChange = function(e) {
var $e;
$e = $(e.currentTarget);
return $("#mobile_country").val($e.val()).trigger('change');
};
ClientsSignUpView.prototype.showCardType = function(e) {
var $el, reAmerica, reDiscover, reMaster, reVisa, validCard;
reVisa = /^4\d{3}-?\d{4}-?\d{4}-?\d{4}$/;
reMaster = /^5[1-5]\d{2}-?\d{4}-?\d{4}-?\d{4}$/;
reAmerica = /^6011-?\d{4}-?\d{4}-?\d{4}$/;
reDiscover = /^3[4,7]\d{13}$/;
$el = $("#card_logos_signup");
validCard = false;
if (e.currentTarget.value.match(reVisa)) {
$el.find("#overlay_left").css('width', "0px");
return $el.find("#overlay_right").css('width', "75%");
} else if (e.currentTarget.value.match(reMaster)) {
$el.find("#overlay_left").css('width', "25%");
return $el.find("#overlay_right").css('width', "50%");
} else if (e.currentTarget.value.match(reAmerica)) {
$el.find("#overlay_left").css('width', "75%");
$el.find("#overlay_right").css('width', "0px");
return console.log("amex");
} else if (e.currentTarget.value.match(reDiscover)) {
$el.find("#overlay_left").css('width', "50%");
return $el.find("#overlay_right").css('width', "25%");
} else {
$el.find("#overlay_left").css('width', "0px");
return $el.find("#overlay_right").css('width', "0px");
}
};
return ClientsSignUpView;
})();
}).call(this);
}, "views/clients/trip_detail": function(exports, require, module) {(function() {
var clientsTripDetailTemplate;
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
};
clientsTripDetailTemplate = require('templates/clients/trip_detail');
exports.TripDetailView = (function() {
__extends(TripDetailView, UberView);
function TripDetailView() {
this.resendReceipt = __bind(this.resendReceipt, this);
TripDetailView.__super__.constructor.apply(this, arguments);
}
TripDetailView.prototype.id = 'trip_detail_view';
TripDetailView.prototype.className = 'view_container';
TripDetailView.prototype.events = {
'click a#fare_review': 'showFareReview',
'click #fare_review_hide': 'hideFareReview',
'submit #form_review_form': 'submitFareReview',
'click #submit_fare_review': 'submitFareReview',
'click .resendReceipt': 'resendReceipt'
};
TripDetailView.prototype.render = function(id) {
if (id == null) {
id = 'invalid';
}
this.ReadUserInfo();
this.HideSpinner();
this.model = new app.models.trip({
id: id
});
this.model.fetch({
data: {
relationships: 'points,driver,city.country'
},
dataType: 'json',
success: __bind(function() {
var trip;
trip = this.model;
$(this.el).html(clientsTripDetailTemplate({
trip: trip
}));
this.RequireMaps(__bind(function() {
var bounds, endPos, map, myOptions, path, polyline, startPos;
bounds = new google.maps.LatLngBounds();
path = [];
_.each(this.model.get('points'), __bind(function(point) {
path.push(new google.maps.LatLng(point.lat, point.lng));
return bounds.extend(_.last(path));
}, this));
myOptions = {
zoom: 12,
center: path[0],
mapTypeId: google.maps.MapTypeId.ROADMAP,
zoomControl: false,
rotateControl: false,
panControl: false,
mapTypeControl: false,
scrollwheel: false
};
map = new google.maps.Map(document.getElementById("trip_details_map"), myOptions);
map.fitBounds(bounds);
startPos = new google.maps.Marker({
position: _.first(path),
map: map,
title: t("Trip started here"),
icon: 'https://uber-static.s3.amazonaws.com/marker_start.png'
});
endPos = new google.maps.Marker({
position: _.last(path),
map: map,
title: t("Trip ended here"),
icon: 'https://uber-static.s3.amazonaws.com/marker_end.png'
});
startPos.setMap(map);
endPos.setMap(map);
polyline = new google.maps.Polyline({
path: path,
strokeColor: '#003F87',
strokeOpacity: 1,
strokeWeight: 5
});
return polyline.setMap(map);
}, this));
return this.HideSpinner();
}, this)
});
this.ShowSpinner('load');
this.delegateEvents();
return this;
};
TripDetailView.prototype.showFareReview = function(e) {
e.preventDefault();
$('#fare_review_box').slideDown();
return $('#fare_review').hide();
};
TripDetailView.prototype.hideFareReview = function(e) {
e.preventDefault();
$('#fare_review_box').slideUp();
return $('#fare_review').show();
};
TripDetailView.prototype.submitFareReview = function(e) {
var attrs, errorMessage, id, options;
e.preventDefault();
errorMessage = $(".error_message");
errorMessage.hide();
id = $("#tripid").val();
this.model = new app.models.trip({
id: id
});
attrs = {
note: $('#form_review_message').val(),
note_type: 'client_fare_review'
};
options = {
success: __bind(function(response) {
$(".success_message").fadeIn();
return $("#fare_review_form_wrapper").slideUp();
}, this),
error: __bind(function(error) {
return errorMessage.fadeIn();
}, this)
};
return this.model.save(attrs, options);
};
TripDetailView.prototype.resendReceipt = function(e) {
var $e;
e.preventDefault();
$e = $(e.currentTarget);
this.$(".resendReceiptSuccess").empty().show();
this.$(".resentReceiptError").empty().show();
e.preventDefault();
$('#spinner').show();
return $.ajax('/api/trips/func/resend_receipt', {
data: {
token: $.cookie('token'),
trip_id: this.model.id
},
type: 'POST',
complete: __bind(function(xhr) {
var response;
response = JSON.parse(xhr.responseText);
$('#spinner').hide();
switch (xhr.status) {
case 200:
this.$(".resendReceiptSuccess").html("Receipt has been emailed");
return this.$(".resendReceiptSuccess").fadeOut(2000);
default:
this.$(".resendReceiptError").html("Receipt has failed to be emailed");
return this.$(".resendReceiptError").fadeOut(2000);
}
}, this)
});
};
return TripDetailView;
})();
}).call(this);
}, "views/shared/menu": function(exports, require, module) {(function() {
var menuTemplate;
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
};
menuTemplate = require('templates/shared/menu');
exports.SharedMenuView = (function() {
__extends(SharedMenuView, Backbone.View);
function SharedMenuView() {
SharedMenuView.__super__.constructor.apply(this, arguments);
}
SharedMenuView.prototype.id = 'menu_view';
SharedMenuView.prototype.render = function() {
var type;
if ($.cookie('token') === null) {
type = 'guest';
} else {
type = 'client';
}
$(this.el).html(menuTemplate({
type: type
}));
return this;
};
return SharedMenuView;
})();
}).call(this);
}, "web-lib/collections/countries": function(exports, require, module) {(function() {
var UberCollection;
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
};
UberCollection = require('web-lib/uber_collection').UberCollection;
exports.CountriesCollection = (function() {
__extends(CountriesCollection, UberCollection);
function CountriesCollection() {
CountriesCollection.__super__.constructor.apply(this, arguments);
}
CountriesCollection.prototype.model = app.models.country;
CountriesCollection.prototype.url = '/countries';
return CountriesCollection;
})();
}).call(this);
}, "web-lib/collections/vehicle_types": function(exports, require, module) {(function() {
var UberCollection, vehicleType, _ref;
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
};
UberCollection = require('web-lib/uber_collection').UberCollection;
vehicleType = (typeof app !== "undefined" && app !== null ? (_ref = app.models) != null ? _ref.vehicleType : void 0 : void 0) || require('models/vehicle_type').VehicleType;
exports.VehicleTypesCollection = (function() {
__extends(VehicleTypesCollection, UberCollection);
function VehicleTypesCollection() {
VehicleTypesCollection.__super__.constructor.apply(this, arguments);
}
VehicleTypesCollection.prototype.model = vehicleType;
VehicleTypesCollection.prototype.url = '/vehicle_types';
VehicleTypesCollection.prototype.defaultColumns = ['id', 'created_at', 'updated_at', 'deleted_at', 'created_by_user_id', 'updated_by_user_id', 'city_id', 'type', 'make', 'model', 'capacity', 'minimum_year', 'actions'];
VehicleTypesCollection.prototype.tableColumns = function(cols) {
var actions, c, capacity, city_id, columnValues, created_at, created_by_user_id, deleted_at, headerRow, id, make, minimum_year, model, type, updated_at, updated_by_user_id, _i, _len;
id = {
sTitle: 'Id'
};
created_at = {
sTitle: 'Created At (UTC)',
'sType': 'string'
};
updated_at = {
sTitle: 'Updated At (UTC)',
'sType': 'string'
};
deleted_at = {
sTitle: 'Deleted At (UTC)',
'sType': 'string'
};
created_by_user_id = {
sTitle: 'Created By'
};
updated_by_user_id = {
sTitle: 'Updated By'
};
city_id = {
sTitle: 'City'
};
type = {
sTitle: 'Type'
};
make = {
sTitle: 'Make'
};
model = {
sTitle: 'Model'
};
capacity = {
sTitle: 'Capacity'
};
minimum_year = {
sTitle: 'Min. Year'
};
actions = {
sTitle: 'Actions'
};
columnValues = {
id: id,
created_at: created_at,
updated_at: updated_at,
deleted_at: deleted_at,
created_by_user_id: created_by_user_id,
updated_by_user_id: updated_by_user_id,
city_id: city_id,
type: type,
make: make,
model: model,
capacity: capacity,
minimum_year: minimum_year,
actions: actions
};
headerRow = [];
for (_i = 0, _len = cols.length; _i < _len; _i++) {
c = cols[_i];
if (columnValues[c]) {
headerRow.push(columnValues[c]);
}
}
return headerRow;
};
return VehicleTypesCollection;
})();
}).call(this);
}, "web-lib/helpers": function(exports, require, module) {(function() {
var __indexOf = Array.prototype.indexOf || function(item) {
for (var i = 0, l = this.length; i < l; i++) {
if (this[i] === item) return i;
}
return -1;
}, __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
exports.helpers = {
pin: function(num, color) {
if (color == null) {
color = 'FF0000';
}
return "<img src=\"http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=" + num + "|" + color + "|000000\" width=\"14\" height=\"22\" />";
},
reverseGeocode: function(latitude, longitude) {
if (latitude && longitude) {
return "<span data-point=" + (JSON.stringify({
latitude: latitude,
longitude: longitude
})) + ">" + latitude + ", " + longitude + "</span>";
} else {
return '';
}
},
linkedName: function(model) {
var first_name, id, last_name, role, url;
role = model.role || model.get('role');
id = model.id || model.get('id');
first_name = model.first_name || model.get('first_name');
last_name = model.last_name || model.get('last_name');
url = "/" + role + "s/" + id;
return "<a href=\"#" + url + "\">" + first_name + " " + last_name + "</a>";
},
linkedVehicle: function(vehicle, vehicleType) {
return "<a href=\"/#/vehicles/" + vehicle.id + "\"> " + (vehicleType != null ? vehicleType.get('make') : void 0) + " " + (vehicleType != null ? vehicleType.get('model') : void 0) + " " + (vehicle.get('year')) + " </a>";
},
linkedUserId: function(userType, userId) {
return "<a href=\"#!/" + userType + "/" + userId + "\" data-user-type=\"" + userType + "\" data-user-id=\"" + userId + "\">" + userType + " " + userId + "</a>";
},
timeDelta: function(start, end) {
var delta;
if (typeof start === 'string') {
start = this.parseDate(start);
}
if (typeof end === 'string') {
end = this.parseDate(end);
}
if (end && start) {
delta = end.getTime() - start.getTime();
return this.formatSeconds(delta / 1000);
} else {
return '00:00';
}
},
formatSeconds: function(s) {
var minutes, seconds;
s = Math.floor(s);
minutes = Math.floor(s / 60);
seconds = s - minutes * 60;
return "" + (this.leadingZero(minutes)) + ":" + (this.leadingZero(seconds));
},
formatCurrency: function(strValue, reverseSign, currency) {
var currency_locale, lc, mf;
if (reverseSign == null) {
reverseSign = false;
}
if (currency == null) {
currency = null;
}
strValue = String(strValue);
if (reverseSign) {
strValue = ~strValue.indexOf('-') ? strValue.split('-').join('') : ['-', strValue].join('');
}
currency_locale = i18n.currencyToLocale[currency];
try {
if (!(currency_locale != null) || currency_locale === i18n.locale) {
return i18n.jsworld.mf.format(strValue);
} else {
lc = new jsworld.Locale(POSIX_LC[currency_locale]);
mf = new jsworld.MonetaryFormatter(lc);
return mf.format(strValue);
}
} catch (error) {
i18n.log(error);
return strValue;
}
},
formatTripFare: function(trip, type) {
var _ref, _ref2;
if (type == null) {
type = "fare";
}
if (!trip.get('fare')) {
return 'n/a';
}
if (((_ref = trip.get('fare_breakdown_local')) != null ? _ref.currency : void 0) != null) {
return app.helpers.formatCurrency(trip.get("" + type + "_local"), false, (_ref2 = trip.get('fare_breakdown_local')) != null ? _ref2.currency : void 0);
} else if (trip.get("" + type + "_string") != null) {
return trip.get("" + type + "_string");
} else if (trip.get("" + type + "_local") != null) {
return trip.get("" + type + "_local");
} else {
return 'n/a';
}
},
formatPhoneNumber: function(phoneNumber, countryCode) {
if (countryCode == null) {
countryCode = "+1";
}
if (phoneNumber != null) {
phoneNumber = String(phoneNumber);
switch (countryCode) {
case '+1':
return countryCode + ' ' + phoneNumber.substring(0, 3) + '-' + phoneNumber.substring(3, 6) + '-' + phoneNumber.substring(6, 10);
case '+33':
return countryCode + ' ' + phoneNumber.substring(0, 1) + ' ' + phoneNumber.substring(1, 3) + ' ' + phoneNumber.substring(3, 5) + ' ' + phoneNumber.substring(5, 7) + ' ' + phoneNumber.substring(7, 9);
default:
countryCode + phoneNumber;
}
}
return "" + countryCode + " " + phoneNumber;
},
parseDate: function(d, cityTime, tz) {
var city_filter, parsed, _ref;
if (cityTime == null) {
cityTime = true;
}
if (tz == null) {
tz = null;
}
if (((_ref = !d.substr(-6, 1)) === '+' || _ref === '-') || d.length === 19) {
d += '+00:00';
}
if (/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})/.test(d)) {
parsed = d.match(/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})/);
d = new Date();
d.setUTCFullYear(parsed[1]);
d.setUTCMonth(parsed[2] - 1);
d.setUTCDate(parsed[3]);
d.setUTCHours(parsed[4]);
d.setUTCMinutes(parsed[5]);
d.setUTCSeconds(parsed[6]);
} else {
d = Date.parse(d);
}
if (typeof d === 'number') {
d = new Date(d);
}
d = new timezoneJS.Date(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate(), d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds(), 'Etc/UTC');
if (tz) {
d.convertToTimezone(tz);
} else if (cityTime) {
city_filter = $.cookie('city_filter');
if (city_filter) {
tz = $("#city_filter option[value=" + city_filter + "]").attr('data-timezone');
if (tz) {
d.convertToTimezone(tz);
}
}
}
return d;
},
dateToTimezone: function(d) {
var city_filter, tz;
d = new timezoneJS.Date(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate(), d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds(), 'Etc/UTC');
city_filter = $.cookie('city_filter');
if (city_filter) {
tz = $("#city_filter option[value=" + city_filter + "]").attr('data-timezone');
d.convertToTimezone(tz);
}
return d;
},
fixAMPM: function(d, formatted) {
if (d.hours >= 12) {
return formatted.replace(/\b[AP]M\b/, 'PM');
} else {
return formatted.replace(/\b[AP]M\b/, 'AM');
}
},
formatDate: function(d, time, timezone) {
var formatted;
if (time == null) {
time = true;
}
if (timezone == null) {
timezone = null;
}
d = this.parseDate(d, true, timezone);
formatted = time ? ("" + (i18n.jsworld.dtf.formatDate(d)) + " ") + this.formatTime(d, d.getTimezoneInfo()) : i18n.jsworld.dtf.formatDate(d);
return this.fixAMPM(d, formatted);
},
formatDateLong: function(d, time, timezone) {
if (time == null) {
time = true;
}
if (timezone == null) {
timezone = null;
}
d = this.parseDate(d, true, timezone);
timezone = d.getTimezoneInfo().tzAbbr;
if (time) {
return (i18n.jsworld.dtf.formatDateTime(d)) + (" " + timezone);
} else {
return i18n.jsworld.dtf.formatDate(d);
}
},
formatTimezoneJSDate: function(d) {
var day, hours, jsDate, minutes, month, year;
year = d.getFullYear();
month = this.leadingZero(d.getMonth());
day = this.leadingZero(d.getDate());
hours = this.leadingZero(d.getHours());
minutes = this.leadingZero(d.getMinutes());
jsDate = new Date(year, month, day, hours, minutes, 0);
return jsDate.toDateString();
},
formatTime: function(d, timezone) {
var formatted;
if (timezone == null) {
timezone = null;
}
formatted = ("" + (i18n.jsworld.dtf.formatTime(d))) + (timezone != null ? " " + (timezone != null ? timezone.tzAbbr : void 0) : "");
return this.fixAMPM(d, formatted);
},
formatISODate: function(d) {
var pad;
pad = function(n) {
if (n < 10) {
return '0' + n;
}
return n;
};
return d.getUTCFullYear() + '-' + pad(d.getUTCMonth() + 1) + '-' + pad(d.getUTCDate()) + 'T' + pad(d.getUTCHours()) + ':' + pad(d.getUTCMinutes()) + ':' + pad(d.getUTCSeconds()) + 'Z';
},
formatExpDate: function(d) {
var month, year;
d = this.parseDate(d);
year = d.getFullYear();
month = this.leadingZero(d.getMonth() + 1);
return "" + year + "-" + month;
},
formatLatLng: function(lat, lng, precision) {
if (precision == null) {
precision = 8;
}
return parseFloat(lat).toFixed(precision) + ',' + parseFloat(lng).toFixed(precision);
},
leadingZero: function(num) {
if (num < 10) {
return "0" + num;
} else {
return num;
}
},
roundNumber: function(num, dec) {
return Math.round(num * Math.pow(10, dec)) / Math.pow(10, dec);
},
notesToHTML: function(notes) {
var i, note, notesHTML, _i, _len;
notesHTML = '';
i = 1;
if (notes) {
for (_i = 0, _len = notes.length; _i < _len; _i++) {
note = notes[_i];
notesHTML += "<strong>" + note['userid'] + "</strong> " + (this.formatDate(note['created_at'])) + "<p>" + note['note'] + "</p>";
notesHTML += "<br>";
}
}
return notesHTML.replace("'", '"e');
},
formatPhone: function(n) {
var parts, phone, regexObj;
n = "" + n;
regexObj = /^(?:\+?1[-. ]?)?(?:\(?([0-9]{3})\)?[-. ]?)?([0-9]{3})[-. ]?([0-9]{4})$/;
if (regexObj.test(n)) {
parts = n.match(regexObj);
phone = "";
if (parts[1]) {
phone += "(" + parts[1] + ") ";
}
phone += "" + parts[2] + "-" + parts[3];
} else {
phone = n;
}
return phone;
},
usStates: ['Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 'Colorado', 'Connecticut', 'Delaware', 'District of Columbia', 'Florida', 'Georgia', 'Hawaii', 'Idaho', 'Illinois', 'Indiana', 'Iowa', 'Kansas', 'Kentucky', 'Louisiana', 'Maine', 'Maryland', 'Massachusetts', 'Michigan', 'Minnesota', 'Mississippi', 'Missouri', 'Montana', 'Nebraska', 'Nevada', 'New Hampshire', 'New Jersey', 'New Mexico', 'New York', 'North Carolina', 'North Dakota', 'Ohio', 'Oklahoma', 'Oregon', 'Pennsylvania', 'Rhode Island', 'South Carolina', 'South Dakota', 'Tennessee', 'Texas', 'Utah', 'Vermont', 'Virginia', 'Washington', 'West Virginia', 'Wisconsin', 'Wyoming'],
onboardingPages: ['applied', 'ready_to_interview', 'pending_interview', 'interviewed', 'accepted', 'ready_to_onboard', 'pending_onboarding', 'active', 'waitlisted', 'rejected'],
driverBreadCrumb: function(loc, model) {
var onboardingPage, out, _i, _len, _ref;
out = "<a href='#/driver_ops/summary'>Drivers</a> > ";
if (!(model != null)) {
out += "<select name='onboardingPage' id='onboardingPageSelector'>";
_ref = this.onboardingPages;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
onboardingPage = _ref[_i];
out += "<option value='" + onboardingPage + "' " + (onboardingPage === loc ? "selected" : void 0) + ">" + (this.onboardingUrlToName(onboardingPage)) + "</option>";
}
out += "</select>";
} else {
out += "<a href='#/driver_ops/" + (model.get('driver_status')) + "'>" + (this.onboardingUrlToName(model.get('driver_status'))) + "</a>";
out += " > " + (this.linkedName(model)) + " (" + (model.get('role')) + ") #" + (model.get('id'));
}
return out;
},
onboardingUrlToName: function(url) {
return url != null ? url.replace(/_/g, " ").replace(/(^|\s)([a-z])/g, function(m, p1, p2) {
return p1 + p2.toUpperCase();
}) : void 0;
},
formatVehicle: function(vehicle) {
if (vehicle.get('make') && vehicle.get('model') && vehicle.get('license_plate')) {
return "" + (vehicle.get('make')) + " " + (vehicle.get('model')) + " (" + (vehicle.get('license_plate')) + ")";
}
},
docArbitraryFields: function(docName, cityDocs) {
var doc, field, out, _i, _j, _len, _len2, _ref;
out = "";
for (_i = 0, _len = cityDocs.length; _i < _len; _i++) {
doc = cityDocs[_i];
if (doc.name === docName && __indexOf.call(_.keys(doc), "metaFields") >= 0) {
_ref = doc.metaFields;
for (_j = 0, _len2 = _ref.length; _j < _len2; _j++) {
field = _ref[_j];
out += "" + field.label + ": <input type='text' name='" + field.name + "' class='arbitraryField'><br>";
}
}
}
return out;
},
capitaliseFirstLetter: function(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
},
createDocUploadForm: function(docName, driverId, vehicleId, cityMeta, vehicleName, expirationRequired) {
var ddocs, expDropdowns, pdocs, vdocs;
if (driverId == null) {
driverId = "None";
}
if (vehicleId == null) {
vehicleId = "None";
}
if (cityMeta == null) {
cityMeta = [];
}
if (vehicleName == null) {
vehicleName = false;
}
if (expirationRequired == null) {
expirationRequired = false;
}
ddocs = cityMeta["driverRequiredDocs"] || [];
pdocs = cityMeta["partnerRequiredDocs"] || [];
vdocs = cityMeta["vehicleRequiredDocs"] || [];
expDropdowns = "Expiration Date:\n<select name=\"expiration-year\">\n <option value=\"2011\">2011</option>\n <option value=\"2012\">2012</option>\n <option value=\"2013\">2013</option>\n <option value=\"2014\">2014</option>\n <option value=\"2015\">2015</option>\n <option value=\"2016\">2016</option>\n <option value=\"2017\">2017</option>\n <option value=\"2018\">2018</option>\n</select> -\n<select name=\"expiration-month\">\n <option value=\"01\">01</option>\n <option value=\"02\">02</option>\n <option value=\"03\">03</option>\n <option value=\"04\">04</option>\n <option value=\"05\">05</option>\n <option value=\"06\">06</option>\n <option value=\"07\">07</option>\n <option value=\"08\">08</option>\n <option value=\"09\">09</option>\n <option value=\"10\">10</option>\n <option value=\"11\">11</option>\n <option value=\"12\">12</option>\n</select>";
return " <form class=\"documentuploadform\">\n <div>\n <input type=\"hidden\" name=\"fileName\" value=\"" + docName + "\">\n <input type=\"hidden\" name=\"driver_id\" value=\"" + driverId + "\">\n <input type=\"hidden\" name=\"vehicle_id\" value=\"" + vehicleId + "\">\n\n <div>\n <strong>" + (vehicleName ? vehicleName : "") + " " + docName + "</strong>\n </div>\n\n <div>\n <input type=\"file\" name=\"uploadContent\" id=\"" + (vehicleId !== "None" ? "vehicle_" + vehicleId + "_" : "") + "doc_upload_" + (docName.replace(/[\W]/g, "_")) + "\">\n </div>\n\n <div class=\"expiration\">\n " + (expirationRequired ? expDropdowns : "") + "\n </div>\n\n <div>\n " + (app.helpers.docArbitraryFields(docName, _.union(ddocs, pdocs, vdocs))) + "\n </div>\n\n <div>\n <input type=\"submit\" value=\"Upload\">\n </div>\n\n </div>\n</form>";
},
countrySelector: function(name, options) {
var countries, countryCodePrefix, defaultOptions;
if (options == null) {
options = {};
}
defaultOptions = {
selectedKey: 'telephone_code',
selectedValue: '+1',
silent: false
};
_.extend(defaultOptions, options);
options = defaultOptions;
countries = new app.collections.countries();
countries.fetch({
data: {
limit: 300
},
success: function(countries) {
var $option, $select, country, selected, _i, _len, _ref;
selected = false;
_ref = countries.models || [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
country = _ref[_i];
$select = $("select[name=" + name + "]");
$option = $('<option></option>').val(country.id).attr('data-iso2', country.get('iso2')).attr('data-prefix', country.get('telephone_code')).html(country.get('name'));
if (country.get(options.selectedKey) === options.selectedValue && !selected) {
selected = true;
$option.attr('selected', 'selected');
}
$select.append($option);
}
if (selected && !options.silent) {
return $select.val(options.selected).trigger('change');
}
}
});
countryCodePrefix = options.countryCodePrefix ? "data-country-code-prefix='" + options.countryCodePrefix + "'" : '';
return "<select name='" + name + "' id='" + name + "' " + countryCodePrefix + " " + (options.disabled ? 'disabled="disabled"' : "") + "></select>";
},
missingDocsOnDriver: function(driver) {
var city, docsReq, documents, partnerDocs;
city = driver.get('city');
documents = driver.get('documents');
if ((city != null) && (documents != null)) {
docsReq = _.pluck(city != null ? city.get('meta')["driverRequiredDocs"] : void 0, "name");
if (driver.get('role') === "partner") {
partnerDocs = _.pluck(city != null ? city.get('meta')["partnerRequiredDocs"] : void 0, "name");
docsReq = _.union(docsReq, partnerDocs);
}
return _.reject(docsReq, __bind(function(doc) {
return __indexOf.call((documents != null ? documents.pluck("name") : void 0) || [], doc) >= 0;
}, this));
} else {
return [];
}
}
};
}).call(this);
}, "web-lib/i18n": function(exports, require, module) {(function() {
exports.i18n = {
defaultLocale: 'en_US',
cookieName: '_LOCALE_',
locales: {
'en_US': "English (US)",
'fr_FR': "Français"
},
currencyToLocale: {
'USD': 'en_US',
'EUR': 'fr_FR'
},
logglyKey: 'd2d5a9bc-7ebe-4538-a180-81e62c705b1b',
logglyHost: 'https://logs.loggly.com',
init: function() {
this.castor = new window.loggly({
url: this.logglyHost + '/inputs/' + this.logglyKey + '?rt=1',
level: 'error'
});
this.setLocale($.cookie(this.cookieName) || this.defaultLocale);
window.t = _.bind(this.t, this);
this.loadLocaleTranslations(this.locale);
if (!(this[this.defaultLocale] != null)) {
return this.loadLocaleTranslations(this.defaultLocale);
}
},
loadLocaleTranslations: function(locale) {
var loadPaths, path, _i, _len, _results;
loadPaths = ['web-lib/translations/' + locale, 'web-lib/translations/' + locale.slice(0, 2), 'translations/' + locale, 'translations/' + locale.slice(0, 2)];
_results = [];
for (_i = 0, _len = loadPaths.length; _i < _len; _i++) {
path = loadPaths[_i];
locale = path.substring(path.lastIndexOf('/') + 1);
if (this[locale] == null) {
this[locale] = {};
}
_results.push((function() {
try {
return _.extend(this[locale], require(path).translations);
} catch (error) {
}
}).call(this));
}
return _results;
},
getLocale: function() {
return this.locale;
},
setLocale: function(locale) {
var message, parts, _ref;
parts = locale.split('_');
this.locale = parts[0].toLowerCase();
if (parts.length > 1) {
this.locale += "_" + (parts[1].toUpperCase());
}
if (this.locale) {
$.cookie(this.cookieName, this.locale, {
path: '/',
domain: '.uber.com'
});
}
try {
((_ref = this.jsworld) != null ? _ref : this.jsworld = {}).lc = new jsworld.Locale(POSIX_LC[this.locale]);
this.jsworld.mf = new jsworld.MonetaryFormatter(this.jsworld.lc);
this.jsworld.nf = new jsworld.NumericFormatter(this.jsworld.lc);
this.jsworld.dtf = new jsworld.DateTimeFormatter(this.jsworld.lc);
this.jsworld.np = new jsworld.NumericParser(this.jsworld.lc);
this.jsworld.mp = new jsworld.MonetaryParser(this.jsworld.lc);
return this.jsworld.dtp = new jsworld.DateTimeParser(this.jsworld.lc);
} catch (error) {
message = 'JsWorld error with locale: ' + this.locale;
return this.log({
message: message,
error: error
});
}
},
getTemplate: function(id) {
var _ref, _ref2;
return ((_ref = this[this.locale]) != null ? _ref[id] : void 0) || ((_ref2 = this[this.locale.slice(0, 2)]) != null ? _ref2[id] : void 0);
},
getTemplateDefault: function(id) {
var _ref, _ref2;
return ((_ref = this[this.defaultLocale]) != null ? _ref[id] : void 0) || ((_ref2 = this[this.defaultLocale.slice(0, 2)]) != null ? _ref2[id] : void 0);
},
getTemplateOrDefault: function(id) {
return this.getTemplate(id) || this.getTemplateDefault(id);
},
t: function(id, vars) {
var errStr, locale, template;
if (vars == null) {
vars = {};
}
locale = this.getLocale();
template = this.getTemplate(id);
if (template == null) {
if (/dev|test/.test(window.location.host)) {
template = "(?) " + id;
} else {
template = this.getTemplateDefault(id);
}
errStr = "Missing [" + locale + "] translation for [" + id + "] at [" + window.location.hash + "] - Default template is [" + template + "]";
this.log({
error: errStr,
locale: locale,
id: id,
defaultTemplate: template
});
}
if (template) {
return _.template(template, vars);
} else {
return id;
}
},
log: function(error) {
if (/dev/.test(window.location.host)) {
if ((typeof console !== "undefined" && console !== null ? console.log : void 0) != null) {
return console.log(error);
}
} else {
_.extend(error, {
host: window.location.host,
hash: window.location.hash
});
return this.castor.error(JSON.stringify(error));
}
}
};
}).call(this);
}, "web-lib/mixins/i18n_phone_form": function(exports, require, module) {(function() {
exports.i18nPhoneForm = {
_events: {
'change select[data-country-code-prefix]': 'setCountryCodePrefix'
},
setCountryCodePrefix: function(e) {
var $el, prefix;
$el = $(e.currentTarget);
prefix = $el.find('option:selected').attr('data-prefix');
return $("#" + ($el.attr('data-country-code-prefix'))).text(prefix);
}
};
}).call(this);
}, "web-lib/models/country": function(exports, require, module) {(function() {
var UberModel;
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
};
UberModel = require('web-lib/uber_model').UberModel;
exports.Country = (function() {
__extends(Country, UberModel);
function Country() {
Country.__super__.constructor.apply(this, arguments);
}
Country.prototype.url = function() {
if (this.id) {
return "/countries/" + this.id;
} else {
return '/countries';
}
};
return Country;
})();
}).call(this);
}, "web-lib/models/vehicle_type": function(exports, require, module) {(function() {
var UberModel;
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
};
UberModel = require('web-lib/uber_model').UberModel;
exports.VehicleType = (function() {
__extends(VehicleType, UberModel);
function VehicleType() {
this.toString = __bind(this.toString, this);
VehicleType.__super__.constructor.apply(this, arguments);
}
VehicleType.prototype.endpoint = 'vehicle_types';
VehicleType.prototype.toTableRow = function(cols) {
var actions, c, capacity, city_id, columnValues, created_at, created_by_user_id, deleted_at, id, make, minimum_year, model, rows, type, updated_at, updated_by_user_id, _i, _len, _ref;
id = "<a href='#/vehicle_types/" + (this.get('id')) + "'>" + (this.get('id')) + "</a>";
if (this.get('created_at')) {
created_at = app.helpers.formatDate(this.get('created_at'));
}
if (this.get('updated_at')) {
updated_at = app.helpers.formatDate(this.get('updated_at'));
}
if (this.get('deleted_at')) {
deleted_at = app.helpers.formatDate(this.get('deleted_at'));
}
created_by_user_id = "<a href='#/clients/" + (this.get('created_by_user_id')) + "'>" + (this.get('created_by_user_id')) + "</a>";
updated_by_user_id = "<a href='#/clients/" + (this.get('updated_by_user_id')) + "'>" + (this.get('updated_by_user_id')) + "</a>";
city_id = (_ref = this.get('city')) != null ? _ref.get('display_name') : void 0;
type = this.get('type');
make = this.get('make');
model = this.get('model');
capacity = this.get('capacity');
minimum_year = this.get('minimum_year');
actions = "<a href='#/vehicle_types/" + (this.get('id')) + "'>Show</a>";
if (!this.get('deleted_at')) {
actions += " <a href='#/vehicle_types/" + (this.get('id')) + "/edit'>Edit</a>";
actions += " <a id='" + (this.get('id')) + "' class='delete' href='#'>Delete</a>";
}
columnValues = {
id: id,
created_at: created_at,
updated_at: updated_at,
deleted_at: deleted_at,
created_by_user_id: created_by_user_id,
updated_by_user_id: updated_by_user_id,
city_id: city_id,
type: type,
make: make,
model: model,
capacity: capacity,
minimum_year: minimum_year,
actions: actions
};
rows = [];
for (_i = 0, _len = cols.length; _i < _len; _i++) {
c = cols[_i];
rows.push(columnValues[c] ? columnValues[c] : '-');
}
return rows;
};
VehicleType.prototype.toString = function() {
return this.get('make') + ' ' + this.get('model') + ' ' + this.get('type') + (" (" + (this.get('capacity')) + ")");
};
return VehicleType;
})();
}).call(this);
}, "web-lib/templates/footer": function(exports, require, module) {module.exports = function(__obj) {
if (!__obj) __obj = {};
var __out = [], __capture = function(callback) {
var out = __out, result;
__out = [];
callback.call(this);
result = __out.join('');
__out = out;
return __safe(result);
}, __sanitize = function(value) {
if (value && value.ecoSafe) {
return value;
} else if (typeof value !== 'undefined' && value != null) {
return __escape(value);
} else {
return '';
}
}, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
__safe = __obj.safe = function(value) {
if (value && value.ecoSafe) {
return value;
} else {
if (!(typeof value !== 'undefined' && value != null)) value = '';
var result = new String(value);
result.ecoSafe = true;
return result;
}
};
if (!__escape) {
__escape = __obj.escape = function(value) {
return ('' + value)
.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/"/g, '"');
};
}
(function() {
(function() {
var locale, title, _ref;
__out.push('<div class="footer_col_2">\n <ul>\n <li class="head">');
__out.push(__sanitize(t("Info")));
__out.push('</li>\n <li><a href="https://www.uber.com/learn">');
__out.push(__sanitize(t("Learn More")));
__out.push('</a></li>\n <li><a href="https://www.uber.com/learn#pricing">');
__out.push(__sanitize(t("Pricing")));
__out.push('</a></li>\n <li><a href="http://support.uber.com">');
__out.push(__sanitize(t("Support & FAQ")));
__out.push('</a></li>\n <li><a href="https://partners.uber.com/#!/partners/new">');
__out.push(__sanitize(t("Apply to Drive")));
__out.push('</a></li>\n </ul>\n</div>\n<div class="footer_col_2">\n <ul>\n <li class="head">');
__out.push(__sanitize(t("Social")));
__out.push('</li>\n <li><a href="http://www.twitter.com/uber">');
__out.push(__sanitize(t("Twitter")));
__out.push('</a></li>\n <li><a href="http://www.facebook.com/uber">');
__out.push(__sanitize(t("Facebook")));
__out.push('</a></li>\n <li><a href="http://blog.uber.com">');
__out.push(__sanitize(t("Blog")));
__out.push('</a></li>\n <li><a href="https://www.uber.com/contact">');
__out.push(__sanitize(t("Contact Us")));
__out.push('</a></li>\n </ul>\n</div>\n<div class="footer_col_2">\n <ul>\n <li class="head">');
__out.push(__sanitize(t("Phones")));
__out.push('</li>\n <li><a href="https://www.uber.com/phones/text">');
__out.push(__sanitize(t("Text Message")));
__out.push('</a></li>\n <li><a href="https://www.uber.com/phones/iphone">');
__out.push(__sanitize(t("iPhone")));
__out.push('</a></li>\n <li><a href="https://www.uber.com/phones/android">');
__out.push(__sanitize(t("Android")));
__out.push('</a></li>\n </ul>\n</div>\n<div class="footer_col_2">\n <ul>\n <li class="head">');
__out.push(__sanitize(t("Company_Footer")));
__out.push('</li>\n <li><a href="https://www.uber.com/privacy">');
__out.push(__sanitize(t("Privacy Policy")));
__out.push('</a></li>\n <li><a href="https://www.uber.com/terms">');
__out.push(__sanitize(t("Terms")));
__out.push('</a></li>\n <li><a href="https://www.uber.com/jobs">');
__out.push(__sanitize(t("Jobs")));
__out.push('</a></li>\n </ul>\n</div>\n<div class="footer_col_copyright">\n <p>');
__out.push(t("Copyright © Uber Technologies, Inc."));
__out.push('</p>\n <p>\n ');
__out.push(__sanitize(t('Language:')));
__out.push('\n ');
_ref = typeof i18n !== "undefined" && i18n !== null ? i18n.locales : void 0;
for (locale in _ref) {
title = _ref[locale];
__out.push('\n ');
if (locale === (typeof i18n !== "undefined" && i18n !== null ? i18n.getLocale() : void 0)) {
__out.push('\n <span class="language current_language" id=\'');
__out.push(__sanitize(locale));
__out.push('\'>');
__out.push(__sanitize(title));
__out.push('</span>\n ');
} else {
__out.push('\n <a href="');
__out.push(__sanitize(window.location.href));
__out.push('" class="language" id=\'');
__out.push(__sanitize(locale));
__out.push('\' title="');
__out.push(__sanitize(title));
__out.push('">');
__out.push(__sanitize(title));
__out.push('</a>\n ');
}
__out.push('\n ');
}
__out.push('\n </p>\n</div>\n');
}).call(this);
}).call(__obj);
__obj.safe = __objSafe, __obj.escape = __escape;
return __out.join('');
}}, "web-lib/translations/en": function(exports, require, module) {(function() {
exports.translations = {
"Info": "Info",
"Learn More": "Learn More",
"Pricing": "Pricing",
"FAQ": "FAQ",
"Support": "Support",
"Support & FAQ": "Support & FAQ",
"Contact Us": "Contact Us",
"Jobs": "Jobs",
"Phones": "Phones",
"Text Message": "Text Message",
"iPhone": "iPhone",
"Android": "Android",
"Drivers": "Drivers",
"Apply": "Apply",
"Sign In": "Sign In",
"Social": "Social",
"Twitter": "Twitter",
"Facebook": "Facebook",
"Blog": "Blog",
"Legal": "Legal",
"Company_Footer": "Company",
"Privacy Policy": "Privacy Policy",
"Terms": "Terms",
"Copyright © Uber Technologies, Inc.": "Copyright © Uber Technologies, Inc.",
"Language:": "Language:",
"Apply to Drive": "Apply to Drive",
"Expiration": "Expiration",
"Fare": "Fare",
"Driver": "Driver ",
"Dashboard": "Dashboard",
"Forgot Password": "Forgot Password",
"Trip Details": "Trip Details",
"Save": "Save",
"Cancel": "Cancel",
"Edit": "Edit",
"Password": "Password",
"First Name": "First Name",
"Last Name": "Last Name",
"Email Address": "Email Address",
"Submit": "Submit",
"Mobile Number": "Mobile Number",
"Zip Code": "Zip Code",
"Sign Out": "Sign Out",
"Confirm Email Message": "Attempting to confirm email...",
"Upload": "Upload",
"Rating": "Rating",
"Pickup Time": "Pickup Time",
"2011": "2011",
"2012": "2012",
"2013": "2013",
"2014": "2014",
"2015": "2015",
"2016": "2016",
"2017": "2017",
"2018": "2018",
"2019": "2019",
"2020": "2020",
"2021": "2021",
"2022": "2022",
"01": "01",
"02": "02",
"03": "03",
"04": "04",
"05": "05",
"06": "06",
"07": "07",
"08": "08",
"09": "09",
"10": "10",
"11": "11",
"12": "12"
};
}).call(this);
}, "web-lib/translations/fr": function(exports, require, module) {(function() {
exports.translations = {
"Info": "Info",
"Learn More": "En Savoir Plus",
"Pricing": "Calcul du Prix",
"Support & FAQ": "Aide & FAQ",
"Contact Us": "Contactez Nous",
"Jobs": "Emplois",
"Phones": "Téléphones",
"Text Message": "SMS",
"iPhone": "iPhone",
"Android": "Android",
"Apply to Drive": "Candidature Chauffeur",
"Sign In": "Connexion",
"Social": "Contact",
"Twitter": "Twitter",
"Facebook": "Facebook",
"Blog": "Blog",
"Privacy Policy": "Protection des Données Personelles",
"Terms": "Conditions Générales",
"Copyright © Uber Technologies, Inc.": "© Uber, Inc.",
"Language:": "Langue:",
"Forgot Password": "Mot de passe oublié",
"Company_Footer": "À Propos d'Uber",
"Expiration": "Expiration",
"Fare": "Tarif",
"Driver": "Chauffeur",
"Drivers": "Chauffeurs",
"Dashboard": "Tableau de bord",
"Forgot Password": "Mot de passe oublié",
"Forgot Password?": "Mot de passe oublié?",
"Trip Details": "Détails de la course",
"Save": "Enregistrer",
"Cancel": "Annuler",
"Edit": "Modifier",
"Password": "Mot de passe",
"First Name": "Prénom",
"Last Name": "Nom",
"Email Address": "E-mail",
"Submit": "Soumettre",
"Mobile Number": "Téléphone Portable",
"Zip Code": "Code Postal",
"Sign Out": "Se déconnecter",
"Confirm Email Message": "E-mail de confirmation",
"Upload": "Télécharger",
"Rating": "Notation",
"Pickup Time": "Heure de prise en charge",
"2011": "2011",
"2012": "2012",
"2013": "2013",
"2014": "2014",
"2015": "2015",
"2016": "2016",
"2017": "2017",
"2018": "2018",
"2019": "2019",
"2020": "2020",
"2021": "2021",
"2022": "2022",
"01": "01",
"02": "02",
"03": "03",
"04": "04",
"05": "05",
"06": "06",
"07": "07",
"08": "08",
"09": "09",
"10": "10",
"11": "11",
"12": "12"
};
}).call(this);
}, "web-lib/uber_collection": function(exports, require, module) {(function() {
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
};
exports.UberCollection = (function() {
__extends(UberCollection, Backbone.Collection);
function UberCollection() {
UberCollection.__super__.constructor.apply(this, arguments);
}
UberCollection.prototype.parse = function(data) {
var model, tmp, _i, _in, _len, _out;
_in = data.resources || data;
_out = [];
if (data.meta) {
this.meta = data.meta;
}
for (_i = 0, _len = _in.length; _i < _len; _i++) {
model = _in[_i];
tmp = new this.model;
tmp.set(tmp.parse(model));
_out.push(tmp);
}
return _out;
};
UberCollection.prototype.isRenderable = function() {
if (this.models.length) {
return true;
}
};
UberCollection.prototype.toTableRows = function(cols) {
var tableRows;
tableRows = [];
_.each(this.models, function(model) {
return tableRows.push(model.toTableRow(cols));
});
return tableRows;
};
return UberCollection;
})();
}).call(this);
}, "web-lib/uber_model": function(exports, require, module) {(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
}, __indexOf = Array.prototype.indexOf || function(item) {
for (var i = 0, l = this.length; i < l; i++) {
if (this[i] === item) return i;
}
return -1;
};
exports.UberModel = (function() {
__extends(UberModel, Backbone.Model);
function UberModel() {
this.refetch = __bind(this.refetch, this);
this.fetch = __bind(this.fetch, this);
this.save = __bind(this.save, this);
this.parse = __bind(this.parse, this);
UberModel.__super__.constructor.apply(this, arguments);
}
UberModel.prototype.endpoint = 'set_api_endpoint_in_subclass';
UberModel.prototype.refetchOptions = {};
UberModel.prototype.url = function(type) {
var endpoint_path;
endpoint_path = "/" + this.endpoint;
if (this.get('id')) {
return endpoint_path + ("/" + (this.get('id')));
} else {
return endpoint_path;
}
};
UberModel.prototype.isRenderable = function() {
var i, key, value, _ref;
i = 0;
_ref = this.attributes;
for (key in _ref) {
if (!__hasProp.call(_ref, key)) continue;
value = _ref[key];
if (this.attributes.hasOwnProperty(key)) {
i += 1;
}
if (i > 1) {
return true;
}
}
return !(i === 1);
};
UberModel.prototype.parse = function(response) {
var attrs, key, model, models, _i, _j, _k, _len, _len2, _len3, _ref, _ref2;
if (typeof response === 'object') {
_ref = _.intersection(_.keys(app.models), _.keys(response));
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
key = _ref[_i];
if (response[key]) {
attrs = this.parse(response[key]);
if (typeof attrs === 'object') {
response[key] = new app.models[key](attrs);
}
}
}
_ref2 = _.intersection(_.keys(app.collections), _.keys(response));
for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) {
key = _ref2[_j];
models = response[key];
if (_.isArray(models)) {
response[key] = new app.collections[key];
for (_k = 0, _len3 = models.length; _k < _len3; _k++) {
model = models[_k];
attrs = app.collections[key].prototype.model.prototype.parse(model);
response[key].add(new response[key].model(attrs));
}
}
}
}
return response;
};
UberModel.prototype.save = function(attributes, options) {
var attr, _i, _j, _len, _len2, _ref, _ref2;
if (options == null) {
options = {};
}
_ref = _.intersection(_.keys(app.models), _.keys(this.attributes));
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
attr = _ref[_i];
if (typeof this.get(attr) === "object") {
this.unset(attr, {
silent: true
});
}
}
_ref2 = _.intersection(_.keys(app.collections), _.keys(this.attributes));
for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) {
attr = _ref2[_j];
if (typeof this.get(attr) === "object") {
this.unset(attr, {
silent: true
});
}
}
if ((options != null) && options.diff && (attributes != null) && attributes !== {}) {
attributes['id'] = this.get('id');
attributes['token'] = this.get('token');
this.clear({
'silent': true
});
this.set(attributes, {
silent: true
});
}
if (__indexOf.call(_.keys(options), "data") < 0 && __indexOf.call(_.keys(this.refetchOptions || {}), "data") >= 0) {
options.data = this.refetchOptions.data;
}
return Backbone.Model.prototype.save.call(this, attributes, options);
};
UberModel.prototype.fetch = function(options) {
this.refetchOptions = options;
return Backbone.Model.prototype.fetch.call(this, options);
};
UberModel.prototype.refetch = function() {
return this.fetch(this.refetchOptions);
};
return UberModel;
})();
}).call(this);
}, "web-lib/uber_router": function(exports, require, module) {(function() {
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
};
exports.UberRouter = (function() {
__extends(UberRouter, Backbone.Router);
function UberRouter() {
UberRouter.__super__.constructor.apply(this, arguments);
}
UberRouter.prototype.datePickers = function(format) {
if (format == null) {
format = "%Z-%m-%dT%H:%i:%s%:";
}
$('.datepicker').AnyTime_noPicker();
return $('.datepicker').AnyTime_picker({
'format': format,
'formatUtcOffset': '%@'
});
};
UberRouter.prototype.autoGrowInput = function() {
return $('.editable input').autoGrowInput();
};
UberRouter.prototype.windowTitle = function(title) {
return $(document).attr('title', title);
};
return UberRouter;
})();
}).call(this);
}, "web-lib/uber_show_view": function(exports, require, module) {(function() {
var UberView;
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
}, __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
UberView = require('web-lib/uber_view').UberView;
exports.UberShowView = (function() {
__extends(UberShowView, UberView);
function UberShowView() {
UberShowView.__super__.constructor.apply(this, arguments);
}
UberShowView.prototype.view = 'show';
UberShowView.prototype.events = {
'click #edit': 'edit',
'submit form': 'save',
'click .cancel': 'cancel'
};
UberShowView.prototype.errors = null;
UberShowView.prototype.showTemplate = null;
UberShowView.prototype.editTemplate = null;
UberShowView.prototype.initialize = function() {
if (this.init_hook) {
this.init_hook();
}
_.bindAll(this, 'render');
return this.model.bind('change', this.render);
};
UberShowView.prototype.render = function() {
var $el;
$el = $(this.el);
this.selectView();
if (this.view === 'show') {
$el.html(this.showTemplate({
model: this.model
}));
} else if (this.view === 'edit') {
$el.html(this.editTemplate({
model: this.model,
errors: this.errors || {},
collections: this.collections || {}
}));
} else {
$el.html(this.newTemplate({
model: this.model,
errors: this.errors || {},
collections: this.collections || {}
}));
}
if (this.render_hook) {
this.render_hook();
}
this.errors = null;
this.userIdsToLinkedNames();
this.datePickers();
return this.place();
};
UberShowView.prototype.selectView = function() {
var url;
if (this.options.urlRendering) {
url = window.location.hash;
if (url.match(/\/new/)) {
return this.view = 'new';
} else if (url.match(/\/edit/)) {
return this.view = 'edit';
} else {
return this.view = 'show';
}
}
};
UberShowView.prototype.edit = function(e) {
e.preventDefault();
if (this.options.urlRendering) {
window.location.hash = '#/' + this.model.endpoint + '/' + this.model.get('id') + '/edit';
} else {
this.view = 'edit';
}
return this.model.change();
};
UberShowView.prototype.save = function(e) {
var attributes, ele, form_attrs, _i, _len, _ref;
e.preventDefault();
attributes = $(e.currentTarget).serializeToJson();
form_attrs = {};
_ref = $('input[type="radio"]');
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
ele = _ref[_i];
if ($(ele).is(':checked')) {
form_attrs[$(ele).attr('name')] = $(ele).attr('value');
}
}
attributes = _.extend(attributes, form_attrs);
if (this.relationships) {
attributes = _.extend(attributes, {
relationships: this.relationships
});
}
if (this.filter_attributes != null) {
this.filter_attributes(attributes);
}
return this.model.save(attributes, {
silent: true,
success: __bind(function(model) {
if (this.options.urlRendering) {
window.location.hash = '#/' + this.model.endpoint + '/' + this.model.get('id');
} else {
this.view = 'show';
}
return this.flash('success', "Uber save!");
}, this),
statusCode: {
406: __bind(function(xhr) {
this.errors = JSON.parse(xhr.responseText);
return this.flash('error', 'That was not Uber.');
}, this)
},
error: __bind(function(model, xhr) {
var code, message, responseJSON, responseText;
code = xhr.status;
responseText = xhr.responseText;
if (responseText) {
responseJSON = JSON.parse(responseText);
}
if (responseJSON && (typeof responseJSON === 'object') && (responseJSON.hasOwnProperty('error'))) {
message = responseJSON.error;
}
return this.flash('error', (code || 'Unknown') + ' error' + (': ' + message || ''));
}, this),
complete: __bind(function() {
return this.model.change();
}, this)
});
};
UberShowView.prototype.cancel = function(e) {
e.preventDefault();
if (this.options.urlRendering) {
window.location.hash = '#/' + this.model.endpoint + '/' + this.model.get('id');
} else {
this.view = 'show';
}
return this.model.fetch({
silent: true,
complete: __bind(function() {
return this.model.change();
}, this)
});
};
return UberShowView;
})();
}).call(this);
}, "web-lib/uber_sync": function(exports, require, module) {(function() {
var methodType;
var __indexOf = Array.prototype.indexOf || function(item) {
for (var i = 0, l = this.length; i < l; i++) {
if (this[i] === item) return i;
}
return -1;
};
methodType = {
create: 'POST',
update: 'PUT',
"delete": 'DELETE',
read: 'GET'
};
exports.UberSync = function(method, model, options) {
var token;
options.type = methodType[method];
options.url = _.isString(this.url) ? '/api' + this.url : '/api' + this.url(options.type);
options.data = _.extend({}, options.data);
if (__indexOf.call(_.keys(options.data), "city_id") < 0) {
if ($.cookie('city_filter')) {
_.extend(options.data, {
city_id: $.cookie('city_filter')
});
}
} else {
delete options.data['city_id'];
}
if (options.type === 'POST' || options.type === 'PUT') {
_.extend(options.data, model.toJSON());
}
token = $.cookie('token') ? $.cookie('token') : typeof USER !== "undefined" && USER !== null ? USER.get('token') : "";
_.extend(options.data, {
token: token
});
if (method === "delete") {
options.contentType = 'application/json';
options.data = JSON.stringify(options.data);
}
return $.ajax(options);
};
}).call(this);
}, "web-lib/uber_view": function(exports, require, module) {(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
};
exports.UberView = (function() {
__extends(UberView, Backbone.View);
function UberView() {
this.processDocumentUpload = __bind(this.processDocumentUpload, this);
UberView.__super__.constructor.apply(this, arguments);
}
UberView.prototype.className = 'view_container';
UberView.prototype.hashId = function() {
return parseInt(location.hash.split('/')[2]);
};
UberView.prototype.place = function(content) {
var $target;
$target = this.options.scope ? this.options.scope.find(this.options.selector) : $(this.options.selector);
$target[this.options.method || 'html'](content || this.el);
this.delegateEvents();
$('#spinner').hide();
return this;
};
UberView.prototype.mixin = function(m, args) {
var events, self;
if (args == null) {
args = {};
}
self = this;
events = m._events;
_.extend(this, m);
if (m.initialize) {
m.initialize(self, args);
}
return _.each(_.keys(events), function(key) {
var event, func, selector, split;
split = key.split(' ');
event = split[0];
selector = split[1];
func = events[key];
return $(self.el).find(selector).live(event, function(e) {
return self[func](e);
});
});
};
UberView.prototype.datePickers = function(format) {
if (format == null) {
format = "%Z-%m-%dT%H:%i:%s%:";
}
$('.datepicker').AnyTime_noPicker();
return $('.datepicker').AnyTime_picker({
'format': format,
'formatUtcOffset': '%@'
});
};
UberView.prototype.dataTable = function(collection, selector, options, params, cols) {
var defaults;
if (selector == null) {
selector = 'table';
}
if (options == null) {
options = {};
}
if (params == null) {
params = {};
}
if (cols == null) {
cols = [];
}
$(selector).empty();
if (!cols.length) {
cols = collection.defaultColumns;
}
defaults = {
aoColumns: collection.tableColumns(cols),
bDestroy: true,
bSort: false,
bProcessing: true,
bFilter: false,
bServerSide: true,
bPaginate: true,
bScrollInfinite: true,
bScrollCollapse: true,
sScrollY: '600px',
iDisplayLength: 50,
fnServerData: function(source, data, callback) {
var defaultParams;
defaultParams = {
limit: data[4].value,
offset: data[3].value
};
return collection.fetch({
data: _.extend(defaultParams, params),
success: function() {
return callback({
aaData: collection.toTableRows(cols),
iTotalRecords: collection.meta.count,
iTotalDisplayRecords: collection.meta.count
});
},
error: function() {
return new Error({
message: 'Loading error.'
});
}
});
},
fnRowCallback: function(nRow, aData, iDisplayIndex, iDisplayIndexFull) {
$('[data-tooltip]', nRow).qtip({
content: {
attr: 'data-tooltip'
},
style: {
classes: "ui-tooltip-light ui-tooltip-rounded ui-tooltip-shadow"
}
});
return nRow;
}
};
return $(this.el).find(selector).dataTable(_.extend(defaults, options));
};
UberView.prototype.dataTableLocal = function(collection, selector, options, params, cols) {
var $dataTable, defaults;
if (selector == null) {
selector = 'table';
}
if (options == null) {
options = {};
}
if (params == null) {
params = {};
}
if (cols == null) {
cols = [];
}
$(selector).empty();
if (!cols.length || cols.length === 0) {
cols = collection.defaultColumns;
}
defaults = {
aaData: collection.toTableRows(cols),
aoColumns: collection.tableColumns(cols),
bDestroy: true,
bSort: false,
bProcessing: true,
bFilter: false,
bScrollInfinite: true,
bScrollCollapse: true,
sScrollY: '600px',
iDisplayLength: -1
};
$dataTable = $(this.el).find(selector).dataTable(_.extend(defaults, options));
_.delay(__bind(function() {
if ($dataTable && $dataTable.length > 0) {
return $dataTable.fnAdjustColumnSizing();
}
}, this), 1);
return $dataTable;
};
UberView.prototype.reverseGeocode = function() {
var $el;
return '';
$el = $(this.el);
return this.requireMaps(function() {
var geocoder;
geocoder = new google.maps.Geocoder();
return $el.find('[data-point]').each(function() {
var $this, latLng, point;
$this = $(this);
point = JSON.parse($this.attr('data-point'));
latLng = new google.maps.LatLng(point.latitude, point.longitude);
return geocoder.geocode({
latLng: latLng
}, function(data, status) {
if (status === google.maps.GeocoderStatus.OK) {
return $this.text(data[0].formatted_address);
}
});
});
});
};
UberView.prototype.userIdsToLinkedNames = function() {
var $el;
$el = $(this.el);
return $el.find('a[data-user-id][data-user-type]').each(function() {
var $this, user, userType;
$this = $(this);
userType = $this.attr('data-user-type') === 'user' ? 'client' : $this.attr('data-user-type');
user = new app.models[userType]({
id: $this.attr('data-user-id')
});
return user.fetch({
success: function(user) {
return $this.html(app.helpers.linkedName(user)).attr('href', "!/" + user.role + "s/" + user.id);
},
error: function() {
if ($this.attr('data-user-type') === 'user') {
user = new app.models['driver']({
id: $this.attr('data-user-id')
});
return user.fetch({
success: function(user) {
return $this.html(app.helpers.linkedName(user)).attr('href', "!/driver/" + user.id);
}
});
}
}
});
});
};
UberView.prototype.selectedCity = function() {
var $selected, city, cityFilter;
cityFilter = $.cookie('city_filter');
$selected = $("#city_filter option[value=" + cityFilter + "]");
if (city_filter && $selected.length) {
return city = {
lat: parseFloat($selected.attr('data-lat')),
lng: parseFloat($selected.attr('data-lng')),
timezone: $selected.attr('data-timezone')
};
} else {
return city = {
lat: 37.775,
lng: -122.45,
timezone: 'Etc/UTC'
};
}
};
UberView.prototype.updateModel = function(e, success) {
var $el, attrs, model, self;
e.preventDefault();
$el = $(e.currentTarget);
self = this;
model = new this.model.__proto__.constructor({
id: this.model.id
});
attrs = {};
$el.find('[name]').each(function() {
var $this;
$this = $(this);
return attrs["" + ($this.attr('name'))] = $this.val();
});
self.model.set(attrs);
$el.find('span.error').text('');
return model.save(attrs, {
complete: function(xhr) {
var response;
response = JSON.parse(xhr.responseText);
switch (xhr.status) {
case 200:
self.model = model;
$el.find('[name]').val('');
if (success) {
return success();
}
break;
case 406:
return _.each(response, function(error, field) {
return $el.find("[name=" + field + "]").parent().find('span.error').text(error);
});
default:
return this.unanticipatedError(response);
}
}
});
};
UberView.prototype.autoUpdateModel = function(e) {
var $el, arg, model, self, val;
$el = $(e.currentTarget);
val = $el.val();
self = this;
if (val !== this.model.get($el.attr('id'))) {
arg = {};
arg[$el.attr('id')] = $el.is(':checkbox') ? $el.is(':checked') ? 1 : 0 : val;
$('.editable span').empty();
this.model.set(arg);
model = new this.model.__proto__.constructor({
id: this.model.id
});
return model.save(arg, {
complete: function(xhr) {
var key, response, _i, _len, _ref, _results;
response = JSON.parse(xhr.responseText);
switch (xhr.status) {
case 200:
self.flash('success', 'Saved!');
return $el.blur();
case 406:
self.flash('error', 'That was not Uber.');
_ref = _.keys(response);
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
key = _ref[_i];
_results.push($el.parent().find('span').html(response[key]));
}
return _results;
break;
default:
return self.unanticipatedError;
}
}
});
}
};
UberView.prototype.unanticipatedError = function(response) {
return self.flash('error', response);
};
UberView.prototype.flash = function(type, text) {
var $banner;
$banner = $("." + type);
$banner.find('p').text(text).end().css('border', '1px solid #999').animate({
top: 0
}, 500);
return setTimeout(function() {
return $banner.animate({
top: -$banner.outerHeight()
}, 500);
}, 3000);
};
UberView.prototype.requireMaps = function(callback) {
if (typeof google !== 'undefined' && google.maps) {
return callback();
} else {
return $.getScript("https://www.google.com/jsapi?key=" + CONFIG.googleJsApiKey, function() {
return google.load('maps', 3, {
callback: callback,
other_params: 'sensor=false&language=en'
});
});
}
};
UberView.prototype.select_drop_down = function(model, key) {
var value;
value = model.get(key);
if (value) {
return $("select[id='" + key + "'] option[value='" + value + "']").attr('selected', 'selected');
}
};
UberView.prototype.processDocumentUpload = function(e) {
var $fi, $form, arbData, curDate, data, expDate, expM, expY, expiration, fileElementId, invalid;
e.preventDefault();
$form = $(e.currentTarget);
$fi = $("input[type=file]", $form);
$(".validationError").removeClass("validationError");
if (!$fi.val()) {
return $fi.addClass("validationError");
} else {
fileElementId = $fi.attr('id');
expY = $("select[name=expiration-year]", $form).val();
expM = $("select[name=expiration-month]", $form).val();
invalid = false;
if (expY && expM) {
expDate = new Date(expY, expM, 28);
curDate = new Date();
if (expDate < curDate) {
invalid = true;
$(".expiration", $form).addClass("validationError");
}
expiration = "" + expY + "-" + expM + "-28T23:59:59Z";
}
arbData = {};
$(".arbitraryField", $form).each(__bind(function(i, e) {
arbData[$(e).attr('name')] = $(e).val();
if ($(e).val() === "") {
invalid = true;
return $(e).addClass("validationError");
}
}, this));
if (!invalid) {
data = {
token: $.cookie('token') || USER.get('token'),
name: $("input[name=fileName]", $form).val(),
meta: escape(JSON.stringify(arbData)),
user_id: $("input[name=driver_id]", $form).val(),
vehicle_id: $("input[name=vehicle_id]", $form).val()
};
if (expiration) {
data['expiration'] = expiration;
}
$("#spinner").show();
return $.ajaxFileUpload({
url: '/api/documents',
secureuri: false,
fileElementId: fileElementId,
data: data,
complete: __bind(function(resp, status) {
var key, _i, _len, _ref, _results;
$("#spinner").hide();
if (status === "success") {
if (this.model) {
this.model.refetch();
} else {
USER.refetch();
}
}
if (status === "error") {
_ref = _.keys(resp);
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
key = _ref[_i];
_results.push($("*[name=" + key + "]", $form).addClass("validationError"));
}
return _results;
}
}, this)
});
}
}
};
return UberView;
})();
}).call(this);
}, "web-lib/views/footer": function(exports, require, module) {(function() {
var footerTemplate;
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
};
footerTemplate = require('web-lib/templates/footer');
exports.SharedFooterView = (function() {
__extends(SharedFooterView, Backbone.View);
function SharedFooterView() {
SharedFooterView.__super__.constructor.apply(this, arguments);
}
SharedFooterView.prototype.id = 'footer_view';
SharedFooterView.prototype.events = {
'click .language': 'intl_set_cookie_locale'
};
SharedFooterView.prototype.render = function() {
$(this.el).html(footerTemplate());
this.delegateEvents();
return this;
};
SharedFooterView.prototype.intl_set_cookie_locale = function(e) {
var _ref;
i18n.setLocale(e != null ? (_ref = e.srcElement) != null ? _ref.id : void 0 : void 0);
return location.reload();
};
return SharedFooterView;
})();
}).call(this);
}});
|
ui/src/js/password/resetPassword/SendRequest.js | Dica-Developer/weplantaforest | import axios from 'axios';
import counterpart from 'counterpart';
import he from 'he';
import React, { Component } from 'react';
import IconButton from '../../common/components/IconButton';
import InputText from '../../common/components/InputText';
import Notification from '../../common/components/Notification';
export default class SendRequest extends Component {
constructor(props) {
super(props);
this.state = {
passwordOne: '',
passwordTwo: '',
name: '',
linkValid: false,
headLine: ''
};
}
componentDidMount() {
var that = this;
axios
.post('http://localhost:8081/password_reset_verify' + this.props.search + '&language=' + localStorage.getItem('language'))
.then(function(response) {
var headLine = 'Passwortänderung für ' + he.encode(response.data);
that.setState({ headLine: headLine, linkValid: true });
})
.catch(function(response) {
that.setState({ headLine: counterpart.translate(response.data.errorInfos[0].errorCode), linkValid: false });
});
}
updateValue(toUpdate, value) {
this.setState({
[toUpdate]: value
});
}
resetPassword() {
if (this.state.passwordOne != this.state.passwordTwo) {
this.refs.notification.addNotification('Passwörter stimmen nicht überein!', 'Das angegebene Passwort stimmt nicht mit der Bestätigung überein.', 'error');
} else if (this.state.passwordOne.length < 6) {
this.refs.notification.addNotification('Passwort zu kurz!', 'Das angegebene Passwort ist zu kurz, verwende bitte mind. 6 Zeichen', 'error');
} else {
var that = this;
axios
.post('http://localhost:8081/password_reset' + this.props.search + '&language=' + localStorage.getItem('language') + '&password=' + encodeURIComponent(this.state.passwordOne))
.then(function(response) {
that.props.setResetted();
})
.catch(function(response) {
// that.refs.notification.addNotification('Fehler beim Zurücksetzen des Passworts!', response.data, 'error');
that.refs.notification.handleError(response);
});
}
}
render() {
var headLine = this.state.headLine;
var inputForm;
if (this.state.linkValid) {
inputForm = (
<div className="form">
Gib hier dein neues Passwort an, verwende bitte mind. 6 Zeichen.
<br />
<br />
Passwort:
<InputText type="password" toUpdate="passwordOne" updateValue={this.updateValue.bind(this)} />
Passwort(Bestätigen):
<InputText type="password" toUpdate="passwordTwo" updateValue={this.updateValue.bind(this)} />
<br />
<IconButton text="PASSWORT ZURÜCKSETZEN" glyphIcon="glyphicon-cog" onClick={this.resetPassword.bind(this)} />
</div>
);
} else {
inputForm = '';
}
return (
<div className="col-md-12">
<h1>{headLine}</h1>
{inputForm}
<Notification ref="notification" />
</div>
);
}
}
/* vim: set softtabstop=2:shiftwidth=2:expandtab */
|
src/react/installation/pages/Step7.component.js | formtools/core | import React, { Component } from 'react';
import { withRouter } from 'react-router-dom';
import styles from '../Layout/Layout.scss';
import Button from '../../components/Buttons';
import { NotificationPanel } from '../../components';
class Step7 extends Component {
constructor (props) {
super(props);
this.notificationPanel = React.createRef();
}
componentDidMount () {
const { i18n } = this.props;
this.notificationPanel.current.add({
msg: i18n.text_ft_installed,
msgType: 'notify',
showCloseIcon: false
});
}
login () {
window.location = '../';
}
render () {
const { i18n } = this.props;
return (
<>
<h2>{i18n.phrase_clean_up}</h2>
<NotificationPanel ref={this.notificationPanel} />
<p>
<Button onClick={this.login}>{i18n.text_log_in_to_ft} »</Button>
</p>
<div className={styles.divider} />
<p><b>{i18n.phrase_getting_started.toUpperCase()}</b></p>
<ul>
<li>
<a href="https://docs.formtools.org/tutorials/adding_first_form/" target="_blank" rel="noopener noreferrer">{i18n.text_tutorial_adding_first_form}</a>
</li>
<li>
<a href="https://docs.formtools.org/" target="_blank" rel="noopener noreferrer">{i18n.text_review_user_doc}</a>
</li>
</ul>
</>
);
}
}
export default withRouter(Step7);
|
admin/client/App/components/Navigation/Mobile/SectionItem.js | andrewlinfoot/keystone | /**
* A mobile section
*/
import React from 'react';
import MobileListItem from './ListItem';
import { Link } from 'react-router';
const MobileSectionItem = React.createClass({
displayName: 'MobileSectionItem',
propTypes: {
children: React.PropTypes.node.isRequired,
className: React.PropTypes.string,
currentListKey: React.PropTypes.string,
href: React.PropTypes.string.isRequired,
lists: React.PropTypes.array,
},
// Render the lists
renderLists () {
if (!this.props.lists || this.props.lists.length <= 1) return null;
const navLists = this.props.lists.map((item) => {
// Get the link and the classname
const href = item.external ? item.path : `${Keystone.adminPath}/${item.path}`;
const className = (this.props.currentListKey && this.props.currentListKey === item.path) ? 'MobileNavigation__list-item is-active' : 'MobileNavigation__list-item';
return (
<MobileListItem key={item.path} href={href} className={className} onClick={this.props.onClick}>
{item.label}
</MobileListItem>
);
});
return (
<div className="MobileNavigation__lists">
{navLists}
</div>
);
},
render () {
return (
<div className={this.props.className}>
<Link
className="MobileNavigation__section-item"
to={this.props.href}
tabIndex="-1"
onClick={this.props.onClick}
>
{this.props.children}
</Link>
{this.renderLists()}
</div>
);
},
});
module.exports = MobileSectionItem;
|
wrappers/toml.js | rileyjshaw/crypto.christmas | import React from 'react'
import toml from 'toml-js'
import Helmet from 'react-helmet'
import {config} from 'config'
module.exports = React.createClass({
propTypes () {
return {
route: React.PropTypes.object,
}
},
render () {
const data = this.props.route.page.data
return (
<div>
<Helmet
title={`${config.siteTitle} | ${data.title}`}
/>
<h1>{data.title}</h1>
<p>Raw view of toml file</p>
<pre dangerouslySetInnerHTML={{ __html: toml.dump(data) }} />
</div>
)
},
})
|
src/js/components/icons/base/DocumentPowerpoint.js | codeswan/grommet | import React from 'react';
import DocumentPpt from './DocumentPpt';
export default (props) => {
console.warn(
'DocumentPowerpoint has been renamed to DocumentPpt.' +
' Plese update your import statement.'
);
return <DocumentPpt {...props} />;
};
|
stories/BottomNavBar.stories.js | nekuno/client | import React from 'react';
import { storiesOf } from '@storybook/react';
import { action } from '@storybook/addon-actions';
import { linkTo } from '@storybook/addon-links'
import BottomNavBar from '../src/js/components/BottomNavBar/BottomNavBar.js';
storiesOf('BottomNavBar', module)
.add('with proposals as current', () => (
<div>
<div style={{height: '100vh'}}>Lorem ipsum</div>
<BottomNavBar current={'proposals'}/>
</div>
))
.add('with persons as current and 1 notification', () => (
<div>
<div style={{height: '100vh'}}>Lorem ipsum</div>
<BottomNavBar current={'persons'} notifications={1}/>
</div>
))
.add('with plans as current and 20 notifications', () => (
<div>
<div style={{height: '100vh'}}>Lorem ipsum</div>
<BottomNavBar current={'plans'} notifications={20}/>
</div>
))
.add('with messages as current and 100 notifications', () => (
<div>
<div style={{height: '100vh'}}>Lorem ipsum</div>
<BottomNavBar current={'messages'} notifications={100}/>
</div>
)); |
src/svg-icons/device/battery-std.js | ruifortes/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let DeviceBatteryStd = (props) => (
<SvgIcon {...props}>
<path d="M15.67 4H14V2h-4v2H8.33C7.6 4 7 4.6 7 5.33v15.33C7 21.4 7.6 22 8.33 22h7.33c.74 0 1.34-.6 1.34-1.33V5.33C17 4.6 16.4 4 15.67 4z"/>
</SvgIcon>
);
DeviceBatteryStd = pure(DeviceBatteryStd);
DeviceBatteryStd.displayName = 'DeviceBatteryStd';
DeviceBatteryStd.muiName = 'SvgIcon';
export default DeviceBatteryStd;
|
app/javascript/mastodon/components/__tests__/avatar-test.js | cybrespace/mastodon | import React from 'react';
import renderer from 'react-test-renderer';
import { fromJS } from 'immutable';
import Avatar from '../avatar';
describe('<Avatar />', () => {
const account = fromJS({
username: 'alice',
acct: 'alice',
display_name: 'Alice',
avatar: '/animated/alice.gif',
avatar_static: '/static/alice.jpg',
});
const size = 100;
describe('Autoplay', () => {
it('renders a animated avatar', () => {
const component = renderer.create(<Avatar account={account} animate size={size} />);
const tree = component.toJSON();
expect(tree).toMatchSnapshot();
});
});
describe('Still', () => {
it('renders a still avatar', () => {
const component = renderer.create(<Avatar account={account} size={size} />);
const tree = component.toJSON();
expect(tree).toMatchSnapshot();
});
});
// TODO add autoplay test if possible
});
|
files/react/0.13.1/JSXTransformer.js | unpete/jsdelivr | /**
* JSXTransformer v0.13.1
*/
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.JSXTransformer = 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){
/**
* 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.
*/
/* jshint browser: true */
/* jslint evil: true */
/*eslint-disable no-eval */
/*eslint-disable block-scoped-var */
'use strict';
var ReactTools = _dereq_('../main');
var inlineSourceMap = _dereq_('./inline-source-map');
var headEl;
var dummyAnchor;
var inlineScriptCount = 0;
// The source-map library relies on Object.defineProperty, but IE8 doesn't
// support it fully even with es5-sham. Indeed, es5-sham's defineProperty
// throws when Object.prototype.__defineGetter__ is missing, so we skip building
// the source map in that case.
var supportsAccessors = Object.prototype.hasOwnProperty('__defineGetter__');
/**
* Run provided code through jstransform.
*
* @param {string} source Original source code
* @param {object?} options Options to pass to jstransform
* @return {object} object as returned from jstransform
*/
function transformReact(source, options) {
options = options || {};
// Force the sourcemaps option manually. We don't want to use it if it will
// break (see above note about supportsAccessors). We'll only override the
// value here if sourceMap was specified and is truthy. This guarantees that
// we won't override any user intent (since this method is exposed publicly).
if (options.sourceMap) {
options.sourceMap = supportsAccessors;
}
// Otherwise just pass all options straight through to react-tools.
return ReactTools.transformWithDetails(source, options);
}
/**
* Eval provided source after transforming it.
*
* @param {string} source Original source code
* @param {object?} options Options to pass to jstransform
*/
function exec(source, options) {
return eval(transformReact(source, options).code);
}
/**
* This method returns a nicely formated line of code pointing to the exact
* location of the error `e`. The line is limited in size so big lines of code
* are also shown in a readable way.
*
* Example:
* ... x', overflow:'scroll'}} id={} onScroll={this.scroll} class=" ...
* ^
*
* @param {string} code The full string of code
* @param {Error} e The error being thrown
* @return {string} formatted message
* @internal
*/
function createSourceCodeErrorMessage(code, e) {
var sourceLines = code.split('\n');
// e.lineNumber is non-standard so we can't depend on its availability. If
// we're in a browser where it isn't supported, don't even bother trying to
// format anything. We may also hit a case where the line number is reported
// incorrectly and is outside the bounds of the actual code. Handle that too.
if (!e.lineNumber || e.lineNumber > sourceLines.length) {
return '';
}
var erroneousLine = sourceLines[e.lineNumber - 1];
// Removes any leading indenting spaces and gets the number of
// chars indenting the `erroneousLine`
var indentation = 0;
erroneousLine = erroneousLine.replace(/^\s+/, function(leadingSpaces) {
indentation = leadingSpaces.length;
return '';
});
// Defines the number of characters that are going to show
// before and after the erroneous code
var LIMIT = 30;
var errorColumn = e.column - indentation;
if (errorColumn > LIMIT) {
erroneousLine = '... ' + erroneousLine.slice(errorColumn - LIMIT);
errorColumn = 4 + LIMIT;
}
if (erroneousLine.length - errorColumn > LIMIT) {
erroneousLine = erroneousLine.slice(0, errorColumn + LIMIT) + ' ...';
}
var message = '\n\n' + erroneousLine + '\n';
message += new Array(errorColumn - 1).join(' ') + '^';
return message;
}
/**
* Actually transform the code.
*
* @param {string} code
* @param {string?} url
* @param {object?} options
* @return {string} The transformed code.
* @internal
*/
function transformCode(code, url, options) {
try {
var transformed = transformReact(code, options);
} catch(e) {
e.message += '\n at ';
if (url) {
if ('fileName' in e) {
// We set `fileName` if it's supported by this error object and
// a `url` was provided.
// The error will correctly point to `url` in Firefox.
e.fileName = url;
}
e.message += url + ':' + e.lineNumber + ':' + e.columnNumber;
} else {
e.message += location.href;
}
e.message += createSourceCodeErrorMessage(code, e);
throw e;
}
if (!transformed.sourceMap) {
return transformed.code;
}
var source;
if (url == null) {
source = 'Inline JSX script';
inlineScriptCount++;
if (inlineScriptCount > 1) {
source += ' (' + inlineScriptCount + ')';
}
} else if (dummyAnchor) {
// Firefox has problems when the sourcemap source is a proper URL with a
// protocol and hostname, so use the pathname. We could use just the
// filename, but hopefully using the full path will prevent potential
// issues where the same filename exists in multiple directories.
dummyAnchor.href = url;
source = dummyAnchor.pathname.substr(1);
}
return (
transformed.code +
'\n' +
inlineSourceMap(transformed.sourceMap, code, source)
);
}
/**
* Appends a script element at the end of the <head> with the content of code,
* after transforming it.
*
* @param {string} code The original source code
* @param {string?} url Where the code came from. null if inline
* @param {object?} options Options to pass to jstransform
* @internal
*/
function run(code, url, options) {
var scriptEl = document.createElement('script');
scriptEl.text = transformCode(code, url, options);
headEl.appendChild(scriptEl);
}
/**
* Load script from the provided url and pass the content to the callback.
*
* @param {string} url The location of the script src
* @param {function} callback Function to call with the content of url
* @internal
*/
function load(url, successCallback, errorCallback) {
var xhr;
xhr = window.ActiveXObject ? new window.ActiveXObject('Microsoft.XMLHTTP')
: new XMLHttpRequest();
// async, however scripts will be executed in the order they are in the
// DOM to mirror normal script loading.
xhr.open('GET', url, true);
if ('overrideMimeType' in xhr) {
xhr.overrideMimeType('text/plain');
}
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
if (xhr.status === 0 || xhr.status === 200) {
successCallback(xhr.responseText);
} else {
errorCallback();
throw new Error('Could not load ' + url);
}
}
};
return xhr.send(null);
}
/**
* Loop over provided script tags and get the content, via innerHTML if an
* inline script, or by using XHR. Transforms are applied if needed. The scripts
* are executed in the order they are found on the page.
*
* @param {array} scripts The <script> elements to load and run.
* @internal
*/
function loadScripts(scripts) {
var result = [];
var count = scripts.length;
function check() {
var script, i;
for (i = 0; i < count; i++) {
script = result[i];
if (script.loaded && !script.executed) {
script.executed = true;
run(script.content, script.url, script.options);
} else if (!script.loaded && !script.error && !script.async) {
break;
}
}
}
scripts.forEach(function(script, i) {
var options = {
sourceMap: true
};
if (/;harmony=true(;|$)/.test(script.type)) {
options.harmony = true;
}
if (/;stripTypes=true(;|$)/.test(script.type)) {
options.stripTypes = true;
}
// script.async is always true for non-javascript script tags
var async = script.hasAttribute('async');
if (script.src) {
result[i] = {
async: async,
error: false,
executed: false,
content: null,
loaded: false,
url: script.src,
options: options
};
load(script.src, function(content) {
result[i].loaded = true;
result[i].content = content;
check();
}, function() {
result[i].error = true;
check();
});
} else {
result[i] = {
async: async,
error: false,
executed: false,
content: script.innerHTML,
loaded: true,
url: null,
options: options
};
}
});
check();
}
/**
* Find and run all script tags with type="text/jsx".
*
* @internal
*/
function runScripts() {
var scripts = document.getElementsByTagName('script');
// Array.prototype.slice cannot be used on NodeList on IE8
var jsxScripts = [];
for (var i = 0; i < scripts.length; i++) {
if (/^text\/jsx(;|$)/.test(scripts.item(i).type)) {
jsxScripts.push(scripts.item(i));
}
}
if (jsxScripts.length < 1) {
return;
}
console.warn(
'You are using the in-browser JSX transformer. Be sure to precompile ' +
'your JSX for production - ' +
'http://facebook.github.io/react/docs/tooling-integration.html#jsx'
);
loadScripts(jsxScripts);
}
// Listen for load event if we're in a browser and then kick off finding and
// running of scripts.
if (typeof window !== 'undefined' && window !== null) {
headEl = document.getElementsByTagName('head')[0];
dummyAnchor = document.createElement('a');
if (window.addEventListener) {
window.addEventListener('DOMContentLoaded', runScripts, false);
} else {
window.attachEvent('onload', runScripts);
}
}
module.exports = {
transform: transformReact,
exec: exec
};
},{"../main":2,"./inline-source-map":41}],2:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
'use strict';
/*eslint-disable no-undef*/
var visitors = _dereq_('./vendor/fbtransform/visitors');
var transform = _dereq_('jstransform').transform;
var typesSyntax = _dereq_('jstransform/visitors/type-syntax');
var inlineSourceMap = _dereq_('./vendor/inline-source-map');
module.exports = {
transform: function(input, options) {
options = processOptions(options);
var output = innerTransform(input, options);
var result = output.code;
if (options.sourceMap) {
var map = inlineSourceMap(
output.sourceMap,
input,
options.filename
);
result += '\n' + map;
}
return result;
},
transformWithDetails: function(input, options) {
options = processOptions(options);
var output = innerTransform(input, options);
var result = {};
result.code = output.code;
if (options.sourceMap) {
result.sourceMap = output.sourceMap.toJSON();
}
if (options.filename) {
result.sourceMap.sources = [options.filename];
}
return result;
}
};
/**
* Only copy the values that we need. We'll do some preprocessing to account for
* converting command line flags to options that jstransform can actually use.
*/
function processOptions(opts) {
opts = opts || {};
var options = {};
options.harmony = opts.harmony;
options.stripTypes = opts.stripTypes;
options.sourceMap = opts.sourceMap;
options.filename = opts.sourceFilename;
if (opts.es6module) {
options.sourceType = 'module';
}
if (opts.nonStrictEs6module) {
options.sourceType = 'nonStrictModule';
}
// Instead of doing any fancy validation, only look for 'es3'. If we have
// that, then use it. Otherwise use 'es5'.
options.es3 = opts.target === 'es3';
options.es5 = !options.es3;
return options;
}
function innerTransform(input, options) {
var visitorSets = ['react'];
if (options.harmony) {
visitorSets.push('harmony');
}
if (options.es3) {
visitorSets.push('es3');
}
if (options.stripTypes) {
// Stripping types needs to happen before the other transforms
// unfortunately, due to bad interactions. For example,
// es6-rest-param-visitors conflict with stripping rest param type
// annotation
input = transform(typesSyntax.visitorList, input, options).code;
}
var visitorList = visitors.getVisitorsBySet(visitorSets);
return transform(visitorList, input, options);
}
},{"./vendor/fbtransform/visitors":40,"./vendor/inline-source-map":41,"jstransform":22,"jstransform/visitors/type-syntax":36}],3:[function(_dereq_,module,exports){
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
* @license MIT
*/
var base64 = _dereq_('base64-js')
var ieee754 = _dereq_('ieee754')
var isArray = _dereq_('is-array')
exports.Buffer = Buffer
exports.SlowBuffer = SlowBuffer
exports.INSPECT_MAX_BYTES = 50
Buffer.poolSize = 8192 // not used by this implementation
var kMaxLength = 0x3fffffff
var rootParent = {}
/**
* If `Buffer.TYPED_ARRAY_SUPPORT`:
* === true Use Uint8Array implementation (fastest)
* === false Use Object implementation (most compatible, even IE6)
*
* Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
* Opera 11.6+, iOS 4.2+.
*
* Note:
*
* - Implementation must support adding new properties to `Uint8Array` instances.
* Firefox 4-29 lacked support, fixed in Firefox 30+.
* See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
*
* - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
*
* - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
* incorrect length in some situations.
*
* We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they will
* get the Object implementation, which is slower but will work correctly.
*/
Buffer.TYPED_ARRAY_SUPPORT = (function () {
try {
var buf = new ArrayBuffer(0)
var arr = new Uint8Array(buf)
arr.foo = function () { return 42 }
return arr.foo() === 42 && // typed array instances can be augmented
typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
new Uint8Array(1).subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
} catch (e) {
return false
}
})()
/**
* Class: Buffer
* =============
*
* The Buffer constructor returns instances of `Uint8Array` that are augmented
* with function properties for all the node `Buffer` API functions. We use
* `Uint8Array` so that square bracket notation works as expected -- it returns
* a single octet.
*
* By augmenting the instances, we can avoid modifying the `Uint8Array`
* prototype.
*/
function Buffer (subject, encoding, noZero) {
if (!(this instanceof Buffer)) return new Buffer(subject, encoding, noZero)
var type = typeof subject
var length
if (type === 'number') {
length = +subject
} else if (type === 'string') {
length = Buffer.byteLength(subject, encoding)
} else if (type === 'object' && subject !== null) {
// assume object is array-like
if (subject.type === 'Buffer' && isArray(subject.data)) subject = subject.data
length = +subject.length
} else {
throw new TypeError('must start with number, buffer, array or string')
}
if (length > kMaxLength) {
throw new RangeError('Attempt to allocate Buffer larger than maximum size: 0x' +
kMaxLength.toString(16) + ' bytes')
}
if (length < 0) length = 0
else length >>>= 0 // coerce to uint32
var self = this
if (Buffer.TYPED_ARRAY_SUPPORT) {
// Preferred: Return an augmented `Uint8Array` instance for best performance
/*eslint-disable consistent-this */
self = Buffer._augment(new Uint8Array(length))
/*eslint-enable consistent-this */
} else {
// Fallback: Return THIS instance of Buffer (created by `new`)
self.length = length
self._isBuffer = true
}
var i
if (Buffer.TYPED_ARRAY_SUPPORT && typeof subject.byteLength === 'number') {
// Speed optimization -- use set if we're copying from a typed array
self._set(subject)
} else if (isArrayish(subject)) {
// Treat array-ish objects as a byte array
if (Buffer.isBuffer(subject)) {
for (i = 0; i < length; i++) {
self[i] = subject.readUInt8(i)
}
} else {
for (i = 0; i < length; i++) {
self[i] = ((subject[i] % 256) + 256) % 256
}
}
} else if (type === 'string') {
self.write(subject, 0, encoding)
} else if (type === 'number' && !Buffer.TYPED_ARRAY_SUPPORT && !noZero) {
for (i = 0; i < length; i++) {
self[i] = 0
}
}
if (length > 0 && length <= Buffer.poolSize) self.parent = rootParent
return self
}
function SlowBuffer (subject, encoding, noZero) {
if (!(this instanceof SlowBuffer)) return new SlowBuffer(subject, encoding, noZero)
var buf = new Buffer(subject, encoding, noZero)
delete buf.parent
return buf
}
Buffer.isBuffer = function isBuffer (b) {
return !!(b != null && b._isBuffer)
}
Buffer.compare = function compare (a, b) {
if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
throw new TypeError('Arguments must be Buffers')
}
if (a === b) return 0
var x = a.length
var y = b.length
for (var i = 0, len = Math.min(x, y); i < len && a[i] === b[i]; i++) {}
if (i !== len) {
x = a[i]
y = b[i]
}
if (x < y) return -1
if (y < x) return 1
return 0
}
Buffer.isEncoding = function isEncoding (encoding) {
switch (String(encoding).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 true
default:
return false
}
}
Buffer.concat = function concat (list, totalLength) {
if (!isArray(list)) throw new TypeError('Usage: Buffer.concat(list[, length])')
if (list.length === 0) {
return new Buffer(0)
} else if (list.length === 1) {
return list[0]
}
var i
if (totalLength === undefined) {
totalLength = 0
for (i = 0; i < list.length; i++) {
totalLength += list[i].length
}
}
var buf = new Buffer(totalLength)
var pos = 0
for (i = 0; i < list.length; i++) {
var item = list[i]
item.copy(buf, pos)
pos += item.length
}
return buf
}
Buffer.byteLength = function byteLength (str, encoding) {
var ret
str = str + ''
switch (encoding || 'utf8') {
case 'ascii':
case 'binary':
case 'raw':
ret = str.length
break
case 'ucs2':
case 'ucs-2':
case 'utf16le':
case 'utf-16le':
ret = str.length * 2
break
case 'hex':
ret = str.length >>> 1
break
case 'utf8':
case 'utf-8':
ret = utf8ToBytes(str).length
break
case 'base64':
ret = base64ToBytes(str).length
break
default:
ret = str.length
}
return ret
}
// pre-set for values that may exist in the future
Buffer.prototype.length = undefined
Buffer.prototype.parent = undefined
// toString(encoding, start=0, end=buffer.length)
Buffer.prototype.toString = function toString (encoding, start, end) {
var loweredCase = false
start = start >>> 0
end = end === undefined || end === Infinity ? this.length : end >>> 0
if (!encoding) encoding = 'utf8'
if (start < 0) start = 0
if (end > this.length) end = this.length
if (end <= start) return ''
while (true) {
switch (encoding) {
case 'hex':
return hexSlice(this, start, end)
case 'utf8':
case 'utf-8':
return utf8Slice(this, start, end)
case 'ascii':
return asciiSlice(this, start, end)
case 'binary':
return binarySlice(this, start, end)
case 'base64':
return base64Slice(this, start, end)
case 'ucs2':
case 'ucs-2':
case 'utf16le':
case 'utf-16le':
return utf16leSlice(this, start, end)
default:
if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
encoding = (encoding + '').toLowerCase()
loweredCase = true
}
}
}
Buffer.prototype.equals = function equals (b) {
if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
if (this === b) return true
return Buffer.compare(this, b) === 0
}
Buffer.prototype.inspect = function inspect () {
var str = ''
var max = exports.INSPECT_MAX_BYTES
if (this.length > 0) {
str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
if (this.length > max) str += ' ... '
}
return '<Buffer ' + str + '>'
}
Buffer.prototype.compare = function compare (b) {
if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
if (this === b) return 0
return Buffer.compare(this, b)
}
Buffer.prototype.indexOf = function indexOf (val, byteOffset) {
if (byteOffset > 0x7fffffff) byteOffset = 0x7fffffff
else if (byteOffset < -0x80000000) byteOffset = -0x80000000
byteOffset >>= 0
if (this.length === 0) return -1
if (byteOffset >= this.length) return -1
// Negative offsets start from the end of the buffer
if (byteOffset < 0) byteOffset = Math.max(this.length + byteOffset, 0)
if (typeof val === 'string') {
if (val.length === 0) return -1 // special case: looking for empty string always fails
return String.prototype.indexOf.call(this, val, byteOffset)
}
if (Buffer.isBuffer(val)) {
return arrayIndexOf(this, val, byteOffset)
}
if (typeof val === 'number') {
if (Buffer.TYPED_ARRAY_SUPPORT && Uint8Array.prototype.indexOf === 'function') {
return Uint8Array.prototype.indexOf.call(this, val, byteOffset)
}
return arrayIndexOf(this, [ val ], byteOffset)
}
function arrayIndexOf (arr, val, byteOffset) {
var foundIndex = -1
for (var i = 0; byteOffset + i < arr.length; i++) {
if (arr[byteOffset + i] === val[foundIndex === -1 ? 0 : i - foundIndex]) {
if (foundIndex === -1) foundIndex = i
if (i - foundIndex + 1 === val.length) return byteOffset + foundIndex
} else {
foundIndex = -1
}
}
return -1
}
throw new TypeError('val must be string, number or Buffer')
}
// `get` will be removed in Node 0.13+
Buffer.prototype.get = function get (offset) {
console.log('.get() is deprecated. Access using array indexes instead.')
return this.readUInt8(offset)
}
// `set` will be removed in Node 0.13+
Buffer.prototype.set = function set (v, offset) {
console.log('.set() is deprecated. Access using array indexes instead.')
return this.writeUInt8(v, offset)
}
function hexWrite (buf, string, offset, length) {
offset = Number(offset) || 0
var remaining = buf.length - offset
if (!length) {
length = remaining
} else {
length = Number(length)
if (length > remaining) {
length = remaining
}
}
// must be an even number of digits
var strLen = string.length
if (strLen % 2 !== 0) throw new Error('Invalid hex string')
if (length > strLen / 2) {
length = strLen / 2
}
for (var i = 0; i < length; i++) {
var parsed = parseInt(string.substr(i * 2, 2), 16)
if (isNaN(parsed)) throw new Error('Invalid hex string')
buf[offset + i] = parsed
}
return i
}
function utf8Write (buf, string, offset, length) {
var charsWritten = blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
return charsWritten
}
function asciiWrite (buf, string, offset, length) {
var charsWritten = blitBuffer(asciiToBytes(string), buf, offset, length)
return charsWritten
}
function binaryWrite (buf, string, offset, length) {
return asciiWrite(buf, string, offset, length)
}
function base64Write (buf, string, offset, length) {
var charsWritten = blitBuffer(base64ToBytes(string), buf, offset, length)
return charsWritten
}
function utf16leWrite (buf, string, offset, length) {
var charsWritten = blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
return charsWritten
}
Buffer.prototype.write = function write (string, offset, length, encoding) {
// Support both (string, offset, length, encoding)
// and the legacy (string, encoding, offset, length)
if (isFinite(offset)) {
if (!isFinite(length)) {
encoding = length
length = undefined
}
} else { // legacy
var swap = encoding
encoding = offset
offset = length
length = swap
}
offset = Number(offset) || 0
if (length < 0 || offset < 0 || offset > this.length) {
throw new RangeError('attempt to write outside buffer bounds')
}
var remaining = this.length - offset
if (!length) {
length = remaining
} else {
length = Number(length)
if (length > remaining) {
length = remaining
}
}
encoding = String(encoding || 'utf8').toLowerCase()
var ret
switch (encoding) {
case 'hex':
ret = hexWrite(this, string, offset, length)
break
case 'utf8':
case 'utf-8':
ret = utf8Write(this, string, offset, length)
break
case 'ascii':
ret = asciiWrite(this, string, offset, length)
break
case 'binary':
ret = binaryWrite(this, string, offset, length)
break
case 'base64':
ret = base64Write(this, string, offset, length)
break
case 'ucs2':
case 'ucs-2':
case 'utf16le':
case 'utf-16le':
ret = utf16leWrite(this, string, offset, length)
break
default:
throw new TypeError('Unknown encoding: ' + encoding)
}
return ret
}
Buffer.prototype.toJSON = function toJSON () {
return {
type: 'Buffer',
data: Array.prototype.slice.call(this._arr || this, 0)
}
}
function base64Slice (buf, start, end) {
if (start === 0 && end === buf.length) {
return base64.fromByteArray(buf)
} else {
return base64.fromByteArray(buf.slice(start, end))
}
}
function utf8Slice (buf, start, end) {
var res = ''
var tmp = ''
end = Math.min(buf.length, end)
for (var i = start; i < end; i++) {
if (buf[i] <= 0x7F) {
res += decodeUtf8Char(tmp) + String.fromCharCode(buf[i])
tmp = ''
} else {
tmp += '%' + buf[i].toString(16)
}
}
return res + decodeUtf8Char(tmp)
}
function asciiSlice (buf, start, end) {
var ret = ''
end = Math.min(buf.length, end)
for (var i = start; i < end; i++) {
ret += String.fromCharCode(buf[i] & 0x7F)
}
return ret
}
function binarySlice (buf, start, end) {
var ret = ''
end = Math.min(buf.length, end)
for (var i = start; i < end; i++) {
ret += String.fromCharCode(buf[i])
}
return ret
}
function hexSlice (buf, start, end) {
var len = buf.length
if (!start || start < 0) start = 0
if (!end || end < 0 || end > len) end = len
var out = ''
for (var i = start; i < end; i++) {
out += toHex(buf[i])
}
return out
}
function utf16leSlice (buf, start, end) {
var bytes = buf.slice(start, end)
var res = ''
for (var i = 0; i < bytes.length; i += 2) {
res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
}
return res
}
Buffer.prototype.slice = function slice (start, end) {
var len = this.length
start = ~~start
end = end === undefined ? len : ~~end
if (start < 0) {
start += len
if (start < 0) start = 0
} else if (start > len) {
start = len
}
if (end < 0) {
end += len
if (end < 0) end = 0
} else if (end > len) {
end = len
}
if (end < start) end = start
var newBuf
if (Buffer.TYPED_ARRAY_SUPPORT) {
newBuf = Buffer._augment(this.subarray(start, end))
} else {
var sliceLen = end - start
newBuf = new Buffer(sliceLen, undefined, true)
for (var i = 0; i < sliceLen; i++) {
newBuf[i] = this[i + start]
}
}
if (newBuf.length) newBuf.parent = this.parent || this
return newBuf
}
/*
* Need to make sure that buffer isn't trying to write out of bounds.
*/
function checkOffset (offset, ext, length) {
if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
}
Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
offset = offset >>> 0
byteLength = byteLength >>> 0
if (!noAssert) checkOffset(offset, byteLength, this.length)
var val = this[offset]
var mul = 1
var i = 0
while (++i < byteLength && (mul *= 0x100)) {
val += this[offset + i] * mul
}
return val
}
Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
offset = offset >>> 0
byteLength = byteLength >>> 0
if (!noAssert) {
checkOffset(offset, byteLength, this.length)
}
var val = this[offset + --byteLength]
var mul = 1
while (byteLength > 0 && (mul *= 0x100)) {
val += this[offset + --byteLength] * mul
}
return val
}
Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
if (!noAssert) checkOffset(offset, 1, this.length)
return this[offset]
}
Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
if (!noAssert) checkOffset(offset, 2, this.length)
return this[offset] | (this[offset + 1] << 8)
}
Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
if (!noAssert) checkOffset(offset, 2, this.length)
return (this[offset] << 8) | this[offset + 1]
}
Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
if (!noAssert) checkOffset(offset, 4, this.length)
return ((this[offset]) |
(this[offset + 1] << 8) |
(this[offset + 2] << 16)) +
(this[offset + 3] * 0x1000000)
}
Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
if (!noAssert) checkOffset(offset, 4, this.length)
return (this[offset] * 0x1000000) +
((this[offset + 1] << 16) |
(this[offset + 2] << 8) |
this[offset + 3])
}
Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
offset = offset >>> 0
byteLength = byteLength >>> 0
if (!noAssert) checkOffset(offset, byteLength, this.length)
var val = this[offset]
var mul = 1
var i = 0
while (++i < byteLength && (mul *= 0x100)) {
val += this[offset + i] * mul
}
mul *= 0x80
if (val >= mul) val -= Math.pow(2, 8 * byteLength)
return val
}
Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
offset = offset >>> 0
byteLength = byteLength >>> 0
if (!noAssert) checkOffset(offset, byteLength, this.length)
var i = byteLength
var mul = 1
var val = this[offset + --i]
while (i > 0 && (mul *= 0x100)) {
val += this[offset + --i] * mul
}
mul *= 0x80
if (val >= mul) val -= Math.pow(2, 8 * byteLength)
return val
}
Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
if (!noAssert) checkOffset(offset, 1, this.length)
if (!(this[offset] & 0x80)) return (this[offset])
return ((0xff - this[offset] + 1) * -1)
}
Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
if (!noAssert) checkOffset(offset, 2, this.length)
var val = this[offset] | (this[offset + 1] << 8)
return (val & 0x8000) ? val | 0xFFFF0000 : val
}
Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
if (!noAssert) checkOffset(offset, 2, this.length)
var val = this[offset + 1] | (this[offset] << 8)
return (val & 0x8000) ? val | 0xFFFF0000 : val
}
Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
if (!noAssert) checkOffset(offset, 4, this.length)
return (this[offset]) |
(this[offset + 1] << 8) |
(this[offset + 2] << 16) |
(this[offset + 3] << 24)
}
Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
if (!noAssert) checkOffset(offset, 4, this.length)
return (this[offset] << 24) |
(this[offset + 1] << 16) |
(this[offset + 2] << 8) |
(this[offset + 3])
}
Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
if (!noAssert) checkOffset(offset, 4, this.length)
return ieee754.read(this, offset, true, 23, 4)
}
Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
if (!noAssert) checkOffset(offset, 4, this.length)
return ieee754.read(this, offset, false, 23, 4)
}
Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
if (!noAssert) checkOffset(offset, 8, this.length)
return ieee754.read(this, offset, true, 52, 8)
}
Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
if (!noAssert) checkOffset(offset, 8, this.length)
return ieee754.read(this, offset, false, 52, 8)
}
function checkInt (buf, value, offset, ext, max, min) {
if (!Buffer.isBuffer(buf)) throw new TypeError('buffer must be a Buffer instance')
if (value > max || value < min) throw new RangeError('value is out of bounds')
if (offset + ext > buf.length) throw new RangeError('index out of range')
}
Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
value = +value
offset = offset >>> 0
byteLength = byteLength >>> 0
if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0)
var mul = 1
var i = 0
this[offset] = value & 0xFF
while (++i < byteLength && (mul *= 0x100)) {
this[offset + i] = (value / mul) >>> 0 & 0xFF
}
return offset + byteLength
}
Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
value = +value
offset = offset >>> 0
byteLength = byteLength >>> 0
if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0)
var i = byteLength - 1
var mul = 1
this[offset + i] = value & 0xFF
while (--i >= 0 && (mul *= 0x100)) {
this[offset + i] = (value / mul) >>> 0 & 0xFF
}
return offset + byteLength
}
Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
value = +value
offset = offset >>> 0
if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
this[offset] = value
return offset + 1
}
function objectWriteUInt16 (buf, value, offset, littleEndian) {
if (value < 0) value = 0xffff + value + 1
for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; i++) {
buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
(littleEndian ? i : 1 - i) * 8
}
}
Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
value = +value
offset = offset >>> 0
if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
if (Buffer.TYPED_ARRAY_SUPPORT) {
this[offset] = value
this[offset + 1] = (value >>> 8)
} else {
objectWriteUInt16(this, value, offset, true)
}
return offset + 2
}
Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
value = +value
offset = offset >>> 0
if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
if (Buffer.TYPED_ARRAY_SUPPORT) {
this[offset] = (value >>> 8)
this[offset + 1] = value
} else {
objectWriteUInt16(this, value, offset, false)
}
return offset + 2
}
function objectWriteUInt32 (buf, value, offset, littleEndian) {
if (value < 0) value = 0xffffffff + value + 1
for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; i++) {
buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
}
}
Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
value = +value
offset = offset >>> 0
if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
if (Buffer.TYPED_ARRAY_SUPPORT) {
this[offset + 3] = (value >>> 24)
this[offset + 2] = (value >>> 16)
this[offset + 1] = (value >>> 8)
this[offset] = value
} else {
objectWriteUInt32(this, value, offset, true)
}
return offset + 4
}
Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
value = +value
offset = offset >>> 0
if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
if (Buffer.TYPED_ARRAY_SUPPORT) {
this[offset] = (value >>> 24)
this[offset + 1] = (value >>> 16)
this[offset + 2] = (value >>> 8)
this[offset + 3] = value
} else {
objectWriteUInt32(this, value, offset, false)
}
return offset + 4
}
Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
value = +value
offset = offset >>> 0
if (!noAssert) {
checkInt(
this, value, offset, byteLength,
Math.pow(2, 8 * byteLength - 1) - 1,
-Math.pow(2, 8 * byteLength - 1)
)
}
var i = 0
var mul = 1
var sub = value < 0 ? 1 : 0
this[offset] = value & 0xFF
while (++i < byteLength && (mul *= 0x100)) {
this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
}
return offset + byteLength
}
Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
value = +value
offset = offset >>> 0
if (!noAssert) {
checkInt(
this, value, offset, byteLength,
Math.pow(2, 8 * byteLength - 1) - 1,
-Math.pow(2, 8 * byteLength - 1)
)
}
var i = byteLength - 1
var mul = 1
var sub = value < 0 ? 1 : 0
this[offset + i] = value & 0xFF
while (--i >= 0 && (mul *= 0x100)) {
this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
}
return offset + byteLength
}
Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
value = +value
offset = offset >>> 0
if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
if (value < 0) value = 0xff + value + 1
this[offset] = value
return offset + 1
}
Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
value = +value
offset = offset >>> 0
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
if (Buffer.TYPED_ARRAY_SUPPORT) {
this[offset] = value
this[offset + 1] = (value >>> 8)
} else {
objectWriteUInt16(this, value, offset, true)
}
return offset + 2
}
Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
value = +value
offset = offset >>> 0
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
if (Buffer.TYPED_ARRAY_SUPPORT) {
this[offset] = (value >>> 8)
this[offset + 1] = value
} else {
objectWriteUInt16(this, value, offset, false)
}
return offset + 2
}
Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
value = +value
offset = offset >>> 0
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
if (Buffer.TYPED_ARRAY_SUPPORT) {
this[offset] = value
this[offset + 1] = (value >>> 8)
this[offset + 2] = (value >>> 16)
this[offset + 3] = (value >>> 24)
} else {
objectWriteUInt32(this, value, offset, true)
}
return offset + 4
}
Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
value = +value
offset = offset >>> 0
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
if (value < 0) value = 0xffffffff + value + 1
if (Buffer.TYPED_ARRAY_SUPPORT) {
this[offset] = (value >>> 24)
this[offset + 1] = (value >>> 16)
this[offset + 2] = (value >>> 8)
this[offset + 3] = value
} else {
objectWriteUInt32(this, value, offset, false)
}
return offset + 4
}
function checkIEEE754 (buf, value, offset, ext, max, min) {
if (value > max || value < min) throw new RangeError('value is out of bounds')
if (offset + ext > buf.length) throw new RangeError('index out of range')
if (offset < 0) throw new RangeError('index out of range')
}
function writeFloat (buf, value, offset, littleEndian, noAssert) {
if (!noAssert) {
checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
}
ieee754.write(buf, value, offset, littleEndian, 23, 4)
return offset + 4
}
Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
return writeFloat(this, value, offset, true, noAssert)
}
Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
return writeFloat(this, value, offset, false, noAssert)
}
function writeDouble (buf, value, offset, littleEndian, noAssert) {
if (!noAssert) {
checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
}
ieee754.write(buf, value, offset, littleEndian, 52, 8)
return offset + 8
}
Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
return writeDouble(this, value, offset, true, noAssert)
}
Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
return writeDouble(this, value, offset, false, noAssert)
}
// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
Buffer.prototype.copy = function copy (target, target_start, start, end) {
var self = this // source
if (!start) start = 0
if (!end && end !== 0) end = this.length
if (target_start >= target.length) target_start = target.length
if (!target_start) target_start = 0
if (end > 0 && end < start) end = start
// Copy 0 bytes; we're done
if (end === start) return 0
if (target.length === 0 || self.length === 0) return 0
// Fatal error conditions
if (target_start < 0) {
throw new RangeError('targetStart out of bounds')
}
if (start < 0 || start >= self.length) throw new RangeError('sourceStart out of bounds')
if (end < 0) throw new RangeError('sourceEnd out of bounds')
// Are we oob?
if (end > this.length) end = this.length
if (target.length - target_start < end - start) {
end = target.length - target_start + start
}
var len = end - start
if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
for (var i = 0; i < len; i++) {
target[i + target_start] = this[i + start]
}
} else {
target._set(this.subarray(start, start + len), target_start)
}
return len
}
// fill(value, start=0, end=buffer.length)
Buffer.prototype.fill = function fill (value, start, end) {
if (!value) value = 0
if (!start) start = 0
if (!end) end = this.length
if (end < start) throw new RangeError('end < start')
// Fill 0 bytes; we're done
if (end === start) return
if (this.length === 0) return
if (start < 0 || start >= this.length) throw new RangeError('start out of bounds')
if (end < 0 || end > this.length) throw new RangeError('end out of bounds')
var i
if (typeof value === 'number') {
for (i = start; i < end; i++) {
this[i] = value
}
} else {
var bytes = utf8ToBytes(value.toString())
var len = bytes.length
for (i = start; i < end; i++) {
this[i] = bytes[i % len]
}
}
return this
}
/**
* Creates a new `ArrayBuffer` with the *copied* memory of the buffer instance.
* Added in Node 0.12. Only available in browsers that support ArrayBuffer.
*/
Buffer.prototype.toArrayBuffer = function toArrayBuffer () {
if (typeof Uint8Array !== 'undefined') {
if (Buffer.TYPED_ARRAY_SUPPORT) {
return (new Buffer(this)).buffer
} else {
var buf = new Uint8Array(this.length)
for (var i = 0, len = buf.length; i < len; i += 1) {
buf[i] = this[i]
}
return buf.buffer
}
} else {
throw new TypeError('Buffer.toArrayBuffer not supported in this browser')
}
}
// HELPER FUNCTIONS
// ================
var BP = Buffer.prototype
/**
* Augment a Uint8Array *instance* (not the Uint8Array class!) with Buffer methods
*/
Buffer._augment = function _augment (arr) {
arr.constructor = Buffer
arr._isBuffer = true
// save reference to original Uint8Array get/set methods before overwriting
arr._get = arr.get
arr._set = arr.set
// deprecated, will be removed in node 0.13+
arr.get = BP.get
arr.set = BP.set
arr.write = BP.write
arr.toString = BP.toString
arr.toLocaleString = BP.toString
arr.toJSON = BP.toJSON
arr.equals = BP.equals
arr.compare = BP.compare
arr.indexOf = BP.indexOf
arr.copy = BP.copy
arr.slice = BP.slice
arr.readUIntLE = BP.readUIntLE
arr.readUIntBE = BP.readUIntBE
arr.readUInt8 = BP.readUInt8
arr.readUInt16LE = BP.readUInt16LE
arr.readUInt16BE = BP.readUInt16BE
arr.readUInt32LE = BP.readUInt32LE
arr.readUInt32BE = BP.readUInt32BE
arr.readIntLE = BP.readIntLE
arr.readIntBE = BP.readIntBE
arr.readInt8 = BP.readInt8
arr.readInt16LE = BP.readInt16LE
arr.readInt16BE = BP.readInt16BE
arr.readInt32LE = BP.readInt32LE
arr.readInt32BE = BP.readInt32BE
arr.readFloatLE = BP.readFloatLE
arr.readFloatBE = BP.readFloatBE
arr.readDoubleLE = BP.readDoubleLE
arr.readDoubleBE = BP.readDoubleBE
arr.writeUInt8 = BP.writeUInt8
arr.writeUIntLE = BP.writeUIntLE
arr.writeUIntBE = BP.writeUIntBE
arr.writeUInt16LE = BP.writeUInt16LE
arr.writeUInt16BE = BP.writeUInt16BE
arr.writeUInt32LE = BP.writeUInt32LE
arr.writeUInt32BE = BP.writeUInt32BE
arr.writeIntLE = BP.writeIntLE
arr.writeIntBE = BP.writeIntBE
arr.writeInt8 = BP.writeInt8
arr.writeInt16LE = BP.writeInt16LE
arr.writeInt16BE = BP.writeInt16BE
arr.writeInt32LE = BP.writeInt32LE
arr.writeInt32BE = BP.writeInt32BE
arr.writeFloatLE = BP.writeFloatLE
arr.writeFloatBE = BP.writeFloatBE
arr.writeDoubleLE = BP.writeDoubleLE
arr.writeDoubleBE = BP.writeDoubleBE
arr.fill = BP.fill
arr.inspect = BP.inspect
arr.toArrayBuffer = BP.toArrayBuffer
return arr
}
var INVALID_BASE64_RE = /[^+\/0-9A-z\-]/g
function base64clean (str) {
// Node strips out invalid characters like \n and \t from the string, base64-js does not
str = stringtrim(str).replace(INVALID_BASE64_RE, '')
// Node converts strings with length < 2 to ''
if (str.length < 2) return ''
// Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
while (str.length % 4 !== 0) {
str = str + '='
}
return str
}
function stringtrim (str) {
if (str.trim) return str.trim()
return str.replace(/^\s+|\s+$/g, '')
}
function isArrayish (subject) {
return isArray(subject) || Buffer.isBuffer(subject) ||
subject && typeof subject === 'object' &&
typeof subject.length === 'number'
}
function toHex (n) {
if (n < 16) return '0' + n.toString(16)
return n.toString(16)
}
function utf8ToBytes (string, units) {
units = units || Infinity
var codePoint
var length = string.length
var leadSurrogate = null
var bytes = []
var i = 0
for (; i < length; i++) {
codePoint = string.charCodeAt(i)
// is surrogate component
if (codePoint > 0xD7FF && codePoint < 0xE000) {
// last char was a lead
if (leadSurrogate) {
// 2 leads in a row
if (codePoint < 0xDC00) {
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
leadSurrogate = codePoint
continue
} else {
// valid surrogate pair
codePoint = leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00 | 0x10000
leadSurrogate = null
}
} else {
// no lead yet
if (codePoint > 0xDBFF) {
// unexpected trail
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
continue
} else if (i + 1 === length) {
// unpaired lead
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
continue
} else {
// valid lead
leadSurrogate = codePoint
continue
}
}
} else if (leadSurrogate) {
// valid bmp char, but last char was a lead
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
leadSurrogate = null
}
// encode utf8
if (codePoint < 0x80) {
if ((units -= 1) < 0) break
bytes.push(codePoint)
} else if (codePoint < 0x800) {
if ((units -= 2) < 0) break
bytes.push(
codePoint >> 0x6 | 0xC0,
codePoint & 0x3F | 0x80
)
} else if (codePoint < 0x10000) {
if ((units -= 3) < 0) break
bytes.push(
codePoint >> 0xC | 0xE0,
codePoint >> 0x6 & 0x3F | 0x80,
codePoint & 0x3F | 0x80
)
} else if (codePoint < 0x200000) {
if ((units -= 4) < 0) break
bytes.push(
codePoint >> 0x12 | 0xF0,
codePoint >> 0xC & 0x3F | 0x80,
codePoint >> 0x6 & 0x3F | 0x80,
codePoint & 0x3F | 0x80
)
} else {
throw new Error('Invalid code point')
}
}
return bytes
}
function asciiToBytes (str) {
var byteArray = []
for (var i = 0; i < str.length; i++) {
// Node's code seems to be doing this and not & 0x7F..
byteArray.push(str.charCodeAt(i) & 0xFF)
}
return byteArray
}
function utf16leToBytes (str, units) {
var c, hi, lo
var byteArray = []
for (var i = 0; i < str.length; i++) {
if ((units -= 2) < 0) break
c = str.charCodeAt(i)
hi = c >> 8
lo = c % 256
byteArray.push(lo)
byteArray.push(hi)
}
return byteArray
}
function base64ToBytes (str) {
return base64.toByteArray(base64clean(str))
}
function blitBuffer (src, dst, offset, length) {
for (var i = 0; i < length; i++) {
if ((i + offset >= dst.length) || (i >= src.length)) break
dst[i + offset] = src[i]
}
return i
}
function decodeUtf8Char (str) {
try {
return decodeURIComponent(str)
} catch (err) {
return String.fromCharCode(0xFFFD) // UTF 8 invalid char
}
}
},{"base64-js":4,"ieee754":5,"is-array":6}],4:[function(_dereq_,module,exports){
var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
;(function (exports) {
'use strict';
var Arr = (typeof Uint8Array !== 'undefined')
? Uint8Array
: Array
var PLUS = '+'.charCodeAt(0)
var SLASH = '/'.charCodeAt(0)
var NUMBER = '0'.charCodeAt(0)
var LOWER = 'a'.charCodeAt(0)
var UPPER = 'A'.charCodeAt(0)
var PLUS_URL_SAFE = '-'.charCodeAt(0)
var SLASH_URL_SAFE = '_'.charCodeAt(0)
function decode (elt) {
var code = elt.charCodeAt(0)
if (code === PLUS ||
code === PLUS_URL_SAFE)
return 62 // '+'
if (code === SLASH ||
code === SLASH_URL_SAFE)
return 63 // '/'
if (code < NUMBER)
return -1 //no match
if (code < NUMBER + 10)
return code - NUMBER + 26 + 26
if (code < UPPER + 26)
return code - UPPER
if (code < LOWER + 26)
return code - LOWER + 26
}
function b64ToByteArray (b64) {
var i, j, l, tmp, placeHolders, arr
if (b64.length % 4 > 0) {
throw new Error('Invalid string. Length must be a multiple of 4')
}
// the number of equal signs (place holders)
// if there are two placeholders, than the two characters before it
// represent one byte
// if there is only one, then the three characters before it represent 2 bytes
// this is just a cheap hack to not do indexOf twice
var len = b64.length
placeHolders = '=' === b64.charAt(len - 2) ? 2 : '=' === b64.charAt(len - 1) ? 1 : 0
// base64 is 4/3 + up to two characters of the original data
arr = new Arr(b64.length * 3 / 4 - placeHolders)
// if there are placeholders, only get up to the last complete 4 chars
l = placeHolders > 0 ? b64.length - 4 : b64.length
var L = 0
function push (v) {
arr[L++] = v
}
for (i = 0, j = 0; i < l; i += 4, j += 3) {
tmp = (decode(b64.charAt(i)) << 18) | (decode(b64.charAt(i + 1)) << 12) | (decode(b64.charAt(i + 2)) << 6) | decode(b64.charAt(i + 3))
push((tmp & 0xFF0000) >> 16)
push((tmp & 0xFF00) >> 8)
push(tmp & 0xFF)
}
if (placeHolders === 2) {
tmp = (decode(b64.charAt(i)) << 2) | (decode(b64.charAt(i + 1)) >> 4)
push(tmp & 0xFF)
} else if (placeHolders === 1) {
tmp = (decode(b64.charAt(i)) << 10) | (decode(b64.charAt(i + 1)) << 4) | (decode(b64.charAt(i + 2)) >> 2)
push((tmp >> 8) & 0xFF)
push(tmp & 0xFF)
}
return arr
}
function uint8ToBase64 (uint8) {
var i,
extraBytes = uint8.length % 3, // if we have 1 byte left, pad 2 bytes
output = "",
temp, length
function encode (num) {
return lookup.charAt(num)
}
function tripletToBase64 (num) {
return encode(num >> 18 & 0x3F) + encode(num >> 12 & 0x3F) + encode(num >> 6 & 0x3F) + encode(num & 0x3F)
}
// go through the array every three bytes, we'll deal with trailing stuff later
for (i = 0, length = uint8.length - extraBytes; i < length; i += 3) {
temp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])
output += tripletToBase64(temp)
}
// pad the end with zeros, but make sure to not forget the extra bytes
switch (extraBytes) {
case 1:
temp = uint8[uint8.length - 1]
output += encode(temp >> 2)
output += encode((temp << 4) & 0x3F)
output += '=='
break
case 2:
temp = (uint8[uint8.length - 2] << 8) + (uint8[uint8.length - 1])
output += encode(temp >> 10)
output += encode((temp >> 4) & 0x3F)
output += encode((temp << 2) & 0x3F)
output += '='
break
}
return output
}
exports.toByteArray = b64ToByteArray
exports.fromByteArray = uint8ToBase64
}(typeof exports === 'undefined' ? (this.base64js = {}) : exports))
},{}],5:[function(_dereq_,module,exports){
exports.read = function(buffer, offset, isLE, mLen, nBytes) {
var e, m,
eLen = nBytes * 8 - mLen - 1,
eMax = (1 << eLen) - 1,
eBias = eMax >> 1,
nBits = -7,
i = isLE ? (nBytes - 1) : 0,
d = isLE ? -1 : 1,
s = buffer[offset + i];
i += d;
e = s & ((1 << (-nBits)) - 1);
s >>= (-nBits);
nBits += eLen;
for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8);
m = e & ((1 << (-nBits)) - 1);
e >>= (-nBits);
nBits += mLen;
for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8);
if (e === 0) {
e = 1 - eBias;
} else if (e === eMax) {
return m ? NaN : ((s ? -1 : 1) * Infinity);
} else {
m = m + Math.pow(2, mLen);
e = e - eBias;
}
return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
};
exports.write = function(buffer, value, offset, isLE, mLen, nBytes) {
var e, m, c,
eLen = nBytes * 8 - mLen - 1,
eMax = (1 << eLen) - 1,
eBias = eMax >> 1,
rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0),
i = isLE ? 0 : (nBytes - 1),
d = isLE ? 1 : -1,
s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0;
value = Math.abs(value);
if (isNaN(value) || value === Infinity) {
m = isNaN(value) ? 1 : 0;
e = eMax;
} else {
e = Math.floor(Math.log(value) / Math.LN2);
if (value * (c = Math.pow(2, -e)) < 1) {
e--;
c *= 2;
}
if (e + eBias >= 1) {
value += rt / c;
} else {
value += rt * Math.pow(2, 1 - eBias);
}
if (value * c >= 2) {
e++;
c /= 2;
}
if (e + eBias >= eMax) {
m = 0;
e = eMax;
} else if (e + eBias >= 1) {
m = (value * c - 1) * Math.pow(2, mLen);
e = e + eBias;
} else {
m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
e = 0;
}
}
for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8);
e = (e << mLen) | m;
eLen += mLen;
for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8);
buffer[offset + i - d] |= s * 128;
};
},{}],6:[function(_dereq_,module,exports){
/**
* isArray
*/
var isArray = Array.isArray;
/**
* toString
*/
var str = Object.prototype.toString;
/**
* Whether or not the given `val`
* is an array.
*
* example:
*
* isArray([]);
* // > true
* isArray(arguments);
* // > false
* isArray('');
* // > false
*
* @param {mixed} val
* @return {bool}
*/
module.exports = isArray || function (val) {
return !! val && '[object Array]' == str.call(val);
};
},{}],7:[function(_dereq_,module,exports){
(function (process){
// 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.
// resolves . and .. elements in a path array with directory names there
// must be no slashes, empty elements, or device names (c:\) in the array
// (so also no leading and trailing slashes - it does not distinguish
// relative and absolute paths)
function normalizeArray(parts, allowAboveRoot) {
// if the path tries to go above the root, `up` ends up > 0
var up = 0;
for (var i = parts.length - 1; i >= 0; i--) {
var last = parts[i];
if (last === '.') {
parts.splice(i, 1);
} else if (last === '..') {
parts.splice(i, 1);
up++;
} else if (up) {
parts.splice(i, 1);
up--;
}
}
// if the path is allowed to go above the root, restore leading ..s
if (allowAboveRoot) {
for (; up--; up) {
parts.unshift('..');
}
}
return parts;
}
// Split a filename into [root, dir, basename, ext], unix version
// 'root' is just a slash, or nothing.
var splitPathRe =
/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
var splitPath = function(filename) {
return splitPathRe.exec(filename).slice(1);
};
// path.resolve([from ...], to)
// posix version
exports.resolve = function() {
var resolvedPath = '',
resolvedAbsolute = false;
for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
var path = (i >= 0) ? arguments[i] : process.cwd();
// Skip empty and invalid entries
if (typeof path !== 'string') {
throw new TypeError('Arguments to path.resolve must be strings');
} else if (!path) {
continue;
}
resolvedPath = path + '/' + resolvedPath;
resolvedAbsolute = path.charAt(0) === '/';
}
// At this point the path should be resolved to a full absolute path, but
// handle relative paths to be safe (might happen when process.cwd() fails)
// Normalize the path
resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
return !!p;
}), !resolvedAbsolute).join('/');
return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
};
// path.normalize(path)
// posix version
exports.normalize = function(path) {
var isAbsolute = exports.isAbsolute(path),
trailingSlash = substr(path, -1) === '/';
// Normalize the path
path = normalizeArray(filter(path.split('/'), function(p) {
return !!p;
}), !isAbsolute).join('/');
if (!path && !isAbsolute) {
path = '.';
}
if (path && trailingSlash) {
path += '/';
}
return (isAbsolute ? '/' : '') + path;
};
// posix version
exports.isAbsolute = function(path) {
return path.charAt(0) === '/';
};
// posix version
exports.join = function() {
var paths = Array.prototype.slice.call(arguments, 0);
return exports.normalize(filter(paths, function(p, index) {
if (typeof p !== 'string') {
throw new TypeError('Arguments to path.join must be strings');
}
return p;
}).join('/'));
};
// path.relative(from, to)
// posix version
exports.relative = function(from, to) {
from = exports.resolve(from).substr(1);
to = exports.resolve(to).substr(1);
function trim(arr) {
var start = 0;
for (; start < arr.length; start++) {
if (arr[start] !== '') break;
}
var end = arr.length - 1;
for (; end >= 0; end--) {
if (arr[end] !== '') break;
}
if (start > end) return [];
return arr.slice(start, end - start + 1);
}
var fromParts = trim(from.split('/'));
var toParts = trim(to.split('/'));
var length = Math.min(fromParts.length, toParts.length);
var samePartsLength = length;
for (var i = 0; i < length; i++) {
if (fromParts[i] !== toParts[i]) {
samePartsLength = i;
break;
}
}
var outputParts = [];
for (var i = samePartsLength; i < fromParts.length; i++) {
outputParts.push('..');
}
outputParts = outputParts.concat(toParts.slice(samePartsLength));
return outputParts.join('/');
};
exports.sep = '/';
exports.delimiter = ':';
exports.dirname = function(path) {
var result = splitPath(path),
root = result[0],
dir = result[1];
if (!root && !dir) {
// No dirname whatsoever
return '.';
}
if (dir) {
// It has a dirname, strip trailing slash
dir = dir.substr(0, dir.length - 1);
}
return root + dir;
};
exports.basename = function(path, ext) {
var f = splitPath(path)[2];
// TODO: make this comparison case-insensitive on windows?
if (ext && f.substr(-1 * ext.length) === ext) {
f = f.substr(0, f.length - ext.length);
}
return f;
};
exports.extname = function(path) {
return splitPath(path)[3];
};
function filter (xs, f) {
if (xs.filter) return xs.filter(f);
var res = [];
for (var i = 0; i < xs.length; i++) {
if (f(xs[i], i, xs)) res.push(xs[i]);
}
return res;
}
// String.prototype.substr - negative index don't work in IE8
var substr = 'ab'.substr(-1) === 'b'
? function (str, start, len) { return str.substr(start, len) }
: function (str, start, len) {
if (start < 0) start = str.length + start;
return str.substr(start, len);
}
;
}).call(this,_dereq_('_process'))
},{"_process":8}],8:[function(_dereq_,module,exports){
// shim for using process in browser
var process = module.exports = {};
var queue = [];
var draining = false;
function drainQueue() {
if (draining) {
return;
}
draining = true;
var currentQueue;
var len = queue.length;
while(len) {
currentQueue = queue;
queue = [];
var i = -1;
while (++i < len) {
currentQueue[i]();
}
len = queue.length;
}
draining = false;
}
process.nextTick = function (fun) {
queue.push(fun);
if (!draining) {
setTimeout(drainQueue, 0);
}
};
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
process.version = ''; // empty string to avoid regexp issues
process.versions = {};
function noop() {}
process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.binding = function (name) {
throw new Error('process.binding is not supported');
};
// TODO(shtylman)
process.cwd = function () { return '/' };
process.chdir = function (dir) {
throw new Error('process.chdir is not supported');
};
process.umask = function() { return 0; };
},{}],9:[function(_dereq_,module,exports){
/*
Copyright (C) 2013 Ariya Hidayat <ariya.hidayat@gmail.com>
Copyright (C) 2013 Thaddee Tyl <thaddee.tyl@gmail.com>
Copyright (C) 2012 Ariya Hidayat <ariya.hidayat@gmail.com>
Copyright (C) 2012 Mathias Bynens <mathias@qiwi.be>
Copyright (C) 2012 Joost-Wim Boekesteijn <joost-wim@boekesteijn.nl>
Copyright (C) 2012 Kris Kowal <kris.kowal@cixar.com>
Copyright (C) 2012 Yusuke Suzuki <utatane.tea@gmail.com>
Copyright (C) 2012 Arpad Borsos <arpad.borsos@googlemail.com>
Copyright (C) 2011 Ariya Hidayat <ariya.hidayat@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
(function (root, factory) {
'use strict';
// Universal Module Definition (UMD) to support AMD, CommonJS/Node.js,
// Rhino, and plain browser loading.
/* istanbul ignore next */
if (typeof define === 'function' && define.amd) {
define(['exports'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports);
} else {
factory((root.esprima = {}));
}
}(this, function (exports) {
'use strict';
var Token,
TokenName,
FnExprTokens,
Syntax,
PropertyKind,
Messages,
Regex,
SyntaxTreeDelegate,
XHTMLEntities,
ClassPropertyType,
source,
strict,
index,
lineNumber,
lineStart,
length,
delegate,
lookahead,
state,
extra;
Token = {
BooleanLiteral: 1,
EOF: 2,
Identifier: 3,
Keyword: 4,
NullLiteral: 5,
NumericLiteral: 6,
Punctuator: 7,
StringLiteral: 8,
RegularExpression: 9,
Template: 10,
JSXIdentifier: 11,
JSXText: 12
};
TokenName = {};
TokenName[Token.BooleanLiteral] = 'Boolean';
TokenName[Token.EOF] = '<end>';
TokenName[Token.Identifier] = 'Identifier';
TokenName[Token.Keyword] = 'Keyword';
TokenName[Token.NullLiteral] = 'Null';
TokenName[Token.NumericLiteral] = 'Numeric';
TokenName[Token.Punctuator] = 'Punctuator';
TokenName[Token.StringLiteral] = 'String';
TokenName[Token.JSXIdentifier] = 'JSXIdentifier';
TokenName[Token.JSXText] = 'JSXText';
TokenName[Token.RegularExpression] = 'RegularExpression';
// A function following one of those tokens is an expression.
FnExprTokens = ['(', '{', '[', 'in', 'typeof', 'instanceof', 'new',
'return', 'case', 'delete', 'throw', 'void',
// assignment operators
'=', '+=', '-=', '*=', '/=', '%=', '<<=', '>>=', '>>>=',
'&=', '|=', '^=', ',',
// binary/unary operators
'+', '-', '*', '/', '%', '++', '--', '<<', '>>', '>>>', '&',
'|', '^', '!', '~', '&&', '||', '?', ':', '===', '==', '>=',
'<=', '<', '>', '!=', '!=='];
Syntax = {
AnyTypeAnnotation: 'AnyTypeAnnotation',
ArrayExpression: 'ArrayExpression',
ArrayPattern: 'ArrayPattern',
ArrayTypeAnnotation: 'ArrayTypeAnnotation',
ArrowFunctionExpression: 'ArrowFunctionExpression',
AssignmentExpression: 'AssignmentExpression',
BinaryExpression: 'BinaryExpression',
BlockStatement: 'BlockStatement',
BooleanTypeAnnotation: 'BooleanTypeAnnotation',
BreakStatement: 'BreakStatement',
CallExpression: 'CallExpression',
CatchClause: 'CatchClause',
ClassBody: 'ClassBody',
ClassDeclaration: 'ClassDeclaration',
ClassExpression: 'ClassExpression',
ClassImplements: 'ClassImplements',
ClassProperty: 'ClassProperty',
ComprehensionBlock: 'ComprehensionBlock',
ComprehensionExpression: 'ComprehensionExpression',
ConditionalExpression: 'ConditionalExpression',
ContinueStatement: 'ContinueStatement',
DebuggerStatement: 'DebuggerStatement',
DeclareClass: 'DeclareClass',
DeclareFunction: 'DeclareFunction',
DeclareModule: 'DeclareModule',
DeclareVariable: 'DeclareVariable',
DoWhileStatement: 'DoWhileStatement',
EmptyStatement: 'EmptyStatement',
ExportDeclaration: 'ExportDeclaration',
ExportBatchSpecifier: 'ExportBatchSpecifier',
ExportSpecifier: 'ExportSpecifier',
ExpressionStatement: 'ExpressionStatement',
ForInStatement: 'ForInStatement',
ForOfStatement: 'ForOfStatement',
ForStatement: 'ForStatement',
FunctionDeclaration: 'FunctionDeclaration',
FunctionExpression: 'FunctionExpression',
FunctionTypeAnnotation: 'FunctionTypeAnnotation',
FunctionTypeParam: 'FunctionTypeParam',
GenericTypeAnnotation: 'GenericTypeAnnotation',
Identifier: 'Identifier',
IfStatement: 'IfStatement',
ImportDeclaration: 'ImportDeclaration',
ImportDefaultSpecifier: 'ImportDefaultSpecifier',
ImportNamespaceSpecifier: 'ImportNamespaceSpecifier',
ImportSpecifier: 'ImportSpecifier',
InterfaceDeclaration: 'InterfaceDeclaration',
InterfaceExtends: 'InterfaceExtends',
IntersectionTypeAnnotation: 'IntersectionTypeAnnotation',
LabeledStatement: 'LabeledStatement',
Literal: 'Literal',
LogicalExpression: 'LogicalExpression',
MemberExpression: 'MemberExpression',
MethodDefinition: 'MethodDefinition',
ModuleSpecifier: 'ModuleSpecifier',
NewExpression: 'NewExpression',
NullableTypeAnnotation: 'NullableTypeAnnotation',
NumberTypeAnnotation: 'NumberTypeAnnotation',
ObjectExpression: 'ObjectExpression',
ObjectPattern: 'ObjectPattern',
ObjectTypeAnnotation: 'ObjectTypeAnnotation',
ObjectTypeCallProperty: 'ObjectTypeCallProperty',
ObjectTypeIndexer: 'ObjectTypeIndexer',
ObjectTypeProperty: 'ObjectTypeProperty',
Program: 'Program',
Property: 'Property',
QualifiedTypeIdentifier: 'QualifiedTypeIdentifier',
ReturnStatement: 'ReturnStatement',
SequenceExpression: 'SequenceExpression',
SpreadElement: 'SpreadElement',
SpreadProperty: 'SpreadProperty',
StringLiteralTypeAnnotation: 'StringLiteralTypeAnnotation',
StringTypeAnnotation: 'StringTypeAnnotation',
SwitchCase: 'SwitchCase',
SwitchStatement: 'SwitchStatement',
TaggedTemplateExpression: 'TaggedTemplateExpression',
TemplateElement: 'TemplateElement',
TemplateLiteral: 'TemplateLiteral',
ThisExpression: 'ThisExpression',
ThrowStatement: 'ThrowStatement',
TupleTypeAnnotation: 'TupleTypeAnnotation',
TryStatement: 'TryStatement',
TypeAlias: 'TypeAlias',
TypeAnnotation: 'TypeAnnotation',
TypeCastExpression: 'TypeCastExpression',
TypeofTypeAnnotation: 'TypeofTypeAnnotation',
TypeParameterDeclaration: 'TypeParameterDeclaration',
TypeParameterInstantiation: 'TypeParameterInstantiation',
UnaryExpression: 'UnaryExpression',
UnionTypeAnnotation: 'UnionTypeAnnotation',
UpdateExpression: 'UpdateExpression',
VariableDeclaration: 'VariableDeclaration',
VariableDeclarator: 'VariableDeclarator',
VoidTypeAnnotation: 'VoidTypeAnnotation',
WhileStatement: 'WhileStatement',
WithStatement: 'WithStatement',
JSXIdentifier: 'JSXIdentifier',
JSXNamespacedName: 'JSXNamespacedName',
JSXMemberExpression: 'JSXMemberExpression',
JSXEmptyExpression: 'JSXEmptyExpression',
JSXExpressionContainer: 'JSXExpressionContainer',
JSXElement: 'JSXElement',
JSXClosingElement: 'JSXClosingElement',
JSXOpeningElement: 'JSXOpeningElement',
JSXAttribute: 'JSXAttribute',
JSXSpreadAttribute: 'JSXSpreadAttribute',
JSXText: 'JSXText',
YieldExpression: 'YieldExpression',
AwaitExpression: 'AwaitExpression'
};
PropertyKind = {
Data: 1,
Get: 2,
Set: 4
};
ClassPropertyType = {
'static': 'static',
prototype: 'prototype'
};
// Error messages should be identical to V8.
Messages = {
UnexpectedToken: 'Unexpected token %0',
UnexpectedNumber: 'Unexpected number',
UnexpectedString: 'Unexpected string',
UnexpectedIdentifier: 'Unexpected identifier',
UnexpectedReserved: 'Unexpected reserved word',
UnexpectedTemplate: 'Unexpected quasi %0',
UnexpectedEOS: 'Unexpected end of input',
NewlineAfterThrow: 'Illegal newline after throw',
InvalidRegExp: 'Invalid regular expression',
UnterminatedRegExp: 'Invalid regular expression: missing /',
InvalidLHSInAssignment: 'Invalid left-hand side in assignment',
InvalidLHSInFormalsList: 'Invalid left-hand side in formals list',
InvalidLHSInForIn: 'Invalid left-hand side in for-in',
MultipleDefaultsInSwitch: 'More than one default clause in switch statement',
NoCatchOrFinally: 'Missing catch or finally after try',
UnknownLabel: 'Undefined label \'%0\'',
Redeclaration: '%0 \'%1\' has already been declared',
IllegalContinue: 'Illegal continue statement',
IllegalBreak: 'Illegal break statement',
IllegalDuplicateClassProperty: 'Illegal duplicate property in class definition',
IllegalClassConstructorProperty: 'Illegal constructor property in class definition',
IllegalReturn: 'Illegal return statement',
IllegalSpread: 'Illegal spread element',
StrictModeWith: 'Strict mode code may not include a with statement',
StrictCatchVariable: 'Catch variable may not be eval or arguments in strict mode',
StrictVarName: 'Variable name may not be eval or arguments in strict mode',
StrictParamName: 'Parameter name eval or arguments is not allowed in strict mode',
StrictParamDupe: 'Strict mode function may not have duplicate parameter names',
ParameterAfterRestParameter: 'Rest parameter must be final parameter of an argument list',
DefaultRestParameter: 'Rest parameter can not have a default value',
ElementAfterSpreadElement: 'Spread must be the final element of an element list',
PropertyAfterSpreadProperty: 'A rest property must be the final property of an object literal',
ObjectPatternAsRestParameter: 'Invalid rest parameter',
ObjectPatternAsSpread: 'Invalid spread argument',
StrictFunctionName: 'Function name may not be eval or arguments in strict mode',
StrictOctalLiteral: 'Octal literals are not allowed in strict mode.',
StrictDelete: 'Delete of an unqualified identifier in strict mode.',
StrictDuplicateProperty: 'Duplicate data property in object literal not allowed in strict mode',
AccessorDataProperty: 'Object literal may not have data and accessor property with the same name',
AccessorGetSet: 'Object literal may not have multiple get/set accessors with the same name',
StrictLHSAssignment: 'Assignment to eval or arguments is not allowed in strict mode',
StrictLHSPostfix: 'Postfix increment/decrement may not have eval or arguments operand in strict mode',
StrictLHSPrefix: 'Prefix increment/decrement may not have eval or arguments operand in strict mode',
StrictReservedWord: 'Use of future reserved word in strict mode',
MissingFromClause: 'Missing from clause',
NoAsAfterImportNamespace: 'Missing as after import *',
InvalidModuleSpecifier: 'Invalid module specifier',
IllegalImportDeclaration: 'Illegal import declaration',
IllegalExportDeclaration: 'Illegal export declaration',
NoUninitializedConst: 'Const must be initialized',
ComprehensionRequiresBlock: 'Comprehension must have at least one block',
ComprehensionError: 'Comprehension Error',
EachNotAllowed: 'Each is not supported',
InvalidJSXAttributeValue: 'JSX value should be either an expression or a quoted JSX text',
ExpectedJSXClosingTag: 'Expected corresponding JSX closing tag for %0',
AdjacentJSXElements: 'Adjacent JSX elements must be wrapped in an enclosing tag',
ConfusedAboutFunctionType: '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'
};
// See also tools/generate-unicode-regex.py.
Regex = {
NonAsciiIdentifierStart: new RegExp('[\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05d0-\u05ea\u05f0-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u08a0\u08a2-\u08ac\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097f\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c3d\u0c58\u0c59\u0c60\u0c61\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d60\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f0\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1877\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191c\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19c1-\u19c7\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1ce9-\u1cec\u1cee-\u1cf1\u1cf5\u1cf6\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2e2f\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fcc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua697\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua78e\ua790-\ua793\ua7a0-\ua7aa\ua7f8-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa80-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uabc0-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc]'),
NonAsciiIdentifierPart: new RegExp('[\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0300-\u0374\u0376\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u0483-\u0487\u048a-\u0527\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u05d0-\u05ea\u05f0-\u05f2\u0610-\u061a\u0620-\u0669\u066e-\u06d3\u06d5-\u06dc\u06df-\u06e8\u06ea-\u06fc\u06ff\u0710-\u074a\u074d-\u07b1\u07c0-\u07f5\u07fa\u0800-\u082d\u0840-\u085b\u08a0\u08a2-\u08ac\u08e4-\u08fe\u0900-\u0963\u0966-\u096f\u0971-\u0977\u0979-\u097f\u0981-\u0983\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bc-\u09c4\u09c7\u09c8\u09cb-\u09ce\u09d7\u09dc\u09dd\u09df-\u09e3\u09e6-\u09f1\u0a01-\u0a03\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a59-\u0a5c\u0a5e\u0a66-\u0a75\u0a81-\u0a83\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abc-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ad0\u0ae0-\u0ae3\u0ae6-\u0aef\u0b01-\u0b03\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3c-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b56\u0b57\u0b5c\u0b5d\u0b5f-\u0b63\u0b66-\u0b6f\u0b71\u0b82\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd0\u0bd7\u0be6-\u0bef\u0c01-\u0c03\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c3d-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c58\u0c59\u0c60-\u0c63\u0c66-\u0c6f\u0c82\u0c83\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbc-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0cde\u0ce0-\u0ce3\u0ce6-\u0cef\u0cf1\u0cf2\u0d02\u0d03\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d-\u0d44\u0d46-\u0d48\u0d4a-\u0d4e\u0d57\u0d60-\u0d63\u0d66-\u0d6f\u0d7a-\u0d7f\u0d82\u0d83\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0df2\u0df3\u0e01-\u0e3a\u0e40-\u0e4e\u0e50-\u0e59\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb9\u0ebb-\u0ebd\u0ec0-\u0ec4\u0ec6\u0ec8-\u0ecd\u0ed0-\u0ed9\u0edc-\u0edf\u0f00\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e-\u0f47\u0f49-\u0f6c\u0f71-\u0f84\u0f86-\u0f97\u0f99-\u0fbc\u0fc6\u1000-\u1049\u1050-\u109d\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u135d-\u135f\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f0\u1700-\u170c\u170e-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176c\u176e-\u1770\u1772\u1773\u1780-\u17d3\u17d7\u17dc\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u1820-\u1877\u1880-\u18aa\u18b0-\u18f5\u1900-\u191c\u1920-\u192b\u1930-\u193b\u1946-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u19d0-\u19d9\u1a00-\u1a1b\u1a20-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1aa7\u1b00-\u1b4b\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1bf3\u1c00-\u1c37\u1c40-\u1c49\u1c4d-\u1c7d\u1cd0-\u1cd2\u1cd4-\u1cf6\u1d00-\u1de6\u1dfc-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u200c\u200d\u203f\u2040\u2054\u2071\u207f\u2090-\u209c\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d7f-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2de0-\u2dff\u2e2f\u3005-\u3007\u3021-\u302f\u3031-\u3035\u3038-\u303c\u3041-\u3096\u3099\u309a\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fcc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua62b\ua640-\ua66f\ua674-\ua67d\ua67f-\ua697\ua69f-\ua6f1\ua717-\ua71f\ua722-\ua788\ua78b-\ua78e\ua790-\ua793\ua7a0-\ua7aa\ua7f8-\ua827\ua840-\ua873\ua880-\ua8c4\ua8d0-\ua8d9\ua8e0-\ua8f7\ua8fb\ua900-\ua92d\ua930-\ua953\ua960-\ua97c\ua980-\ua9c0\ua9cf-\ua9d9\uaa00-\uaa36\uaa40-\uaa4d\uaa50-\uaa59\uaa60-\uaa76\uaa7a\uaa7b\uaa80-\uaac2\uaadb-\uaadd\uaae0-\uaaef\uaaf2-\uaaf6\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uabc0-\uabea\uabec\uabed\uabf0-\uabf9\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe00-\ufe0f\ufe20-\ufe26\ufe33\ufe34\ufe4d-\ufe4f\ufe70-\ufe74\ufe76-\ufefc\uff10-\uff19\uff21-\uff3a\uff3f\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc]'),
LeadingZeros: new RegExp('^0+(?!$)')
};
// Ensure the condition is true, otherwise throw an error.
// This is only to have a better contract semantic, i.e. another safety net
// to catch a logic error. The condition shall be fulfilled in normal case.
// Do NOT use this to enforce a certain condition on any user input.
function assert(condition, message) {
/* istanbul ignore if */
if (!condition) {
throw new Error('ASSERT: ' + message);
}
}
function StringMap() {
this.$data = {};
}
StringMap.prototype.get = function (key) {
key = '$' + key;
return this.$data[key];
};
StringMap.prototype.set = function (key, value) {
key = '$' + key;
this.$data[key] = value;
return this;
};
StringMap.prototype.has = function (key) {
key = '$' + key;
return Object.prototype.hasOwnProperty.call(this.$data, key);
};
StringMap.prototype["delete"] = function (key) {
key = '$' + key;
return delete this.$data[key];
};
function isDecimalDigit(ch) {
return (ch >= 48 && ch <= 57); // 0..9
}
function isHexDigit(ch) {
return '0123456789abcdefABCDEF'.indexOf(ch) >= 0;
}
function isOctalDigit(ch) {
return '01234567'.indexOf(ch) >= 0;
}
// 7.2 White Space
function isWhiteSpace(ch) {
return (ch === 32) || // space
(ch === 9) || // tab
(ch === 0xB) ||
(ch === 0xC) ||
(ch === 0xA0) ||
(ch >= 0x1680 && '\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\uFEFF'.indexOf(String.fromCharCode(ch)) > 0);
}
// 7.3 Line Terminators
function isLineTerminator(ch) {
return (ch === 10) || (ch === 13) || (ch === 0x2028) || (ch === 0x2029);
}
// 7.6 Identifier Names and Identifiers
function isIdentifierStart(ch) {
return (ch === 36) || (ch === 95) || // $ (dollar) and _ (underscore)
(ch >= 65 && ch <= 90) || // A..Z
(ch >= 97 && ch <= 122) || // a..z
(ch === 92) || // \ (backslash)
((ch >= 0x80) && Regex.NonAsciiIdentifierStart.test(String.fromCharCode(ch)));
}
function isIdentifierPart(ch) {
return (ch === 36) || (ch === 95) || // $ (dollar) and _ (underscore)
(ch >= 65 && ch <= 90) || // A..Z
(ch >= 97 && ch <= 122) || // a..z
(ch >= 48 && ch <= 57) || // 0..9
(ch === 92) || // \ (backslash)
((ch >= 0x80) && Regex.NonAsciiIdentifierPart.test(String.fromCharCode(ch)));
}
// 7.6.1.2 Future Reserved Words
function isFutureReservedWord(id) {
switch (id) {
case 'class':
case 'enum':
case 'export':
case 'extends':
case 'import':
case 'super':
return true;
default:
return false;
}
}
function isStrictModeReservedWord(id) {
switch (id) {
case 'implements':
case 'interface':
case 'package':
case 'private':
case 'protected':
case 'public':
case 'static':
case 'yield':
case 'let':
return true;
default:
return false;
}
}
function isRestrictedWord(id) {
return id === 'eval' || id === 'arguments';
}
// 7.6.1.1 Keywords
function isKeyword(id) {
if (strict && isStrictModeReservedWord(id)) {
return true;
}
// 'const' is specialized as Keyword in V8.
// 'yield' is only treated as a keyword in strict mode.
// 'let' is for compatiblity with SpiderMonkey and ES.next.
// Some others are from future reserved words.
switch (id.length) {
case 2:
return (id === 'if') || (id === 'in') || (id === 'do');
case 3:
return (id === 'var') || (id === 'for') || (id === 'new') ||
(id === 'try') || (id === 'let');
case 4:
return (id === 'this') || (id === 'else') || (id === 'case') ||
(id === 'void') || (id === 'with') || (id === 'enum');
case 5:
return (id === 'while') || (id === 'break') || (id === 'catch') ||
(id === 'throw') || (id === 'const') ||
(id === 'class') || (id === 'super');
case 6:
return (id === 'return') || (id === 'typeof') || (id === 'delete') ||
(id === 'switch') || (id === 'export') || (id === 'import');
case 7:
return (id === 'default') || (id === 'finally') || (id === 'extends');
case 8:
return (id === 'function') || (id === 'continue') || (id === 'debugger');
case 10:
return (id === 'instanceof');
default:
return false;
}
}
// 7.4 Comments
function addComment(type, value, start, end, loc) {
var comment;
assert(typeof start === 'number', 'Comment must have valid position');
// Because the way the actual token is scanned, often the comments
// (if any) are skipped twice during the lexical analysis.
// Thus, we need to skip adding a comment if the comment array already
// handled it.
if (state.lastCommentStart >= start) {
return;
}
state.lastCommentStart = start;
comment = {
type: type,
value: value
};
if (extra.range) {
comment.range = [start, end];
}
if (extra.loc) {
comment.loc = loc;
}
extra.comments.push(comment);
if (extra.attachComment) {
extra.leadingComments.push(comment);
extra.trailingComments.push(comment);
}
}
function skipSingleLineComment() {
var start, loc, ch, comment;
start = index - 2;
loc = {
start: {
line: lineNumber,
column: index - lineStart - 2
}
};
while (index < length) {
ch = source.charCodeAt(index);
++index;
if (isLineTerminator(ch)) {
if (extra.comments) {
comment = source.slice(start + 2, index - 1);
loc.end = {
line: lineNumber,
column: index - lineStart - 1
};
addComment('Line', comment, start, index - 1, loc);
}
if (ch === 13 && source.charCodeAt(index) === 10) {
++index;
}
++lineNumber;
lineStart = index;
return;
}
}
if (extra.comments) {
comment = source.slice(start + 2, index);
loc.end = {
line: lineNumber,
column: index - lineStart
};
addComment('Line', comment, start, index, loc);
}
}
function skipMultiLineComment() {
var start, loc, ch, comment;
if (extra.comments) {
start = index - 2;
loc = {
start: {
line: lineNumber,
column: index - lineStart - 2
}
};
}
while (index < length) {
ch = source.charCodeAt(index);
if (isLineTerminator(ch)) {
if (ch === 13 && source.charCodeAt(index + 1) === 10) {
++index;
}
++lineNumber;
++index;
lineStart = index;
if (index >= length) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
} else if (ch === 42) {
// Block comment ends with '*/' (char #42, char #47).
if (source.charCodeAt(index + 1) === 47) {
++index;
++index;
if (extra.comments) {
comment = source.slice(start + 2, index - 2);
loc.end = {
line: lineNumber,
column: index - lineStart
};
addComment('Block', comment, start, index, loc);
}
return;
}
++index;
} else {
++index;
}
}
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
function skipComment() {
var ch;
while (index < length) {
ch = source.charCodeAt(index);
if (isWhiteSpace(ch)) {
++index;
} else if (isLineTerminator(ch)) {
++index;
if (ch === 13 && source.charCodeAt(index) === 10) {
++index;
}
++lineNumber;
lineStart = index;
} else if (ch === 47) { // 47 is '/'
ch = source.charCodeAt(index + 1);
if (ch === 47) {
++index;
++index;
skipSingleLineComment();
} else if (ch === 42) { // 42 is '*'
++index;
++index;
skipMultiLineComment();
} else {
break;
}
} else {
break;
}
}
}
function scanHexEscape(prefix) {
var i, len, ch, code = 0;
len = (prefix === 'u') ? 4 : 2;
for (i = 0; i < len; ++i) {
if (index < length && isHexDigit(source[index])) {
ch = source[index++];
code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase());
} else {
return '';
}
}
return String.fromCharCode(code);
}
function scanUnicodeCodePointEscape() {
var ch, code, cu1, cu2;
ch = source[index];
code = 0;
// At least, one hex digit is required.
if (ch === '}') {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
while (index < length) {
ch = source[index++];
if (!isHexDigit(ch)) {
break;
}
code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase());
}
if (code > 0x10FFFF || ch !== '}') {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
// UTF-16 Encoding
if (code <= 0xFFFF) {
return String.fromCharCode(code);
}
cu1 = ((code - 0x10000) >> 10) + 0xD800;
cu2 = ((code - 0x10000) & 1023) + 0xDC00;
return String.fromCharCode(cu1, cu2);
}
function getEscapedIdentifier() {
var ch, id;
ch = source.charCodeAt(index++);
id = String.fromCharCode(ch);
// '\u' (char #92, char #117) denotes an escaped character.
if (ch === 92) {
if (source.charCodeAt(index) !== 117) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
++index;
ch = scanHexEscape('u');
if (!ch || ch === '\\' || !isIdentifierStart(ch.charCodeAt(0))) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
id = ch;
}
while (index < length) {
ch = source.charCodeAt(index);
if (!isIdentifierPart(ch)) {
break;
}
++index;
id += String.fromCharCode(ch);
// '\u' (char #92, char #117) denotes an escaped character.
if (ch === 92) {
id = id.substr(0, id.length - 1);
if (source.charCodeAt(index) !== 117) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
++index;
ch = scanHexEscape('u');
if (!ch || ch === '\\' || !isIdentifierPart(ch.charCodeAt(0))) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
id += ch;
}
}
return id;
}
function getIdentifier() {
var start, ch;
start = index++;
while (index < length) {
ch = source.charCodeAt(index);
if (ch === 92) {
// Blackslash (char #92) marks Unicode escape sequence.
index = start;
return getEscapedIdentifier();
}
if (isIdentifierPart(ch)) {
++index;
} else {
break;
}
}
return source.slice(start, index);
}
function scanIdentifier() {
var start, id, type;
start = index;
// Backslash (char #92) starts an escaped character.
id = (source.charCodeAt(index) === 92) ? getEscapedIdentifier() : getIdentifier();
// There is no keyword or literal with only one character.
// Thus, it must be an identifier.
if (id.length === 1) {
type = Token.Identifier;
} else if (isKeyword(id)) {
type = Token.Keyword;
} else if (id === 'null') {
type = Token.NullLiteral;
} else if (id === 'true' || id === 'false') {
type = Token.BooleanLiteral;
} else {
type = Token.Identifier;
}
return {
type: type,
value: id,
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
// 7.7 Punctuators
function scanPunctuator() {
var start = index,
code = source.charCodeAt(index),
code2,
ch1 = source[index],
ch2,
ch3,
ch4;
if (state.inJSXTag || state.inJSXChild) {
// Don't need to check for '{' and '}' as it's already handled
// correctly by default.
switch (code) {
case 60: // <
case 62: // >
++index;
return {
type: Token.Punctuator,
value: String.fromCharCode(code),
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
}
switch (code) {
// Check for most common single-character punctuators.
case 40: // ( open bracket
case 41: // ) close bracket
case 59: // ; semicolon
case 44: // , comma
case 123: // { open curly brace
case 125: // } close curly brace
case 91: // [
case 93: // ]
case 58: // :
case 63: // ?
case 126: // ~
++index;
if (extra.tokenize) {
if (code === 40) {
extra.openParenToken = extra.tokens.length;
} else if (code === 123) {
extra.openCurlyToken = extra.tokens.length;
}
}
return {
type: Token.Punctuator,
value: String.fromCharCode(code),
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
default:
code2 = source.charCodeAt(index + 1);
// '=' (char #61) marks an assignment or comparison operator.
if (code2 === 61) {
switch (code) {
case 37: // %
case 38: // &
case 42: // *:
case 43: // +
case 45: // -
case 47: // /
case 60: // <
case 62: // >
case 94: // ^
case 124: // |
index += 2;
return {
type: Token.Punctuator,
value: String.fromCharCode(code) + String.fromCharCode(code2),
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
case 33: // !
case 61: // =
index += 2;
// !== and ===
if (source.charCodeAt(index) === 61) {
++index;
}
return {
type: Token.Punctuator,
value: source.slice(start, index),
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
default:
break;
}
}
break;
}
// Peek more characters.
ch2 = source[index + 1];
ch3 = source[index + 2];
ch4 = source[index + 3];
// 4-character punctuator: >>>=
if (ch1 === '>' && ch2 === '>' && ch3 === '>') {
if (ch4 === '=') {
index += 4;
return {
type: Token.Punctuator,
value: '>>>=',
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
}
// 3-character punctuators: === !== >>> <<= >>=
if (ch1 === '>' && ch2 === '>' && ch3 === '>' && !state.inType) {
index += 3;
return {
type: Token.Punctuator,
value: '>>>',
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
if (ch1 === '<' && ch2 === '<' && ch3 === '=') {
index += 3;
return {
type: Token.Punctuator,
value: '<<=',
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
if (ch1 === '>' && ch2 === '>' && ch3 === '=') {
index += 3;
return {
type: Token.Punctuator,
value: '>>=',
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
if (ch1 === '.' && ch2 === '.' && ch3 === '.') {
index += 3;
return {
type: Token.Punctuator,
value: '...',
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
// Other 2-character punctuators: ++ -- << >> && ||
// Don't match these tokens if we're in a type, since they never can
// occur and can mess up types like Map<string, Array<string>>
if (ch1 === ch2 && ('+-<>&|'.indexOf(ch1) >= 0) && !state.inType) {
index += 2;
return {
type: Token.Punctuator,
value: ch1 + ch2,
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
if (ch1 === '=' && ch2 === '>') {
index += 2;
return {
type: Token.Punctuator,
value: '=>',
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
if ('<>=!+-*%&|^/'.indexOf(ch1) >= 0) {
++index;
return {
type: Token.Punctuator,
value: ch1,
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
if (ch1 === '.') {
++index;
return {
type: Token.Punctuator,
value: ch1,
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
// 7.8.3 Numeric Literals
function scanHexLiteral(start) {
var number = '';
while (index < length) {
if (!isHexDigit(source[index])) {
break;
}
number += source[index++];
}
if (number.length === 0) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
if (isIdentifierStart(source.charCodeAt(index))) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
return {
type: Token.NumericLiteral,
value: parseInt('0x' + number, 16),
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
function scanBinaryLiteral(start) {
var ch, number;
number = '';
while (index < length) {
ch = source[index];
if (ch !== '0' && ch !== '1') {
break;
}
number += source[index++];
}
if (number.length === 0) {
// only 0b or 0B
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
if (index < length) {
ch = source.charCodeAt(index);
/* istanbul ignore else */
if (isIdentifierStart(ch) || isDecimalDigit(ch)) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
}
return {
type: Token.NumericLiteral,
value: parseInt(number, 2),
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
function scanOctalLiteral(prefix, start) {
var number, octal;
if (isOctalDigit(prefix)) {
octal = true;
number = '0' + source[index++];
} else {
octal = false;
++index;
number = '';
}
while (index < length) {
if (!isOctalDigit(source[index])) {
break;
}
number += source[index++];
}
if (!octal && number.length === 0) {
// only 0o or 0O
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
if (isIdentifierStart(source.charCodeAt(index)) || isDecimalDigit(source.charCodeAt(index))) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
return {
type: Token.NumericLiteral,
value: parseInt(number, 8),
octal: octal,
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
function scanNumericLiteral() {
var number, start, ch;
ch = source[index];
assert(isDecimalDigit(ch.charCodeAt(0)) || (ch === '.'),
'Numeric literal must start with a decimal digit or a decimal point');
start = index;
number = '';
if (ch !== '.') {
number = source[index++];
ch = source[index];
// Hex number starts with '0x'.
// Octal number starts with '0'.
// Octal number in ES6 starts with '0o'.
// Binary number in ES6 starts with '0b'.
if (number === '0') {
if (ch === 'x' || ch === 'X') {
++index;
return scanHexLiteral(start);
}
if (ch === 'b' || ch === 'B') {
++index;
return scanBinaryLiteral(start);
}
if (ch === 'o' || ch === 'O' || isOctalDigit(ch)) {
return scanOctalLiteral(ch, start);
}
// decimal number starts with '0' such as '09' is illegal.
if (ch && isDecimalDigit(ch.charCodeAt(0))) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
}
while (isDecimalDigit(source.charCodeAt(index))) {
number += source[index++];
}
ch = source[index];
}
if (ch === '.') {
number += source[index++];
while (isDecimalDigit(source.charCodeAt(index))) {
number += source[index++];
}
ch = source[index];
}
if (ch === 'e' || ch === 'E') {
number += source[index++];
ch = source[index];
if (ch === '+' || ch === '-') {
number += source[index++];
}
if (isDecimalDigit(source.charCodeAt(index))) {
while (isDecimalDigit(source.charCodeAt(index))) {
number += source[index++];
}
} else {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
}
if (isIdentifierStart(source.charCodeAt(index))) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
return {
type: Token.NumericLiteral,
value: parseFloat(number),
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
// 7.8.4 String Literals
function scanStringLiteral() {
var str = '', quote, start, ch, code, unescaped, restore, octal = false;
quote = source[index];
assert((quote === '\'' || quote === '"'),
'String literal must starts with a quote');
start = index;
++index;
while (index < length) {
ch = source[index++];
if (ch === quote) {
quote = '';
break;
} else if (ch === '\\') {
ch = source[index++];
if (!ch || !isLineTerminator(ch.charCodeAt(0))) {
switch (ch) {
case 'n':
str += '\n';
break;
case 'r':
str += '\r';
break;
case 't':
str += '\t';
break;
case 'u':
case 'x':
if (source[index] === '{') {
++index;
str += scanUnicodeCodePointEscape();
} else {
restore = index;
unescaped = scanHexEscape(ch);
if (unescaped) {
str += unescaped;
} else {
index = restore;
str += ch;
}
}
break;
case 'b':
str += '\b';
break;
case 'f':
str += '\f';
break;
case 'v':
str += '\x0B';
break;
default:
if (isOctalDigit(ch)) {
code = '01234567'.indexOf(ch);
// \0 is not octal escape sequence
if (code !== 0) {
octal = true;
}
/* istanbul ignore else */
if (index < length && isOctalDigit(source[index])) {
octal = true;
code = code * 8 + '01234567'.indexOf(source[index++]);
// 3 digits are only allowed when string starts
// with 0, 1, 2, 3
if ('0123'.indexOf(ch) >= 0 &&
index < length &&
isOctalDigit(source[index])) {
code = code * 8 + '01234567'.indexOf(source[index++]);
}
}
str += String.fromCharCode(code);
} else {
str += ch;
}
break;
}
} else {
++lineNumber;
if (ch === '\r' && source[index] === '\n') {
++index;
}
lineStart = index;
}
} else if (isLineTerminator(ch.charCodeAt(0))) {
break;
} else {
str += ch;
}
}
if (quote !== '') {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
return {
type: Token.StringLiteral,
value: str,
octal: octal,
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
function scanTemplate() {
var cooked = '', ch, start, terminated, tail, restore, unescaped, code, octal;
terminated = false;
tail = false;
start = index;
++index;
while (index < length) {
ch = source[index++];
if (ch === '`') {
tail = true;
terminated = true;
break;
} else if (ch === '$') {
if (source[index] === '{') {
++index;
terminated = true;
break;
}
cooked += ch;
} else if (ch === '\\') {
ch = source[index++];
if (!isLineTerminator(ch.charCodeAt(0))) {
switch (ch) {
case 'n':
cooked += '\n';
break;
case 'r':
cooked += '\r';
break;
case 't':
cooked += '\t';
break;
case 'u':
case 'x':
if (source[index] === '{') {
++index;
cooked += scanUnicodeCodePointEscape();
} else {
restore = index;
unescaped = scanHexEscape(ch);
if (unescaped) {
cooked += unescaped;
} else {
index = restore;
cooked += ch;
}
}
break;
case 'b':
cooked += '\b';
break;
case 'f':
cooked += '\f';
break;
case 'v':
cooked += '\v';
break;
default:
if (isOctalDigit(ch)) {
code = '01234567'.indexOf(ch);
// \0 is not octal escape sequence
if (code !== 0) {
octal = true;
}
/* istanbul ignore else */
if (index < length && isOctalDigit(source[index])) {
octal = true;
code = code * 8 + '01234567'.indexOf(source[index++]);
// 3 digits are only allowed when string starts
// with 0, 1, 2, 3
if ('0123'.indexOf(ch) >= 0 &&
index < length &&
isOctalDigit(source[index])) {
code = code * 8 + '01234567'.indexOf(source[index++]);
}
}
cooked += String.fromCharCode(code);
} else {
cooked += ch;
}
break;
}
} else {
++lineNumber;
if (ch === '\r' && source[index] === '\n') {
++index;
}
lineStart = index;
}
} else if (isLineTerminator(ch.charCodeAt(0))) {
++lineNumber;
if (ch === '\r' && source[index] === '\n') {
++index;
}
lineStart = index;
cooked += '\n';
} else {
cooked += ch;
}
}
if (!terminated) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
return {
type: Token.Template,
value: {
cooked: cooked,
raw: source.slice(start + 1, index - ((tail) ? 1 : 2))
},
tail: tail,
octal: octal,
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
function scanTemplateElement(option) {
var startsWith, template;
lookahead = null;
skipComment();
startsWith = (option.head) ? '`' : '}';
if (source[index] !== startsWith) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
template = scanTemplate();
peek();
return template;
}
function testRegExp(pattern, flags) {
var tmp = pattern,
value;
if (flags.indexOf('u') >= 0) {
// Replace each astral symbol and every Unicode code point
// escape sequence with a single ASCII symbol to avoid throwing on
// regular expressions that are only valid in combination with the
// `/u` flag.
// Note: replacing with the ASCII symbol `x` might cause false
// negatives in unlikely scenarios. For example, `[\u{61}-b]` is a
// perfectly valid pattern that is equivalent to `[a-b]`, but it
// would be replaced by `[x-b]` which throws an error.
tmp = tmp
.replace(/\\u\{([0-9a-fA-F]+)\}/g, function ($0, $1) {
if (parseInt($1, 16) <= 0x10FFFF) {
return 'x';
}
throwError({}, Messages.InvalidRegExp);
})
.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, 'x');
}
// First, detect invalid regular expressions.
try {
value = new RegExp(tmp);
} catch (e) {
throwError({}, Messages.InvalidRegExp);
}
// Return a regular expression object for this pattern-flag pair, or
// `null` in case the current environment doesn't support the flags it
// uses.
try {
return new RegExp(pattern, flags);
} catch (exception) {
return null;
}
}
function scanRegExpBody() {
var ch, str, classMarker, terminated, body;
ch = source[index];
assert(ch === '/', 'Regular expression literal must start with a slash');
str = source[index++];
classMarker = false;
terminated = false;
while (index < length) {
ch = source[index++];
str += ch;
if (ch === '\\') {
ch = source[index++];
// ECMA-262 7.8.5
if (isLineTerminator(ch.charCodeAt(0))) {
throwError({}, Messages.UnterminatedRegExp);
}
str += ch;
} else if (isLineTerminator(ch.charCodeAt(0))) {
throwError({}, Messages.UnterminatedRegExp);
} else if (classMarker) {
if (ch === ']') {
classMarker = false;
}
} else {
if (ch === '/') {
terminated = true;
break;
} else if (ch === '[') {
classMarker = true;
}
}
}
if (!terminated) {
throwError({}, Messages.UnterminatedRegExp);
}
// Exclude leading and trailing slash.
body = str.substr(1, str.length - 2);
return {
value: body,
literal: str
};
}
function scanRegExpFlags() {
var ch, str, flags, restore;
str = '';
flags = '';
while (index < length) {
ch = source[index];
if (!isIdentifierPart(ch.charCodeAt(0))) {
break;
}
++index;
if (ch === '\\' && index < length) {
ch = source[index];
if (ch === 'u') {
++index;
restore = index;
ch = scanHexEscape('u');
if (ch) {
flags += ch;
for (str += '\\u'; restore < index; ++restore) {
str += source[restore];
}
} else {
index = restore;
flags += 'u';
str += '\\u';
}
throwErrorTolerant({}, Messages.UnexpectedToken, 'ILLEGAL');
} else {
str += '\\';
throwErrorTolerant({}, Messages.UnexpectedToken, 'ILLEGAL');
}
} else {
flags += ch;
str += ch;
}
}
return {
value: flags,
literal: str
};
}
function scanRegExp() {
var start, body, flags, value;
lookahead = null;
skipComment();
start = index;
body = scanRegExpBody();
flags = scanRegExpFlags();
value = testRegExp(body.value, flags.value);
if (extra.tokenize) {
return {
type: Token.RegularExpression,
value: value,
regex: {
pattern: body.value,
flags: flags.value
},
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
return {
literal: body.literal + flags.literal,
value: value,
regex: {
pattern: body.value,
flags: flags.value
},
range: [start, index]
};
}
function isIdentifierName(token) {
return token.type === Token.Identifier ||
token.type === Token.Keyword ||
token.type === Token.BooleanLiteral ||
token.type === Token.NullLiteral;
}
function advanceSlash() {
var prevToken,
checkToken;
// Using the following algorithm:
// https://github.com/mozilla/sweet.js/wiki/design
prevToken = extra.tokens[extra.tokens.length - 1];
if (!prevToken) {
// Nothing before that: it cannot be a division.
return scanRegExp();
}
if (prevToken.type === 'Punctuator') {
if (prevToken.value === ')') {
checkToken = extra.tokens[extra.openParenToken - 1];
if (checkToken &&
checkToken.type === 'Keyword' &&
(checkToken.value === 'if' ||
checkToken.value === 'while' ||
checkToken.value === 'for' ||
checkToken.value === 'with')) {
return scanRegExp();
}
return scanPunctuator();
}
if (prevToken.value === '}') {
// Dividing a function by anything makes little sense,
// but we have to check for that.
if (extra.tokens[extra.openCurlyToken - 3] &&
extra.tokens[extra.openCurlyToken - 3].type === 'Keyword') {
// Anonymous function.
checkToken = extra.tokens[extra.openCurlyToken - 4];
if (!checkToken) {
return scanPunctuator();
}
} else if (extra.tokens[extra.openCurlyToken - 4] &&
extra.tokens[extra.openCurlyToken - 4].type === 'Keyword') {
// Named function.
checkToken = extra.tokens[extra.openCurlyToken - 5];
if (!checkToken) {
return scanRegExp();
}
} else {
return scanPunctuator();
}
// checkToken determines whether the function is
// a declaration or an expression.
if (FnExprTokens.indexOf(checkToken.value) >= 0) {
// It is an expression.
return scanPunctuator();
}
// It is a declaration.
return scanRegExp();
}
return scanRegExp();
}
if (prevToken.type === 'Keyword' && prevToken.value !== 'this') {
return scanRegExp();
}
return scanPunctuator();
}
function advance() {
var ch;
if (!state.inJSXChild) {
skipComment();
}
if (index >= length) {
return {
type: Token.EOF,
lineNumber: lineNumber,
lineStart: lineStart,
range: [index, index]
};
}
if (state.inJSXChild) {
return advanceJSXChild();
}
ch = source.charCodeAt(index);
// Very common: ( and ) and ;
if (ch === 40 || ch === 41 || ch === 58) {
return scanPunctuator();
}
// String literal starts with single quote (#39) or double quote (#34).
if (ch === 39 || ch === 34) {
if (state.inJSXTag) {
return scanJSXStringLiteral();
}
return scanStringLiteral();
}
if (state.inJSXTag && isJSXIdentifierStart(ch)) {
return scanJSXIdentifier();
}
if (ch === 96) {
return scanTemplate();
}
if (isIdentifierStart(ch)) {
return scanIdentifier();
}
// Dot (.) char #46 can also start a floating-point number, hence the need
// to check the next character.
if (ch === 46) {
if (isDecimalDigit(source.charCodeAt(index + 1))) {
return scanNumericLiteral();
}
return scanPunctuator();
}
if (isDecimalDigit(ch)) {
return scanNumericLiteral();
}
// Slash (/) char #47 can also start a regex.
if (extra.tokenize && ch === 47) {
return advanceSlash();
}
return scanPunctuator();
}
function lex() {
var token;
token = lookahead;
index = token.range[1];
lineNumber = token.lineNumber;
lineStart = token.lineStart;
lookahead = advance();
index = token.range[1];
lineNumber = token.lineNumber;
lineStart = token.lineStart;
return token;
}
function peek() {
var pos, line, start;
pos = index;
line = lineNumber;
start = lineStart;
lookahead = advance();
index = pos;
lineNumber = line;
lineStart = start;
}
function lookahead2() {
var adv, pos, line, start, result;
// If we are collecting the tokens, don't grab the next one yet.
/* istanbul ignore next */
adv = (typeof extra.advance === 'function') ? extra.advance : advance;
pos = index;
line = lineNumber;
start = lineStart;
// Scan for the next immediate token.
/* istanbul ignore if */
if (lookahead === null) {
lookahead = adv();
}
index = lookahead.range[1];
lineNumber = lookahead.lineNumber;
lineStart = lookahead.lineStart;
// Grab the token right after.
result = adv();
index = pos;
lineNumber = line;
lineStart = start;
return result;
}
function rewind(token) {
index = token.range[0];
lineNumber = token.lineNumber;
lineStart = token.lineStart;
lookahead = token;
}
function markerCreate() {
if (!extra.loc && !extra.range) {
return undefined;
}
skipComment();
return {offset: index, line: lineNumber, col: index - lineStart};
}
function markerCreatePreserveWhitespace() {
if (!extra.loc && !extra.range) {
return undefined;
}
return {offset: index, line: lineNumber, col: index - lineStart};
}
function processComment(node) {
var lastChild,
trailingComments,
bottomRight = extra.bottomRightStack,
last = bottomRight[bottomRight.length - 1];
if (node.type === Syntax.Program) {
/* istanbul ignore else */
if (node.body.length > 0) {
return;
}
}
if (extra.trailingComments.length > 0) {
if (extra.trailingComments[0].range[0] >= node.range[1]) {
trailingComments = extra.trailingComments;
extra.trailingComments = [];
} else {
extra.trailingComments.length = 0;
}
} else {
if (last && last.trailingComments && last.trailingComments[0].range[0] >= node.range[1]) {
trailingComments = last.trailingComments;
delete last.trailingComments;
}
}
// Eating the stack.
if (last) {
while (last && last.range[0] >= node.range[0]) {
lastChild = last;
last = bottomRight.pop();
}
}
if (lastChild) {
if (lastChild.leadingComments && lastChild.leadingComments[lastChild.leadingComments.length - 1].range[1] <= node.range[0]) {
node.leadingComments = lastChild.leadingComments;
delete lastChild.leadingComments;
}
} else if (extra.leadingComments.length > 0 && extra.leadingComments[extra.leadingComments.length - 1].range[1] <= node.range[0]) {
node.leadingComments = extra.leadingComments;
extra.leadingComments = [];
}
if (trailingComments) {
node.trailingComments = trailingComments;
}
bottomRight.push(node);
}
function markerApply(marker, node) {
if (extra.range) {
node.range = [marker.offset, index];
}
if (extra.loc) {
node.loc = {
start: {
line: marker.line,
column: marker.col
},
end: {
line: lineNumber,
column: index - lineStart
}
};
node = delegate.postProcess(node);
}
if (extra.attachComment) {
processComment(node);
}
return node;
}
SyntaxTreeDelegate = {
name: 'SyntaxTree',
postProcess: function (node) {
return node;
},
createArrayExpression: function (elements) {
return {
type: Syntax.ArrayExpression,
elements: elements
};
},
createAssignmentExpression: function (operator, left, right) {
return {
type: Syntax.AssignmentExpression,
operator: operator,
left: left,
right: right
};
},
createBinaryExpression: function (operator, left, right) {
var type = (operator === '||' || operator === '&&') ? Syntax.LogicalExpression :
Syntax.BinaryExpression;
return {
type: type,
operator: operator,
left: left,
right: right
};
},
createBlockStatement: function (body) {
return {
type: Syntax.BlockStatement,
body: body
};
},
createBreakStatement: function (label) {
return {
type: Syntax.BreakStatement,
label: label
};
},
createCallExpression: function (callee, args) {
return {
type: Syntax.CallExpression,
callee: callee,
'arguments': args
};
},
createCatchClause: function (param, body) {
return {
type: Syntax.CatchClause,
param: param,
body: body
};
},
createConditionalExpression: function (test, consequent, alternate) {
return {
type: Syntax.ConditionalExpression,
test: test,
consequent: consequent,
alternate: alternate
};
},
createContinueStatement: function (label) {
return {
type: Syntax.ContinueStatement,
label: label
};
},
createDebuggerStatement: function () {
return {
type: Syntax.DebuggerStatement
};
},
createDoWhileStatement: function (body, test) {
return {
type: Syntax.DoWhileStatement,
body: body,
test: test
};
},
createEmptyStatement: function () {
return {
type: Syntax.EmptyStatement
};
},
createExpressionStatement: function (expression) {
return {
type: Syntax.ExpressionStatement,
expression: expression
};
},
createForStatement: function (init, test, update, body) {
return {
type: Syntax.ForStatement,
init: init,
test: test,
update: update,
body: body
};
},
createForInStatement: function (left, right, body) {
return {
type: Syntax.ForInStatement,
left: left,
right: right,
body: body,
each: false
};
},
createForOfStatement: function (left, right, body) {
return {
type: Syntax.ForOfStatement,
left: left,
right: right,
body: body
};
},
createFunctionDeclaration: function (id, params, defaults, body, rest, generator, expression,
isAsync, returnType, typeParameters) {
var funDecl = {
type: Syntax.FunctionDeclaration,
id: id,
params: params,
defaults: defaults,
body: body,
rest: rest,
generator: generator,
expression: expression,
returnType: returnType,
typeParameters: typeParameters
};
if (isAsync) {
funDecl.async = true;
}
return funDecl;
},
createFunctionExpression: function (id, params, defaults, body, rest, generator, expression,
isAsync, returnType, typeParameters) {
var funExpr = {
type: Syntax.FunctionExpression,
id: id,
params: params,
defaults: defaults,
body: body,
rest: rest,
generator: generator,
expression: expression,
returnType: returnType,
typeParameters: typeParameters
};
if (isAsync) {
funExpr.async = true;
}
return funExpr;
},
createIdentifier: function (name) {
return {
type: Syntax.Identifier,
name: name,
// Only here to initialize the shape of the object to ensure
// that the 'typeAnnotation' key is ordered before others that
// are added later (like 'loc' and 'range'). This just helps
// keep the shape of Identifier nodes consistent with everything
// else.
typeAnnotation: undefined,
optional: undefined
};
},
createTypeAnnotation: function (typeAnnotation) {
return {
type: Syntax.TypeAnnotation,
typeAnnotation: typeAnnotation
};
},
createTypeCast: function (expression, typeAnnotation) {
return {
type: Syntax.TypeCastExpression,
expression: expression,
typeAnnotation: typeAnnotation
};
},
createFunctionTypeAnnotation: function (params, returnType, rest, typeParameters) {
return {
type: Syntax.FunctionTypeAnnotation,
params: params,
returnType: returnType,
rest: rest,
typeParameters: typeParameters
};
},
createFunctionTypeParam: function (name, typeAnnotation, optional) {
return {
type: Syntax.FunctionTypeParam,
name: name,
typeAnnotation: typeAnnotation,
optional: optional
};
},
createNullableTypeAnnotation: function (typeAnnotation) {
return {
type: Syntax.NullableTypeAnnotation,
typeAnnotation: typeAnnotation
};
},
createArrayTypeAnnotation: function (elementType) {
return {
type: Syntax.ArrayTypeAnnotation,
elementType: elementType
};
},
createGenericTypeAnnotation: function (id, typeParameters) {
return {
type: Syntax.GenericTypeAnnotation,
id: id,
typeParameters: typeParameters
};
},
createQualifiedTypeIdentifier: function (qualification, id) {
return {
type: Syntax.QualifiedTypeIdentifier,
qualification: qualification,
id: id
};
},
createTypeParameterDeclaration: function (params) {
return {
type: Syntax.TypeParameterDeclaration,
params: params
};
},
createTypeParameterInstantiation: function (params) {
return {
type: Syntax.TypeParameterInstantiation,
params: params
};
},
createAnyTypeAnnotation: function () {
return {
type: Syntax.AnyTypeAnnotation
};
},
createBooleanTypeAnnotation: function () {
return {
type: Syntax.BooleanTypeAnnotation
};
},
createNumberTypeAnnotation: function () {
return {
type: Syntax.NumberTypeAnnotation
};
},
createStringTypeAnnotation: function () {
return {
type: Syntax.StringTypeAnnotation
};
},
createStringLiteralTypeAnnotation: function (token) {
return {
type: Syntax.StringLiteralTypeAnnotation,
value: token.value,
raw: source.slice(token.range[0], token.range[1])
};
},
createVoidTypeAnnotation: function () {
return {
type: Syntax.VoidTypeAnnotation
};
},
createTypeofTypeAnnotation: function (argument) {
return {
type: Syntax.TypeofTypeAnnotation,
argument: argument
};
},
createTupleTypeAnnotation: function (types) {
return {
type: Syntax.TupleTypeAnnotation,
types: types
};
},
createObjectTypeAnnotation: function (properties, indexers, callProperties) {
return {
type: Syntax.ObjectTypeAnnotation,
properties: properties,
indexers: indexers,
callProperties: callProperties
};
},
createObjectTypeIndexer: function (id, key, value, isStatic) {
return {
type: Syntax.ObjectTypeIndexer,
id: id,
key: key,
value: value,
"static": isStatic
};
},
createObjectTypeCallProperty: function (value, isStatic) {
return {
type: Syntax.ObjectTypeCallProperty,
value: value,
"static": isStatic
};
},
createObjectTypeProperty: function (key, value, optional, isStatic) {
return {
type: Syntax.ObjectTypeProperty,
key: key,
value: value,
optional: optional,
"static": isStatic
};
},
createUnionTypeAnnotation: function (types) {
return {
type: Syntax.UnionTypeAnnotation,
types: types
};
},
createIntersectionTypeAnnotation: function (types) {
return {
type: Syntax.IntersectionTypeAnnotation,
types: types
};
},
createTypeAlias: function (id, typeParameters, right) {
return {
type: Syntax.TypeAlias,
id: id,
typeParameters: typeParameters,
right: right
};
},
createInterface: function (id, typeParameters, body, extended) {
return {
type: Syntax.InterfaceDeclaration,
id: id,
typeParameters: typeParameters,
body: body,
"extends": extended
};
},
createInterfaceExtends: function (id, typeParameters) {
return {
type: Syntax.InterfaceExtends,
id: id,
typeParameters: typeParameters
};
},
createDeclareFunction: function (id) {
return {
type: Syntax.DeclareFunction,
id: id
};
},
createDeclareVariable: function (id) {
return {
type: Syntax.DeclareVariable,
id: id
};
},
createDeclareModule: function (id, body) {
return {
type: Syntax.DeclareModule,
id: id,
body: body
};
},
createJSXAttribute: function (name, value) {
return {
type: Syntax.JSXAttribute,
name: name,
value: value || null
};
},
createJSXSpreadAttribute: function (argument) {
return {
type: Syntax.JSXSpreadAttribute,
argument: argument
};
},
createJSXIdentifier: function (name) {
return {
type: Syntax.JSXIdentifier,
name: name
};
},
createJSXNamespacedName: function (namespace, name) {
return {
type: Syntax.JSXNamespacedName,
namespace: namespace,
name: name
};
},
createJSXMemberExpression: function (object, property) {
return {
type: Syntax.JSXMemberExpression,
object: object,
property: property
};
},
createJSXElement: function (openingElement, closingElement, children) {
return {
type: Syntax.JSXElement,
openingElement: openingElement,
closingElement: closingElement,
children: children
};
},
createJSXEmptyExpression: function () {
return {
type: Syntax.JSXEmptyExpression
};
},
createJSXExpressionContainer: function (expression) {
return {
type: Syntax.JSXExpressionContainer,
expression: expression
};
},
createJSXOpeningElement: function (name, attributes, selfClosing) {
return {
type: Syntax.JSXOpeningElement,
name: name,
selfClosing: selfClosing,
attributes: attributes
};
},
createJSXClosingElement: function (name) {
return {
type: Syntax.JSXClosingElement,
name: name
};
},
createIfStatement: function (test, consequent, alternate) {
return {
type: Syntax.IfStatement,
test: test,
consequent: consequent,
alternate: alternate
};
},
createLabeledStatement: function (label, body) {
return {
type: Syntax.LabeledStatement,
label: label,
body: body
};
},
createLiteral: function (token) {
var object = {
type: Syntax.Literal,
value: token.value,
raw: source.slice(token.range[0], token.range[1])
};
if (token.regex) {
object.regex = token.regex;
}
return object;
},
createMemberExpression: function (accessor, object, property) {
return {
type: Syntax.MemberExpression,
computed: accessor === '[',
object: object,
property: property
};
},
createNewExpression: function (callee, args) {
return {
type: Syntax.NewExpression,
callee: callee,
'arguments': args
};
},
createObjectExpression: function (properties) {
return {
type: Syntax.ObjectExpression,
properties: properties
};
},
createPostfixExpression: function (operator, argument) {
return {
type: Syntax.UpdateExpression,
operator: operator,
argument: argument,
prefix: false
};
},
createProgram: function (body) {
return {
type: Syntax.Program,
body: body
};
},
createProperty: function (kind, key, value, method, shorthand, computed) {
return {
type: Syntax.Property,
key: key,
value: value,
kind: kind,
method: method,
shorthand: shorthand,
computed: computed
};
},
createReturnStatement: function (argument) {
return {
type: Syntax.ReturnStatement,
argument: argument
};
},
createSequenceExpression: function (expressions) {
return {
type: Syntax.SequenceExpression,
expressions: expressions
};
},
createSwitchCase: function (test, consequent) {
return {
type: Syntax.SwitchCase,
test: test,
consequent: consequent
};
},
createSwitchStatement: function (discriminant, cases) {
return {
type: Syntax.SwitchStatement,
discriminant: discriminant,
cases: cases
};
},
createThisExpression: function () {
return {
type: Syntax.ThisExpression
};
},
createThrowStatement: function (argument) {
return {
type: Syntax.ThrowStatement,
argument: argument
};
},
createTryStatement: function (block, guardedHandlers, handlers, finalizer) {
return {
type: Syntax.TryStatement,
block: block,
guardedHandlers: guardedHandlers,
handlers: handlers,
finalizer: finalizer
};
},
createUnaryExpression: function (operator, argument) {
if (operator === '++' || operator === '--') {
return {
type: Syntax.UpdateExpression,
operator: operator,
argument: argument,
prefix: true
};
}
return {
type: Syntax.UnaryExpression,
operator: operator,
argument: argument,
prefix: true
};
},
createVariableDeclaration: function (declarations, kind) {
return {
type: Syntax.VariableDeclaration,
declarations: declarations,
kind: kind
};
},
createVariableDeclarator: function (id, init) {
return {
type: Syntax.VariableDeclarator,
id: id,
init: init
};
},
createWhileStatement: function (test, body) {
return {
type: Syntax.WhileStatement,
test: test,
body: body
};
},
createWithStatement: function (object, body) {
return {
type: Syntax.WithStatement,
object: object,
body: body
};
},
createTemplateElement: function (value, tail) {
return {
type: Syntax.TemplateElement,
value: value,
tail: tail
};
},
createTemplateLiteral: function (quasis, expressions) {
return {
type: Syntax.TemplateLiteral,
quasis: quasis,
expressions: expressions
};
},
createSpreadElement: function (argument) {
return {
type: Syntax.SpreadElement,
argument: argument
};
},
createSpreadProperty: function (argument) {
return {
type: Syntax.SpreadProperty,
argument: argument
};
},
createTaggedTemplateExpression: function (tag, quasi) {
return {
type: Syntax.TaggedTemplateExpression,
tag: tag,
quasi: quasi
};
},
createArrowFunctionExpression: function (params, defaults, body, rest, expression, isAsync) {
var arrowExpr = {
type: Syntax.ArrowFunctionExpression,
id: null,
params: params,
defaults: defaults,
body: body,
rest: rest,
generator: false,
expression: expression
};
if (isAsync) {
arrowExpr.async = true;
}
return arrowExpr;
},
createMethodDefinition: function (propertyType, kind, key, value, computed) {
return {
type: Syntax.MethodDefinition,
key: key,
value: value,
kind: kind,
'static': propertyType === ClassPropertyType["static"],
computed: computed
};
},
createClassProperty: function (key, typeAnnotation, computed, isStatic) {
return {
type: Syntax.ClassProperty,
key: key,
typeAnnotation: typeAnnotation,
computed: computed,
"static": isStatic
};
},
createClassBody: function (body) {
return {
type: Syntax.ClassBody,
body: body
};
},
createClassImplements: function (id, typeParameters) {
return {
type: Syntax.ClassImplements,
id: id,
typeParameters: typeParameters
};
},
createClassExpression: function (id, superClass, body, typeParameters, superTypeParameters, implemented) {
return {
type: Syntax.ClassExpression,
id: id,
superClass: superClass,
body: body,
typeParameters: typeParameters,
superTypeParameters: superTypeParameters,
"implements": implemented
};
},
createClassDeclaration: function (id, superClass, body, typeParameters, superTypeParameters, implemented) {
return {
type: Syntax.ClassDeclaration,
id: id,
superClass: superClass,
body: body,
typeParameters: typeParameters,
superTypeParameters: superTypeParameters,
"implements": implemented
};
},
createModuleSpecifier: function (token) {
return {
type: Syntax.ModuleSpecifier,
value: token.value,
raw: source.slice(token.range[0], token.range[1])
};
},
createExportSpecifier: function (id, name) {
return {
type: Syntax.ExportSpecifier,
id: id,
name: name
};
},
createExportBatchSpecifier: function () {
return {
type: Syntax.ExportBatchSpecifier
};
},
createImportDefaultSpecifier: function (id) {
return {
type: Syntax.ImportDefaultSpecifier,
id: id
};
},
createImportNamespaceSpecifier: function (id) {
return {
type: Syntax.ImportNamespaceSpecifier,
id: id
};
},
createExportDeclaration: function (isDefault, declaration, specifiers, src) {
return {
type: Syntax.ExportDeclaration,
'default': !!isDefault,
declaration: declaration,
specifiers: specifiers,
source: src
};
},
createImportSpecifier: function (id, name) {
return {
type: Syntax.ImportSpecifier,
id: id,
name: name
};
},
createImportDeclaration: function (specifiers, src, isType) {
return {
type: Syntax.ImportDeclaration,
specifiers: specifiers,
source: src,
isType: isType
};
},
createYieldExpression: function (argument, dlg) {
return {
type: Syntax.YieldExpression,
argument: argument,
delegate: dlg
};
},
createAwaitExpression: function (argument) {
return {
type: Syntax.AwaitExpression,
argument: argument
};
},
createComprehensionExpression: function (filter, blocks, body) {
return {
type: Syntax.ComprehensionExpression,
filter: filter,
blocks: blocks,
body: body
};
}
};
// Return true if there is a line terminator before the next token.
function peekLineTerminator() {
var pos, line, start, found;
pos = index;
line = lineNumber;
start = lineStart;
skipComment();
found = lineNumber !== line;
index = pos;
lineNumber = line;
lineStart = start;
return found;
}
// Throw an exception
function throwError(token, messageFormat) {
var error,
args = Array.prototype.slice.call(arguments, 2),
msg = messageFormat.replace(
/%(\d)/g,
function (whole, idx) {
assert(idx < args.length, 'Message reference must be in range');
return args[idx];
}
);
if (typeof token.lineNumber === 'number') {
error = new Error('Line ' + token.lineNumber + ': ' + msg);
error.index = token.range[0];
error.lineNumber = token.lineNumber;
error.column = token.range[0] - lineStart + 1;
} else {
error = new Error('Line ' + lineNumber + ': ' + msg);
error.index = index;
error.lineNumber = lineNumber;
error.column = index - lineStart + 1;
}
error.description = msg;
throw error;
}
function throwErrorTolerant() {
try {
throwError.apply(null, arguments);
} catch (e) {
if (extra.errors) {
extra.errors.push(e);
} else {
throw e;
}
}
}
// Throw an exception because of the token.
function throwUnexpected(token) {
if (token.type === Token.EOF) {
throwError(token, Messages.UnexpectedEOS);
}
if (token.type === Token.NumericLiteral) {
throwError(token, Messages.UnexpectedNumber);
}
if (token.type === Token.StringLiteral || token.type === Token.JSXText) {
throwError(token, Messages.UnexpectedString);
}
if (token.type === Token.Identifier) {
throwError(token, Messages.UnexpectedIdentifier);
}
if (token.type === Token.Keyword) {
if (isFutureReservedWord(token.value)) {
throwError(token, Messages.UnexpectedReserved);
} else if (strict && isStrictModeReservedWord(token.value)) {
throwErrorTolerant(token, Messages.StrictReservedWord);
return;
}
throwError(token, Messages.UnexpectedToken, token.value);
}
if (token.type === Token.Template) {
throwError(token, Messages.UnexpectedTemplate, token.value.raw);
}
// BooleanLiteral, NullLiteral, or Punctuator.
throwError(token, Messages.UnexpectedToken, token.value);
}
// Expect the next token to match the specified punctuator.
// If not, an exception will be thrown.
function expect(value) {
var token = lex();
if (token.type !== Token.Punctuator || token.value !== value) {
throwUnexpected(token);
}
}
// Expect the next token to match the specified keyword.
// If not, an exception will be thrown.
function expectKeyword(keyword, contextual) {
var token = lex();
if (token.type !== (contextual ? Token.Identifier : Token.Keyword) ||
token.value !== keyword) {
throwUnexpected(token);
}
}
// Expect the next token to match the specified contextual keyword.
// If not, an exception will be thrown.
function expectContextualKeyword(keyword) {
return expectKeyword(keyword, true);
}
// Return true if the next token matches the specified punctuator.
function match(value) {
return lookahead.type === Token.Punctuator && lookahead.value === value;
}
// Return true if the next token matches the specified keyword
function matchKeyword(keyword, contextual) {
var expectedType = contextual ? Token.Identifier : Token.Keyword;
return lookahead.type === expectedType && lookahead.value === keyword;
}
// Return true if the next token matches the specified contextual keyword
function matchContextualKeyword(keyword) {
return matchKeyword(keyword, true);
}
// Return true if the next token is an assignment operator
function matchAssign() {
var op;
if (lookahead.type !== Token.Punctuator) {
return false;
}
op = lookahead.value;
return op === '=' ||
op === '*=' ||
op === '/=' ||
op === '%=' ||
op === '+=' ||
op === '-=' ||
op === '<<=' ||
op === '>>=' ||
op === '>>>=' ||
op === '&=' ||
op === '^=' ||
op === '|=';
}
// Note that 'yield' is treated as a keyword in strict mode, but a
// contextual keyword (identifier) in non-strict mode, so we need to
// use matchKeyword('yield', false) and matchKeyword('yield', true)
// (i.e. matchContextualKeyword) appropriately.
function matchYield() {
return state.yieldAllowed && matchKeyword('yield', !strict);
}
function matchAsync() {
var backtrackToken = lookahead, matches = false;
if (matchContextualKeyword('async')) {
lex(); // Make sure peekLineTerminator() starts after 'async'.
matches = !peekLineTerminator();
rewind(backtrackToken); // Revert the lex().
}
return matches;
}
function matchAwait() {
return state.awaitAllowed && matchContextualKeyword('await');
}
function consumeSemicolon() {
var line, oldIndex = index, oldLineNumber = lineNumber,
oldLineStart = lineStart, oldLookahead = lookahead;
// Catch the very common case first: immediately a semicolon (char #59).
if (source.charCodeAt(index) === 59) {
lex();
return;
}
line = lineNumber;
skipComment();
if (lineNumber !== line) {
index = oldIndex;
lineNumber = oldLineNumber;
lineStart = oldLineStart;
lookahead = oldLookahead;
return;
}
if (match(';')) {
lex();
return;
}
if (lookahead.type !== Token.EOF && !match('}')) {
throwUnexpected(lookahead);
}
}
// Return true if provided expression is LeftHandSideExpression
function isLeftHandSide(expr) {
return expr.type === Syntax.Identifier || expr.type === Syntax.MemberExpression;
}
function isAssignableLeftHandSide(expr) {
return isLeftHandSide(expr) || expr.type === Syntax.ObjectPattern || expr.type === Syntax.ArrayPattern;
}
// 11.1.4 Array Initialiser
function parseArrayInitialiser() {
var elements = [], blocks = [], filter = null, tmp, possiblecomprehension = true,
marker = markerCreate();
expect('[');
while (!match(']')) {
if (lookahead.value === 'for' &&
lookahead.type === Token.Keyword) {
if (!possiblecomprehension) {
throwError({}, Messages.ComprehensionError);
}
matchKeyword('for');
tmp = parseForStatement({ignoreBody: true});
tmp.of = tmp.type === Syntax.ForOfStatement;
tmp.type = Syntax.ComprehensionBlock;
if (tmp.left.kind) { // can't be let or const
throwError({}, Messages.ComprehensionError);
}
blocks.push(tmp);
} else if (lookahead.value === 'if' &&
lookahead.type === Token.Keyword) {
if (!possiblecomprehension) {
throwError({}, Messages.ComprehensionError);
}
expectKeyword('if');
expect('(');
filter = parseExpression();
expect(')');
} else if (lookahead.value === ',' &&
lookahead.type === Token.Punctuator) {
possiblecomprehension = false; // no longer allowed.
lex();
elements.push(null);
} else {
tmp = parseSpreadOrAssignmentExpression();
elements.push(tmp);
if (tmp && tmp.type === Syntax.SpreadElement) {
if (!match(']')) {
throwError({}, Messages.ElementAfterSpreadElement);
}
} else if (!(match(']') || matchKeyword('for') || matchKeyword('if'))) {
expect(','); // this lexes.
possiblecomprehension = false;
}
}
}
expect(']');
if (filter && !blocks.length) {
throwError({}, Messages.ComprehensionRequiresBlock);
}
if (blocks.length) {
if (elements.length !== 1) {
throwError({}, Messages.ComprehensionError);
}
return markerApply(marker, delegate.createComprehensionExpression(filter, blocks, elements[0]));
}
return markerApply(marker, delegate.createArrayExpression(elements));
}
// 11.1.5 Object Initialiser
function parsePropertyFunction(options) {
var previousStrict, previousYieldAllowed, previousAwaitAllowed,
params, defaults, body, marker = markerCreate();
previousStrict = strict;
previousYieldAllowed = state.yieldAllowed;
state.yieldAllowed = options.generator;
previousAwaitAllowed = state.awaitAllowed;
state.awaitAllowed = options.async;
params = options.params || [];
defaults = options.defaults || [];
body = parseConciseBody();
if (options.name && strict && isRestrictedWord(params[0].name)) {
throwErrorTolerant(options.name, Messages.StrictParamName);
}
strict = previousStrict;
state.yieldAllowed = previousYieldAllowed;
state.awaitAllowed = previousAwaitAllowed;
return markerApply(marker, delegate.createFunctionExpression(
null,
params,
defaults,
body,
options.rest || null,
options.generator,
body.type !== Syntax.BlockStatement,
options.async,
options.returnType,
options.typeParameters
));
}
function parsePropertyMethodFunction(options) {
var previousStrict, tmp, method;
previousStrict = strict;
strict = true;
tmp = parseParams();
if (tmp.stricted) {
throwErrorTolerant(tmp.stricted, tmp.message);
}
method = parsePropertyFunction({
params: tmp.params,
defaults: tmp.defaults,
rest: tmp.rest,
generator: options.generator,
async: options.async,
returnType: tmp.returnType,
typeParameters: options.typeParameters
});
strict = previousStrict;
return method;
}
function parseObjectPropertyKey() {
var marker = markerCreate(),
token = lex(),
propertyKey,
result;
// Note: This function is called only from parseObjectProperty(), where
// EOF and Punctuator tokens are already filtered out.
if (token.type === Token.StringLiteral || token.type === Token.NumericLiteral) {
if (strict && token.octal) {
throwErrorTolerant(token, Messages.StrictOctalLiteral);
}
return markerApply(marker, delegate.createLiteral(token));
}
if (token.type === Token.Punctuator && token.value === '[') {
// For computed properties we should skip the [ and ], and
// capture in marker only the assignment expression itself.
marker = markerCreate();
propertyKey = parseAssignmentExpression();
result = markerApply(marker, propertyKey);
expect(']');
return result;
}
return markerApply(marker, delegate.createIdentifier(token.value));
}
function parseObjectProperty() {
var token, key, id, param, computed,
marker = markerCreate(), returnType, typeParameters;
token = lookahead;
computed = (token.value === '[' && token.type === Token.Punctuator);
if (token.type === Token.Identifier || computed || matchAsync()) {
id = parseObjectPropertyKey();
if (match(':')) {
lex();
return markerApply(
marker,
delegate.createProperty(
'init',
id,
parseAssignmentExpression(),
false,
false,
computed
)
);
}
if (match('(') || match('<')) {
if (match('<')) {
typeParameters = parseTypeParameterDeclaration();
}
return markerApply(
marker,
delegate.createProperty(
'init',
id,
parsePropertyMethodFunction({
generator: false,
async: false,
typeParameters: typeParameters
}),
true,
false,
computed
)
);
}
// Property Assignment: Getter and Setter.
if (token.value === 'get') {
computed = (lookahead.value === '[');
key = parseObjectPropertyKey();
expect('(');
expect(')');
if (match(':')) {
returnType = parseTypeAnnotation();
}
return markerApply(
marker,
delegate.createProperty(
'get',
key,
parsePropertyFunction({
generator: false,
async: false,
returnType: returnType
}),
false,
false,
computed
)
);
}
if (token.value === 'set') {
computed = (lookahead.value === '[');
key = parseObjectPropertyKey();
expect('(');
token = lookahead;
param = [ parseTypeAnnotatableIdentifier() ];
expect(')');
if (match(':')) {
returnType = parseTypeAnnotation();
}
return markerApply(
marker,
delegate.createProperty(
'set',
key,
parsePropertyFunction({
params: param,
generator: false,
async: false,
name: token,
returnType: returnType
}),
false,
false,
computed
)
);
}
if (token.value === 'async') {
computed = (lookahead.value === '[');
key = parseObjectPropertyKey();
if (match('<')) {
typeParameters = parseTypeParameterDeclaration();
}
return markerApply(
marker,
delegate.createProperty(
'init',
key,
parsePropertyMethodFunction({
generator: false,
async: true,
typeParameters: typeParameters
}),
true,
false,
computed
)
);
}
if (computed) {
// Computed properties can only be used with full notation.
throwUnexpected(lookahead);
}
return markerApply(
marker,
delegate.createProperty('init', id, id, false, true, false)
);
}
if (token.type === Token.EOF || token.type === Token.Punctuator) {
if (!match('*')) {
throwUnexpected(token);
}
lex();
computed = (lookahead.type === Token.Punctuator && lookahead.value === '[');
id = parseObjectPropertyKey();
if (match('<')) {
typeParameters = parseTypeParameterDeclaration();
}
if (!match('(')) {
throwUnexpected(lex());
}
return markerApply(marker, delegate.createProperty(
'init',
id,
parsePropertyMethodFunction({
generator: true,
typeParameters: typeParameters
}),
true,
false,
computed
));
}
key = parseObjectPropertyKey();
if (match(':')) {
lex();
return markerApply(marker, delegate.createProperty('init', key, parseAssignmentExpression(), false, false, false));
}
if (match('(') || match('<')) {
if (match('<')) {
typeParameters = parseTypeParameterDeclaration();
}
return markerApply(marker, delegate.createProperty(
'init',
key,
parsePropertyMethodFunction({
generator: false,
typeParameters: typeParameters
}),
true,
false,
false
));
}
throwUnexpected(lex());
}
function parseObjectSpreadProperty() {
var marker = markerCreate();
expect('...');
return markerApply(marker, delegate.createSpreadProperty(parseAssignmentExpression()));
}
function getFieldName(key) {
var toString = String;
if (key.type === Syntax.Identifier) {
return key.name;
}
return toString(key.value);
}
function parseObjectInitialiser() {
var properties = [], property, name, kind, storedKind, map = new StringMap(),
marker = markerCreate(), toString = String;
expect('{');
while (!match('}')) {
if (match('...')) {
property = parseObjectSpreadProperty();
} else {
property = parseObjectProperty();
if (property.key.type === Syntax.Identifier) {
name = property.key.name;
} else {
name = toString(property.key.value);
}
kind = (property.kind === 'init') ? PropertyKind.Data : (property.kind === 'get') ? PropertyKind.Get : PropertyKind.Set;
if (map.has(name)) {
storedKind = map.get(name);
if (storedKind === PropertyKind.Data) {
if (strict && kind === PropertyKind.Data) {
throwErrorTolerant({}, Messages.StrictDuplicateProperty);
} else if (kind !== PropertyKind.Data) {
throwErrorTolerant({}, Messages.AccessorDataProperty);
}
} else {
if (kind === PropertyKind.Data) {
throwErrorTolerant({}, Messages.AccessorDataProperty);
} else if (storedKind & kind) {
throwErrorTolerant({}, Messages.AccessorGetSet);
}
}
map.set(name, storedKind | kind);
} else {
map.set(name, kind);
}
}
properties.push(property);
if (!match('}')) {
expect(',');
}
}
expect('}');
return markerApply(marker, delegate.createObjectExpression(properties));
}
function parseTemplateElement(option) {
var marker = markerCreate(),
token = scanTemplateElement(option);
if (strict && token.octal) {
throwError(token, Messages.StrictOctalLiteral);
}
return markerApply(marker, delegate.createTemplateElement({ raw: token.value.raw, cooked: token.value.cooked }, token.tail));
}
function parseTemplateLiteral() {
var quasi, quasis, expressions, marker = markerCreate();
quasi = parseTemplateElement({ head: true });
quasis = [ quasi ];
expressions = [];
while (!quasi.tail) {
expressions.push(parseExpression());
quasi = parseTemplateElement({ head: false });
quasis.push(quasi);
}
return markerApply(marker, delegate.createTemplateLiteral(quasis, expressions));
}
// 11.1.6 The Grouping Operator
function parseGroupExpression() {
var expr, marker, typeAnnotation;
expect('(');
++state.parenthesizedCount;
marker = markerCreate();
expr = parseExpression();
if (match(':')) {
typeAnnotation = parseTypeAnnotation();
expr = markerApply(marker, delegate.createTypeCast(
expr,
typeAnnotation
));
}
expect(')');
return expr;
}
function matchAsyncFuncExprOrDecl() {
var token;
if (matchAsync()) {
token = lookahead2();
if (token.type === Token.Keyword && token.value === 'function') {
return true;
}
}
return false;
}
// 11.1 Primary Expressions
function parsePrimaryExpression() {
var marker, type, token, expr;
type = lookahead.type;
if (type === Token.Identifier) {
marker = markerCreate();
return markerApply(marker, delegate.createIdentifier(lex().value));
}
if (type === Token.StringLiteral || type === Token.NumericLiteral) {
if (strict && lookahead.octal) {
throwErrorTolerant(lookahead, Messages.StrictOctalLiteral);
}
marker = markerCreate();
return markerApply(marker, delegate.createLiteral(lex()));
}
if (type === Token.Keyword) {
if (matchKeyword('this')) {
marker = markerCreate();
lex();
return markerApply(marker, delegate.createThisExpression());
}
if (matchKeyword('function')) {
return parseFunctionExpression();
}
if (matchKeyword('class')) {
return parseClassExpression();
}
if (matchKeyword('super')) {
marker = markerCreate();
lex();
return markerApply(marker, delegate.createIdentifier('super'));
}
}
if (type === Token.BooleanLiteral) {
marker = markerCreate();
token = lex();
token.value = (token.value === 'true');
return markerApply(marker, delegate.createLiteral(token));
}
if (type === Token.NullLiteral) {
marker = markerCreate();
token = lex();
token.value = null;
return markerApply(marker, delegate.createLiteral(token));
}
if (match('[')) {
return parseArrayInitialiser();
}
if (match('{')) {
return parseObjectInitialiser();
}
if (match('(')) {
return parseGroupExpression();
}
if (match('/') || match('/=')) {
marker = markerCreate();
expr = delegate.createLiteral(scanRegExp());
peek();
return markerApply(marker, expr);
}
if (type === Token.Template) {
return parseTemplateLiteral();
}
if (match('<')) {
return parseJSXElement();
}
throwUnexpected(lex());
}
// 11.2 Left-Hand-Side Expressions
function parseArguments() {
var args = [], arg;
expect('(');
if (!match(')')) {
while (index < length) {
arg = parseSpreadOrAssignmentExpression();
args.push(arg);
if (match(')')) {
break;
} else if (arg.type === Syntax.SpreadElement) {
throwError({}, Messages.ElementAfterSpreadElement);
}
expect(',');
}
}
expect(')');
return args;
}
function parseSpreadOrAssignmentExpression() {
if (match('...')) {
var marker = markerCreate();
lex();
return markerApply(marker, delegate.createSpreadElement(parseAssignmentExpression()));
}
return parseAssignmentExpression();
}
function parseNonComputedProperty() {
var marker = markerCreate(),
token = lex();
if (!isIdentifierName(token)) {
throwUnexpected(token);
}
return markerApply(marker, delegate.createIdentifier(token.value));
}
function parseNonComputedMember() {
expect('.');
return parseNonComputedProperty();
}
function parseComputedMember() {
var expr;
expect('[');
expr = parseExpression();
expect(']');
return expr;
}
function parseNewExpression() {
var callee, args, marker = markerCreate();
expectKeyword('new');
callee = parseLeftHandSideExpression();
args = match('(') ? parseArguments() : [];
return markerApply(marker, delegate.createNewExpression(callee, args));
}
function parseLeftHandSideExpressionAllowCall() {
var expr, args, marker = markerCreate();
expr = matchKeyword('new') ? parseNewExpression() : parsePrimaryExpression();
while (match('.') || match('[') || match('(') || lookahead.type === Token.Template) {
if (match('(')) {
args = parseArguments();
expr = markerApply(marker, delegate.createCallExpression(expr, args));
} else if (match('[')) {
expr = markerApply(marker, delegate.createMemberExpression('[', expr, parseComputedMember()));
} else if (match('.')) {
expr = markerApply(marker, delegate.createMemberExpression('.', expr, parseNonComputedMember()));
} else {
expr = markerApply(marker, delegate.createTaggedTemplateExpression(expr, parseTemplateLiteral()));
}
}
return expr;
}
function parseLeftHandSideExpression() {
var expr, marker = markerCreate();
expr = matchKeyword('new') ? parseNewExpression() : parsePrimaryExpression();
while (match('.') || match('[') || lookahead.type === Token.Template) {
if (match('[')) {
expr = markerApply(marker, delegate.createMemberExpression('[', expr, parseComputedMember()));
} else if (match('.')) {
expr = markerApply(marker, delegate.createMemberExpression('.', expr, parseNonComputedMember()));
} else {
expr = markerApply(marker, delegate.createTaggedTemplateExpression(expr, parseTemplateLiteral()));
}
}
return expr;
}
// 11.3 Postfix Expressions
function parsePostfixExpression() {
var marker = markerCreate(),
expr = parseLeftHandSideExpressionAllowCall(),
token;
if (lookahead.type !== Token.Punctuator) {
return expr;
}
if ((match('++') || match('--')) && !peekLineTerminator()) {
// 11.3.1, 11.3.2
if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) {
throwErrorTolerant({}, Messages.StrictLHSPostfix);
}
if (!isLeftHandSide(expr)) {
throwError({}, Messages.InvalidLHSInAssignment);
}
token = lex();
expr = markerApply(marker, delegate.createPostfixExpression(token.value, expr));
}
return expr;
}
// 11.4 Unary Operators
function parseUnaryExpression() {
var marker, token, expr;
if (lookahead.type !== Token.Punctuator && lookahead.type !== Token.Keyword) {
return parsePostfixExpression();
}
if (match('++') || match('--')) {
marker = markerCreate();
token = lex();
expr = parseUnaryExpression();
// 11.4.4, 11.4.5
if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) {
throwErrorTolerant({}, Messages.StrictLHSPrefix);
}
if (!isLeftHandSide(expr)) {
throwError({}, Messages.InvalidLHSInAssignment);
}
return markerApply(marker, delegate.createUnaryExpression(token.value, expr));
}
if (match('+') || match('-') || match('~') || match('!')) {
marker = markerCreate();
token = lex();
expr = parseUnaryExpression();
return markerApply(marker, delegate.createUnaryExpression(token.value, expr));
}
if (matchKeyword('delete') || matchKeyword('void') || matchKeyword('typeof')) {
marker = markerCreate();
token = lex();
expr = parseUnaryExpression();
expr = markerApply(marker, delegate.createUnaryExpression(token.value, expr));
if (strict && expr.operator === 'delete' && expr.argument.type === Syntax.Identifier) {
throwErrorTolerant({}, Messages.StrictDelete);
}
return expr;
}
return parsePostfixExpression();
}
function binaryPrecedence(token, allowIn) {
var prec = 0;
if (token.type !== Token.Punctuator && token.type !== Token.Keyword) {
return 0;
}
switch (token.value) {
case '||':
prec = 1;
break;
case '&&':
prec = 2;
break;
case '|':
prec = 3;
break;
case '^':
prec = 4;
break;
case '&':
prec = 5;
break;
case '==':
case '!=':
case '===':
case '!==':
prec = 6;
break;
case '<':
case '>':
case '<=':
case '>=':
case 'instanceof':
prec = 7;
break;
case 'in':
prec = allowIn ? 7 : 0;
break;
case '<<':
case '>>':
case '>>>':
prec = 8;
break;
case '+':
case '-':
prec = 9;
break;
case '*':
case '/':
case '%':
prec = 11;
break;
default:
break;
}
return prec;
}
// 11.5 Multiplicative Operators
// 11.6 Additive Operators
// 11.7 Bitwise Shift Operators
// 11.8 Relational Operators
// 11.9 Equality Operators
// 11.10 Binary Bitwise Operators
// 11.11 Binary Logical Operators
function parseBinaryExpression() {
var expr, token, prec, previousAllowIn, stack, right, operator, left, i,
marker, markers;
previousAllowIn = state.allowIn;
state.allowIn = true;
marker = markerCreate();
left = parseUnaryExpression();
token = lookahead;
prec = binaryPrecedence(token, previousAllowIn);
if (prec === 0) {
return left;
}
token.prec = prec;
lex();
markers = [marker, markerCreate()];
right = parseUnaryExpression();
stack = [left, token, right];
while ((prec = binaryPrecedence(lookahead, previousAllowIn)) > 0) {
// Reduce: make a binary expression from the three topmost entries.
while ((stack.length > 2) && (prec <= stack[stack.length - 2].prec)) {
right = stack.pop();
operator = stack.pop().value;
left = stack.pop();
expr = delegate.createBinaryExpression(operator, left, right);
markers.pop();
marker = markers.pop();
markerApply(marker, expr);
stack.push(expr);
markers.push(marker);
}
// Shift.
token = lex();
token.prec = prec;
stack.push(token);
markers.push(markerCreate());
expr = parseUnaryExpression();
stack.push(expr);
}
state.allowIn = previousAllowIn;
// Final reduce to clean-up the stack.
i = stack.length - 1;
expr = stack[i];
markers.pop();
while (i > 1) {
expr = delegate.createBinaryExpression(stack[i - 1].value, stack[i - 2], expr);
i -= 2;
marker = markers.pop();
markerApply(marker, expr);
}
return expr;
}
// 11.12 Conditional Operator
function parseConditionalExpression() {
var expr, previousAllowIn, consequent, alternate, marker = markerCreate();
expr = parseBinaryExpression();
if (match('?')) {
lex();
previousAllowIn = state.allowIn;
state.allowIn = true;
consequent = parseAssignmentExpression();
state.allowIn = previousAllowIn;
expect(':');
alternate = parseAssignmentExpression();
expr = markerApply(marker, delegate.createConditionalExpression(expr, consequent, alternate));
}
return expr;
}
// 11.13 Assignment Operators
// 12.14.5 AssignmentPattern
function reinterpretAsAssignmentBindingPattern(expr) {
var i, len, property, element;
if (expr.type === Syntax.ObjectExpression) {
expr.type = Syntax.ObjectPattern;
for (i = 0, len = expr.properties.length; i < len; i += 1) {
property = expr.properties[i];
if (property.type === Syntax.SpreadProperty) {
if (i < len - 1) {
throwError({}, Messages.PropertyAfterSpreadProperty);
}
reinterpretAsAssignmentBindingPattern(property.argument);
} else {
if (property.kind !== 'init') {
throwError({}, Messages.InvalidLHSInAssignment);
}
reinterpretAsAssignmentBindingPattern(property.value);
}
}
} else if (expr.type === Syntax.ArrayExpression) {
expr.type = Syntax.ArrayPattern;
for (i = 0, len = expr.elements.length; i < len; i += 1) {
element = expr.elements[i];
/* istanbul ignore else */
if (element) {
reinterpretAsAssignmentBindingPattern(element);
}
}
} else if (expr.type === Syntax.Identifier) {
if (isRestrictedWord(expr.name)) {
throwError({}, Messages.InvalidLHSInAssignment);
}
} else if (expr.type === Syntax.SpreadElement) {
reinterpretAsAssignmentBindingPattern(expr.argument);
if (expr.argument.type === Syntax.ObjectPattern) {
throwError({}, Messages.ObjectPatternAsSpread);
}
} else {
/* istanbul ignore else */
if (expr.type !== Syntax.MemberExpression && expr.type !== Syntax.CallExpression && expr.type !== Syntax.NewExpression) {
throwError({}, Messages.InvalidLHSInAssignment);
}
}
}
// 13.2.3 BindingPattern
function reinterpretAsDestructuredParameter(options, expr) {
var i, len, property, element;
if (expr.type === Syntax.ObjectExpression) {
expr.type = Syntax.ObjectPattern;
for (i = 0, len = expr.properties.length; i < len; i += 1) {
property = expr.properties[i];
if (property.type === Syntax.SpreadProperty) {
if (i < len - 1) {
throwError({}, Messages.PropertyAfterSpreadProperty);
}
reinterpretAsDestructuredParameter(options, property.argument);
} else {
if (property.kind !== 'init') {
throwError({}, Messages.InvalidLHSInFormalsList);
}
reinterpretAsDestructuredParameter(options, property.value);
}
}
} else if (expr.type === Syntax.ArrayExpression) {
expr.type = Syntax.ArrayPattern;
for (i = 0, len = expr.elements.length; i < len; i += 1) {
element = expr.elements[i];
if (element) {
reinterpretAsDestructuredParameter(options, element);
}
}
} else if (expr.type === Syntax.Identifier) {
validateParam(options, expr, expr.name);
} else if (expr.type === Syntax.SpreadElement) {
// BindingRestElement only allows BindingIdentifier
if (expr.argument.type !== Syntax.Identifier) {
throwError({}, Messages.InvalidLHSInFormalsList);
}
validateParam(options, expr.argument, expr.argument.name);
} else {
throwError({}, Messages.InvalidLHSInFormalsList);
}
}
function reinterpretAsCoverFormalsList(expressions) {
var i, len, param, params, defaults, defaultCount, options, rest;
params = [];
defaults = [];
defaultCount = 0;
rest = null;
options = {
paramSet: new StringMap()
};
for (i = 0, len = expressions.length; i < len; i += 1) {
param = expressions[i];
if (param.type === Syntax.Identifier) {
params.push(param);
defaults.push(null);
validateParam(options, param, param.name);
} else if (param.type === Syntax.ObjectExpression || param.type === Syntax.ArrayExpression) {
reinterpretAsDestructuredParameter(options, param);
params.push(param);
defaults.push(null);
} else if (param.type === Syntax.SpreadElement) {
assert(i === len - 1, 'It is guaranteed that SpreadElement is last element by parseExpression');
if (param.argument.type !== Syntax.Identifier) {
throwError({}, Messages.InvalidLHSInFormalsList);
}
reinterpretAsDestructuredParameter(options, param.argument);
rest = param.argument;
} else if (param.type === Syntax.AssignmentExpression) {
params.push(param.left);
defaults.push(param.right);
++defaultCount;
validateParam(options, param.left, param.left.name);
} else {
return null;
}
}
if (options.message === Messages.StrictParamDupe) {
throwError(
strict ? options.stricted : options.firstRestricted,
options.message
);
}
if (defaultCount === 0) {
defaults = [];
}
return {
params: params,
defaults: defaults,
rest: rest,
stricted: options.stricted,
firstRestricted: options.firstRestricted,
message: options.message
};
}
function parseArrowFunctionExpression(options, marker) {
var previousStrict, previousYieldAllowed, previousAwaitAllowed, body;
expect('=>');
previousStrict = strict;
previousYieldAllowed = state.yieldAllowed;
state.yieldAllowed = false;
previousAwaitAllowed = state.awaitAllowed;
state.awaitAllowed = !!options.async;
body = parseConciseBody();
if (strict && options.firstRestricted) {
throwError(options.firstRestricted, options.message);
}
if (strict && options.stricted) {
throwErrorTolerant(options.stricted, options.message);
}
strict = previousStrict;
state.yieldAllowed = previousYieldAllowed;
state.awaitAllowed = previousAwaitAllowed;
return markerApply(marker, delegate.createArrowFunctionExpression(
options.params,
options.defaults,
body,
options.rest,
body.type !== Syntax.BlockStatement,
!!options.async
));
}
function parseAssignmentExpression() {
var marker, expr, token, params, oldParenthesizedCount,
startsWithParen = false, backtrackToken = lookahead,
possiblyAsync = false;
if (matchYield()) {
return parseYieldExpression();
}
if (matchAwait()) {
return parseAwaitExpression();
}
oldParenthesizedCount = state.parenthesizedCount;
marker = markerCreate();
if (matchAsyncFuncExprOrDecl()) {
return parseFunctionExpression();
}
if (matchAsync()) {
// We can't be completely sure that this 'async' token is
// actually a contextual keyword modifying a function
// expression, so we might have to un-lex() it later by
// calling rewind(backtrackToken).
possiblyAsync = true;
lex();
}
if (match('(')) {
token = lookahead2();
if ((token.type === Token.Punctuator && token.value === ')') || token.value === '...') {
params = parseParams();
if (!match('=>')) {
throwUnexpected(lex());
}
params.async = possiblyAsync;
return parseArrowFunctionExpression(params, marker);
}
startsWithParen = true;
}
token = lookahead;
// If the 'async' keyword is not followed by a '(' character or an
// identifier, then it can't be an arrow function modifier, and we
// should interpret it as a normal identifer.
if (possiblyAsync && !match('(') && token.type !== Token.Identifier) {
possiblyAsync = false;
rewind(backtrackToken);
}
expr = parseConditionalExpression();
if (match('=>') &&
(state.parenthesizedCount === oldParenthesizedCount ||
state.parenthesizedCount === (oldParenthesizedCount + 1))) {
if (expr.type === Syntax.Identifier) {
params = reinterpretAsCoverFormalsList([ expr ]);
} else if (expr.type === Syntax.AssignmentExpression ||
expr.type === Syntax.ArrayExpression ||
expr.type === Syntax.ObjectExpression) {
if (!startsWithParen) {
throwUnexpected(lex());
}
params = reinterpretAsCoverFormalsList([ expr ]);
} else if (expr.type === Syntax.SequenceExpression) {
params = reinterpretAsCoverFormalsList(expr.expressions);
}
if (params) {
params.async = possiblyAsync;
return parseArrowFunctionExpression(params, marker);
}
}
// If we haven't returned by now, then the 'async' keyword was not
// a function modifier, and we should rewind and interpret it as a
// normal identifier.
if (possiblyAsync) {
possiblyAsync = false;
rewind(backtrackToken);
expr = parseConditionalExpression();
}
if (matchAssign()) {
// 11.13.1
if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) {
throwErrorTolerant(token, Messages.StrictLHSAssignment);
}
// ES.next draf 11.13 Runtime Semantics step 1
if (match('=') && (expr.type === Syntax.ObjectExpression || expr.type === Syntax.ArrayExpression)) {
reinterpretAsAssignmentBindingPattern(expr);
} else if (!isLeftHandSide(expr)) {
throwError({}, Messages.InvalidLHSInAssignment);
}
expr = markerApply(marker, delegate.createAssignmentExpression(lex().value, expr, parseAssignmentExpression()));
}
return expr;
}
// 11.14 Comma Operator
function parseExpression() {
var marker, expr, expressions, sequence, spreadFound;
marker = markerCreate();
expr = parseAssignmentExpression();
expressions = [ expr ];
if (match(',')) {
while (index < length) {
if (!match(',')) {
break;
}
lex();
expr = parseSpreadOrAssignmentExpression();
expressions.push(expr);
if (expr.type === Syntax.SpreadElement) {
spreadFound = true;
if (!match(')')) {
throwError({}, Messages.ElementAfterSpreadElement);
}
break;
}
}
sequence = markerApply(marker, delegate.createSequenceExpression(expressions));
}
if (spreadFound && lookahead2().value !== '=>') {
throwError({}, Messages.IllegalSpread);
}
return sequence || expr;
}
// 12.1 Block
function parseStatementList() {
var list = [],
statement;
while (index < length) {
if (match('}')) {
break;
}
statement = parseSourceElement();
if (typeof statement === 'undefined') {
break;
}
list.push(statement);
}
return list;
}
function parseBlock() {
var block, marker = markerCreate();
expect('{');
block = parseStatementList();
expect('}');
return markerApply(marker, delegate.createBlockStatement(block));
}
// 12.2 Variable Statement
function parseTypeParameterDeclaration() {
var marker = markerCreate(), paramTypes = [];
expect('<');
while (!match('>')) {
paramTypes.push(parseTypeAnnotatableIdentifier());
if (!match('>')) {
expect(',');
}
}
expect('>');
return markerApply(marker, delegate.createTypeParameterDeclaration(
paramTypes
));
}
function parseTypeParameterInstantiation() {
var marker = markerCreate(), oldInType = state.inType, paramTypes = [];
state.inType = true;
expect('<');
while (!match('>')) {
paramTypes.push(parseType());
if (!match('>')) {
expect(',');
}
}
expect('>');
state.inType = oldInType;
return markerApply(marker, delegate.createTypeParameterInstantiation(
paramTypes
));
}
function parseObjectTypeIndexer(marker, isStatic) {
var id, key, value;
expect('[');
id = parseObjectPropertyKey();
expect(':');
key = parseType();
expect(']');
expect(':');
value = parseType();
return markerApply(marker, delegate.createObjectTypeIndexer(
id,
key,
value,
isStatic
));
}
function parseObjectTypeMethodish(marker) {
var params = [], rest = null, returnType, typeParameters = null;
if (match('<')) {
typeParameters = parseTypeParameterDeclaration();
}
expect('(');
while (lookahead.type === Token.Identifier) {
params.push(parseFunctionTypeParam());
if (!match(')')) {
expect(',');
}
}
if (match('...')) {
lex();
rest = parseFunctionTypeParam();
}
expect(')');
expect(':');
returnType = parseType();
return markerApply(marker, delegate.createFunctionTypeAnnotation(
params,
returnType,
rest,
typeParameters
));
}
function parseObjectTypeMethod(marker, isStatic, key) {
var optional = false, value;
value = parseObjectTypeMethodish(marker);
return markerApply(marker, delegate.createObjectTypeProperty(
key,
value,
optional,
isStatic
));
}
function parseObjectTypeCallProperty(marker, isStatic) {
var valueMarker = markerCreate();
return markerApply(marker, delegate.createObjectTypeCallProperty(
parseObjectTypeMethodish(valueMarker),
isStatic
));
}
function parseObjectType(allowStatic) {
var callProperties = [], indexers = [], marker, optional = false,
properties = [], propertyKey, propertyTypeAnnotation,
token, isStatic, matchStatic;
expect('{');
while (!match('}')) {
marker = markerCreate();
matchStatic =
strict
? matchKeyword('static')
: matchContextualKeyword('static');
if (allowStatic && matchStatic) {
token = lex();
isStatic = true;
}
if (match('[')) {
indexers.push(parseObjectTypeIndexer(marker, isStatic));
} else if (match('(') || match('<')) {
callProperties.push(parseObjectTypeCallProperty(marker, allowStatic));
} else {
if (isStatic && match(':')) {
propertyKey = markerApply(marker, delegate.createIdentifier(token));
throwErrorTolerant(token, Messages.StrictReservedWord);
} else {
propertyKey = parseObjectPropertyKey();
}
if (match('<') || match('(')) {
// This is a method property
properties.push(parseObjectTypeMethod(marker, isStatic, propertyKey));
} else {
if (match('?')) {
lex();
optional = true;
}
expect(':');
propertyTypeAnnotation = parseType();
properties.push(markerApply(marker, delegate.createObjectTypeProperty(
propertyKey,
propertyTypeAnnotation,
optional,
isStatic
)));
}
}
if (match(';')) {
lex();
} else if (!match('}')) {
throwUnexpected(lookahead);
}
}
expect('}');
return delegate.createObjectTypeAnnotation(
properties,
indexers,
callProperties
);
}
function parseGenericType() {
var marker = markerCreate(),
typeParameters = null, typeIdentifier;
typeIdentifier = parseVariableIdentifier();
while (match('.')) {
expect('.');
typeIdentifier = markerApply(marker, delegate.createQualifiedTypeIdentifier(
typeIdentifier,
parseVariableIdentifier()
));
}
if (match('<')) {
typeParameters = parseTypeParameterInstantiation();
}
return markerApply(marker, delegate.createGenericTypeAnnotation(
typeIdentifier,
typeParameters
));
}
function parseVoidType() {
var marker = markerCreate();
expectKeyword('void');
return markerApply(marker, delegate.createVoidTypeAnnotation());
}
function parseTypeofType() {
var argument, marker = markerCreate();
expectKeyword('typeof');
argument = parsePrimaryType();
return markerApply(marker, delegate.createTypeofTypeAnnotation(
argument
));
}
function parseTupleType() {
var marker = markerCreate(), types = [];
expect('[');
// We allow trailing commas
while (index < length && !match(']')) {
types.push(parseType());
if (match(']')) {
break;
}
expect(',');
}
expect(']');
return markerApply(marker, delegate.createTupleTypeAnnotation(
types
));
}
function parseFunctionTypeParam() {
var marker = markerCreate(), name, optional = false, typeAnnotation;
name = parseVariableIdentifier();
if (match('?')) {
lex();
optional = true;
}
expect(':');
typeAnnotation = parseType();
return markerApply(marker, delegate.createFunctionTypeParam(
name,
typeAnnotation,
optional
));
}
function parseFunctionTypeParams() {
var ret = { params: [], rest: null };
while (lookahead.type === Token.Identifier) {
ret.params.push(parseFunctionTypeParam());
if (!match(')')) {
expect(',');
}
}
if (match('...')) {
lex();
ret.rest = parseFunctionTypeParam();
}
return ret;
}
// The parsing of types roughly parallels the parsing of expressions, and
// primary types are kind of like primary expressions...they're the
// primitives with which other types are constructed.
function parsePrimaryType() {
var params = null, returnType = null,
marker = markerCreate(), rest = null, tmp,
typeParameters, token, type, isGroupedType = false;
switch (lookahead.type) {
case Token.Identifier:
switch (lookahead.value) {
case 'any':
lex();
return markerApply(marker, delegate.createAnyTypeAnnotation());
case 'bool': // fallthrough
case 'boolean':
lex();
return markerApply(marker, delegate.createBooleanTypeAnnotation());
case 'number':
lex();
return markerApply(marker, delegate.createNumberTypeAnnotation());
case 'string':
lex();
return markerApply(marker, delegate.createStringTypeAnnotation());
}
return markerApply(marker, parseGenericType());
case Token.Punctuator:
switch (lookahead.value) {
case '{':
return markerApply(marker, parseObjectType());
case '[':
return parseTupleType();
case '<':
typeParameters = parseTypeParameterDeclaration();
expect('(');
tmp = parseFunctionTypeParams();
params = tmp.params;
rest = tmp.rest;
expect(')');
expect('=>');
returnType = parseType();
return markerApply(marker, delegate.createFunctionTypeAnnotation(
params,
returnType,
rest,
typeParameters
));
case '(':
lex();
// Check to see if this is actually a grouped type
if (!match(')') && !match('...')) {
if (lookahead.type === Token.Identifier) {
token = lookahead2();
isGroupedType = token.value !== '?' && token.value !== ':';
} else {
isGroupedType = true;
}
}
if (isGroupedType) {
type = parseType();
expect(')');
// If we see a => next then someone was probably confused about
// function types, so we can provide a better error message
if (match('=>')) {
throwError({}, Messages.ConfusedAboutFunctionType);
}
return type;
}
tmp = parseFunctionTypeParams();
params = tmp.params;
rest = tmp.rest;
expect(')');
expect('=>');
returnType = parseType();
return markerApply(marker, delegate.createFunctionTypeAnnotation(
params,
returnType,
rest,
null /* typeParameters */
));
}
break;
case Token.Keyword:
switch (lookahead.value) {
case 'void':
return markerApply(marker, parseVoidType());
case 'typeof':
return markerApply(marker, parseTypeofType());
}
break;
case Token.StringLiteral:
token = lex();
if (token.octal) {
throwError(token, Messages.StrictOctalLiteral);
}
return markerApply(marker, delegate.createStringLiteralTypeAnnotation(
token
));
}
throwUnexpected(lookahead);
}
function parsePostfixType() {
var marker = markerCreate(), t = parsePrimaryType();
if (match('[')) {
expect('[');
expect(']');
return markerApply(marker, delegate.createArrayTypeAnnotation(t));
}
return t;
}
function parsePrefixType() {
var marker = markerCreate();
if (match('?')) {
lex();
return markerApply(marker, delegate.createNullableTypeAnnotation(
parsePrefixType()
));
}
return parsePostfixType();
}
function parseIntersectionType() {
var marker = markerCreate(), type, types;
type = parsePrefixType();
types = [type];
while (match('&')) {
lex();
types.push(parsePrefixType());
}
return types.length === 1 ?
type :
markerApply(marker, delegate.createIntersectionTypeAnnotation(
types
));
}
function parseUnionType() {
var marker = markerCreate(), type, types;
type = parseIntersectionType();
types = [type];
while (match('|')) {
lex();
types.push(parseIntersectionType());
}
return types.length === 1 ?
type :
markerApply(marker, delegate.createUnionTypeAnnotation(
types
));
}
function parseType() {
var oldInType = state.inType, type;
state.inType = true;
type = parseUnionType();
state.inType = oldInType;
return type;
}
function parseTypeAnnotation() {
var marker = markerCreate(), type;
expect(':');
type = parseType();
return markerApply(marker, delegate.createTypeAnnotation(type));
}
function parseVariableIdentifier() {
var marker = markerCreate(),
token = lex();
if (token.type !== Token.Identifier) {
throwUnexpected(token);
}
return markerApply(marker, delegate.createIdentifier(token.value));
}
function parseTypeAnnotatableIdentifier(requireTypeAnnotation, canBeOptionalParam) {
var marker = markerCreate(),
ident = parseVariableIdentifier(),
isOptionalParam = false;
if (canBeOptionalParam && match('?')) {
expect('?');
isOptionalParam = true;
}
if (requireTypeAnnotation || match(':')) {
ident.typeAnnotation = parseTypeAnnotation();
ident = markerApply(marker, ident);
}
if (isOptionalParam) {
ident.optional = true;
ident = markerApply(marker, ident);
}
return ident;
}
function parseVariableDeclaration(kind) {
var id,
marker = markerCreate(),
init = null,
typeAnnotationMarker = markerCreate();
if (match('{')) {
id = parseObjectInitialiser();
reinterpretAsAssignmentBindingPattern(id);
if (match(':')) {
id.typeAnnotation = parseTypeAnnotation();
markerApply(typeAnnotationMarker, id);
}
} else if (match('[')) {
id = parseArrayInitialiser();
reinterpretAsAssignmentBindingPattern(id);
if (match(':')) {
id.typeAnnotation = parseTypeAnnotation();
markerApply(typeAnnotationMarker, id);
}
} else {
/* istanbul ignore next */
id = state.allowKeyword ? parseNonComputedProperty() : parseTypeAnnotatableIdentifier();
// 12.2.1
if (strict && isRestrictedWord(id.name)) {
throwErrorTolerant({}, Messages.StrictVarName);
}
}
if (kind === 'const') {
if (!match('=')) {
throwError({}, Messages.NoUninitializedConst);
}
expect('=');
init = parseAssignmentExpression();
} else if (match('=')) {
lex();
init = parseAssignmentExpression();
}
return markerApply(marker, delegate.createVariableDeclarator(id, init));
}
function parseVariableDeclarationList(kind) {
var list = [];
do {
list.push(parseVariableDeclaration(kind));
if (!match(',')) {
break;
}
lex();
} while (index < length);
return list;
}
function parseVariableStatement() {
var declarations, marker = markerCreate();
expectKeyword('var');
declarations = parseVariableDeclarationList();
consumeSemicolon();
return markerApply(marker, delegate.createVariableDeclaration(declarations, 'var'));
}
// kind may be `const` or `let`
// Both are experimental and not in the specification yet.
// see http://wiki.ecmascript.org/doku.php?id=harmony:const
// and http://wiki.ecmascript.org/doku.php?id=harmony:let
function parseConstLetDeclaration(kind) {
var declarations, marker = markerCreate();
expectKeyword(kind);
declarations = parseVariableDeclarationList(kind);
consumeSemicolon();
return markerApply(marker, delegate.createVariableDeclaration(declarations, kind));
}
// people.mozilla.org/~jorendorff/es6-draft.html
function parseModuleSpecifier() {
var marker = markerCreate(),
specifier;
if (lookahead.type !== Token.StringLiteral) {
throwError({}, Messages.InvalidModuleSpecifier);
}
specifier = delegate.createModuleSpecifier(lookahead);
lex();
return markerApply(marker, specifier);
}
function parseExportBatchSpecifier() {
var marker = markerCreate();
expect('*');
return markerApply(marker, delegate.createExportBatchSpecifier());
}
function parseExportSpecifier() {
var id, name = null, marker = markerCreate(), from;
if (matchKeyword('default')) {
lex();
id = markerApply(marker, delegate.createIdentifier('default'));
// export {default} from "something";
} else {
id = parseVariableIdentifier();
}
if (matchContextualKeyword('as')) {
lex();
name = parseNonComputedProperty();
}
return markerApply(marker, delegate.createExportSpecifier(id, name));
}
function parseExportDeclaration() {
var declaration = null,
possibleIdentifierToken, sourceElement,
isExportFromIdentifier,
src = null, specifiers = [],
marker = markerCreate();
expectKeyword('export');
if (matchKeyword('default')) {
// covers:
// export default ...
lex();
if (matchKeyword('function') || matchKeyword('class')) {
possibleIdentifierToken = lookahead2();
if (isIdentifierName(possibleIdentifierToken)) {
// covers:
// export default function foo () {}
// export default class foo {}
sourceElement = parseSourceElement();
return markerApply(marker, delegate.createExportDeclaration(true, sourceElement, [sourceElement.id], null));
}
// covers:
// export default function () {}
// export default class {}
switch (lookahead.value) {
case 'class':
return markerApply(marker, delegate.createExportDeclaration(true, parseClassExpression(), [], null));
case 'function':
return markerApply(marker, delegate.createExportDeclaration(true, parseFunctionExpression(), [], null));
}
}
if (matchContextualKeyword('from')) {
throwError({}, Messages.UnexpectedToken, lookahead.value);
}
// covers:
// export default {};
// export default [];
if (match('{')) {
declaration = parseObjectInitialiser();
} else if (match('[')) {
declaration = parseArrayInitialiser();
} else {
declaration = parseAssignmentExpression();
}
consumeSemicolon();
return markerApply(marker, delegate.createExportDeclaration(true, declaration, [], null));
}
// non-default export
if (lookahead.type === Token.Keyword || matchContextualKeyword('type')) {
// covers:
// export var f = 1;
switch (lookahead.value) {
case 'type':
case 'let':
case 'const':
case 'var':
case 'class':
case 'function':
return markerApply(marker, delegate.createExportDeclaration(false, parseSourceElement(), specifiers, null));
}
}
if (match('*')) {
// covers:
// export * from "foo";
specifiers.push(parseExportBatchSpecifier());
if (!matchContextualKeyword('from')) {
throwError({}, lookahead.value ?
Messages.UnexpectedToken : Messages.MissingFromClause, lookahead.value);
}
lex();
src = parseModuleSpecifier();
consumeSemicolon();
return markerApply(marker, delegate.createExportDeclaration(false, null, specifiers, src));
}
expect('{');
if (!match('}')) {
do {
isExportFromIdentifier = isExportFromIdentifier || matchKeyword('default');
specifiers.push(parseExportSpecifier());
} while (match(',') && lex());
}
expect('}');
if (matchContextualKeyword('from')) {
// covering:
// export {default} from "foo";
// export {foo} from "foo";
lex();
src = parseModuleSpecifier();
consumeSemicolon();
} else if (isExportFromIdentifier) {
// covering:
// export {default}; // missing fromClause
throwError({}, lookahead.value ?
Messages.UnexpectedToken : Messages.MissingFromClause, lookahead.value);
} else {
// cover
// export {foo};
consumeSemicolon();
}
return markerApply(marker, delegate.createExportDeclaration(false, declaration, specifiers, src));
}
function parseImportSpecifier() {
// import {<foo as bar>} ...;
var id, name = null, marker = markerCreate();
id = parseNonComputedProperty();
if (matchContextualKeyword('as')) {
lex();
name = parseVariableIdentifier();
}
return markerApply(marker, delegate.createImportSpecifier(id, name));
}
function parseNamedImports() {
var specifiers = [];
// {foo, bar as bas}
expect('{');
if (!match('}')) {
do {
specifiers.push(parseImportSpecifier());
} while (match(',') && lex());
}
expect('}');
return specifiers;
}
function parseImportDefaultSpecifier() {
// import <foo> ...;
var id, marker = markerCreate();
id = parseNonComputedProperty();
return markerApply(marker, delegate.createImportDefaultSpecifier(id));
}
function parseImportNamespaceSpecifier() {
// import <* as foo> ...;
var id, marker = markerCreate();
expect('*');
if (!matchContextualKeyword('as')) {
throwError({}, Messages.NoAsAfterImportNamespace);
}
lex();
id = parseNonComputedProperty();
return markerApply(marker, delegate.createImportNamespaceSpecifier(id));
}
function parseImportDeclaration() {
var specifiers, src, marker = markerCreate(), isType = false, token2;
expectKeyword('import');
if (matchContextualKeyword('type')) {
token2 = lookahead2();
if ((token2.type === Token.Identifier && token2.value !== 'from') ||
(token2.type === Token.Punctuator &&
(token2.value === '{' || token2.value === '*'))) {
isType = true;
lex();
}
}
specifiers = [];
if (lookahead.type === Token.StringLiteral) {
// covers:
// import "foo";
src = parseModuleSpecifier();
consumeSemicolon();
return markerApply(marker, delegate.createImportDeclaration(specifiers, src, isType));
}
if (!matchKeyword('default') && isIdentifierName(lookahead)) {
// covers:
// import foo
// import foo, ...
specifiers.push(parseImportDefaultSpecifier());
if (match(',')) {
lex();
}
}
if (match('*')) {
// covers:
// import foo, * as foo
// import * as foo
specifiers.push(parseImportNamespaceSpecifier());
} else if (match('{')) {
// covers:
// import foo, {bar}
// import {bar}
specifiers = specifiers.concat(parseNamedImports());
}
if (!matchContextualKeyword('from')) {
throwError({}, lookahead.value ?
Messages.UnexpectedToken : Messages.MissingFromClause, lookahead.value);
}
lex();
src = parseModuleSpecifier();
consumeSemicolon();
return markerApply(marker, delegate.createImportDeclaration(specifiers, src, isType));
}
// 12.3 Empty Statement
function parseEmptyStatement() {
var marker = markerCreate();
expect(';');
return markerApply(marker, delegate.createEmptyStatement());
}
// 12.4 Expression Statement
function parseExpressionStatement() {
var marker = markerCreate(), expr = parseExpression();
consumeSemicolon();
return markerApply(marker, delegate.createExpressionStatement(expr));
}
// 12.5 If statement
function parseIfStatement() {
var test, consequent, alternate, marker = markerCreate();
expectKeyword('if');
expect('(');
test = parseExpression();
expect(')');
consequent = parseStatement();
if (matchKeyword('else')) {
lex();
alternate = parseStatement();
} else {
alternate = null;
}
return markerApply(marker, delegate.createIfStatement(test, consequent, alternate));
}
// 12.6 Iteration Statements
function parseDoWhileStatement() {
var body, test, oldInIteration, marker = markerCreate();
expectKeyword('do');
oldInIteration = state.inIteration;
state.inIteration = true;
body = parseStatement();
state.inIteration = oldInIteration;
expectKeyword('while');
expect('(');
test = parseExpression();
expect(')');
if (match(';')) {
lex();
}
return markerApply(marker, delegate.createDoWhileStatement(body, test));
}
function parseWhileStatement() {
var test, body, oldInIteration, marker = markerCreate();
expectKeyword('while');
expect('(');
test = parseExpression();
expect(')');
oldInIteration = state.inIteration;
state.inIteration = true;
body = parseStatement();
state.inIteration = oldInIteration;
return markerApply(marker, delegate.createWhileStatement(test, body));
}
function parseForVariableDeclaration() {
var marker = markerCreate(),
token = lex(),
declarations = parseVariableDeclarationList();
return markerApply(marker, delegate.createVariableDeclaration(declarations, token.value));
}
function parseForStatement(opts) {
var init, test, update, left, right, body, operator, oldInIteration,
marker = markerCreate();
init = test = update = null;
expectKeyword('for');
// http://wiki.ecmascript.org/doku.php?id=proposals:iterators_and_generators&s=each
if (matchContextualKeyword('each')) {
throwError({}, Messages.EachNotAllowed);
}
expect('(');
if (match(';')) {
lex();
} else {
if (matchKeyword('var') || matchKeyword('let') || matchKeyword('const')) {
state.allowIn = false;
init = parseForVariableDeclaration();
state.allowIn = true;
if (init.declarations.length === 1) {
if (matchKeyword('in') || matchContextualKeyword('of')) {
operator = lookahead;
if (!((operator.value === 'in' || init.kind !== 'var') && init.declarations[0].init)) {
lex();
left = init;
right = parseExpression();
init = null;
}
}
}
} else {
state.allowIn = false;
init = parseExpression();
state.allowIn = true;
if (matchContextualKeyword('of')) {
operator = lex();
left = init;
right = parseExpression();
init = null;
} else if (matchKeyword('in')) {
// LeftHandSideExpression
if (!isAssignableLeftHandSide(init)) {
throwError({}, Messages.InvalidLHSInForIn);
}
operator = lex();
left = init;
right = parseExpression();
init = null;
}
}
if (typeof left === 'undefined') {
expect(';');
}
}
if (typeof left === 'undefined') {
if (!match(';')) {
test = parseExpression();
}
expect(';');
if (!match(')')) {
update = parseExpression();
}
}
expect(')');
oldInIteration = state.inIteration;
state.inIteration = true;
if (!(opts !== undefined && opts.ignoreBody)) {
body = parseStatement();
}
state.inIteration = oldInIteration;
if (typeof left === 'undefined') {
return markerApply(marker, delegate.createForStatement(init, test, update, body));
}
if (operator.value === 'in') {
return markerApply(marker, delegate.createForInStatement(left, right, body));
}
return markerApply(marker, delegate.createForOfStatement(left, right, body));
}
// 12.7 The continue statement
function parseContinueStatement() {
var label = null, marker = markerCreate();
expectKeyword('continue');
// Optimize the most common form: 'continue;'.
if (source.charCodeAt(index) === 59) {
lex();
if (!state.inIteration) {
throwError({}, Messages.IllegalContinue);
}
return markerApply(marker, delegate.createContinueStatement(null));
}
if (peekLineTerminator()) {
if (!state.inIteration) {
throwError({}, Messages.IllegalContinue);
}
return markerApply(marker, delegate.createContinueStatement(null));
}
if (lookahead.type === Token.Identifier) {
label = parseVariableIdentifier();
if (!state.labelSet.has(label.name)) {
throwError({}, Messages.UnknownLabel, label.name);
}
}
consumeSemicolon();
if (label === null && !state.inIteration) {
throwError({}, Messages.IllegalContinue);
}
return markerApply(marker, delegate.createContinueStatement(label));
}
// 12.8 The break statement
function parseBreakStatement() {
var label = null, marker = markerCreate();
expectKeyword('break');
// Catch the very common case first: immediately a semicolon (char #59).
if (source.charCodeAt(index) === 59) {
lex();
if (!(state.inIteration || state.inSwitch)) {
throwError({}, Messages.IllegalBreak);
}
return markerApply(marker, delegate.createBreakStatement(null));
}
if (peekLineTerminator()) {
if (!(state.inIteration || state.inSwitch)) {
throwError({}, Messages.IllegalBreak);
}
return markerApply(marker, delegate.createBreakStatement(null));
}
if (lookahead.type === Token.Identifier) {
label = parseVariableIdentifier();
if (!state.labelSet.has(label.name)) {
throwError({}, Messages.UnknownLabel, label.name);
}
}
consumeSemicolon();
if (label === null && !(state.inIteration || state.inSwitch)) {
throwError({}, Messages.IllegalBreak);
}
return markerApply(marker, delegate.createBreakStatement(label));
}
// 12.9 The return statement
function parseReturnStatement() {
var argument = null, marker = markerCreate();
expectKeyword('return');
if (!state.inFunctionBody) {
throwErrorTolerant({}, Messages.IllegalReturn);
}
// 'return' followed by a space and an identifier is very common.
if (source.charCodeAt(index) === 32) {
if (isIdentifierStart(source.charCodeAt(index + 1))) {
argument = parseExpression();
consumeSemicolon();
return markerApply(marker, delegate.createReturnStatement(argument));
}
}
if (peekLineTerminator()) {
return markerApply(marker, delegate.createReturnStatement(null));
}
if (!match(';')) {
if (!match('}') && lookahead.type !== Token.EOF) {
argument = parseExpression();
}
}
consumeSemicolon();
return markerApply(marker, delegate.createReturnStatement(argument));
}
// 12.10 The with statement
function parseWithStatement() {
var object, body, marker = markerCreate();
if (strict) {
throwErrorTolerant({}, Messages.StrictModeWith);
}
expectKeyword('with');
expect('(');
object = parseExpression();
expect(')');
body = parseStatement();
return markerApply(marker, delegate.createWithStatement(object, body));
}
// 12.10 The swith statement
function parseSwitchCase() {
var test,
consequent = [],
sourceElement,
marker = markerCreate();
if (matchKeyword('default')) {
lex();
test = null;
} else {
expectKeyword('case');
test = parseExpression();
}
expect(':');
while (index < length) {
if (match('}') || matchKeyword('default') || matchKeyword('case')) {
break;
}
sourceElement = parseSourceElement();
if (typeof sourceElement === 'undefined') {
break;
}
consequent.push(sourceElement);
}
return markerApply(marker, delegate.createSwitchCase(test, consequent));
}
function parseSwitchStatement() {
var discriminant, cases, clause, oldInSwitch, defaultFound, marker = markerCreate();
expectKeyword('switch');
expect('(');
discriminant = parseExpression();
expect(')');
expect('{');
cases = [];
if (match('}')) {
lex();
return markerApply(marker, delegate.createSwitchStatement(discriminant, cases));
}
oldInSwitch = state.inSwitch;
state.inSwitch = true;
defaultFound = false;
while (index < length) {
if (match('}')) {
break;
}
clause = parseSwitchCase();
if (clause.test === null) {
if (defaultFound) {
throwError({}, Messages.MultipleDefaultsInSwitch);
}
defaultFound = true;
}
cases.push(clause);
}
state.inSwitch = oldInSwitch;
expect('}');
return markerApply(marker, delegate.createSwitchStatement(discriminant, cases));
}
// 12.13 The throw statement
function parseThrowStatement() {
var argument, marker = markerCreate();
expectKeyword('throw');
if (peekLineTerminator()) {
throwError({}, Messages.NewlineAfterThrow);
}
argument = parseExpression();
consumeSemicolon();
return markerApply(marker, delegate.createThrowStatement(argument));
}
// 12.14 The try statement
function parseCatchClause() {
var param, body, marker = markerCreate();
expectKeyword('catch');
expect('(');
if (match(')')) {
throwUnexpected(lookahead);
}
param = parseExpression();
// 12.14.1
if (strict && param.type === Syntax.Identifier && isRestrictedWord(param.name)) {
throwErrorTolerant({}, Messages.StrictCatchVariable);
}
expect(')');
body = parseBlock();
return markerApply(marker, delegate.createCatchClause(param, body));
}
function parseTryStatement() {
var block, handlers = [], finalizer = null, marker = markerCreate();
expectKeyword('try');
block = parseBlock();
if (matchKeyword('catch')) {
handlers.push(parseCatchClause());
}
if (matchKeyword('finally')) {
lex();
finalizer = parseBlock();
}
if (handlers.length === 0 && !finalizer) {
throwError({}, Messages.NoCatchOrFinally);
}
return markerApply(marker, delegate.createTryStatement(block, [], handlers, finalizer));
}
// 12.15 The debugger statement
function parseDebuggerStatement() {
var marker = markerCreate();
expectKeyword('debugger');
consumeSemicolon();
return markerApply(marker, delegate.createDebuggerStatement());
}
// 12 Statements
function parseStatement() {
var type = lookahead.type,
marker,
expr,
labeledBody;
if (type === Token.EOF) {
throwUnexpected(lookahead);
}
if (type === Token.Punctuator) {
switch (lookahead.value) {
case ';':
return parseEmptyStatement();
case '{':
return parseBlock();
case '(':
return parseExpressionStatement();
default:
break;
}
}
if (type === Token.Keyword) {
switch (lookahead.value) {
case 'break':
return parseBreakStatement();
case 'continue':
return parseContinueStatement();
case 'debugger':
return parseDebuggerStatement();
case 'do':
return parseDoWhileStatement();
case 'for':
return parseForStatement();
case 'function':
return parseFunctionDeclaration();
case 'class':
return parseClassDeclaration();
case 'if':
return parseIfStatement();
case 'return':
return parseReturnStatement();
case 'switch':
return parseSwitchStatement();
case 'throw':
return parseThrowStatement();
case 'try':
return parseTryStatement();
case 'var':
return parseVariableStatement();
case 'while':
return parseWhileStatement();
case 'with':
return parseWithStatement();
default:
break;
}
}
if (matchAsyncFuncExprOrDecl()) {
return parseFunctionDeclaration();
}
marker = markerCreate();
expr = parseExpression();
// 12.12 Labelled Statements
if ((expr.type === Syntax.Identifier) && match(':')) {
lex();
if (state.labelSet.has(expr.name)) {
throwError({}, Messages.Redeclaration, 'Label', expr.name);
}
state.labelSet.set(expr.name, true);
labeledBody = parseStatement();
state.labelSet["delete"](expr.name);
return markerApply(marker, delegate.createLabeledStatement(expr, labeledBody));
}
consumeSemicolon();
return markerApply(marker, delegate.createExpressionStatement(expr));
}
// 13 Function Definition
function parseConciseBody() {
if (match('{')) {
return parseFunctionSourceElements();
}
return parseAssignmentExpression();
}
function parseFunctionSourceElements() {
var sourceElement, sourceElements = [], token, directive, firstRestricted,
oldLabelSet, oldInIteration, oldInSwitch, oldInFunctionBody, oldParenthesizedCount,
marker = markerCreate();
expect('{');
while (index < length) {
if (lookahead.type !== Token.StringLiteral) {
break;
}
token = lookahead;
sourceElement = parseSourceElement();
sourceElements.push(sourceElement);
if (sourceElement.expression.type !== Syntax.Literal) {
// this is not directive
break;
}
directive = source.slice(token.range[0] + 1, token.range[1] - 1);
if (directive === 'use strict') {
strict = true;
if (firstRestricted) {
throwErrorTolerant(firstRestricted, Messages.StrictOctalLiteral);
}
} else {
if (!firstRestricted && token.octal) {
firstRestricted = token;
}
}
}
oldLabelSet = state.labelSet;
oldInIteration = state.inIteration;
oldInSwitch = state.inSwitch;
oldInFunctionBody = state.inFunctionBody;
oldParenthesizedCount = state.parenthesizedCount;
state.labelSet = new StringMap();
state.inIteration = false;
state.inSwitch = false;
state.inFunctionBody = true;
state.parenthesizedCount = 0;
while (index < length) {
if (match('}')) {
break;
}
sourceElement = parseSourceElement();
if (typeof sourceElement === 'undefined') {
break;
}
sourceElements.push(sourceElement);
}
expect('}');
state.labelSet = oldLabelSet;
state.inIteration = oldInIteration;
state.inSwitch = oldInSwitch;
state.inFunctionBody = oldInFunctionBody;
state.parenthesizedCount = oldParenthesizedCount;
return markerApply(marker, delegate.createBlockStatement(sourceElements));
}
function validateParam(options, param, name) {
if (strict) {
if (isRestrictedWord(name)) {
options.stricted = param;
options.message = Messages.StrictParamName;
}
if (options.paramSet.has(name)) {
options.stricted = param;
options.message = Messages.StrictParamDupe;
}
} else if (!options.firstRestricted) {
if (isRestrictedWord(name)) {
options.firstRestricted = param;
options.message = Messages.StrictParamName;
} else if (isStrictModeReservedWord(name)) {
options.firstRestricted = param;
options.message = Messages.StrictReservedWord;
} else if (options.paramSet.has(name)) {
options.firstRestricted = param;
options.message = Messages.StrictParamDupe;
}
}
options.paramSet.set(name, true);
}
function parseParam(options) {
var marker, token, rest, param, def;
token = lookahead;
if (token.value === '...') {
token = lex();
rest = true;
}
if (match('[')) {
marker = markerCreate();
param = parseArrayInitialiser();
reinterpretAsDestructuredParameter(options, param);
if (match(':')) {
param.typeAnnotation = parseTypeAnnotation();
markerApply(marker, param);
}
} else if (match('{')) {
marker = markerCreate();
if (rest) {
throwError({}, Messages.ObjectPatternAsRestParameter);
}
param = parseObjectInitialiser();
reinterpretAsDestructuredParameter(options, param);
if (match(':')) {
param.typeAnnotation = parseTypeAnnotation();
markerApply(marker, param);
}
} else {
param =
rest
? parseTypeAnnotatableIdentifier(
false, /* requireTypeAnnotation */
false /* canBeOptionalParam */
)
: parseTypeAnnotatableIdentifier(
false, /* requireTypeAnnotation */
true /* canBeOptionalParam */
);
validateParam(options, token, token.value);
}
if (match('=')) {
if (rest) {
throwErrorTolerant(lookahead, Messages.DefaultRestParameter);
}
lex();
def = parseAssignmentExpression();
++options.defaultCount;
}
if (rest) {
if (!match(')')) {
throwError({}, Messages.ParameterAfterRestParameter);
}
options.rest = param;
return false;
}
options.params.push(param);
options.defaults.push(def);
return !match(')');
}
function parseParams(firstRestricted) {
var options, marker = markerCreate();
options = {
params: [],
defaultCount: 0,
defaults: [],
rest: null,
firstRestricted: firstRestricted
};
expect('(');
if (!match(')')) {
options.paramSet = new StringMap();
while (index < length) {
if (!parseParam(options)) {
break;
}
expect(',');
}
}
expect(')');
if (options.defaultCount === 0) {
options.defaults = [];
}
if (match(':')) {
options.returnType = parseTypeAnnotation();
}
return markerApply(marker, options);
}
function parseFunctionDeclaration() {
var id, body, token, tmp, firstRestricted, message, generator, isAsync,
previousStrict, previousYieldAllowed, previousAwaitAllowed,
marker = markerCreate(), typeParameters;
isAsync = false;
if (matchAsync()) {
lex();
isAsync = true;
}
expectKeyword('function');
generator = false;
if (match('*')) {
lex();
generator = true;
}
token = lookahead;
id = parseVariableIdentifier();
if (match('<')) {
typeParameters = parseTypeParameterDeclaration();
}
if (strict) {
if (isRestrictedWord(token.value)) {
throwErrorTolerant(token, Messages.StrictFunctionName);
}
} else {
if (isRestrictedWord(token.value)) {
firstRestricted = token;
message = Messages.StrictFunctionName;
} else if (isStrictModeReservedWord(token.value)) {
firstRestricted = token;
message = Messages.StrictReservedWord;
}
}
tmp = parseParams(firstRestricted);
firstRestricted = tmp.firstRestricted;
if (tmp.message) {
message = tmp.message;
}
previousStrict = strict;
previousYieldAllowed = state.yieldAllowed;
state.yieldAllowed = generator;
previousAwaitAllowed = state.awaitAllowed;
state.awaitAllowed = isAsync;
body = parseFunctionSourceElements();
if (strict && firstRestricted) {
throwError(firstRestricted, message);
}
if (strict && tmp.stricted) {
throwErrorTolerant(tmp.stricted, message);
}
strict = previousStrict;
state.yieldAllowed = previousYieldAllowed;
state.awaitAllowed = previousAwaitAllowed;
return markerApply(
marker,
delegate.createFunctionDeclaration(
id,
tmp.params,
tmp.defaults,
body,
tmp.rest,
generator,
false,
isAsync,
tmp.returnType,
typeParameters
)
);
}
function parseFunctionExpression() {
var token, id = null, firstRestricted, message, tmp, body, generator, isAsync,
previousStrict, previousYieldAllowed, previousAwaitAllowed,
marker = markerCreate(), typeParameters;
isAsync = false;
if (matchAsync()) {
lex();
isAsync = true;
}
expectKeyword('function');
generator = false;
if (match('*')) {
lex();
generator = true;
}
if (!match('(')) {
if (!match('<')) {
token = lookahead;
id = parseVariableIdentifier();
if (strict) {
if (isRestrictedWord(token.value)) {
throwErrorTolerant(token, Messages.StrictFunctionName);
}
} else {
if (isRestrictedWord(token.value)) {
firstRestricted = token;
message = Messages.StrictFunctionName;
} else if (isStrictModeReservedWord(token.value)) {
firstRestricted = token;
message = Messages.StrictReservedWord;
}
}
}
if (match('<')) {
typeParameters = parseTypeParameterDeclaration();
}
}
tmp = parseParams(firstRestricted);
firstRestricted = tmp.firstRestricted;
if (tmp.message) {
message = tmp.message;
}
previousStrict = strict;
previousYieldAllowed = state.yieldAllowed;
state.yieldAllowed = generator;
previousAwaitAllowed = state.awaitAllowed;
state.awaitAllowed = isAsync;
body = parseFunctionSourceElements();
if (strict && firstRestricted) {
throwError(firstRestricted, message);
}
if (strict && tmp.stricted) {
throwErrorTolerant(tmp.stricted, message);
}
strict = previousStrict;
state.yieldAllowed = previousYieldAllowed;
state.awaitAllowed = previousAwaitAllowed;
return markerApply(
marker,
delegate.createFunctionExpression(
id,
tmp.params,
tmp.defaults,
body,
tmp.rest,
generator,
false,
isAsync,
tmp.returnType,
typeParameters
)
);
}
function parseYieldExpression() {
var delegateFlag, expr, marker = markerCreate();
expectKeyword('yield', !strict);
delegateFlag = false;
if (match('*')) {
lex();
delegateFlag = true;
}
expr = parseAssignmentExpression();
return markerApply(marker, delegate.createYieldExpression(expr, delegateFlag));
}
function parseAwaitExpression() {
var expr, marker = markerCreate();
expectContextualKeyword('await');
expr = parseAssignmentExpression();
return markerApply(marker, delegate.createAwaitExpression(expr));
}
// 14 Functions and classes
// 14.1 Functions is defined above (13 in ES5)
// 14.2 Arrow Functions Definitions is defined in (7.3 assignments)
// 14.3 Method Definitions
// 14.3.7
function specialMethod(methodDefinition) {
return methodDefinition.kind === 'get' ||
methodDefinition.kind === 'set' ||
methodDefinition.value.generator;
}
function parseMethodDefinition(key, isStatic, generator, computed) {
var token, param, propType,
isAsync, typeParameters, tokenValue, returnType;
propType = isStatic ? ClassPropertyType["static"] : ClassPropertyType.prototype;
if (generator) {
return delegate.createMethodDefinition(
propType,
'',
key,
parsePropertyMethodFunction({ generator: true }),
computed
);
}
tokenValue = key.type === 'Identifier' && key.name;
if (tokenValue === 'get' && !match('(')) {
key = parseObjectPropertyKey();
expect('(');
expect(')');
if (match(':')) {
returnType = parseTypeAnnotation();
}
return delegate.createMethodDefinition(
propType,
'get',
key,
parsePropertyFunction({ generator: false, returnType: returnType }),
computed
);
}
if (tokenValue === 'set' && !match('(')) {
key = parseObjectPropertyKey();
expect('(');
token = lookahead;
param = [ parseTypeAnnotatableIdentifier() ];
expect(')');
if (match(':')) {
returnType = parseTypeAnnotation();
}
return delegate.createMethodDefinition(
propType,
'set',
key,
parsePropertyFunction({
params: param,
generator: false,
name: token,
returnType: returnType
}),
computed
);
}
if (match('<')) {
typeParameters = parseTypeParameterDeclaration();
}
isAsync = tokenValue === 'async' && !match('(');
if (isAsync) {
key = parseObjectPropertyKey();
}
return delegate.createMethodDefinition(
propType,
'',
key,
parsePropertyMethodFunction({
generator: false,
async: isAsync,
typeParameters: typeParameters
}),
computed
);
}
function parseClassProperty(key, computed, isStatic) {
var typeAnnotation;
typeAnnotation = parseTypeAnnotation();
expect(';');
return delegate.createClassProperty(
key,
typeAnnotation,
computed,
isStatic
);
}
function parseClassElement() {
var computed = false, generator = false, key, marker = markerCreate(),
isStatic = false, possiblyOpenBracketToken;
if (match(';')) {
lex();
return undefined;
}
if (lookahead.value === 'static') {
lex();
isStatic = true;
}
if (match('*')) {
lex();
generator = true;
}
possiblyOpenBracketToken = lookahead;
if (matchContextualKeyword('get') || matchContextualKeyword('set')) {
possiblyOpenBracketToken = lookahead2();
}
if (possiblyOpenBracketToken.type === Token.Punctuator
&& possiblyOpenBracketToken.value === '[') {
computed = true;
}
key = parseObjectPropertyKey();
if (!generator && lookahead.value === ':') {
return markerApply(marker, parseClassProperty(key, computed, isStatic));
}
return markerApply(marker, parseMethodDefinition(
key,
isStatic,
generator,
computed
));
}
function parseClassBody() {
var classElement, classElements = [], existingProps = {},
marker = markerCreate(), propName, propType;
existingProps[ClassPropertyType["static"]] = new StringMap();
existingProps[ClassPropertyType.prototype] = new StringMap();
expect('{');
while (index < length) {
if (match('}')) {
break;
}
classElement = parseClassElement(existingProps);
if (typeof classElement !== 'undefined') {
classElements.push(classElement);
propName = !classElement.computed && getFieldName(classElement.key);
if (propName !== false) {
propType = classElement["static"] ?
ClassPropertyType["static"] :
ClassPropertyType.prototype;
if (classElement.type === Syntax.MethodDefinition) {
if (propName === 'constructor' && !classElement["static"]) {
if (specialMethod(classElement)) {
throwError(classElement, Messages.IllegalClassConstructorProperty);
}
if (existingProps[ClassPropertyType.prototype].has('constructor')) {
throwError(classElement.key, Messages.IllegalDuplicateClassProperty);
}
}
existingProps[propType].set(propName, true);
}
}
}
}
expect('}');
return markerApply(marker, delegate.createClassBody(classElements));
}
function parseClassImplements() {
var id, implemented = [], marker, typeParameters;
if (strict) {
expectKeyword('implements');
} else {
expectContextualKeyword('implements');
}
while (index < length) {
marker = markerCreate();
id = parseVariableIdentifier();
if (match('<')) {
typeParameters = parseTypeParameterInstantiation();
} else {
typeParameters = null;
}
implemented.push(markerApply(marker, delegate.createClassImplements(
id,
typeParameters
)));
if (!match(',')) {
break;
}
expect(',');
}
return implemented;
}
function parseClassExpression() {
var id, implemented, previousYieldAllowed, superClass = null,
superTypeParameters, marker = markerCreate(), typeParameters,
matchImplements;
expectKeyword('class');
matchImplements =
strict
? matchKeyword('implements')
: matchContextualKeyword('implements');
if (!matchKeyword('extends') && !matchImplements && !match('{')) {
id = parseVariableIdentifier();
}
if (match('<')) {
typeParameters = parseTypeParameterDeclaration();
}
if (matchKeyword('extends')) {
expectKeyword('extends');
previousYieldAllowed = state.yieldAllowed;
state.yieldAllowed = false;
superClass = parseLeftHandSideExpressionAllowCall();
if (match('<')) {
superTypeParameters = parseTypeParameterInstantiation();
}
state.yieldAllowed = previousYieldAllowed;
}
if (strict ? matchKeyword('implements') : matchContextualKeyword('implements')) {
implemented = parseClassImplements();
}
return markerApply(marker, delegate.createClassExpression(
id,
superClass,
parseClassBody(),
typeParameters,
superTypeParameters,
implemented
));
}
function parseClassDeclaration() {
var id, implemented, previousYieldAllowed, superClass = null,
superTypeParameters, marker = markerCreate(), typeParameters;
expectKeyword('class');
id = parseVariableIdentifier();
if (match('<')) {
typeParameters = parseTypeParameterDeclaration();
}
if (matchKeyword('extends')) {
expectKeyword('extends');
previousYieldAllowed = state.yieldAllowed;
state.yieldAllowed = false;
superClass = parseLeftHandSideExpressionAllowCall();
if (match('<')) {
superTypeParameters = parseTypeParameterInstantiation();
}
state.yieldAllowed = previousYieldAllowed;
}
if (strict ? matchKeyword('implements') : matchContextualKeyword('implements')) {
implemented = parseClassImplements();
}
return markerApply(marker, delegate.createClassDeclaration(
id,
superClass,
parseClassBody(),
typeParameters,
superTypeParameters,
implemented
));
}
// 15 Program
function parseSourceElement() {
var token;
if (lookahead.type === Token.Keyword) {
switch (lookahead.value) {
case 'const':
case 'let':
return parseConstLetDeclaration(lookahead.value);
case 'function':
return parseFunctionDeclaration();
case 'export':
throwErrorTolerant({}, Messages.IllegalExportDeclaration);
return parseExportDeclaration();
case 'import':
throwErrorTolerant({}, Messages.IllegalImportDeclaration);
return parseImportDeclaration();
case 'interface':
if (lookahead2().type === Token.Identifier) {
return parseInterface();
}
return parseStatement();
default:
return parseStatement();
}
}
if (matchContextualKeyword('type')
&& lookahead2().type === Token.Identifier) {
return parseTypeAlias();
}
if (matchContextualKeyword('interface')
&& lookahead2().type === Token.Identifier) {
return parseInterface();
}
if (matchContextualKeyword('declare')) {
token = lookahead2();
if (token.type === Token.Keyword) {
switch (token.value) {
case 'class':
return parseDeclareClass();
case 'function':
return parseDeclareFunction();
case 'var':
return parseDeclareVariable();
}
} else if (token.type === Token.Identifier
&& token.value === 'module') {
return parseDeclareModule();
}
}
if (lookahead.type !== Token.EOF) {
return parseStatement();
}
}
function parseProgramElement() {
var isModule = extra.sourceType === 'module' || extra.sourceType === 'nonStrictModule';
if (isModule && lookahead.type === Token.Keyword) {
switch (lookahead.value) {
case 'export':
return parseExportDeclaration();
case 'import':
return parseImportDeclaration();
}
}
return parseSourceElement();
}
function parseProgramElements() {
var sourceElement, sourceElements = [], token, directive, firstRestricted;
while (index < length) {
token = lookahead;
if (token.type !== Token.StringLiteral) {
break;
}
sourceElement = parseProgramElement();
sourceElements.push(sourceElement);
if (sourceElement.expression.type !== Syntax.Literal) {
// this is not directive
break;
}
directive = source.slice(token.range[0] + 1, token.range[1] - 1);
if (directive === 'use strict') {
strict = true;
if (firstRestricted) {
throwErrorTolerant(firstRestricted, Messages.StrictOctalLiteral);
}
} else {
if (!firstRestricted && token.octal) {
firstRestricted = token;
}
}
}
while (index < length) {
sourceElement = parseProgramElement();
if (typeof sourceElement === 'undefined') {
break;
}
sourceElements.push(sourceElement);
}
return sourceElements;
}
function parseProgram() {
var body, marker = markerCreate();
strict = extra.sourceType === 'module';
peek();
body = parseProgramElements();
return markerApply(marker, delegate.createProgram(body));
}
// 16 JSX
XHTMLEntities = {
quot: '\u0022',
amp: '&',
apos: '\u0027',
lt: '<',
gt: '>',
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',
OElig: '\u0152',
oelig: '\u0153',
Scaron: '\u0160',
scaron: '\u0161',
Yuml: '\u0178',
fnof: '\u0192',
circ: '\u02C6',
tilde: '\u02DC',
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',
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',
bull: '\u2022',
hellip: '\u2026',
permil: '\u2030',
prime: '\u2032',
Prime: '\u2033',
lsaquo: '\u2039',
rsaquo: '\u203A',
oline: '\u203E',
frasl: '\u2044',
euro: '\u20AC',
image: '\u2111',
weierp: '\u2118',
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',
'int': '\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'
};
function getQualifiedJSXName(object) {
if (object.type === Syntax.JSXIdentifier) {
return object.name;
}
if (object.type === Syntax.JSXNamespacedName) {
return object.namespace.name + ':' + object.name.name;
}
/* istanbul ignore else */
if (object.type === Syntax.JSXMemberExpression) {
return (
getQualifiedJSXName(object.object) + '.' +
getQualifiedJSXName(object.property)
);
}
/* istanbul ignore next */
throwUnexpected(object);
}
function isJSXIdentifierStart(ch) {
// exclude backslash (\)
return (ch !== 92) && isIdentifierStart(ch);
}
function isJSXIdentifierPart(ch) {
// exclude backslash (\) and add hyphen (-)
return (ch !== 92) && (ch === 45 || isIdentifierPart(ch));
}
function scanJSXIdentifier() {
var ch, start, value = '';
start = index;
while (index < length) {
ch = source.charCodeAt(index);
if (!isJSXIdentifierPart(ch)) {
break;
}
value += source[index++];
}
return {
type: Token.JSXIdentifier,
value: value,
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
function scanJSXEntity() {
var ch, str = '', start = index, count = 0, code;
ch = source[index];
assert(ch === '&', 'Entity must start with an ampersand');
index++;
while (index < length && count++ < 10) {
ch = source[index++];
if (ch === ';') {
break;
}
str += ch;
}
// Well-formed entity (ending was found).
if (ch === ';') {
// Numeric entity.
if (str[0] === '#') {
if (str[1] === 'x') {
code = +('0' + str.substr(1));
} else {
// Removing leading zeros in order to avoid treating as octal in old browsers.
code = +str.substr(1).replace(Regex.LeadingZeros, '');
}
if (!isNaN(code)) {
return String.fromCharCode(code);
}
/* istanbul ignore else */
} else if (XHTMLEntities[str]) {
return XHTMLEntities[str];
}
}
// Treat non-entity sequences as regular text.
index = start + 1;
return '&';
}
function scanJSXText(stopChars) {
var ch, str = '', start;
start = index;
while (index < length) {
ch = source[index];
if (stopChars.indexOf(ch) !== -1) {
break;
}
if (ch === '&') {
str += scanJSXEntity();
} else {
index++;
if (ch === '\r' && source[index] === '\n') {
str += ch;
ch = source[index];
index++;
}
if (isLineTerminator(ch.charCodeAt(0))) {
++lineNumber;
lineStart = index;
}
str += ch;
}
}
return {
type: Token.JSXText,
value: str,
lineNumber: lineNumber,
lineStart: lineStart,
range: [start, index]
};
}
function scanJSXStringLiteral() {
var innerToken, quote, start;
quote = source[index];
assert((quote === '\'' || quote === '"'),
'String literal must starts with a quote');
start = index;
++index;
innerToken = scanJSXText([quote]);
if (quote !== source[index]) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
++index;
innerToken.range = [start, index];
return innerToken;
}
/**
* Between JSX opening and closing tags (e.g. <foo>HERE</foo>), anything that
* is not another JSX tag and is not an expression wrapped by {} is text.
*/
function advanceJSXChild() {
var ch = source.charCodeAt(index);
// '<' 60, '>' 62, '{' 123, '}' 125
if (ch !== 60 && ch !== 62 && ch !== 123 && ch !== 125) {
return scanJSXText(['<', '>', '{', '}']);
}
return scanPunctuator();
}
function parseJSXIdentifier() {
var token, marker = markerCreate();
if (lookahead.type !== Token.JSXIdentifier) {
throwUnexpected(lookahead);
}
token = lex();
return markerApply(marker, delegate.createJSXIdentifier(token.value));
}
function parseJSXNamespacedName() {
var namespace, name, marker = markerCreate();
namespace = parseJSXIdentifier();
expect(':');
name = parseJSXIdentifier();
return markerApply(marker, delegate.createJSXNamespacedName(namespace, name));
}
function parseJSXMemberExpression() {
var marker = markerCreate(),
expr = parseJSXIdentifier();
while (match('.')) {
lex();
expr = markerApply(marker, delegate.createJSXMemberExpression(expr, parseJSXIdentifier()));
}
return expr;
}
function parseJSXElementName() {
if (lookahead2().value === ':') {
return parseJSXNamespacedName();
}
if (lookahead2().value === '.') {
return parseJSXMemberExpression();
}
return parseJSXIdentifier();
}
function parseJSXAttributeName() {
if (lookahead2().value === ':') {
return parseJSXNamespacedName();
}
return parseJSXIdentifier();
}
function parseJSXAttributeValue() {
var value, marker;
if (match('{')) {
value = parseJSXExpressionContainer();
if (value.expression.type === Syntax.JSXEmptyExpression) {
throwError(
value,
'JSX attributes must only be assigned a non-empty ' +
'expression'
);
}
} else if (match('<')) {
value = parseJSXElement();
} else if (lookahead.type === Token.JSXText) {
marker = markerCreate();
value = markerApply(marker, delegate.createLiteral(lex()));
} else {
throwError({}, Messages.InvalidJSXAttributeValue);
}
return value;
}
function parseJSXEmptyExpression() {
var marker = markerCreatePreserveWhitespace();
while (source.charAt(index) !== '}') {
index++;
}
return markerApply(marker, delegate.createJSXEmptyExpression());
}
function parseJSXExpressionContainer() {
var expression, origInJSXChild, origInJSXTag, marker = markerCreate();
origInJSXChild = state.inJSXChild;
origInJSXTag = state.inJSXTag;
state.inJSXChild = false;
state.inJSXTag = false;
expect('{');
if (match('}')) {
expression = parseJSXEmptyExpression();
} else {
expression = parseExpression();
}
state.inJSXChild = origInJSXChild;
state.inJSXTag = origInJSXTag;
expect('}');
return markerApply(marker, delegate.createJSXExpressionContainer(expression));
}
function parseJSXSpreadAttribute() {
var expression, origInJSXChild, origInJSXTag, marker = markerCreate();
origInJSXChild = state.inJSXChild;
origInJSXTag = state.inJSXTag;
state.inJSXChild = false;
state.inJSXTag = false;
expect('{');
expect('...');
expression = parseAssignmentExpression();
state.inJSXChild = origInJSXChild;
state.inJSXTag = origInJSXTag;
expect('}');
return markerApply(marker, delegate.createJSXSpreadAttribute(expression));
}
function parseJSXAttribute() {
var name, marker;
if (match('{')) {
return parseJSXSpreadAttribute();
}
marker = markerCreate();
name = parseJSXAttributeName();
// HTML empty attribute
if (match('=')) {
lex();
return markerApply(marker, delegate.createJSXAttribute(name, parseJSXAttributeValue()));
}
return markerApply(marker, delegate.createJSXAttribute(name));
}
function parseJSXChild() {
var token, marker;
if (match('{')) {
token = parseJSXExpressionContainer();
} else if (lookahead.type === Token.JSXText) {
marker = markerCreatePreserveWhitespace();
token = markerApply(marker, delegate.createLiteral(lex()));
} else if (match('<')) {
token = parseJSXElement();
} else {
throwUnexpected(lookahead);
}
return token;
}
function parseJSXClosingElement() {
var name, origInJSXChild, origInJSXTag, marker = markerCreate();
origInJSXChild = state.inJSXChild;
origInJSXTag = state.inJSXTag;
state.inJSXChild = false;
state.inJSXTag = true;
expect('<');
expect('/');
name = parseJSXElementName();
// Because advance() (called by lex() called by expect()) expects there
// to be a valid token after >, it needs to know whether to look for a
// standard JS token or an JSX text node
state.inJSXChild = origInJSXChild;
state.inJSXTag = origInJSXTag;
expect('>');
return markerApply(marker, delegate.createJSXClosingElement(name));
}
function parseJSXOpeningElement() {
var name, attributes = [], selfClosing = false, origInJSXChild, origInJSXTag, marker = markerCreate();
origInJSXChild = state.inJSXChild;
origInJSXTag = state.inJSXTag;
state.inJSXChild = false;
state.inJSXTag = true;
expect('<');
name = parseJSXElementName();
while (index < length &&
lookahead.value !== '/' &&
lookahead.value !== '>') {
attributes.push(parseJSXAttribute());
}
state.inJSXTag = origInJSXTag;
if (lookahead.value === '/') {
expect('/');
// Because advance() (called by lex() called by expect()) expects
// there to be a valid token after >, it needs to know whether to
// look for a standard JS token or an JSX text node
state.inJSXChild = origInJSXChild;
expect('>');
selfClosing = true;
} else {
state.inJSXChild = true;
expect('>');
}
return markerApply(marker, delegate.createJSXOpeningElement(name, attributes, selfClosing));
}
function parseJSXElement() {
var openingElement, closingElement = null, children = [], origInJSXChild, origInJSXTag, marker = markerCreate();
origInJSXChild = state.inJSXChild;
origInJSXTag = state.inJSXTag;
openingElement = parseJSXOpeningElement();
if (!openingElement.selfClosing) {
while (index < length) {
state.inJSXChild = false; // Call lookahead2() with inJSXChild = false because </ should not be considered in the child
if (lookahead.value === '<' && lookahead2().value === '/') {
break;
}
state.inJSXChild = true;
children.push(parseJSXChild());
}
state.inJSXChild = origInJSXChild;
state.inJSXTag = origInJSXTag;
closingElement = parseJSXClosingElement();
if (getQualifiedJSXName(closingElement.name) !== getQualifiedJSXName(openingElement.name)) {
throwError({}, Messages.ExpectedJSXClosingTag, getQualifiedJSXName(openingElement.name));
}
}
// When (erroneously) writing two adjacent tags like
//
// var x = <div>one</div><div>two</div>;
//
// the default error message is a bit incomprehensible. Since it's
// rarely (never?) useful to write a less-than sign after an JSX
// element, we disallow it here in the parser in order to provide a
// better error message. (In the rare case that the less-than operator
// was intended, the left tag can be wrapped in parentheses.)
if (!origInJSXChild && match('<')) {
throwError(lookahead, Messages.AdjacentJSXElements);
}
return markerApply(marker, delegate.createJSXElement(openingElement, closingElement, children));
}
function parseTypeAlias() {
var id, marker = markerCreate(), typeParameters = null, right;
expectContextualKeyword('type');
id = parseVariableIdentifier();
if (match('<')) {
typeParameters = parseTypeParameterDeclaration();
}
expect('=');
right = parseType();
consumeSemicolon();
return markerApply(marker, delegate.createTypeAlias(id, typeParameters, right));
}
function parseInterfaceExtends() {
var marker = markerCreate(), id, typeParameters = null;
id = parseVariableIdentifier();
if (match('<')) {
typeParameters = parseTypeParameterInstantiation();
}
return markerApply(marker, delegate.createInterfaceExtends(
id,
typeParameters
));
}
function parseInterfaceish(marker, allowStatic) {
var body, bodyMarker, extended = [], id,
typeParameters = null;
id = parseVariableIdentifier();
if (match('<')) {
typeParameters = parseTypeParameterDeclaration();
}
if (matchKeyword('extends')) {
expectKeyword('extends');
while (index < length) {
extended.push(parseInterfaceExtends());
if (!match(',')) {
break;
}
expect(',');
}
}
bodyMarker = markerCreate();
body = markerApply(bodyMarker, parseObjectType(allowStatic));
return markerApply(marker, delegate.createInterface(
id,
typeParameters,
body,
extended
));
}
function parseInterface() {
var marker = markerCreate();
if (strict) {
expectKeyword('interface');
} else {
expectContextualKeyword('interface');
}
return parseInterfaceish(marker, /* allowStatic */false);
}
function parseDeclareClass() {
var marker = markerCreate(), ret;
expectContextualKeyword('declare');
expectKeyword('class');
ret = parseInterfaceish(marker, /* allowStatic */true);
ret.type = Syntax.DeclareClass;
return ret;
}
function parseDeclareFunction() {
var id, idMarker,
marker = markerCreate(), params, returnType, rest, tmp,
typeParameters = null, value, valueMarker;
expectContextualKeyword('declare');
expectKeyword('function');
idMarker = markerCreate();
id = parseVariableIdentifier();
valueMarker = markerCreate();
if (match('<')) {
typeParameters = parseTypeParameterDeclaration();
}
expect('(');
tmp = parseFunctionTypeParams();
params = tmp.params;
rest = tmp.rest;
expect(')');
expect(':');
returnType = parseType();
value = markerApply(valueMarker, delegate.createFunctionTypeAnnotation(
params,
returnType,
rest,
typeParameters
));
id.typeAnnotation = markerApply(valueMarker, delegate.createTypeAnnotation(
value
));
markerApply(idMarker, id);
consumeSemicolon();
return markerApply(marker, delegate.createDeclareFunction(
id
));
}
function parseDeclareVariable() {
var id, marker = markerCreate();
expectContextualKeyword('declare');
expectKeyword('var');
id = parseTypeAnnotatableIdentifier();
consumeSemicolon();
return markerApply(marker, delegate.createDeclareVariable(
id
));
}
function parseDeclareModule() {
var body = [], bodyMarker, id, idMarker, marker = markerCreate(), token;
expectContextualKeyword('declare');
expectContextualKeyword('module');
if (lookahead.type === Token.StringLiteral) {
if (strict && lookahead.octal) {
throwErrorTolerant(lookahead, Messages.StrictOctalLiteral);
}
idMarker = markerCreate();
id = markerApply(idMarker, delegate.createLiteral(lex()));
} else {
id = parseVariableIdentifier();
}
bodyMarker = markerCreate();
expect('{');
while (index < length && !match('}')) {
token = lookahead2();
switch (token.value) {
case 'class':
body.push(parseDeclareClass());
break;
case 'function':
body.push(parseDeclareFunction());
break;
case 'var':
body.push(parseDeclareVariable());
break;
default:
throwUnexpected(lookahead);
}
}
expect('}');
return markerApply(marker, delegate.createDeclareModule(
id,
markerApply(bodyMarker, delegate.createBlockStatement(body))
));
}
function collectToken() {
var loc, token, range, value, entry;
/* istanbul ignore else */
if (!state.inJSXChild) {
skipComment();
}
loc = {
start: {
line: lineNumber,
column: index - lineStart
}
};
token = extra.advance();
loc.end = {
line: lineNumber,
column: index - lineStart
};
if (token.type !== Token.EOF) {
range = [token.range[0], token.range[1]];
value = source.slice(token.range[0], token.range[1]);
entry = {
type: TokenName[token.type],
value: value,
range: range,
loc: loc
};
if (token.regex) {
entry.regex = {
pattern: token.regex.pattern,
flags: token.regex.flags
};
}
extra.tokens.push(entry);
}
return token;
}
function collectRegex() {
var pos, loc, regex, token;
skipComment();
pos = index;
loc = {
start: {
line: lineNumber,
column: index - lineStart
}
};
regex = extra.scanRegExp();
loc.end = {
line: lineNumber,
column: index - lineStart
};
if (!extra.tokenize) {
/* istanbul ignore next */
// Pop the previous token, which is likely '/' or '/='
if (extra.tokens.length > 0) {
token = extra.tokens[extra.tokens.length - 1];
if (token.range[0] === pos && token.type === 'Punctuator') {
if (token.value === '/' || token.value === '/=') {
extra.tokens.pop();
}
}
}
extra.tokens.push({
type: 'RegularExpression',
value: regex.literal,
regex: regex.regex,
range: [pos, index],
loc: loc
});
}
return regex;
}
function filterTokenLocation() {
var i, entry, token, tokens = [];
for (i = 0; i < extra.tokens.length; ++i) {
entry = extra.tokens[i];
token = {
type: entry.type,
value: entry.value
};
if (entry.regex) {
token.regex = {
pattern: entry.regex.pattern,
flags: entry.regex.flags
};
}
if (extra.range) {
token.range = entry.range;
}
if (extra.loc) {
token.loc = entry.loc;
}
tokens.push(token);
}
extra.tokens = tokens;
}
function patch() {
if (typeof extra.tokens !== 'undefined') {
extra.advance = advance;
extra.scanRegExp = scanRegExp;
advance = collectToken;
scanRegExp = collectRegex;
}
}
function unpatch() {
if (typeof extra.scanRegExp === 'function') {
advance = extra.advance;
scanRegExp = extra.scanRegExp;
}
}
// This is used to modify the delegate.
function extend(object, properties) {
var entry, result = {};
for (entry in object) {
/* istanbul ignore else */
if (object.hasOwnProperty(entry)) {
result[entry] = object[entry];
}
}
for (entry in properties) {
/* istanbul ignore else */
if (properties.hasOwnProperty(entry)) {
result[entry] = properties[entry];
}
}
return result;
}
function tokenize(code, options) {
var toString,
token,
tokens;
toString = String;
if (typeof code !== 'string' && !(code instanceof String)) {
code = toString(code);
}
delegate = SyntaxTreeDelegate;
source = code;
index = 0;
lineNumber = (source.length > 0) ? 1 : 0;
lineStart = 0;
length = source.length;
lookahead = null;
state = {
allowKeyword: true,
allowIn: true,
labelSet: new StringMap(),
inFunctionBody: false,
inIteration: false,
inSwitch: false,
lastCommentStart: -1
};
extra = {};
// Options matching.
options = options || {};
// Of course we collect tokens here.
options.tokens = true;
extra.tokens = [];
extra.tokenize = true;
// The following two fields are necessary to compute the Regex tokens.
extra.openParenToken = -1;
extra.openCurlyToken = -1;
extra.range = (typeof options.range === 'boolean') && options.range;
extra.loc = (typeof options.loc === 'boolean') && options.loc;
if (typeof options.comment === 'boolean' && options.comment) {
extra.comments = [];
}
if (typeof options.tolerant === 'boolean' && options.tolerant) {
extra.errors = [];
}
patch();
try {
peek();
if (lookahead.type === Token.EOF) {
return extra.tokens;
}
token = lex();
while (lookahead.type !== Token.EOF) {
try {
token = lex();
} catch (lexError) {
token = lookahead;
if (extra.errors) {
extra.errors.push(lexError);
// We have to break on the first error
// to avoid infinite loops.
break;
} else {
throw lexError;
}
}
}
filterTokenLocation();
tokens = extra.tokens;
if (typeof extra.comments !== 'undefined') {
tokens.comments = extra.comments;
}
if (typeof extra.errors !== 'undefined') {
tokens.errors = extra.errors;
}
} catch (e) {
throw e;
} finally {
unpatch();
extra = {};
}
return tokens;
}
function parse(code, options) {
var program, toString;
toString = String;
if (typeof code !== 'string' && !(code instanceof String)) {
code = toString(code);
}
delegate = SyntaxTreeDelegate;
source = code;
index = 0;
lineNumber = (source.length > 0) ? 1 : 0;
lineStart = 0;
length = source.length;
lookahead = null;
state = {
allowKeyword: false,
allowIn: true,
labelSet: new StringMap(),
parenthesizedCount: 0,
inFunctionBody: false,
inIteration: false,
inSwitch: false,
inJSXChild: false,
inJSXTag: false,
inType: false,
lastCommentStart: -1,
yieldAllowed: false,
awaitAllowed: false
};
extra = {};
if (typeof options !== 'undefined') {
extra.range = (typeof options.range === 'boolean') && options.range;
extra.loc = (typeof options.loc === 'boolean') && options.loc;
extra.attachComment = (typeof options.attachComment === 'boolean') && options.attachComment;
if (extra.loc && options.source !== null && options.source !== undefined) {
delegate = extend(delegate, {
'postProcess': function (node) {
node.loc.source = toString(options.source);
return node;
}
});
}
extra.sourceType = options.sourceType;
if (typeof options.tokens === 'boolean' && options.tokens) {
extra.tokens = [];
}
if (typeof options.comment === 'boolean' && options.comment) {
extra.comments = [];
}
if (typeof options.tolerant === 'boolean' && options.tolerant) {
extra.errors = [];
}
if (extra.attachComment) {
extra.range = true;
extra.comments = [];
extra.bottomRightStack = [];
extra.trailingComments = [];
extra.leadingComments = [];
}
}
patch();
try {
program = parseProgram();
if (typeof extra.comments !== 'undefined') {
program.comments = extra.comments;
}
if (typeof extra.tokens !== 'undefined') {
filterTokenLocation();
program.tokens = extra.tokens;
}
if (typeof extra.errors !== 'undefined') {
program.errors = extra.errors;
}
} catch (e) {
throw e;
} finally {
unpatch();
extra = {};
}
return program;
}
// Sync with *.json manifests.
exports.version = '13001.1001.0-dev-harmony-fb';
exports.tokenize = tokenize;
exports.parse = parse;
// Deep copy.
/* istanbul ignore next */
exports.Syntax = (function () {
var name, types = {};
if (typeof Object.create === 'function') {
types = Object.create(null);
}
for (name in Syntax) {
if (Syntax.hasOwnProperty(name)) {
types[name] = Syntax[name];
}
}
if (typeof Object.freeze === 'function') {
Object.freeze(types);
}
return types;
}());
}));
/* vim: set sw=4 ts=4 et tw=80 : */
},{}],10:[function(_dereq_,module,exports){
var Base62 = (function (my) {
my.chars = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]
my.encode = function(i){
if (i === 0) {return '0'}
var s = ''
while (i > 0) {
s = this.chars[i % 62] + s
i = Math.floor(i/62)
}
return s
};
my.decode = function(a,b,c,d){
for (
b = c = (
a === (/\W|_|^$/.test(a += "") || a)
) - 1;
d = a.charCodeAt(c++);
)
b = b * 62 + d - [, 48, 29, 87][d >> 5];
return b
};
return my;
}({}));
module.exports = Base62
},{}],11:[function(_dereq_,module,exports){
/*
* Copyright 2009-2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE.txt or:
* http://opensource.org/licenses/BSD-3-Clause
*/
exports.SourceMapGenerator = _dereq_('./source-map/source-map-generator').SourceMapGenerator;
exports.SourceMapConsumer = _dereq_('./source-map/source-map-consumer').SourceMapConsumer;
exports.SourceNode = _dereq_('./source-map/source-node').SourceNode;
},{"./source-map/source-map-consumer":16,"./source-map/source-map-generator":17,"./source-map/source-node":18}],12:[function(_dereq_,module,exports){
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
if (typeof define !== 'function') {
var define = _dereq_('amdefine')(module, _dereq_);
}
define(function (_dereq_, exports, module) {
var util = _dereq_('./util');
/**
* A data structure which is a combination of an array and a set. Adding a new
* member is O(1), testing for membership is O(1), and finding the index of an
* element is O(1). Removing elements from the set is not supported. Only
* strings are supported for membership.
*/
function ArraySet() {
this._array = [];
this._set = {};
}
/**
* Static method for creating ArraySet instances from an existing array.
*/
ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {
var set = new ArraySet();
for (var i = 0, len = aArray.length; i < len; i++) {
set.add(aArray[i], aAllowDuplicates);
}
return set;
};
/**
* Add the given string to this set.
*
* @param String aStr
*/
ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {
var isDuplicate = this.has(aStr);
var idx = this._array.length;
if (!isDuplicate || aAllowDuplicates) {
this._array.push(aStr);
}
if (!isDuplicate) {
this._set[util.toSetString(aStr)] = idx;
}
};
/**
* Is the given string a member of this set?
*
* @param String aStr
*/
ArraySet.prototype.has = function ArraySet_has(aStr) {
return Object.prototype.hasOwnProperty.call(this._set,
util.toSetString(aStr));
};
/**
* What is the index of the given string in the array?
*
* @param String aStr
*/
ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {
if (this.has(aStr)) {
return this._set[util.toSetString(aStr)];
}
throw new Error('"' + aStr + '" is not in the set.');
};
/**
* What is the element at the given index?
*
* @param Number aIdx
*/
ArraySet.prototype.at = function ArraySet_at(aIdx) {
if (aIdx >= 0 && aIdx < this._array.length) {
return this._array[aIdx];
}
throw new Error('No element indexed by ' + aIdx);
};
/**
* Returns the array representation of this set (which has the proper indices
* indicated by indexOf). Note that this is a copy of the internal array used
* for storing the members so that no one can mess with internal state.
*/
ArraySet.prototype.toArray = function ArraySet_toArray() {
return this._array.slice();
};
exports.ArraySet = ArraySet;
});
},{"./util":19,"amdefine":20}],13:[function(_dereq_,module,exports){
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*
* Based on the Base 64 VLQ implementation in Closure Compiler:
* https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java
*
* Copyright 2011 The Closure Compiler Authors. All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
if (typeof define !== 'function') {
var define = _dereq_('amdefine')(module, _dereq_);
}
define(function (_dereq_, exports, module) {
var base64 = _dereq_('./base64');
// A single base 64 digit can contain 6 bits of data. For the base 64 variable
// length quantities we use in the source map spec, the first bit is the sign,
// the next four bits are the actual value, and the 6th bit is the
// continuation bit. The continuation bit tells us whether there are more
// digits in this value following this digit.
//
// Continuation
// | Sign
// | |
// V V
// 101011
var VLQ_BASE_SHIFT = 5;
// binary: 100000
var VLQ_BASE = 1 << VLQ_BASE_SHIFT;
// binary: 011111
var VLQ_BASE_MASK = VLQ_BASE - 1;
// binary: 100000
var VLQ_CONTINUATION_BIT = VLQ_BASE;
/**
* Converts from a two-complement value to a value where the sign bit is
* is placed in the least significant bit. For example, as decimals:
* 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)
* 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)
*/
function toVLQSigned(aValue) {
return aValue < 0
? ((-aValue) << 1) + 1
: (aValue << 1) + 0;
}
/**
* Converts to a two-complement value from a value where the sign bit is
* is placed in the least significant bit. For example, as decimals:
* 2 (10 binary) becomes 1, 3 (11 binary) becomes -1
* 4 (100 binary) becomes 2, 5 (101 binary) becomes -2
*/
function fromVLQSigned(aValue) {
var isNegative = (aValue & 1) === 1;
var shifted = aValue >> 1;
return isNegative
? -shifted
: shifted;
}
/**
* Returns the base 64 VLQ encoded value.
*/
exports.encode = function base64VLQ_encode(aValue) {
var encoded = "";
var digit;
var vlq = toVLQSigned(aValue);
do {
digit = vlq & VLQ_BASE_MASK;
vlq >>>= VLQ_BASE_SHIFT;
if (vlq > 0) {
// There are still more digits in this value, so we must make sure the
// continuation bit is marked.
digit |= VLQ_CONTINUATION_BIT;
}
encoded += base64.encode(digit);
} while (vlq > 0);
return encoded;
};
/**
* Decodes the next base 64 VLQ value from the given string and returns the
* value and the rest of the string.
*/
exports.decode = function base64VLQ_decode(aStr) {
var i = 0;
var strLen = aStr.length;
var result = 0;
var shift = 0;
var continuation, digit;
do {
if (i >= strLen) {
throw new Error("Expected more digits in base 64 VLQ value.");
}
digit = base64.decode(aStr.charAt(i++));
continuation = !!(digit & VLQ_CONTINUATION_BIT);
digit &= VLQ_BASE_MASK;
result = result + (digit << shift);
shift += VLQ_BASE_SHIFT;
} while (continuation);
return {
value: fromVLQSigned(result),
rest: aStr.slice(i)
};
};
});
},{"./base64":14,"amdefine":20}],14:[function(_dereq_,module,exports){
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
if (typeof define !== 'function') {
var define = _dereq_('amdefine')(module, _dereq_);
}
define(function (_dereq_, exports, module) {
var charToIntMap = {};
var intToCharMap = {};
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
.split('')
.forEach(function (ch, index) {
charToIntMap[ch] = index;
intToCharMap[index] = ch;
});
/**
* Encode an integer in the range of 0 to 63 to a single base 64 digit.
*/
exports.encode = function base64_encode(aNumber) {
if (aNumber in intToCharMap) {
return intToCharMap[aNumber];
}
throw new TypeError("Must be between 0 and 63: " + aNumber);
};
/**
* Decode a single base 64 digit to an integer.
*/
exports.decode = function base64_decode(aChar) {
if (aChar in charToIntMap) {
return charToIntMap[aChar];
}
throw new TypeError("Not a valid base 64 digit: " + aChar);
};
});
},{"amdefine":20}],15:[function(_dereq_,module,exports){
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
if (typeof define !== 'function') {
var define = _dereq_('amdefine')(module, _dereq_);
}
define(function (_dereq_, exports, module) {
/**
* Recursive implementation of binary search.
*
* @param aLow Indices here and lower do not contain the needle.
* @param aHigh Indices here and higher do not contain the needle.
* @param aNeedle The element being searched for.
* @param aHaystack The non-empty array being searched.
* @param aCompare Function which takes two elements and returns -1, 0, or 1.
*/
function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare) {
// This function terminates when one of the following is true:
//
// 1. We find the exact element we are looking for.
//
// 2. We did not find the exact element, but we can return the next
// closest element that is less than that element.
//
// 3. We did not find the exact element, and there is no next-closest
// element which is less than the one we are searching for, so we
// return null.
var mid = Math.floor((aHigh - aLow) / 2) + aLow;
var cmp = aCompare(aNeedle, aHaystack[mid], true);
if (cmp === 0) {
// Found the element we are looking for.
return aHaystack[mid];
}
else if (cmp > 0) {
// aHaystack[mid] is greater than our needle.
if (aHigh - mid > 1) {
// The element is in the upper half.
return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare);
}
// We did not find an exact match, return the next closest one
// (termination case 2).
return aHaystack[mid];
}
else {
// aHaystack[mid] is less than our needle.
if (mid - aLow > 1) {
// The element is in the lower half.
return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare);
}
// The exact needle element was not found in this haystack. Determine if
// we are in termination case (2) or (3) and return the appropriate thing.
return aLow < 0
? null
: aHaystack[aLow];
}
}
/**
* This is an implementation of binary search which will always try and return
* the next lowest value checked if there is no exact hit. This is because
* mappings between original and generated line/col pairs are single points,
* and there is an implicit region between each of them, so a miss just means
* that you aren't on the very start of a region.
*
* @param aNeedle The element you are looking for.
* @param aHaystack The array that is being searched.
* @param aCompare A function which takes the needle and an element in the
* array and returns -1, 0, or 1 depending on whether the needle is less
* than, equal to, or greater than the element, respectively.
*/
exports.search = function search(aNeedle, aHaystack, aCompare) {
return aHaystack.length > 0
? recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack, aCompare)
: null;
};
});
},{"amdefine":20}],16:[function(_dereq_,module,exports){
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
if (typeof define !== 'function') {
var define = _dereq_('amdefine')(module, _dereq_);
}
define(function (_dereq_, exports, module) {
var util = _dereq_('./util');
var binarySearch = _dereq_('./binary-search');
var ArraySet = _dereq_('./array-set').ArraySet;
var base64VLQ = _dereq_('./base64-vlq');
/**
* A SourceMapConsumer instance represents a parsed source map which we can
* query for information about the original file positions by giving it a file
* position in the generated source.
*
* The only parameter is the raw source map (either as a JSON string, or
* already parsed to an object). According to the spec, source maps have the
* following attributes:
*
* - version: Which version of the source map spec this map is following.
* - sources: An array of URLs to the original source files.
* - names: An array of identifiers which can be referrenced by individual mappings.
* - sourceRoot: Optional. The URL root from which all sources are relative.
* - sourcesContent: Optional. An array of contents of the original source files.
* - mappings: A string of base64 VLQs which contain the actual mappings.
* - file: The generated file this source map is associated with.
*
* Here is an example source map, taken from the source map spec[0]:
*
* {
* version : 3,
* file: "out.js",
* sourceRoot : "",
* sources: ["foo.js", "bar.js"],
* names: ["src", "maps", "are", "fun"],
* mappings: "AA,AB;;ABCDE;"
* }
*
* [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1#
*/
function SourceMapConsumer(aSourceMap) {
var sourceMap = aSourceMap;
if (typeof aSourceMap === 'string') {
sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, ''));
}
var version = util.getArg(sourceMap, 'version');
var sources = util.getArg(sourceMap, 'sources');
// Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which
// requires the array) to play nice here.
var names = util.getArg(sourceMap, 'names', []);
var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null);
var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null);
var mappings = util.getArg(sourceMap, 'mappings');
var file = util.getArg(sourceMap, 'file', null);
// Once again, Sass deviates from the spec and supplies the version as a
// string rather than a number, so we use loose equality checking here.
if (version != this._version) {
throw new Error('Unsupported version: ' + version);
}
// Pass `true` below to allow duplicate names and sources. While source maps
// are intended to be compressed and deduplicated, the TypeScript compiler
// sometimes generates source maps with duplicates in them. See Github issue
// #72 and bugzil.la/889492.
this._names = ArraySet.fromArray(names, true);
this._sources = ArraySet.fromArray(sources, true);
this.sourceRoot = sourceRoot;
this.sourcesContent = sourcesContent;
this._mappings = mappings;
this.file = file;
}
/**
* Create a SourceMapConsumer from a SourceMapGenerator.
*
* @param SourceMapGenerator aSourceMap
* The source map that will be consumed.
* @returns SourceMapConsumer
*/
SourceMapConsumer.fromSourceMap =
function SourceMapConsumer_fromSourceMap(aSourceMap) {
var smc = Object.create(SourceMapConsumer.prototype);
smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true);
smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true);
smc.sourceRoot = aSourceMap._sourceRoot;
smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(),
smc.sourceRoot);
smc.file = aSourceMap._file;
smc.__generatedMappings = aSourceMap._mappings.slice()
.sort(util.compareByGeneratedPositions);
smc.__originalMappings = aSourceMap._mappings.slice()
.sort(util.compareByOriginalPositions);
return smc;
};
/**
* The version of the source mapping spec that we are consuming.
*/
SourceMapConsumer.prototype._version = 3;
/**
* The list of original sources.
*/
Object.defineProperty(SourceMapConsumer.prototype, 'sources', {
get: function () {
return this._sources.toArray().map(function (s) {
return this.sourceRoot ? util.join(this.sourceRoot, s) : s;
}, this);
}
});
// `__generatedMappings` and `__originalMappings` are arrays that hold the
// parsed mapping coordinates from the source map's "mappings" attribute. They
// are lazily instantiated, accessed via the `_generatedMappings` and
// `_originalMappings` getters respectively, and we only parse the mappings
// and create these arrays once queried for a source location. We jump through
// these hoops because there can be many thousands of mappings, and parsing
// them is expensive, so we only want to do it if we must.
//
// Each object in the arrays is of the form:
//
// {
// generatedLine: The line number in the generated code,
// generatedColumn: The column number in the generated code,
// source: The path to the original source file that generated this
// chunk of code,
// originalLine: The line number in the original source that
// corresponds to this chunk of generated code,
// originalColumn: The column number in the original source that
// corresponds to this chunk of generated code,
// name: The name of the original symbol which generated this chunk of
// code.
// }
//
// All properties except for `generatedLine` and `generatedColumn` can be
// `null`.
//
// `_generatedMappings` is ordered by the generated positions.
//
// `_originalMappings` is ordered by the original positions.
SourceMapConsumer.prototype.__generatedMappings = null;
Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', {
get: function () {
if (!this.__generatedMappings) {
this.__generatedMappings = [];
this.__originalMappings = [];
this._parseMappings(this._mappings, this.sourceRoot);
}
return this.__generatedMappings;
}
});
SourceMapConsumer.prototype.__originalMappings = null;
Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', {
get: function () {
if (!this.__originalMappings) {
this.__generatedMappings = [];
this.__originalMappings = [];
this._parseMappings(this._mappings, this.sourceRoot);
}
return this.__originalMappings;
}
});
/**
* Parse the mappings in a string in to a data structure which we can easily
* query (the ordered arrays in the `this.__generatedMappings` and
* `this.__originalMappings` properties).
*/
SourceMapConsumer.prototype._parseMappings =
function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
var generatedLine = 1;
var previousGeneratedColumn = 0;
var previousOriginalLine = 0;
var previousOriginalColumn = 0;
var previousSource = 0;
var previousName = 0;
var mappingSeparator = /^[,;]/;
var str = aStr;
var mapping;
var temp;
while (str.length > 0) {
if (str.charAt(0) === ';') {
generatedLine++;
str = str.slice(1);
previousGeneratedColumn = 0;
}
else if (str.charAt(0) === ',') {
str = str.slice(1);
}
else {
mapping = {};
mapping.generatedLine = generatedLine;
// Generated column.
temp = base64VLQ.decode(str);
mapping.generatedColumn = previousGeneratedColumn + temp.value;
previousGeneratedColumn = mapping.generatedColumn;
str = temp.rest;
if (str.length > 0 && !mappingSeparator.test(str.charAt(0))) {
// Original source.
temp = base64VLQ.decode(str);
mapping.source = this._sources.at(previousSource + temp.value);
previousSource += temp.value;
str = temp.rest;
if (str.length === 0 || mappingSeparator.test(str.charAt(0))) {
throw new Error('Found a source, but no line and column');
}
// Original line.
temp = base64VLQ.decode(str);
mapping.originalLine = previousOriginalLine + temp.value;
previousOriginalLine = mapping.originalLine;
// Lines are stored 0-based
mapping.originalLine += 1;
str = temp.rest;
if (str.length === 0 || mappingSeparator.test(str.charAt(0))) {
throw new Error('Found a source and line, but no column');
}
// Original column.
temp = base64VLQ.decode(str);
mapping.originalColumn = previousOriginalColumn + temp.value;
previousOriginalColumn = mapping.originalColumn;
str = temp.rest;
if (str.length > 0 && !mappingSeparator.test(str.charAt(0))) {
// Original name.
temp = base64VLQ.decode(str);
mapping.name = this._names.at(previousName + temp.value);
previousName += temp.value;
str = temp.rest;
}
}
this.__generatedMappings.push(mapping);
if (typeof mapping.originalLine === 'number') {
this.__originalMappings.push(mapping);
}
}
}
this.__originalMappings.sort(util.compareByOriginalPositions);
};
/**
* Find the mapping that best matches the hypothetical "needle" mapping that
* we are searching for in the given "haystack" of mappings.
*/
SourceMapConsumer.prototype._findMapping =
function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName,
aColumnName, aComparator) {
// To return the position we are searching for, we must first find the
// mapping for the given position and then return the opposite position it
// points to. Because the mappings are sorted, we can use binary search to
// find the best mapping.
if (aNeedle[aLineName] <= 0) {
throw new TypeError('Line must be greater than or equal to 1, got '
+ aNeedle[aLineName]);
}
if (aNeedle[aColumnName] < 0) {
throw new TypeError('Column must be greater than or equal to 0, got '
+ aNeedle[aColumnName]);
}
return binarySearch.search(aNeedle, aMappings, aComparator);
};
/**
* Returns the original source, line, and column information for the generated
* source's line and column positions provided. The only argument is an object
* with the following properties:
*
* - line: The line number in the generated source.
* - column: The column number in the generated source.
*
* and an object is returned with the following properties:
*
* - source: The original source file, or null.
* - line: The line number in the original source, or null.
* - column: The column number in the original source, or null.
* - name: The original identifier, or null.
*/
SourceMapConsumer.prototype.originalPositionFor =
function SourceMapConsumer_originalPositionFor(aArgs) {
var needle = {
generatedLine: util.getArg(aArgs, 'line'),
generatedColumn: util.getArg(aArgs, 'column')
};
var mapping = this._findMapping(needle,
this._generatedMappings,
"generatedLine",
"generatedColumn",
util.compareByGeneratedPositions);
if (mapping) {
var source = util.getArg(mapping, 'source', null);
if (source && this.sourceRoot) {
source = util.join(this.sourceRoot, source);
}
return {
source: source,
line: util.getArg(mapping, 'originalLine', null),
column: util.getArg(mapping, 'originalColumn', null),
name: util.getArg(mapping, 'name', null)
};
}
return {
source: null,
line: null,
column: null,
name: null
};
};
/**
* Returns the original source content. The only argument is the url of the
* original source file. Returns null if no original source content is
* availible.
*/
SourceMapConsumer.prototype.sourceContentFor =
function SourceMapConsumer_sourceContentFor(aSource) {
if (!this.sourcesContent) {
return null;
}
if (this.sourceRoot) {
aSource = util.relative(this.sourceRoot, aSource);
}
if (this._sources.has(aSource)) {
return this.sourcesContent[this._sources.indexOf(aSource)];
}
var url;
if (this.sourceRoot
&& (url = util.urlParse(this.sourceRoot))) {
// XXX: file:// URIs and absolute paths lead to unexpected behavior for
// many users. We can help them out when they expect file:// URIs to
// behave like it would if they were running a local HTTP server. See
// https://bugzilla.mozilla.org/show_bug.cgi?id=885597.
var fileUriAbsPath = aSource.replace(/^file:\/\//, "");
if (url.scheme == "file"
&& this._sources.has(fileUriAbsPath)) {
return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)]
}
if ((!url.path || url.path == "/")
&& this._sources.has("/" + aSource)) {
return this.sourcesContent[this._sources.indexOf("/" + aSource)];
}
}
throw new Error('"' + aSource + '" is not in the SourceMap.');
};
/**
* Returns the generated line and column information for the original source,
* line, and column positions provided. The only argument is an object with
* the following properties:
*
* - source: The filename of the original source.
* - line: The line number in the original source.
* - column: The column number in the original source.
*
* and an object is returned with the following properties:
*
* - line: The line number in the generated source, or null.
* - column: The column number in the generated source, or null.
*/
SourceMapConsumer.prototype.generatedPositionFor =
function SourceMapConsumer_generatedPositionFor(aArgs) {
var needle = {
source: util.getArg(aArgs, 'source'),
originalLine: util.getArg(aArgs, 'line'),
originalColumn: util.getArg(aArgs, 'column')
};
if (this.sourceRoot) {
needle.source = util.relative(this.sourceRoot, needle.source);
}
var mapping = this._findMapping(needle,
this._originalMappings,
"originalLine",
"originalColumn",
util.compareByOriginalPositions);
if (mapping) {
return {
line: util.getArg(mapping, 'generatedLine', null),
column: util.getArg(mapping, 'generatedColumn', null)
};
}
return {
line: null,
column: null
};
};
SourceMapConsumer.GENERATED_ORDER = 1;
SourceMapConsumer.ORIGINAL_ORDER = 2;
/**
* Iterate over each mapping between an original source/line/column and a
* generated line/column in this source map.
*
* @param Function aCallback
* The function that is called with each mapping.
* @param Object aContext
* Optional. If specified, this object will be the value of `this` every
* time that `aCallback` is called.
* @param aOrder
* Either `SourceMapConsumer.GENERATED_ORDER` or
* `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to
* iterate over the mappings sorted by the generated file's line/column
* order or the original's source/line/column order, respectively. Defaults to
* `SourceMapConsumer.GENERATED_ORDER`.
*/
SourceMapConsumer.prototype.eachMapping =
function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) {
var context = aContext || null;
var order = aOrder || SourceMapConsumer.GENERATED_ORDER;
var mappings;
switch (order) {
case SourceMapConsumer.GENERATED_ORDER:
mappings = this._generatedMappings;
break;
case SourceMapConsumer.ORIGINAL_ORDER:
mappings = this._originalMappings;
break;
default:
throw new Error("Unknown order of iteration.");
}
var sourceRoot = this.sourceRoot;
mappings.map(function (mapping) {
var source = mapping.source;
if (source && sourceRoot) {
source = util.join(sourceRoot, source);
}
return {
source: source,
generatedLine: mapping.generatedLine,
generatedColumn: mapping.generatedColumn,
originalLine: mapping.originalLine,
originalColumn: mapping.originalColumn,
name: mapping.name
};
}).forEach(aCallback, context);
};
exports.SourceMapConsumer = SourceMapConsumer;
});
},{"./array-set":12,"./base64-vlq":13,"./binary-search":15,"./util":19,"amdefine":20}],17:[function(_dereq_,module,exports){
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
if (typeof define !== 'function') {
var define = _dereq_('amdefine')(module, _dereq_);
}
define(function (_dereq_, exports, module) {
var base64VLQ = _dereq_('./base64-vlq');
var util = _dereq_('./util');
var ArraySet = _dereq_('./array-set').ArraySet;
/**
* An instance of the SourceMapGenerator represents a source map which is
* being built incrementally. To create a new one, you must pass an object
* with the following properties:
*
* - file: The filename of the generated source.
* - sourceRoot: An optional root for all URLs in this source map.
*/
function SourceMapGenerator(aArgs) {
this._file = util.getArg(aArgs, 'file');
this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null);
this._sources = new ArraySet();
this._names = new ArraySet();
this._mappings = [];
this._sourcesContents = null;
}
SourceMapGenerator.prototype._version = 3;
/**
* Creates a new SourceMapGenerator based on a SourceMapConsumer
*
* @param aSourceMapConsumer The SourceMap.
*/
SourceMapGenerator.fromSourceMap =
function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {
var sourceRoot = aSourceMapConsumer.sourceRoot;
var generator = new SourceMapGenerator({
file: aSourceMapConsumer.file,
sourceRoot: sourceRoot
});
aSourceMapConsumer.eachMapping(function (mapping) {
var newMapping = {
generated: {
line: mapping.generatedLine,
column: mapping.generatedColumn
}
};
if (mapping.source) {
newMapping.source = mapping.source;
if (sourceRoot) {
newMapping.source = util.relative(sourceRoot, newMapping.source);
}
newMapping.original = {
line: mapping.originalLine,
column: mapping.originalColumn
};
if (mapping.name) {
newMapping.name = mapping.name;
}
}
generator.addMapping(newMapping);
});
aSourceMapConsumer.sources.forEach(function (sourceFile) {
var content = aSourceMapConsumer.sourceContentFor(sourceFile);
if (content) {
generator.setSourceContent(sourceFile, content);
}
});
return generator;
};
/**
* Add a single mapping from original source line and column to the generated
* source's line and column for this source map being created. The mapping
* object should have the following properties:
*
* - generated: An object with the generated line and column positions.
* - original: An object with the original line and column positions.
* - source: The original source file (relative to the sourceRoot).
* - name: An optional original token name for this mapping.
*/
SourceMapGenerator.prototype.addMapping =
function SourceMapGenerator_addMapping(aArgs) {
var generated = util.getArg(aArgs, 'generated');
var original = util.getArg(aArgs, 'original', null);
var source = util.getArg(aArgs, 'source', null);
var name = util.getArg(aArgs, 'name', null);
this._validateMapping(generated, original, source, name);
if (source && !this._sources.has(source)) {
this._sources.add(source);
}
if (name && !this._names.has(name)) {
this._names.add(name);
}
this._mappings.push({
generatedLine: generated.line,
generatedColumn: generated.column,
originalLine: original != null && original.line,
originalColumn: original != null && original.column,
source: source,
name: name
});
};
/**
* Set the source content for a source file.
*/
SourceMapGenerator.prototype.setSourceContent =
function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) {
var source = aSourceFile;
if (this._sourceRoot) {
source = util.relative(this._sourceRoot, source);
}
if (aSourceContent !== null) {
// Add the source content to the _sourcesContents map.
// Create a new _sourcesContents map if the property is null.
if (!this._sourcesContents) {
this._sourcesContents = {};
}
this._sourcesContents[util.toSetString(source)] = aSourceContent;
} else {
// Remove the source file from the _sourcesContents map.
// If the _sourcesContents map is empty, set the property to null.
delete this._sourcesContents[util.toSetString(source)];
if (Object.keys(this._sourcesContents).length === 0) {
this._sourcesContents = null;
}
}
};
/**
* Applies the mappings of a sub-source-map for a specific source file to the
* source map being generated. Each mapping to the supplied source file is
* rewritten using the supplied source map. Note: The resolution for the
* resulting mappings is the minimium of this map and the supplied map.
*
* @param aSourceMapConsumer The source map to be applied.
* @param aSourceFile Optional. The filename of the source file.
* If omitted, SourceMapConsumer's file property will be used.
*/
SourceMapGenerator.prototype.applySourceMap =
function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile) {
// If aSourceFile is omitted, we will use the file property of the SourceMap
if (!aSourceFile) {
aSourceFile = aSourceMapConsumer.file;
}
var sourceRoot = this._sourceRoot;
// Make "aSourceFile" relative if an absolute Url is passed.
if (sourceRoot) {
aSourceFile = util.relative(sourceRoot, aSourceFile);
}
// Applying the SourceMap can add and remove items from the sources and
// the names array.
var newSources = new ArraySet();
var newNames = new ArraySet();
// Find mappings for the "aSourceFile"
this._mappings.forEach(function (mapping) {
if (mapping.source === aSourceFile && mapping.originalLine) {
// Check if it can be mapped by the source map, then update the mapping.
var original = aSourceMapConsumer.originalPositionFor({
line: mapping.originalLine,
column: mapping.originalColumn
});
if (original.source !== null) {
// Copy mapping
if (sourceRoot) {
mapping.source = util.relative(sourceRoot, original.source);
} else {
mapping.source = original.source;
}
mapping.originalLine = original.line;
mapping.originalColumn = original.column;
if (original.name !== null && mapping.name !== null) {
// Only use the identifier name if it's an identifier
// in both SourceMaps
mapping.name = original.name;
}
}
}
var source = mapping.source;
if (source && !newSources.has(source)) {
newSources.add(source);
}
var name = mapping.name;
if (name && !newNames.has(name)) {
newNames.add(name);
}
}, this);
this._sources = newSources;
this._names = newNames;
// Copy sourcesContents of applied map.
aSourceMapConsumer.sources.forEach(function (sourceFile) {
var content = aSourceMapConsumer.sourceContentFor(sourceFile);
if (content) {
if (sourceRoot) {
sourceFile = util.relative(sourceRoot, sourceFile);
}
this.setSourceContent(sourceFile, content);
}
}, this);
};
/**
* A mapping can have one of the three levels of data:
*
* 1. Just the generated position.
* 2. The Generated position, original position, and original source.
* 3. Generated and original position, original source, as well as a name
* token.
*
* To maintain consistency, we validate that any new mapping being added falls
* in to one of these categories.
*/
SourceMapGenerator.prototype._validateMapping =
function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource,
aName) {
if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
&& aGenerated.line > 0 && aGenerated.column >= 0
&& !aOriginal && !aSource && !aName) {
// Case 1.
return;
}
else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
&& aOriginal && 'line' in aOriginal && 'column' in aOriginal
&& aGenerated.line > 0 && aGenerated.column >= 0
&& aOriginal.line > 0 && aOriginal.column >= 0
&& aSource) {
// Cases 2 and 3.
return;
}
else {
throw new Error('Invalid mapping: ' + JSON.stringify({
generated: aGenerated,
source: aSource,
orginal: aOriginal,
name: aName
}));
}
};
/**
* Serialize the accumulated mappings in to the stream of base 64 VLQs
* specified by the source map format.
*/
SourceMapGenerator.prototype._serializeMappings =
function SourceMapGenerator_serializeMappings() {
var previousGeneratedColumn = 0;
var previousGeneratedLine = 1;
var previousOriginalColumn = 0;
var previousOriginalLine = 0;
var previousName = 0;
var previousSource = 0;
var result = '';
var mapping;
// The mappings must be guaranteed to be in sorted order before we start
// serializing them or else the generated line numbers (which are defined
// via the ';' separators) will be all messed up. Note: it might be more
// performant to maintain the sorting as we insert them, rather than as we
// serialize them, but the big O is the same either way.
this._mappings.sort(util.compareByGeneratedPositions);
for (var i = 0, len = this._mappings.length; i < len; i++) {
mapping = this._mappings[i];
if (mapping.generatedLine !== previousGeneratedLine) {
previousGeneratedColumn = 0;
while (mapping.generatedLine !== previousGeneratedLine) {
result += ';';
previousGeneratedLine++;
}
}
else {
if (i > 0) {
if (!util.compareByGeneratedPositions(mapping, this._mappings[i - 1])) {
continue;
}
result += ',';
}
}
result += base64VLQ.encode(mapping.generatedColumn
- previousGeneratedColumn);
previousGeneratedColumn = mapping.generatedColumn;
if (mapping.source) {
result += base64VLQ.encode(this._sources.indexOf(mapping.source)
- previousSource);
previousSource = this._sources.indexOf(mapping.source);
// lines are stored 0-based in SourceMap spec version 3
result += base64VLQ.encode(mapping.originalLine - 1
- previousOriginalLine);
previousOriginalLine = mapping.originalLine - 1;
result += base64VLQ.encode(mapping.originalColumn
- previousOriginalColumn);
previousOriginalColumn = mapping.originalColumn;
if (mapping.name) {
result += base64VLQ.encode(this._names.indexOf(mapping.name)
- previousName);
previousName = this._names.indexOf(mapping.name);
}
}
}
return result;
};
SourceMapGenerator.prototype._generateSourcesContent =
function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {
return aSources.map(function (source) {
if (!this._sourcesContents) {
return null;
}
if (aSourceRoot) {
source = util.relative(aSourceRoot, source);
}
var key = util.toSetString(source);
return Object.prototype.hasOwnProperty.call(this._sourcesContents,
key)
? this._sourcesContents[key]
: null;
}, this);
};
/**
* Externalize the source map.
*/
SourceMapGenerator.prototype.toJSON =
function SourceMapGenerator_toJSON() {
var map = {
version: this._version,
file: this._file,
sources: this._sources.toArray(),
names: this._names.toArray(),
mappings: this._serializeMappings()
};
if (this._sourceRoot) {
map.sourceRoot = this._sourceRoot;
}
if (this._sourcesContents) {
map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);
}
return map;
};
/**
* Render the source map being generated to a string.
*/
SourceMapGenerator.prototype.toString =
function SourceMapGenerator_toString() {
return JSON.stringify(this);
};
exports.SourceMapGenerator = SourceMapGenerator;
});
},{"./array-set":12,"./base64-vlq":13,"./util":19,"amdefine":20}],18:[function(_dereq_,module,exports){
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
if (typeof define !== 'function') {
var define = _dereq_('amdefine')(module, _dereq_);
}
define(function (_dereq_, exports, module) {
var SourceMapGenerator = _dereq_('./source-map-generator').SourceMapGenerator;
var util = _dereq_('./util');
/**
* SourceNodes provide a way to abstract over interpolating/concatenating
* snippets of generated JavaScript source code while maintaining the line and
* column information associated with the original source code.
*
* @param aLine The original line number.
* @param aColumn The original column number.
* @param aSource The original source's filename.
* @param aChunks Optional. An array of strings which are snippets of
* generated JS, or other SourceNodes.
* @param aName The original identifier.
*/
function SourceNode(aLine, aColumn, aSource, aChunks, aName) {
this.children = [];
this.sourceContents = {};
this.line = aLine === undefined ? null : aLine;
this.column = aColumn === undefined ? null : aColumn;
this.source = aSource === undefined ? null : aSource;
this.name = aName === undefined ? null : aName;
if (aChunks != null) this.add(aChunks);
}
/**
* Creates a SourceNode from generated code and a SourceMapConsumer.
*
* @param aGeneratedCode The generated code
* @param aSourceMapConsumer The SourceMap for the generated code
*/
SourceNode.fromStringWithSourceMap =
function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer) {
// The SourceNode we want to fill with the generated code
// and the SourceMap
var node = new SourceNode();
// The generated code
// Processed fragments are removed from this array.
var remainingLines = aGeneratedCode.split('\n');
// We need to remember the position of "remainingLines"
var lastGeneratedLine = 1, lastGeneratedColumn = 0;
// The generate SourceNodes we need a code range.
// To extract it current and last mapping is used.
// Here we store the last mapping.
var lastMapping = null;
aSourceMapConsumer.eachMapping(function (mapping) {
if (lastMapping === null) {
// We add the generated code until the first mapping
// to the SourceNode without any mapping.
// Each line is added as separate string.
while (lastGeneratedLine < mapping.generatedLine) {
node.add(remainingLines.shift() + "\n");
lastGeneratedLine++;
}
if (lastGeneratedColumn < mapping.generatedColumn) {
var nextLine = remainingLines[0];
node.add(nextLine.substr(0, mapping.generatedColumn));
remainingLines[0] = nextLine.substr(mapping.generatedColumn);
lastGeneratedColumn = mapping.generatedColumn;
}
} else {
// We add the code from "lastMapping" to "mapping":
// First check if there is a new line in between.
if (lastGeneratedLine < mapping.generatedLine) {
var code = "";
// Associate full lines with "lastMapping"
do {
code += remainingLines.shift() + "\n";
lastGeneratedLine++;
lastGeneratedColumn = 0;
} while (lastGeneratedLine < mapping.generatedLine);
// When we reached the correct line, we add code until we
// reach the correct column too.
if (lastGeneratedColumn < mapping.generatedColumn) {
var nextLine = remainingLines[0];
code += nextLine.substr(0, mapping.generatedColumn);
remainingLines[0] = nextLine.substr(mapping.generatedColumn);
lastGeneratedColumn = mapping.generatedColumn;
}
// Create the SourceNode.
addMappingWithCode(lastMapping, code);
} else {
// There is no new line in between.
// Associate the code between "lastGeneratedColumn" and
// "mapping.generatedColumn" with "lastMapping"
var nextLine = remainingLines[0];
var code = nextLine.substr(0, mapping.generatedColumn -
lastGeneratedColumn);
remainingLines[0] = nextLine.substr(mapping.generatedColumn -
lastGeneratedColumn);
lastGeneratedColumn = mapping.generatedColumn;
addMappingWithCode(lastMapping, code);
}
}
lastMapping = mapping;
}, this);
// We have processed all mappings.
// Associate the remaining code in the current line with "lastMapping"
// and add the remaining lines without any mapping
addMappingWithCode(lastMapping, remainingLines.join("\n"));
// Copy sourcesContent into SourceNode
aSourceMapConsumer.sources.forEach(function (sourceFile) {
var content = aSourceMapConsumer.sourceContentFor(sourceFile);
if (content) {
node.setSourceContent(sourceFile, content);
}
});
return node;
function addMappingWithCode(mapping, code) {
if (mapping === null || mapping.source === undefined) {
node.add(code);
} else {
node.add(new SourceNode(mapping.originalLine,
mapping.originalColumn,
mapping.source,
code,
mapping.name));
}
}
};
/**
* Add a chunk of generated JS to this source node.
*
* @param aChunk A string snippet of generated JS code, another instance of
* SourceNode, or an array where each member is one of those things.
*/
SourceNode.prototype.add = function SourceNode_add(aChunk) {
if (Array.isArray(aChunk)) {
aChunk.forEach(function (chunk) {
this.add(chunk);
}, this);
}
else if (aChunk instanceof SourceNode || typeof aChunk === "string") {
if (aChunk) {
this.children.push(aChunk);
}
}
else {
throw new TypeError(
"Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
);
}
return this;
};
/**
* Add a chunk of generated JS to the beginning of this source node.
*
* @param aChunk A string snippet of generated JS code, another instance of
* SourceNode, or an array where each member is one of those things.
*/
SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) {
if (Array.isArray(aChunk)) {
for (var i = aChunk.length-1; i >= 0; i--) {
this.prepend(aChunk[i]);
}
}
else if (aChunk instanceof SourceNode || typeof aChunk === "string") {
this.children.unshift(aChunk);
}
else {
throw new TypeError(
"Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
);
}
return this;
};
/**
* Walk over the tree of JS snippets in this node and its children. The
* walking function is called once for each snippet of JS and is passed that
* snippet and the its original associated source's line/column location.
*
* @param aFn The traversal function.
*/
SourceNode.prototype.walk = function SourceNode_walk(aFn) {
var chunk;
for (var i = 0, len = this.children.length; i < len; i++) {
chunk = this.children[i];
if (chunk instanceof SourceNode) {
chunk.walk(aFn);
}
else {
if (chunk !== '') {
aFn(chunk, { source: this.source,
line: this.line,
column: this.column,
name: this.name });
}
}
}
};
/**
* Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between
* each of `this.children`.
*
* @param aSep The separator.
*/
SourceNode.prototype.join = function SourceNode_join(aSep) {
var newChildren;
var i;
var len = this.children.length;
if (len > 0) {
newChildren = [];
for (i = 0; i < len-1; i++) {
newChildren.push(this.children[i]);
newChildren.push(aSep);
}
newChildren.push(this.children[i]);
this.children = newChildren;
}
return this;
};
/**
* Call String.prototype.replace on the very right-most source snippet. Useful
* for trimming whitespace from the end of a source node, etc.
*
* @param aPattern The pattern to replace.
* @param aReplacement The thing to replace the pattern with.
*/
SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) {
var lastChild = this.children[this.children.length - 1];
if (lastChild instanceof SourceNode) {
lastChild.replaceRight(aPattern, aReplacement);
}
else if (typeof lastChild === 'string') {
this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);
}
else {
this.children.push(''.replace(aPattern, aReplacement));
}
return this;
};
/**
* Set the source content for a source file. This will be added to the SourceMapGenerator
* in the sourcesContent field.
*
* @param aSourceFile The filename of the source file
* @param aSourceContent The content of the source file
*/
SourceNode.prototype.setSourceContent =
function SourceNode_setSourceContent(aSourceFile, aSourceContent) {
this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;
};
/**
* Walk over the tree of SourceNodes. The walking function is called for each
* source file content and is passed the filename and source content.
*
* @param aFn The traversal function.
*/
SourceNode.prototype.walkSourceContents =
function SourceNode_walkSourceContents(aFn) {
for (var i = 0, len = this.children.length; i < len; i++) {
if (this.children[i] instanceof SourceNode) {
this.children[i].walkSourceContents(aFn);
}
}
var sources = Object.keys(this.sourceContents);
for (var i = 0, len = sources.length; i < len; i++) {
aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]);
}
};
/**
* Return the string representation of this source node. Walks over the tree
* and concatenates all the various snippets together to one string.
*/
SourceNode.prototype.toString = function SourceNode_toString() {
var str = "";
this.walk(function (chunk) {
str += chunk;
});
return str;
};
/**
* Returns the string representation of this source node along with a source
* map.
*/
SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {
var generated = {
code: "",
line: 1,
column: 0
};
var map = new SourceMapGenerator(aArgs);
var sourceMappingActive = false;
var lastOriginalSource = null;
var lastOriginalLine = null;
var lastOriginalColumn = null;
var lastOriginalName = null;
this.walk(function (chunk, original) {
generated.code += chunk;
if (original.source !== null
&& original.line !== null
&& original.column !== null) {
if(lastOriginalSource !== original.source
|| lastOriginalLine !== original.line
|| lastOriginalColumn !== original.column
|| lastOriginalName !== original.name) {
map.addMapping({
source: original.source,
original: {
line: original.line,
column: original.column
},
generated: {
line: generated.line,
column: generated.column
},
name: original.name
});
}
lastOriginalSource = original.source;
lastOriginalLine = original.line;
lastOriginalColumn = original.column;
lastOriginalName = original.name;
sourceMappingActive = true;
} else if (sourceMappingActive) {
map.addMapping({
generated: {
line: generated.line,
column: generated.column
}
});
lastOriginalSource = null;
sourceMappingActive = false;
}
chunk.split('').forEach(function (ch) {
if (ch === '\n') {
generated.line++;
generated.column = 0;
} else {
generated.column++;
}
});
});
this.walkSourceContents(function (sourceFile, sourceContent) {
map.setSourceContent(sourceFile, sourceContent);
});
return { code: generated.code, map: map };
};
exports.SourceNode = SourceNode;
});
},{"./source-map-generator":17,"./util":19,"amdefine":20}],19:[function(_dereq_,module,exports){
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
if (typeof define !== 'function') {
var define = _dereq_('amdefine')(module, _dereq_);
}
define(function (_dereq_, exports, module) {
/**
* This is a helper function for getting values from parameter/options
* objects.
*
* @param args The object we are extracting values from
* @param name The name of the property we are getting.
* @param defaultValue An optional value to return if the property is missing
* from the object. If this is not specified and the property is missing, an
* error will be thrown.
*/
function getArg(aArgs, aName, aDefaultValue) {
if (aName in aArgs) {
return aArgs[aName];
} else if (arguments.length === 3) {
return aDefaultValue;
} else {
throw new Error('"' + aName + '" is a required argument.');
}
}
exports.getArg = getArg;
var urlRegexp = /([\w+\-.]+):\/\/((\w+:\w+)@)?([\w.]+)?(:(\d+))?(\S+)?/;
var dataUrlRegexp = /^data:.+\,.+/;
function urlParse(aUrl) {
var match = aUrl.match(urlRegexp);
if (!match) {
return null;
}
return {
scheme: match[1],
auth: match[3],
host: match[4],
port: match[6],
path: match[7]
};
}
exports.urlParse = urlParse;
function urlGenerate(aParsedUrl) {
var url = aParsedUrl.scheme + "://";
if (aParsedUrl.auth) {
url += aParsedUrl.auth + "@"
}
if (aParsedUrl.host) {
url += aParsedUrl.host;
}
if (aParsedUrl.port) {
url += ":" + aParsedUrl.port
}
if (aParsedUrl.path) {
url += aParsedUrl.path;
}
return url;
}
exports.urlGenerate = urlGenerate;
function join(aRoot, aPath) {
var url;
if (aPath.match(urlRegexp) || aPath.match(dataUrlRegexp)) {
return aPath;
}
if (aPath.charAt(0) === '/' && (url = urlParse(aRoot))) {
url.path = aPath;
return urlGenerate(url);
}
return aRoot.replace(/\/$/, '') + '/' + aPath;
}
exports.join = join;
/**
* Because behavior goes wacky when you set `__proto__` on objects, we
* have to prefix all the strings in our set with an arbitrary character.
*
* See https://github.com/mozilla/source-map/pull/31 and
* https://github.com/mozilla/source-map/issues/30
*
* @param String aStr
*/
function toSetString(aStr) {
return '$' + aStr;
}
exports.toSetString = toSetString;
function fromSetString(aStr) {
return aStr.substr(1);
}
exports.fromSetString = fromSetString;
function relative(aRoot, aPath) {
aRoot = aRoot.replace(/\/$/, '');
var url = urlParse(aRoot);
if (aPath.charAt(0) == "/" && url && url.path == "/") {
return aPath.slice(1);
}
return aPath.indexOf(aRoot + '/') === 0
? aPath.substr(aRoot.length + 1)
: aPath;
}
exports.relative = relative;
function strcmp(aStr1, aStr2) {
var s1 = aStr1 || "";
var s2 = aStr2 || "";
return (s1 > s2) - (s1 < s2);
}
/**
* Comparator between two mappings where the original positions are compared.
*
* Optionally pass in `true` as `onlyCompareGenerated` to consider two
* mappings with the same original source/line/column, but different generated
* line and column the same. Useful when searching for a mapping with a
* stubbed out mapping.
*/
function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
var cmp;
cmp = strcmp(mappingA.source, mappingB.source);
if (cmp) {
return cmp;
}
cmp = mappingA.originalLine - mappingB.originalLine;
if (cmp) {
return cmp;
}
cmp = mappingA.originalColumn - mappingB.originalColumn;
if (cmp || onlyCompareOriginal) {
return cmp;
}
cmp = strcmp(mappingA.name, mappingB.name);
if (cmp) {
return cmp;
}
cmp = mappingA.generatedLine - mappingB.generatedLine;
if (cmp) {
return cmp;
}
return mappingA.generatedColumn - mappingB.generatedColumn;
};
exports.compareByOriginalPositions = compareByOriginalPositions;
/**
* Comparator between two mappings where the generated positions are
* compared.
*
* Optionally pass in `true` as `onlyCompareGenerated` to consider two
* mappings with the same generated line and column, but different
* source/name/original line and column the same. Useful when searching for a
* mapping with a stubbed out mapping.
*/
function compareByGeneratedPositions(mappingA, mappingB, onlyCompareGenerated) {
var cmp;
cmp = mappingA.generatedLine - mappingB.generatedLine;
if (cmp) {
return cmp;
}
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
if (cmp || onlyCompareGenerated) {
return cmp;
}
cmp = strcmp(mappingA.source, mappingB.source);
if (cmp) {
return cmp;
}
cmp = mappingA.originalLine - mappingB.originalLine;
if (cmp) {
return cmp;
}
cmp = mappingA.originalColumn - mappingB.originalColumn;
if (cmp) {
return cmp;
}
return strcmp(mappingA.name, mappingB.name);
};
exports.compareByGeneratedPositions = compareByGeneratedPositions;
});
},{"amdefine":20}],20:[function(_dereq_,module,exports){
(function (process,__filename){
/** vim: et:ts=4:sw=4:sts=4
* @license amdefine 0.1.0 Copyright (c) 2011, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license.
* see: http://github.com/jrburke/amdefine for details
*/
/*jslint node: true */
/*global module, process */
'use strict';
/**
* Creates a define for node.
* @param {Object} module the "module" object that is defined by Node for the
* current module.
* @param {Function} [requireFn]. Node's require function for the current module.
* It only needs to be passed in Node versions before 0.5, when module.require
* did not exist.
* @returns {Function} a define function that is usable for the current node
* module.
*/
function amdefine(module, requireFn) {
'use strict';
var defineCache = {},
loaderCache = {},
alreadyCalled = false,
path = _dereq_('path'),
makeRequire, stringRequire;
/**
* Trims the . and .. from an array of path segments.
* It will keep a leading path segment if a .. will become
* the first path segment, to help with module name lookups,
* which act like paths, but can be remapped. But the end result,
* all paths that use this function should look normalized.
* NOTE: this method MODIFIES the input array.
* @param {Array} ary the array of path segments.
*/
function trimDots(ary) {
var i, part;
for (i = 0; ary[i]; i+= 1) {
part = ary[i];
if (part === '.') {
ary.splice(i, 1);
i -= 1;
} else if (part === '..') {
if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
//End of the line. Keep at least one non-dot
//path segment at the front so it can be mapped
//correctly to disk. Otherwise, there is likely
//no path mapping for a path starting with '..'.
//This can still fail, but catches the most reasonable
//uses of ..
break;
} else if (i > 0) {
ary.splice(i - 1, 2);
i -= 2;
}
}
}
}
function normalize(name, baseName) {
var baseParts;
//Adjust any relative paths.
if (name && name.charAt(0) === '.') {
//If have a base name, try to normalize against it,
//otherwise, assume it is a top-level require that will
//be relative to baseUrl in the end.
if (baseName) {
baseParts = baseName.split('/');
baseParts = baseParts.slice(0, baseParts.length - 1);
baseParts = baseParts.concat(name.split('/'));
trimDots(baseParts);
name = baseParts.join('/');
}
}
return name;
}
/**
* Create the normalize() function passed to a loader plugin's
* normalize method.
*/
function makeNormalize(relName) {
return function (name) {
return normalize(name, relName);
};
}
function makeLoad(id) {
function load(value) {
loaderCache[id] = value;
}
load.fromText = function (id, text) {
//This one is difficult because the text can/probably uses
//define, and any relative paths and requires should be relative
//to that id was it would be found on disk. But this would require
//bootstrapping a module/require fairly deeply from node core.
//Not sure how best to go about that yet.
throw new Error('amdefine does not implement load.fromText');
};
return load;
}
makeRequire = function (systemRequire, exports, module, relId) {
function amdRequire(deps, callback) {
if (typeof deps === 'string') {
//Synchronous, single module require('')
return stringRequire(systemRequire, exports, module, deps, relId);
} else {
//Array of dependencies with a callback.
//Convert the dependencies to modules.
deps = deps.map(function (depName) {
return stringRequire(systemRequire, exports, module, depName, relId);
});
//Wait for next tick to call back the require call.
process.nextTick(function () {
callback.apply(null, deps);
});
}
}
amdRequire.toUrl = function (filePath) {
if (filePath.indexOf('.') === 0) {
return normalize(filePath, path.dirname(module.filename));
} else {
return filePath;
}
};
return amdRequire;
};
//Favor explicit value, passed in if the module wants to support Node 0.4.
requireFn = requireFn || function req() {
return module.require.apply(module, arguments);
};
function runFactory(id, deps, factory) {
var r, e, m, result;
if (id) {
e = loaderCache[id] = {};
m = {
id: id,
uri: __filename,
exports: e
};
r = makeRequire(requireFn, e, m, id);
} else {
//Only support one define call per file
if (alreadyCalled) {
throw new Error('amdefine with no module ID cannot be called more than once per file.');
}
alreadyCalled = true;
//Use the real variables from node
//Use module.exports for exports, since
//the exports in here is amdefine exports.
e = module.exports;
m = module;
r = makeRequire(requireFn, e, m, module.id);
}
//If there are dependencies, they are strings, so need
//to convert them to dependency values.
if (deps) {
deps = deps.map(function (depName) {
return r(depName);
});
}
//Call the factory with the right dependencies.
if (typeof factory === 'function') {
result = factory.apply(m.exports, deps);
} else {
result = factory;
}
if (result !== undefined) {
m.exports = result;
if (id) {
loaderCache[id] = m.exports;
}
}
}
stringRequire = function (systemRequire, exports, module, id, relId) {
//Split the ID by a ! so that
var index = id.indexOf('!'),
originalId = id,
prefix, plugin;
if (index === -1) {
id = normalize(id, relId);
//Straight module lookup. If it is one of the special dependencies,
//deal with it, otherwise, delegate to node.
if (id === 'require') {
return makeRequire(systemRequire, exports, module, relId);
} else if (id === 'exports') {
return exports;
} else if (id === 'module') {
return module;
} else if (loaderCache.hasOwnProperty(id)) {
return loaderCache[id];
} else if (defineCache[id]) {
runFactory.apply(null, defineCache[id]);
return loaderCache[id];
} else {
if(systemRequire) {
return systemRequire(originalId);
} else {
throw new Error('No module with ID: ' + id);
}
}
} else {
//There is a plugin in play.
prefix = id.substring(0, index);
id = id.substring(index + 1, id.length);
plugin = stringRequire(systemRequire, exports, module, prefix, relId);
if (plugin.normalize) {
id = plugin.normalize(id, makeNormalize(relId));
} else {
//Normalize the ID normally.
id = normalize(id, relId);
}
if (loaderCache[id]) {
return loaderCache[id];
} else {
plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {});
return loaderCache[id];
}
}
};
//Create a define function specific to the module asking for amdefine.
function define(id, deps, factory) {
if (Array.isArray(id)) {
factory = deps;
deps = id;
id = undefined;
} else if (typeof id !== 'string') {
factory = id;
id = deps = undefined;
}
if (deps && !Array.isArray(deps)) {
factory = deps;
deps = undefined;
}
if (!deps) {
deps = ['require', 'exports', 'module'];
}
//Set up properties for this module. If an ID, then use
//internal cache. If no ID, then use the external variables
//for this node module.
if (id) {
//Put the module in deep freeze until there is a
//require call for it.
defineCache[id] = [id, deps, factory];
} else {
runFactory(id, deps, factory);
}
}
//define.require, which has access to all the values in the
//cache. Useful for AMD modules that all have IDs in the file,
//but need to finally export a value to node based on one of those
//IDs.
define.require = function (id) {
if (loaderCache[id]) {
return loaderCache[id];
}
if (defineCache[id]) {
runFactory.apply(null, defineCache[id]);
return loaderCache[id];
}
};
define.amd = {};
return define;
}
module.exports = amdefine;
}).call(this,_dereq_('_process'),"/node_modules/jstransform/node_modules/source-map/node_modules/amdefine/amdefine.js")
},{"_process":8,"path":7}],21:[function(_dereq_,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var docblockRe = /^\s*(\/\*\*(.|\r?\n)*?\*\/)/;
var ltrimRe = /^\s*/;
/**
* @param {String} contents
* @return {String}
*/
function extract(contents) {
var match = contents.match(docblockRe);
if (match) {
return match[0].replace(ltrimRe, '') || '';
}
return '';
}
var commentStartRe = /^\/\*\*?/;
var commentEndRe = /\*+\/$/;
var wsRe = /[\t ]+/g;
var stringStartRe = /(\r?\n|^) *\*/g;
var multilineRe = /(?:^|\r?\n) *(@[^\r\n]*?) *\r?\n *([^@\r\n\s][^@\r\n]+?) *\r?\n/g;
var propertyRe = /(?:^|\r?\n) *@(\S+) *([^\r\n]*)/g;
/**
* @param {String} contents
* @return {Array}
*/
function parse(docblock) {
docblock = docblock
.replace(commentStartRe, '')
.replace(commentEndRe, '')
.replace(wsRe, ' ')
.replace(stringStartRe, '$1');
// Normalize multi-line directives
var prev = '';
while (prev != docblock) {
prev = docblock;
docblock = docblock.replace(multilineRe, "\n$1 $2\n");
}
docblock = docblock.trim();
var result = [];
var match;
while (match = propertyRe.exec(docblock)) {
result.push([match[1], match[2]]);
}
return result;
}
/**
* Same as parse but returns an object of prop: value instead of array of paris
* If a property appers more than once the last one will be returned
*
* @param {String} contents
* @return {Object}
*/
function parseAsObject(docblock) {
var pairs = parse(docblock);
var result = {};
for (var i = 0; i < pairs.length; i++) {
result[pairs[i][0]] = pairs[i][1];
}
return result;
}
exports.extract = extract;
exports.parse = parse;
exports.parseAsObject = parseAsObject;
},{}],22:[function(_dereq_,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*jslint node: true*/
"use strict";
var esprima = _dereq_('esprima-fb');
var utils = _dereq_('./utils');
var getBoundaryNode = utils.getBoundaryNode;
var declareIdentInScope = utils.declareIdentInLocalScope;
var initScopeMetadata = utils.initScopeMetadata;
var Syntax = esprima.Syntax;
/**
* @param {object} node
* @param {object} parentNode
* @return {boolean}
*/
function _nodeIsClosureScopeBoundary(node, parentNode) {
if (node.type === Syntax.Program) {
return true;
}
var parentIsFunction =
parentNode.type === Syntax.FunctionDeclaration
|| parentNode.type === Syntax.FunctionExpression
|| parentNode.type === Syntax.ArrowFunctionExpression;
var parentIsCurlylessArrowFunc =
parentNode.type === Syntax.ArrowFunctionExpression
&& node === parentNode.body;
return parentIsFunction
&& (node.type === Syntax.BlockStatement || parentIsCurlylessArrowFunc);
}
function _nodeIsBlockScopeBoundary(node, parentNode) {
if (node.type === Syntax.Program) {
return false;
}
return node.type === Syntax.BlockStatement
&& parentNode.type === Syntax.CatchClause;
}
/**
* @param {object} node
* @param {array} path
* @param {object} state
*/
function traverse(node, path, state) {
/*jshint -W004*/
// Create a scope stack entry if this is the first node we've encountered in
// its local scope
var startIndex = null;
var parentNode = path[0];
if (!Array.isArray(node) && state.localScope.parentNode !== parentNode) {
if (_nodeIsClosureScopeBoundary(node, parentNode)) {
var scopeIsStrict = state.scopeIsStrict;
if (!scopeIsStrict
&& (node.type === Syntax.BlockStatement
|| node.type === Syntax.Program)) {
scopeIsStrict =
node.body.length > 0
&& node.body[0].type === Syntax.ExpressionStatement
&& node.body[0].expression.type === Syntax.Literal
&& node.body[0].expression.value === 'use strict';
}
if (node.type === Syntax.Program) {
startIndex = state.g.buffer.length;
state = utils.updateState(state, {
scopeIsStrict: scopeIsStrict
});
} else {
startIndex = state.g.buffer.length + 1;
state = utils.updateState(state, {
localScope: {
parentNode: parentNode,
parentScope: state.localScope,
identifiers: {},
tempVarIndex: 0,
tempVars: []
},
scopeIsStrict: scopeIsStrict
});
// All functions have an implicit 'arguments' object in scope
declareIdentInScope('arguments', initScopeMetadata(node), state);
// Include function arg identifiers in the scope boundaries of the
// function
if (parentNode.params.length > 0) {
var param;
var metadata = initScopeMetadata(parentNode, path.slice(1), path[0]);
for (var i = 0; i < parentNode.params.length; i++) {
param = parentNode.params[i];
if (param.type === Syntax.Identifier) {
declareIdentInScope(param.name, metadata, state);
}
}
}
// Include rest arg identifiers in the scope boundaries of their
// functions
if (parentNode.rest) {
var metadata = initScopeMetadata(
parentNode,
path.slice(1),
path[0]
);
declareIdentInScope(parentNode.rest.name, metadata, state);
}
// Named FunctionExpressions scope their name within the body block of
// themselves only
if (parentNode.type === Syntax.FunctionExpression && parentNode.id) {
var metaData =
initScopeMetadata(parentNode, path.parentNodeslice, parentNode);
declareIdentInScope(parentNode.id.name, metaData, state);
}
}
// Traverse and find all local identifiers in this closure first to
// account for function/variable declaration hoisting
collectClosureIdentsAndTraverse(node, path, state);
}
if (_nodeIsBlockScopeBoundary(node, parentNode)) {
startIndex = state.g.buffer.length;
state = utils.updateState(state, {
localScope: {
parentNode: parentNode,
parentScope: state.localScope,
identifiers: {},
tempVarIndex: 0,
tempVars: []
}
});
if (parentNode.type === Syntax.CatchClause) {
var metadata = initScopeMetadata(
parentNode,
path.slice(1),
parentNode
);
declareIdentInScope(parentNode.param.name, metadata, state);
}
collectBlockIdentsAndTraverse(node, path, state);
}
}
// Only catchup() before and after traversing a child node
function traverser(node, path, state) {
node.range && utils.catchup(node.range[0], state);
traverse(node, path, state);
node.range && utils.catchup(node.range[1], state);
}
utils.analyzeAndTraverse(walker, traverser, node, path, state);
// Inject temp variables into the scope.
if (startIndex !== null) {
utils.injectTempVarDeclarations(state, startIndex);
}
}
function collectClosureIdentsAndTraverse(node, path, state) {
utils.analyzeAndTraverse(
visitLocalClosureIdentifiers,
collectClosureIdentsAndTraverse,
node,
path,
state
);
}
function collectBlockIdentsAndTraverse(node, path, state) {
utils.analyzeAndTraverse(
visitLocalBlockIdentifiers,
collectBlockIdentsAndTraverse,
node,
path,
state
);
}
function visitLocalClosureIdentifiers(node, path, state) {
var metaData;
switch (node.type) {
case Syntax.ArrowFunctionExpression:
case Syntax.FunctionExpression:
// Function expressions don't get their names (if there is one) added to
// the closure scope they're defined in
return false;
case Syntax.ClassDeclaration:
case Syntax.ClassExpression:
case Syntax.FunctionDeclaration:
if (node.id) {
metaData = initScopeMetadata(getBoundaryNode(path), path.slice(), node);
declareIdentInScope(node.id.name, metaData, state);
}
return false;
case Syntax.VariableDeclarator:
// Variables have function-local scope
if (path[0].kind === 'var') {
metaData = initScopeMetadata(getBoundaryNode(path), path.slice(), node);
declareIdentInScope(node.id.name, metaData, state);
}
break;
}
}
function visitLocalBlockIdentifiers(node, path, state) {
// TODO: Support 'let' here...maybe...one day...or something...
if (node.type === Syntax.CatchClause) {
return false;
}
}
function walker(node, path, state) {
var visitors = state.g.visitors;
for (var i = 0; i < visitors.length; i++) {
if (visitors[i].test(node, path, state)) {
return visitors[i](traverse, node, path, state);
}
}
}
var _astCache = {};
function getAstForSource(source, options) {
if (_astCache[source] && !options.disableAstCache) {
return _astCache[source];
}
var ast = esprima.parse(source, {
comment: true,
loc: true,
range: true,
sourceType: options.sourceType
});
if (!options.disableAstCache) {
_astCache[source] = ast;
}
return ast;
}
/**
* Applies all available transformations to the source
* @param {array} visitors
* @param {string} source
* @param {?object} options
* @return {object}
*/
function transform(visitors, source, options) {
options = options || {};
var ast;
try {
ast = getAstForSource(source, options);
} catch (e) {
e.message = 'Parse Error: ' + e.message;
throw e;
}
var state = utils.createState(source, ast, options);
state.g.visitors = visitors;
if (options.sourceMap) {
var SourceMapGenerator = _dereq_('source-map').SourceMapGenerator;
state.g.sourceMap = new SourceMapGenerator({file: options.filename || 'transformed.js'});
}
traverse(ast, [], state);
utils.catchup(source.length, state);
var ret = {code: state.g.buffer, extra: state.g.extra};
if (options.sourceMap) {
ret.sourceMap = state.g.sourceMap;
ret.sourceMapFilename = options.filename || 'source.js';
}
return ret;
}
exports.transform = transform;
exports.Syntax = Syntax;
},{"./utils":23,"esprima-fb":9,"source-map":11}],23:[function(_dereq_,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*jslint node: true*/
var Syntax = _dereq_('esprima-fb').Syntax;
var leadingIndentRegexp = /(^|\n)( {2}|\t)/g;
var nonWhiteRegexp = /(\S)/g;
/**
* A `state` object represents the state of the parser. It has "local" and
* "global" parts. Global contains parser position, source, etc. Local contains
* scope based properties like current class name. State should contain all the
* info required for transformation. It's the only mandatory object that is
* being passed to every function in transform chain.
*
* @param {string} source
* @param {object} transformOptions
* @return {object}
*/
function createState(source, rootNode, transformOptions) {
return {
/**
* A tree representing the current local scope (and its lexical scope chain)
* Useful for tracking identifiers from parent scopes, etc.
* @type {Object}
*/
localScope: {
parentNode: rootNode,
parentScope: null,
identifiers: {},
tempVarIndex: 0,
tempVars: []
},
/**
* The name (and, if applicable, expression) of the super class
* @type {Object}
*/
superClass: null,
/**
* The namespace to use when munging identifiers
* @type {String}
*/
mungeNamespace: '',
/**
* Ref to the node for the current MethodDefinition
* @type {Object}
*/
methodNode: null,
/**
* Ref to the node for the FunctionExpression of the enclosing
* MethodDefinition
* @type {Object}
*/
methodFuncNode: null,
/**
* Name of the enclosing class
* @type {String}
*/
className: null,
/**
* Whether we're currently within a `strict` scope
* @type {Bool}
*/
scopeIsStrict: null,
/**
* Indentation offset
* @type {Number}
*/
indentBy: 0,
/**
* Global state (not affected by updateState)
* @type {Object}
*/
g: {
/**
* A set of general options that transformations can consider while doing
* a transformation:
*
* - minify
* Specifies that transformation steps should do their best to minify
* the output source when possible. This is useful for places where
* minification optimizations are possible with higher-level context
* info than what jsxmin can provide.
*
* For example, the ES6 class transform will minify munged private
* variables if this flag is set.
*/
opts: transformOptions,
/**
* Current position in the source code
* @type {Number}
*/
position: 0,
/**
* Auxiliary data to be returned by transforms
* @type {Object}
*/
extra: {},
/**
* Buffer containing the result
* @type {String}
*/
buffer: '',
/**
* Source that is being transformed
* @type {String}
*/
source: source,
/**
* Cached parsed docblock (see getDocblock)
* @type {object}
*/
docblock: null,
/**
* Whether the thing was used
* @type {Boolean}
*/
tagNamespaceUsed: false,
/**
* If using bolt xjs transformation
* @type {Boolean}
*/
isBolt: undefined,
/**
* Whether to record source map (expensive) or not
* @type {SourceMapGenerator|null}
*/
sourceMap: null,
/**
* Filename of the file being processed. Will be returned as a source
* attribute in the source map
*/
sourceMapFilename: 'source.js',
/**
* Only when source map is used: last line in the source for which
* source map was generated
* @type {Number}
*/
sourceLine: 1,
/**
* Only when source map is used: last line in the buffer for which
* source map was generated
* @type {Number}
*/
bufferLine: 1,
/**
* The top-level Program AST for the original file.
*/
originalProgramAST: null,
sourceColumn: 0,
bufferColumn: 0
}
};
}
/**
* Updates a copy of a given state with "update" and returns an updated state.
*
* @param {object} state
* @param {object} update
* @return {object}
*/
function updateState(state, update) {
var ret = Object.create(state);
Object.keys(update).forEach(function(updatedKey) {
ret[updatedKey] = update[updatedKey];
});
return ret;
}
/**
* Given a state fill the resulting buffer from the original source up to
* the end
*
* @param {number} end
* @param {object} state
* @param {?function} contentTransformer Optional callback to transform newly
* added content.
*/
function catchup(end, state, contentTransformer) {
if (end < state.g.position) {
// cannot move backwards
return;
}
var source = state.g.source.substring(state.g.position, end);
var transformed = updateIndent(source, state);
if (state.g.sourceMap && transformed) {
// record where we are
state.g.sourceMap.addMapping({
generated: { line: state.g.bufferLine, column: state.g.bufferColumn },
original: { line: state.g.sourceLine, column: state.g.sourceColumn },
source: state.g.sourceMapFilename
});
// record line breaks in transformed source
var sourceLines = source.split('\n');
var transformedLines = transformed.split('\n');
// Add line break mappings between last known mapping and the end of the
// added piece. So for the code piece
// (foo, bar);
// > var x = 2;
// > var b = 3;
// var c =
// only add lines marked with ">": 2, 3.
for (var i = 1; i < sourceLines.length - 1; i++) {
state.g.sourceMap.addMapping({
generated: { line: state.g.bufferLine, column: 0 },
original: { line: state.g.sourceLine, column: 0 },
source: state.g.sourceMapFilename
});
state.g.sourceLine++;
state.g.bufferLine++;
}
// offset for the last piece
if (sourceLines.length > 1) {
state.g.sourceLine++;
state.g.bufferLine++;
state.g.sourceColumn = 0;
state.g.bufferColumn = 0;
}
state.g.sourceColumn += sourceLines[sourceLines.length - 1].length;
state.g.bufferColumn +=
transformedLines[transformedLines.length - 1].length;
}
state.g.buffer +=
contentTransformer ? contentTransformer(transformed) : transformed;
state.g.position = end;
}
/**
* Returns original source for an AST node.
* @param {object} node
* @param {object} state
* @return {string}
*/
function getNodeSourceText(node, state) {
return state.g.source.substring(node.range[0], node.range[1]);
}
function _replaceNonWhite(value) {
return value.replace(nonWhiteRegexp, ' ');
}
/**
* Removes all non-whitespace characters
*/
function _stripNonWhite(value) {
return value.replace(nonWhiteRegexp, '');
}
/**
* Finds the position of the next instance of the specified syntactic char in
* the pending source.
*
* NOTE: This will skip instances of the specified char if they sit inside a
* comment body.
*
* NOTE: This function also assumes that the buffer's current position is not
* already within a comment or a string. This is rarely the case since all
* of the buffer-advancement utility methods tend to be used on syntactic
* nodes' range values -- but it's a small gotcha that's worth mentioning.
*/
function getNextSyntacticCharOffset(char, state) {
var pendingSource = state.g.source.substring(state.g.position);
var pendingSourceLines = pendingSource.split('\n');
var charOffset = 0;
var line;
var withinBlockComment = false;
var withinString = false;
lineLoop: while ((line = pendingSourceLines.shift()) !== undefined) {
var lineEndPos = charOffset + line.length;
charLoop: for (; charOffset < lineEndPos; charOffset++) {
var currChar = pendingSource[charOffset];
if (currChar === '"' || currChar === '\'') {
withinString = !withinString;
continue charLoop;
} else if (withinString) {
continue charLoop;
} else if (charOffset + 1 < lineEndPos) {
var nextTwoChars = currChar + line[charOffset + 1];
if (nextTwoChars === '//') {
charOffset = lineEndPos + 1;
continue lineLoop;
} else if (nextTwoChars === '/*') {
withinBlockComment = true;
charOffset += 1;
continue charLoop;
} else if (nextTwoChars === '*/') {
withinBlockComment = false;
charOffset += 1;
continue charLoop;
}
}
if (!withinBlockComment && currChar === char) {
return charOffset + state.g.position;
}
}
// Account for '\n'
charOffset++;
withinString = false;
}
throw new Error('`' + char + '` not found!');
}
/**
* Catches up as `catchup` but replaces non-whitespace chars with spaces.
*/
function catchupWhiteOut(end, state) {
catchup(end, state, _replaceNonWhite);
}
/**
* Catches up as `catchup` but removes all non-whitespace characters.
*/
function catchupWhiteSpace(end, state) {
catchup(end, state, _stripNonWhite);
}
/**
* Removes all non-newline characters
*/
var reNonNewline = /[^\n]/g;
function stripNonNewline(value) {
return value.replace(reNonNewline, function() {
return '';
});
}
/**
* Catches up as `catchup` but removes all non-newline characters.
*
* Equivalent to appending as many newlines as there are in the original source
* between the current position and `end`.
*/
function catchupNewlines(end, state) {
catchup(end, state, stripNonNewline);
}
/**
* Same as catchup but does not touch the buffer
*
* @param {number} end
* @param {object} state
*/
function move(end, state) {
// move the internal cursors
if (state.g.sourceMap) {
if (end < state.g.position) {
state.g.position = 0;
state.g.sourceLine = 1;
state.g.sourceColumn = 0;
}
var source = state.g.source.substring(state.g.position, end);
var sourceLines = source.split('\n');
if (sourceLines.length > 1) {
state.g.sourceLine += sourceLines.length - 1;
state.g.sourceColumn = 0;
}
state.g.sourceColumn += sourceLines[sourceLines.length - 1].length;
}
state.g.position = end;
}
/**
* Appends a string of text to the buffer
*
* @param {string} str
* @param {object} state
*/
function append(str, state) {
if (state.g.sourceMap && str) {
state.g.sourceMap.addMapping({
generated: { line: state.g.bufferLine, column: state.g.bufferColumn },
original: { line: state.g.sourceLine, column: state.g.sourceColumn },
source: state.g.sourceMapFilename
});
var transformedLines = str.split('\n');
if (transformedLines.length > 1) {
state.g.bufferLine += transformedLines.length - 1;
state.g.bufferColumn = 0;
}
state.g.bufferColumn +=
transformedLines[transformedLines.length - 1].length;
}
state.g.buffer += str;
}
/**
* Update indent using state.indentBy property. Indent is measured in
* double spaces. Updates a single line only.
*
* @param {string} str
* @param {object} state
* @return {string}
*/
function updateIndent(str, state) {
/*jshint -W004*/
var indentBy = state.indentBy;
if (indentBy < 0) {
for (var i = 0; i < -indentBy; i++) {
str = str.replace(leadingIndentRegexp, '$1');
}
} else {
for (var i = 0; i < indentBy; i++) {
str = str.replace(leadingIndentRegexp, '$1$2$2');
}
}
return str;
}
/**
* Calculates indent from the beginning of the line until "start" or the first
* character before start.
* @example
* " foo.bar()"
* ^
* start
* indent will be " "
*
* @param {number} start
* @param {object} state
* @return {string}
*/
function indentBefore(start, state) {
var end = start;
start = start - 1;
while (start > 0 && state.g.source[start] != '\n') {
if (!state.g.source[start].match(/[ \t]/)) {
end = start;
}
start--;
}
return state.g.source.substring(start + 1, end);
}
function getDocblock(state) {
if (!state.g.docblock) {
var docblock = _dereq_('./docblock');
state.g.docblock =
docblock.parseAsObject(docblock.extract(state.g.source));
}
return state.g.docblock;
}
function identWithinLexicalScope(identName, state, stopBeforeNode) {
var currScope = state.localScope;
while (currScope) {
if (currScope.identifiers[identName] !== undefined) {
return true;
}
if (stopBeforeNode && currScope.parentNode === stopBeforeNode) {
break;
}
currScope = currScope.parentScope;
}
return false;
}
function identInLocalScope(identName, state) {
return state.localScope.identifiers[identName] !== undefined;
}
/**
* @param {object} boundaryNode
* @param {?array} path
* @return {?object} node
*/
function initScopeMetadata(boundaryNode, path, node) {
return {
boundaryNode: boundaryNode,
bindingPath: path,
bindingNode: node
};
}
function declareIdentInLocalScope(identName, metaData, state) {
state.localScope.identifiers[identName] = {
boundaryNode: metaData.boundaryNode,
path: metaData.bindingPath,
node: metaData.bindingNode,
state: Object.create(state)
};
}
function getLexicalBindingMetadata(identName, state) {
var currScope = state.localScope;
while (currScope) {
if (currScope.identifiers[identName] !== undefined) {
return currScope.identifiers[identName];
}
currScope = currScope.parentScope;
}
}
function getLocalBindingMetadata(identName, state) {
return state.localScope.identifiers[identName];
}
/**
* Apply the given analyzer function to the current node. If the analyzer
* doesn't return false, traverse each child of the current node using the given
* traverser function.
*
* @param {function} analyzer
* @param {function} traverser
* @param {object} node
* @param {array} path
* @param {object} state
*/
function analyzeAndTraverse(analyzer, traverser, node, path, state) {
if (node.type) {
if (analyzer(node, path, state) === false) {
return;
}
path.unshift(node);
}
getOrderedChildren(node).forEach(function(child) {
traverser(child, path, state);
});
node.type && path.shift();
}
/**
* It is crucial that we traverse in order, or else catchup() on a later
* node that is processed out of order can move the buffer past a node
* that we haven't handled yet, preventing us from modifying that node.
*
* This can happen when a node has multiple properties containing children.
* For example, XJSElement nodes have `openingElement`, `closingElement` and
* `children`. If we traverse `openingElement`, then `closingElement`, then
* when we get to `children`, the buffer has already caught up to the end of
* the closing element, after the children.
*
* This is basically a Schwartzian transform. Collects an array of children,
* each one represented as [child, startIndex]; sorts the array by start
* index; then traverses the children in that order.
*/
function getOrderedChildren(node) {
var queue = [];
for (var key in node) {
if (node.hasOwnProperty(key)) {
enqueueNodeWithStartIndex(queue, node[key]);
}
}
queue.sort(function(a, b) { return a[1] - b[1]; });
return queue.map(function(pair) { return pair[0]; });
}
/**
* Helper function for analyzeAndTraverse which queues up all of the children
* of the given node.
*
* Children can also be found in arrays, so we basically want to merge all of
* those arrays together so we can sort them and then traverse the children
* in order.
*
* One example is the Program node. It contains `body` and `comments`, both
* arrays. Lexographically, comments are interspersed throughout the body
* nodes, but esprima's AST groups them together.
*/
function enqueueNodeWithStartIndex(queue, node) {
if (typeof node !== 'object' || node === null) {
return;
}
if (node.range) {
queue.push([node, node.range[0]]);
} else if (Array.isArray(node)) {
for (var ii = 0; ii < node.length; ii++) {
enqueueNodeWithStartIndex(queue, node[ii]);
}
}
}
/**
* Checks whether a node or any of its sub-nodes contains
* a syntactic construct of the passed type.
* @param {object} node - AST node to test.
* @param {string} type - node type to lookup.
*/
function containsChildOfType(node, type) {
return containsChildMatching(node, function(node) {
return node.type === type;
});
}
function containsChildMatching(node, matcher) {
var foundMatchingChild = false;
function nodeTypeAnalyzer(node) {
if (matcher(node) === true) {
foundMatchingChild = true;
return false;
}
}
function nodeTypeTraverser(child, path, state) {
if (!foundMatchingChild) {
foundMatchingChild = containsChildMatching(child, matcher);
}
}
analyzeAndTraverse(
nodeTypeAnalyzer,
nodeTypeTraverser,
node,
[]
);
return foundMatchingChild;
}
var scopeTypes = {};
scopeTypes[Syntax.ArrowFunctionExpression] = true;
scopeTypes[Syntax.FunctionExpression] = true;
scopeTypes[Syntax.FunctionDeclaration] = true;
scopeTypes[Syntax.Program] = true;
function getBoundaryNode(path) {
for (var ii = 0; ii < path.length; ++ii) {
if (scopeTypes[path[ii].type]) {
return path[ii];
}
}
throw new Error(
'Expected to find a node with one of the following types in path:\n' +
JSON.stringify(Object.keys(scopeTypes))
);
}
function getTempVar(tempVarIndex) {
return '$__' + tempVarIndex;
}
function injectTempVar(state) {
var tempVar = '$__' + (state.localScope.tempVarIndex++);
state.localScope.tempVars.push(tempVar);
return tempVar;
}
function injectTempVarDeclarations(state, index) {
if (state.localScope.tempVars.length) {
state.g.buffer =
state.g.buffer.slice(0, index) +
'var ' + state.localScope.tempVars.join(', ') + ';' +
state.g.buffer.slice(index);
state.localScope.tempVars = [];
}
}
exports.analyzeAndTraverse = analyzeAndTraverse;
exports.append = append;
exports.catchup = catchup;
exports.catchupNewlines = catchupNewlines;
exports.catchupWhiteOut = catchupWhiteOut;
exports.catchupWhiteSpace = catchupWhiteSpace;
exports.containsChildMatching = containsChildMatching;
exports.containsChildOfType = containsChildOfType;
exports.createState = createState;
exports.declareIdentInLocalScope = declareIdentInLocalScope;
exports.getBoundaryNode = getBoundaryNode;
exports.getDocblock = getDocblock;
exports.getLexicalBindingMetadata = getLexicalBindingMetadata;
exports.getLocalBindingMetadata = getLocalBindingMetadata;
exports.getNextSyntacticCharOffset = getNextSyntacticCharOffset;
exports.getNodeSourceText = getNodeSourceText;
exports.getOrderedChildren = getOrderedChildren;
exports.getTempVar = getTempVar;
exports.identInLocalScope = identInLocalScope;
exports.identWithinLexicalScope = identWithinLexicalScope;
exports.indentBefore = indentBefore;
exports.initScopeMetadata = initScopeMetadata;
exports.injectTempVar = injectTempVar;
exports.injectTempVarDeclarations = injectTempVarDeclarations;
exports.move = move;
exports.scopeTypes = scopeTypes;
exports.updateIndent = updateIndent;
exports.updateState = updateState;
},{"./docblock":21,"esprima-fb":9}],24:[function(_dereq_,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*global exports:true*/
/**
* Desugars ES6 Arrow functions to ES3 function expressions.
* If the function contains `this` expression -- automatically
* binds the function to current value of `this`.
*
* Single parameter, simple expression:
*
* [1, 2, 3].map(x => x * x);
*
* [1, 2, 3].map(function(x) { return x * x; });
*
* Several parameters, complex block:
*
* this.users.forEach((user, idx) => {
* return this.isActive(idx) && this.send(user);
* });
*
* this.users.forEach(function(user, idx) {
* return this.isActive(idx) && this.send(user);
* }.bind(this));
*
*/
var restParamVisitors = _dereq_('./es6-rest-param-visitors');
var destructuringVisitors = _dereq_('./es6-destructuring-visitors');
var Syntax = _dereq_('esprima-fb').Syntax;
var utils = _dereq_('../src/utils');
/**
* @public
*/
function visitArrowFunction(traverse, node, path, state) {
var notInExpression = (path[0].type === Syntax.ExpressionStatement);
// Wrap a function into a grouping operator, if it's not
// in the expression position.
if (notInExpression) {
utils.append('(', state);
}
utils.append('function', state);
renderParams(traverse, node, path, state);
// Skip arrow.
utils.catchupWhiteSpace(node.body.range[0], state);
var renderBody = node.body.type == Syntax.BlockStatement
? renderStatementBody
: renderExpressionBody;
path.unshift(node);
renderBody(traverse, node, path, state);
path.shift();
// Bind the function only if `this` value is used
// inside it or inside any sub-expression.
var containsBindingSyntax =
utils.containsChildMatching(node.body, function(node) {
return node.type === Syntax.ThisExpression
|| (node.type === Syntax.Identifier
&& node.name === "super");
});
if (containsBindingSyntax) {
utils.append('.bind(this)', state);
}
utils.catchupWhiteSpace(node.range[1], state);
// Close wrapper if not in the expression.
if (notInExpression) {
utils.append(')', state);
}
return false;
}
function renderParams(traverse, node, path, state) {
// To preserve inline typechecking directives, we
// distinguish between parens-free and paranthesized single param.
if (isParensFreeSingleParam(node, state) || !node.params.length) {
utils.append('(', state);
}
if (node.params.length !== 0) {
path.unshift(node);
traverse(node.params, path, state);
path.unshift();
}
utils.append(')', state);
}
function isParensFreeSingleParam(node, state) {
return node.params.length === 1 &&
state.g.source[state.g.position] !== '(';
}
function renderExpressionBody(traverse, node, path, state) {
// Wrap simple expression bodies into a block
// with explicit return statement.
utils.append('{', state);
// Special handling of rest param.
if (node.rest) {
utils.append(
restParamVisitors.renderRestParamSetup(node, state),
state
);
}
// Special handling of destructured params.
destructuringVisitors.renderDestructuredComponents(
node,
utils.updateState(state, {
localScope: {
parentNode: state.parentNode,
parentScope: state.parentScope,
identifiers: state.identifiers,
tempVarIndex: 0
}
})
);
utils.append('return ', state);
renderStatementBody(traverse, node, path, state);
utils.append(';}', state);
}
function renderStatementBody(traverse, node, path, state) {
traverse(node.body, path, state);
utils.catchup(node.body.range[1], state);
}
visitArrowFunction.test = function(node, path, state) {
return node.type === Syntax.ArrowFunctionExpression;
};
exports.visitorList = [
visitArrowFunction
];
},{"../src/utils":23,"./es6-destructuring-visitors":27,"./es6-rest-param-visitors":30,"esprima-fb":9}],25:[function(_dereq_,module,exports){
/**
* Copyright 2004-present Facebook. All Rights Reserved.
*/
/*global exports:true*/
/**
* Implements ES6 call spread.
*
* instance.method(a, b, c, ...d)
*
* instance.method.apply(instance, [a, b, c].concat(d))
*
*/
var Syntax = _dereq_('esprima-fb').Syntax;
var utils = _dereq_('../src/utils');
function process(traverse, node, path, state) {
utils.move(node.range[0], state);
traverse(node, path, state);
utils.catchup(node.range[1], state);
}
function visitCallSpread(traverse, node, path, state) {
utils.catchup(node.range[0], state);
if (node.type === Syntax.NewExpression) {
// Input = new Set(1, 2, ...list)
// Output = new (Function.prototype.bind.apply(Set, [null, 1, 2].concat(list)))
utils.append('new (Function.prototype.bind.apply(', state);
process(traverse, node.callee, path, state);
} else if (node.callee.type === Syntax.MemberExpression) {
// Input = get().fn(1, 2, ...more)
// Output = (_ = get()).fn.apply(_, [1, 2].apply(more))
var tempVar = utils.injectTempVar(state);
utils.append('(' + tempVar + ' = ', state);
process(traverse, node.callee.object, path, state);
utils.append(')', state);
if (node.callee.property.type === Syntax.Identifier) {
utils.append('.', state);
process(traverse, node.callee.property, path, state);
} else {
utils.append('[', state);
process(traverse, node.callee.property, path, state);
utils.append(']', state);
}
utils.append('.apply(' + tempVar, state);
} else {
// Input = max(1, 2, ...list)
// Output = max.apply(null, [1, 2].concat(list))
var needsToBeWrappedInParenthesis =
node.callee.type === Syntax.FunctionDeclaration ||
node.callee.type === Syntax.FunctionExpression;
if (needsToBeWrappedInParenthesis) {
utils.append('(', state);
}
process(traverse, node.callee, path, state);
if (needsToBeWrappedInParenthesis) {
utils.append(')', state);
}
utils.append('.apply(null', state);
}
utils.append(', ', state);
var args = node.arguments.slice();
var spread = args.pop();
if (args.length || node.type === Syntax.NewExpression) {
utils.append('[', state);
if (node.type === Syntax.NewExpression) {
utils.append('null' + (args.length ? ', ' : ''), state);
}
while (args.length) {
var arg = args.shift();
utils.move(arg.range[0], state);
traverse(arg, path, state);
if (args.length) {
utils.catchup(args[0].range[0], state);
} else {
utils.catchup(arg.range[1], state);
}
}
utils.append('].concat(', state);
process(traverse, spread.argument, path, state);
utils.append(')', state);
} else {
process(traverse, spread.argument, path, state);
}
utils.append(node.type === Syntax.NewExpression ? '))' : ')', state);
utils.move(node.range[1], state);
return false;
}
visitCallSpread.test = function(node, path, state) {
return (
(
node.type === Syntax.CallExpression ||
node.type === Syntax.NewExpression
) &&
node.arguments.length > 0 &&
node.arguments[node.arguments.length - 1].type === Syntax.SpreadElement
);
};
exports.visitorList = [
visitCallSpread
];
},{"../src/utils":23,"esprima-fb":9}],26:[function(_dereq_,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*jslint node:true*/
/**
* @typechecks
*/
'use strict';
var base62 = _dereq_('base62');
var Syntax = _dereq_('esprima-fb').Syntax;
var utils = _dereq_('../src/utils');
var reservedWordsHelper = _dereq_('./reserved-words-helper');
var declareIdentInLocalScope = utils.declareIdentInLocalScope;
var initScopeMetadata = utils.initScopeMetadata;
var SUPER_PROTO_IDENT_PREFIX = '____SuperProtoOf';
var _anonClassUUIDCounter = 0;
var _mungedSymbolMaps = {};
function resetSymbols() {
_anonClassUUIDCounter = 0;
_mungedSymbolMaps = {};
}
/**
* Used to generate a unique class for use with code-gens for anonymous class
* expressions.
*
* @param {object} state
* @return {string}
*/
function _generateAnonymousClassName(state) {
var mungeNamespace = state.mungeNamespace || '';
return '____Class' + mungeNamespace + base62.encode(_anonClassUUIDCounter++);
}
/**
* Given an identifier name, munge it using the current state's mungeNamespace.
*
* @param {string} identName
* @param {object} state
* @return {string}
*/
function _getMungedName(identName, state) {
var mungeNamespace = state.mungeNamespace;
var shouldMinify = state.g.opts.minify;
if (shouldMinify) {
if (!_mungedSymbolMaps[mungeNamespace]) {
_mungedSymbolMaps[mungeNamespace] = {
symbolMap: {},
identUUIDCounter: 0
};
}
var symbolMap = _mungedSymbolMaps[mungeNamespace].symbolMap;
if (!symbolMap[identName]) {
symbolMap[identName] =
base62.encode(_mungedSymbolMaps[mungeNamespace].identUUIDCounter++);
}
identName = symbolMap[identName];
}
return '$' + mungeNamespace + identName;
}
/**
* Extracts super class information from a class node.
*
* Information includes name of the super class and/or the expression string
* (if extending from an expression)
*
* @param {object} node
* @param {object} state
* @return {object}
*/
function _getSuperClassInfo(node, state) {
var ret = {
name: null,
expression: null
};
if (node.superClass) {
if (node.superClass.type === Syntax.Identifier) {
ret.name = node.superClass.name;
} else {
// Extension from an expression
ret.name = _generateAnonymousClassName(state);
ret.expression = state.g.source.substring(
node.superClass.range[0],
node.superClass.range[1]
);
}
}
return ret;
}
/**
* Used with .filter() to find the constructor method in a list of
* MethodDefinition nodes.
*
* @param {object} classElement
* @return {boolean}
*/
function _isConstructorMethod(classElement) {
return classElement.type === Syntax.MethodDefinition &&
classElement.key.type === Syntax.Identifier &&
classElement.key.name === 'constructor';
}
/**
* @param {object} node
* @param {object} state
* @return {boolean}
*/
function _shouldMungeIdentifier(node, state) {
return (
!!state.methodFuncNode &&
!utils.getDocblock(state).hasOwnProperty('preventMunge') &&
/^_(?!_)/.test(node.name)
);
}
/**
* @param {function} traverse
* @param {object} node
* @param {array} path
* @param {object} state
*/
function visitClassMethod(traverse, node, path, state) {
if (!state.g.opts.es5 && (node.kind === 'get' || node.kind === 'set')) {
throw new Error(
'This transform does not support ' + node.kind + 'ter methods for ES6 ' +
'classes. (line: ' + node.loc.start.line + ', col: ' +
node.loc.start.column + ')'
);
}
state = utils.updateState(state, {
methodNode: node
});
utils.catchup(node.range[0], state);
path.unshift(node);
traverse(node.value, path, state);
path.shift();
return false;
}
visitClassMethod.test = function(node, path, state) {
return node.type === Syntax.MethodDefinition;
};
/**
* @param {function} traverse
* @param {object} node
* @param {array} path
* @param {object} state
*/
function visitClassFunctionExpression(traverse, node, path, state) {
var methodNode = path[0];
var isGetter = methodNode.kind === 'get';
var isSetter = methodNode.kind === 'set';
state = utils.updateState(state, {
methodFuncNode: node
});
if (methodNode.key.name === 'constructor') {
utils.append('function ' + state.className, state);
} else {
var methodAccessorComputed = false;
var methodAccessor;
var prototypeOrStatic = methodNode["static"] ? '' : '.prototype';
var objectAccessor = state.className + prototypeOrStatic;
if (methodNode.key.type === Syntax.Identifier) {
// foo() {}
methodAccessor = methodNode.key.name;
if (_shouldMungeIdentifier(methodNode.key, state)) {
methodAccessor = _getMungedName(methodAccessor, state);
}
if (isGetter || isSetter) {
methodAccessor = JSON.stringify(methodAccessor);
} else if (reservedWordsHelper.isReservedWord(methodAccessor)) {
methodAccessorComputed = true;
methodAccessor = JSON.stringify(methodAccessor);
}
} else if (methodNode.key.type === Syntax.Literal) {
// 'foo bar'() {} | get 'foo bar'() {} | set 'foo bar'() {}
methodAccessor = JSON.stringify(methodNode.key.value);
methodAccessorComputed = true;
}
if (isSetter || isGetter) {
utils.append(
'Object.defineProperty(' +
objectAccessor + ',' +
methodAccessor + ',' +
'{configurable:true,' +
methodNode.kind + ':function',
state
);
} else {
if (state.g.opts.es3) {
if (methodAccessorComputed) {
methodAccessor = '[' + methodAccessor + ']';
} else {
methodAccessor = '.' + methodAccessor;
}
utils.append(
objectAccessor +
methodAccessor + '=function' + (node.generator ? '*' : ''),
state
);
} else {
if (!methodAccessorComputed) {
methodAccessor = JSON.stringify(methodAccessor);
}
utils.append(
'Object.defineProperty(' +
objectAccessor + ',' +
methodAccessor + ',' +
'{writable:true,configurable:true,' +
'value:function' + (node.generator ? '*' : ''),
state
);
}
}
}
utils.move(methodNode.key.range[1], state);
utils.append('(', state);
var params = node.params;
if (params.length > 0) {
utils.catchupNewlines(params[0].range[0], state);
for (var i = 0; i < params.length; i++) {
utils.catchup(node.params[i].range[0], state);
path.unshift(node);
traverse(params[i], path, state);
path.shift();
}
}
var closingParenPosition = utils.getNextSyntacticCharOffset(')', state);
utils.catchupWhiteSpace(closingParenPosition, state);
var openingBracketPosition = utils.getNextSyntacticCharOffset('{', state);
utils.catchup(openingBracketPosition + 1, state);
if (!state.scopeIsStrict) {
utils.append('"use strict";', state);
state = utils.updateState(state, {
scopeIsStrict: true
});
}
utils.move(node.body.range[0] + '{'.length, state);
path.unshift(node);
traverse(node.body, path, state);
path.shift();
utils.catchup(node.body.range[1], state);
if (methodNode.key.name !== 'constructor') {
if (isGetter || isSetter || !state.g.opts.es3) {
utils.append('})', state);
}
utils.append(';', state);
}
return false;
}
visitClassFunctionExpression.test = function(node, path, state) {
return node.type === Syntax.FunctionExpression
&& path[0].type === Syntax.MethodDefinition;
};
function visitClassMethodParam(traverse, node, path, state) {
var paramName = node.name;
if (_shouldMungeIdentifier(node, state)) {
paramName = _getMungedName(node.name, state);
}
utils.append(paramName, state);
utils.move(node.range[1], state);
}
visitClassMethodParam.test = function(node, path, state) {
if (!path[0] || !path[1]) {
return;
}
var parentFuncExpr = path[0];
var parentClassMethod = path[1];
return parentFuncExpr.type === Syntax.FunctionExpression
&& parentClassMethod.type === Syntax.MethodDefinition
&& node.type === Syntax.Identifier;
};
/**
* @param {function} traverse
* @param {object} node
* @param {array} path
* @param {object} state
*/
function _renderClassBody(traverse, node, path, state) {
var className = state.className;
var superClass = state.superClass;
// Set up prototype of constructor on same line as `extends` for line-number
// preservation. This relies on function-hoisting if a constructor function is
// defined in the class body.
if (superClass.name) {
// If the super class is an expression, we need to memoize the output of the
// expression into the generated class name variable and use that to refer
// to the super class going forward. Example:
//
// class Foo extends mixin(Bar, Baz) {}
// --transforms to--
// function Foo() {} var ____Class0Blah = mixin(Bar, Baz);
if (superClass.expression !== null) {
utils.append(
'var ' + superClass.name + '=' + superClass.expression + ';',
state
);
}
var keyName = superClass.name + '____Key';
var keyNameDeclarator = '';
if (!utils.identWithinLexicalScope(keyName, state)) {
keyNameDeclarator = 'var ';
declareIdentInLocalScope(keyName, initScopeMetadata(node), state);
}
utils.append(
'for(' + keyNameDeclarator + keyName + ' in ' + superClass.name + '){' +
'if(' + superClass.name + '.hasOwnProperty(' + keyName + ')){' +
className + '[' + keyName + ']=' +
superClass.name + '[' + keyName + '];' +
'}' +
'}',
state
);
var superProtoIdentStr = SUPER_PROTO_IDENT_PREFIX + superClass.name;
if (!utils.identWithinLexicalScope(superProtoIdentStr, state)) {
utils.append(
'var ' + superProtoIdentStr + '=' + superClass.name + '===null?' +
'null:' + superClass.name + '.prototype;',
state
);
declareIdentInLocalScope(superProtoIdentStr, initScopeMetadata(node), state);
}
utils.append(
className + '.prototype=Object.create(' + superProtoIdentStr + ');',
state
);
utils.append(
className + '.prototype.constructor=' + className + ';',
state
);
utils.append(
className + '.__superConstructor__=' + superClass.name + ';',
state
);
}
// If there's no constructor method specified in the class body, create an
// empty constructor function at the top (same line as the class keyword)
if (!node.body.body.filter(_isConstructorMethod).pop()) {
utils.append('function ' + className + '(){', state);
if (!state.scopeIsStrict) {
utils.append('"use strict";', state);
}
if (superClass.name) {
utils.append(
'if(' + superClass.name + '!==null){' +
superClass.name + '.apply(this,arguments);}',
state
);
}
utils.append('}', state);
}
utils.move(node.body.range[0] + '{'.length, state);
traverse(node.body, path, state);
utils.catchupWhiteSpace(node.range[1], state);
}
/**
* @param {function} traverse
* @param {object} node
* @param {array} path
* @param {object} state
*/
function visitClassDeclaration(traverse, node, path, state) {
var className = node.id.name;
var superClass = _getSuperClassInfo(node, state);
state = utils.updateState(state, {
mungeNamespace: className,
className: className,
superClass: superClass
});
_renderClassBody(traverse, node, path, state);
return false;
}
visitClassDeclaration.test = function(node, path, state) {
return node.type === Syntax.ClassDeclaration;
};
/**
* @param {function} traverse
* @param {object} node
* @param {array} path
* @param {object} state
*/
function visitClassExpression(traverse, node, path, state) {
var className = node.id && node.id.name || _generateAnonymousClassName(state);
var superClass = _getSuperClassInfo(node, state);
utils.append('(function(){', state);
state = utils.updateState(state, {
mungeNamespace: className,
className: className,
superClass: superClass
});
_renderClassBody(traverse, node, path, state);
utils.append('return ' + className + ';})()', state);
return false;
}
visitClassExpression.test = function(node, path, state) {
return node.type === Syntax.ClassExpression;
};
/**
* @param {function} traverse
* @param {object} node
* @param {array} path
* @param {object} state
*/
function visitPrivateIdentifier(traverse, node, path, state) {
utils.append(_getMungedName(node.name, state), state);
utils.move(node.range[1], state);
}
visitPrivateIdentifier.test = function(node, path, state) {
if (node.type === Syntax.Identifier && _shouldMungeIdentifier(node, state)) {
// Always munge non-computed properties of MemberExpressions
// (a la preventing access of properties of unowned objects)
if (path[0].type === Syntax.MemberExpression && path[0].object !== node
&& path[0].computed === false) {
return true;
}
// Always munge identifiers that were declared within the method function
// scope
if (utils.identWithinLexicalScope(node.name, state, state.methodFuncNode)) {
return true;
}
// Always munge private keys on object literals defined within a method's
// scope.
if (path[0].type === Syntax.Property
&& path[1].type === Syntax.ObjectExpression) {
return true;
}
// Always munge function parameters
if (path[0].type === Syntax.FunctionExpression
|| path[0].type === Syntax.FunctionDeclaration
|| path[0].type === Syntax.ArrowFunctionExpression) {
for (var i = 0; i < path[0].params.length; i++) {
if (path[0].params[i] === node) {
return true;
}
}
}
}
return false;
};
/**
* @param {function} traverse
* @param {object} node
* @param {array} path
* @param {object} state
*/
function visitSuperCallExpression(traverse, node, path, state) {
var superClassName = state.superClass.name;
if (node.callee.type === Syntax.Identifier) {
if (_isConstructorMethod(state.methodNode)) {
utils.append(superClassName + '.call(', state);
} else {
var protoProp = SUPER_PROTO_IDENT_PREFIX + superClassName;
if (state.methodNode.key.type === Syntax.Identifier) {
protoProp += '.' + state.methodNode.key.name;
} else if (state.methodNode.key.type === Syntax.Literal) {
protoProp += '[' + JSON.stringify(state.methodNode.key.value) + ']';
}
utils.append(protoProp + ".call(", state);
}
utils.move(node.callee.range[1], state);
} else if (node.callee.type === Syntax.MemberExpression) {
utils.append(SUPER_PROTO_IDENT_PREFIX + superClassName, state);
utils.move(node.callee.object.range[1], state);
if (node.callee.computed) {
// ["a" + "b"]
utils.catchup(node.callee.property.range[1] + ']'.length, state);
} else {
// .ab
utils.append('.' + node.callee.property.name, state);
}
utils.append('.call(', state);
utils.move(node.callee.range[1], state);
}
utils.append('this', state);
if (node.arguments.length > 0) {
utils.append(',', state);
utils.catchupWhiteSpace(node.arguments[0].range[0], state);
traverse(node.arguments, path, state);
}
utils.catchupWhiteSpace(node.range[1], state);
utils.append(')', state);
return false;
}
visitSuperCallExpression.test = function(node, path, state) {
if (state.superClass && node.type === Syntax.CallExpression) {
var callee = node.callee;
if (callee.type === Syntax.Identifier && callee.name === 'super'
|| callee.type == Syntax.MemberExpression
&& callee.object.name === 'super') {
return true;
}
}
return false;
};
/**
* @param {function} traverse
* @param {object} node
* @param {array} path
* @param {object} state
*/
function visitSuperMemberExpression(traverse, node, path, state) {
var superClassName = state.superClass.name;
utils.append(SUPER_PROTO_IDENT_PREFIX + superClassName, state);
utils.move(node.object.range[1], state);
}
visitSuperMemberExpression.test = function(node, path, state) {
return state.superClass
&& node.type === Syntax.MemberExpression
&& node.object.type === Syntax.Identifier
&& node.object.name === 'super';
};
exports.resetSymbols = resetSymbols;
exports.visitorList = [
visitClassDeclaration,
visitClassExpression,
visitClassFunctionExpression,
visitClassMethod,
visitClassMethodParam,
visitPrivateIdentifier,
visitSuperCallExpression,
visitSuperMemberExpression
];
},{"../src/utils":23,"./reserved-words-helper":34,"base62":10,"esprima-fb":9}],27:[function(_dereq_,module,exports){
/**
* Copyright 2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*global exports:true*/
/**
* Implements ES6 destructuring assignment and pattern matchng.
*
* function init({port, ip, coords: [x, y]}) {
* return (x && y) ? {id, port} : {ip};
* };
*
* function init($__0) {
* var
* port = $__0.port,
* ip = $__0.ip,
* $__1 = $__0.coords,
* x = $__1[0],
* y = $__1[1];
* return (x && y) ? {id, port} : {ip};
* }
*
* var x, {ip, port} = init({ip, port});
*
* var x, $__0 = init({ip, port}), ip = $__0.ip, port = $__0.port;
*
*/
var Syntax = _dereq_('esprima-fb').Syntax;
var utils = _dereq_('../src/utils');
var reservedWordsHelper = _dereq_('./reserved-words-helper');
var restParamVisitors = _dereq_('./es6-rest-param-visitors');
var restPropertyHelpers = _dereq_('./es7-rest-property-helpers');
// -------------------------------------------------------
// 1. Structured variable declarations.
//
// var [a, b] = [b, a];
// var {x, y} = {y, x};
// -------------------------------------------------------
function visitStructuredVariable(traverse, node, path, state) {
// Allocate new temp for the pattern.
utils.append(utils.getTempVar(state.localScope.tempVarIndex) + '=', state);
// Skip the pattern and assign the init to the temp.
utils.catchupWhiteSpace(node.init.range[0], state);
traverse(node.init, path, state);
utils.catchup(node.init.range[1], state);
// Render the destructured data.
utils.append(',' + getDestructuredComponents(node.id, state), state);
state.localScope.tempVarIndex++;
return false;
}
visitStructuredVariable.test = function(node, path, state) {
return node.type === Syntax.VariableDeclarator &&
isStructuredPattern(node.id);
};
function isStructuredPattern(node) {
return node.type === Syntax.ObjectPattern ||
node.type === Syntax.ArrayPattern;
}
// Main function which does actual recursive destructuring
// of nested complex structures.
function getDestructuredComponents(node, state) {
var tmpIndex = state.localScope.tempVarIndex;
var components = [];
var patternItems = getPatternItems(node);
for (var idx = 0; idx < patternItems.length; idx++) {
var item = patternItems[idx];
if (!item) {
continue;
}
if (item.type === Syntax.SpreadElement) {
// Spread/rest of an array.
// TODO(dmitrys): support spread in the middle of a pattern
// and also for function param patterns: [x, ...xs, y]
components.push(item.argument.name +
'=Array.prototype.slice.call(' +
utils.getTempVar(tmpIndex) + ',' + idx + ')'
);
continue;
}
if (item.type === Syntax.SpreadProperty) {
var restExpression = restPropertyHelpers.renderRestExpression(
utils.getTempVar(tmpIndex),
patternItems
);
components.push(item.argument.name + '=' + restExpression);
continue;
}
// Depending on pattern type (Array or Object), we get
// corresponding pattern item parts.
var accessor = getPatternItemAccessor(node, item, tmpIndex, idx);
var value = getPatternItemValue(node, item);
// TODO(dmitrys): implement default values: {x, y=5}
if (value.type === Syntax.Identifier) {
// Simple pattern item.
components.push(value.name + '=' + accessor);
} else {
// Complex sub-structure.
components.push(
utils.getTempVar(++state.localScope.tempVarIndex) + '=' + accessor +
',' + getDestructuredComponents(value, state)
);
}
}
return components.join(',');
}
function getPatternItems(node) {
return node.properties || node.elements;
}
function getPatternItemAccessor(node, patternItem, tmpIndex, idx) {
var tmpName = utils.getTempVar(tmpIndex);
if (node.type === Syntax.ObjectPattern) {
if (reservedWordsHelper.isReservedWord(patternItem.key.name)) {
return tmpName + '["' + patternItem.key.name + '"]';
} else if (patternItem.key.type === Syntax.Literal) {
return tmpName + '[' + JSON.stringify(patternItem.key.value) + ']';
} else if (patternItem.key.type === Syntax.Identifier) {
return tmpName + '.' + patternItem.key.name;
}
} else if (node.type === Syntax.ArrayPattern) {
return tmpName + '[' + idx + ']';
}
}
function getPatternItemValue(node, patternItem) {
return node.type === Syntax.ObjectPattern
? patternItem.value
: patternItem;
}
// -------------------------------------------------------
// 2. Assignment expression.
//
// [a, b] = [b, a];
// ({x, y} = {y, x});
// -------------------------------------------------------
function visitStructuredAssignment(traverse, node, path, state) {
var exprNode = node.expression;
utils.append('var ' + utils.getTempVar(state.localScope.tempVarIndex) + '=', state);
utils.catchupWhiteSpace(exprNode.right.range[0], state);
traverse(exprNode.right, path, state);
utils.catchup(exprNode.right.range[1], state);
utils.append(
';' + getDestructuredComponents(exprNode.left, state) + ';',
state
);
utils.catchupWhiteSpace(node.range[1], state);
state.localScope.tempVarIndex++;
return false;
}
visitStructuredAssignment.test = function(node, path, state) {
// We consider the expression statement rather than just assignment
// expression to cover case with object patters which should be
// wrapped in grouping operator: ({x, y} = {y, x});
return node.type === Syntax.ExpressionStatement &&
node.expression.type === Syntax.AssignmentExpression &&
isStructuredPattern(node.expression.left);
};
// -------------------------------------------------------
// 3. Structured parameter.
//
// function foo({x, y}) { ... }
// -------------------------------------------------------
function visitStructuredParameter(traverse, node, path, state) {
utils.append(utils.getTempVar(getParamIndex(node, path)), state);
utils.catchupWhiteSpace(node.range[1], state);
return true;
}
function getParamIndex(paramNode, path) {
var funcNode = path[0];
var tmpIndex = 0;
for (var k = 0; k < funcNode.params.length; k++) {
var param = funcNode.params[k];
if (param === paramNode) {
break;
}
if (isStructuredPattern(param)) {
tmpIndex++;
}
}
return tmpIndex;
}
visitStructuredParameter.test = function(node, path, state) {
return isStructuredPattern(node) && isFunctionNode(path[0]);
};
function isFunctionNode(node) {
return (node.type == Syntax.FunctionDeclaration ||
node.type == Syntax.FunctionExpression ||
node.type == Syntax.MethodDefinition ||
node.type == Syntax.ArrowFunctionExpression);
}
// -------------------------------------------------------
// 4. Function body for structured parameters.
//
// function foo({x, y}) { x; y; }
// -------------------------------------------------------
function visitFunctionBodyForStructuredParameter(traverse, node, path, state) {
var funcNode = path[0];
utils.catchup(funcNode.body.range[0] + 1, state);
renderDestructuredComponents(funcNode, state);
if (funcNode.rest) {
utils.append(
restParamVisitors.renderRestParamSetup(funcNode, state),
state
);
}
return true;
}
function renderDestructuredComponents(funcNode, state) {
var destructuredComponents = [];
for (var k = 0; k < funcNode.params.length; k++) {
var param = funcNode.params[k];
if (isStructuredPattern(param)) {
destructuredComponents.push(
getDestructuredComponents(param, state)
);
state.localScope.tempVarIndex++;
}
}
if (destructuredComponents.length) {
utils.append('var ' + destructuredComponents.join(',') + ';', state);
}
}
visitFunctionBodyForStructuredParameter.test = function(node, path, state) {
return node.type === Syntax.BlockStatement && isFunctionNode(path[0]);
};
exports.visitorList = [
visitStructuredVariable,
visitStructuredAssignment,
visitStructuredParameter,
visitFunctionBodyForStructuredParameter
];
exports.renderDestructuredComponents = renderDestructuredComponents;
},{"../src/utils":23,"./es6-rest-param-visitors":30,"./es7-rest-property-helpers":32,"./reserved-words-helper":34,"esprima-fb":9}],28:[function(_dereq_,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*jslint node:true*/
/**
* Desugars concise methods of objects to function expressions.
*
* var foo = {
* method(x, y) { ... }
* };
*
* var foo = {
* method: function(x, y) { ... }
* };
*
*/
var Syntax = _dereq_('esprima-fb').Syntax;
var utils = _dereq_('../src/utils');
var reservedWordsHelper = _dereq_('./reserved-words-helper');
function visitObjectConciseMethod(traverse, node, path, state) {
var isGenerator = node.value.generator;
if (isGenerator) {
utils.catchupWhiteSpace(node.range[0] + 1, state);
}
if (node.computed) { // [<expr>]() { ...}
utils.catchup(node.key.range[1] + 1, state);
} else if (reservedWordsHelper.isReservedWord(node.key.name)) {
utils.catchup(node.key.range[0], state);
utils.append('"', state);
utils.catchup(node.key.range[1], state);
utils.append('"', state);
}
utils.catchup(node.key.range[1], state);
utils.append(
':function' + (isGenerator ? '*' : ''),
state
);
path.unshift(node);
traverse(node.value, path, state);
path.shift();
return false;
}
visitObjectConciseMethod.test = function(node, path, state) {
return node.type === Syntax.Property &&
node.value.type === Syntax.FunctionExpression &&
node.method === true;
};
exports.visitorList = [
visitObjectConciseMethod
];
},{"../src/utils":23,"./reserved-words-helper":34,"esprima-fb":9}],29:[function(_dereq_,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*jslint node: true*/
/**
* Desugars ES6 Object Literal short notations into ES3 full notation.
*
* // Easier return values.
* function foo(x, y) {
* return {x, y}; // {x: x, y: y}
* };
*
* // Destructuring.
* function init({port, ip, coords: {x, y}}) { ... }
*
*/
var Syntax = _dereq_('esprima-fb').Syntax;
var utils = _dereq_('../src/utils');
/**
* @public
*/
function visitObjectLiteralShortNotation(traverse, node, path, state) {
utils.catchup(node.key.range[1], state);
utils.append(':' + node.key.name, state);
return false;
}
visitObjectLiteralShortNotation.test = function(node, path, state) {
return node.type === Syntax.Property &&
node.kind === 'init' &&
node.shorthand === true &&
path[0].type !== Syntax.ObjectPattern;
};
exports.visitorList = [
visitObjectLiteralShortNotation
];
},{"../src/utils":23,"esprima-fb":9}],30:[function(_dereq_,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*jslint node:true*/
/**
* Desugars ES6 rest parameters into an ES3 arguments array.
*
* function printf(template, ...args) {
* args.forEach(...);
* }
*
* We could use `Array.prototype.slice.call`, but that usage of arguments causes
* functions to be deoptimized in V8, so instead we use a for-loop.
*
* function printf(template) {
* for (var args = [], $__0 = 1, $__1 = arguments.length; $__0 < $__1; $__0++)
* args.push(arguments[$__0]);
* args.forEach(...);
* }
*
*/
var Syntax = _dereq_('esprima-fb').Syntax;
var utils = _dereq_('../src/utils');
function _nodeIsFunctionWithRestParam(node) {
return (node.type === Syntax.FunctionDeclaration
|| node.type === Syntax.FunctionExpression
|| node.type === Syntax.ArrowFunctionExpression)
&& node.rest;
}
function visitFunctionParamsWithRestParam(traverse, node, path, state) {
if (node.parametricType) {
utils.catchup(node.parametricType.range[0], state);
path.unshift(node);
traverse(node.parametricType, path, state);
path.shift();
}
// Render params.
if (node.params.length) {
path.unshift(node);
traverse(node.params, path, state);
path.shift();
} else {
// -3 is for ... of the rest.
utils.catchup(node.rest.range[0] - 3, state);
}
utils.catchupWhiteSpace(node.rest.range[1], state);
path.unshift(node);
traverse(node.body, path, state);
path.shift();
return false;
}
visitFunctionParamsWithRestParam.test = function(node, path, state) {
return _nodeIsFunctionWithRestParam(node);
};
function renderRestParamSetup(functionNode, state) {
var idx = state.localScope.tempVarIndex++;
var len = state.localScope.tempVarIndex++;
return 'for (var ' + functionNode.rest.name + '=[],' +
utils.getTempVar(idx) + '=' + functionNode.params.length + ',' +
utils.getTempVar(len) + '=arguments.length;' +
utils.getTempVar(idx) + '<' + utils.getTempVar(len) + ';' +
utils.getTempVar(idx) + '++) ' +
functionNode.rest.name + '.push(arguments[' + utils.getTempVar(idx) + ']);';
}
function visitFunctionBodyWithRestParam(traverse, node, path, state) {
utils.catchup(node.range[0] + 1, state);
var parentNode = path[0];
utils.append(renderRestParamSetup(parentNode, state), state);
return true;
}
visitFunctionBodyWithRestParam.test = function(node, path, state) {
return node.type === Syntax.BlockStatement
&& _nodeIsFunctionWithRestParam(path[0]);
};
exports.renderRestParamSetup = renderRestParamSetup;
exports.visitorList = [
visitFunctionParamsWithRestParam,
visitFunctionBodyWithRestParam
];
},{"../src/utils":23,"esprima-fb":9}],31:[function(_dereq_,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*jslint node:true*/
/**
* @typechecks
*/
'use strict';
var Syntax = _dereq_('esprima-fb').Syntax;
var utils = _dereq_('../src/utils');
/**
* http://people.mozilla.org/~jorendorff/es6-draft.html#sec-12.1.9
*/
function visitTemplateLiteral(traverse, node, path, state) {
var templateElements = node.quasis;
utils.append('(', state);
for (var ii = 0; ii < templateElements.length; ii++) {
var templateElement = templateElements[ii];
if (templateElement.value.raw !== '') {
utils.append(getCookedValue(templateElement), state);
if (!templateElement.tail) {
// + between element and substitution
utils.append(' + ', state);
}
// maintain line numbers
utils.move(templateElement.range[0], state);
utils.catchupNewlines(templateElement.range[1], state);
} else { // templateElement.value.raw === ''
// Concatenat adjacent substitutions, e.g. `${x}${y}`. Empty templates
// appear before the first and after the last element - nothing to add in
// those cases.
if (ii > 0 && !templateElement.tail) {
// + between substitution and substitution
utils.append(' + ', state);
}
}
utils.move(templateElement.range[1], state);
if (!templateElement.tail) {
var substitution = node.expressions[ii];
if (substitution.type === Syntax.Identifier ||
substitution.type === Syntax.MemberExpression ||
substitution.type === Syntax.CallExpression) {
utils.catchup(substitution.range[1], state);
} else {
utils.append('(', state);
traverse(substitution, path, state);
utils.catchup(substitution.range[1], state);
utils.append(')', state);
}
// if next templateElement isn't empty...
if (templateElements[ii + 1].value.cooked !== '') {
utils.append(' + ', state);
}
}
}
utils.move(node.range[1], state);
utils.append(')', state);
return false;
}
visitTemplateLiteral.test = function(node, path, state) {
return node.type === Syntax.TemplateLiteral;
};
/**
* http://people.mozilla.org/~jorendorff/es6-draft.html#sec-12.2.6
*/
function visitTaggedTemplateExpression(traverse, node, path, state) {
var template = node.quasi;
var numQuasis = template.quasis.length;
// print the tag
utils.move(node.tag.range[0], state);
traverse(node.tag, path, state);
utils.catchup(node.tag.range[1], state);
// print array of template elements
utils.append('(function() { var siteObj = [', state);
for (var ii = 0; ii < numQuasis; ii++) {
utils.append(getCookedValue(template.quasis[ii]), state);
if (ii !== numQuasis - 1) {
utils.append(', ', state);
}
}
utils.append(']; siteObj.raw = [', state);
for (ii = 0; ii < numQuasis; ii++) {
utils.append(getRawValue(template.quasis[ii]), state);
if (ii !== numQuasis - 1) {
utils.append(', ', state);
}
}
utils.append(
']; Object.freeze(siteObj.raw); Object.freeze(siteObj); return siteObj; }()',
state
);
// print substitutions
if (numQuasis > 1) {
for (ii = 0; ii < template.expressions.length; ii++) {
var expression = template.expressions[ii];
utils.append(', ', state);
// maintain line numbers by calling catchupWhiteSpace over the whole
// previous TemplateElement
utils.move(template.quasis[ii].range[0], state);
utils.catchupNewlines(template.quasis[ii].range[1], state);
utils.move(expression.range[0], state);
traverse(expression, path, state);
utils.catchup(expression.range[1], state);
}
}
// print blank lines to push the closing ) down to account for the final
// TemplateElement.
utils.catchupNewlines(node.range[1], state);
utils.append(')', state);
return false;
}
visitTaggedTemplateExpression.test = function(node, path, state) {
return node.type === Syntax.TaggedTemplateExpression;
};
function getCookedValue(templateElement) {
return JSON.stringify(templateElement.value.cooked);
}
function getRawValue(templateElement) {
return JSON.stringify(templateElement.value.raw);
}
exports.visitorList = [
visitTemplateLiteral,
visitTaggedTemplateExpression
];
},{"../src/utils":23,"esprima-fb":9}],32:[function(_dereq_,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*jslint node:true*/
/**
* Desugars ES7 rest properties into ES5 object iteration.
*/
var Syntax = _dereq_('esprima-fb').Syntax;
// TODO: This is a pretty massive helper, it should only be defined once, in the
// transform's runtime environment. We don't currently have a runtime though.
var restFunction =
'(function(source, exclusion) {' +
'var rest = {};' +
'var hasOwn = Object.prototype.hasOwnProperty;' +
'if (source == null) {' +
'throw new TypeError();' +
'}' +
'for (var key in source) {' +
'if (hasOwn.call(source, key) && !hasOwn.call(exclusion, key)) {' +
'rest[key] = source[key];' +
'}' +
'}' +
'return rest;' +
'})';
function getPropertyNames(properties) {
var names = [];
for (var i = 0; i < properties.length; i++) {
var property = properties[i];
if (property.type === Syntax.SpreadProperty) {
continue;
}
if (property.type === Syntax.Identifier) {
names.push(property.name);
} else {
names.push(property.key.name);
}
}
return names;
}
function getRestFunctionCall(source, exclusion) {
return restFunction + '(' + source + ',' + exclusion + ')';
}
function getSimpleShallowCopy(accessorExpression) {
// This could be faster with 'Object.assign({}, ' + accessorExpression + ')'
// but to unify code paths and avoid a ES6 dependency we use the same
// helper as for the exclusion case.
return getRestFunctionCall(accessorExpression, '{}');
}
function renderRestExpression(accessorExpression, excludedProperties) {
var excludedNames = getPropertyNames(excludedProperties);
if (!excludedNames.length) {
return getSimpleShallowCopy(accessorExpression);
}
return getRestFunctionCall(
accessorExpression,
'{' + excludedNames.join(':1,') + ':1}'
);
}
exports.renderRestExpression = renderRestExpression;
},{"esprima-fb":9}],33:[function(_dereq_,module,exports){
/**
* Copyright 2004-present Facebook. All Rights Reserved.
*/
/*global exports:true*/
/**
* Implements ES7 object spread property.
* https://gist.github.com/sebmarkbage/aa849c7973cb4452c547
*
* { ...a, x: 1 }
*
* Object.assign({}, a, {x: 1 })
*
*/
var Syntax = _dereq_('esprima-fb').Syntax;
var utils = _dereq_('../src/utils');
function visitObjectLiteralSpread(traverse, node, path, state) {
utils.catchup(node.range[0], state);
utils.append('Object.assign({', state);
// Skip the original {
utils.move(node.range[0] + 1, state);
var previousWasSpread = false;
for (var i = 0; i < node.properties.length; i++) {
var property = node.properties[i];
if (property.type === Syntax.SpreadProperty) {
// Close the previous object or initial object
if (!previousWasSpread) {
utils.append('}', state);
}
if (i === 0) {
// Normally there will be a comma when we catch up, but not before
// the first property.
utils.append(',', state);
}
utils.catchup(property.range[0], state);
// skip ...
utils.move(property.range[0] + 3, state);
traverse(property.argument, path, state);
utils.catchup(property.range[1], state);
previousWasSpread = true;
} else {
utils.catchup(property.range[0], state);
if (previousWasSpread) {
utils.append('{', state);
}
traverse(property, path, state);
utils.catchup(property.range[1], state);
previousWasSpread = false;
}
}
// Strip any non-whitespace between the last item and the end.
// We only catch up on whitespace so that we ignore any trailing commas which
// are stripped out for IE8 support. Unfortunately, this also strips out any
// trailing comments.
utils.catchupWhiteSpace(node.range[1] - 1, state);
// Skip the trailing }
utils.move(node.range[1], state);
if (!previousWasSpread) {
utils.append('}', state);
}
utils.append(')', state);
return false;
}
visitObjectLiteralSpread.test = function(node, path, state) {
if (node.type !== Syntax.ObjectExpression) {
return false;
}
// Tight loop optimization
var hasAtLeastOneSpreadProperty = false;
for (var i = 0; i < node.properties.length; i++) {
var property = node.properties[i];
if (property.type === Syntax.SpreadProperty) {
hasAtLeastOneSpreadProperty = true;
} else if (property.kind !== 'init') {
return false;
}
}
return hasAtLeastOneSpreadProperty;
};
exports.visitorList = [
visitObjectLiteralSpread
];
},{"../src/utils":23,"esprima-fb":9}],34:[function(_dereq_,module,exports){
/**
* Copyright 2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var KEYWORDS = [
'break', 'do', 'in', 'typeof', 'case', 'else', 'instanceof', 'var', 'catch',
'export', 'new', 'void', 'class', 'extends', 'return', 'while', 'const',
'finally', 'super', 'with', 'continue', 'for', 'switch', 'yield', 'debugger',
'function', 'this', 'default', 'if', 'throw', 'delete', 'import', 'try'
];
var FUTURE_RESERVED_WORDS = [
'enum', 'await', 'implements', 'package', 'protected', 'static', 'interface',
'private', 'public'
];
var LITERALS = [
'null',
'true',
'false'
];
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reserved-words
var RESERVED_WORDS = [].concat(
KEYWORDS,
FUTURE_RESERVED_WORDS,
LITERALS
);
var reservedWordsMap = Object.create(null);
RESERVED_WORDS.forEach(function(k) {
reservedWordsMap[k] = true;
});
/**
* This list should not grow as new reserved words are introdued. This list is
* of words that need to be quoted because ES3-ish browsers do not allow their
* use as identifier names.
*/
var ES3_FUTURE_RESERVED_WORDS = [
'enum', 'implements', 'package', 'protected', 'static', 'interface',
'private', 'public'
];
var ES3_RESERVED_WORDS = [].concat(
KEYWORDS,
ES3_FUTURE_RESERVED_WORDS,
LITERALS
);
var es3ReservedWordsMap = Object.create(null);
ES3_RESERVED_WORDS.forEach(function(k) {
es3ReservedWordsMap[k] = true;
});
exports.isReservedWord = function(word) {
return !!reservedWordsMap[word];
};
exports.isES3ReservedWord = function(word) {
return !!es3ReservedWordsMap[word];
};
},{}],35:[function(_dereq_,module,exports){
/**
* Copyright 2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
/*global exports:true*/
var Syntax = _dereq_('esprima-fb').Syntax;
var utils = _dereq_('../src/utils');
var reserverdWordsHelper = _dereq_('./reserved-words-helper');
/**
* Code adapted from https://github.com/spicyj/es3ify
* The MIT License (MIT)
* Copyright (c) 2014 Ben Alpert
*/
function visitProperty(traverse, node, path, state) {
utils.catchup(node.key.range[0], state);
utils.append('"', state);
utils.catchup(node.key.range[1], state);
utils.append('"', state);
utils.catchup(node.value.range[0], state);
traverse(node.value, path, state);
return false;
}
visitProperty.test = function(node) {
return node.type === Syntax.Property &&
node.key.type === Syntax.Identifier &&
!node.method &&
!node.shorthand &&
!node.computed &&
reserverdWordsHelper.isES3ReservedWord(node.key.name);
};
function visitMemberExpression(traverse, node, path, state) {
traverse(node.object, path, state);
utils.catchup(node.property.range[0] - 1, state);
utils.append('[', state);
utils.catchupWhiteSpace(node.property.range[0], state);
utils.append('"', state);
utils.catchup(node.property.range[1], state);
utils.append('"]', state);
return false;
}
visitMemberExpression.test = function(node) {
return node.type === Syntax.MemberExpression &&
node.property.type === Syntax.Identifier &&
reserverdWordsHelper.isES3ReservedWord(node.property.name);
};
exports.visitorList = [
visitProperty,
visitMemberExpression
];
},{"../src/utils":23,"./reserved-words-helper":34,"esprima-fb":9}],36:[function(_dereq_,module,exports){
var esprima = _dereq_('esprima-fb');
var utils = _dereq_('../src/utils');
var Syntax = esprima.Syntax;
function _isFunctionNode(node) {
return node.type === Syntax.FunctionDeclaration
|| node.type === Syntax.FunctionExpression
|| node.type === Syntax.ArrowFunctionExpression;
}
function visitClassProperty(traverse, node, path, state) {
utils.catchup(node.range[0], state);
utils.catchupWhiteOut(node.range[1], state);
return false;
}
visitClassProperty.test = function(node, path, state) {
return node.type === Syntax.ClassProperty;
};
function visitTypeAlias(traverse, node, path, state) {
utils.catchupWhiteOut(node.range[1], state);
return false;
}
visitTypeAlias.test = function(node, path, state) {
return node.type === Syntax.TypeAlias;
};
function visitTypeCast(traverse, node, path, state) {
path.unshift(node);
traverse(node.expression, path, state);
path.shift();
utils.catchup(node.typeAnnotation.range[0], state);
utils.catchupWhiteOut(node.typeAnnotation.range[1], state);
return false;
}
visitTypeCast.test = function(node, path, state) {
return node.type === Syntax.TypeCastExpression;
};
function visitInterfaceDeclaration(traverse, node, path, state) {
utils.catchupWhiteOut(node.range[1], state);
return false;
}
visitInterfaceDeclaration.test = function(node, path, state) {
return node.type === Syntax.InterfaceDeclaration;
};
function visitDeclare(traverse, node, path, state) {
utils.catchupWhiteOut(node.range[1], state);
return false;
}
visitDeclare.test = function(node, path, state) {
switch (node.type) {
case Syntax.DeclareVariable:
case Syntax.DeclareFunction:
case Syntax.DeclareClass:
case Syntax.DeclareModule:
return true;
}
return false;
};
function visitFunctionParametricAnnotation(traverse, node, path, state) {
utils.catchup(node.range[0], state);
utils.catchupWhiteOut(node.range[1], state);
return false;
}
visitFunctionParametricAnnotation.test = function(node, path, state) {
return node.type === Syntax.TypeParameterDeclaration
&& path[0]
&& _isFunctionNode(path[0])
&& node === path[0].typeParameters;
};
function visitFunctionReturnAnnotation(traverse, node, path, state) {
utils.catchup(node.range[0], state);
utils.catchupWhiteOut(node.range[1], state);
return false;
}
visitFunctionReturnAnnotation.test = function(node, path, state) {
return path[0] && _isFunctionNode(path[0]) && node === path[0].returnType;
};
function visitOptionalFunctionParameterAnnotation(traverse, node, path, state) {
utils.catchup(node.range[0] + node.name.length, state);
utils.catchupWhiteOut(node.range[1], state);
return false;
}
visitOptionalFunctionParameterAnnotation.test = function(node, path, state) {
return node.type === Syntax.Identifier
&& node.optional
&& path[0]
&& _isFunctionNode(path[0]);
};
function visitTypeAnnotatedIdentifier(traverse, node, path, state) {
utils.catchup(node.typeAnnotation.range[0], state);
utils.catchupWhiteOut(node.typeAnnotation.range[1], state);
return false;
}
visitTypeAnnotatedIdentifier.test = function(node, path, state) {
return node.type === Syntax.Identifier && node.typeAnnotation;
};
function visitTypeAnnotatedObjectOrArrayPattern(traverse, node, path, state) {
utils.catchup(node.typeAnnotation.range[0], state);
utils.catchupWhiteOut(node.typeAnnotation.range[1], state);
return false;
}
visitTypeAnnotatedObjectOrArrayPattern.test = function(node, path, state) {
var rightType = node.type === Syntax.ObjectPattern
|| node.type === Syntax.ArrayPattern;
return rightType && node.typeAnnotation;
};
/**
* Methods cause trouble, since esprima parses them as a key/value pair, where
* the location of the value starts at the method body. For example
* { bar(x:number,...y:Array<number>):number {} }
* is parsed as
* { bar: function(x: number, ...y:Array<number>): number {} }
* except that the location of the FunctionExpression value is 40-something,
* which is the location of the function body. This means that by the time we
* visit the params, rest param, and return type organically, we've already
* catchup()'d passed them.
*/
function visitMethod(traverse, node, path, state) {
path.unshift(node);
traverse(node.key, path, state);
path.unshift(node.value);
traverse(node.value.params, path, state);
node.value.rest && traverse(node.value.rest, path, state);
node.value.returnType && traverse(node.value.returnType, path, state);
traverse(node.value.body, path, state);
path.shift();
path.shift();
return false;
}
visitMethod.test = function(node, path, state) {
return (node.type === "Property" && (node.method || node.kind === "set" || node.kind === "get"))
|| (node.type === "MethodDefinition");
};
function visitImportType(traverse, node, path, state) {
utils.catchupWhiteOut(node.range[1], state);
return false;
}
visitImportType.test = function(node, path, state) {
return node.type === 'ImportDeclaration'
&& node.isType;
};
exports.visitorList = [
visitClassProperty,
visitDeclare,
visitImportType,
visitInterfaceDeclaration,
visitFunctionParametricAnnotation,
visitFunctionReturnAnnotation,
visitMethod,
visitOptionalFunctionParameterAnnotation,
visitTypeAlias,
visitTypeCast,
visitTypeAnnotatedIdentifier,
visitTypeAnnotatedObjectOrArrayPattern
];
},{"../src/utils":23,"esprima-fb":9}],37:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
/*global exports:true*/
'use strict';
var Syntax = _dereq_('jstransform').Syntax;
var utils = _dereq_('jstransform/src/utils');
function renderJSXLiteral(object, isLast, state, start, end) {
var lines = object.value.split(/\r\n|\n|\r/);
if (start) {
utils.append(start, state);
}
var lastNonEmptyLine = 0;
lines.forEach(function(line, index) {
if (line.match(/[^ \t]/)) {
lastNonEmptyLine = index;
}
});
lines.forEach(function(line, index) {
var isFirstLine = index === 0;
var isLastLine = index === lines.length - 1;
var isLastNonEmptyLine = index === lastNonEmptyLine;
// replace rendered whitespace tabs with spaces
var trimmedLine = line.replace(/\t/g, ' ');
// trim whitespace touching a newline
if (!isFirstLine) {
trimmedLine = trimmedLine.replace(/^[ ]+/, '');
}
if (!isLastLine) {
trimmedLine = trimmedLine.replace(/[ ]+$/, '');
}
if (!isFirstLine) {
utils.append(line.match(/^[ \t]*/)[0], state);
}
if (trimmedLine || isLastNonEmptyLine) {
utils.append(
JSON.stringify(trimmedLine) +
(!isLastNonEmptyLine ? ' + \' \' +' : ''),
state);
if (isLastNonEmptyLine) {
if (end) {
utils.append(end, state);
}
if (!isLast) {
utils.append(', ', state);
}
}
// only restore tail whitespace if line had literals
if (trimmedLine && !isLastLine) {
utils.append(line.match(/[ \t]*$/)[0], state);
}
}
if (!isLastLine) {
utils.append('\n', state);
}
});
utils.move(object.range[1], state);
}
function renderJSXExpressionContainer(traverse, object, isLast, path, state) {
// Plus 1 to skip `{`.
utils.move(object.range[0] + 1, state);
utils.catchup(object.expression.range[0], state);
traverse(object.expression, path, state);
if (!isLast && object.expression.type !== Syntax.JSXEmptyExpression) {
// If we need to append a comma, make sure to do so after the expression.
utils.catchup(object.expression.range[1], state, trimLeft);
utils.append(', ', state);
}
// Minus 1 to skip `}`.
utils.catchup(object.range[1] - 1, state, trimLeft);
utils.move(object.range[1], state);
return false;
}
function quoteAttrName(attr) {
// Quote invalid JS identifiers.
if (!/^[a-z_$][a-z\d_$]*$/i.test(attr)) {
return '"' + attr + '"';
}
return attr;
}
function trimLeft(value) {
return value.replace(/^[ ]+/, '');
}
exports.renderJSXExpressionContainer = renderJSXExpressionContainer;
exports.renderJSXLiteral = renderJSXLiteral;
exports.quoteAttrName = quoteAttrName;
exports.trimLeft = trimLeft;
},{"jstransform":22,"jstransform/src/utils":23}],38:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
/*global exports:true*/
'use strict';
var Syntax = _dereq_('jstransform').Syntax;
var utils = _dereq_('jstransform/src/utils');
var renderJSXExpressionContainer =
_dereq_('./jsx').renderJSXExpressionContainer;
var renderJSXLiteral = _dereq_('./jsx').renderJSXLiteral;
var quoteAttrName = _dereq_('./jsx').quoteAttrName;
var trimLeft = _dereq_('./jsx').trimLeft;
/**
* Customized desugar processor for React JSX. Currently:
*
* <X> </X> => React.createElement(X, null)
* <X prop="1" /> => React.createElement(X, {prop: '1'}, null)
* <X prop="2"><Y /></X> => React.createElement(X, {prop:'2'},
* React.createElement(Y, null)
* )
* <div /> => React.createElement("div", null)
*/
/**
* Removes all non-whitespace/parenthesis characters
*/
var reNonWhiteParen = /([^\s\(\)])/g;
function stripNonWhiteParen(value) {
return value.replace(reNonWhiteParen, '');
}
var tagConvention = /^[a-z]|\-/;
function isTagName(name) {
return tagConvention.test(name);
}
function visitReactTag(traverse, object, path, state) {
var openingElement = object.openingElement;
var nameObject = openingElement.name;
var attributesObject = openingElement.attributes;
utils.catchup(openingElement.range[0], state, trimLeft);
if (nameObject.type === Syntax.JSXNamespacedName && nameObject.namespace) {
throw new Error('Namespace tags are not supported. ReactJSX is not XML.');
}
// We assume that the React runtime is already in scope
utils.append('React.createElement(', state);
if (nameObject.type === Syntax.JSXIdentifier && isTagName(nameObject.name)) {
utils.append('"' + nameObject.name + '"', state);
utils.move(nameObject.range[1], state);
} else {
// Use utils.catchup in this case so we can easily handle
// JSXMemberExpressions which look like Foo.Bar.Baz. This also handles
// JSXIdentifiers that aren't fallback tags.
utils.move(nameObject.range[0], state);
utils.catchup(nameObject.range[1], state);
}
utils.append(', ', state);
var hasAttributes = attributesObject.length;
var hasAtLeastOneSpreadProperty = attributesObject.some(function(attr) {
return attr.type === Syntax.JSXSpreadAttribute;
});
// if we don't have any attributes, pass in null
if (hasAtLeastOneSpreadProperty) {
utils.append('React.__spread({', state);
} else if (hasAttributes) {
utils.append('{', state);
} else {
utils.append('null', state);
}
// keep track of if the previous attribute was a spread attribute
var previousWasSpread = false;
// write attributes
attributesObject.forEach(function(attr, index) {
var isLast = index === attributesObject.length - 1;
if (attr.type === Syntax.JSXSpreadAttribute) {
// Close the previous object or initial object
if (!previousWasSpread) {
utils.append('}, ', state);
}
// Move to the expression start, ignoring everything except parenthesis
// and whitespace.
utils.catchup(attr.range[0], state, stripNonWhiteParen);
// Plus 1 to skip `{`.
utils.move(attr.range[0] + 1, state);
utils.catchup(attr.argument.range[0], state, stripNonWhiteParen);
traverse(attr.argument, path, state);
utils.catchup(attr.argument.range[1], state);
// Move to the end, ignoring parenthesis and the closing `}`
utils.catchup(attr.range[1] - 1, state, stripNonWhiteParen);
if (!isLast) {
utils.append(', ', state);
}
utils.move(attr.range[1], state);
previousWasSpread = true;
return;
}
// If the next attribute is a spread, we're effective last in this object
if (!isLast) {
isLast = attributesObject[index + 1].type === Syntax.JSXSpreadAttribute;
}
if (attr.name.namespace) {
throw new Error(
'Namespace attributes are not supported. ReactJSX is not XML.');
}
var name = attr.name.name;
utils.catchup(attr.range[0], state, trimLeft);
if (previousWasSpread) {
utils.append('{', state);
}
utils.append(quoteAttrName(name), state);
utils.append(': ', state);
if (!attr.value) {
state.g.buffer += 'true';
state.g.position = attr.name.range[1];
if (!isLast) {
utils.append(', ', state);
}
} else {
utils.move(attr.name.range[1], state);
// Use catchupNewlines to skip over the '=' in the attribute
utils.catchupNewlines(attr.value.range[0], state);
if (attr.value.type === Syntax.Literal) {
renderJSXLiteral(attr.value, isLast, state);
} else {
renderJSXExpressionContainer(traverse, attr.value, isLast, path, state);
}
}
utils.catchup(attr.range[1], state, trimLeft);
previousWasSpread = false;
});
if (!openingElement.selfClosing) {
utils.catchup(openingElement.range[1] - 1, state, trimLeft);
utils.move(openingElement.range[1], state);
}
if (hasAttributes && !previousWasSpread) {
utils.append('}', state);
}
if (hasAtLeastOneSpreadProperty) {
utils.append(')', state);
}
// filter out whitespace
var childrenToRender = object.children.filter(function(child) {
return !(child.type === Syntax.Literal
&& typeof child.value === 'string'
&& child.value.match(/^[ \t]*[\r\n][ \t\r\n]*$/));
});
if (childrenToRender.length > 0) {
var lastRenderableIndex;
childrenToRender.forEach(function(child, index) {
if (child.type !== Syntax.JSXExpressionContainer ||
child.expression.type !== Syntax.JSXEmptyExpression) {
lastRenderableIndex = index;
}
});
if (lastRenderableIndex !== undefined) {
utils.append(', ', state);
}
childrenToRender.forEach(function(child, index) {
utils.catchup(child.range[0], state, trimLeft);
var isLast = index >= lastRenderableIndex;
if (child.type === Syntax.Literal) {
renderJSXLiteral(child, isLast, state);
} else if (child.type === Syntax.JSXExpressionContainer) {
renderJSXExpressionContainer(traverse, child, isLast, path, state);
} else {
traverse(child, path, state);
if (!isLast) {
utils.append(', ', state);
}
}
utils.catchup(child.range[1], state, trimLeft);
});
}
if (openingElement.selfClosing) {
// everything up to />
utils.catchup(openingElement.range[1] - 2, state, trimLeft);
utils.move(openingElement.range[1], state);
} else {
// everything up to </ sdflksjfd>
utils.catchup(object.closingElement.range[0], state, trimLeft);
utils.move(object.closingElement.range[1], state);
}
utils.append(')', state);
return false;
}
visitReactTag.test = function(object, path, state) {
return object.type === Syntax.JSXElement;
};
exports.visitorList = [
visitReactTag
];
},{"./jsx":37,"jstransform":22,"jstransform/src/utils":23}],39:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
/*global exports:true*/
'use strict';
var Syntax = _dereq_('jstransform').Syntax;
var utils = _dereq_('jstransform/src/utils');
function addDisplayName(displayName, object, state) {
if (object &&
object.type === Syntax.CallExpression &&
object.callee.type === Syntax.MemberExpression &&
object.callee.object.type === Syntax.Identifier &&
object.callee.object.name === 'React' &&
object.callee.property.type === Syntax.Identifier &&
object.callee.property.name === 'createClass' &&
object.arguments.length === 1 &&
object.arguments[0].type === Syntax.ObjectExpression) {
// Verify that the displayName property isn't already set
var properties = object.arguments[0].properties;
var safe = properties.every(function(property) {
var value = property.key.type === Syntax.Identifier ?
property.key.name :
property.key.value;
return value !== 'displayName';
});
if (safe) {
utils.catchup(object.arguments[0].range[0] + 1, state);
utils.append('displayName: "' + displayName + '",', state);
}
}
}
/**
* Transforms the following:
*
* var MyComponent = React.createClass({
* render: ...
* });
*
* into:
*
* var MyComponent = React.createClass({
* displayName: 'MyComponent',
* render: ...
* });
*
* Also catches:
*
* MyComponent = React.createClass(...);
* exports.MyComponent = React.createClass(...);
* module.exports = {MyComponent: React.createClass(...)};
*/
function visitReactDisplayName(traverse, object, path, state) {
var left, right;
if (object.type === Syntax.AssignmentExpression) {
left = object.left;
right = object.right;
} else if (object.type === Syntax.Property) {
left = object.key;
right = object.value;
} else if (object.type === Syntax.VariableDeclarator) {
left = object.id;
right = object.init;
}
if (left && left.type === Syntax.MemberExpression) {
left = left.property;
}
if (left && left.type === Syntax.Identifier) {
addDisplayName(left.name, right, state);
}
}
visitReactDisplayName.test = function(object, path, state) {
return (
object.type === Syntax.AssignmentExpression ||
object.type === Syntax.Property ||
object.type === Syntax.VariableDeclarator
);
};
exports.visitorList = [
visitReactDisplayName
];
},{"jstransform":22,"jstransform/src/utils":23}],40:[function(_dereq_,module,exports){
/*global exports:true*/
'use strict';
var es6ArrowFunctions =
_dereq_('jstransform/visitors/es6-arrow-function-visitors');
var es6Classes = _dereq_('jstransform/visitors/es6-class-visitors');
var es6Destructuring =
_dereq_('jstransform/visitors/es6-destructuring-visitors');
var es6ObjectConciseMethod =
_dereq_('jstransform/visitors/es6-object-concise-method-visitors');
var es6ObjectShortNotation =
_dereq_('jstransform/visitors/es6-object-short-notation-visitors');
var es6RestParameters = _dereq_('jstransform/visitors/es6-rest-param-visitors');
var es6Templates = _dereq_('jstransform/visitors/es6-template-visitors');
var es6CallSpread =
_dereq_('jstransform/visitors/es6-call-spread-visitors');
var es7SpreadProperty =
_dereq_('jstransform/visitors/es7-spread-property-visitors');
var react = _dereq_('./transforms/react');
var reactDisplayName = _dereq_('./transforms/reactDisplayName');
var reservedWords = _dereq_('jstransform/visitors/reserved-words-visitors');
/**
* Map from transformName => orderedListOfVisitors.
*/
var transformVisitors = {
'es6-arrow-functions': es6ArrowFunctions.visitorList,
'es6-classes': es6Classes.visitorList,
'es6-destructuring': es6Destructuring.visitorList,
'es6-object-concise-method': es6ObjectConciseMethod.visitorList,
'es6-object-short-notation': es6ObjectShortNotation.visitorList,
'es6-rest-params': es6RestParameters.visitorList,
'es6-templates': es6Templates.visitorList,
'es6-call-spread': es6CallSpread.visitorList,
'es7-spread-property': es7SpreadProperty.visitorList,
'react': react.visitorList.concat(reactDisplayName.visitorList),
'reserved-words': reservedWords.visitorList
};
var transformSets = {
'harmony': [
'es6-arrow-functions',
'es6-object-concise-method',
'es6-object-short-notation',
'es6-classes',
'es6-rest-params',
'es6-templates',
'es6-destructuring',
'es6-call-spread',
'es7-spread-property'
],
'es3': [
'reserved-words'
],
'react': [
'react'
]
};
/**
* Specifies the order in which each transform should run.
*/
var transformRunOrder = [
'reserved-words',
'es6-arrow-functions',
'es6-object-concise-method',
'es6-object-short-notation',
'es6-classes',
'es6-rest-params',
'es6-templates',
'es6-destructuring',
'es6-call-spread',
'es7-spread-property',
'react'
];
/**
* Given a list of transform names, return the ordered list of visitors to be
* passed to the transform() function.
*
* @param {array?} excludes
* @return {array}
*/
function getAllVisitors(excludes) {
var ret = [];
for (var i = 0, il = transformRunOrder.length; i < il; i++) {
if (!excludes || excludes.indexOf(transformRunOrder[i]) === -1) {
ret = ret.concat(transformVisitors[transformRunOrder[i]]);
}
}
return ret;
}
/**
* Given a list of visitor set names, return the ordered list of visitors to be
* passed to jstransform.
*
* @param {array}
* @return {array}
*/
function getVisitorsBySet(sets) {
var visitorsToInclude = sets.reduce(function(visitors, set) {
if (!transformSets.hasOwnProperty(set)) {
throw new Error('Unknown visitor set: ' + set);
}
transformSets[set].forEach(function(visitor) {
visitors[visitor] = true;
});
return visitors;
}, {});
var visitorList = [];
for (var i = 0; i < transformRunOrder.length; i++) {
if (visitorsToInclude.hasOwnProperty(transformRunOrder[i])) {
visitorList = visitorList.concat(transformVisitors[transformRunOrder[i]]);
}
}
return visitorList;
}
exports.getVisitorsBySet = getVisitorsBySet;
exports.getAllVisitors = getAllVisitors;
exports.transformVisitors = transformVisitors;
},{"./transforms/react":38,"./transforms/reactDisplayName":39,"jstransform/visitors/es6-arrow-function-visitors":24,"jstransform/visitors/es6-call-spread-visitors":25,"jstransform/visitors/es6-class-visitors":26,"jstransform/visitors/es6-destructuring-visitors":27,"jstransform/visitors/es6-object-concise-method-visitors":28,"jstransform/visitors/es6-object-short-notation-visitors":29,"jstransform/visitors/es6-rest-param-visitors":30,"jstransform/visitors/es6-template-visitors":31,"jstransform/visitors/es7-spread-property-visitors":33,"jstransform/visitors/reserved-words-visitors":35}],41:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
'use strict';
/*eslint-disable no-undef*/
var Buffer = _dereq_('buffer').Buffer;
function inlineSourceMap(sourceMap, sourceCode, sourceFilename) {
// This can be used with a sourcemap that has already has toJSON called on it.
// Check first.
var json = sourceMap;
if (typeof sourceMap.toJSON === 'function') {
json = sourceMap.toJSON();
}
json.sources = [sourceFilename];
json.sourcesContent = [sourceCode];
var base64 = Buffer(JSON.stringify(json)).toString('base64');
return '//# sourceMappingURL=data:application/json;base64,' + base64;
}
module.exports = inlineSourceMap;
},{"buffer":3}]},{},[1])(1)
}); |
index.es6.js | hemanth/react-mui-base | 'use strict';
import React from 'react';
import {Styles} from 'material-ui';
import injectTapEventPlugin from 'react-tap-event-plugin';
injectTapEventPlugin();
let ThemeManager = new Styles.ThemeManager();
export default class BaseComponent extends React.Component {
constructor () {
super();
}
getChildContext() {
return {
muiTheme: ThemeManager.getCurrentTheme()
};
}
}
BaseComponent.childContextTypes = {
muiTheme: React.PropTypes.object
};
BaseComponent.contextTypes = {};
|
src/containers/RefreshContainer.js | TorinoMeteo/tm-realtime-map | import React from 'react'
import PropTypes from 'prop-types'
import { connect } from 'react-redux'
import RealtimeApi from 'api/realtime'
import moment from 'moment'
class Refresh extends React.Component {
static propTypes = {
onRefresh: PropTypes.func.isRequired
}
constructor () {
super()
this.interval = null
}
componentDidMount () {
if (this.interval) {
clearInterval(this.interval)
}
setInterval(() => {
this.props.onRefresh()
}, 3 * 60 * 1000)
}
render () {
return <div />
}
}
const mapStateToProps = (state) => {
return {
// these is not same images array as passed to overlay component
// the overlay one is sliced, but for the purpose of this prop
// it is the same (just len != 0 check)
images: state.radar.data.live,
status: state.map.live.radar
}
}
const mapDispatchToProps = (dispatch) => {
return {
onRefresh: () => {
dispatch(RealtimeApi.actions.realtimeData())
let now = moment()
dispatch(RealtimeApi.actions.liveRadarImages({
year: now.format('Y'),
month: now.format('M'),
day: now.format('D')
}))
}
}
}
export default connect(
mapStateToProps,
mapDispatchToProps
)(Refresh)
|
src/svg-icons/toggle/radio-button-unchecked.js | frnk94/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ToggleRadioButtonUnchecked = (props) => (
<SvgIcon {...props}>
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"/>
</SvgIcon>
);
ToggleRadioButtonUnchecked = pure(ToggleRadioButtonUnchecked);
ToggleRadioButtonUnchecked.displayName = 'ToggleRadioButtonUnchecked';
ToggleRadioButtonUnchecked.muiName = 'SvgIcon';
export default ToggleRadioButtonUnchecked;
|
ajax/libs/elfinder/2.1.6/js/i18n/elfinder.nl.js | dada0423/cdnjs | /**
* Dutch translation
* @author Barry vd. Heuvel <barry@fruitcakestudio.nl>
* @version 2015-12-01
*/
if (elFinder && elFinder.prototype && typeof(elFinder.prototype.i18) == 'object') {
elFinder.prototype.i18.nl = {
translator : 'Barry vd. Heuvel <barry@fruitcakestudio.nl>',
language : 'Nederlands',
direction : 'ltr',
dateFormat : 'd-m-Y H:i', // Mar 13, 2012 05:27 PM
fancyDateFormat : '$1 H:i', // will produce smth like: Today 12:25 PM
messages : {
/********************************** errors **********************************/
'error' : 'Fout',
'errUnknown' : 'Onbekend fout.',
'errUnknownCmd' : 'Onbekend commando.',
'errJqui' : 'Ongeldige jQuery UI configuratie. Selectable, draggable en droppable componenten moeten aanwezig zijn.',
'errNode' : 'Voor elFinder moet een DOM Element gemaakt worden.',
'errURL' : 'Ongeldige elFinder configuratie! URL optie is niet ingesteld.',
'errAccess' : 'Toegang geweigerd.',
'errConnect' : 'Kan geen verbinding met de backend maken.',
'errAbort' : 'Verbinding afgebroken.',
'errTimeout' : 'Verbinding time-out.',
'errNotFound' : 'Backend niet gevonden.',
'errResponse' : 'Ongeldige reactie van de backend.',
'errConf' : 'Ongeldige backend configuratie.',
'errJSON' : 'PHP JSON module niet geïnstalleerd.',
'errNoVolumes' : 'Leesbaar volume is niet beschikbaar.',
'errCmdParams' : 'Ongeldige parameters voor commando "$1".',
'errDataNotJSON' : 'Data is niet JSON.',
'errDataEmpty' : 'Data is leeg.',
'errCmdReq' : 'Backend verzoek heeft een commando naam nodig.',
'errOpen' : 'Kan "$1" niet openen.',
'errNotFolder' : 'Object is geen map.',
'errNotFile' : 'Object is geen bestand.',
'errRead' : 'Kan "$1" niet lezen.',
'errWrite' : 'Kan niet schrijven in "$1".',
'errPerm' : 'Toegang geweigerd.',
'errLocked' : '"$1" is vergrendeld en kan niet hernoemd, verplaats of verwijderd worden.',
'errExists' : 'Bestand "$1" bestaat al.',
'errInvName' : 'Ongeldige bestandsnaam.',
'errFolderNotFound' : 'Map niet gevonden.',
'errFileNotFound' : 'Bestand niet gevonden.',
'errTrgFolderNotFound' : 'Doelmap"$1" niet gevonden.',
'errPopup' : 'De browser heeft voorkomen dat de pop-up is geopend. Pas de browser instellingen aan om de popup te kunnen openen.',
'errMkdir' : 'Kan map "$1" niet aanmaken.',
'errMkfile' : 'Kan bestand "$1" niet aanmaken.',
'errRename' : 'Kan "$1" niet hernoemen.',
'errCopyFrom' : 'Bestanden kopiëren van "$1" is niet toegestaan.',
'errCopyTo' : 'Bestanden kopiëren naar "$1" is niet toegestaan.',
'errMkOutLink' : 'Kan geen link maken buiten de hoofdmap.', // from v2.1 added 03.10.2015
'errUpload' : 'Upload fout.', // old name - errUploadCommon
'errUploadFile' : 'Kan "$1" niet uploaden.', // old name - errUpload
'errUploadNoFiles' : 'Geen bestanden gevonden om te uploaden.',
'errUploadTotalSize' : 'Data overschrijdt de maximale grootte.', // old name - errMaxSize
'errUploadFileSize' : 'Bestand overschrijdt de maximale grootte.', // old name - errFileMaxSize
'errUploadMime' : 'Bestandstype niet toegestaan.',
'errUploadTransfer' : '"$1" overdrachtsfout.',
'errUploadTemp' : 'Kan geen tijdelijk bestand voor de upload maken.', // from v2.1 added 26.09.2015
'errNotReplace' : 'Object "$1" bestaat al op deze locatie en kan niet vervangen worden door een ander type object.', // new
'errReplace' : 'Kan "$1" niet vervangen.',
'errSave' : 'Kan "$1" niet opslaan.',
'errCopy' : 'Kan "$1" niet kopiëren.',
'errMove' : 'Kan "$1" niet verplaatsen.',
'errCopyInItself' : 'Kan "$1" niet in zichzelf kopiëren.',
'errRm' : 'Kan "$1" niet verwijderen.',
'errRmSrc' : 'Kan bronbestanden niet verwijderen.',
'errExtract' : 'Kan de bestanden van "$1" niet uitpakken.',
'errArchive' : 'Kan het archief niet maken.',
'errArcType' : 'Archief type is niet ondersteund.',
'errNoArchive' : 'Bestand is geen archief of geen ondersteund archief type.',
'errCmdNoSupport' : 'Backend ondersteund dit commando niet.',
'errReplByChild' : 'De map "$1" kan niet vervangen worden door een item uit die map.',
'errArcSymlinks' : 'Om veiligheidsredenen kan een bestand met symlinks of bestanden met niet toegestane namen niet worden uitgepakt .', // edited 24.06.2012
'errArcMaxSize' : 'Archief overschrijdt de maximale bestandsgrootte.',
'errResize' : 'Kan het formaat van "$1" niet wijzigen.',
'errResizeDegree' : 'Ongeldig aantal graden om te draaien.', // added 7.3.2013
'errResizeRotate' : 'Afbeelding kan niet gedraaid worden.', // added 7.3.2013
'errResizeSize' : 'Ongeldig afbeelding formaat.', // added 7.3.2013
'errResizeNoChange' : 'Afbeelding formaat is niet veranderd.', // added 7.3.2013
'errUsupportType' : 'Bestandstype wordt niet ondersteund.',
'errNotUTF8Content' : 'Bestand "$1" is niet in UTF-8 and kan niet aangepast worden.', // added 9.11.2011
'errNetMount' : 'Kan "$1" niet mounten.', // added 17.04.2012
'errNetMountNoDriver' : 'Niet ondersteund protocol.', // added 17.04.2012
'errNetMountFailed' : 'Mount mislukt.', // added 17.04.2012
'errNetMountHostReq' : 'Host is verplicht.', // added 18.04.2012
'errSessionExpires' : 'Uw sessie is verlopen vanwege inactiviteit.',
'errCreatingTempDir' : 'Kan de tijdelijke map niet aanmaken: "$1" ',
'errFtpDownloadFile' : 'Kan het bestand niet downloaden vanaf FTP: "$1"',
'errFtpUploadFile' : 'Kan het bestand niet uploaden naar FTP: "$1"',
'errFtpMkdir' : 'Kan het externe map niet aanmaken op de FTP-server: "$1"',
'errArchiveExec' : 'Er is een fout opgetreden bij het archivering van de bestanden: "$1" ',
'errExtractExec' : 'Er is een fout opgetreden bij het uitpakken van de bestanden: "$1" ',
'errNetUnMount' : 'Kan niet unmounten', // from v2.1 added 30.04.2012
'errConvUTF8' : 'Kan niet converteren naar UTF-8', // from v2.1 added 08.04.2014
'errFolderUpload' : 'Probeer Google Chrome, als je de map wil uploaden.', // from v2.1 added 26.6.2015
/******************************* commands names ********************************/
'cmdarchive' : 'Maak archief',
'cmdback' : 'Vorige',
'cmdcopy' : 'Kopieer',
'cmdcut' : 'Knip',
'cmddownload' : 'Download',
'cmdduplicate' : 'Dupliceer',
'cmdedit' : 'Pas bestand aan',
'cmdextract' : 'Bestanden uit archief uitpakken',
'cmdforward' : 'Volgende',
'cmdgetfile' : 'Kies bestanden',
'cmdhelp' : 'Over deze software',
'cmdhome' : 'Home',
'cmdinfo' : 'Bekijk info',
'cmdmkdir' : 'Nieuwe map',
'cmdmkfile' : 'Nieuw tekstbestand',
'cmdopen' : 'Open',
'cmdpaste' : 'Plak',
'cmdquicklook' : 'Voorbeeld',
'cmdreload' : 'Vernieuwen',
'cmdrename' : 'Naam wijzigen',
'cmdrm' : 'Verwijder',
'cmdsearch' : 'Zoek bestanden',
'cmdup' : 'Ga een map hoger',
'cmdupload' : 'Upload bestanden',
'cmdview' : 'Bekijk',
'cmdresize' : 'Formaat wijzigen',
'cmdsort' : 'Sorteren',
'cmdnetmount' : 'Mount netwerk volume', // added 18.04.2012
'cmdnetunmount': 'Unmount', // from v2.1 added 30.04.2012
'cmdplaces' : 'Naar Plaatsen', // added 28.12.2014
'cmdchmod' : 'Wijzig modus', // from v2.1 added 20.6.2015
/*********************************** buttons ***********************************/
'btnClose' : 'Sluit',
'btnSave' : 'Opslaan',
'btnRm' : 'Verwijder',
'btnApply' : 'Toepassen',
'btnCancel' : 'Annuleren',
'btnNo' : 'Nee',
'btnYes' : 'Ja',
'btnMount' : 'Mount', // added 18.04.2012
'btnApprove': 'Ga naar $1 & keur goed', // from v2.1 added 26.04.2012
'btnUnmount': 'Unmount', // from v2.1 added 30.04.2012
'btnConv' : 'Converteer', // from v2.1 added 08.04.2014
'btnCwd' : 'Hier', // from v2.1 added 22.5.2015
'btnVolume' : 'Volume', // from v2.1 added 22.5.2015
'btnAll' : 'Alles', // from v2.1 added 22.5.2015
'btnMime' : 'MIME Type', // from v2.1 added 22.5.2015
'btnFileName':'Bestandsnaam', // from v2.1 added 22.5.2015
'btnSaveClose': 'Opslaan & Sluiten', // from v2.1 added 12.6.2015
'btnBackup' : 'Back-up', // fromv2.1 added 28.11.2015
/******************************** notifications ********************************/
'ntfopen' : 'Bezig met openen van map',
'ntffile' : 'Bezig met openen bestand',
'ntfreload' : 'Herladen map inhoud',
'ntfmkdir' : 'Bezig met map maken',
'ntfmkfile' : 'Bezig met Bestanden maken',
'ntfrm' : 'Verwijderen bestanden',
'ntfcopy' : 'Kopieer bestanden',
'ntfmove' : 'Verplaats bestanden',
'ntfprepare' : 'Voorbereiden kopiëren',
'ntfrename' : 'Hernoem bestanden',
'ntfupload' : 'Bestanden uploaden actief',
'ntfdownload' : 'Bestanden downloaden actief',
'ntfsave' : 'Bestanden opslaan',
'ntfarchive' : 'Archief aan het maken',
'ntfextract' : 'Bestanden uitpakken actief',
'ntfsearch' : 'Zoeken naar bestanden',
'ntfresize' : 'Formaat wijzigen van afbeeldingen',
'ntfsmth' : 'Iets aan het doen',
'ntfloadimg' : 'Laden van plaatje',
'ntfnetmount' : 'Mounten van netwerk volume', // added 18.04.2012
'ntfnetunmount': 'Unmounten van netwerk volume', // from v2.1 added 30.04.2012
'ntfdim' : 'Opvragen afbeeldingen dimensies', // added 20.05.2013
'ntfreaddir' : 'Map informatie lezen', // from v2.1 added 01.07.2013
'ntfurl' : 'URL van link ophalen', // from v2.1 added 11.03.2014
'ntfchmod' : 'Bestandsmodus wijzigen', // from v2.1 added 20.6.2015
'ntfpreupload': 'Upload bestandsnaam verifiëren', // from v2.1 added 31.11.2015
/************************************ dates **********************************/
'dateUnknown' : 'onbekend',
'Today' : 'Vandaag',
'Yesterday' : 'Gisteren',
'msJan' : 'Jan',
'msFeb' : 'Feb',
'msMar' : 'Mar',
'msApr' : 'Apr',
'msMay' : 'Mei',
'msJun' : 'Jun',
'msJul' : 'Jul',
'msAug' : 'Aug',
'msSep' : 'Sep',
'msOct' : 'Okt',
'msNov' : 'Nov',
'msDec' : 'Dec',
'January' : 'Januari',
'February' : 'Februari',
'March' : 'Maart',
'April' : 'April',
'May' : 'Mei',
'June' : 'Juni',
'July' : 'Juli',
'August' : 'Augustus',
'September' : 'September',
'October' : 'Oktober',
'November' : 'November',
'December' : 'December',
'Sunday' : 'Zondag',
'Monday' : 'Maandag',
'Tuesday' : 'Dinsdag',
'Wednesday' : 'Woensdag',
'Thursday' : 'Donderdag',
'Friday' : 'Vrijdag',
'Saturday' : 'Zaterdag',
'Sun' : 'Zo',
'Mon' : 'Ma',
'Tue' : 'Di',
'Wed' : 'Wo',
'Thu' : 'Do',
'Fri' : 'Vr',
'Sat' : 'Za',
/******************************** sort variants ********************************/
'sortname' : 'op naam',
'sortkind' : 'op type',
'sortsize' : 'op grootte',
'sortdate' : 'op datum',
'sortFoldersFirst' : 'Mappen eerst',
/********************************** new items **********************************/
'untitled file.txt' : 'NieuwBestand.txt', // added 10.11.2015
'untitled folder' : 'NieuweMap', // added 10.11.2015
'Archive' : 'NieuwArchief', // from v2.1 added 10.11.2015
/********************************** messages **********************************/
'confirmReq' : 'Bevestiging nodig',
'confirmRm' : 'Weet u zeker dat u deze bestanden wil verwijderen?<br/>Deze actie kan niet ongedaan gemaakt worden!',
'confirmRepl' : 'Oud bestand vervangen door het nieuwe bestand?',
'confirmConvUTF8' : 'Niet in UTF-8<br/>Converteren naar UTF-8?<br/>De inhoud wordt UTF-8 door op te slaan na de conversie.', // from v2.1 added 08.04.2014
'confirmNotSave' : 'Het is aangepast.<br/>Wijzigingen gaan verloren als je niet opslaat.', // from v2.1 added 15.7.2015
'apllyAll' : 'Toepassen op alles',
'name' : 'Naam',
'size' : 'Grootte',
'perms' : 'Rechten',
'modify' : 'Aangepast',
'kind' : 'Type',
'read' : 'lees',
'write' : 'schrijf',
'noaccess' : 'geen toegang',
'and' : 'en',
'unknown' : 'onbekend',
'selectall' : 'Selecteer alle bestanden',
'selectfiles' : 'Selecteer bestand(en)',
'selectffile' : 'Selecteer eerste bestand',
'selectlfile' : 'Selecteer laatste bestand',
'viewlist' : 'Lijst weergave',
'viewicons' : 'Icoon weergave',
'places' : 'Plaatsen',
'calc' : 'Bereken',
'path' : 'Pad',
'aliasfor' : 'Alias voor',
'locked' : 'Vergrendeld',
'dim' : 'Dimensies',
'files' : 'Bestanden',
'folders' : 'Mappen',
'items' : 'Items',
'yes' : 'ja',
'no' : 'nee',
'link' : 'Link',
'searcresult' : 'Zoek resultaten',
'selected' : 'geselecteerde items',
'about' : 'Over',
'shortcuts' : 'Snelkoppelingen',
'help' : 'Help',
'webfm' : 'Web bestandsmanager',
'ver' : 'Versie',
'protocolver' : 'protocol versie',
'homepage' : 'Project home',
'docs' : 'Documentatie',
'github' : 'Fork ons op Github',
'twitter' : 'Volg ons op twitter',
'facebook' : 'Wordt lid op facebook',
'team' : 'Team',
'chiefdev' : 'Hoofd ontwikkelaar',
'developer' : 'ontwikkelaar',
'contributor' : 'bijdrager',
'maintainer' : 'onderhouder',
'translator' : 'vertaler',
'icons' : 'Iconen',
'dontforget' : 'En vergeet je handdoek niet!',
'shortcutsof' : 'Snelkoppelingen uitgeschakeld',
'dropFiles' : 'Sleep hier uw bestanden heen',
'or' : 'of',
'selectForUpload' : 'Selecteer bestanden om te uploaden',
'moveFiles' : 'Verplaats bestanden',
'copyFiles' : 'Kopieer bestanden',
'rmFromPlaces' : 'Verwijder uit Plaatsen',
'aspectRatio' : 'Aspect ratio',
'scale' : 'Schaal',
'width' : 'Breedte',
'height' : 'Hoogte',
'resize' : 'Verkleinen',
'crop' : 'Bijsnijden',
'rotate' : 'Draaien',
'rotate-cw' : 'Draai 90 graden rechtsom',
'rotate-ccw' : 'Draai 90 graden linksom',
'degree' : '°',
'netMountDialogTitle' : 'Mount netwerk volume', // added 18.04.2012
'protocol' : 'Protocol', // added 18.04.2012
'host' : 'Host', // added 18.04.2012
'port' : 'Poort', // added 18.04.2012
'user' : 'Gebruikersnaams', // added 18.04.2012
'pass' : 'Wachtwoord', // added 18.04.2012
'confirmUnmount' : 'Weet u zeker dat u $1 wil unmounten?', // from v2.1 added 30.04.2012
'dropFilesBrowser': 'Sleep of plak bestanden vanuit de browser', // from v2.1 added 30.05.2012
'dropPasteFiles' : 'Sleep of plak bestanden hier', // from v2.1 added 07.04.2014
'encoding' : 'Encodering', // from v2.1 added 19.12.2014
'locale' : 'Locale', // from v2.1 added 19.12.2014
'searchTarget' : 'Doel: $1', // from v2.1 added 22.5.2015
'searchMime' : 'Zoek op invoer MIME Type', // from v2.1 added 22.5.2015
'owner' : 'Eigenaar', // from v2.1 added 20.6.2015
'group' : 'Groep', // from v2.1 added 20.6.2015
'other' : 'Overig', // from v2.1 added 20.6.2015
'execute' : 'Uitvoeren', // from v2.1 added 20.6.2015
'perm' : 'Rechten', // from v2.1 added 20.6.2015
'mode' : 'Modus', // from v2.1 added 20.6.2015
/********************************** mimetypes **********************************/
'kindUnknown' : 'Onbekend',
'kindFolder' : 'Map',
'kindAlias' : 'Alias',
'kindAliasBroken' : 'Kapot alias',
// applications
'kindApp' : 'Applicatie',
'kindPostscript' : 'Postscript document',
'kindMsOffice' : 'Microsoft Office document',
'kindMsWord' : 'Microsoft Word document',
'kindMsExcel' : 'Microsoft Excel document',
'kindMsPP' : 'Microsoft Powerpoint presentation',
'kindOO' : 'Open Office document',
'kindAppFlash' : 'Flash applicatie',
'kindPDF' : 'Portable Document Format (PDF)',
'kindTorrent' : 'Bittorrent bestand',
'kind7z' : '7z archief',
'kindTAR' : 'TAR archief',
'kindGZIP' : 'GZIP archief',
'kindBZIP' : 'BZIP archief',
'kindXZ' : 'XZ archief',
'kindZIP' : 'ZIP archief',
'kindRAR' : 'RAR archief',
'kindJAR' : 'Java JAR bestand',
'kindTTF' : 'True Type font',
'kindOTF' : 'Open Type font',
'kindRPM' : 'RPM package',
// texts
'kindText' : 'Tekst bestand',
'kindTextPlain' : 'Tekst',
'kindPHP' : 'PHP bronbestand',
'kindCSS' : 'Cascading style sheet',
'kindHTML' : 'HTML document',
'kindJS' : 'Javascript bronbestand',
'kindRTF' : 'Rich Text Format',
'kindC' : 'C bronbestand',
'kindCHeader' : 'C header bronbestand',
'kindCPP' : 'C++ bronbestand',
'kindCPPHeader' : 'C++ header bronbestand',
'kindShell' : 'Unix shell script',
'kindPython' : 'Python bronbestand',
'kindJava' : 'Java bronbestand',
'kindRuby' : 'Ruby bronbestand',
'kindPerl' : 'Perl bronbestand',
'kindSQL' : 'SQL bronbestand',
'kindXML' : 'XML document',
'kindAWK' : 'AWK bronbestand',
'kindCSV' : 'Komma gescheiden waardes',
'kindDOCBOOK' : 'Docbook XML document',
'kindMarkdown' : 'Markdown tekst', // added 20.7.2015
// images
'kindImage' : 'Afbeelding',
'kindBMP' : 'BMP afbeelding',
'kindJPEG' : 'JPEG afbeelding',
'kindGIF' : 'GIF afbeelding',
'kindPNG' : 'PNG afbeelding',
'kindTIFF' : 'TIFF afbeelding',
'kindTGA' : 'TGA afbeelding',
'kindPSD' : 'Adobe Photoshop afbeelding',
'kindXBITMAP' : 'X bitmap afbeelding',
'kindPXM' : 'Pixelmator afbeelding',
// media
'kindAudio' : 'Audio media',
'kindAudioMPEG' : 'MPEG audio',
'kindAudioMPEG4' : 'MPEG-4 audio',
'kindAudioMIDI' : 'MIDI audio',
'kindAudioOGG' : 'Ogg Vorbis audio',
'kindAudioWAV' : 'WAV audio',
'AudioPlaylist' : 'MP3 playlist',
'kindVideo' : 'Video media',
'kindVideoDV' : 'DV video',
'kindVideoMPEG' : 'MPEG video',
'kindVideoMPEG4' : 'MPEG-4 video',
'kindVideoAVI' : 'AVI video',
'kindVideoMOV' : 'Quick Time video',
'kindVideoWM' : 'Windows Media video',
'kindVideoFlash' : 'Flash video',
'kindVideoMKV' : 'Matroska video',
'kindVideoOGG' : 'Ogg video'
}
};
}
|
packages/accounts-base/accounts_client.js | esteedqueen/meteor | // @summary Constructor for AccountsClient instances. Available only on
// the client for now, though server code might also want to
// create a client connection to an accounts server.
// @locus Client
// @param options {Object} an object with fields:
// - connection {Object} Optional DDP connection to reuse.
// - ddpUrl {String} Optional URL for creating a new DDP connection.
AccountsClient = function AccountsClient(options) {
AccountsCommon.call(this, options);
this._loggingIn = false;
this._loggingInDeps = new Tracker.Dependency;
this._loginServicesHandle =
this.connection.subscribe("meteor.loginServiceConfiguration");
this._pageLoadLoginCallbacks = [];
this._pageLoadLoginAttemptInfo = null;
// Defined in url_client.js.
this._initUrlMatching();
// Defined in localstorage_token.js.
this._initLocalStorage();
};
Meteor._inherits(AccountsClient, AccountsCommon);
var Ap = AccountsClient.prototype;
///
/// CURRENT USER
///
// @override
Ap.userId = function () {
return this.connection.userId();
};
// This is mostly just called within this file, but Meteor.loginWithPassword
// also uses it to make loggingIn() be true during the beginPasswordExchange
// method call too.
Ap._setLoggingIn = function (x) {
if (this._loggingIn !== x) {
this._loggingIn = x;
this._loggingInDeps.changed();
}
};
/**
* @summary True if a login method (such as `Meteor.loginWithPassword`, `Meteor.loginWithFacebook`, or `Accounts.createUser`) is currently in progress. A reactive data source.
* @locus Client
*/
Meteor.loggingIn = function () {
return Accounts.loggingIn();
};
Ap.loggingIn = function () {
this._loggingInDeps.depend();
return this._loggingIn;
};
///
/// LOGIN METHODS
///
// Call a login method on the server.
//
// A login method is a method which on success calls `this.setUserId(id)` and
// `Accounts._setLoginToken` on the server and returns an object with fields
// 'id' (containing the user id), 'token' (containing a resume token), and
// optionally `tokenExpires`.
//
// This function takes care of:
// - Updating the Meteor.loggingIn() reactive data source
// - Calling the method in 'wait' mode
// - On success, saving the resume token to localStorage
// - On success, calling Accounts.connection.setUserId()
// - Setting up an onReconnect handler which logs in with
// the resume token
//
// Options:
// - methodName: The method to call (default 'login')
// - methodArguments: The arguments for the method
// - validateResult: If provided, will be called with the result of the
// method. If it throws, the client will not be logged in (and
// its error will be passed to the callback).
// - userCallback: Will be called with no arguments once the user is fully
// logged in, or with the error on error.
//
Ap.callLoginMethod = function (options) {
var self = this;
options = _.extend({
methodName: 'login',
methodArguments: [{}],
_suppressLoggingIn: false
}, options);
// Set defaults for callback arguments to no-op functions; make sure we
// override falsey values too.
_.each(['validateResult', 'userCallback'], function (f) {
if (!options[f])
options[f] = function () {};
});
// Prepare callbacks: user provided and onLogin/onLoginFailure hooks.
var loginCallbacks = _.once(function (error) {
if (!error) {
self._onLoginHook.each(function (callback) {
callback();
return true;
});
} else {
self._onLoginFailureHook.each(function (callback) {
callback();
return true;
});
}
options.userCallback.apply(this, arguments);
});
var reconnected = false;
// We want to set up onReconnect as soon as we get a result token back from
// the server, without having to wait for subscriptions to rerun. This is
// because if we disconnect and reconnect between getting the result and
// getting the results of subscription rerun, we WILL NOT re-send this
// method (because we never re-send methods whose results we've received)
// but we WILL call loggedInAndDataReadyCallback at "reconnect quiesce"
// time. This will lead to makeClientLoggedIn(result.id) even though we
// haven't actually sent a login method!
//
// But by making sure that we send this "resume" login in that case (and
// calling makeClientLoggedOut if it fails), we'll end up with an accurate
// client-side userId. (It's important that livedata_connection guarantees
// that the "reconnect quiesce"-time call to loggedInAndDataReadyCallback
// will occur before the callback from the resume login call.)
var onResultReceived = function (err, result) {
if (err || !result || !result.token) {
self.connection.onReconnect = null;
} else {
self.connection.onReconnect = function () {
reconnected = true;
// If our token was updated in storage, use the latest one.
var storedToken = self._storedLoginToken();
if (storedToken) {
result = {
token: storedToken,
tokenExpires: self._storedLoginTokenExpires()
};
}
if (! result.tokenExpires)
result.tokenExpires = self._tokenExpiration(new Date());
if (self._tokenExpiresSoon(result.tokenExpires)) {
self.makeClientLoggedOut();
} else {
self.callLoginMethod({
methodArguments: [{resume: result.token}],
// Reconnect quiescence ensures that the user doesn't see an
// intermediate state before the login method finishes. So we don't
// need to show a logging-in animation.
_suppressLoggingIn: true,
userCallback: function (error) {
var storedTokenNow = self._storedLoginToken();
if (error) {
// If we had a login error AND the current stored token is the
// one that we tried to log in with, then declare ourselves
// logged out. If there's a token in storage but it's not the
// token that we tried to log in with, we don't know anything
// about whether that token is valid or not, so do nothing. The
// periodic localStorage poll will decide if we are logged in or
// out with this token, if it hasn't already. Of course, even
// with this check, another tab could insert a new valid token
// immediately before we clear localStorage here, which would
// lead to both tabs being logged out, but by checking the token
// in storage right now we hope to make that unlikely to happen.
//
// If there is no token in storage right now, we don't have to
// do anything; whatever code removed the token from storage was
// responsible for calling `makeClientLoggedOut()`, or the
// periodic localStorage poll will call `makeClientLoggedOut`
// eventually if another tab wiped the token from storage.
if (storedTokenNow && storedTokenNow === result.token) {
self.makeClientLoggedOut();
}
}
// Possibly a weird callback to call, but better than nothing if
// there is a reconnect between "login result received" and "data
// ready".
loginCallbacks(error);
}});
}
};
}
};
// This callback is called once the local cache of the current-user
// subscription (and all subscriptions, in fact) are guaranteed to be up to
// date.
var loggedInAndDataReadyCallback = function (error, result) {
// If the login method returns its result but the connection is lost
// before the data is in the local cache, it'll set an onReconnect (see
// above). The onReconnect will try to log in using the token, and *it*
// will call userCallback via its own version of this
// loggedInAndDataReadyCallback. So we don't have to do anything here.
if (reconnected)
return;
// Note that we need to call this even if _suppressLoggingIn is true,
// because it could be matching a _setLoggingIn(true) from a
// half-completed pre-reconnect login method.
self._setLoggingIn(false);
if (error || !result) {
error = error || new Error(
"No result from call to " + options.methodName);
loginCallbacks(error);
return;
}
try {
options.validateResult(result);
} catch (e) {
loginCallbacks(e);
return;
}
// Make the client logged in. (The user data should already be loaded!)
self.makeClientLoggedIn(result.id, result.token, result.tokenExpires);
loginCallbacks();
};
if (!options._suppressLoggingIn)
self._setLoggingIn(true);
self.connection.apply(
options.methodName,
options.methodArguments,
{wait: true, onResultReceived: onResultReceived},
loggedInAndDataReadyCallback);
};
Ap.makeClientLoggedOut = function () {
this._unstoreLoginToken();
this.connection.setUserId(null);
this.connection.onReconnect = null;
};
Ap.makeClientLoggedIn = function (userId, token, tokenExpires) {
this._storeLoginToken(userId, token, tokenExpires);
this.connection.setUserId(userId);
};
/**
* @summary Log the user out.
* @locus Client
* @param {Function} [callback] Optional callback. Called with no arguments on success, or with a single `Error` argument on failure.
*/
Meteor.logout = function (callback) {
return Accounts.logout(callback);
};
Ap.logout = function (callback) {
var self = this;
self.connection.apply('logout', [], {
wait: true
}, function (error, result) {
if (error) {
callback && callback(error);
} else {
self.makeClientLoggedOut();
callback && callback();
}
});
};
/**
* @summary Log out other clients logged in as the current user, but does not log out the client that calls this function.
* @locus Client
* @param {Function} [callback] Optional callback. Called with no arguments on success, or with a single `Error` argument on failure.
*/
Meteor.logoutOtherClients = function (callback) {
return Accounts.logoutOtherClients(callback);
};
Ap.logoutOtherClients = function (callback) {
var self = this;
// We need to make two method calls: one to replace our current token,
// and another to remove all tokens except the current one. We want to
// call these two methods one after the other, without any other
// methods running between them. For example, we don't want `logout`
// to be called in between our two method calls (otherwise the second
// method call would return an error). Another example: we don't want
// logout to be called before the callback for `getNewToken`;
// otherwise we would momentarily log the user out and then write a
// new token to localStorage.
//
// To accomplish this, we make both calls as wait methods, and queue
// them one after the other, without spinning off the event loop in
// between. Even though we queue `removeOtherTokens` before
// `getNewToken`, we won't actually send the `removeOtherTokens` call
// until the `getNewToken` callback has finished running, because they
// are both wait methods.
self.connection.apply(
'getNewToken',
[],
{ wait: true },
function (err, result) {
if (! err) {
self._storeLoginToken(
self.userId(),
result.token,
result.tokenExpires
);
}
}
);
self.connection.apply(
'removeOtherTokens',
[],
{ wait: true },
function (err) {
callback && callback(err);
}
);
};
///
/// LOGIN SERVICES
///
// A reactive function returning whether the loginServiceConfiguration
// subscription is ready. Used by accounts-ui to hide the login button
// until we have all the configuration loaded
//
Ap.loginServicesConfigured = function () {
return this._loginServicesHandle.ready();
};
// Some login services such as the redirect login flow or the resume
// login handler can log the user in at page load time. The
// Meteor.loginWithX functions have a callback argument, but the
// callback function instance won't be in memory any longer if the
// page was reloaded. The `onPageLoadLogin` function allows a
// callback to be registered for the case where the login was
// initiated in a previous VM, and we now have the result of the login
// attempt in a new VM.
// Register a callback to be called if we have information about a
// login attempt at page load time. Call the callback immediately if
// we already have the page load login attempt info, otherwise stash
// the callback to be called if and when we do get the attempt info.
//
Ap.onPageLoadLogin = function (f) {
if (this._pageLoadLoginAttemptInfo) {
f(this._pageLoadLoginAttemptInfo);
} else {
this._pageLoadLoginCallbacks.push(f);
}
};
// Receive the information about the login attempt at page load time.
// Call registered callbacks, and also record the info in case
// someone's callback hasn't been registered yet.
//
Ap._pageLoadLogin = function (attemptInfo) {
if (this._pageLoadLoginAttemptInfo) {
Meteor._debug("Ignoring unexpected duplicate page load login attempt info");
return;
}
_.each(this._pageLoadLoginCallbacks, function (callback) {
callback(attemptInfo);
});
this._pageLoadLoginCallbacks = [];
this._pageLoadLoginAttemptInfo = attemptInfo;
};
///
/// HANDLEBARS HELPERS
///
// If our app has a Blaze, register the {{currentUser}} and {{loggingIn}}
// global helpers.
if (Package.blaze) {
/**
* @global
* @name currentUser
* @isHelper true
* @summary Calls [Meteor.user()](#meteor_user). Use `{{#if currentUser}}` to check whether the user is logged in.
*/
Package.blaze.Blaze.Template.registerHelper('currentUser', function () {
return Meteor.user();
});
/**
* @global
* @name loggingIn
* @isHelper true
* @summary Calls [Meteor.loggingIn()](#meteor_loggingin).
*/
Package.blaze.Blaze.Template.registerHelper('loggingIn', function () {
return Meteor.loggingIn();
});
}
|
src/svg-icons/editor/border-clear.js | owencm/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let EditorBorderClear = (props) => (
<SvgIcon {...props}>
<path d="M7 5h2V3H7v2zm0 8h2v-2H7v2zm0 8h2v-2H7v2zm4-4h2v-2h-2v2zm0 4h2v-2h-2v2zm-8 0h2v-2H3v2zm0-4h2v-2H3v2zm0-4h2v-2H3v2zm0-4h2V7H3v2zm0-4h2V3H3v2zm8 8h2v-2h-2v2zm8 4h2v-2h-2v2zm0-4h2v-2h-2v2zm0 8h2v-2h-2v2zm0-12h2V7h-2v2zm-8 0h2V7h-2v2zm8-6v2h2V3h-2zm-8 2h2V3h-2v2zm4 16h2v-2h-2v2zm0-8h2v-2h-2v2zm0-8h2V3h-2v2z"/>
</SvgIcon>
);
EditorBorderClear = pure(EditorBorderClear);
EditorBorderClear.displayName = 'EditorBorderClear';
EditorBorderClear.muiName = 'SvgIcon';
export default EditorBorderClear;
|
src/views/letterhead.js | planigan/resource-center | import _ from 'lodash'
import React from 'react'
import LetterheadCard from '../components/letterheadCard'
import { letterheadData } from '../data/letterheadData'
import { Helmet } from 'react-helmet'
const Letterhead = () => {
return (
<div className='container'>
<Helmet>
<title>Letterhead | Resource Center</title>
</Helmet>
<div className='row'>
<div className='col s12'>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim
ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat. Duis aute irure dolor in
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum.
</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim
ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat. Duis aute irure dolor in
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum.
</p>
</div>
</div>
<div className='row'>
{_.map(letterheadData, ({ image }, key) => {
return (
<LetterheadCard
key={key}
title='Card title'
action='Action1'
image={image}
/>
)
})}
</div>
</div>
)
}
export default Letterhead
|
app/js/components/FormFrameModal.js | niksoc/srmconnect | import React from 'react';
import GenericModal from './common/GenericModal';
import FormFrame from './common/FormFrame';
const FormFrameModal = (props) => {
const formFrame = <FormFrame src={props.src} />;
const tagForm = <FormFrame height="200px" src="/api/create/tag" />;
const form = <div>{formFrame}<hr/><p><strong>Can't find the tag you're looking for?<br/>Create it here and then add it to your post (note:not all posts (eg. answers) can have tags) Rarely used tags may be deleted.</strong></p>{tagForm}</div>;
return ( <GenericModal {...props} children={form} /> );
};
export default FormFrameModal;
|
src/routes/Search/components/EmptyResultCard.js | SurfaceW/connectify_client | import React from 'react'
import { Card, CardHeader, CardText } from 'material-ui/Card'
export default () => (
<Card>
<CardHeader
title='no result'
/>
<CardText>
There is no result for the current state, you can click back button and
keep on searching with some other words.
</CardText>
</Card>
)
|
web/bundles/app/js/jquery.cleditor.min.js | mail2nisam/superApp | /*
CLEditor WYSIWYG HTML Editor v1.3.0
http://premiumsoftware.net/cleditor
requires jQuery v1.4.2 or later
Copyright 2010, Chris Landowski, Premium Software, LLC
Dual licensed under the MIT or GPL Version 2 licenses.
*/
(function(e){function aa(a){var b=this,c=a.target,d=e.data(c,x),h=s[d],f=h.popupName,i=p[f];if(!(b.disabled||e(c).attr(n)==n)){var g={editor:b,button:c,buttonName:d,popup:i,popupName:f,command:h.command,useCSS:b.options.useCSS};if(h.buttonClick&&h.buttonClick(a,g)===false)return false;if(d=="source"){if(t(b)){delete b.range;b.$area.hide();b.$frame.show();c.title=h.title}else{b.$frame.hide();b.$area.show();c.title="Show Rich Text"}setTimeout(function(){u(b)},100)}else if(!t(b))if(f){var j=e(i);if(f==
"url"){if(d=="link"&&M(b)===""){z(b,"A selection is required when inserting a link.",c);return false}j.children(":button").unbind(q).bind(q,function(){var k=j.find(":text"),o=e.trim(k.val());o!==""&&v(b,g.command,o,null,g.button);k.val("http://");r();w(b)})}else f=="pastetext"&&j.children(":button").unbind(q).bind(q,function(){var k=j.find("textarea"),o=k.val().replace(/\n/g,"<br />");o!==""&&v(b,g.command,o,null,g.button);k.val("");r();w(b)});if(c!==e.data(i,A)){N(b,i,c);return false}return}else if(d==
"print")b.$frame[0].contentWindow.print();else if(!v(b,g.command,g.value,g.useCSS,c))return false;w(b)}}function O(a){a=e(a.target).closest("div");a.css(H,a.data(x)?"#FFF":"#FFC")}function P(a){e(a.target).closest("div").css(H,"transparent")}function ba(a){var b=a.data.popup,c=a.target;if(!(b===p.msg||e(b).hasClass(B))){var d=e.data(b,A),h=e.data(d,x),f=s[h],i=f.command,g,j=this.options.useCSS;if(h=="font")g=c.style.fontFamily.replace(/"/g,"");else if(h=="size"){if(c.tagName=="DIV")c=c.children[0];
g=c.innerHTML}else if(h=="style")g="<"+c.tagName+">";else if(h=="color")g=Q(c.style.backgroundColor);else if(h=="highlight"){g=Q(c.style.backgroundColor);if(l)i="backcolor";else j=true}b={editor:this,button:d,buttonName:h,popup:b,popupName:f.popupName,command:i,value:g,useCSS:j};if(!(f.popupClick&&f.popupClick(a,b)===false)){if(b.command&&!v(this,b.command,b.value,b.useCSS,d))return false;r();w(this)}}}function C(a){for(var b=1,c=0,d=0;d<a.length;++d){b=(b+a.charCodeAt(d))%65521;c=(c+b)%65521}return c<<
16|b}function R(a,b,c,d,h){if(p[a])return p[a];var f=e(m).hide().addClass(ca).appendTo("body");if(d)f.html(d);else if(a=="color"){b=b.colors.split(" ");b.length<10&&f.width("auto");e.each(b,function(i,g){e(m).appendTo(f).css(H,"#"+g)});c=da}else if(a=="font")e.each(b.fonts.split(","),function(i,g){e(m).appendTo(f).css("fontFamily",g).html(g)});else if(a=="size")e.each(b.sizes.split(","),function(i,g){e(m).appendTo(f).html("<font size="+g+">"+g+"</font>")});else if(a=="style")e.each(b.styles,function(i,
g){e(m).appendTo(f).html(g[1]+g[0]+g[1].replace("<","</"))});else if(a=="url"){f.html('Enter URL:<br><input type=text value="http://" size=35><br><input type=button value="Submit">');c=B}else if(a=="pastetext"){f.html("Paste your content here and click submit.<br /><textarea cols=40 rows=3></textarea><br /><input type=button value=Submit>");c=B}if(!c&&!d)c=S;f.addClass(c);l&&f.attr(I,"on").find("div,font,p,h1,h2,h3,h4,h5,h6").attr(I,"on");if(f.hasClass(S)||h===true)f.children().hover(O,P);p[a]=f[0];
return f[0]}function T(a,b){if(b){a.$area.attr(n,n);a.disabled=true}else{a.$area.removeAttr(n);delete a.disabled}try{if(l)a.doc.body.contentEditable=!b;else a.doc.designMode=!b?"on":"off"}catch(c){}u(a)}function v(a,b,c,d,h){D(a);if(!l){if(d===undefined||d===null)d=a.options.useCSS;a.doc.execCommand("styleWithCSS",0,d.toString())}d=true;var f;if(l&&b.toLowerCase()=="inserthtml")y(a).pasteHTML(c);else{try{d=a.doc.execCommand(b,0,c||null)}catch(i){f=i.description;d=false}d||("cutcopypaste".indexOf(b)>
-1?z(a,"For security reasons, your browser does not support the "+b+" command. Try using the keyboard shortcut or context menu instead.",h):z(a,f?f:"Error executing the "+b+" command.",h))}u(a);return d}function w(a){setTimeout(function(){t(a)?a.$area.focus():a.$frame[0].contentWindow.focus();u(a)},0)}function y(a){if(l)return J(a).createRange();return J(a).getRangeAt(0)}function J(a){if(l)return a.doc.selection;return a.$frame[0].contentWindow.getSelection()}function Q(a){var b=/rgba?\((\d+), (\d+), (\d+)/.exec(a),
c=a.split("");if(b)for(a=(b[1]<<16|b[2]<<8|b[3]).toString(16);a.length<6;)a="0"+a;return"#"+(a.length==6?a:c[1]+c[1]+c[2]+c[2]+c[3]+c[3])}function r(){e.each(p,function(a,b){e(b).hide().unbind(q).removeData(A)})}function U(){var a=e("link[href$='jquery.cleditor.css']").attr("href");return a.substr(0,a.length-19)+"images/"}function K(a){var b=a.$main,c=a.options;a.$frame&&a.$frame.remove();var d=a.$frame=e('<iframe frameborder="0" src="javascript:true;">').hide().appendTo(b),h=d[0].contentWindow,f=
a.doc=h.document,i=e(f);f.open();f.write(c.docType+"<html>"+(c.docCSSFile===""?"":'<head><link rel="stylesheet" type="text/css" href="'+c.docCSSFile+'" /></head>')+'<body style="'+c.bodyStyle+'"></body></html>');f.close();l&&i.click(function(){w(a)});E(a);if(l){i.bind("beforedeactivate beforeactivate selectionchange keypress",function(g){if(g.type=="beforedeactivate")a.inactive=true;else if(g.type=="beforeactivate"){!a.inactive&&a.range&&a.range.length>1&&a.range.shift();delete a.inactive}else if(!a.inactive){if(!a.range)a.range=
[];for(a.range.unshift(y(a));a.range.length>2;)a.range.pop()}});d.focus(function(){D(a)})}(e.browser.mozilla?i:e(h)).blur(function(){V(a,true)});i.click(r).bind("keyup mouseup",function(){u(a)});L?a.$area.show():d.show();e(function(){var g=a.$toolbar,j=g.children("div:last"),k=b.width();j=j.offset().top+j.outerHeight()-g.offset().top+1;g.height(j);j=(/%/.test(""+c.height)?b.height():parseInt(c.height))-j;d.width(k).height(j);a.$area.width(k).height(ea?j-2:j);T(a,a.disabled);u(a)})}function u(a){if(!L&&
e.browser.webkit&&!a.focused){a.$frame[0].contentWindow.focus();window.focus();a.focused=true}var b=a.doc;if(l)b=y(a);var c=t(a);e.each(a.$toolbar.find("."+W),function(d,h){var f=e(h),i=e.cleditor.buttons[e.data(h,x)],g=i.command,j=true;if(a.disabled)j=false;else if(i.getEnabled){j=i.getEnabled({editor:a,button:h,buttonName:i.name,popup:p[i.popupName],popupName:i.popupName,command:i.command,useCSS:a.options.useCSS});if(j===undefined)j=true}else if((c||L)&&i.name!="source"||l&&(g=="undo"||g=="redo"))j=
false;else if(g&&g!="print"){if(l&&g=="hilitecolor")g="backcolor";if(!l||g!="inserthtml")try{j=b.queryCommandEnabled(g)}catch(k){j=false}}if(j){f.removeClass(X);f.removeAttr(n)}else{f.addClass(X);f.attr(n,n)}})}function D(a){l&&a.range&&a.range[0].select()}function M(a){D(a);if(l)return y(a).text;return J(a).toString()}function z(a,b,c){var d=R("msg",a.options,fa);d.innerHTML=b;N(a,d,c)}function N(a,b,c){var d,h,f=e(b);if(c){var i=e(c);d=i.offset();h=--d.left;d=d.top+i.height()}else{i=a.$toolbar;
d=i.offset();h=Math.floor((i.width()-f.width())/2)+d.left;d=d.top+i.height()-2}r();f.css({left:h,top:d}).show();if(c){e.data(b,A,c);f.bind(q,{popup:b},e.proxy(ba,a))}setTimeout(function(){f.find(":text,textarea").eq(0).focus().select()},100)}function t(a){return a.$area.is(":visible")}function E(a,b){var c=a.$area.val(),d=a.options,h=d.updateFrame,f=e(a.doc.body);if(h){var i=C(c);if(b&&a.areaChecksum==i)return;a.areaChecksum=i}c=h?h(c):c;c=c.replace(/<(?=\/?script)/ig,"<");if(d.updateTextArea)a.frameChecksum=
C(c);if(c!=f.html()){f.html(c);e(a).triggerHandler(F)}}function V(a,b){var c=e(a.doc.body).html(),d=a.options,h=d.updateTextArea,f=a.$area;if(h){var i=C(c);if(b&&a.frameChecksum==i)return;a.frameChecksum=i}c=h?h(c):c;if(d.updateFrame)a.areaChecksum=C(c);if(c!=f.val()){f.val(c);e(a).triggerHandler(F)}}e.cleditor={defaultOptions:{width:500,height:250,controls:"bold italic underline strikethrough subscript superscript | font size style | color highlight removeformat | bullets numbering | outdent indent | alignleft center alignright justify | undo redo | rule image link unlink | cut copy paste pastetext | print source",
colors:"FFF FCC FC9 FF9 FFC 9F9 9FF CFF CCF FCF CCC F66 F96 FF6 FF3 6F9 3FF 6FF 99F F9F BBB F00 F90 FC6 FF0 3F3 6CC 3CF 66C C6C 999 C00 F60 FC3 FC0 3C0 0CC 36F 63F C3C 666 900 C60 C93 990 090 399 33F 60C 939 333 600 930 963 660 060 366 009 339 636 000 300 630 633 330 030 033 006 309 303",fonts:"Arial,Arial Black,Comic Sans MS,Courier New,Narrow,Garamond,Georgia,Impact,Sans Serif,Serif,Tahoma,Trebuchet MS,Verdana",sizes:"1,2,3,4,5,6,7",styles:[["Paragraph","<p>"],["Header 1","<h1>"],["Header 2","<h2>"],
["Header 3","<h3>"],["Header 4","<h4>"],["Header 5","<h5>"],["Header 6","<h6>"]],useCSS:false,docType:'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">',docCSSFile:"",bodyStyle:"margin:4px; font:10pt Arial,Verdana; cursor:text"},buttons:{init:"bold,,|italic,,|underline,,|strikethrough,,|subscript,,|superscript,,|font,,fontname,|size,Font Size,fontsize,|style,,formatblock,|color,Font Color,forecolor,|highlight,Text Highlight Color,hilitecolor,color|removeformat,Remove Formatting,|bullets,,insertunorderedlist|numbering,,insertorderedlist|outdent,,|indent,,|alignleft,Align Text Left,justifyleft|center,,justifycenter|alignright,Align Text Right,justifyright|justify,,justifyfull|undo,,|redo,,|rule,Insert Horizontal Rule,inserthorizontalrule|image,Insert Image,insertimage,url|link,Insert Hyperlink,createlink,url|unlink,Remove Hyperlink,|cut,,|copy,,|paste,,|pastetext,Paste as Text,inserthtml,|print,,|source,Show Source"},
imagesPath:function(){return U()}};e.fn.cleditor=function(a){var b=e([]);this.each(function(c,d){if(d.tagName=="TEXTAREA"){var h=e.data(d,Y);h||(h=new cleditor(d,a));b=b.add(h)}});return b};var H="backgroundColor",A="button",x="buttonName",F="change",Y="cleditor",q="click",n="disabled",m="<div>",I="unselectable",W="cleditorButton",X="cleditorDisabled",ca="cleditorPopup",S="cleditorList",da="cleditorColor",B="cleditorPrompt",fa="cleditorMsg",l=e.browser.msie,ea=/msie\s6/i.test(navigator.userAgent),
L=/iphone|ipad|ipod/i.test(navigator.userAgent),p={},Z,s=e.cleditor.buttons;e.each(s.init.split("|"),function(a,b){var c=b.split(","),d=c[0];s[d]={stripIndex:a,name:d,title:c[1]===""?d.charAt(0).toUpperCase()+d.substr(1):c[1],command:c[2]===""?d:c[2],popupName:c[3]===""?d:c[3]}});delete s.init;cleditor=function(a,b){var c=this;c.options=b=e.extend({},e.cleditor.defaultOptions,b);var d=c.$area=e(a).hide().data(Y,c).blur(function(){E(c,true)}),h=c.$main=e(m).addClass("cleditorMain").width(b.width).height(b.height),
f=c.$toolbar=e(m).addClass("cleditorToolbar").appendTo(h),i=e(m).addClass("cleditorGroup").appendTo(f);e.each(b.controls.split(" "),function(g,j){if(j==="")return true;if(j=="|"){e(m).addClass("cleditorDivider").appendTo(i);i=e(m).addClass("cleditorGroup").appendTo(f)}else{var k=s[j],o=e(m).data(x,k.name).addClass(W).attr("title",k.title).bind(q,e.proxy(aa,c)).appendTo(i).hover(O,P),G={};if(k.css)G=k.css;else if(k.image)G.backgroundImage="url("+U()+k.image+")";if(k.stripIndex)G.backgroundPosition=
k.stripIndex*-24;o.css(G);l&&o.attr(I,"on");k.popupName&&R(k.popupName,b,k.popupClass,k.popupContent,k.popupHover)}});h.insertBefore(d).append(d);if(!Z){e(document).click(function(g){g=e(g.target);g.add(g.parents()).is("."+B)||r()});Z=true}/auto|%/.test(""+b.width+b.height)&&e(window).resize(function(){K(c)});K(c)};var $=cleditor.prototype;e.each([["clear",function(a){a.$area.val("");E(a)}],["disable",T],["execCommand",v],["focus",w],["hidePopups",r],["sourceMode",t,true],["refresh",K],["select",
function(a){setTimeout(function(){t(a)?a.$area.select():v(a,"selectall")},0)}],["selectedHTML",function(a){D(a);a=y(a);if(l)return a.htmlText;var b=e("<layer>")[0];b.appendChild(a.cloneContents());return b.innerHTML},true],["selectedText",M,true],["showMessage",z],["updateFrame",E],["updateTextArea",V]],function(a,b){$[b[0]]=function(){for(var c=[this],d=0;d<arguments.length;d++)c.push(arguments[d]);c=b[1].apply(this,c);if(b[2])return c;return this}});$.change=function(a){var b=e(this);return a?b.bind(F,
a):b.trigger(F)}})(jQuery); |
ReactJS/class-2017-12-03/my-app/src/header/Header.js | tahashahid/cloud-computing-2017 | import React from 'react';
class Header extends React.Component {
render() {
return (
<div className="Header">
{ this.props.data }
{ this.props.data1 }
<br/>
{ this.props.data2.a + this.props.data2.b }
</div>
);
}
}
export default Header;
|
ajax/libs/react-native-web/0.12.2/exports/TouchableOpacity/index.min.js | cdnjs/cdnjs | "use strict";function _extends(){return(_extends=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var o=arguments[e];for(var s in o)Object.prototype.hasOwnProperty.call(o,s)&&(t[s]=o[s])}return t}).apply(this,arguments)}function ownKeys(t,e){var o=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,s)}return o}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(o),!0).forEach(function(e){_defineProperty(t,e,o[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):ownKeys(Object(o)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))})}return t}function _defineProperty(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}import applyNativeMethods from"../../modules/applyNativeMethods";import createReactClass from"create-react-class";import ensurePositiveDelayProps from"../Touchable/ensurePositiveDelayProps";import*as React from"react";import StyleSheet from"../StyleSheet";import Touchable from"../Touchable";import View from"../View";var flattenStyle=StyleSheet.flatten,PRESS_RETENTION_OFFSET={top:20,left:20,right:20,bottom:30},TouchableOpacity=createReactClass({displayName:"TouchableOpacity",mixins:[Touchable.Mixin.withoutDefaultFocusAndBlur],getDefaultProps:function(){return{activeOpacity:.2}},getInitialState:function(){return _objectSpread({},this.touchableGetInitialState(),{anim:this._getChildStyleOpacityWithDefault()})},componentDidMount:function(){ensurePositiveDelayProps(this.props)},UNSAFE_componentWillReceiveProps:function(t){ensurePositiveDelayProps(t)},componentDidUpdate:function(t,e){this.props.disabled!==t.disabled&&this._opacityInactive(250)},setOpacityTo:function(t,e){this.setNativeProps({style:{opacity:t,transitionDuration:e?e/1e3+"s":"0s"}})},touchableHandleActivePressIn:function(t){"onResponderGrant"===t.dispatchConfig.registrationName?this._opacityActive(0):this._opacityActive(150),this.props.onPressIn&&this.props.onPressIn(t)},touchableHandleActivePressOut:function(t){this._opacityInactive(250),this.props.onPressOut&&this.props.onPressOut(t)},touchableHandleFocus:function(t){this.props.onFocus&&this.props.onFocus(t)},touchableHandleBlur:function(t){this.props.onBlur&&this.props.onBlur(t)},touchableHandlePress:function(t){this.props.onPress&&this.props.onPress(t)},touchableHandleLongPress:function(t){this.props.onLongPress&&this.props.onLongPress(t)},touchableGetPressRectOffset:function(){return this.props.pressRetentionOffset||PRESS_RETENTION_OFFSET},touchableGetHitSlop:function(){return this.props.hitSlop},touchableGetHighlightDelayMS:function(){return this.props.delayPressIn||0},touchableGetLongPressDelayMS:function(){return 0===this.props.delayLongPress?0:this.props.delayLongPress||500},touchableGetPressOutDelayMS:function(){return this.props.delayPressOut},_opacityActive:function(t){this.setOpacityTo(this.props.activeOpacity,t)},_opacityInactive:function(t){this.setOpacityTo(this._getChildStyleOpacityWithDefault(),t)},_getChildStyleOpacityWithDefault:function(){var t=flattenStyle(this.props.style)||{};return null==t.opacity?1:t.opacity},render:function(){return React.createElement(View,_extends({},this.props,{accessibilityHint:this.props.accessibilityHint,accessibilityLabel:this.props.accessibilityLabel,accessibilityRole:this.props.accessibilityRole,accessibilityState:this.props.accessibilityState,accessible:!1!==this.props.accessible,hitSlop:this.props.hitSlop,nativeID:this.props.nativeID,onKeyDown:this.touchableHandleKeyEvent,onKeyUp:this.touchableHandleKeyEvent,onLayout:this.props.onLayout,onResponderGrant:this.touchableHandleResponderGrant,onResponderMove:this.touchableHandleResponderMove,onResponderRelease:this.touchableHandleResponderRelease,onResponderTerminate:this.touchableHandleResponderTerminate,onResponderTerminationRequest:this.touchableHandleResponderTerminationRequest,onStartShouldSetResponder:this.touchableHandleStartShouldSetResponder,style:[styles.root,!this.props.disabled&&styles.actionable,this.props.style,{opacity:this.state.anim}],testID:this.props.testID}),this.props.children,Touchable.renderDebugView({color:"cyan",hitSlop:this.props.hitSlop}))}}),styles=StyleSheet.create({root:{transitionProperty:"opacity",transitionDuration:"0.15s",userSelect:"none"},actionable:{cursor:"pointer",touchAction:"manipulation"}});export default applyNativeMethods(TouchableOpacity); |
ui/src/pages/PeopleManagePage/IdentifiersViewer/SavedRow.js | LearningLocker/learninglocker | import React from 'react';
import { compose, withProps } from 'recompose';
import styled from 'styled-components';
import { withModel } from 'ui/utils/hocs';
import { identifierTypeDisplays } from '../constants';
import IfiViewer from '../IfiViewer';
import { tableDataStyle } from './tableDataStyle';
const TableData = styled.td`${tableDataStyle}`;
const enhance = compose(
withProps({ schema: 'personaIdentifier' }),
withModel
);
const render = ({ model }) => {
const identifierType = model.getIn(['ifi', 'key']);
const identifierValue = model.getIn(['ifi', 'value']);
return (
<tr>
<TableData>
{identifierTypeDisplays[identifierType]}
</TableData>
<TableData>
<IfiViewer identifierType={identifierType} identifierValue={identifierValue} />
</TableData>
</tr>
);
};
export default enhance(render);
|
node_modules/react-tools/src/core/__tests__/ReactIdentity-test.js | wongherlung/react-resizable-component | /**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @emails react-core
*/
'use strict';
var React;
var ReactFragment;
var ReactTestUtils;
var reactComponentExpect;
var ReactMount;
describe('ReactIdentity', function() {
beforeEach(function() {
require('mock-modules').dumpCache();
React = require('React');
ReactFragment = require('ReactFragment');
ReactTestUtils = require('ReactTestUtils');
reactComponentExpect = require('reactComponentExpect');
ReactMount = require('ReactMount');
});
var idExp = /^\.[^.]+(.*)$/;
function checkId(child, expectedId) {
var actual = idExp.exec(ReactMount.getID(child));
var expected = idExp.exec(expectedId);
expect(actual).toBeTruthy();
expect(expected).toBeTruthy();
expect(actual[1]).toEqual(expected[1]);
}
function frag(obj) {
return ReactFragment.create(obj);
}
it('should allow keyed objects to express identity', function() {
var instance =
<div>
{frag({
first: <div />,
second: <div />
})}
</div>;
instance = React.render(instance, document.createElement('div'));
var node = instance.getDOMNode();
reactComponentExpect(instance).toBeDOMComponentWithChildCount(2);
checkId(node.childNodes[0], '.0.$first:0');
checkId(node.childNodes[1], '.0.$second:0');
});
it('should allow key property to express identity', function() {
var instance =
<div>
<div key="apple" />
<div key="banana" />
<div key={0} />
<div key={123} />
</div>;
instance = React.render(instance, document.createElement('div'));
var node = instance.getDOMNode();
reactComponentExpect(instance).toBeDOMComponentWithChildCount(4);
checkId(node.childNodes[0], '.0.$apple');
checkId(node.childNodes[1], '.0.$banana');
checkId(node.childNodes[2], '.0.$0');
checkId(node.childNodes[3], '.0.$123');
});
it('should use instance identity', function() {
var Wrapper = React.createClass({
render: function() {
return <a key="i_get_overwritten">{this.props.children}</a>;
}
});
var instance =
<div>
<Wrapper key="wrap1"><span key="squirrel" /></Wrapper>
<Wrapper key="wrap2"><span key="bunny" /></Wrapper>
<Wrapper><span key="chipmunk" /></Wrapper>
</div>;
instance = React.render(instance, document.createElement('div'));
var node = instance.getDOMNode();
reactComponentExpect(instance).toBeDOMComponentWithChildCount(3);
checkId(node.childNodes[0], '.0.$wrap1');
checkId(node.childNodes[0].firstChild, '.0.$wrap1.$squirrel');
checkId(node.childNodes[1], '.0.$wrap2');
checkId(node.childNodes[1].firstChild, '.0.$wrap2.$bunny');
checkId(node.childNodes[2], '.0.2');
checkId(node.childNodes[2].firstChild, '.0.2.$chipmunk');
});
function renderAComponentWithKeyIntoContainer(key, container) {
var Wrapper = React.createClass({
render: function() {
var span1 = <span ref="span1" key={key} />;
var span2 = <span ref="span2" />;
var map = {};
map[key] = span2;
return <div>{[span1, frag(map)]}</div>;
}
});
var instance = React.render(<Wrapper />, container);
var span1 = instance.refs.span1;
var span2 = instance.refs.span2;
expect(span1.getDOMNode()).not.toBe(null);
expect(span2.getDOMNode()).not.toBe(null);
key = key.replace(/=/g, '=0');
checkId(span1.getDOMNode(), '.0.$' + key);
checkId(span2.getDOMNode(), '.0.1:$' + key + ':0');
}
it('should allow any character as a key, in a detached parent', function() {
var detachedContainer = document.createElement('div');
renderAComponentWithKeyIntoContainer("<'WEIRD/&\\key'>", detachedContainer);
});
it('should allow any character as a key, in an attached parent', function() {
// This test exists to protect against implementation details that
// incorrectly query escaped IDs using DOM tools like getElementById.
var attachedContainer = document.createElement('div');
document.body.appendChild(attachedContainer);
renderAComponentWithKeyIntoContainer("<'WEIRD/&\\key'>", attachedContainer);
document.body.removeChild(attachedContainer);
});
it('should not allow scripts in keys to execute', function() {
var h4x0rKey =
'"><script>window[\'YOUVEBEENH4X0RED\']=true;</script><div id="';
var attachedContainer = document.createElement('div');
document.body.appendChild(attachedContainer);
renderAComponentWithKeyIntoContainer(h4x0rKey, attachedContainer);
document.body.removeChild(attachedContainer);
// If we get this far, make sure we haven't executed the code
expect(window.YOUVEBEENH4X0RED).toBe(undefined);
});
it('should let restructured components retain their uniqueness', function() {
var instance0 = <span />;
var instance1 = <span />;
var instance2 = <span />;
var TestComponent = React.createClass({
render: function() {
return (
<div>
{instance2}
{this.props.children[0]}
{this.props.children[1]}
</div>
);
}
});
var TestContainer = React.createClass({
render: function() {
return <TestComponent>{instance0}{instance1}</TestComponent>;
}
});
expect(function() {
ReactTestUtils.renderIntoDocument(<TestContainer />);
}).not.toThrow();
});
it('should let nested restructures retain their uniqueness', function() {
var instance0 = <span />;
var instance1 = <span />;
var instance2 = <span />;
var TestComponent = React.createClass({
render: function() {
return (
<div>
{instance2}
{this.props.children[0]}
{this.props.children[1]}
</div>
);
}
});
var TestContainer = React.createClass({
render: function() {
return (
<div>
<TestComponent>{instance0}{instance1}</TestComponent>
</div>
);
}
});
expect(function() {
ReactTestUtils.renderIntoDocument(<TestContainer />);
}).not.toThrow();
});
it('should let text nodes retain their uniqueness', function() {
var TestComponent = React.createClass({
render: function() {
return <div>{this.props.children}<span /></div>;
}
});
var TestContainer = React.createClass({
render: function() {
return (
<TestComponent>
<div />
{'second'}
</TestComponent>
);
}
});
expect(function() {
ReactTestUtils.renderIntoDocument(<TestContainer />);
}).not.toThrow();
});
it('should retain key during updates in composite components', function() {
var TestComponent = React.createClass({
render: function() {
return <div>{this.props.children}</div>;
}
});
var TestContainer = React.createClass({
getInitialState: function() {
return {swapped: false};
},
swap: function() {
this.setState({swapped: true});
},
render: function() {
return (
<TestComponent>
{this.state.swapped ? this.props.second : this.props.first}
{this.state.swapped ? this.props.first : this.props.second}
</TestComponent>
);
}
});
var instance0 = <span key="A" />;
var instance1 = <span key="B" />;
var wrapped = <TestContainer first={instance0} second={instance1} />;
wrapped = React.render(wrapped, document.createElement('div'));
var beforeID = ReactMount.getID(wrapped.getDOMNode().firstChild);
wrapped.swap();
var afterID = ReactMount.getID(wrapped.getDOMNode().firstChild);
expect(beforeID).not.toEqual(afterID);
});
it('should not allow implicit and explicit keys to collide', function() {
var component =
<div>
<span />
<span key="0" />
</div>;
expect(function() {
ReactTestUtils.renderIntoDocument(component);
}).not.toThrow();
});
});
|
packages/react-noop-renderer/src/ReactNoopFlightServer.js | Simek/react | /**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
/**
* This is a renderer of React that doesn't have a render target output.
* It is useful to demonstrate the internals of the reconciler in isolation
* and for testing semantics of reconciliation separate from the host
* environment.
*/
import type {ReactModel} from 'react-server/flight.inline-typed';
import ReactFlightServer from 'react-server/flight';
type Destination = Array<string>;
const ReactNoopFlightServer = ReactFlightServer({
scheduleWork(callback: () => void) {
callback();
},
beginWriting(destination: Destination): void {},
writeChunk(destination: Destination, buffer: Uint8Array): void {
destination.push(Buffer.from((buffer: any)).toString('utf8'));
},
completeWriting(destination: Destination): void {},
close(destination: Destination): void {},
flushBuffered(destination: Destination): void {},
convertStringToBuffer(content: string): Uint8Array {
return Buffer.from(content, 'utf8');
},
formatChunkAsString(type: string, props: Object): string {
return JSON.stringify({type, props});
},
formatChunk(type: string, props: Object): Uint8Array {
return Buffer.from(JSON.stringify({type, props}), 'utf8');
},
renderHostChildrenToString(children: React$Element<any>): string {
throw new Error('The noop rendered do not support host components');
},
});
function render(model: ReactModel): Destination {
let destination: Destination = [];
let request = ReactNoopFlightServer.createRequest(model, destination);
ReactNoopFlightServer.startWork(request);
return destination;
}
export default {
render,
};
|
src/index.js | react-hack-night/reactSocial | // Import NPM dependencies like this:
import React from 'react';
import ReactDOM from 'react-dom';
import {Grid} from 'react-bootstrap';
// Import styles like this:
import './styles/main.scss';
import Main from './components/main';
import Insta from './components/instagram';
// Import dependencies like this:
import Giphy from './components/giphy.js';
class App extends React.Component {
render() {
return (
<Grid>
<Main />
</Grid>
);
}
}
ReactDOM.render(<App />, document.getElementById('app'));
|
node_modules/react-native/Libraries/CameraRoll/CameraRoll.js | 15chrjef/mobileHackerNews | /**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule CameraRoll
* @flow
*/
'use strict';
var ReactPropTypes = require('React').PropTypes
var RCTCameraRollManager = require('NativeModules').CameraRollManager;
var createStrictShapeTypeChecker = require('createStrictShapeTypeChecker');
var deepFreezeAndThrowOnMutationInDev =
require('deepFreezeAndThrowOnMutationInDev');
var invariant = require('fbjs/lib/invariant');
var GROUP_TYPES_OPTIONS = [
'Album',
'All',
'Event',
'Faces',
'Library',
'PhotoStream',
'SavedPhotos', // default
];
var ASSET_TYPE_OPTIONS = [
'All',
'Videos',
'Photos', // default
];
// Flow treats Object and Array as disjoint types, currently.
deepFreezeAndThrowOnMutationInDev((GROUP_TYPES_OPTIONS: any));
deepFreezeAndThrowOnMutationInDev((ASSET_TYPE_OPTIONS: any));
/**
* Shape of the param arg for the `getPhotos` function.
*/
var getPhotosParamChecker = createStrictShapeTypeChecker({
/**
* The number of photos wanted in reverse order of the photo application
* (i.e. most recent first for SavedPhotos).
*/
first: ReactPropTypes.number.isRequired,
/**
* A cursor that matches `page_info { end_cursor }` returned from a previous
* call to `getPhotos`
*/
after: ReactPropTypes.string,
/**
* Specifies which group types to filter the results to.
*/
groupTypes: ReactPropTypes.oneOf(GROUP_TYPES_OPTIONS),
/**
* Specifies filter on group names, like 'Recent Photos' or custom album
* titles.
*/
groupName: ReactPropTypes.string,
/**
* Specifies filter on asset type
*/
assetType: ReactPropTypes.oneOf(ASSET_TYPE_OPTIONS),
/**
* Filter by mimetype (e.g. image/jpeg).
*/
mimeTypes: ReactPropTypes.arrayOf(ReactPropTypes.string),
});
/**
* Shape of the return value of the `getPhotos` function.
*/
var getPhotosReturnChecker = createStrictShapeTypeChecker({
edges: ReactPropTypes.arrayOf(createStrictShapeTypeChecker({
node: createStrictShapeTypeChecker({
type: ReactPropTypes.string.isRequired,
group_name: ReactPropTypes.string.isRequired,
image: createStrictShapeTypeChecker({
uri: ReactPropTypes.string.isRequired,
height: ReactPropTypes.number.isRequired,
width: ReactPropTypes.number.isRequired,
isStored: ReactPropTypes.bool,
}).isRequired,
timestamp: ReactPropTypes.number.isRequired,
location: createStrictShapeTypeChecker({
latitude: ReactPropTypes.number,
longitude: ReactPropTypes.number,
altitude: ReactPropTypes.number,
heading: ReactPropTypes.number,
speed: ReactPropTypes.number,
}),
}).isRequired,
})).isRequired,
page_info: createStrictShapeTypeChecker({
has_next_page: ReactPropTypes.bool.isRequired,
start_cursor: ReactPropTypes.string,
end_cursor: ReactPropTypes.string,
}).isRequired,
});
/**
* `CameraRoll` provides access to the local camera roll / gallery.
* Before using this you must link the `RCTCameraRoll` library.
* You can refer to [Linking](https://facebook.github.io/react-native/docs/linking-libraries-ios.html) for help.
*/
class CameraRoll {
static GroupTypesOptions: Array<string>;
static AssetTypeOptions: Array<string>;
static saveImageWithTag(tag: string): Promise<Object> {
console.warn('CameraRoll.saveImageWithTag is deprecated. Use CameraRoll.saveToCameraRoll instead');
return this.saveToCameraRoll(tag, 'photo');
}
/**
* Saves the photo or video to the camera roll / gallery.
*
* On Android, the tag must be a local image or video URI, such as `"file:///sdcard/img.png"`.
*
* On iOS, the tag can be any image URI (including local, remote asset-library and base64 data URIs)
* or a local video file URI (remote or data URIs are not supported for saving video at this time).
*
* If the tag has a file extension of .mov or .mp4, it will be inferred as a video. Otherwise
* it will be treated as a photo. To override the automatic choice, you can pass an optional
* `type` parameter that must be one of 'photo' or 'video'.
*
* Returns a Promise which will resolve with the new URI.
*/
static saveToCameraRoll(tag: string, type?: 'photo' | 'video'): Promise<Object> {
invariant(
typeof tag === 'string',
'CameraRoll.saveToCameraRoll must be a valid string.'
);
invariant(
type === 'photo' || type === 'video' || type === undefined,
// $FlowFixMe(>=0.28.0)
`The second argument to saveToCameraRoll must be 'photo' or 'video'. You passed ${type}`
);
let mediaType = 'photo';
if (type) {
mediaType = type;
} else if (['mov', 'mp4'].indexOf(tag.split('.').slice(-1)[0]) >= 0) {
mediaType = 'video';
}
return RCTCameraRollManager.saveToCameraRoll(tag, mediaType);
}
/**
* Returns a Promise with photo identifier objects from the local camera
* roll of the device matching shape defined by `getPhotosReturnChecker`.
*
* @param {object} params See `getPhotosParamChecker`.
*
* Returns a Promise which when resolved will be of shape `getPhotosReturnChecker`.
*/
static getPhotos(params) {
if (__DEV__) {
getPhotosParamChecker({params}, 'params', 'CameraRoll.getPhotos');
}
if (arguments.length > 1) {
console.warn('CameraRoll.getPhotos(tag, success, error) is deprecated. Use the returned Promise instead');
let successCallback = arguments[1];
if (__DEV__) {
const callback = arguments[1];
successCallback = (response) => {
getPhotosReturnChecker(
{response},
'response',
'CameraRoll.getPhotos callback'
);
callback(response);
};
}
const errorCallback = arguments[2] || ( () => {} );
RCTCameraRollManager.getPhotos(params).then(successCallback, errorCallback);
}
// TODO: Add the __DEV__ check back in to verify the Promise result
return RCTCameraRollManager.getPhotos(params);
}
}
CameraRoll.GroupTypesOptions = GROUP_TYPES_OPTIONS;
CameraRoll.AssetTypeOptions = ASSET_TYPE_OPTIONS;
module.exports = CameraRoll;
|
src/views/Card/CardContent.js | aabustamante/Semantic-UI-React | import cx from 'classnames'
import _ from 'lodash'
import PropTypes from 'prop-types'
import React from 'react'
import {
createShorthand,
customPropTypes,
getElementType,
getUnhandledProps,
META,
useKeyOnly,
} from '../../lib'
import CardDescription from './CardDescription'
import CardHeader from './CardHeader'
import CardMeta from './CardMeta'
/**
* A card can contain blocks of content or extra content meant to be formatted separately from the main content.
*/
function CardContent(props) {
const {
children,
className,
description,
extra,
header,
meta,
} = props
const classes = cx(
className,
useKeyOnly(extra, 'extra'),
'content',
)
const rest = getUnhandledProps(CardContent, props)
const ElementType = getElementType(CardContent, props)
if (!_.isNil(children)) {
return <ElementType {...rest} className={classes}>{children}</ElementType>
}
return (
<ElementType {...rest} className={classes}>
{createShorthand(CardHeader, val => ({ content: val }), header)}
{createShorthand(CardMeta, val => ({ content: val }), meta)}
{createShorthand(CardDescription, val => ({ content: val }), description)}
</ElementType>
)
}
CardContent._meta = {
name: 'CardContent',
parent: 'Card',
type: META.TYPES.VIEW,
}
CardContent.propTypes = {
/** An element type to render as (string or function). */
as: customPropTypes.as,
/** Primary content. */
children: PropTypes.node,
/** Additional classes. */
className: PropTypes.string,
/** Shorthand for CardDescription. */
description: customPropTypes.itemShorthand,
/** A card can contain extra content meant to be formatted separately from the main content. */
extra: PropTypes.bool,
/** Shorthand for CardHeader. */
header: customPropTypes.itemShorthand,
/** Shorthand for CardMeta. */
meta: customPropTypes.itemShorthand,
}
export default CardContent
|
src/pages/AssetsDepreciation.js | azedo/freelancer-calculator | // components/AssetsFixed.js
// main imports
import React, { Component } from 'react';
import { Link } from 'react-router';
// components import
import AssetForm from '../components/AssetForm';
import AssetTable from '../components/AssetTable';
class AssetsFixed extends Component {
render() {
return (
<div>
<h1><Link to="/app/assets">Assets</Link> / depreciation</h1>
<AssetForm addNewAsset={this.props.addNewAsset} type="depreciation" />
<AssetTable assets={this.props.assets.depreciation} currency={this.props.currency} removeAsset={this.props.removeAsset} type="depreciation" />
</div>
)
}
}
export default AssetsFixed ;
|
ajax/libs/elfinder/2.1.4/js/i18n/elfinder.nl.js | BenjaminVanRyseghem/cdnjs | /**
* Dutch translation
* @author Barry vd. Heuvel <barry@fruitcakestudio.nl>
* @version 2015-12-01
*/
if (elFinder && elFinder.prototype && typeof(elFinder.prototype.i18) == 'object') {
elFinder.prototype.i18.nl = {
translator : 'Barry vd. Heuvel <barry@fruitcakestudio.nl>',
language : 'Nederlands',
direction : 'ltr',
dateFormat : 'd-m-Y H:i', // Mar 13, 2012 05:27 PM
fancyDateFormat : '$1 H:i', // will produce smth like: Today 12:25 PM
messages : {
/********************************** errors **********************************/
'error' : 'Fout',
'errUnknown' : 'Onbekend fout.',
'errUnknownCmd' : 'Onbekend commando.',
'errJqui' : 'Ongeldige jQuery UI configuratie. Selectable, draggable en droppable componenten moeten aanwezig zijn.',
'errNode' : 'Voor elFinder moet een DOM Element gemaakt worden.',
'errURL' : 'Ongeldige elFinder configuratie! URL optie is niet ingesteld.',
'errAccess' : 'Toegang geweigerd.',
'errConnect' : 'Kan geen verbinding met de backend maken.',
'errAbort' : 'Verbinding afgebroken.',
'errTimeout' : 'Verbinding time-out.',
'errNotFound' : 'Backend niet gevonden.',
'errResponse' : 'Ongeldige reactie van de backend.',
'errConf' : 'Ongeldige backend configuratie.',
'errJSON' : 'PHP JSON module niet geïnstalleerd.',
'errNoVolumes' : 'Leesbaar volume is niet beschikbaar.',
'errCmdParams' : 'Ongeldige parameters voor commando "$1".',
'errDataNotJSON' : 'Data is niet JSON.',
'errDataEmpty' : 'Data is leeg.',
'errCmdReq' : 'Backend verzoek heeft een commando naam nodig.',
'errOpen' : 'Kan "$1" niet openen.',
'errNotFolder' : 'Object is geen map.',
'errNotFile' : 'Object is geen bestand.',
'errRead' : 'Kan "$1" niet lezen.',
'errWrite' : 'Kan niet schrijven in "$1".',
'errPerm' : 'Toegang geweigerd.',
'errLocked' : '"$1" is vergrendeld en kan niet hernoemd, verplaats of verwijderd worden.',
'errExists' : 'Bestand "$1" bestaat al.',
'errInvName' : 'Ongeldige bestandsnaam.',
'errFolderNotFound' : 'Map niet gevonden.',
'errFileNotFound' : 'Bestand niet gevonden.',
'errTrgFolderNotFound' : 'Doelmap"$1" niet gevonden.',
'errPopup' : 'De browser heeft voorkomen dat de pop-up is geopend. Pas de browser instellingen aan om de popup te kunnen openen.',
'errMkdir' : 'Kan map "$1" niet aanmaken.',
'errMkfile' : 'Kan bestand "$1" niet aanmaken.',
'errRename' : 'Kan "$1" niet hernoemen.',
'errCopyFrom' : 'Bestanden kopiëren van "$1" is niet toegestaan.',
'errCopyTo' : 'Bestanden kopiëren naar "$1" is niet toegestaan.',
'errMkOutLink' : 'Kan geen link maken buiten de hoofdmap.', // from v2.1 added 03.10.2015
'errUpload' : 'Upload fout.', // old name - errUploadCommon
'errUploadFile' : 'Kan "$1" niet uploaden.', // old name - errUpload
'errUploadNoFiles' : 'Geen bestanden gevonden om te uploaden.',
'errUploadTotalSize' : 'Data overschrijdt de maximale grootte.', // old name - errMaxSize
'errUploadFileSize' : 'Bestand overschrijdt de maximale grootte.', // old name - errFileMaxSize
'errUploadMime' : 'Bestandstype niet toegestaan.',
'errUploadTransfer' : '"$1" overdrachtsfout.',
'errUploadTemp' : 'Kan geen tijdelijk bestand voor de upload maken.', // from v2.1 added 26.09.2015
'errNotReplace' : 'Object "$1" bestaat al op deze locatie en kan niet vervangen worden door een ander type object.', // new
'errReplace' : 'Kan "$1" niet vervangen.',
'errSave' : 'Kan "$1" niet opslaan.',
'errCopy' : 'Kan "$1" niet kopiëren.',
'errMove' : 'Kan "$1" niet verplaatsen.',
'errCopyInItself' : 'Kan "$1" niet in zichzelf kopiëren.',
'errRm' : 'Kan "$1" niet verwijderen.',
'errRmSrc' : 'Kan bronbestanden niet verwijderen.',
'errExtract' : 'Kan de bestanden van "$1" niet uitpakken.',
'errArchive' : 'Kan het archief niet maken.',
'errArcType' : 'Archief type is niet ondersteund.',
'errNoArchive' : 'Bestand is geen archief of geen ondersteund archief type.',
'errCmdNoSupport' : 'Backend ondersteund dit commando niet.',
'errReplByChild' : 'De map "$1" kan niet vervangen worden door een item uit die map.',
'errArcSymlinks' : 'Om veiligheidsredenen kan een bestand met symlinks of bestanden met niet toegestane namen niet worden uitgepakt .', // edited 24.06.2012
'errArcMaxSize' : 'Archief overschrijdt de maximale bestandsgrootte.',
'errResize' : 'Kan het formaat van "$1" niet wijzigen.',
'errResizeDegree' : 'Ongeldig aantal graden om te draaien.', // added 7.3.2013
'errResizeRotate' : 'Afbeelding kan niet gedraaid worden.', // added 7.3.2013
'errResizeSize' : 'Ongeldig afbeelding formaat.', // added 7.3.2013
'errResizeNoChange' : 'Afbeelding formaat is niet veranderd.', // added 7.3.2013
'errUsupportType' : 'Bestandstype wordt niet ondersteund.',
'errNotUTF8Content' : 'Bestand "$1" is niet in UTF-8 and kan niet aangepast worden.', // added 9.11.2011
'errNetMount' : 'Kan "$1" niet mounten.', // added 17.04.2012
'errNetMountNoDriver' : 'Niet ondersteund protocol.', // added 17.04.2012
'errNetMountFailed' : 'Mount mislukt.', // added 17.04.2012
'errNetMountHostReq' : 'Host is verplicht.', // added 18.04.2012
'errSessionExpires' : 'Uw sessie is verlopen vanwege inactiviteit.',
'errCreatingTempDir' : 'Kan de tijdelijke map niet aanmaken: "$1" ',
'errFtpDownloadFile' : 'Kan het bestand niet downloaden vanaf FTP: "$1"',
'errFtpUploadFile' : 'Kan het bestand niet uploaden naar FTP: "$1"',
'errFtpMkdir' : 'Kan het externe map niet aanmaken op de FTP-server: "$1"',
'errArchiveExec' : 'Er is een fout opgetreden bij het archivering van de bestanden: "$1" ',
'errExtractExec' : 'Er is een fout opgetreden bij het uitpakken van de bestanden: "$1" ',
'errNetUnMount' : 'Kan niet unmounten', // from v2.1 added 30.04.2012
'errConvUTF8' : 'Kan niet converteren naar UTF-8', // from v2.1 added 08.04.2014
'errFolderUpload' : 'Probeer Google Chrome, als je de map wil uploaden.', // from v2.1 added 26.6.2015
/******************************* commands names ********************************/
'cmdarchive' : 'Maak archief',
'cmdback' : 'Vorige',
'cmdcopy' : 'Kopieer',
'cmdcut' : 'Knip',
'cmddownload' : 'Download',
'cmdduplicate' : 'Dupliceer',
'cmdedit' : 'Pas bestand aan',
'cmdextract' : 'Bestanden uit archief uitpakken',
'cmdforward' : 'Volgende',
'cmdgetfile' : 'Kies bestanden',
'cmdhelp' : 'Over deze software',
'cmdhome' : 'Home',
'cmdinfo' : 'Bekijk info',
'cmdmkdir' : 'Nieuwe map',
'cmdmkfile' : 'Nieuw tekstbestand',
'cmdopen' : 'Open',
'cmdpaste' : 'Plak',
'cmdquicklook' : 'Voorbeeld',
'cmdreload' : 'Vernieuwen',
'cmdrename' : 'Naam wijzigen',
'cmdrm' : 'Verwijder',
'cmdsearch' : 'Zoek bestanden',
'cmdup' : 'Ga een map hoger',
'cmdupload' : 'Upload bestanden',
'cmdview' : 'Bekijk',
'cmdresize' : 'Formaat wijzigen',
'cmdsort' : 'Sorteren',
'cmdnetmount' : 'Mount netwerk volume', // added 18.04.2012
'cmdnetunmount': 'Unmount', // from v2.1 added 30.04.2012
'cmdplaces' : 'Naar Plaatsen', // added 28.12.2014
'cmdchmod' : 'Wijzig modus', // from v2.1 added 20.6.2015
/*********************************** buttons ***********************************/
'btnClose' : 'Sluit',
'btnSave' : 'Opslaan',
'btnRm' : 'Verwijder',
'btnApply' : 'Toepassen',
'btnCancel' : 'Annuleren',
'btnNo' : 'Nee',
'btnYes' : 'Ja',
'btnMount' : 'Mount', // added 18.04.2012
'btnApprove': 'Ga naar $1 & keur goed', // from v2.1 added 26.04.2012
'btnUnmount': 'Unmount', // from v2.1 added 30.04.2012
'btnConv' : 'Converteer', // from v2.1 added 08.04.2014
'btnCwd' : 'Hier', // from v2.1 added 22.5.2015
'btnVolume' : 'Volume', // from v2.1 added 22.5.2015
'btnAll' : 'Alles', // from v2.1 added 22.5.2015
'btnMime' : 'MIME Type', // from v2.1 added 22.5.2015
'btnFileName':'Bestandsnaam', // from v2.1 added 22.5.2015
'btnSaveClose': 'Opslaan & Sluiten', // from v2.1 added 12.6.2015
'btnBackup' : 'Back-up', // fromv2.1 added 28.11.2015
/******************************** notifications ********************************/
'ntfopen' : 'Bezig met openen van map',
'ntffile' : 'Bezig met openen bestand',
'ntfreload' : 'Herladen map inhoud',
'ntfmkdir' : 'Bezig met map maken',
'ntfmkfile' : 'Bezig met Bestanden maken',
'ntfrm' : 'Verwijderen bestanden',
'ntfcopy' : 'Kopieer bestanden',
'ntfmove' : 'Verplaats bestanden',
'ntfprepare' : 'Voorbereiden kopiëren',
'ntfrename' : 'Hernoem bestanden',
'ntfupload' : 'Bestanden uploaden actief',
'ntfdownload' : 'Bestanden downloaden actief',
'ntfsave' : 'Bestanden opslaan',
'ntfarchive' : 'Archief aan het maken',
'ntfextract' : 'Bestanden uitpakken actief',
'ntfsearch' : 'Zoeken naar bestanden',
'ntfresize' : 'Formaat wijzigen van afbeeldingen',
'ntfsmth' : 'Iets aan het doen',
'ntfloadimg' : 'Laden van plaatje',
'ntfnetmount' : 'Mounten van netwerk volume', // added 18.04.2012
'ntfnetunmount': 'Unmounten van netwerk volume', // from v2.1 added 30.04.2012
'ntfdim' : 'Opvragen afbeeldingen dimensies', // added 20.05.2013
'ntfreaddir' : 'Map informatie lezen', // from v2.1 added 01.07.2013
'ntfurl' : 'URL van link ophalen', // from v2.1 added 11.03.2014
'ntfchmod' : 'Bestandsmodus wijzigen', // from v2.1 added 20.6.2015
'ntfpreupload': 'Upload bestandsnaam verifiëren', // from v2.1 added 31.11.2015
/************************************ dates **********************************/
'dateUnknown' : 'onbekend',
'Today' : 'Vandaag',
'Yesterday' : 'Gisteren',
'msJan' : 'Jan',
'msFeb' : 'Feb',
'msMar' : 'Mar',
'msApr' : 'Apr',
'msMay' : 'Mei',
'msJun' : 'Jun',
'msJul' : 'Jul',
'msAug' : 'Aug',
'msSep' : 'Sep',
'msOct' : 'Okt',
'msNov' : 'Nov',
'msDec' : 'Dec',
'January' : 'Januari',
'February' : 'Februari',
'March' : 'Maart',
'April' : 'April',
'May' : 'Mei',
'June' : 'Juni',
'July' : 'Juli',
'August' : 'Augustus',
'September' : 'September',
'October' : 'Oktober',
'November' : 'November',
'December' : 'December',
'Sunday' : 'Zondag',
'Monday' : 'Maandag',
'Tuesday' : 'Dinsdag',
'Wednesday' : 'Woensdag',
'Thursday' : 'Donderdag',
'Friday' : 'Vrijdag',
'Saturday' : 'Zaterdag',
'Sun' : 'Zo',
'Mon' : 'Ma',
'Tue' : 'Di',
'Wed' : 'Wo',
'Thu' : 'Do',
'Fri' : 'Vr',
'Sat' : 'Za',
/******************************** sort variants ********************************/
'sortname' : 'op naam',
'sortkind' : 'op type',
'sortsize' : 'op grootte',
'sortdate' : 'op datum',
'sortFoldersFirst' : 'Mappen eerst',
/********************************** new items **********************************/
'untitled file.txt' : 'NieuwBestand.txt', // added 10.11.2015
'untitled folder' : 'NieuweMap', // added 10.11.2015
'Archive' : 'NieuwArchief', // from v2.1 added 10.11.2015
/********************************** messages **********************************/
'confirmReq' : 'Bevestiging nodig',
'confirmRm' : 'Weet u zeker dat u deze bestanden wil verwijderen?<br/>Deze actie kan niet ongedaan gemaakt worden!',
'confirmRepl' : 'Oud bestand vervangen door het nieuwe bestand?',
'confirmConvUTF8' : 'Niet in UTF-8<br/>Converteren naar UTF-8?<br/>De inhoud wordt UTF-8 door op te slaan na de conversie.', // from v2.1 added 08.04.2014
'confirmNotSave' : 'Het is aangepast.<br/>Wijzigingen gaan verloren als je niet opslaat.', // from v2.1 added 15.7.2015
'apllyAll' : 'Toepassen op alles',
'name' : 'Naam',
'size' : 'Grootte',
'perms' : 'Rechten',
'modify' : 'Aangepast',
'kind' : 'Type',
'read' : 'lees',
'write' : 'schrijf',
'noaccess' : 'geen toegang',
'and' : 'en',
'unknown' : 'onbekend',
'selectall' : 'Selecteer alle bestanden',
'selectfiles' : 'Selecteer bestand(en)',
'selectffile' : 'Selecteer eerste bestand',
'selectlfile' : 'Selecteer laatste bestand',
'viewlist' : 'Lijst weergave',
'viewicons' : 'Icoon weergave',
'places' : 'Plaatsen',
'calc' : 'Bereken',
'path' : 'Pad',
'aliasfor' : 'Alias voor',
'locked' : 'Vergrendeld',
'dim' : 'Dimensies',
'files' : 'Bestanden',
'folders' : 'Mappen',
'items' : 'Items',
'yes' : 'ja',
'no' : 'nee',
'link' : 'Link',
'searcresult' : 'Zoek resultaten',
'selected' : 'geselecteerde items',
'about' : 'Over',
'shortcuts' : 'Snelkoppelingen',
'help' : 'Help',
'webfm' : 'Web bestandsmanager',
'ver' : 'Versie',
'protocolver' : 'protocol versie',
'homepage' : 'Project home',
'docs' : 'Documentatie',
'github' : 'Fork ons op Github',
'twitter' : 'Volg ons op twitter',
'facebook' : 'Wordt lid op facebook',
'team' : 'Team',
'chiefdev' : 'Hoofd ontwikkelaar',
'developer' : 'ontwikkelaar',
'contributor' : 'bijdrager',
'maintainer' : 'onderhouder',
'translator' : 'vertaler',
'icons' : 'Iconen',
'dontforget' : 'En vergeet je handdoek niet!',
'shortcutsof' : 'Snelkoppelingen uitgeschakeld',
'dropFiles' : 'Sleep hier uw bestanden heen',
'or' : 'of',
'selectForUpload' : 'Selecteer bestanden om te uploaden',
'moveFiles' : 'Verplaats bestanden',
'copyFiles' : 'Kopieer bestanden',
'rmFromPlaces' : 'Verwijder uit Plaatsen',
'aspectRatio' : 'Aspect ratio',
'scale' : 'Schaal',
'width' : 'Breedte',
'height' : 'Hoogte',
'resize' : 'Verkleinen',
'crop' : 'Bijsnijden',
'rotate' : 'Draaien',
'rotate-cw' : 'Draai 90 graden rechtsom',
'rotate-ccw' : 'Draai 90 graden linksom',
'degree' : '°',
'netMountDialogTitle' : 'Mount netwerk volume', // added 18.04.2012
'protocol' : 'Protocol', // added 18.04.2012
'host' : 'Host', // added 18.04.2012
'port' : 'Poort', // added 18.04.2012
'user' : 'Gebruikersnaams', // added 18.04.2012
'pass' : 'Wachtwoord', // added 18.04.2012
'confirmUnmount' : 'Weet u zeker dat u $1 wil unmounten?', // from v2.1 added 30.04.2012
'dropFilesBrowser': 'Sleep of plak bestanden vanuit de browser', // from v2.1 added 30.05.2012
'dropPasteFiles' : 'Sleep of plak bestanden hier', // from v2.1 added 07.04.2014
'encoding' : 'Encodering', // from v2.1 added 19.12.2014
'locale' : 'Locale', // from v2.1 added 19.12.2014
'searchTarget' : 'Doel: $1', // from v2.1 added 22.5.2015
'searchMime' : 'Zoek op invoer MIME Type', // from v2.1 added 22.5.2015
'owner' : 'Eigenaar', // from v2.1 added 20.6.2015
'group' : 'Groep', // from v2.1 added 20.6.2015
'other' : 'Overig', // from v2.1 added 20.6.2015
'execute' : 'Uitvoeren', // from v2.1 added 20.6.2015
'perm' : 'Rechten', // from v2.1 added 20.6.2015
'mode' : 'Modus', // from v2.1 added 20.6.2015
/********************************** mimetypes **********************************/
'kindUnknown' : 'Onbekend',
'kindFolder' : 'Map',
'kindAlias' : 'Alias',
'kindAliasBroken' : 'Kapot alias',
// applications
'kindApp' : 'Applicatie',
'kindPostscript' : 'Postscript document',
'kindMsOffice' : 'Microsoft Office document',
'kindMsWord' : 'Microsoft Word document',
'kindMsExcel' : 'Microsoft Excel document',
'kindMsPP' : 'Microsoft Powerpoint presentation',
'kindOO' : 'Open Office document',
'kindAppFlash' : 'Flash applicatie',
'kindPDF' : 'Portable Document Format (PDF)',
'kindTorrent' : 'Bittorrent bestand',
'kind7z' : '7z archief',
'kindTAR' : 'TAR archief',
'kindGZIP' : 'GZIP archief',
'kindBZIP' : 'BZIP archief',
'kindXZ' : 'XZ archief',
'kindZIP' : 'ZIP archief',
'kindRAR' : 'RAR archief',
'kindJAR' : 'Java JAR bestand',
'kindTTF' : 'True Type font',
'kindOTF' : 'Open Type font',
'kindRPM' : 'RPM package',
// texts
'kindText' : 'Tekst bestand',
'kindTextPlain' : 'Tekst',
'kindPHP' : 'PHP bronbestand',
'kindCSS' : 'Cascading style sheet',
'kindHTML' : 'HTML document',
'kindJS' : 'Javascript bronbestand',
'kindRTF' : 'Rich Text Format',
'kindC' : 'C bronbestand',
'kindCHeader' : 'C header bronbestand',
'kindCPP' : 'C++ bronbestand',
'kindCPPHeader' : 'C++ header bronbestand',
'kindShell' : 'Unix shell script',
'kindPython' : 'Python bronbestand',
'kindJava' : 'Java bronbestand',
'kindRuby' : 'Ruby bronbestand',
'kindPerl' : 'Perl bronbestand',
'kindSQL' : 'SQL bronbestand',
'kindXML' : 'XML document',
'kindAWK' : 'AWK bronbestand',
'kindCSV' : 'Komma gescheiden waardes',
'kindDOCBOOK' : 'Docbook XML document',
'kindMarkdown' : 'Markdown tekst', // added 20.7.2015
// images
'kindImage' : 'Afbeelding',
'kindBMP' : 'BMP afbeelding',
'kindJPEG' : 'JPEG afbeelding',
'kindGIF' : 'GIF afbeelding',
'kindPNG' : 'PNG afbeelding',
'kindTIFF' : 'TIFF afbeelding',
'kindTGA' : 'TGA afbeelding',
'kindPSD' : 'Adobe Photoshop afbeelding',
'kindXBITMAP' : 'X bitmap afbeelding',
'kindPXM' : 'Pixelmator afbeelding',
// media
'kindAudio' : 'Audio media',
'kindAudioMPEG' : 'MPEG audio',
'kindAudioMPEG4' : 'MPEG-4 audio',
'kindAudioMIDI' : 'MIDI audio',
'kindAudioOGG' : 'Ogg Vorbis audio',
'kindAudioWAV' : 'WAV audio',
'AudioPlaylist' : 'MP3 playlist',
'kindVideo' : 'Video media',
'kindVideoDV' : 'DV video',
'kindVideoMPEG' : 'MPEG video',
'kindVideoMPEG4' : 'MPEG-4 video',
'kindVideoAVI' : 'AVI video',
'kindVideoMOV' : 'Quick Time video',
'kindVideoWM' : 'Windows Media video',
'kindVideoFlash' : 'Flash video',
'kindVideoMKV' : 'Matroska video',
'kindVideoOGG' : 'Ogg video'
}
};
}
|
vgdb-frontend/src/components/grid/GridLayout.js | mattruston/idb | import React, { Component } from 'react';
import GridItem from './GridItem';
import './GridLayout.css';
/* Multiline flexible column layout for griditems */
class GridLayout extends Component {
static defaultProps = {
aspect: "cover"
};
constructor(props) {
super(props);
}
render() {
return (
<div className="grid-layout">
<div className="grid-layout-container">
<div className="grid">
{
this.props.items.map(item =>
<GridItem details={item.details} name={item.name} img={item.img} url={item.url} aspect={this.props.aspect}/>
)
}
</div>
</div>
</div>
);
}
}
export default GridLayout; |
admin/frontend/pages/roles/list.js | latteware/marble-seed | import React from 'react'
import Link from '~base/router/link'
import moment from 'moment'
import env from '~base/env-variables'
import ListPageComponent from '~base/list-page-component'
import { loggedIn } from '~base/middlewares/'
import CreateRole from './create'
class RoleList extends ListPageComponent {
finishUp (data) {
this.props.history.push(env.PREFIX + '/manage/roles/' + data.uuid)
}
getColumns () {
return [
{
'title': 'Name',
'property': 'name',
'default': 'N/A',
formatter: (row) => {
return (
<Link to={'/manage/roles/' + row.uuid}>
{row.name}
</Link>
)
}
},
{
'title': 'Created',
'property': 'dateCreated',
'default': 'N/A',
formatter: (row) => {
return (
moment.utc(row.dateCreated).local().format('DD/MM/YYYY hh:mm a')
)
}
},
{
'title': 'Default',
'property': 'isDefault',
formatter: (row) => {
if (row.isDefault) {
return (
'Yes'
)
}
}
},
{
'title': 'Actions',
formatter: (row) => {
return <Link className='button' to={'/manage/roles/' + row.uuid}>
Detalle
</Link>
}
}
]
}
getFilters () {
const schema = {
name: {
widget: 'TextWidget',
name: 'name',
placeholder: 'By name'
}
}
return schema
}
exportFormatter (row) {
return { name: row.name }
}
}
RoleList.config({
name: 'role-list',
path: '/manage/roles',
title: 'Roles',
icon: 'address-book',
exact: true,
validate: loggedIn,
headerLayout: 'create',
createComponent: CreateRole,
createComponentLabel: 'New Role',
apiUrl: '/admin/roles'
})
export default RoleList
|
src/components/locator/components/presentational/ToggleButton.js | mgoodenough/estimator | 'use strict';
/*
* Module Definition
*
*/
import React from 'react';
import Button from './Button';
/*
* Class Definition
*
*/
class ToggleButton extends React.Component {
constructor(props) {
super(props);
this.state = {
isPosition: true
};
this.onClick = this.onClick.bind(this);
}
/*
* onClick
*
*/
onClick(evt) {
evt.preventDefault();
this.props.onClick && this.props.onClick();
this.setPosition();
}
/*
* setPosition
*
*/
setPosition() {
this.setState(prevState => ({
isPosition: !prevState.isPosition
}));
}
/*
* render
*
*/
render() {
const { className, text, onClick } = this.props;
return (
<button className={ className } onClick={ this.onClick }>
{ this.state.isPosition ? text[0] : text[1] }
</button>
);
}
};
/*
* Module Export
*
*/
export default ToggleButton; |
ajax/libs/rxjs/2.3.9/rx.all.js | dada0423/cdnjs | // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
;(function (undefined) {
var objectTypes = {
'boolean': false,
'function': true,
'object': true,
'number': false,
'string': false,
'undefined': false
};
var root = (objectTypes[typeof window] && window) || this,
freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports,
freeModule = objectTypes[typeof module] && module && !module.nodeType && module,
moduleExports = freeModule && freeModule.exports === freeExports && freeExports,
freeGlobal = objectTypes[typeof global] && global;
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) {
root = freeGlobal;
}
var Rx = {
internals: {},
config: {
Promise: root.Promise // Detect if promise exists
},
helpers: { }
};
// Defaults
var noop = Rx.helpers.noop = function () { },
notDefined = Rx.helpers.notDefined = function (x) { return typeof x === 'undefined'; },
isScheduler = Rx.helpers.isScheduler = function (x) { return x instanceof Rx.Scheduler; },
identity = Rx.helpers.identity = function (x) { return x; },
pluck = Rx.helpers.pluck = function (property) { return function (x) { return x[property]; }; },
just = Rx.helpers.just = function (value) { return function () { return value; }; },
defaultNow = Rx.helpers.defaultNow = Date.now,
defaultComparer = Rx.helpers.defaultComparer = function (x, y) { return isEqual(x, y); },
defaultSubComparer = Rx.helpers.defaultSubComparer = function (x, y) { return x > y ? 1 : (x < y ? -1 : 0); },
defaultKeySerializer = Rx.helpers.defaultKeySerializer = function (x) { return x.toString(); },
defaultError = Rx.helpers.defaultError = function (err) { throw err; },
isPromise = Rx.helpers.isPromise = function (p) { return !!p && typeof p.then === 'function'; },
asArray = Rx.helpers.asArray = function () { return Array.prototype.slice.call(arguments); },
not = Rx.helpers.not = function (a) { return !a; };
// Errors
var sequenceContainsNoElements = 'Sequence contains no elements.';
var argumentOutOfRange = 'Argument out of range';
var objectDisposed = 'Object has been disposed';
function checkDisposed() { if (this.isDisposed) { throw new Error(objectDisposed); } }
// Shim in iterator support
var $iterator$ = (typeof Symbol === 'function' && Symbol.iterator) ||
'_es6shim_iterator_';
// Bug for mozilla version
if (root.Set && typeof new root.Set()['@@iterator'] === 'function') {
$iterator$ = '@@iterator';
}
var doneEnumerator = { done: true, value: undefined };
/** `Object#toString` result shortcuts */
var argsClass = '[object Arguments]',
arrayClass = '[object Array]',
boolClass = '[object Boolean]',
dateClass = '[object Date]',
errorClass = '[object Error]',
funcClass = '[object Function]',
numberClass = '[object Number]',
objectClass = '[object Object]',
regexpClass = '[object RegExp]',
stringClass = '[object String]';
var toString = Object.prototype.toString,
hasOwnProperty = Object.prototype.hasOwnProperty,
supportsArgsClass = toString.call(arguments) == argsClass, // For less <IE9 && FF<4
suportNodeClass,
errorProto = Error.prototype,
objectProto = Object.prototype,
propertyIsEnumerable = objectProto.propertyIsEnumerable;
try {
suportNodeClass = !(toString.call(document) == objectClass && !({ 'toString': 0 } + ''));
} catch(e) {
suportNodeClass = true;
}
var shadowedProps = [
'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf'
];
var nonEnumProps = {};
nonEnumProps[arrayClass] = nonEnumProps[dateClass] = nonEnumProps[numberClass] = { 'constructor': true, 'toLocaleString': true, 'toString': true, 'valueOf': true };
nonEnumProps[boolClass] = nonEnumProps[stringClass] = { 'constructor': true, 'toString': true, 'valueOf': true };
nonEnumProps[errorClass] = nonEnumProps[funcClass] = nonEnumProps[regexpClass] = { 'constructor': true, 'toString': true };
nonEnumProps[objectClass] = { 'constructor': true };
var support = {};
(function () {
var ctor = function() { this.x = 1; },
props = [];
ctor.prototype = { 'valueOf': 1, 'y': 1 };
for (var key in new ctor) { props.push(key); }
for (key in arguments) { }
// Detect if `name` or `message` properties of `Error.prototype` are enumerable by default.
support.enumErrorProps = propertyIsEnumerable.call(errorProto, 'message') || propertyIsEnumerable.call(errorProto, 'name');
// Detect if `prototype` properties are enumerable by default.
support.enumPrototypes = propertyIsEnumerable.call(ctor, 'prototype');
// Detect if `arguments` object indexes are non-enumerable
support.nonEnumArgs = key != 0;
// Detect if properties shadowing those on `Object.prototype` are non-enumerable.
support.nonEnumShadows = !/valueOf/.test(props);
}(1));
function isObject(value) {
// check if the value is the ECMAScript language type of Object
// http://es5.github.io/#x8
// and avoid a V8 bug
// https://code.google.com/p/v8/issues/detail?id=2291
var type = typeof value;
return value && (type == 'function' || type == 'object') || false;
}
function keysIn(object) {
var result = [];
if (!isObject(object)) {
return result;
}
if (support.nonEnumArgs && object.length && isArguments(object)) {
object = slice.call(object);
}
var skipProto = support.enumPrototypes && typeof object == 'function',
skipErrorProps = support.enumErrorProps && (object === errorProto || object instanceof Error);
for (var key in object) {
if (!(skipProto && key == 'prototype') &&
!(skipErrorProps && (key == 'message' || key == 'name'))) {
result.push(key);
}
}
if (support.nonEnumShadows && object !== objectProto) {
var ctor = object.constructor,
index = -1,
length = shadowedProps.length;
if (object === (ctor && ctor.prototype)) {
var className = object === stringProto ? stringClass : object === errorProto ? errorClass : toString.call(object),
nonEnum = nonEnumProps[className];
}
while (++index < length) {
key = shadowedProps[index];
if (!(nonEnum && nonEnum[key]) && hasOwnProperty.call(object, key)) {
result.push(key);
}
}
}
return result;
}
function internalFor(object, callback, keysFunc) {
var index = -1,
props = keysFunc(object),
length = props.length;
while (++index < length) {
var key = props[index];
if (callback(object[key], key, object) === false) {
break;
}
}
return object;
}
function internalForIn(object, callback) {
return internalFor(object, callback, keysIn);
}
function isNode(value) {
// IE < 9 presents DOM nodes as `Object` objects except they have `toString`
// methods that are `typeof` "string" and still can coerce nodes to strings
return typeof value.toString != 'function' && typeof (value + '') == 'string';
}
function isArguments(value) {
return (value && typeof value == 'object') ? toString.call(value) == argsClass : false;
}
// fallback for browsers that can't detect `arguments` objects by [[Class]]
if (!supportsArgsClass) {
isArguments = function(value) {
return (value && typeof value == 'object') ? hasOwnProperty.call(value, 'callee') : false;
};
}
function isFunction(value) {
return typeof value == 'function' || false;
}
// fallback for older versions of Chrome and Safari
if (isFunction(/x/)) {
isFunction = function(value) {
return typeof value == 'function' && toString.call(value) == funcClass;
};
}
var isEqual = Rx.internals.isEqual = function (x, y) {
return deepEquals(x, y, [], []);
};
/** @private
* Used for deep comparison
**/
function deepEquals(a, b, stackA, stackB) {
// exit early for identical values
if (a === b) {
// treat `+0` vs. `-0` as not equal
return a !== 0 || (1 / a == 1 / b);
}
var type = typeof a,
otherType = typeof b;
// exit early for unlike primitive values
if (a === a && (a == null || b == null ||
(type != 'function' && type != 'object' && otherType != 'function' && otherType != 'object'))) {
return false;
}
// compare [[Class]] names
var className = toString.call(a),
otherClass = toString.call(b);
if (className == argsClass) {
className = objectClass;
}
if (otherClass == argsClass) {
otherClass = objectClass;
}
if (className != otherClass) {
return false;
}
switch (className) {
case boolClass:
case dateClass:
// coerce dates and booleans to numbers, dates to milliseconds and booleans
// to `1` or `0` treating invalid dates coerced to `NaN` as not equal
return +a == +b;
case numberClass:
// treat `NaN` vs. `NaN` as equal
return (a != +a)
? b != +b
// but treat `-0` vs. `+0` as not equal
: (a == 0 ? (1 / a == 1 / b) : a == +b);
case regexpClass:
case stringClass:
// coerce regexes to strings (http://es5.github.io/#x15.10.6.4)
// treat string primitives and their corresponding object instances as equal
return a == String(b);
}
var isArr = className == arrayClass;
if (!isArr) {
// exit for functions and DOM nodes
if (className != objectClass || (!support.nodeClass && (isNode(a) || isNode(b)))) {
return false;
}
// in older versions of Opera, `arguments` objects have `Array` constructors
var ctorA = !support.argsObject && isArguments(a) ? Object : a.constructor,
ctorB = !support.argsObject && isArguments(b) ? Object : b.constructor;
// non `Object` object instances with different constructors are not equal
if (ctorA != ctorB &&
!(hasOwnProperty.call(a, 'constructor') && hasOwnProperty.call(b, 'constructor')) &&
!(isFunction(ctorA) && ctorA instanceof ctorA && isFunction(ctorB) && ctorB instanceof ctorB) &&
('constructor' in a && 'constructor' in b)
) {
return false;
}
}
// assume cyclic structures are equal
// the algorithm for detecting cyclic structures is adapted from ES 5.1
// section 15.12.3, abstract operation `JO` (http://es5.github.io/#x15.12.3)
var initedStack = !stackA;
stackA || (stackA = []);
stackB || (stackB = []);
var length = stackA.length;
while (length--) {
if (stackA[length] == a) {
return stackB[length] == b;
}
}
var size = 0;
result = true;
// add `a` and `b` to the stack of traversed objects
stackA.push(a);
stackB.push(b);
// recursively compare objects and arrays (susceptible to call stack limits)
if (isArr) {
// compare lengths to determine if a deep comparison is necessary
length = a.length;
size = b.length;
result = size == length;
if (result) {
// deep compare the contents, ignoring non-numeric properties
while (size--) {
var index = length,
value = b[size];
if (!(result = deepEquals(a[size], value, stackA, stackB))) {
break;
}
}
}
}
else {
// deep compare objects using `forIn`, instead of `forOwn`, to avoid `Object.keys`
// which, in this case, is more costly
internalForIn(b, function(value, key, b) {
if (hasOwnProperty.call(b, key)) {
// count the number of properties.
size++;
// deep compare each property value.
return (result = hasOwnProperty.call(a, key) && deepEquals(a[key], value, stackA, stackB));
}
});
if (result) {
// ensure both objects have the same number of properties
internalForIn(a, function(value, key, a) {
if (hasOwnProperty.call(a, key)) {
// `size` will be `-1` if `a` has more properties than `b`
return (result = --size > -1);
}
});
}
}
stackA.pop();
stackB.pop();
return result;
}
var slice = Array.prototype.slice;
function argsOrArray(args, idx) {
return args.length === 1 && Array.isArray(args[idx]) ?
args[idx] :
slice.call(args);
}
var hasProp = {}.hasOwnProperty;
/** @private */
var inherits = this.inherits = Rx.internals.inherits = function (child, parent) {
function __() { this.constructor = child; }
__.prototype = parent.prototype;
child.prototype = new __();
};
/** @private */
var addProperties = Rx.internals.addProperties = function (obj) {
var sources = slice.call(arguments, 1);
for (var i = 0, len = sources.length; i < len; i++) {
var source = sources[i];
for (var prop in source) {
obj[prop] = source[prop];
}
}
};
// Rx Utils
var addRef = Rx.internals.addRef = function (xs, r) {
return new AnonymousObservable(function (observer) {
return new CompositeDisposable(r.getDisposable(), xs.subscribe(observer));
});
};
// Collection polyfills
function arrayInitialize(count, factory) {
var a = new Array(count);
for (var i = 0; i < count; i++) {
a[i] = factory();
}
return a;
}
// Collections
var IndexedItem = function (id, value) {
this.id = id;
this.value = value;
};
IndexedItem.prototype.compareTo = function (other) {
var c = this.value.compareTo(other.value);
if (c === 0) {
c = this.id - other.id;
}
return c;
};
// Priority Queue for Scheduling
var PriorityQueue = Rx.internals.PriorityQueue = function (capacity) {
this.items = new Array(capacity);
this.length = 0;
};
var priorityProto = PriorityQueue.prototype;
priorityProto.isHigherPriority = function (left, right) {
return this.items[left].compareTo(this.items[right]) < 0;
};
priorityProto.percolate = function (index) {
if (index >= this.length || index < 0) {
return;
}
var parent = index - 1 >> 1;
if (parent < 0 || parent === index) {
return;
}
if (this.isHigherPriority(index, parent)) {
var temp = this.items[index];
this.items[index] = this.items[parent];
this.items[parent] = temp;
this.percolate(parent);
}
};
priorityProto.heapify = function (index) {
if (index === undefined) {
index = 0;
}
if (index >= this.length || index < 0) {
return;
}
var left = 2 * index + 1,
right = 2 * index + 2,
first = index;
if (left < this.length && this.isHigherPriority(left, first)) {
first = left;
}
if (right < this.length && this.isHigherPriority(right, first)) {
first = right;
}
if (first !== index) {
var temp = this.items[index];
this.items[index] = this.items[first];
this.items[first] = temp;
this.heapify(first);
}
};
priorityProto.peek = function () { return this.items[0].value; };
priorityProto.removeAt = function (index) {
this.items[index] = this.items[--this.length];
delete this.items[this.length];
this.heapify();
};
priorityProto.dequeue = function () {
var result = this.peek();
this.removeAt(0);
return result;
};
priorityProto.enqueue = function (item) {
var index = this.length++;
this.items[index] = new IndexedItem(PriorityQueue.count++, item);
this.percolate(index);
};
priorityProto.remove = function (item) {
for (var i = 0; i < this.length; i++) {
if (this.items[i].value === item) {
this.removeAt(i);
return true;
}
}
return false;
};
PriorityQueue.count = 0;
/**
* Represents a group of disposable resources that are disposed together.
* @constructor
*/
var CompositeDisposable = Rx.CompositeDisposable = function () {
this.disposables = argsOrArray(arguments, 0);
this.isDisposed = false;
this.length = this.disposables.length;
};
var CompositeDisposablePrototype = CompositeDisposable.prototype;
/**
* Adds a disposable to the CompositeDisposable or disposes the disposable if the CompositeDisposable is disposed.
* @param {Mixed} item Disposable to add.
*/
CompositeDisposablePrototype.add = function (item) {
if (this.isDisposed) {
item.dispose();
} else {
this.disposables.push(item);
this.length++;
}
};
/**
* Removes and disposes the first occurrence of a disposable from the CompositeDisposable.
* @param {Mixed} item Disposable to remove.
* @returns {Boolean} true if found; false otherwise.
*/
CompositeDisposablePrototype.remove = function (item) {
var shouldDispose = false;
if (!this.isDisposed) {
var idx = this.disposables.indexOf(item);
if (idx !== -1) {
shouldDispose = true;
this.disposables.splice(idx, 1);
this.length--;
item.dispose();
}
}
return shouldDispose;
};
/**
* Disposes all disposables in the group and removes them from the group.
*/
CompositeDisposablePrototype.dispose = function () {
if (!this.isDisposed) {
this.isDisposed = true;
var currentDisposables = this.disposables.slice(0);
this.disposables = [];
this.length = 0;
for (var i = 0, len = currentDisposables.length; i < len; i++) {
currentDisposables[i].dispose();
}
}
};
/**
* Converts the existing CompositeDisposable to an array of disposables
* @returns {Array} An array of disposable objects.
*/
CompositeDisposablePrototype.toArray = function () {
return this.disposables.slice(0);
};
/**
* Provides a set of static methods for creating Disposables.
*
* @constructor
* @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once.
*/
var Disposable = Rx.Disposable = function (action) {
this.isDisposed = false;
this.action = action || noop;
};
/** Performs the task of cleaning up resources. */
Disposable.prototype.dispose = function () {
if (!this.isDisposed) {
this.action();
this.isDisposed = true;
}
};
/**
* Creates a disposable object that invokes the specified action when disposed.
* @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once.
* @return {Disposable} The disposable object that runs the given action upon disposal.
*/
var disposableCreate = Disposable.create = function (action) { return new Disposable(action); };
/**
* Gets the disposable that does nothing when disposed.
*/
var disposableEmpty = Disposable.empty = { dispose: noop };
var SingleAssignmentDisposable = Rx.SingleAssignmentDisposable =
SerialDisposable = Rx.SerialDisposable = (function () {
function BooleanDisposable () {
this.isDisposed = false;
this.current = null;
}
var booleanDisposablePrototype = BooleanDisposable.prototype;
/**
* Gets the underlying disposable.
* @return The underlying disposable.
*/
booleanDisposablePrototype.getDisposable = function () {
return this.current;
};
/**
* Sets the underlying disposable.
* @param {Disposable} value The new underlying disposable.
*/
booleanDisposablePrototype.setDisposable = function (value) {
var shouldDispose = this.isDisposed, old;
if (!shouldDispose) {
old = this.current;
this.current = value;
}
old && old.dispose();
shouldDispose && value && value.dispose();
};
/**
* Disposes the underlying disposable as well as all future replacements.
*/
booleanDisposablePrototype.dispose = function () {
var old;
if (!this.isDisposed) {
this.isDisposed = true;
old = this.current;
this.current = null;
}
old && old.dispose();
};
return BooleanDisposable;
}());
/**
* Represents a disposable resource that only disposes its underlying disposable resource when all dependent disposable objects have been disposed.
*/
var RefCountDisposable = Rx.RefCountDisposable = (function () {
function InnerDisposable(disposable) {
this.disposable = disposable;
this.disposable.count++;
this.isInnerDisposed = false;
}
InnerDisposable.prototype.dispose = function () {
if (!this.disposable.isDisposed) {
if (!this.isInnerDisposed) {
this.isInnerDisposed = true;
this.disposable.count--;
if (this.disposable.count === 0 && this.disposable.isPrimaryDisposed) {
this.disposable.isDisposed = true;
this.disposable.underlyingDisposable.dispose();
}
}
}
};
/**
* Initializes a new instance of the RefCountDisposable with the specified disposable.
* @constructor
* @param {Disposable} disposable Underlying disposable.
*/
function RefCountDisposable(disposable) {
this.underlyingDisposable = disposable;
this.isDisposed = false;
this.isPrimaryDisposed = false;
this.count = 0;
}
/**
* Disposes the underlying disposable only when all dependent disposables have been disposed
*/
RefCountDisposable.prototype.dispose = function () {
if (!this.isDisposed) {
if (!this.isPrimaryDisposed) {
this.isPrimaryDisposed = true;
if (this.count === 0) {
this.isDisposed = true;
this.underlyingDisposable.dispose();
}
}
}
};
/**
* Returns a dependent disposable that when disposed decreases the refcount on the underlying disposable.
* @returns {Disposable} A dependent disposable contributing to the reference count that manages the underlying disposable's lifetime.
*/
RefCountDisposable.prototype.getDisposable = function () {
return this.isDisposed ? disposableEmpty : new InnerDisposable(this);
};
return RefCountDisposable;
})();
function ScheduledDisposable(scheduler, disposable) {
this.scheduler = scheduler;
this.disposable = disposable;
this.isDisposed = false;
}
ScheduledDisposable.prototype.dispose = function () {
var parent = this;
this.scheduler.schedule(function () {
if (!parent.isDisposed) {
parent.isDisposed = true;
parent.disposable.dispose();
}
});
};
var ScheduledItem = Rx.internals.ScheduledItem = function (scheduler, state, action, dueTime, comparer) {
this.scheduler = scheduler;
this.state = state;
this.action = action;
this.dueTime = dueTime;
this.comparer = comparer || defaultSubComparer;
this.disposable = new SingleAssignmentDisposable();
}
ScheduledItem.prototype.invoke = function () {
this.disposable.setDisposable(this.invokeCore());
};
ScheduledItem.prototype.compareTo = function (other) {
return this.comparer(this.dueTime, other.dueTime);
};
ScheduledItem.prototype.isCancelled = function () {
return this.disposable.isDisposed;
};
ScheduledItem.prototype.invokeCore = function () {
return this.action(this.scheduler, this.state);
};
/** Provides a set of static properties to access commonly used schedulers. */
var Scheduler = Rx.Scheduler = (function () {
function Scheduler(now, schedule, scheduleRelative, scheduleAbsolute) {
this.now = now;
this._schedule = schedule;
this._scheduleRelative = scheduleRelative;
this._scheduleAbsolute = scheduleAbsolute;
}
function invokeRecImmediate(scheduler, pair) {
var state = pair.first, action = pair.second, group = new CompositeDisposable(),
recursiveAction = function (state1) {
action(state1, function (state2) {
var isAdded = false, isDone = false,
d = scheduler.scheduleWithState(state2, function (scheduler1, state3) {
if (isAdded) {
group.remove(d);
} else {
isDone = true;
}
recursiveAction(state3);
return disposableEmpty;
});
if (!isDone) {
group.add(d);
isAdded = true;
}
});
};
recursiveAction(state);
return group;
}
function invokeRecDate(scheduler, pair, method) {
var state = pair.first, action = pair.second, group = new CompositeDisposable(),
recursiveAction = function (state1) {
action(state1, function (state2, dueTime1) {
var isAdded = false, isDone = false,
d = scheduler[method].call(scheduler, state2, dueTime1, function (scheduler1, state3) {
if (isAdded) {
group.remove(d);
} else {
isDone = true;
}
recursiveAction(state3);
return disposableEmpty;
});
if (!isDone) {
group.add(d);
isAdded = true;
}
});
};
recursiveAction(state);
return group;
}
function invokeAction(scheduler, action) {
action();
return disposableEmpty;
}
var schedulerProto = Scheduler.prototype;
/**
* Schedules an action to be executed.
* @param {Function} action Action to execute.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.schedule = function (action) {
return this._schedule(action, invokeAction);
};
/**
* Schedules an action to be executed.
* @param state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithState = function (state, action) {
return this._schedule(state, action);
};
/**
* Schedules an action to be executed after the specified relative due time.
* @param {Function} action Action to execute.
* @param {Number} dueTime Relative time after which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithRelative = function (dueTime, action) {
return this._scheduleRelative(action, dueTime, invokeAction);
};
/**
* Schedules an action to be executed after dueTime.
* @param state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @param {Number} dueTime Relative time after which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithRelativeAndState = function (state, dueTime, action) {
return this._scheduleRelative(state, dueTime, action);
};
/**
* Schedules an action to be executed at the specified absolute due time.
* @param {Function} action Action to execute.
* @param {Number} dueTime Absolute time at which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithAbsolute = function (dueTime, action) {
return this._scheduleAbsolute(action, dueTime, invokeAction);
};
/**
* Schedules an action to be executed at dueTime.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @param {Number}dueTime Absolute time at which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithAbsoluteAndState = function (state, dueTime, action) {
return this._scheduleAbsolute(state, dueTime, action);
};
/** Gets the current time according to the local machine's system clock. */
Scheduler.now = defaultNow;
/**
* Normalizes the specified TimeSpan value to a positive value.
* @param {Number} timeSpan The time span value to normalize.
* @returns {Number} The specified TimeSpan value if it is zero or positive; otherwise, 0
*/
Scheduler.normalize = function (timeSpan) {
timeSpan < 0 && (timeSpan = 0);
return timeSpan;
};
return Scheduler;
}());
var normalizeTime = Scheduler.normalize;
(function (schedulerProto) {
function invokeRecImmediate(scheduler, pair) {
var state = pair.first, action = pair.second, group = new CompositeDisposable(),
recursiveAction = function (state1) {
action(state1, function (state2) {
var isAdded = false, isDone = false,
d = scheduler.scheduleWithState(state2, function (scheduler1, state3) {
if (isAdded) {
group.remove(d);
} else {
isDone = true;
}
recursiveAction(state3);
return disposableEmpty;
});
if (!isDone) {
group.add(d);
isAdded = true;
}
});
};
recursiveAction(state);
return group;
}
function invokeRecDate(scheduler, pair, method) {
var state = pair.first, action = pair.second, group = new CompositeDisposable(),
recursiveAction = function (state1) {
action(state1, function (state2, dueTime1) {
var isAdded = false, isDone = false,
d = scheduler[method].call(scheduler, state2, dueTime1, function (scheduler1, state3) {
if (isAdded) {
group.remove(d);
} else {
isDone = true;
}
recursiveAction(state3);
return disposableEmpty;
});
if (!isDone) {
group.add(d);
isAdded = true;
}
});
};
recursiveAction(state);
return group;
}
function scheduleInnerRecursive(action, self) {
action(function(dt) { self(action, dt); });
}
/**
* Schedules an action to be executed recursively.
* @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursive = function (action) {
return this.scheduleRecursiveWithState(action, function (_action, self) {
_action(function () { self(_action); }); });
};
/**
* Schedules an action to be executed recursively.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in recursive invocation state.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithState = function (state, action) {
return this.scheduleWithState({ first: state, second: action }, invokeRecImmediate);
};
/**
* Schedules an action to be executed recursively after a specified relative due time.
* @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action at the specified relative time.
* @param {Number}dueTime Relative time after which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithRelative = function (dueTime, action) {
return this.scheduleRecursiveWithRelativeAndState(action, dueTime, scheduleInnerRecursive);
};
/**
* Schedules an action to be executed recursively after a specified relative due time.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state.
* @param {Number}dueTime Relative time after which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithRelativeAndState = function (state, dueTime, action) {
return this._scheduleRelative({ first: state, second: action }, dueTime, function (s, p) {
return invokeRecDate(s, p, 'scheduleWithRelativeAndState');
});
};
/**
* Schedules an action to be executed recursively at a specified absolute due time.
* @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action at the specified absolute time.
* @param {Number}dueTime Absolute time at which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithAbsolute = function (dueTime, action) {
return this.scheduleRecursiveWithAbsoluteAndState(action, dueTime, scheduleInnerRecursive);
};
/**
* Schedules an action to be executed recursively at a specified absolute due time.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state.
* @param {Number}dueTime Absolute time at which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithAbsoluteAndState = function (state, dueTime, action) {
return this._scheduleAbsolute({ first: state, second: action }, dueTime, function (s, p) {
return invokeRecDate(s, p, 'scheduleWithAbsoluteAndState');
});
};
}(Scheduler.prototype));
(function (schedulerProto) {
/**
* Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be scheduled using window.setInterval for the base implementation.
* @param {Number} period Period for running the work periodically.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort).
*/
Scheduler.prototype.schedulePeriodic = function (period, action) {
return this.schedulePeriodicWithState(null, period, action);
};
/**
* Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be scheduled using window.setInterval for the base implementation.
* @param {Mixed} state Initial state passed to the action upon the first iteration.
* @param {Number} period Period for running the work periodically.
* @param {Function} action Action to be executed, potentially updating the state.
* @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort).
*/
Scheduler.prototype.schedulePeriodicWithState = function (state, period, action) {
var s = state;
var id = setInterval(function () {
s = action(s);
}, period);
return disposableCreate(function () {
clearInterval(id);
});
};
}(Scheduler.prototype));
(function (schedulerProto) {
/**
* Returns a scheduler that wraps the original scheduler, adding exception handling for scheduled actions.
* @param {Function} handler Handler that's run if an exception is caught. The exception will be rethrown if the handler returns false.
* @returns {Scheduler} Wrapper around the original scheduler, enforcing exception handling.
*/
schedulerProto.catchError = schedulerProto['catch'] = function (handler) {
return new CatchScheduler(this, handler);
};
}(Scheduler.prototype));
var SchedulePeriodicRecursive = Rx.internals.SchedulePeriodicRecursive = (function () {
function tick(command, recurse) {
recurse(0, this._period);
try {
this._state = this._action(this._state);
} catch (e) {
this._cancel.dispose();
throw e;
}
}
function SchedulePeriodicRecursive(scheduler, state, period, action) {
this._scheduler = scheduler;
this._state = state;
this._period = period;
this._action = action;
}
SchedulePeriodicRecursive.prototype.start = function () {
var d = new SingleAssignmentDisposable();
this._cancel = d;
d.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0, this._period, tick.bind(this)));
return d;
};
return SchedulePeriodicRecursive;
}());
/**
* Gets a scheduler that schedules work immediately on the current thread.
*/
var immediateScheduler = Scheduler.immediate = (function () {
function scheduleNow(state, action) { return action(this, state); }
function scheduleRelative(state, dueTime, action) {
var dt = normalizeTime(dt);
while (dt - this.now() > 0) { }
return action(this, state);
}
function scheduleAbsolute(state, dueTime, action) {
return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
}
return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
}());
/**
* Gets a scheduler that schedules work as soon as possible on the current thread.
*/
var currentThreadScheduler = Scheduler.currentThread = (function () {
var queue;
function runTrampoline (q) {
var item;
while (q.length > 0) {
item = q.dequeue();
if (!item.isCancelled()) {
// Note, do not schedule blocking work!
while (item.dueTime - Scheduler.now() > 0) {
}
if (!item.isCancelled()) {
item.invoke();
}
}
}
}
function scheduleNow(state, action) {
return this.scheduleWithRelativeAndState(state, 0, action);
}
function scheduleRelative(state, dueTime, action) {
var dt = this.now() + Scheduler.normalize(dueTime),
si = new ScheduledItem(this, state, action, dt);
if (!queue) {
queue = new PriorityQueue(4);
queue.enqueue(si);
try {
runTrampoline(queue);
} catch (e) {
throw e;
} finally {
queue = null;
}
} else {
queue.enqueue(si);
}
return si.disposable;
}
function scheduleAbsolute(state, dueTime, action) {
return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
}
var currentScheduler = new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
currentScheduler.scheduleRequired = function () { return !queue; };
currentScheduler.ensureTrampoline = function (action) {
if (!queue) { this.schedule(action); } else { action(); }
};
return currentScheduler;
}());
var scheduleMethod, clearMethod = noop;
(function () {
var reNative = RegExp('^' +
String(toString)
.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
.replace(/toString| for [^\]]+/g, '.*?') + '$'
);
var setImmediate = typeof (setImmediate = freeGlobal && moduleExports && freeGlobal.setImmediate) == 'function' &&
!reNative.test(setImmediate) && setImmediate,
clearImmediate = typeof (clearImmediate = freeGlobal && moduleExports && freeGlobal.clearImmediate) == 'function' &&
!reNative.test(clearImmediate) && clearImmediate;
function postMessageSupported () {
// Ensure not in a worker
if (!root.postMessage || root.importScripts) { return false; }
var isAsync = false,
oldHandler = root.onmessage;
// Test for async
root.onmessage = function () { isAsync = true; };
root.postMessage('','*');
root.onmessage = oldHandler;
return isAsync;
}
// Use in order, nextTick, setImmediate, postMessage, MessageChannel, script readystatechanged, setTimeout
if (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]') {
scheduleMethod = process.nextTick;
} else if (typeof setImmediate === 'function') {
scheduleMethod = setImmediate;
clearMethod = clearImmediate;
} else if (postMessageSupported()) {
var MSG_PREFIX = 'ms.rx.schedule' + Math.random(),
tasks = {},
taskId = 0;
function onGlobalPostMessage(event) {
// Only if we're a match to avoid any other global events
if (typeof event.data === 'string' && event.data.substring(0, MSG_PREFIX.length) === MSG_PREFIX) {
var handleId = event.data.substring(MSG_PREFIX.length),
action = tasks[handleId];
action();
delete tasks[handleId];
}
}
if (root.addEventListener) {
root.addEventListener('message', onGlobalPostMessage, false);
} else {
root.attachEvent('onmessage', onGlobalPostMessage, false);
}
scheduleMethod = function (action) {
var currentId = taskId++;
tasks[currentId] = action;
root.postMessage(MSG_PREFIX + currentId, '*');
};
} else if (!!root.MessageChannel) {
var channel = new root.MessageChannel(),
channelTasks = {},
channelTaskId = 0;
channel.port1.onmessage = function (event) {
var id = event.data,
action = channelTasks[id];
action();
delete channelTasks[id];
};
scheduleMethod = function (action) {
var id = channelTaskId++;
channelTasks[id] = action;
channel.port2.postMessage(id);
};
} else if ('document' in root && 'onreadystatechange' in root.document.createElement('script')) {
scheduleMethod = function (action) {
var scriptElement = root.document.createElement('script');
scriptElement.onreadystatechange = function () {
action();
scriptElement.onreadystatechange = null;
scriptElement.parentNode.removeChild(scriptElement);
scriptElement = null;
};
root.document.documentElement.appendChild(scriptElement);
};
} else {
scheduleMethod = function (action) { return setTimeout(action, 0); };
clearMethod = clearTimeout;
}
}());
/**
* Gets a scheduler that schedules work via a timed callback based upon platform.
*/
var timeoutScheduler = Scheduler.timeout = (function () {
function scheduleNow(state, action) {
var scheduler = this,
disposable = new SingleAssignmentDisposable();
var id = scheduleMethod(function () {
if (!disposable.isDisposed) {
disposable.setDisposable(action(scheduler, state));
}
});
return new CompositeDisposable(disposable, disposableCreate(function () {
clearMethod(id);
}));
}
function scheduleRelative(state, dueTime, action) {
var scheduler = this,
dt = Scheduler.normalize(dueTime);
if (dt === 0) {
return scheduler.scheduleWithState(state, action);
}
var disposable = new SingleAssignmentDisposable();
var id = setTimeout(function () {
if (!disposable.isDisposed) {
disposable.setDisposable(action(scheduler, state));
}
}, dt);
return new CompositeDisposable(disposable, disposableCreate(function () {
clearTimeout(id);
}));
}
function scheduleAbsolute(state, dueTime, action) {
return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
}
return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
})();
/** @private */
var CatchScheduler = (function (_super) {
function localNow() {
return this._scheduler.now();
}
function scheduleNow(state, action) {
return this._scheduler.scheduleWithState(state, this._wrap(action));
}
function scheduleRelative(state, dueTime, action) {
return this._scheduler.scheduleWithRelativeAndState(state, dueTime, this._wrap(action));
}
function scheduleAbsolute(state, dueTime, action) {
return this._scheduler.scheduleWithAbsoluteAndState(state, dueTime, this._wrap(action));
}
inherits(CatchScheduler, _super);
/** @private */
function CatchScheduler(scheduler, handler) {
this._scheduler = scheduler;
this._handler = handler;
this._recursiveOriginal = null;
this._recursiveWrapper = null;
_super.call(this, localNow, scheduleNow, scheduleRelative, scheduleAbsolute);
}
/** @private */
CatchScheduler.prototype._clone = function (scheduler) {
return new CatchScheduler(scheduler, this._handler);
};
/** @private */
CatchScheduler.prototype._wrap = function (action) {
var parent = this;
return function (self, state) {
try {
return action(parent._getRecursiveWrapper(self), state);
} catch (e) {
if (!parent._handler(e)) { throw e; }
return disposableEmpty;
}
};
};
/** @private */
CatchScheduler.prototype._getRecursiveWrapper = function (scheduler) {
if (this._recursiveOriginal !== scheduler) {
this._recursiveOriginal = scheduler;
var wrapper = this._clone(scheduler);
wrapper._recursiveOriginal = scheduler;
wrapper._recursiveWrapper = wrapper;
this._recursiveWrapper = wrapper;
}
return this._recursiveWrapper;
};
/** @private */
CatchScheduler.prototype.schedulePeriodicWithState = function (state, period, action) {
var self = this, failed = false, d = new SingleAssignmentDisposable();
d.setDisposable(this._scheduler.schedulePeriodicWithState(state, period, function (state1) {
if (failed) { return null; }
try {
return action(state1);
} catch (e) {
failed = true;
if (!self._handler(e)) { throw e; }
d.dispose();
return null;
}
}));
return d;
};
return CatchScheduler;
}(Scheduler));
/**
* Represents a notification to an observer.
*/
var Notification = Rx.Notification = (function () {
function Notification(kind, hasValue) {
this.hasValue = hasValue == null ? false : hasValue;
this.kind = kind;
}
/**
* Invokes the delegate corresponding to the notification or the observer's method corresponding to the notification and returns the produced result.
*
* @memberOf Notification
* @param {Any} observerOrOnNext Delegate to invoke for an OnNext notification or Observer to invoke the notification on..
* @param {Function} onError Delegate to invoke for an OnError notification.
* @param {Function} onCompleted Delegate to invoke for an OnCompleted notification.
* @returns {Any} Result produced by the observation.
*/
Notification.prototype.accept = function (observerOrOnNext, onError, onCompleted) {
return observerOrOnNext && typeof observerOrOnNext === 'object' ?
this._acceptObservable(observerOrOnNext) :
this._accept(observerOrOnNext, onError, onCompleted);
};
/**
* Returns an observable sequence with a single notification.
*
* @memberOf Notifications
* @param {Scheduler} [scheduler] Scheduler to send out the notification calls on.
* @returns {Observable} The observable sequence that surfaces the behavior of the notification upon subscription.
*/
Notification.prototype.toObservable = function (scheduler) {
var notification = this;
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.schedule(function () {
notification._acceptObservable(observer);
notification.kind === 'N' && observer.onCompleted();
});
});
};
return Notification;
})();
/**
* Creates an object that represents an OnNext notification to an observer.
* @param {Any} value The value contained in the notification.
* @returns {Notification} The OnNext notification containing the value.
*/
var notificationCreateOnNext = Notification.createOnNext = (function () {
function _accept (onNext) { return onNext(this.value); }
function _acceptObservable(observer) { return observer.onNext(this.value); }
function toString () { return 'OnNext(' + this.value + ')'; }
return function (value) {
var notification = new Notification('N', true);
notification.value = value;
notification._accept = _accept;
notification._acceptObservable = _acceptObservable;
notification.toString = toString;
return notification;
};
}());
/**
* Creates an object that represents an OnError notification to an observer.
* @param {Any} error The exception contained in the notification.
* @returns {Notification} The OnError notification containing the exception.
*/
var notificationCreateOnError = Notification.createOnError = (function () {
function _accept (onNext, onError) { return onError(this.exception); }
function _acceptObservable(observer) { return observer.onError(this.exception); }
function toString () { return 'OnError(' + this.exception + ')'; }
return function (exception) {
var notification = new Notification('E');
notification.exception = exception;
notification._accept = _accept;
notification._acceptObservable = _acceptObservable;
notification.toString = toString;
return notification;
};
}());
/**
* Creates an object that represents an OnCompleted notification to an observer.
* @returns {Notification} The OnCompleted notification.
*/
var notificationCreateOnCompleted = Notification.createOnCompleted = (function () {
function _accept (onNext, onError, onCompleted) { return onCompleted(); }
function _acceptObservable(observer) { return observer.onCompleted(); }
function toString () { return 'OnCompleted()'; }
return function () {
var notification = new Notification('C');
notification._accept = _accept;
notification._acceptObservable = _acceptObservable;
notification.toString = toString;
return notification;
};
}());
var Enumerator = Rx.internals.Enumerator = function (next) {
this._next = next;
};
Enumerator.prototype.next = function () {
return this._next();
};
Enumerator.prototype[$iterator$] = function () { return this; }
var Enumerable = Rx.internals.Enumerable = function (iterator) {
this._iterator = iterator;
};
Enumerable.prototype[$iterator$] = function () {
return this._iterator();
};
Enumerable.prototype.concat = function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var e;
try {
e = sources[$iterator$]();
} catch(err) {
observer.onError();
return;
}
var isDisposed,
subscription = new SerialDisposable();
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
var currentItem;
if (isDisposed) { return; }
try {
currentItem = e.next();
} catch (ex) {
observer.onError(ex);
return;
}
if (currentItem.done) {
observer.onCompleted();
return;
}
// Check if promise
var currentValue = currentItem.value;
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
var d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(currentValue.subscribe(
observer.onNext.bind(observer),
observer.onError.bind(observer),
function () { self(); })
);
});
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
isDisposed = true;
}));
});
};
Enumerable.prototype.catchException = function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var e;
try {
e = sources[$iterator$]();
} catch(err) {
observer.onError();
return;
}
var isDisposed,
lastException,
subscription = new SerialDisposable();
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
if (isDisposed) { return; }
var currentItem;
try {
currentItem = e.next();
} catch (ex) {
observer.onError(ex);
return;
}
if (currentItem.done) {
if (lastException) {
observer.onError(lastException);
} else {
observer.onCompleted();
}
return;
}
// Check if promise
var currentValue = currentItem.value;
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
var d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(currentValue.subscribe(
observer.onNext.bind(observer),
function (exn) {
lastException = exn;
self();
},
observer.onCompleted.bind(observer)));
});
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
isDisposed = true;
}));
});
};
var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) {
if (repeatCount == null) { repeatCount = -1; }
return new Enumerable(function () {
var left = repeatCount;
return new Enumerator(function () {
if (left === 0) { return doneEnumerator; }
if (left > 0) { left--; }
return { done: false, value: value };
});
});
};
var enumerableFor = Enumerable.forEach = function (source, selector, thisArg) {
selector || (selector = identity);
return new Enumerable(function () {
var index = -1;
return new Enumerator(
function () {
return ++index < source.length ?
{ done: false, value: selector.call(thisArg, source[index], index, source) } :
doneEnumerator;
});
});
};
/**
* Supports push-style iteration over an observable sequence.
*/
var Observer = Rx.Observer = function () { };
/**
* Creates a notification callback from an observer.
*
* @param observer Observer object.
* @returns The action that forwards its input notification to the underlying observer.
*/
Observer.prototype.toNotifier = function () {
var observer = this;
return function (n) {
return n.accept(observer);
};
};
/**
* Hides the identity of an observer.
* @returns An observer that hides the identity of the specified observer.
*/
Observer.prototype.asObserver = function () {
return new AnonymousObserver(this.onNext.bind(this), this.onError.bind(this), this.onCompleted.bind(this));
};
/**
* Checks access to the observer for grammar violations. This includes checking for multiple OnError or OnCompleted calls, as well as reentrancy in any of the observer methods.
* If a violation is detected, an Error is thrown from the offending observer method call.
*
* @returns An observer that checks callbacks invocations against the observer grammar and, if the checks pass, forwards those to the specified observer.
*/
Observer.prototype.checked = function () { return new CheckedObserver(this); };
/**
* Creates an observer from the specified OnNext, along with optional OnError, and OnCompleted actions.
*
* @static
* @memberOf Observer
* @param {Function} [onNext] Observer's OnNext action implementation.
* @param {Function} [onError] Observer's OnError action implementation.
* @param {Function} [onCompleted] Observer's OnCompleted action implementation.
* @returns {Observer} The observer object implemented using the given actions.
*/
var observerCreate = Observer.create = function (onNext, onError, onCompleted) {
onNext || (onNext = noop);
onError || (onError = defaultError);
onCompleted || (onCompleted = noop);
return new AnonymousObserver(onNext, onError, onCompleted);
};
/**
* Creates an observer from a notification callback.
*
* @static
* @memberOf Observer
* @param {Function} handler Action that handles a notification.
* @returns The observer object that invokes the specified handler using a notification corresponding to each message it receives.
*/
Observer.fromNotifier = function (handler) {
return new AnonymousObserver(function (x) {
return handler(notificationCreateOnNext(x));
}, function (exception) {
return handler(notificationCreateOnError(exception));
}, function () {
return handler(notificationCreateOnCompleted());
});
};
/**
* Schedules the invocation of observer methods on the given scheduler.
* @param {Scheduler} scheduler Scheduler to schedule observer messages on.
* @returns {Observer} Observer whose messages are scheduled on the given scheduler.
*/
Observer.notifyOn = function (scheduler) {
return new ObserveOnObserver(scheduler, this);
};
/**
* Abstract base class for implementations of the Observer class.
* This base class enforces the grammar of observers where OnError and OnCompleted are terminal messages.
*/
var AbstractObserver = Rx.internals.AbstractObserver = (function (_super) {
inherits(AbstractObserver, _super);
/**
* Creates a new observer in a non-stopped state.
*
* @constructor
*/
function AbstractObserver() {
this.isStopped = false;
_super.call(this);
}
/**
* Notifies the observer of a new element in the sequence.
*
* @memberOf AbstractObserver
* @param {Any} value Next element in the sequence.
*/
AbstractObserver.prototype.onNext = function (value) {
if (!this.isStopped) {
this.next(value);
}
};
/**
* Notifies the observer that an exception has occurred.
*
* @memberOf AbstractObserver
* @param {Any} error The error that has occurred.
*/
AbstractObserver.prototype.onError = function (error) {
if (!this.isStopped) {
this.isStopped = true;
this.error(error);
}
};
/**
* Notifies the observer of the end of the sequence.
*/
AbstractObserver.prototype.onCompleted = function () {
if (!this.isStopped) {
this.isStopped = true;
this.completed();
}
};
/**
* Disposes the observer, causing it to transition to the stopped state.
*/
AbstractObserver.prototype.dispose = function () {
this.isStopped = true;
};
AbstractObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.error(e);
return true;
}
return false;
};
return AbstractObserver;
}(Observer));
/**
* Class to create an Observer instance from delegate-based implementations of the on* methods.
*/
var AnonymousObserver = Rx.AnonymousObserver = (function (_super) {
inherits(AnonymousObserver, _super);
/**
* Creates an observer from the specified OnNext, OnError, and OnCompleted actions.
* @param {Any} onNext Observer's OnNext action implementation.
* @param {Any} onError Observer's OnError action implementation.
* @param {Any} onCompleted Observer's OnCompleted action implementation.
*/
function AnonymousObserver(onNext, onError, onCompleted) {
_super.call(this);
this._onNext = onNext;
this._onError = onError;
this._onCompleted = onCompleted;
}
/**
* Calls the onNext action.
* @param {Any} value Next element in the sequence.
*/
AnonymousObserver.prototype.next = function (value) {
this._onNext(value);
};
/**
* Calls the onError action.
* @param {Any} error The error that has occurred.
*/
AnonymousObserver.prototype.error = function (exception) {
this._onError(exception);
};
/**
* Calls the onCompleted action.
*/
AnonymousObserver.prototype.completed = function () {
this._onCompleted();
};
return AnonymousObserver;
}(AbstractObserver));
var CheckedObserver = (function (_super) {
inherits(CheckedObserver, _super);
function CheckedObserver(observer) {
_super.call(this);
this._observer = observer;
this._state = 0; // 0 - idle, 1 - busy, 2 - done
}
var CheckedObserverPrototype = CheckedObserver.prototype;
CheckedObserverPrototype.onNext = function (value) {
this.checkAccess();
try {
this._observer.onNext(value);
} catch (e) {
throw e;
} finally {
this._state = 0;
}
};
CheckedObserverPrototype.onError = function (err) {
this.checkAccess();
try {
this._observer.onError(err);
} catch (e) {
throw e;
} finally {
this._state = 2;
}
};
CheckedObserverPrototype.onCompleted = function () {
this.checkAccess();
try {
this._observer.onCompleted();
} catch (e) {
throw e;
} finally {
this._state = 2;
}
};
CheckedObserverPrototype.checkAccess = function () {
if (this._state === 1) { throw new Error('Re-entrancy detected'); }
if (this._state === 2) { throw new Error('Observer completed'); }
if (this._state === 0) { this._state = 1; }
};
return CheckedObserver;
}(Observer));
var ScheduledObserver = Rx.internals.ScheduledObserver = (function (_super) {
inherits(ScheduledObserver, _super);
function ScheduledObserver(scheduler, observer) {
_super.call(this);
this.scheduler = scheduler;
this.observer = observer;
this.isAcquired = false;
this.hasFaulted = false;
this.queue = [];
this.disposable = new SerialDisposable();
}
ScheduledObserver.prototype.next = function (value) {
var self = this;
this.queue.push(function () {
self.observer.onNext(value);
});
};
ScheduledObserver.prototype.error = function (exception) {
var self = this;
this.queue.push(function () {
self.observer.onError(exception);
});
};
ScheduledObserver.prototype.completed = function () {
var self = this;
this.queue.push(function () {
self.observer.onCompleted();
});
};
ScheduledObserver.prototype.ensureActive = function () {
var isOwner = false, parent = this;
if (!this.hasFaulted && this.queue.length > 0) {
isOwner = !this.isAcquired;
this.isAcquired = true;
}
if (isOwner) {
this.disposable.setDisposable(this.scheduler.scheduleRecursive(function (self) {
var work;
if (parent.queue.length > 0) {
work = parent.queue.shift();
} else {
parent.isAcquired = false;
return;
}
try {
work();
} catch (ex) {
parent.queue = [];
parent.hasFaulted = true;
throw ex;
}
self();
}));
}
};
ScheduledObserver.prototype.dispose = function () {
_super.prototype.dispose.call(this);
this.disposable.dispose();
};
return ScheduledObserver;
}(AbstractObserver));
/** @private */
var ObserveOnObserver = (function (_super) {
inherits(ObserveOnObserver, _super);
/** @private */
function ObserveOnObserver() {
_super.apply(this, arguments);
}
/** @private */
ObserveOnObserver.prototype.next = function (value) {
_super.prototype.next.call(this, value);
this.ensureActive();
};
/** @private */
ObserveOnObserver.prototype.error = function (e) {
_super.prototype.error.call(this, e);
this.ensureActive();
};
/** @private */
ObserveOnObserver.prototype.completed = function () {
_super.prototype.completed.call(this);
this.ensureActive();
};
return ObserveOnObserver;
})(ScheduledObserver);
var observableProto;
/**
* Represents a push-style collection.
*/
var Observable = Rx.Observable = (function () {
function Observable(subscribe) {
this._subscribe = subscribe;
}
observableProto = Observable.prototype;
/**
* Subscribes an observer to the observable sequence.
*
* @example
* 1 - source.subscribe();
* 2 - source.subscribe(observer);
* 3 - source.subscribe(function (x) { console.log(x); });
* 4 - source.subscribe(function (x) { console.log(x); }, function (err) { console.log(err); });
* 5 - source.subscribe(function (x) { console.log(x); }, function (err) { console.log(err); }, function () { console.log('done'); });
* @param {Mixed} [observerOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler.
*/
observableProto.subscribe = observableProto.forEach = function (observerOrOnNext, onError, onCompleted) {
var subscriber = typeof observerOrOnNext === 'object' ?
observerOrOnNext :
observerCreate(observerOrOnNext, onError, onCompleted);
return this._subscribe(subscriber);
};
return Observable;
})();
/**
* Wraps the source sequence in order to run its observer callbacks on the specified scheduler.
*
* This only invokes observer callbacks on a scheduler. In case the subscription and/or unsubscription actions have side-effects
* that require to be run on a scheduler, use subscribeOn.
*
* @param {Scheduler} scheduler Scheduler to notify observers on.
* @returns {Observable} The source sequence whose observations happen on the specified scheduler.
*/
observableProto.observeOn = function (scheduler) {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(new ObserveOnObserver(scheduler, observer));
});
};
/**
* Wraps the source sequence in order to run its subscription and unsubscription logic on the specified scheduler. This operation is not commonly used;
* see the remarks section for more information on the distinction between subscribeOn and observeOn.
* This only performs the side-effects of subscription and unsubscription on the specified scheduler. In order to invoke observer
* callbacks on a scheduler, use observeOn.
* @param {Scheduler} scheduler Scheduler to perform subscription and unsubscription actions on.
* @returns {Observable} The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler.
*/
observableProto.subscribeOn = function (scheduler) {
var source = this;
return new AnonymousObservable(function (observer) {
var m = new SingleAssignmentDisposable(), d = new SerialDisposable();
d.setDisposable(m);
m.setDisposable(scheduler.schedule(function () {
d.setDisposable(new ScheduledDisposable(scheduler, source.subscribe(observer)));
}));
return d;
});
};
/**
* Converts a Promise to an Observable sequence
* @param {Promise} An ES6 Compliant promise.
* @returns {Observable} An Observable sequence which wraps the existing promise success and failure.
*/
var observableFromPromise = Observable.fromPromise = function (promise) {
return observableDefer(function () {
var subject = new Rx.AsyncSubject();
promise.then(
function (value) {
if (!subject.isDisposed) {
subject.onNext(value);
subject.onCompleted();
}
},
subject.onError.bind(subject));
return subject;
});
};
/*
* Converts an existing observable sequence to an ES6 Compatible Promise
* @example
* var promise = Rx.Observable.return(42).toPromise(RSVP.Promise);
*
* // With config
* Rx.config.Promise = RSVP.Promise;
* var promise = Rx.Observable.return(42).toPromise();
* @param {Function} [promiseCtor] The constructor of the promise. If not provided, it looks for it in Rx.config.Promise.
* @returns {Promise} An ES6 compatible promise with the last value from the observable sequence.
*/
observableProto.toPromise = function (promiseCtor) {
promiseCtor || (promiseCtor = Rx.config.Promise);
if (!promiseCtor) {
throw new Error('Promise type not provided nor in Rx.config.Promise');
}
var source = this;
return new promiseCtor(function (resolve, reject) {
// No cancellation can be done
var value, hasValue = false;
source.subscribe(function (v) {
value = v;
hasValue = true;
}, function (err) {
reject(err);
}, function () {
if (hasValue) {
resolve(value);
}
});
});
};
/**
* Creates a list from an observable sequence.
* @returns An observable sequence containing a single element with a list containing all the elements of the source sequence.
*/
observableProto.toArray = function () {
var self = this;
return new AnonymousObservable(function(observer) {
var arr = [];
return self.subscribe(
arr.push.bind(arr),
observer.onError.bind(observer),
function () {
observer.onNext(arr);
observer.onCompleted();
});
});
};
/**
* Creates an observable sequence from a specified subscribe method implementation.
*
* @example
* var res = Rx.Observable.create(function (observer) { return function () { } );
* var res = Rx.Observable.create(function (observer) { return Rx.Disposable.empty; } );
* var res = Rx.Observable.create(function (observer) { } );
*
* @param {Function} subscribe Implementation of the resulting observable sequence's subscribe method, returning a function that will be wrapped in a Disposable.
* @returns {Observable} The observable sequence with the specified implementation for the Subscribe method.
*/
Observable.create = Observable.createWithDisposable = function (subscribe) {
return new AnonymousObservable(subscribe);
};
/**
* Returns an observable sequence that invokes the specified factory function whenever a new observer subscribes.
*
* @example
* var res = Rx.Observable.defer(function () { return Rx.Observable.fromArray([1,2,3]); });
* @param {Function} observableFactory Observable factory function to invoke for each observer that subscribes to the resulting sequence or Promise.
* @returns {Observable} An observable sequence whose observers trigger an invocation of the given observable factory function.
*/
var observableDefer = Observable.defer = function (observableFactory) {
return new AnonymousObservable(function (observer) {
var result;
try {
result = observableFactory();
} catch (e) {
return observableThrow(e).subscribe(observer);
}
isPromise(result) && (result = observableFromPromise(result));
return result.subscribe(observer);
});
};
/**
* Returns an empty observable sequence, using the specified scheduler to send out the single OnCompleted message.
*
* @example
* var res = Rx.Observable.empty();
* var res = Rx.Observable.empty(Rx.Scheduler.timeout);
* @param {Scheduler} [scheduler] Scheduler to send the termination call on.
* @returns {Observable} An observable sequence with no elements.
*/
var observableEmpty = Observable.empty = function (scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.schedule(function () {
observer.onCompleted();
});
});
};
var maxSafeInteger = Math.pow(2, 53) - 1;
function numberIsFinite(value) {
return typeof value === 'number' && root.isFinite(value);
}
function isNan(n) {
return n !== n;
}
function isIterable(o) {
return o[$iterator$] !== undefined;
}
function sign(value) {
var number = +value;
if (number === 0) { return number; }
if (isNaN(number)) { return number; }
return number < 0 ? -1 : 1;
}
function toLength(o) {
var len = +o.length;
if (isNaN(len)) { return 0; }
if (len === 0 || !numberIsFinite(len)) { return len; }
len = sign(len) * Math.floor(Math.abs(len));
if (len <= 0) { return 0; }
if (len > maxSafeInteger) { return maxSafeInteger; }
return len;
}
function isCallable(f) {
return Object.prototype.toString.call(f) === '[object Function]' && typeof f === 'function';
}
/**
* This method creates a new Observable sequence from an array-like or iterable object.
* @param {Any} arrayLike An array-like or iterable object to convert to an Observable sequence.
* @param {Function} [mapFn] Map function to call on every element of the array.
* @param {Any} [thisArg] The context to use calling the mapFn if provided.
* @param {Scheduler} [scheduler] Optional scheduler to use for scheduling. If not provided, defaults to Scheduler.currentThread.
*/
Observable.from = function (iterable, mapFn, thisArg, scheduler) {
if (iterable == null) {
throw new Error('iterable cannot be null.')
}
if (mapFn && !isCallable(mapFn)) {
throw new Error('mapFn when provided must be a function');
}
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new AnonymousObservable(function (observer) {
var list = Object(iterable),
objIsIterable = isIterable(list),
len = objIsIterable ? 0 : toLength(list),
it = objIsIterable ? list[$iterator$]() : null,
i = 0;
return scheduler.scheduleRecursive(function (self) {
if (i < len || objIsIterable) {
var result;
if (objIsIterable) {
var next = it.next();
if (next.done) {
observer.onCompleted();
return;
}
result = next.value;
} else {
result = list[i];
}
if (mapFn && isCallable(mapFn)) {
try {
result = thisArg ? mapFn.call(thisArg, result, i) : mapFn(result, i);
} catch (e) {
observer.onError(e);
return;
}
}
observer.onNext(result);
i++;
self();
} else {
observer.onCompleted();
}
});
});
};
/**
* Converts an array to an observable sequence, using an optional scheduler to enumerate the array.
*
* @example
* var res = Rx.Observable.fromArray([1,2,3]);
* var res = Rx.Observable.fromArray([1,2,3], Rx.Scheduler.timeout);
* @param {Scheduler} [scheduler] Scheduler to run the enumeration of the input sequence on.
* @returns {Observable} The observable sequence whose elements are pulled from the given enumerable sequence.
*/
var observableFromArray = Observable.fromArray = function (array, scheduler) {
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new AnonymousObservable(function (observer) {
var count = 0, len = array.length;
return scheduler.scheduleRecursive(function (self) {
if (count < len) {
observer.onNext(array[count++]);
self();
} else {
observer.onCompleted();
}
});
});
};
/**
* Generates an observable sequence by running a state-driven loop producing the sequence's elements, using the specified scheduler to send out observer messages.
*
* @example
* var res = Rx.Observable.generate(0, function (x) { return x < 10; }, function (x) { return x + 1; }, function (x) { return x; });
* var res = Rx.Observable.generate(0, function (x) { return x < 10; }, function (x) { return x + 1; }, function (x) { return x; }, Rx.Scheduler.timeout);
* @param {Mixed} initialState Initial state.
* @param {Function} condition Condition to terminate generation (upon returning false).
* @param {Function} iterate Iteration step function.
* @param {Function} resultSelector Selector function for results produced in the sequence.
* @param {Scheduler} [scheduler] Scheduler on which to run the generator loop. If not provided, defaults to Scheduler.currentThread.
* @returns {Observable} The generated sequence.
*/
Observable.generate = function (initialState, condition, iterate, resultSelector, scheduler) {
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new AnonymousObservable(function (observer) {
var first = true, state = initialState;
return scheduler.scheduleRecursive(function (self) {
var hasResult, result;
try {
if (first) {
first = false;
} else {
state = iterate(state);
}
hasResult = condition(state);
if (hasResult) {
result = resultSelector(state);
}
} catch (exception) {
observer.onError(exception);
return;
}
if (hasResult) {
observer.onNext(result);
self();
} else {
observer.onCompleted();
}
});
});
};
/**
* This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments.
* @example
* var res = Rx.Observable.of(1,2,3);
* @returns {Observable} The observable sequence whose elements are pulled from the given arguments.
*/
Observable.of = function () {
var len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
return observableFromArray(args);
};
/**
* This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments.
* @example
* var res = Rx.Observable.of(1,2,3);
* @param {Scheduler} scheduler A scheduler to use for scheduling the arguments.
* @returns {Observable} The observable sequence whose elements are pulled from the given arguments.
*/
var observableOf = Observable.ofWithScheduler = function (scheduler) {
var len = arguments.length - 1, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i + 1]; }
return observableFromArray(args, scheduler);
};
/**
* Returns a non-terminating observable sequence, which can be used to denote an infinite duration (e.g. when using reactive joins).
* @returns {Observable} An observable sequence whose observers will never get called.
*/
var observableNever = Observable.never = function () {
return new AnonymousObservable(function () {
return disposableEmpty;
});
};
/**
* Generates an observable sequence of integral numbers within a specified range, using the specified scheduler to send out observer messages.
*
* @example
* var res = Rx.Observable.range(0, 10);
* var res = Rx.Observable.range(0, 10, Rx.Scheduler.timeout);
* @param {Number} start The value of the first integer in the sequence.
* @param {Number} count The number of sequential integers to generate.
* @param {Scheduler} [scheduler] Scheduler to run the generator loop on. If not specified, defaults to Scheduler.currentThread.
* @returns {Observable} An observable sequence that contains a range of sequential integral numbers.
*/
Observable.range = function (start, count, scheduler) {
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.scheduleRecursiveWithState(0, function (i, self) {
if (i < count) {
observer.onNext(start + i);
self(i + 1);
} else {
observer.onCompleted();
}
});
});
};
/**
* Generates an observable sequence that repeats the given element the specified number of times, using the specified scheduler to send out observer messages.
*
* @example
* var res = Rx.Observable.repeat(42);
* var res = Rx.Observable.repeat(42, 4);
* 3 - res = Rx.Observable.repeat(42, 4, Rx.Scheduler.timeout);
* 4 - res = Rx.Observable.repeat(42, null, Rx.Scheduler.timeout);
* @param {Mixed} value Element to repeat.
* @param {Number} repeatCount [Optiona] Number of times to repeat the element. If not specified, repeats indefinitely.
* @param {Scheduler} scheduler Scheduler to run the producer loop on. If not specified, defaults to Scheduler.immediate.
* @returns {Observable} An observable sequence that repeats the given element the specified number of times.
*/
Observable.repeat = function (value, repeatCount, scheduler) {
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return observableReturn(value, scheduler).repeat(repeatCount == null ? -1 : repeatCount);
};
/**
* Returns an observable sequence that contains a single element, using the specified scheduler to send out observer messages.
* There is an alias called 'just', and 'returnValue' for browsers <IE9.
*
* @example
* var res = Rx.Observable.return(42);
* var res = Rx.Observable.return(42, Rx.Scheduler.timeout);
* @param {Mixed} value Single element in the resulting observable sequence.
* @param {Scheduler} scheduler Scheduler to send the single element on. If not specified, defaults to Scheduler.immediate.
* @returns {Observable} An observable sequence containing the single specified element.
*/
var observableReturn = Observable['return'] = Observable.returnValue = Observable.just = function (value, scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.schedule(function () {
observer.onNext(value);
observer.onCompleted();
});
});
};
/**
* Returns an observable sequence that terminates with an exception, using the specified scheduler to send out the single onError message.
* There is an alias to this method called 'throwException' for browsers <IE9.
*
* @example
* var res = Rx.Observable.throw(new Error('Error'));
* var res = Rx.Observable.throw(new Error('Error'), Rx.Scheduler.timeout);
* @param {Mixed} exception An object used for the sequence's termination.
* @param {Scheduler} scheduler Scheduler to send the exceptional termination call on. If not specified, defaults to Scheduler.immediate.
* @returns {Observable} The observable sequence that terminates exceptionally with the specified exception object.
*/
var observableThrow = Observable['throw'] = Observable.throwException = function (exception, scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.schedule(function () {
observer.onError(exception);
});
});
};
/**
* Constructs an observable sequence that depends on a resource object, whose lifetime is tied to the resulting observable sequence's lifetime.
*
* @example
* var res = Rx.Observable.using(function () { return new AsyncSubject(); }, function (s) { return s; });
* @param {Function} resourceFactory Factory function to obtain a resource object.
* @param {Function} observableFactory Factory function to obtain an observable sequence that depends on the obtained resource.
* @returns {Observable} An observable sequence whose lifetime controls the lifetime of the dependent resource object.
*/
Observable.using = function (resourceFactory, observableFactory) {
return new AnonymousObservable(function (observer) {
var disposable = disposableEmpty, resource, source;
try {
resource = resourceFactory();
if (resource) {
disposable = resource;
}
source = observableFactory(resource);
} catch (exception) {
return new CompositeDisposable(observableThrow(exception).subscribe(observer), disposable);
}
return new CompositeDisposable(source.subscribe(observer), disposable);
});
};
/**
* Propagates the observable sequence or Promise that reacts first.
* @param {Observable} rightSource Second observable sequence or Promise.
* @returns {Observable} {Observable} An observable sequence that surfaces either of the given sequences, whichever reacted first.
*/
observableProto.amb = function (rightSource) {
var leftSource = this;
return new AnonymousObservable(function (observer) {
var choice,
leftChoice = 'L', rightChoice = 'R',
leftSubscription = new SingleAssignmentDisposable(),
rightSubscription = new SingleAssignmentDisposable();
isPromise(rightSource) && (rightSource = observableFromPromise(rightSource));
function choiceL() {
if (!choice) {
choice = leftChoice;
rightSubscription.dispose();
}
}
function choiceR() {
if (!choice) {
choice = rightChoice;
leftSubscription.dispose();
}
}
leftSubscription.setDisposable(leftSource.subscribe(function (left) {
choiceL();
if (choice === leftChoice) {
observer.onNext(left);
}
}, function (err) {
choiceL();
if (choice === leftChoice) {
observer.onError(err);
}
}, function () {
choiceL();
if (choice === leftChoice) {
observer.onCompleted();
}
}));
rightSubscription.setDisposable(rightSource.subscribe(function (right) {
choiceR();
if (choice === rightChoice) {
observer.onNext(right);
}
}, function (err) {
choiceR();
if (choice === rightChoice) {
observer.onError(err);
}
}, function () {
choiceR();
if (choice === rightChoice) {
observer.onCompleted();
}
}));
return new CompositeDisposable(leftSubscription, rightSubscription);
});
};
/**
* Propagates the observable sequence or Promise that reacts first.
*
* @example
* var = Rx.Observable.amb(xs, ys, zs);
* @returns {Observable} An observable sequence that surfaces any of the given sequences, whichever reacted first.
*/
Observable.amb = function () {
var acc = observableNever(),
items = argsOrArray(arguments, 0);
function func(previous, current) {
return previous.amb(current);
}
for (var i = 0, len = items.length; i < len; i++) {
acc = func(acc, items[i]);
}
return acc;
};
function observableCatchHandler(source, handler) {
return new AnonymousObservable(function (observer) {
var d1 = new SingleAssignmentDisposable(), subscription = new SerialDisposable();
subscription.setDisposable(d1);
d1.setDisposable(source.subscribe(observer.onNext.bind(observer), function (exception) {
var d, result;
try {
result = handler(exception);
} catch (ex) {
observer.onError(ex);
return;
}
isPromise(result) && (result = observableFromPromise(result));
d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(result.subscribe(observer));
}, observer.onCompleted.bind(observer)));
return subscription;
});
}
/**
* Continues an observable sequence that is terminated by an exception with the next observable sequence.
* @example
* 1 - xs.catchException(ys)
* 2 - xs.catchException(function (ex) { return ys(ex); })
* @param {Mixed} handlerOrSecond Exception handler function that returns an observable sequence given the error that occurred in the first sequence, or a second observable sequence used to produce results when an error occurred in the first sequence.
* @returns {Observable} An observable sequence containing the first sequence's elements, followed by the elements of the handler sequence in case an exception occurred.
*/
observableProto['catch'] = observableProto.catchException = function (handlerOrSecond) {
return typeof handlerOrSecond === 'function' ?
observableCatchHandler(this, handlerOrSecond) :
observableCatch([this, handlerOrSecond]);
};
/**
* Continues an observable sequence that is terminated by an exception with the next observable sequence.
*
* @example
* 1 - res = Rx.Observable.catchException(xs, ys, zs);
* 2 - res = Rx.Observable.catchException([xs, ys, zs]);
* @returns {Observable} An observable sequence containing elements from consecutive source sequences until a source sequence terminates successfully.
*/
var observableCatch = Observable.catchException = Observable['catch'] = function () {
var items = argsOrArray(arguments, 0);
return enumerableFor(items).catchException();
};
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences or Promises produces an element.
* This can be in the form of an argument list of observables or an array.
*
* @example
* 1 - obs = observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; });
* 2 - obs = observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; });
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
observableProto.combineLatest = function () {
var args = slice.call(arguments);
if (Array.isArray(args[0])) {
args[0].unshift(this);
} else {
args.unshift(this);
}
return combineLatest.apply(this, args);
};
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences or Promises produces an element.
*
* @example
* 1 - obs = Rx.Observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; });
* 2 - obs = Rx.Observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; });
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
var combineLatest = Observable.combineLatest = function () {
var args = slice.call(arguments), resultSelector = args.pop();
if (Array.isArray(args[0])) {
args = args[0];
}
return new AnonymousObservable(function (observer) {
var falseFactory = function () { return false; },
n = args.length,
hasValue = arrayInitialize(n, falseFactory),
hasValueAll = false,
isDone = arrayInitialize(n, falseFactory),
values = new Array(n);
function next(i) {
var res;
hasValue[i] = true;
if (hasValueAll || (hasValueAll = hasValue.every(identity))) {
try {
res = resultSelector.apply(null, values);
} catch (ex) {
observer.onError(ex);
return;
}
observer.onNext(res);
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
observer.onCompleted();
}
}
function done (i) {
isDone[i] = true;
if (isDone.every(identity)) {
observer.onCompleted();
}
}
var subscriptions = new Array(n);
for (var idx = 0; idx < n; idx++) {
(function (i) {
var source = args[i], sad = new SingleAssignmentDisposable();
isPromise(source) && (source = observableFromPromise(source));
sad.setDisposable(source.subscribe(function (x) {
values[i] = x;
next(i);
}, observer.onError.bind(observer), function () {
done(i);
}));
subscriptions[i] = sad;
}(idx));
}
return new CompositeDisposable(subscriptions);
});
};
/**
* Concatenates all the observable sequences. This takes in either an array or variable arguments to concatenate.
*
* @example
* 1 - concatenated = xs.concat(ys, zs);
* 2 - concatenated = xs.concat([ys, zs]);
* @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order.
*/
observableProto.concat = function () {
var items = slice.call(arguments, 0);
items.unshift(this);
return observableConcat.apply(this, items);
};
/**
* Concatenates all the observable sequences.
*
* @example
* 1 - res = Rx.Observable.concat(xs, ys, zs);
* 2 - res = Rx.Observable.concat([xs, ys, zs]);
* @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order.
*/
var observableConcat = Observable.concat = function () {
var sources = argsOrArray(arguments, 0);
return enumerableFor(sources).concat();
};
/**
* Concatenates an observable sequence of observable sequences.
* @returns {Observable} An observable sequence that contains the elements of each observed inner sequence, in sequential order.
*/
observableProto.concatObservable = observableProto.concatAll =function () {
return this.merge(1);
};
/**
* Merges an observable sequence of observable sequences into an observable sequence, limiting the number of concurrent subscriptions to inner sequences.
* Or merges two observable sequences into a single observable sequence.
*
* @example
* 1 - merged = sources.merge(1);
* 2 - merged = source.merge(otherSource);
* @param {Mixed} [maxConcurrentOrOther] Maximum number of inner observable sequences being subscribed to concurrently or the second observable sequence.
* @returns {Observable} The observable sequence that merges the elements of the inner sequences.
*/
observableProto.merge = function (maxConcurrentOrOther) {
if (typeof maxConcurrentOrOther !== 'number') { return observableMerge(this, maxConcurrentOrOther); }
var sources = this;
return new AnonymousObservable(function (observer) {
var activeCount = 0, group = new CompositeDisposable(), isStopped = false, q = [];
function subscribe(xs) {
var subscription = new SingleAssignmentDisposable();
group.add(subscription);
// Check for promises support
isPromise(xs) && (xs = observableFromPromise(xs));
subscription.setDisposable(xs.subscribe(observer.onNext.bind(observer), observer.onError.bind(observer), function () {
group.remove(subscription);
if (q.length > 0) {
subscribe(q.shift());
} else {
activeCount--;
isStopped && activeCount === 0 && observer.onCompleted();
}
}));
}
group.add(sources.subscribe(function (innerSource) {
if (activeCount < maxConcurrentOrOther) {
activeCount++;
subscribe(innerSource);
} else {
q.push(innerSource);
}
}, observer.onError.bind(observer), function () {
isStopped = true;
activeCount === 0 && observer.onCompleted();
}));
return group;
});
};
/**
* Merges all the observable sequences into a single observable sequence.
* The scheduler is optional and if not specified, the immediate scheduler is used.
*
* @example
* 1 - merged = Rx.Observable.merge(xs, ys, zs);
* 2 - merged = Rx.Observable.merge([xs, ys, zs]);
* 3 - merged = Rx.Observable.merge(scheduler, xs, ys, zs);
* 4 - merged = Rx.Observable.merge(scheduler, [xs, ys, zs]);
* @returns {Observable} The observable sequence that merges the elements of the observable sequences.
*/
var observableMerge = Observable.merge = function () {
var scheduler, sources;
if (!arguments[0]) {
scheduler = immediateScheduler;
sources = slice.call(arguments, 1);
} else if (arguments[0].now) {
scheduler = arguments[0];
sources = slice.call(arguments, 1);
} else {
scheduler = immediateScheduler;
sources = slice.call(arguments, 0);
}
if (Array.isArray(sources[0])) {
sources = sources[0];
}
return observableFromArray(sources, scheduler).mergeObservable();
};
/**
* Merges an observable sequence of observable sequences into an observable sequence.
* @returns {Observable} The observable sequence that merges the elements of the inner sequences.
*/
observableProto.mergeObservable = observableProto.mergeAll =function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var group = new CompositeDisposable(),
isStopped = false,
m = new SingleAssignmentDisposable();
group.add(m);
m.setDisposable(sources.subscribe(function (innerSource) {
var innerSubscription = new SingleAssignmentDisposable();
group.add(innerSubscription);
// Check if Promise or Observable
if (isPromise(innerSource)) {
innerSource = observableFromPromise(innerSource);
}
innerSubscription.setDisposable(innerSource.subscribe(function (x) {
observer.onNext(x);
}, observer.onError.bind(observer), function () {
group.remove(innerSubscription);
if (isStopped && group.length === 1) { observer.onCompleted(); }
}));
}, observer.onError.bind(observer), function () {
isStopped = true;
if (group.length === 1) { observer.onCompleted(); }
}));
return group;
});
};
/**
* Continues an observable sequence that is terminated normally or by an exception with the next observable sequence.
* @param {Observable} second Second observable sequence used to produce results after the first sequence terminates.
* @returns {Observable} An observable sequence that concatenates the first and second sequence, even if the first sequence terminates exceptionally.
*/
observableProto.onErrorResumeNext = function (second) {
if (!second) {
throw new Error('Second observable is required');
}
return onErrorResumeNext([this, second]);
};
/**
* Continues an observable sequence that is terminated normally or by an exception with the next observable sequence.
*
* @example
* 1 - res = Rx.Observable.onErrorResumeNext(xs, ys, zs);
* 1 - res = Rx.Observable.onErrorResumeNext([xs, ys, zs]);
* @returns {Observable} An observable sequence that concatenates the source sequences, even if a sequence terminates exceptionally.
*/
var onErrorResumeNext = Observable.onErrorResumeNext = function () {
var sources = argsOrArray(arguments, 0);
return new AnonymousObservable(function (observer) {
var pos = 0, subscription = new SerialDisposable(),
cancelable = immediateScheduler.scheduleRecursive(function (self) {
var current, d;
if (pos < sources.length) {
current = sources[pos++];
isPromise(current) && (current = observableFromPromise(current));
d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(current.subscribe(observer.onNext.bind(observer), function () {
self();
}, function () {
self();
}));
} else {
observer.onCompleted();
}
});
return new CompositeDisposable(subscription, cancelable);
});
};
/**
* Returns the values from the source observable sequence only after the other observable sequence produces a value.
* @param {Observable | Promise} other The observable sequence or Promise that triggers propagation of elements of the source sequence.
* @returns {Observable} An observable sequence containing the elements of the source sequence starting from the point the other sequence triggered propagation.
*/
observableProto.skipUntil = function (other) {
var source = this;
return new AnonymousObservable(function (observer) {
var isOpen = false;
var disposables = new CompositeDisposable(source.subscribe(function (left) {
isOpen && observer.onNext(left);
}, observer.onError.bind(observer), function () {
isOpen && observer.onCompleted();
}));
isPromise(other) && (other = observableFromPromise(other));
var rightSubscription = new SingleAssignmentDisposable();
disposables.add(rightSubscription);
rightSubscription.setDisposable(other.subscribe(function () {
isOpen = true;
rightSubscription.dispose();
}, observer.onError.bind(observer), function () {
rightSubscription.dispose();
}));
return disposables;
});
};
/**
* Transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.
* @returns {Observable} The observable sequence that at any point in time produces the elements of the most recent inner observable sequence that has been received.
*/
observableProto['switch'] = observableProto.switchLatest = function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var hasLatest = false,
innerSubscription = new SerialDisposable(),
isStopped = false,
latest = 0,
subscription = sources.subscribe(function (innerSource) {
var d = new SingleAssignmentDisposable(), id = ++latest;
hasLatest = true;
innerSubscription.setDisposable(d);
// Check if Promise or Observable
if (isPromise(innerSource)) {
innerSource = observableFromPromise(innerSource);
}
d.setDisposable(innerSource.subscribe(function (x) {
if (latest === id) {
observer.onNext(x);
}
}, function (e) {
if (latest === id) {
observer.onError(e);
}
}, function () {
if (latest === id) {
hasLatest = false;
if (isStopped) {
observer.onCompleted();
}
}
}));
}, observer.onError.bind(observer), function () {
isStopped = true;
if (!hasLatest) {
observer.onCompleted();
}
});
return new CompositeDisposable(subscription, innerSubscription);
});
};
/**
* Returns the values from the source observable sequence until the other observable sequence produces a value.
* @param {Observable | Promise} other Observable sequence or Promise that terminates propagation of elements of the source sequence.
* @returns {Observable} An observable sequence containing the elements of the source sequence up to the point the other sequence interrupted further propagation.
*/
observableProto.takeUntil = function (other) {
var source = this;
return new AnonymousObservable(function (observer) {
isPromise(other) && (other = observableFromPromise(other));
return new CompositeDisposable(
source.subscribe(observer),
other.subscribe(observer.onCompleted.bind(observer), observer.onError.bind(observer), noop)
);
});
};
function zipArray(second, resultSelector) {
var first = this;
return new AnonymousObservable(function (observer) {
var index = 0, len = second.length;
return first.subscribe(function (left) {
if (index < len) {
var right = second[index++], result;
try {
result = resultSelector(left, right);
} catch (e) {
observer.onError(e);
return;
}
observer.onNext(result);
} else {
observer.onCompleted();
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
}
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences or an array have produced an element at a corresponding index.
* The last element in the arguments must be a function to invoke for each series of elements at corresponding indexes in the sources.
*
* @example
* 1 - res = obs1.zip(obs2, fn);
* 1 - res = x1.zip([1,2,3], fn);
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
observableProto.zip = function () {
if (Array.isArray(arguments[0])) {
return zipArray.apply(this, arguments);
}
var parent = this, sources = slice.call(arguments), resultSelector = sources.pop();
sources.unshift(parent);
return new AnonymousObservable(function (observer) {
var n = sources.length,
queues = arrayInitialize(n, function () { return []; }),
isDone = arrayInitialize(n, function () { return false; });
function next(i) {
var res, queuedValues;
if (queues.every(function (x) { return x.length > 0; })) {
try {
queuedValues = queues.map(function (x) { return x.shift(); });
res = resultSelector.apply(parent, queuedValues);
} catch (ex) {
observer.onError(ex);
return;
}
observer.onNext(res);
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
observer.onCompleted();
}
};
function done(i) {
isDone[i] = true;
if (isDone.every(function (x) { return x; })) {
observer.onCompleted();
}
}
var subscriptions = new Array(n);
for (var idx = 0; idx < n; idx++) {
(function (i) {
var source = sources[i], sad = new SingleAssignmentDisposable();
isPromise(source) && (source = observableFromPromise(source));
sad.setDisposable(source.subscribe(function (x) {
queues[i].push(x);
next(i);
}, observer.onError.bind(observer), function () {
done(i);
}));
subscriptions[i] = sad;
})(idx);
}
return new CompositeDisposable(subscriptions);
});
};
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
* @param arguments Observable sources.
* @param {Function} resultSelector Function to invoke for each series of elements at corresponding indexes in the sources.
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
Observable.zip = function () {
var args = slice.call(arguments, 0),
first = args.shift();
return first.zip.apply(first, args);
};
/**
* Merges the specified observable sequences into one observable sequence by emitting a list with the elements of the observable sequences at corresponding indexes.
* @param arguments Observable sources.
* @returns {Observable} An observable sequence containing lists of elements at corresponding indexes.
*/
Observable.zipArray = function () {
var sources = argsOrArray(arguments, 0);
return new AnonymousObservable(function (observer) {
var n = sources.length,
queues = arrayInitialize(n, function () { return []; }),
isDone = arrayInitialize(n, function () { return false; });
function next(i) {
if (queues.every(function (x) { return x.length > 0; })) {
var res = queues.map(function (x) { return x.shift(); });
observer.onNext(res);
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
observer.onCompleted();
return;
}
};
function done(i) {
isDone[i] = true;
if (isDone.every(identity)) {
observer.onCompleted();
return;
}
}
var subscriptions = new Array(n);
for (var idx = 0; idx < n; idx++) {
(function (i) {
subscriptions[i] = new SingleAssignmentDisposable();
subscriptions[i].setDisposable(sources[i].subscribe(function (x) {
queues[i].push(x);
next(i);
}, observer.onError.bind(observer), function () {
done(i);
}));
})(idx);
}
var compositeDisposable = new CompositeDisposable(subscriptions);
compositeDisposable.add(disposableCreate(function () {
for (var qIdx = 0, qLen = queues.length; qIdx < qLen; qIdx++) {
queues[qIdx] = [];
}
}));
return compositeDisposable;
});
};
/**
* Hides the identity of an observable sequence.
* @returns {Observable} An observable sequence that hides the identity of the source sequence.
*/
observableProto.asObservable = function () {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(observer);
});
};
/**
* Projects each element of an observable sequence into zero or more buffers which are produced based on element count information.
*
* @example
* var res = xs.bufferWithCount(10);
* var res = xs.bufferWithCount(10, 1);
* @param {Number} count Length of each buffer.
* @param {Number} [skip] Number of elements to skip between creation of consecutive buffers. If not provided, defaults to the count.
* @returns {Observable} An observable sequence of buffers.
*/
observableProto.bufferWithCount = function (count, skip) {
if (typeof skip !== 'number') {
skip = count;
}
return this.windowWithCount(count, skip).selectMany(function (x) {
return x.toArray();
}).where(function (x) {
return x.length > 0;
});
};
/**
* Dematerializes the explicit notification values of an observable sequence as implicit notifications.
* @returns {Observable} An observable sequence exhibiting the behavior corresponding to the source sequence's notification values.
*/
observableProto.dematerialize = function () {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(function (x) {
return x.accept(observer);
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Returns an observable sequence that contains only distinct contiguous elements according to the keySelector and the comparer.
*
* var obs = observable.distinctUntilChanged();
* var obs = observable.distinctUntilChanged(function (x) { return x.id; });
* var obs = observable.distinctUntilChanged(function (x) { return x.id; }, function (x, y) { return x === y; });
*
* @param {Function} [keySelector] A function to compute the comparison key for each element. If not provided, it projects the value.
* @param {Function} [comparer] Equality comparer for computed key values. If not provided, defaults to an equality comparer function.
* @returns {Observable} An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence.
*/
observableProto.distinctUntilChanged = function (keySelector, comparer) {
var source = this;
keySelector || (keySelector = identity);
comparer || (comparer = defaultComparer);
return new AnonymousObservable(function (observer) {
var hasCurrentKey = false, currentKey;
return source.subscribe(function (value) {
var comparerEquals = false, key;
try {
key = keySelector(value);
} catch (exception) {
observer.onError(exception);
return;
}
if (hasCurrentKey) {
try {
comparerEquals = comparer(currentKey, key);
} catch (exception) {
observer.onError(exception);
return;
}
}
if (!hasCurrentKey || !comparerEquals) {
hasCurrentKey = true;
currentKey = key;
observer.onNext(value);
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Invokes an action for each element in the observable sequence and invokes an action upon graceful or exceptional termination of the observable sequence.
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
*
* @example
* var res = observable.do(observer);
* var res = observable.do(onNext);
* var res = observable.do(onNext, onError);
* var res = observable.do(onNext, onError, onCompleted);
* @param {Function | Observer} observerOrOnNext Action to invoke for each element in the observable sequence or an observer.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function.
* @returns {Observable} The source sequence with the side-effecting behavior applied.
*/
observableProto['do'] = observableProto.doAction = observableProto.tap = function (observerOrOnNext, onError, onCompleted) {
var source = this, onNextFunc;
if (typeof observerOrOnNext === 'function') {
onNextFunc = observerOrOnNext;
} else {
onNextFunc = observerOrOnNext.onNext.bind(observerOrOnNext);
onError = observerOrOnNext.onError.bind(observerOrOnNext);
onCompleted = observerOrOnNext.onCompleted.bind(observerOrOnNext);
}
return new AnonymousObservable(function (observer) {
return source.subscribe(function (x) {
try {
onNextFunc(x);
} catch (e) {
observer.onError(e);
}
observer.onNext(x);
}, function (err) {
if (!onError) {
observer.onError(err);
} else {
try {
onError(err);
} catch (e) {
observer.onError(e);
}
observer.onError(err);
}
}, function () {
if (!onCompleted) {
observer.onCompleted();
} else {
try {
onCompleted();
} catch (e) {
observer.onError(e);
}
observer.onCompleted();
}
});
});
};
/**
* Invokes a specified action after the source observable sequence terminates gracefully or exceptionally.
*
* @example
* var res = observable.finallyAction(function () { console.log('sequence ended'; });
* @param {Function} finallyAction Action to invoke after the source observable sequence terminates.
* @returns {Observable} Source sequence with the action-invoking termination behavior applied.
*/
observableProto['finally'] = observableProto.finallyAction = function (action) {
var source = this;
return new AnonymousObservable(function (observer) {
var subscription;
try {
subscription = source.subscribe(observer);
} catch (e) {
action();
throw e;
}
return disposableCreate(function () {
try {
subscription.dispose();
} catch (e) {
throw e;
} finally {
action();
}
});
});
};
/**
* Ignores all elements in an observable sequence leaving only the termination messages.
* @returns {Observable} An empty observable sequence that signals termination, successful or exceptional, of the source sequence.
*/
observableProto.ignoreElements = function () {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(noop, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Materializes the implicit notifications of an observable sequence as explicit notification values.
* @returns {Observable} An observable sequence containing the materialized notification values from the source sequence.
*/
observableProto.materialize = function () {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(function (value) {
observer.onNext(notificationCreateOnNext(value));
}, function (e) {
observer.onNext(notificationCreateOnError(e));
observer.onCompleted();
}, function () {
observer.onNext(notificationCreateOnCompleted());
observer.onCompleted();
});
});
};
/**
* Repeats the observable sequence a specified number of times. If the repeat count is not specified, the sequence repeats indefinitely.
*
* @example
* var res = repeated = source.repeat();
* var res = repeated = source.repeat(42);
* @param {Number} [repeatCount] Number of times to repeat the sequence. If not provided, repeats the sequence indefinitely.
* @returns {Observable} The observable sequence producing the elements of the given sequence repeatedly.
*/
observableProto.repeat = function (repeatCount) {
return enumerableRepeat(this, repeatCount).concat();
};
/**
* Repeats the source observable sequence the specified number of times or until it successfully terminates. If the retry count is not specified, it retries indefinitely.
* Note if you encounter an error and want it to retry once, then you must use .retry(2);
*
* @example
* var res = retried = retry.repeat();
* var res = retried = retry.repeat(2);
* @param {Number} [retryCount] Number of times to retry the sequence. If not provided, retry the sequence indefinitely.
* @returns {Observable} An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully.
*/
observableProto.retry = function (retryCount) {
return enumerableRepeat(this, retryCount).catchException();
};
/**
* Applies an accumulator function over an observable sequence and returns each intermediate result. The optional seed value is used as the initial accumulator value.
* For aggregation behavior with no intermediate results, see Observable.aggregate.
* @example
* var res = source.scan(function (acc, x) { return acc + x; });
* var res = source.scan(0, function (acc, x) { return acc + x; });
* @param {Mixed} [seed] The initial accumulator value.
* @param {Function} accumulator An accumulator function to be invoked on each element.
* @returns {Observable} An observable sequence containing the accumulated values.
*/
observableProto.scan = function () {
var hasSeed = false, seed, accumulator, source = this;
if (arguments.length === 2) {
hasSeed = true;
seed = arguments[0];
accumulator = arguments[1];
} else {
accumulator = arguments[0];
}
return new AnonymousObservable(function (observer) {
var hasAccumulation, accumulation, hasValue;
return source.subscribe (
function (x) {
try {
if (!hasValue) {
hasValue = true;
}
if (hasAccumulation) {
accumulation = accumulator(accumulation, x);
} else {
accumulation = hasSeed ? accumulator(seed, x) : x;
hasAccumulation = true;
}
} catch (e) {
observer.onError(e);
return;
}
observer.onNext(accumulation);
},
observer.onError.bind(observer),
function () {
if (!hasValue && hasSeed) {
observer.onNext(seed);
}
observer.onCompleted();
}
);
});
};
/**
* Bypasses a specified number of elements at the end of an observable sequence.
* @description
* This operator accumulates a queue with a length enough to store the first `count` elements. As more elements are
* received, elements are taken from the front of the queue and produced on the result sequence. This causes elements to be delayed.
* @param count Number of elements to bypass at the end of the source sequence.
* @returns {Observable} An observable sequence containing the source sequence elements except for the bypassed ones at the end.
*/
observableProto.skipLast = function (count) {
var source = this;
return new AnonymousObservable(function (observer) {
var q = [];
return source.subscribe(function (x) {
q.push(x);
if (q.length > count) {
observer.onNext(q.shift());
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Prepends a sequence of values to an observable sequence with an optional scheduler and an argument list of values to prepend.
*
* var res = source.startWith(1, 2, 3);
* var res = source.startWith(Rx.Scheduler.timeout, 1, 2, 3);
*
* @memberOf Observable#
* @returns {Observable} The source sequence prepended with the specified values.
*/
observableProto.startWith = function () {
var values, scheduler, start = 0;
if (!!arguments.length && 'now' in Object(arguments[0])) {
scheduler = arguments[0];
start = 1;
} else {
scheduler = immediateScheduler;
}
values = slice.call(arguments, start);
return enumerableFor([observableFromArray(values, scheduler), this]).concat();
};
/**
* Returns a specified number of contiguous elements from the end of an observable sequence.
*
* @example
* var res = source.takeLast(5);
*
* @description
* This operator accumulates a buffer with a length enough to store elements count elements. Upon completion of
* the source sequence, this buffer is drained on the result sequence. This causes the elements to be delayed.
* @param {Number} count Number of elements to take from the end of the source sequence.
* @returns {Observable} An observable sequence containing the specified number of elements from the end of the source sequence.
*/
observableProto.takeLast = function (count) {
var source = this;
return new AnonymousObservable(function (observer) {
var q = [];
return source.subscribe(function (x) {
q.push(x);
q.length > count && q.shift();
}, observer.onError.bind(observer), function () {
while(q.length > 0) { observer.onNext(q.shift()); }
observer.onCompleted();
});
});
};
/**
* Returns an array with the specified number of contiguous elements from the end of an observable sequence.
*
* @description
* This operator accumulates a buffer with a length enough to store count elements. Upon completion of the
* source sequence, this buffer is produced on the result sequence.
* @param {Number} count Number of elements to take from the end of the source sequence.
* @returns {Observable} An observable sequence containing a single array with the specified number of elements from the end of the source sequence.
*/
observableProto.takeLastBuffer = function (count) {
var source = this;
return new AnonymousObservable(function (observer) {
var q = [];
return source.subscribe(function (x) {
q.push(x);
q.length > count && q.shift();
}, observer.onError.bind(observer), function () {
observer.onNext(q);
observer.onCompleted();
});
});
};
/**
* Projects each element of an observable sequence into zero or more windows which are produced based on element count information.
*
* var res = xs.windowWithCount(10);
* var res = xs.windowWithCount(10, 1);
* @param {Number} count Length of each window.
* @param {Number} [skip] Number of elements to skip between creation of consecutive windows. If not specified, defaults to the count.
* @returns {Observable} An observable sequence of windows.
*/
observableProto.windowWithCount = function (count, skip) {
var source = this;
if (count <= 0) {
throw new Error(argumentOutOfRange);
}
if (arguments.length === 1) {
skip = count;
}
if (skip <= 0) {
throw new Error(argumentOutOfRange);
}
return new AnonymousObservable(function (observer) {
var m = new SingleAssignmentDisposable(),
refCountDisposable = new RefCountDisposable(m),
n = 0,
q = [],
createWindow = function () {
var s = new Subject();
q.push(s);
observer.onNext(addRef(s, refCountDisposable));
};
createWindow();
m.setDisposable(source.subscribe(function (x) {
var s;
for (var i = 0, len = q.length; i < len; i++) {
q[i].onNext(x);
}
var c = n - count + 1;
if (c >= 0 && c % skip === 0) {
s = q.shift();
s.onCompleted();
}
n++;
if (n % skip === 0) {
createWindow();
}
}, function (exception) {
while (q.length > 0) {
q.shift().onError(exception);
}
observer.onError(exception);
}, function () {
while (q.length > 0) {
q.shift().onCompleted();
}
observer.onCompleted();
}));
return refCountDisposable;
});
};
function concatMap(source, selector, thisArg) {
return source.map(function (x, i) {
var result = selector.call(thisArg, x, i);
return isPromise(result) ? observableFromPromise(result) : result;
}).concatAll();
}
/**
* One of the Following:
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
*
* @example
* var res = source.concatMap(function (x) { return Rx.Observable.range(0, x); });
* Or:
* Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
*
* var res = source.concatMap(function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
* Or:
* Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
*
* var res = source.concatMap(Rx.Observable.fromArray([1,2,3]));
* @param selector A transform function to apply to each element or an observable sequence to project each element from the
* source sequence onto which could be either an observable or Promise.
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
*/
observableProto.selectConcat = observableProto.concatMap = function (selector, resultSelector, thisArg) {
if (resultSelector) {
return this.concatMap(function (x, i) {
var selectorResult = selector(x, i),
result = isPromise(selectorResult) ? observableFromPromise(selectorResult) : selectorResult;
return result.map(function (y) {
return resultSelector(x, y, i);
});
});
}
return typeof selector === 'function' ?
concatMap(this, selector, thisArg) :
concatMap(this, function () { return selector; });
};
/**
* Projects each notification of an observable sequence to an observable sequence and concats the resulting observable sequences into one observable sequence.
* @param {Function} onNext A transform function to apply to each element; the second parameter of the function represents the index of the source element.
* @param {Function} onError A transform function to apply when an error occurs in the source sequence.
* @param {Function} onCompleted A transform function to apply when the end of the source sequence is reached.
* @param {Any} [thisArg] An optional "this" to use to invoke each transform.
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function corresponding to each notification in the input sequence.
*/
observableProto.concatMapObserver = observableProto.selectConcatObserver = function(onNext, onError, onCompleted, thisArg) {
var source = this;
return new AnonymousObservable(function (observer) {
var index = 0;
return source.subscribe(
function (x) {
var result;
try {
result = onNext.call(thisArg, x, index++);
} catch (e) {
observer.onError(e);
return;
}
isPromise(result) && (result = observableFromPromise(result));
observer.onNext(result);
},
function (err) {
var result;
try {
result = onError.call(thisArg, err);
} catch (e) {
observer.onError(e);
return;
}
isPromise(result) && (result = observableFromPromise(result));
observer.onNext(result);
observer.onCompleted();
},
function () {
var result;
try {
result = onCompleted.call(thisArg);
} catch (e) {
observer.onError(e);
return;
}
isPromise(result) && (result = observableFromPromise(result));
observer.onNext(result);
observer.onCompleted();
});
}).concatAll();
};
/**
* Returns the elements of the specified sequence or the specified value in a singleton sequence if the sequence is empty.
*
* var res = obs = xs.defaultIfEmpty();
* 2 - obs = xs.defaultIfEmpty(false);
*
* @memberOf Observable#
* @param defaultValue The value to return if the sequence is empty. If not provided, this defaults to null.
* @returns {Observable} An observable sequence that contains the specified default value if the source is empty; otherwise, the elements of the source itself.
*/
observableProto.defaultIfEmpty = function (defaultValue) {
var source = this;
if (defaultValue === undefined) {
defaultValue = null;
}
return new AnonymousObservable(function (observer) {
var found = false;
return source.subscribe(function (x) {
found = true;
observer.onNext(x);
}, observer.onError.bind(observer), function () {
if (!found) {
observer.onNext(defaultValue);
}
observer.onCompleted();
});
});
};
// Swap out for Array.findIndex
function arrayIndexOfComparer(array, item, comparer) {
for (var i = 0, len = array.length; i < len; i++) {
if (comparer(array[i], item)) { return i; }
}
return -1;
}
function HashSet(comparer) {
this.comparer = comparer;
this.set = [];
}
HashSet.prototype.push = function(value) {
var retValue = arrayIndexOfComparer(this.set, value, this.comparer) === -1;
retValue && this.set.push(value);
return retValue;
};
/**
* Returns an observable sequence that contains only distinct elements according to the keySelector and the comparer.
* Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large.
*
* @example
* var res = obs = xs.distinct();
* 2 - obs = xs.distinct(function (x) { return x.id; });
* 2 - obs = xs.distinct(function (x) { return x.id; }, function (a,b) { return a === b; });
* @param {Function} [keySelector] A function to compute the comparison key for each element.
* @param {Function} [comparer] Used to compare items in the collection.
* @returns {Observable} An observable sequence only containing the distinct elements, based on a computed key value, from the source sequence.
*/
observableProto.distinct = function (keySelector, comparer) {
var source = this;
comparer || (comparer = defaultComparer);
return new AnonymousObservable(function (observer) {
var hashSet = new HashSet(comparer);
return source.subscribe(function (x) {
var key = x;
if (keySelector) {
try {
key = keySelector(x);
} catch (e) {
observer.onError(e);
return;
}
}
hashSet.push(key) && observer.onNext(x);
},
observer.onError.bind(observer),
observer.onCompleted.bind(observer));
});
};
/**
* Groups the elements of an observable sequence according to a specified key selector function and comparer and selects the resulting elements by using a specified function.
*
* @example
* var res = observable.groupBy(function (x) { return x.id; });
* 2 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; });
* 3 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; }, function (x) { return x.toString(); });
* @param {Function} keySelector A function to extract the key for each element.
* @param {Function} [elementSelector] A function to map each source element to an element in an observable group.
* @param {Function} [comparer] Used to determine whether the objects are equal.
* @returns {Observable} A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
*/
observableProto.groupBy = function (keySelector, elementSelector, comparer) {
return this.groupByUntil(keySelector, elementSelector, observableNever, comparer);
};
/**
* Groups the elements of an observable sequence according to a specified key selector function.
* A duration selector function is used to control the lifetime of groups. When a group expires, it receives an OnCompleted notification. When a new element with the same
* key value as a reclaimed group occurs, the group will be reborn with a new lifetime request.
*
* @example
* var res = observable.groupByUntil(function (x) { return x.id; }, null, function () { return Rx.Observable.never(); });
* 2 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; }, function () { return Rx.Observable.never(); });
* 3 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; }, function () { return Rx.Observable.never(); }, function (x) { return x.toString(); });
* @param {Function} keySelector A function to extract the key for each element.
* @param {Function} durationSelector A function to signal the expiration of a group.
* @param {Function} [comparer] Used to compare objects. When not specified, the default comparer is used.
* @returns {Observable}
* A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
* If a group's lifetime expires, a new group with the same key value can be created once an element with such a key value is encoutered.
*
*/
observableProto.groupByUntil = function (keySelector, elementSelector, durationSelector, comparer) {
var source = this;
elementSelector || (elementSelector = identity);
comparer || (comparer = defaultComparer);
return new AnonymousObservable(function (observer) {
function handleError(e) { return function (item) { item.onError(e); }; }
var map = new Dictionary(0, comparer),
groupDisposable = new CompositeDisposable(),
refCountDisposable = new RefCountDisposable(groupDisposable);
groupDisposable.add(source.subscribe(function (x) {
var key;
try {
key = keySelector(x);
} catch (e) {
map.getValues().forEach(handleError(e));
observer.onError(e);
return;
}
var fireNewMapEntry = false,
writer = map.tryGetValue(key);
if (!writer) {
writer = new Subject();
map.set(key, writer);
fireNewMapEntry = true;
}
if (fireNewMapEntry) {
var group = new GroupedObservable(key, writer, refCountDisposable),
durationGroup = new GroupedObservable(key, writer);
try {
duration = durationSelector(durationGroup);
} catch (e) {
map.getValues().forEach(handleError(e));
observer.onError(e);
return;
}
observer.onNext(group);
var md = new SingleAssignmentDisposable();
groupDisposable.add(md);
var expire = function () {
map.remove(key) && writer.onCompleted();
groupDisposable.remove(md);
};
md.setDisposable(duration.take(1).subscribe(
noop,
function (exn) {
map.getValues().forEach(handleError(exn));
observer.onError(exn);
},
expire)
);
}
var element;
try {
element = elementSelector(x);
} catch (e) {
map.getValues().forEach(handleError(e));
observer.onError(e);
return;
}
writer.onNext(element);
}, function (ex) {
map.getValues().forEach(handleError(ex));
observer.onError(ex);
}, function () {
map.getValues().forEach(function (item) { item.onCompleted(); });
observer.onCompleted();
}));
return refCountDisposable;
});
};
/**
* Projects each element of an observable sequence into a new form by incorporating the element's index.
* @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source.
*/
observableProto.select = observableProto.map = function (selector, thisArg) {
var parent = this;
return new AnonymousObservable(function (observer) {
var count = 0;
return parent.subscribe(function (value) {
var result;
try {
result = selector.call(thisArg, value, count++, parent);
} catch (exception) {
observer.onError(exception);
return;
}
observer.onNext(result);
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Retrieves the value of a specified property from all elements in the Observable sequence.
* @param {String} property The property to pluck.
* @returns {Observable} Returns a new Observable sequence of property values.
*/
observableProto.pluck = function (property) {
return this.select(function (x) { return x[property]; });
};
function flatMap(source, selector, thisArg) {
return source.map(function (x, i) {
var result = selector.call(thisArg, x, i);
return isPromise(result) ? observableFromPromise(result) : result;
}).mergeObservable();
}
/**
* One of the Following:
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
*
* @example
* var res = source.selectMany(function (x) { return Rx.Observable.range(0, x); });
* Or:
* Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
*
* var res = source.selectMany(function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
* Or:
* Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
*
* var res = source.selectMany(Rx.Observable.fromArray([1,2,3]));
* @param selector A transform function to apply to each element or an observable sequence to project each element from the
* source sequence onto which could be either an observable or Promise.
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
*/
observableProto.selectMany = observableProto.flatMap = function (selector, resultSelector, thisArg) {
if (resultSelector) {
return this.flatMap(function (x, i) {
var selectorResult = selector(x, i),
result = isPromise(selectorResult) ? observableFromPromise(selectorResult) : selectorResult;
return result.map(function (y) {
return resultSelector(x, y, i);
});
}, thisArg);
}
return typeof selector === 'function' ?
flatMap(this, selector, thisArg) :
flatMap(this, function () { return selector; });
};
/**
* Projects each notification of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
* @param {Function} onNext A transform function to apply to each element; the second parameter of the function represents the index of the source element.
* @param {Function} onError A transform function to apply when an error occurs in the source sequence.
* @param {Function} onCompleted A transform function to apply when the end of the source sequence is reached.
* @param {Any} [thisArg] An optional "this" to use to invoke each transform.
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function corresponding to each notification in the input sequence.
*/
observableProto.flatMapObserver = observableProto.selectManyObserver = function (onNext, onError, onCompleted, thisArg) {
var source = this;
return new AnonymousObservable(function (observer) {
var index = 0;
return source.subscribe(
function (x) {
var result;
try {
result = onNext.call(thisArg, x, index++);
} catch (e) {
observer.onError(e);
return;
}
isPromise(result) && (result = observableFromPromise(result));
observer.onNext(result);
},
function (err) {
var result;
try {
result = onError.call(thisArg, err);
} catch (e) {
observer.onError(e);
return;
}
isPromise(result) && (result = observableFromPromise(result));
observer.onNext(result);
observer.onCompleted();
},
function () {
var result;
try {
result = onCompleted.call(thisArg);
} catch (e) {
observer.onError(e);
return;
}
isPromise(result) && (result = observableFromPromise(result));
observer.onNext(result);
observer.onCompleted();
});
}).mergeAll();
};
/**
* Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then
* transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.
* @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences
* and that at any point in time produces the elements of the most recent inner observable sequence that has been received.
*/
observableProto.selectSwitch = observableProto.flatMapLatest = observableProto.switchMap = function (selector, thisArg) {
return this.select(selector, thisArg).switchLatest();
};
/**
* Bypasses a specified number of elements in an observable sequence and then returns the remaining elements.
* @param {Number} count The number of elements to skip before returning the remaining elements.
* @returns {Observable} An observable sequence that contains the elements that occur after the specified index in the input sequence.
*/
observableProto.skip = function (count) {
if (count < 0) {
throw new Error(argumentOutOfRange);
}
var observable = this;
return new AnonymousObservable(function (observer) {
var remaining = count;
return observable.subscribe(function (x) {
if (remaining <= 0) {
observer.onNext(x);
} else {
remaining--;
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Bypasses elements in an observable sequence as long as a specified condition is true and then returns the remaining elements.
* The element's index is used in the logic of the predicate function.
*
* var res = source.skipWhile(function (value) { return value < 10; });
* var res = source.skipWhile(function (value, index) { return value < 10 || index < 10; });
* @param {Function} predicate A function to test each element for a condition; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate.
*/
observableProto.skipWhile = function (predicate, thisArg) {
var source = this;
return new AnonymousObservable(function (observer) {
var i = 0, running = false;
return source.subscribe(function (x) {
if (!running) {
try {
running = !predicate.call(thisArg, x, i++, source);
} catch (e) {
observer.onError(e);
return;
}
}
if (running) {
observer.onNext(x);
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Returns a specified number of contiguous elements from the start of an observable sequence, using the specified scheduler for the edge case of take(0).
*
* var res = source.take(5);
* var res = source.take(0, Rx.Scheduler.timeout);
* @param {Number} count The number of elements to return.
* @param {Scheduler} [scheduler] Scheduler used to produce an OnCompleted message in case <paramref name="count count</paramref> is set to 0.
* @returns {Observable} An observable sequence that contains the specified number of elements from the start of the input sequence.
*/
observableProto.take = function (count, scheduler) {
if (count < 0) {
throw new Error(argumentOutOfRange);
}
if (count === 0) {
return observableEmpty(scheduler);
}
var observable = this;
return new AnonymousObservable(function (observer) {
var remaining = count;
return observable.subscribe(function (x) {
if (remaining > 0) {
remaining--;
observer.onNext(x);
if (remaining === 0) {
observer.onCompleted();
}
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Returns elements from an observable sequence as long as a specified condition is true.
* The element's index is used in the logic of the predicate function.
*
* @example
* var res = source.takeWhile(function (value) { return value < 10; });
* var res = source.takeWhile(function (value, index) { return value < 10 || index < 10; });
* @param {Function} predicate A function to test each element for a condition; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes.
*/
observableProto.takeWhile = function (predicate, thisArg) {
var observable = this;
return new AnonymousObservable(function (observer) {
var i = 0, running = true;
return observable.subscribe(function (x) {
if (running) {
try {
running = predicate.call(thisArg, x, i++, observable);
} catch (e) {
observer.onError(e);
return;
}
if (running) {
observer.onNext(x);
} else {
observer.onCompleted();
}
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Filters the elements of an observable sequence based on a predicate by incorporating the element's index.
*
* @example
* var res = source.where(function (value) { return value < 10; });
* var res = source.where(function (value, index) { return value < 10 || index < 10; });
* @param {Function} predicate A function to test each source element for a condition; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence that contains elements from the input sequence that satisfy the condition.
*/
observableProto.where = observableProto.filter = function (predicate, thisArg) {
var parent = this;
return new AnonymousObservable(function (observer) {
var count = 0;
return parent.subscribe(function (value) {
var shouldRun;
try {
shouldRun = predicate.call(thisArg, value, count++, parent);
} catch (exception) {
observer.onError(exception);
return;
}
if (shouldRun) {
observer.onNext(value);
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
observableProto.finalValue = function () {
var source = this;
return new AnonymousObservable(function (observer) {
var hasValue = false, value;
return source.subscribe(function (x) {
hasValue = true;
value = x;
}, observer.onError.bind(observer), function () {
if (!hasValue) {
observer.onError(new Error(sequenceContainsNoElements));
} else {
observer.onNext(value);
observer.onCompleted();
}
});
});
};
function extremaBy(source, keySelector, comparer) {
return new AnonymousObservable(function (observer) {
var hasValue = false, lastKey = null, list = [];
return source.subscribe(function (x) {
var comparison, key;
try {
key = keySelector(x);
} catch (ex) {
observer.onError(ex);
return;
}
comparison = 0;
if (!hasValue) {
hasValue = true;
lastKey = key;
} else {
try {
comparison = comparer(key, lastKey);
} catch (ex1) {
observer.onError(ex1);
return;
}
}
if (comparison > 0) {
lastKey = key;
list = [];
}
if (comparison >= 0) {
list.push(x);
}
}, observer.onError.bind(observer), function () {
observer.onNext(list);
observer.onCompleted();
});
});
}
function firstOnly(x) {
if (x.length === 0) {
throw new Error(sequenceContainsNoElements);
}
return x[0];
}
/**
* Applies an accumulator function over an observable sequence, returning the result of the aggregation as a single element in the result sequence. The specified seed value is used as the initial accumulator value.
* For aggregation behavior with incremental intermediate results, see Observable.scan.
* @example
* 1 - res = source.aggregate(function (acc, x) { return acc + x; });
* 2 - res = source.aggregate(0, function (acc, x) { return acc + x; });
* @param {Mixed} [seed] The initial accumulator value.
* @param {Function} accumulator An accumulator function to be invoked on each element.
* @returns {Observable} An observable sequence containing a single element with the final accumulator value.
*/
observableProto.aggregate = function () {
var seed, hasSeed, accumulator;
if (arguments.length === 2) {
seed = arguments[0];
hasSeed = true;
accumulator = arguments[1];
} else {
accumulator = arguments[0];
}
return hasSeed ? this.scan(seed, accumulator).startWith(seed).finalValue() : this.scan(accumulator).finalValue();
};
/**
* Applies an accumulator function over an observable sequence, returning the result of the aggregation as a single element in the result sequence. The specified seed value is used as the initial accumulator value.
* For aggregation behavior with incremental intermediate results, see Observable.scan.
* @example
* 1 - res = source.reduce(function (acc, x) { return acc + x; });
* 2 - res = source.reduce(function (acc, x) { return acc + x; }, 0);
* @param {Function} accumulator An accumulator function to be invoked on each element.
* @param {Any} [seed] The initial accumulator value.
* @returns {Observable} An observable sequence containing a single element with the final accumulator value.
*/
observableProto.reduce = function (accumulator) {
var seed, hasSeed;
if (arguments.length === 2) {
hasSeed = true;
seed = arguments[1];
}
return hasSeed ? this.scan(seed, accumulator).startWith(seed).finalValue() : this.scan(accumulator).finalValue();
};
/**
* Determines whether any element of an observable sequence satisfies a condition if present, else if any items are in the sequence.
* @example
* var result = source.any();
* var result = source.any(function (x) { return x > 3; });
* @param {Function} [predicate] A function to test each element for a condition.
* @returns {Observable} An observable sequence containing a single element determining whether any elements in the source sequence pass the test in the specified predicate if given, else if any items are in the sequence.
*/
observableProto.some = observableProto.any = function (predicate, thisArg) {
var source = this;
return predicate ?
source.where(predicate, thisArg).any() :
new AnonymousObservable(function (observer) {
return source.subscribe(function () {
observer.onNext(true);
observer.onCompleted();
}, observer.onError.bind(observer), function () {
observer.onNext(false);
observer.onCompleted();
});
});
};
/**
* Determines whether an observable sequence is empty.
* @returns {Observable} An observable sequence containing a single element determining whether the source sequence is empty.
*/
observableProto.isEmpty = function () {
return this.any().map(not);
};
/**
* Determines whether all elements of an observable sequence satisfy a condition.
*
* 1 - res = source.all(function (value) { return value.length > 3; });
* @memberOf Observable#
* @param {Function} [predicate] A function to test each element for a condition.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence containing a single element determining whether all elements in the source sequence pass the test in the specified predicate.
*/
observableProto.every = observableProto.all = function (predicate, thisArg) {
return this.where(function (v) {
return !predicate(v);
}, thisArg).any().select(function (b) {
return !b;
});
};
/**
* Determines whether an observable sequence contains a specified element with an optional equality comparer.
* @example
* 1 - res = source.contains(42);
* 2 - res = source.contains({ value: 42 }, function (x, y) { return x.value === y.value; });
* @param value The value to locate in the source sequence.
* @param {Function} [comparer] An equality comparer to compare elements.
* @returns {Observable} An observable sequence containing a single element determining whether the source sequence contains an element that has the specified value.
*/
observableProto.contains = function (value, comparer) {
comparer || (comparer = defaultComparer);
return this.where(function (v) {
return comparer(v, value);
}).any();
};
/**
* Returns an observable sequence containing a value that represents how many elements in the specified observable sequence satisfy a condition if provided, else the count of items.
* @example
* res = source.count();
* res = source.count(function (x) { return x > 3; });
* @param {Function} [predicate]A function to test each element for a condition.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence containing a single element with a number that represents how many elements in the input sequence satisfy the condition in the predicate function if provided, else the count of items in the sequence.
*/
observableProto.count = function (predicate, thisArg) {
return predicate ?
this.where(predicate, thisArg).count() :
this.aggregate(0, function (count) {
return count + 1;
});
};
/**
* Computes the sum of a sequence of values that are obtained by invoking an optional transform function on each element of the input sequence, else if not specified computes the sum on each item in the sequence.
* @example
* var res = source.sum();
* var res = source.sum(function (x) { return x.value; });
* @param {Function} [selector] A transform function to apply to each element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence containing a single element with the sum of the values in the source sequence.
*/
observableProto.sum = function (keySelector, thisArg) {
return keySelector ?
this.select(keySelector, thisArg).sum() :
this.aggregate(0, function (prev, curr) {
return prev + curr;
});
};
/**
* Returns the elements in an observable sequence with the minimum key value according to the specified comparer.
* @example
* var res = source.minBy(function (x) { return x.value; });
* var res = source.minBy(function (x) { return x.value; }, function (x, y) { return x - y; });
* @param {Function} keySelector Key selector function.
* @param {Function} [comparer] Comparer used to compare key values.
* @returns {Observable} An observable sequence containing a list of zero or more elements that have a minimum key value.
*/
observableProto.minBy = function (keySelector, comparer) {
comparer || (comparer = defaultSubComparer);
return extremaBy(this, keySelector, function (x, y) {
return comparer(x, y) * -1;
});
};
/**
* Returns the minimum element in an observable sequence according to the optional comparer else a default greater than less than check.
* @example
* var res = source.min();
* var res = source.min(function (x, y) { return x.value - y.value; });
* @param {Function} [comparer] Comparer used to compare elements.
* @returns {Observable} An observable sequence containing a single element with the minimum element in the source sequence.
*/
observableProto.min = function (comparer) {
return this.minBy(identity, comparer).select(function (x) {
return firstOnly(x);
});
};
/**
* Returns the elements in an observable sequence with the maximum key value according to the specified comparer.
* @example
* var res = source.maxBy(function (x) { return x.value; });
* var res = source.maxBy(function (x) { return x.value; }, function (x, y) { return x - y;; });
* @param {Function} keySelector Key selector function.
* @param {Function} [comparer] Comparer used to compare key values.
* @returns {Observable} An observable sequence containing a list of zero or more elements that have a maximum key value.
*/
observableProto.maxBy = function (keySelector, comparer) {
comparer || (comparer = defaultSubComparer);
return extremaBy(this, keySelector, comparer);
};
/**
* Returns the maximum value in an observable sequence according to the specified comparer.
* @example
* var res = source.max();
* var res = source.max(function (x, y) { return x.value - y.value; });
* @param {Function} [comparer] Comparer used to compare elements.
* @returns {Observable} An observable sequence containing a single element with the maximum element in the source sequence.
*/
observableProto.max = function (comparer) {
return this.maxBy(identity, comparer).select(function (x) {
return firstOnly(x);
});
};
/**
* Computes the average of an observable sequence of values that are in the sequence or obtained by invoking a transform function on each element of the input sequence if present.
* @example
* var res = res = source.average();
* var res = res = source.average(function (x) { return x.value; });
* @param {Function} [selector] A transform function to apply to each element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence containing a single element with the average of the sequence of values.
*/
observableProto.average = function (keySelector, thisArg) {
return keySelector ?
this.select(keySelector, thisArg).average() :
this.scan({
sum: 0,
count: 0
}, function (prev, cur) {
return {
sum: prev.sum + cur,
count: prev.count + 1
};
}).finalValue().select(function (s) {
if (s.count === 0) {
throw new Error('The input sequence was empty');
}
return s.sum / s.count;
});
};
function sequenceEqualArray(first, second, comparer) {
return new AnonymousObservable(function (observer) {
var count = 0, len = second.length;
return first.subscribe(function (value) {
var equal = false;
try {
if (count < len) {
equal = comparer(value, second[count++]);
}
} catch (e) {
observer.onError(e);
return;
}
if (!equal) {
observer.onNext(false);
observer.onCompleted();
}
}, observer.onError.bind(observer), function () {
observer.onNext(count === len);
observer.onCompleted();
});
});
}
/**
* Determines whether two sequences are equal by comparing the elements pairwise using a specified equality comparer.
*
* @example
* var res = res = source.sequenceEqual([1,2,3]);
* var res = res = source.sequenceEqual([{ value: 42 }], function (x, y) { return x.value === y.value; });
* 3 - res = source.sequenceEqual(Rx.Observable.returnValue(42));
* 4 - res = source.sequenceEqual(Rx.Observable.returnValue({ value: 42 }), function (x, y) { return x.value === y.value; });
* @param {Observable} second Second observable sequence or array to compare.
* @param {Function} [comparer] Comparer used to compare elements of both sequences.
* @returns {Observable} An observable sequence that contains a single element which indicates whether both sequences are of equal length and their corresponding elements are equal according to the specified equality comparer.
*/
observableProto.sequenceEqual = function (second, comparer) {
var first = this;
comparer || (comparer = defaultComparer);
if (Array.isArray(second)) {
return sequenceEqualArray(first, second, comparer);
}
return new AnonymousObservable(function (observer) {
var donel = false, doner = false, ql = [], qr = [];
var subscription1 = first.subscribe(function (x) {
var equal, v;
if (qr.length > 0) {
v = qr.shift();
try {
equal = comparer(v, x);
} catch (e) {
observer.onError(e);
return;
}
if (!equal) {
observer.onNext(false);
observer.onCompleted();
}
} else if (doner) {
observer.onNext(false);
observer.onCompleted();
} else {
ql.push(x);
}
}, observer.onError.bind(observer), function () {
donel = true;
if (ql.length === 0) {
if (qr.length > 0) {
observer.onNext(false);
observer.onCompleted();
} else if (doner) {
observer.onNext(true);
observer.onCompleted();
}
}
});
isPromise(second) && (second = observableFromPromise(second));
var subscription2 = second.subscribe(function (x) {
var equal, v;
if (ql.length > 0) {
v = ql.shift();
try {
equal = comparer(v, x);
} catch (exception) {
observer.onError(exception);
return;
}
if (!equal) {
observer.onNext(false);
observer.onCompleted();
}
} else if (donel) {
observer.onNext(false);
observer.onCompleted();
} else {
qr.push(x);
}
}, observer.onError.bind(observer), function () {
doner = true;
if (qr.length === 0) {
if (ql.length > 0) {
observer.onNext(false);
observer.onCompleted();
} else if (donel) {
observer.onNext(true);
observer.onCompleted();
}
}
});
return new CompositeDisposable(subscription1, subscription2);
});
};
function elementAtOrDefault(source, index, hasDefault, defaultValue) {
if (index < 0) {
throw new Error(argumentOutOfRange);
}
return new AnonymousObservable(function (observer) {
var i = index;
return source.subscribe(function (x) {
if (i === 0) {
observer.onNext(x);
observer.onCompleted();
}
i--;
}, observer.onError.bind(observer), function () {
if (!hasDefault) {
observer.onError(new Error(argumentOutOfRange));
} else {
observer.onNext(defaultValue);
observer.onCompleted();
}
});
});
}
/**
* Returns the element at a specified index in a sequence.
* @example
* var res = source.elementAt(5);
* @param {Number} index The zero-based index of the element to retrieve.
* @returns {Observable} An observable sequence that produces the element at the specified position in the source sequence.
*/
observableProto.elementAt = function (index) {
return elementAtOrDefault(this, index, false);
};
/**
* Returns the element at a specified index in a sequence or a default value if the index is out of range.
* @example
* var res = source.elementAtOrDefault(5);
* var res = source.elementAtOrDefault(5, 0);
* @param {Number} index The zero-based index of the element to retrieve.
* @param [defaultValue] The default value if the index is outside the bounds of the source sequence.
* @returns {Observable} An observable sequence that produces the element at the specified position in the source sequence, or a default value if the index is outside the bounds of the source sequence.
*/
observableProto.elementAtOrDefault = function (index, defaultValue) {
return elementAtOrDefault(this, index, true, defaultValue);
};
function singleOrDefaultAsync(source, hasDefault, defaultValue) {
return new AnonymousObservable(function (observer) {
var value = defaultValue, seenValue = false;
return source.subscribe(function (x) {
if (seenValue) {
observer.onError(new Error('Sequence contains more than one element'));
} else {
value = x;
seenValue = true;
}
}, observer.onError.bind(observer), function () {
if (!seenValue && !hasDefault) {
observer.onError(new Error(sequenceContainsNoElements));
} else {
observer.onNext(value);
observer.onCompleted();
}
});
});
}
/**
* Returns the only element of an observable sequence that satisfies the condition in the optional predicate, and reports an exception if there is not exactly one element in the observable sequence.
* @example
* var res = res = source.single();
* var res = res = source.single(function (x) { return x === 42; });
* @param {Function} [predicate] A predicate function to evaluate for elements in the source sequence.
* @param {Any} [thisArg] Object to use as `this` when executing the predicate.
* @returns {Observable} Sequence containing the single element in the observable sequence that satisfies the condition in the predicate.
*/
observableProto.single = function (predicate, thisArg) {
return predicate ?
this.where(predicate, thisArg).single() :
singleOrDefaultAsync(this, false);
};
/**
* Returns the only element of an observable sequence that matches the predicate, or a default value if no such element exists; this method reports an exception if there is more than one element in the observable sequence.
* @example
* var res = res = source.singleOrDefault();
* var res = res = source.singleOrDefault(function (x) { return x === 42; });
* res = source.singleOrDefault(function (x) { return x === 42; }, 0);
* res = source.singleOrDefault(null, 0);
* @memberOf Observable#
* @param {Function} predicate A predicate function to evaluate for elements in the source sequence.
* @param [defaultValue] The default value if the index is outside the bounds of the source sequence.
* @param {Any} [thisArg] Object to use as `this` when executing the predicate.
* @returns {Observable} Sequence containing the single element in the observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.
*/
observableProto.singleOrDefault = function (predicate, defaultValue, thisArg) {
return predicate?
this.where(predicate, thisArg).singleOrDefault(null, defaultValue) :
singleOrDefaultAsync(this, true, defaultValue)
};
function firstOrDefaultAsync(source, hasDefault, defaultValue) {
return new AnonymousObservable(function (observer) {
return source.subscribe(function (x) {
observer.onNext(x);
observer.onCompleted();
}, observer.onError.bind(observer), function () {
if (!hasDefault) {
observer.onError(new Error(sequenceContainsNoElements));
} else {
observer.onNext(defaultValue);
observer.onCompleted();
}
});
});
}
/**
* Returns the first element of an observable sequence that satisfies the condition in the predicate if present else the first item in the sequence.
* @example
* var res = res = source.first();
* var res = res = source.first(function (x) { return x > 3; });
* @param {Function} [predicate] A predicate function to evaluate for elements in the source sequence.
* @param {Any} [thisArg] Object to use as `this` when executing the predicate.
* @returns {Observable} Sequence containing the first element in the observable sequence that satisfies the condition in the predicate if provided, else the first item in the sequence.
*/
observableProto.first = function (predicate, thisArg) {
return predicate ?
this.where(predicate, thisArg).first() :
firstOrDefaultAsync(this, false);
};
/**
* Returns the first element of an observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.
* @example
* var res = res = source.firstOrDefault();
* var res = res = source.firstOrDefault(function (x) { return x > 3; });
* var res = source.firstOrDefault(function (x) { return x > 3; }, 0);
* var res = source.firstOrDefault(null, 0);
* @param {Function} [predicate] A predicate function to evaluate for elements in the source sequence.
* @param {Any} [defaultValue] The default value if no such element exists. If not specified, defaults to null.
* @param {Any} [thisArg] Object to use as `this` when executing the predicate.
* @returns {Observable} Sequence containing the first element in the observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.
*/
observableProto.firstOrDefault = function (predicate, defaultValue, thisArg) {
return predicate ?
this.where(predicate).firstOrDefault(null, defaultValue) :
firstOrDefaultAsync(this, true, defaultValue);
};
function lastOrDefaultAsync(source, hasDefault, defaultValue) {
return new AnonymousObservable(function (observer) {
var value = defaultValue, seenValue = false;
return source.subscribe(function (x) {
value = x;
seenValue = true;
}, observer.onError.bind(observer), function () {
if (!seenValue && !hasDefault) {
observer.onError(new Error(sequenceContainsNoElements));
} else {
observer.onNext(value);
observer.onCompleted();
}
});
});
}
/**
* Returns the last element of an observable sequence that satisfies the condition in the predicate if specified, else the last element.
* @example
* var res = source.last();
* var res = source.last(function (x) { return x > 3; });
* @param {Function} [predicate] A predicate function to evaluate for elements in the source sequence.
* @param {Any} [thisArg] Object to use as `this` when executing the predicate.
* @returns {Observable} Sequence containing the last element in the observable sequence that satisfies the condition in the predicate.
*/
observableProto.last = function (predicate, thisArg) {
return predicate ?
this.where(predicate, thisArg).last() :
lastOrDefaultAsync(this, false);
};
/**
* Returns the last element of an observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.
* @example
* var res = source.lastOrDefault();
* var res = source.lastOrDefault(function (x) { return x > 3; });
* var res = source.lastOrDefault(function (x) { return x > 3; }, 0);
* var res = source.lastOrDefault(null, 0);
* @param {Function} [predicate] A predicate function to evaluate for elements in the source sequence.
* @param [defaultValue] The default value if no such element exists. If not specified, defaults to null.
* @param {Any} [thisArg] Object to use as `this` when executing the predicate.
* @returns {Observable} Sequence containing the last element in the observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.
*/
observableProto.lastOrDefault = function (predicate, defaultValue, thisArg) {
return predicate ?
this.where(predicate, thisArg).lastOrDefault(null, defaultValue) :
lastOrDefaultAsync(this, true, defaultValue);
};
function findValue (source, predicate, thisArg, yieldIndex) {
return new AnonymousObservable(function (observer) {
var i = 0;
return source.subscribe(function (x) {
var shouldRun;
try {
shouldRun = predicate.call(thisArg, x, i, source);
} catch(e) {
observer.onError(e);
return;
}
if (shouldRun) {
observer.onNext(yieldIndex ? i : x);
observer.onCompleted();
} else {
i++;
}
}, observer.onError.bind(observer), function () {
observer.onNext(yieldIndex ? -1 : undefined);
observer.onCompleted();
});
});
}
/**
* Searches for an element that matches the conditions defined by the specified predicate, and returns the first occurrence within the entire Observable sequence.
* @param {Function} predicate The predicate that defines the conditions of the element to search for.
* @param {Any} [thisArg] Object to use as `this` when executing the predicate.
* @returns {Observable} An Observable sequence with the first element that matches the conditions defined by the specified predicate, if found; otherwise, undefined.
*/
observableProto.find = function (predicate, thisArg) {
return findValue(this, predicate, thisArg, false);
};
/**
* Searches for an element that matches the conditions defined by the specified predicate, and returns
* an Observable sequence with the zero-based index of the first occurrence within the entire Observable sequence.
* @param {Function} predicate The predicate that defines the conditions of the element to search for.
* @param {Any} [thisArg] Object to use as `this` when executing the predicate.
* @returns {Observable} An Observable sequence with the zero-based index of the first occurrence of an element that matches the conditions defined by match, if found; otherwise, –1.
*/
observableProto.findIndex = function (predicate, thisArg) {
return findValue(this, predicate, thisArg, true);
};
function toSet(source, type) {
return new AnonymousObservable(function (observer) {
var s = new type();
return source.subscribe(
s.add.bind(s),
observer.onError.bind(observer),
function () {
observer.onNext(s);
observer.onCompleted();
});
});
}
if (!!root.Set) {
/**
* Converts the observable sequence to a Set if it exists.
* @returns {Observable} An observable sequence with a single value of a Set containing the values from the observable sequence.
*/
observableProto.toSet = function () {
return toSet(this, root.Set);
};
}
if (!!root.WeakSet) {
/**
* Converts the observable sequence to a WeakSet if it exists.
* @returns {Observable} An observable sequence with a single value of a WeakSet containing the values from the observable sequence.
*/
observableProto.toWeakSet = function () {
return toSet(this, root.WeakSet);
};
}
function toMap(source, type, keySelector, elementSelector) {
return new AnonymousObservable(function (observer) {
var m = new type();
return source.subscribe(
function (x) {
var key;
try {
key = keySelector(x);
} catch (e) {
observer.onError(e);
return;
}
var element = x;
if (elementSelector) {
try {
element = elementSelector(x);
} catch (e) {
observer.onError(e);
return;
}
}
m.set(key, element);
},
observer.onError.bind(observer),
function () {
observer.onNext(m);
observer.onCompleted();
});
});
}
if (!!root.Map) {
/**
* Converts the observable sequence to a Map if it exists.
* @param {Function} keySelector A function which produces the key for the Map.
* @param {Function} [elementSelector] An optional function which produces the element for the Map. If not present, defaults to the value from the observable sequence.
* @returns {Observable} An observable sequence with a single value of a Map containing the values from the observable sequence.
*/
observableProto.toMap = function (keySelector, elementSelector) {
return toMap(this, root.Map, keySelector, elementSelector);
};
}
if (!!root.WeakMap) {
/**
* Converts the observable sequence to a WeakMap if it exists.
* @param {Function} keySelector A function which produces the key for the WeakMap
* @param {Function} [elementSelector] An optional function which produces the element for the WeakMap. If not present, defaults to the value from the observable sequence.
* @returns {Observable} An observable sequence with a single value of a WeakMap containing the values from the observable sequence.
*/
observableProto.toWeakMap = function (keySelector, elementSelector) {
return toMap(this, root.WeakMap, keySelector, elementSelector);
};
}
/**
* Invokes the specified function asynchronously on the specified scheduler, surfacing the result through an observable sequence.
*
* @example
* var res = Rx.Observable.start(function () { console.log('hello'); });
* var res = Rx.Observable.start(function () { console.log('hello'); }, Rx.Scheduler.timeout);
* var res = Rx.Observable.start(function () { this.log('hello'); }, Rx.Scheduler.timeout, console);
*
* @param {Function} func Function to run asynchronously.
* @param {Scheduler} [scheduler] Scheduler to run the function on. If not specified, defaults to Scheduler.timeout.
* @param [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @returns {Observable} An observable sequence exposing the function's result value, or an exception.
*
* Remarks
* * The function is called immediately, not during the subscription of the resulting sequence.
* * Multiple subscriptions to the resulting sequence can observe the function's result.
*/
Observable.start = function (func, context, scheduler) {
return observableToAsync(func, context, scheduler)();
};
/**
* Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
*
* @example
* var res = Rx.Observable.toAsync(function (x, y) { return x + y; })(4, 3);
* var res = Rx.Observable.toAsync(function (x, y) { return x + y; }, Rx.Scheduler.timeout)(4, 3);
* var res = Rx.Observable.toAsync(function (x) { this.log(x); }, Rx.Scheduler.timeout, console)('hello');
*
* @param {Function} function Function to convert to an asynchronous function.
* @param {Scheduler} [scheduler] Scheduler to run the function on. If not specified, defaults to Scheduler.timeout.
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @returns {Function} Asynchronous function.
*/
var observableToAsync = Observable.toAsync = function (func, context, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return function () {
var args = arguments,
subject = new AsyncSubject();
scheduler.schedule(function () {
var result;
try {
result = func.apply(context, args);
} catch (e) {
subject.onError(e);
return;
}
subject.onNext(result);
subject.onCompleted();
});
return subject.asObservable();
};
};
/**
* Converts a callback function to an observable sequence.
*
* @param {Function} function Function with a callback as the last parameter to convert to an Observable sequence.
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @param {Function} [selector] A selector which takes the arguments from the callback to produce a single item to yield on next.
* @returns {Function} A function, when executed with the required parameters minus the callback, produces an Observable sequence with a single value of the arguments to the callback as an array.
*/
Observable.fromCallback = function (func, context, selector) {
return function () {
var args = slice.call(arguments, 0);
return new AnonymousObservable(function (observer) {
function handler(e) {
var results = e;
if (selector) {
try {
results = selector(arguments);
} catch (err) {
observer.onError(err);
return;
}
observer.onNext(results);
} else {
if (results.length <= 1) {
observer.onNext.apply(observer, results);
} else {
observer.onNext(results);
}
}
observer.onCompleted();
}
args.push(handler);
func.apply(context, args);
}).publishLast().refCount();
};
};
/**
* Converts a Node.js callback style function to an observable sequence. This must be in function (err, ...) format.
* @param {Function} func The function to call
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @param {Function} [selector] A selector which takes the arguments from the callback minus the error to produce a single item to yield on next.
* @returns {Function} An async function which when applied, returns an observable sequence with the callback arguments as an array.
*/
Observable.fromNodeCallback = function (func, context, selector) {
return function () {
var args = slice.call(arguments, 0);
return new AnonymousObservable(function (observer) {
function handler(err) {
if (err) {
observer.onError(err);
return;
}
var results = slice.call(arguments, 1);
if (selector) {
try {
results = selector(results);
} catch (e) {
observer.onError(e);
return;
}
observer.onNext(results);
} else {
if (results.length <= 1) {
observer.onNext.apply(observer, results);
} else {
observer.onNext(results);
}
}
observer.onCompleted();
}
args.push(handler);
func.apply(context, args);
}).publishLast().refCount();
};
};
function createListener (element, name, handler) {
if (element.addEventListener) {
element.addEventListener(name, handler, false);
return disposableCreate(function () {
element.removeEventListener(name, handler, false);
});
}
throw new Error('No listener found');
}
function createEventListener (el, eventName, handler) {
var disposables = new CompositeDisposable();
// Asume NodeList
if (Object.prototype.toString.call(el) === '[object NodeList]') {
for (var i = 0, len = el.length; i < len; i++) {
disposables.add(createEventListener(el.item(i), eventName, handler));
}
} else if (el) {
disposables.add(createListener(el, eventName, handler));
}
return disposables;
}
/**
* Configuration option to determine whether to use native events only
*/
Rx.config.useNativeEvents = false;
// Check for Angular/jQuery/Zepto support
var jq =
!!root.angular && !!angular.element ? angular.element :
(!!root.jQuery ? root.jQuery : (
!!root.Zepto ? root.Zepto : null));
// Check for ember
var ember = !!root.Ember && typeof root.Ember.addListener === 'function';
// Check for Backbone.Marionette. Note if using AMD add Marionette as a dependency of rxjs
// for proper loading order!
var marionette = !!root.Backbone && !!root.Backbone.Marionette;
/**
* Creates an observable sequence by adding an event listener to the matching DOMElement or each item in the NodeList.
*
* @example
* var source = Rx.Observable.fromEvent(element, 'mouseup');
*
* @param {Object} element The DOMElement or NodeList to attach a listener.
* @param {String} eventName The event name to attach the observable sequence.
* @param {Function} [selector] A selector which takes the arguments from the event handler to produce a single item to yield on next.
* @returns {Observable} An observable sequence of events from the specified element and the specified event.
*/
Observable.fromEvent = function (element, eventName, selector) {
// Node.js specific
if (element.addListener) {
return fromEventPattern(
function (h) { element.addListener(eventName, h); },
function (h) { element.removeListener(eventName, h); },
selector);
}
// Use only if non-native events are allowed
if (!Rx.config.useNativeEvents) {
if (marionette) {
return fromEventPattern(
function (h) { element.on(eventName, h); },
function (h) { element.off(eventName, h); },
selector);
}
if (ember) {
return fromEventPattern(
function (h) { Ember.addListener(element, eventName, h); },
function (h) { Ember.removeListener(element, eventName, h); },
selector);
}
if (jq) {
var $elem = jq(element);
return fromEventPattern(
function (h) { $elem.on(eventName, h); },
function (h) { $elem.off(eventName, h); },
selector);
}
}
return new AnonymousObservable(function (observer) {
return createEventListener(
element,
eventName,
function handler (e) {
var results = e;
if (selector) {
try {
results = selector(arguments);
} catch (err) {
observer.onError(err);
return
}
}
observer.onNext(results);
});
}).publish().refCount();
};
/**
* Creates an observable sequence from an event emitter via an addHandler/removeHandler pair.
* @param {Function} addHandler The function to add a handler to the emitter.
* @param {Function} [removeHandler] The optional function to remove a handler from an emitter.
* @param {Function} [selector] A selector which takes the arguments from the event handler to produce a single item to yield on next.
* @returns {Observable} An observable sequence which wraps an event from an event emitter
*/
var fromEventPattern = Observable.fromEventPattern = function (addHandler, removeHandler, selector) {
return new AnonymousObservable(function (observer) {
function innerHandler (e) {
var result = e;
if (selector) {
try {
result = selector(arguments);
} catch (err) {
observer.onError(err);
return;
}
}
observer.onNext(result);
}
var returnValue = addHandler(innerHandler);
return disposableCreate(function () {
if (removeHandler) {
removeHandler(innerHandler, returnValue);
}
});
}).publish().refCount();
};
/**
* Invokes the asynchronous function, surfacing the result through an observable sequence.
* @param {Function} functionAsync Asynchronous function which returns a Promise to run.
* @returns {Observable} An observable sequence exposing the function's result value, or an exception.
*/
Observable.startAsync = function (functionAsync) {
var promise;
try {
promise = functionAsync();
} catch (e) {
return observableThrow(e);
}
return observableFromPromise(promise);
}
var PausableObservable = (function (_super) {
inherits(PausableObservable, _super);
function subscribe(observer) {
var conn = this.source.publish(),
subscription = conn.subscribe(observer),
connection = disposableEmpty;
var pausable = this.pauser.distinctUntilChanged().subscribe(function (b) {
if (b) {
connection = conn.connect();
} else {
connection.dispose();
connection = disposableEmpty;
}
});
return new CompositeDisposable(subscription, connection, pausable);
}
function PausableObservable(source, pauser) {
this.source = source;
this.controller = new Subject();
if (pauser && pauser.subscribe) {
this.pauser = this.controller.merge(pauser);
} else {
this.pauser = this.controller;
}
_super.call(this, subscribe);
}
PausableObservable.prototype.pause = function () {
this.controller.onNext(false);
};
PausableObservable.prototype.resume = function () {
this.controller.onNext(true);
};
return PausableObservable;
}(Observable));
/**
* Pauses the underlying observable sequence based upon the observable sequence which yields true/false.
* @example
* var pauser = new Rx.Subject();
* var source = Rx.Observable.interval(100).pausable(pauser);
* @param {Observable} pauser The observable sequence used to pause the underlying sequence.
* @returns {Observable} The observable sequence which is paused based upon the pauser.
*/
observableProto.pausable = function (pauser) {
return new PausableObservable(this, pauser);
};
function combineLatestSource(source, subject, resultSelector) {
return new AnonymousObservable(function (observer) {
var n = 2,
hasValue = [false, false],
hasValueAll = false,
isDone = false,
values = new Array(n);
function next(x, i) {
values[i] = x
var res;
hasValue[i] = true;
if (hasValueAll || (hasValueAll = hasValue.every(identity))) {
try {
res = resultSelector.apply(null, values);
} catch (ex) {
observer.onError(ex);
return;
}
observer.onNext(res);
} else if (isDone) {
observer.onCompleted();
}
}
return new CompositeDisposable(
source.subscribe(
function (x) {
next(x, 0);
},
observer.onError.bind(observer),
function () {
isDone = true;
observer.onCompleted();
}),
subject.subscribe(
function (x) {
next(x, 1);
},
observer.onError.bind(observer))
);
});
}
var PausableBufferedObservable = (function (_super) {
inherits(PausableBufferedObservable, _super);
function subscribe(observer) {
var q = [], previousShouldFire;
var subscription =
combineLatestSource(
this.source,
this.pauser.distinctUntilChanged().startWith(false),
function (data, shouldFire) {
return { data: data, shouldFire: shouldFire };
})
.subscribe(
function (results) {
if (previousShouldFire !== undefined && results.shouldFire != previousShouldFire) {
// change in shouldFire
if (results.shouldFire) {
while (q.length > 0) {
observer.onNext(q.shift());
}
}
} else {
// new data
if (results.shouldFire) {
observer.onNext(results.data);
} else {
q.push(results.data);
}
}
previousShouldFire = results.shouldFire;
},
function (err) {
// Empty buffer before sending error
while (q.length > 0) {
observer.onNext(q.shift());
}
observer.onError(err);
},
function () {
// Empty buffer before sending completion
while (q.length > 0) {
observer.onNext(q.shift());
}
observer.onCompleted();
}
);
return subscription;
}
function PausableBufferedObservable(source, pauser) {
this.source = source;
this.controller = new Subject();
if (pauser && pauser.subscribe) {
this.pauser = this.controller.merge(pauser);
} else {
this.pauser = this.controller;
}
_super.call(this, subscribe);
}
PausableBufferedObservable.prototype.pause = function () {
this.controller.onNext(false);
};
PausableBufferedObservable.prototype.resume = function () {
this.controller.onNext(true);
};
return PausableBufferedObservable;
}(Observable));
/**
* Pauses the underlying observable sequence based upon the observable sequence which yields true/false,
* and yields the values that were buffered while paused.
* @example
* var pauser = new Rx.Subject();
* var source = Rx.Observable.interval(100).pausableBuffered(pauser);
* @param {Observable} pauser The observable sequence used to pause the underlying sequence.
* @returns {Observable} The observable sequence which is paused based upon the pauser.
*/
observableProto.pausableBuffered = function (subject) {
return new PausableBufferedObservable(this, subject);
};
/**
* Attaches a controller to the observable sequence with the ability to queue.
* @example
* var source = Rx.Observable.interval(100).controlled();
* source.request(3); // Reads 3 values
* @param {Observable} pauser The observable sequence used to pause the underlying sequence.
* @returns {Observable} The observable sequence which is paused based upon the pauser.
*/
observableProto.controlled = function (enableQueue) {
if (enableQueue == null) { enableQueue = true; }
return new ControlledObservable(this, enableQueue);
};
var ControlledObservable = (function (_super) {
inherits(ControlledObservable, _super);
function subscribe (observer) {
return this.source.subscribe(observer);
}
function ControlledObservable (source, enableQueue) {
_super.call(this, subscribe);
this.subject = new ControlledSubject(enableQueue);
this.source = source.multicast(this.subject).refCount();
}
ControlledObservable.prototype.request = function (numberOfItems) {
if (numberOfItems == null) { numberOfItems = -1; }
return this.subject.request(numberOfItems);
};
return ControlledObservable;
}(Observable));
var ControlledSubject = Rx.ControlledSubject = (function (_super) {
function subscribe (observer) {
return this.subject.subscribe(observer);
}
inherits(ControlledSubject, _super);
function ControlledSubject(enableQueue) {
if (enableQueue == null) {
enableQueue = true;
}
_super.call(this, subscribe);
this.subject = new Subject();
this.enableQueue = enableQueue;
this.queue = enableQueue ? [] : null;
this.requestedCount = 0;
this.requestedDisposable = disposableEmpty;
this.error = null;
this.hasFailed = false;
this.hasCompleted = false;
this.controlledDisposable = disposableEmpty;
}
addProperties(ControlledSubject.prototype, Observer, {
onCompleted: function () {
checkDisposed.call(this);
this.hasCompleted = true;
if (!this.enableQueue || this.queue.length === 0) {
this.subject.onCompleted();
}
},
onError: function (error) {
checkDisposed.call(this);
this.hasFailed = true;
this.error = error;
if (!this.enableQueue || this.queue.length === 0) {
this.subject.onError(error);
}
},
onNext: function (value) {
checkDisposed.call(this);
var hasRequested = false;
if (this.requestedCount === 0) {
if (this.enableQueue) {
this.queue.push(value);
}
} else {
if (this.requestedCount !== -1) {
if (this.requestedCount-- === 0) {
this.disposeCurrentRequest();
}
}
hasRequested = true;
}
if (hasRequested) {
this.subject.onNext(value);
}
},
_processRequest: function (numberOfItems) {
if (this.enableQueue) {
//console.log('queue length', this.queue.length);
while (this.queue.length >= numberOfItems && numberOfItems > 0) {
//console.log('number of items', numberOfItems);
this.subject.onNext(this.queue.shift());
numberOfItems--;
}
if (this.queue.length !== 0) {
return { numberOfItems: numberOfItems, returnValue: true };
} else {
return { numberOfItems: numberOfItems, returnValue: false };
}
}
if (this.hasFailed) {
this.subject.onError(this.error);
this.controlledDisposable.dispose();
this.controlledDisposable = disposableEmpty;
} else if (this.hasCompleted) {
this.subject.onCompleted();
this.controlledDisposable.dispose();
this.controlledDisposable = disposableEmpty;
}
return { numberOfItems: numberOfItems, returnValue: false };
},
request: function (number) {
checkDisposed.call(this);
this.disposeCurrentRequest();
var self = this,
r = this._processRequest(number);
number = r.numberOfItems;
if (!r.returnValue) {
this.requestedCount = number;
this.requestedDisposable = disposableCreate(function () {
self.requestedCount = 0;
});
return this.requestedDisposable
} else {
return disposableEmpty;
}
},
disposeCurrentRequest: function () {
this.requestedDisposable.dispose();
this.requestedDisposable = disposableEmpty;
},
dispose: function () {
this.isDisposed = true;
this.error = null;
this.subject.dispose();
this.requestedDisposable.dispose();
}
});
return ControlledSubject;
}(Observable));
/**
* Multicasts the source sequence notifications through an instantiated subject into all uses of the sequence within a selector function. Each
* subscription to the resulting sequence causes a separate multicast invocation, exposing the sequence resulting from the selector function's
* invocation. For specializations with fixed subject types, see Publish, PublishLast, and Replay.
*
* @example
* 1 - res = source.multicast(observable);
* 2 - res = source.multicast(function () { return new Subject(); }, function (x) { return x; });
*
* @param {Function|Subject} subjectOrSubjectSelector
* Factory function to create an intermediate subject through which the source sequence's elements will be multicast to the selector function.
* Or:
* Subject to push source elements into.
*
* @param {Function} [selector] Optional selector function which can use the multicasted source sequence subject to the policies enforced by the created subject. Specified only if <paramref name="subjectOrSubjectSelector" is a factory function.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.multicast = function (subjectOrSubjectSelector, selector) {
var source = this;
return typeof subjectOrSubjectSelector === 'function' ?
new AnonymousObservable(function (observer) {
var connectable = source.multicast(subjectOrSubjectSelector());
return new CompositeDisposable(selector(connectable).subscribe(observer), connectable.connect());
}) :
new ConnectableObservable(source, subjectOrSubjectSelector);
};
/**
* Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence.
* This operator is a specialization of Multicast using a regular Subject.
*
* @example
* var resres = source.publish();
* var res = source.publish(function (x) { return x; });
*
* @param {Function} [selector] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all notifications of the source from the time of the subscription on.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.publish = function (selector) {
return !selector ?
this.multicast(new Subject()) :
this.multicast(function () {
return new Subject();
}, selector);
};
/**
* Returns an observable sequence that shares a single subscription to the underlying sequence.
* This operator is a specialization of publish which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed.
*
* @example
* var res = source.share();
*
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.
*/
observableProto.share = function () {
return this.publish(null).refCount();
};
/**
* Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence containing only the last notification.
* This operator is a specialization of Multicast using a AsyncSubject.
*
* @example
* var res = source.publishLast();
* var res = source.publishLast(function (x) { return x; });
*
* @param selector [Optional] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will only receive the last notification of the source.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.publishLast = function (selector) {
return !selector ?
this.multicast(new AsyncSubject()) :
this.multicast(function () {
return new AsyncSubject();
}, selector);
};
/**
* Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence and starts with initialValue.
* This operator is a specialization of Multicast using a BehaviorSubject.
*
* @example
* var res = source.publishValue(42);
* var res = source.publishValue(function (x) { return x.select(function (y) { return y * y; }) }, 42);
*
* @param {Function} [selector] Optional selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive immediately receive the initial value, followed by all notifications of the source from the time of the subscription on.
* @param {Mixed} initialValue Initial value received by observers upon subscription.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.publishValue = function (initialValueOrSelector, initialValue) {
return arguments.length === 2 ?
this.multicast(function () {
return new BehaviorSubject(initialValue);
}, initialValueOrSelector) :
this.multicast(new BehaviorSubject(initialValueOrSelector));
};
/**
* Returns an observable sequence that shares a single subscription to the underlying sequence and starts with an initialValue.
* This operator is a specialization of publishValue which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed.
*
* @example
* var res = source.shareValue(42);
*
* @param {Mixed} initialValue Initial value received by observers upon subscription.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.
*/
observableProto.shareValue = function (initialValue) {
return this.publishValue(initialValue).
refCount();
};
/**
* Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum time length for the replay buffer.
* This operator is a specialization of Multicast using a ReplaySubject.
*
* @example
* var res = source.replay(null, 3);
* var res = source.replay(null, 3, 500);
* var res = source.replay(null, 3, 500, scheduler);
* var res = source.replay(function (x) { return x.take(6).repeat(); }, 3, 500, scheduler);
*
* @param selector [Optional] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all the notifications of the source subject to the specified replay buffer trimming policy.
* @param bufferSize [Optional] Maximum element count of the replay buffer.
* @param window [Optional] Maximum time length of the replay buffer.
* @param scheduler [Optional] Scheduler where connected observers within the selector function will be invoked on.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.replay = function (selector, bufferSize, window, scheduler) {
return !selector ?
this.multicast(new ReplaySubject(bufferSize, window, scheduler)) :
this.multicast(function () {
return new ReplaySubject(bufferSize, window, scheduler);
}, selector);
};
/**
* Returns an observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum time length for the replay buffer.
* This operator is a specialization of replay which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed.
*
* @example
* var res = source.shareReplay(3);
* var res = source.shareReplay(3, 500);
* var res = source.shareReplay(3, 500, scheduler);
*
* @param bufferSize [Optional] Maximum element count of the replay buffer.
* @param window [Optional] Maximum time length of the replay buffer.
* @param scheduler [Optional] Scheduler where connected observers within the selector function will be invoked on.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.
*/
observableProto.shareReplay = function (bufferSize, window, scheduler) {
return this.replay(null, bufferSize, window, scheduler).refCount();
};
/** @private */
var InnerSubscription = function (subject, observer) {
this.subject = subject;
this.observer = observer;
};
/**
* @private
* @memberOf InnerSubscription
*/
InnerSubscription.prototype.dispose = function () {
if (!this.subject.isDisposed && this.observer !== null) {
var idx = this.subject.observers.indexOf(this.observer);
this.subject.observers.splice(idx, 1);
this.observer = null;
}
};
/**
* Represents a value that changes over time.
* Observers can subscribe to the subject to receive the last (or initial) value and all subsequent notifications.
*/
var BehaviorSubject = Rx.BehaviorSubject = (function (_super) {
function subscribe(observer) {
checkDisposed.call(this);
if (!this.isStopped) {
this.observers.push(observer);
observer.onNext(this.value);
return new InnerSubscription(this, observer);
}
var ex = this.exception;
if (ex) {
observer.onError(ex);
} else {
observer.onCompleted();
}
return disposableEmpty;
}
inherits(BehaviorSubject, _super);
/**
* @constructor
* Initializes a new instance of the BehaviorSubject class which creates a subject that caches its last value and starts with the specified value.
* @param {Mixed} value Initial value sent to observers when no other value has been received by the subject yet.
*/
function BehaviorSubject(value) {
_super.call(this, subscribe);
this.value = value,
this.observers = [],
this.isDisposed = false,
this.isStopped = false,
this.exception = null;
}
addProperties(BehaviorSubject.prototype, Observer, {
/**
* Indicates whether the subject has observers subscribed to it.
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () {
return this.observers.length > 0;
},
/**
* Notifies all subscribed observers about the end of the sequence.
*/
onCompleted: function () {
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
this.isStopped = true;
for (var i = 0, len = os.length; i < len; i++) {
os[i].onCompleted();
}
this.observers = [];
}
},
/**
* Notifies all subscribed observers about the exception.
* @param {Mixed} error The exception to send to all observers.
*/
onError: function (error) {
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
this.isStopped = true;
this.exception = error;
for (var i = 0, len = os.length; i < len; i++) {
os[i].onError(error);
}
this.observers = [];
}
},
/**
* Notifies all subscribed observers about the arrival of the specified element in the sequence.
* @param {Mixed} value The value to send to all observers.
*/
onNext: function (value) {
checkDisposed.call(this);
if (!this.isStopped) {
this.value = value;
var os = this.observers.slice(0);
for (var i = 0, len = os.length; i < len; i++) {
os[i].onNext(value);
}
}
},
/**
* Unsubscribe all observers and release resources.
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
this.value = null;
this.exception = null;
}
});
return BehaviorSubject;
}(Observable));
/**
* Represents an object that is both an observable sequence as well as an observer.
* Each notification is broadcasted to all subscribed and future observers, subject to buffer trimming policies.
*/
var ReplaySubject = Rx.ReplaySubject = (function (_super) {
function RemovableDisposable (subject, observer) {
this.subject = subject;
this.observer = observer;
};
RemovableDisposable.prototype.dispose = function () {
this.observer.dispose();
if (!this.subject.isDisposed) {
var idx = this.subject.observers.indexOf(this.observer);
this.subject.observers.splice(idx, 1);
}
};
function subscribe(observer) {
var so = new ScheduledObserver(this.scheduler, observer),
subscription = new RemovableDisposable(this, so);
checkDisposed.call(this);
this._trim(this.scheduler.now());
this.observers.push(so);
var n = this.q.length;
for (var i = 0, len = this.q.length; i < len; i++) {
so.onNext(this.q[i].value);
}
if (this.hasError) {
n++;
so.onError(this.error);
} else if (this.isStopped) {
n++;
so.onCompleted();
}
so.ensureActive(n);
return subscription;
}
inherits(ReplaySubject, _super);
/**
* Initializes a new instance of the ReplaySubject class with the specified buffer size, window size and scheduler.
* @param {Number} [bufferSize] Maximum element count of the replay buffer.
* @param {Number} [windowSize] Maximum time length of the replay buffer.
* @param {Scheduler} [scheduler] Scheduler the observers are invoked on.
*/
function ReplaySubject(bufferSize, windowSize, scheduler) {
this.bufferSize = bufferSize == null ? Number.MAX_VALUE : bufferSize;
this.windowSize = windowSize == null ? Number.MAX_VALUE : windowSize;
this.scheduler = scheduler || currentThreadScheduler;
this.q = [];
this.observers = [];
this.isStopped = false;
this.isDisposed = false;
this.hasError = false;
this.error = null;
_super.call(this, subscribe);
}
addProperties(ReplaySubject.prototype, Observer, {
/**
* Indicates whether the subject has observers subscribed to it.
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () {
return this.observers.length > 0;
},
/* @private */
_trim: function (now) {
while (this.q.length > this.bufferSize) {
this.q.shift();
}
while (this.q.length > 0 && (now - this.q[0].interval) > this.windowSize) {
this.q.shift();
}
},
/**
* Notifies all subscribed observers about the arrival of the specified element in the sequence.
* @param {Mixed} value The value to send to all observers.
*/
onNext: function (value) {
var observer;
checkDisposed.call(this);
if (!this.isStopped) {
var now = this.scheduler.now();
this.q.push({ interval: now, value: value });
this._trim(now);
var o = this.observers.slice(0);
for (var i = 0, len = o.length; i < len; i++) {
observer = o[i];
observer.onNext(value);
observer.ensureActive();
}
}
},
/**
* Notifies all subscribed observers about the exception.
* @param {Mixed} error The exception to send to all observers.
*/
onError: function (error) {
var observer;
checkDisposed.call(this);
if (!this.isStopped) {
this.isStopped = true;
this.error = error;
this.hasError = true;
var now = this.scheduler.now();
this._trim(now);
var o = this.observers.slice(0);
for (var i = 0, len = o.length; i < len; i++) {
observer = o[i];
observer.onError(error);
observer.ensureActive();
}
this.observers = [];
}
},
/**
* Notifies all subscribed observers about the end of the sequence.
*/
onCompleted: function () {
var observer;
checkDisposed.call(this);
if (!this.isStopped) {
this.isStopped = true;
var now = this.scheduler.now();
this._trim(now);
var o = this.observers.slice(0);
for (var i = 0, len = o.length; i < len; i++) {
observer = o[i];
observer.onCompleted();
observer.ensureActive();
}
this.observers = [];
}
},
/**
* Unsubscribe all observers and release resources.
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
}
});
return ReplaySubject;
}(Observable));
var ConnectableObservable = Rx.ConnectableObservable = (function (__super__) {
inherits(ConnectableObservable, __super__);
function ConnectableObservable(source, subject) {
var hasSubscription = false,
subscription,
sourceObservable = source.asObservable();
this.connect = function () {
if (!hasSubscription) {
hasSubscription = true;
subscription = new CompositeDisposable(sourceObservable.subscribe(subject), disposableCreate(function () {
hasSubscription = false;
}));
}
return subscription;
};
__super__.call(this, subject.subscribe.bind(subject));
}
ConnectableObservable.prototype.refCount = function () {
var connectableSubscription, count = 0, source = this;
return new AnonymousObservable(function (observer) {
var shouldConnect = ++count === 1,
subscription = source.subscribe(observer);
shouldConnect && (connectableSubscription = source.connect());
return function () {
subscription.dispose();
--count === 0 && connectableSubscription.dispose();
};
});
};
return ConnectableObservable;
}(Observable));
var Dictionary = (function () {
var primes = [1, 3, 7, 13, 31, 61, 127, 251, 509, 1021, 2039, 4093, 8191, 16381, 32749, 65521, 131071, 262139, 524287, 1048573, 2097143, 4194301, 8388593, 16777213, 33554393, 67108859, 134217689, 268435399, 536870909, 1073741789, 2147483647],
noSuchkey = "no such key",
duplicatekey = "duplicate key";
function isPrime(candidate) {
if (candidate & 1 === 0) { return candidate === 2; }
var num1 = Math.sqrt(candidate),
num2 = 3;
while (num2 <= num1) {
if (candidate % num2 === 0) { return false; }
num2 += 2;
}
return true;
}
function getPrime(min) {
var index, num, candidate;
for (index = 0; index < primes.length; ++index) {
num = primes[index];
if (num >= min) { return num; }
}
candidate = min | 1;
while (candidate < primes[primes.length - 1]) {
if (isPrime(candidate)) { return candidate; }
candidate += 2;
}
return min;
}
function stringHashFn(str) {
var hash = 757602046;
if (!str.length) { return hash; }
for (var i = 0, len = str.length; i < len; i++) {
var character = str.charCodeAt(i);
hash = ((hash<<5)-hash)+character;
hash = hash & hash;
}
return hash;
}
function numberHashFn(key) {
var c2 = 0x27d4eb2d;
key = (key ^ 61) ^ (key >>> 16);
key = key + (key << 3);
key = key ^ (key >>> 4);
key = key * c2;
key = key ^ (key >>> 15);
return key;
}
var getHashCode = (function () {
var uniqueIdCounter = 0;
return function (obj) {
if (obj == null) { throw new Error(noSuchkey); }
// Check for built-ins before tacking on our own for any object
if (typeof obj === 'string') { return stringHashFn(obj); }
if (typeof obj === 'number') { return numberHashFn(obj); }
if (typeof obj === 'boolean') { return obj === true ? 1 : 0; }
if (obj instanceof Date) { return numberHashFn(obj.valueOf()); }
if (obj instanceof RegExp) { return stringHashFn(obj.toString()); }
if (typeof obj.valueOf === 'function') {
// Hack check for valueOf
var valueOf = obj.valueOf();
if (typeof valueOf === 'number') { return numberHashFn(valueOf); }
if (typeof obj === 'string') { return stringHashFn(valueOf); }
}
if (obj.getHashCode) { return obj.getHashCode(); }
var id = 17 * uniqueIdCounter++;
obj.getHashCode = function () { return id; };
return id;
};
}());
function newEntry() {
return { key: null, value: null, next: 0, hashCode: 0 };
}
function Dictionary(capacity, comparer) {
if (capacity < 0) { throw new Error('out of range'); }
if (capacity > 0) { this._initialize(capacity); }
this.comparer = comparer || defaultComparer;
this.freeCount = 0;
this.size = 0;
this.freeList = -1;
}
var dictionaryProto = Dictionary.prototype;
dictionaryProto._initialize = function (capacity) {
var prime = getPrime(capacity), i;
this.buckets = new Array(prime);
this.entries = new Array(prime);
for (i = 0; i < prime; i++) {
this.buckets[i] = -1;
this.entries[i] = newEntry();
}
this.freeList = -1;
};
dictionaryProto.add = function (key, value) {
return this._insert(key, value, true);
};
dictionaryProto._insert = function (key, value, add) {
if (!this.buckets) { this._initialize(0); }
var index3,
num = getHashCode(key) & 2147483647,
index1 = num % this.buckets.length;
for (var index2 = this.buckets[index1]; index2 >= 0; index2 = this.entries[index2].next) {
if (this.entries[index2].hashCode === num && this.comparer(this.entries[index2].key, key)) {
if (add) { throw new Error(duplicatekey); }
this.entries[index2].value = value;
return;
}
}
if (this.freeCount > 0) {
index3 = this.freeList;
this.freeList = this.entries[index3].next;
--this.freeCount;
} else {
if (this.size === this.entries.length) {
this._resize();
index1 = num % this.buckets.length;
}
index3 = this.size;
++this.size;
}
this.entries[index3].hashCode = num;
this.entries[index3].next = this.buckets[index1];
this.entries[index3].key = key;
this.entries[index3].value = value;
this.buckets[index1] = index3;
};
dictionaryProto._resize = function () {
var prime = getPrime(this.size * 2),
numArray = new Array(prime);
for (index = 0; index < numArray.length; ++index) { numArray[index] = -1; }
var entryArray = new Array(prime);
for (index = 0; index < this.size; ++index) { entryArray[index] = this.entries[index]; }
for (var index = this.size; index < prime; ++index) { entryArray[index] = newEntry(); }
for (var index1 = 0; index1 < this.size; ++index1) {
var index2 = entryArray[index1].hashCode % prime;
entryArray[index1].next = numArray[index2];
numArray[index2] = index1;
}
this.buckets = numArray;
this.entries = entryArray;
};
dictionaryProto.remove = function (key) {
if (this.buckets) {
var num = getHashCode(key) & 2147483647,
index1 = num % this.buckets.length,
index2 = -1;
for (var index3 = this.buckets[index1]; index3 >= 0; index3 = this.entries[index3].next) {
if (this.entries[index3].hashCode === num && this.comparer(this.entries[index3].key, key)) {
if (index2 < 0) {
this.buckets[index1] = this.entries[index3].next;
} else {
this.entries[index2].next = this.entries[index3].next;
}
this.entries[index3].hashCode = -1;
this.entries[index3].next = this.freeList;
this.entries[index3].key = null;
this.entries[index3].value = null;
this.freeList = index3;
++this.freeCount;
return true;
} else {
index2 = index3;
}
}
}
return false;
};
dictionaryProto.clear = function () {
var index, len;
if (this.size <= 0) { return; }
for (index = 0, len = this.buckets.length; index < len; ++index) {
this.buckets[index] = -1;
}
for (index = 0; index < this.size; ++index) {
this.entries[index] = newEntry();
}
this.freeList = -1;
this.size = 0;
};
dictionaryProto._findEntry = function (key) {
if (this.buckets) {
var num = getHashCode(key) & 2147483647;
for (var index = this.buckets[num % this.buckets.length]; index >= 0; index = this.entries[index].next) {
if (this.entries[index].hashCode === num && this.comparer(this.entries[index].key, key)) {
return index;
}
}
}
return -1;
};
dictionaryProto.count = function () {
return this.size - this.freeCount;
};
dictionaryProto.tryGetValue = function (key) {
var entry = this._findEntry(key);
return entry >= 0 ?
this.entries[entry].value :
undefined;
};
dictionaryProto.getValues = function () {
var index = 0, results = [];
if (this.entries) {
for (var index1 = 0; index1 < this.size; index1++) {
if (this.entries[index1].hashCode >= 0) {
results[index++] = this.entries[index1].value;
}
}
}
return results;
};
dictionaryProto.get = function (key) {
var entry = this._findEntry(key);
if (entry >= 0) { return this.entries[entry].value; }
throw new Error(noSuchkey);
};
dictionaryProto.set = function (key, value) {
this._insert(key, value, false);
};
dictionaryProto.containskey = function (key) {
return this._findEntry(key) >= 0;
};
return Dictionary;
}());
/**
* Correlates the elements of two sequences based on overlapping durations.
*
* @param {Observable} right The right observable sequence to join elements for.
* @param {Function} leftDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the left observable sequence, used to determine overlap.
* @param {Function} rightDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the right observable sequence, used to determine overlap.
* @param {Function} resultSelector A function invoked to compute a result element for any two overlapping elements of the left and right observable sequences. The parameters passed to the function correspond with the elements from the left and right source sequences for which overlap occurs.
* @returns {Observable} An observable sequence that contains result elements computed from source elements that have an overlapping duration.
*/
observableProto.join = function (right, leftDurationSelector, rightDurationSelector, resultSelector) {
var left = this;
return new AnonymousObservable(function (observer) {
var group = new CompositeDisposable();
var leftDone = false, rightDone = false;
var leftId = 0, rightId = 0;
var leftMap = new Dictionary(), rightMap = new Dictionary();
group.add(left.subscribe(
function (value) {
var id = leftId++;
var md = new SingleAssignmentDisposable();
leftMap.add(id, value);
group.add(md);
var expire = function () {
leftMap.remove(id) && leftMap.count() === 0 && leftDone && observer.onCompleted();
group.remove(md);
};
var duration;
try {
duration = leftDurationSelector(value);
} catch (e) {
observer.onError(e);
return;
}
md.setDisposable(duration.take(1).subscribe(noop, observer.onError.bind(observer), expire));
rightMap.getValues().forEach(function (v) {
var result;
try {
result = resultSelector(value, v);
} catch (exn) {
observer.onError(exn);
return;
}
observer.onNext(result);
});
},
observer.onError.bind(observer),
function () {
leftDone = true;
(rightDone || leftMap.count() === 0) && observer.onCompleted();
})
);
group.add(right.subscribe(
function (value) {
var id = rightId++;
var md = new SingleAssignmentDisposable();
rightMap.add(id, value);
group.add(md);
var expire = function () {
rightMap.remove(id) && rightMap.count() === 0 && rightDone && observer.onCompleted();
group.remove(md);
};
var duration;
try {
duration = rightDurationSelector(value);
} catch (e) {
observer.onError(e);
return;
}
md.setDisposable(duration.take(1).subscribe(noop, observer.onError.bind(observer), expire));
leftMap.getValues().forEach(function (v) {
var result;
try {
result = resultSelector(v, value);
} catch(exn) {
observer.onError(exn);
return;
}
observer.onNext(result);
});
},
observer.onError.bind(observer),
function () {
rightDone = true;
(leftDone || rightMap.count() === 0) && observer.onCompleted();
})
);
return group;
});
};
/**
* Correlates the elements of two sequences based on overlapping durations, and groups the results.
*
* @param {Observable} right The right observable sequence to join elements for.
* @param {Function} leftDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the left observable sequence, used to determine overlap.
* @param {Function} rightDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the right observable sequence, used to determine overlap.
* @param {Function} resultSelector A function invoked to compute a result element for any element of the left sequence with overlapping elements from the right observable sequence. The first parameter passed to the function is an element of the left sequence. The second parameter passed to the function is an observable sequence with elements from the right sequence that overlap with the left sequence's element.
* @returns {Observable} An observable sequence that contains result elements computed from source elements that have an overlapping duration.
*/
observableProto.groupJoin = function (right, leftDurationSelector, rightDurationSelector, resultSelector) {
var left = this;
return new AnonymousObservable(function (observer) {
var group = new CompositeDisposable();
var r = new RefCountDisposable(group);
var leftMap = new Dictionary(), rightMap = new Dictionary();
var leftId = 0, rightId = 0;
function handleError(e) { return function (v) { v.onError(e); }; };
group.add(left.subscribe(
function (value) {
var s = new Subject();
var id = leftId++;
leftMap.add(id, s);
var result;
try {
result = resultSelector(value, addRef(s, r));
} catch (e) {
leftMap.getValues().forEach(handleError(e));
observer.onError(e);
return;
}
observer.onNext(result);
rightMap.getValues().forEach(function (v) { s.onNext(v); });
var md = new SingleAssignmentDisposable();
group.add(md);
var expire = function () {
leftMap.remove(id) && s.onCompleted();
group.remove(md);
};
var duration;
try {
duration = leftDurationSelector(value);
} catch (e) {
leftMap.getValues().forEach(handleError(e));
observer.onError(e);
return;
}
md.setDisposable(duration.take(1).subscribe(
noop,
function (e) {
leftMap.getValues().forEach(handleError(e));
observer.onError(e);
},
expire)
);
},
function (e) {
leftMap.getValues().forEach(handleError(e));
observer.onError(e);
},
observer.onCompleted.bind(observer))
);
group.add(right.subscribe(
function (value) {
var id = rightId++;
rightMap.add(id, value);
var md = new SingleAssignmentDisposable();
group.add(md);
var expire = function () {
rightMap.remove(id);
group.remove(md);
};
var duration;
try {
duration = rightDurationSelector(value);
} catch (e) {
leftMap.getValues().forEach(handleError(e));
observer.onError(e);
return;
}
md.setDisposable(duration.take(1).subscribe(
noop,
function (e) {
leftMap.getValues().forEach(handleError(e));
observer.onError(e);
},
expire)
);
leftMap.getValues().forEach(function (v) { v.onNext(value); });
},
function (e) {
leftMap.getValues().forEach(handleError(e));
observer.onError(e);
})
);
return r;
});
};
/**
* Projects each element of an observable sequence into zero or more buffers.
*
* @param {Mixed} bufferOpeningsOrClosingSelector Observable sequence whose elements denote the creation of new windows, or, a function invoked to define the boundaries of the produced windows (a new window is started when the previous one is closed, resulting in non-overlapping windows).
* @param {Function} [bufferClosingSelector] A function invoked to define the closing of each produced window. If a closing selector function is specified for the first parameter, this parameter is ignored.
* @returns {Observable} An observable sequence of windows.
*/
observableProto.buffer = function (bufferOpeningsOrClosingSelector, bufferClosingSelector) {
return this.window.apply(this, arguments).selectMany(function (x) { return x.toArray(); });
};
/**
* Projects each element of an observable sequence into zero or more windows.
*
* @param {Mixed} windowOpeningsOrClosingSelector Observable sequence whose elements denote the creation of new windows, or, a function invoked to define the boundaries of the produced windows (a new window is started when the previous one is closed, resulting in non-overlapping windows).
* @param {Function} [windowClosingSelector] A function invoked to define the closing of each produced window. If a closing selector function is specified for the first parameter, this parameter is ignored.
* @returns {Observable} An observable sequence of windows.
*/
observableProto.window = function (windowOpeningsOrClosingSelector, windowClosingSelector) {
if (arguments.length === 1 && typeof arguments[0] !== 'function') {
return observableWindowWithBounaries.call(this, windowOpeningsOrClosingSelector);
}
return typeof windowOpeningsOrClosingSelector === 'function' ?
observableWindowWithClosingSelector.call(this, windowOpeningsOrClosingSelector) :
observableWindowWithOpenings.call(this, windowOpeningsOrClosingSelector, windowClosingSelector);
};
function observableWindowWithOpenings(windowOpenings, windowClosingSelector) {
return windowOpenings.groupJoin(this, windowClosingSelector, function () {
return observableEmpty();
}, function (_, window) {
return window;
});
}
function observableWindowWithBounaries(windowBoundaries) {
var source = this;
return new AnonymousObservable(function (observer) {
var window = new Subject(),
d = new CompositeDisposable(),
r = new RefCountDisposable(d);
observer.onNext(addRef(window, r));
d.add(source.subscribe(function (x) {
window.onNext(x);
}, function (err) {
window.onError(err);
observer.onError(err);
}, function () {
window.onCompleted();
observer.onCompleted();
}));
d.add(windowBoundaries.subscribe(function (w) {
window.onCompleted();
window = new Subject();
observer.onNext(addRef(window, r));
}, function (err) {
window.onError(err);
observer.onError(err);
}, function () {
window.onCompleted();
observer.onCompleted();
}));
return r;
});
}
function observableWindowWithClosingSelector(windowClosingSelector) {
var source = this;
return new AnonymousObservable(function (observer) {
var createWindowClose,
m = new SerialDisposable(),
d = new CompositeDisposable(m),
r = new RefCountDisposable(d),
window = new Subject();
observer.onNext(addRef(window, r));
d.add(source.subscribe(function (x) {
window.onNext(x);
}, function (ex) {
window.onError(ex);
observer.onError(ex);
}, function () {
window.onCompleted();
observer.onCompleted();
}));
createWindowClose = function () {
var m1, windowClose;
try {
windowClose = windowClosingSelector();
} catch (exception) {
observer.onError(exception);
return;
}
m1 = new SingleAssignmentDisposable();
m.setDisposable(m1);
m1.setDisposable(windowClose.take(1).subscribe(noop, function (ex) {
window.onError(ex);
observer.onError(ex);
}, function () {
window.onCompleted();
window = new Subject();
observer.onNext(addRef(window, r));
createWindowClose();
}));
};
createWindowClose();
return r;
});
}
/**
* Returns a new observable that triggers on the second and subsequent triggerings of the input observable.
* The Nth triggering of the input observable passes the arguments from the N-1th and Nth triggering as a pair.
* The argument passed to the N-1th triggering is held in hidden internal state until the Nth triggering occurs.
* @returns {Observable} An observable that triggers on successive pairs of observations from the input observable as an array.
*/
observableProto.pairwise = function () {
var source = this;
return new AnonymousObservable(function (observer) {
var previous, hasPrevious = false;
return source.subscribe(
function (x) {
if (hasPrevious) {
observer.onNext([previous, x]);
} else {
hasPrevious = true;
}
previous = x;
},
observer.onError.bind(observer),
observer.onCompleted.bind(observer));
});
};
/**
* Returns two observables which partition the observations of the source by the given function.
* The first will trigger observations for those values for which the predicate returns true.
* The second will trigger observations for those values where the predicate returns false.
* The predicate is executed once for each subscribed observer.
* Both also propagate all error observations arising from the source and each completes
* when the source completes.
* @param {Function} predicate
* The function to determine which output Observable will trigger a particular observation.
* @returns {Array}
* An array of observables. The first triggers when the predicate returns true,
* and the second triggers when the predicate returns false.
*/
observableProto.partition = function(predicate, thisArg) {
var published = this.publish().refCount();
return [
published.filter(predicate, thisArg),
published.filter(function (x, i, o) { return !predicate.call(thisArg, x, i, o); })
];
};
function enumerableWhile(condition, source) {
return new Enumerable(function () {
return new Enumerator(function () {
return condition() ?
{ done: false, value: source } :
{ done: true, value: undefined };
});
});
}
/**
* Returns an observable sequence that is the result of invoking the selector on the source sequence, without sharing subscriptions.
* This operator allows for a fluent style of writing queries that use the same sequence multiple times.
*
* @param {Function} selector Selector function which can use the source sequence as many times as needed, without sharing subscriptions to the source sequence.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.letBind = observableProto['let'] = function (func) {
return func(this);
};
/**
* Determines whether an observable collection contains values. There is an alias for this method called 'ifThen' for browsers <IE9
*
* @example
* 1 - res = Rx.Observable.if(condition, obs1);
* 2 - res = Rx.Observable.if(condition, obs1, obs2);
* 3 - res = Rx.Observable.if(condition, obs1, scheduler);
* @param {Function} condition The condition which determines if the thenSource or elseSource will be run.
* @param {Observable} thenSource The observable sequence or Promise that will be run if the condition function returns true.
* @param {Observable} [elseSource] The observable sequence or Promise that will be run if the condition function returns false. If this is not provided, it defaults to Rx.Observabe.Empty with the specified scheduler.
* @returns {Observable} An observable sequence which is either the thenSource or elseSource.
*/
Observable['if'] = Observable.ifThen = function (condition, thenSource, elseSourceOrScheduler) {
return observableDefer(function () {
elseSourceOrScheduler || (elseSourceOrScheduler = observableEmpty());
isPromise(thenSource) && (thenSource = observableFromPromise(thenSource));
isPromise(elseSourceOrScheduler) && (elseSourceOrScheduler = observableFromPromise(elseSourceOrScheduler));
// Assume a scheduler for empty only
typeof elseSourceOrScheduler.now === 'function' && (elseSourceOrScheduler = observableEmpty(elseSourceOrScheduler));
return condition() ? thenSource : elseSourceOrScheduler;
});
};
/**
* Concatenates the observable sequences obtained by running the specified result selector for each element in source.
* There is an alias for this method called 'forIn' for browsers <IE9
* @param {Array} sources An array of values to turn into an observable sequence.
* @param {Function} resultSelector A function to apply to each item in the sources array to turn it into an observable sequence.
* @returns {Observable} An observable sequence from the concatenated observable sequences.
*/
Observable['for'] = Observable.forIn = function (sources, resultSelector) {
return enumerableFor(sources, resultSelector).concat();
};
/**
* Repeats source as long as condition holds emulating a while loop.
* There is an alias for this method called 'whileDo' for browsers <IE9
*
* @param {Function} condition The condition which determines if the source will be repeated.
* @param {Observable} source The observable sequence that will be run if the condition function returns true.
* @returns {Observable} An observable sequence which is repeated as long as the condition holds.
*/
var observableWhileDo = Observable['while'] = Observable.whileDo = function (condition, source) {
isPromise(source) && (source = observableFromPromise(source));
return enumerableWhile(condition, source).concat();
};
/**
* Repeats source as long as condition holds emulating a do while loop.
*
* @param {Function} condition The condition which determines if the source will be repeated.
* @param {Observable} source The observable sequence that will be run if the condition function returns true.
* @returns {Observable} An observable sequence which is repeated as long as the condition holds.
*/
observableProto.doWhile = function (condition) {
return observableConcat([this, observableWhileDo(condition, this)]);
};
/**
* Uses selector to determine which source in sources to use.
* There is an alias 'switchCase' for browsers <IE9.
*
* @example
* 1 - res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 });
* 1 - res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 }, obs0);
* 1 - res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 }, scheduler);
*
* @param {Function} selector The function which extracts the value for to test in a case statement.
* @param {Array} sources A object which has keys which correspond to the case statement labels.
* @param {Observable} [elseSource] The observable sequence or Promise that will be run if the sources are not matched. If this is not provided, it defaults to Rx.Observabe.empty with the specified scheduler.
*
* @returns {Observable} An observable sequence which is determined by a case statement.
*/
Observable['case'] = Observable.switchCase = function (selector, sources, defaultSourceOrScheduler) {
return observableDefer(function () {
isPromise(defaultSourceOrScheduler) && (defaultSourceOrScheduler = observableFromPromise(defaultSourceOrScheduler));
defaultSourceOrScheduler || (defaultSourceOrScheduler = observableEmpty());
typeof defaultSourceOrScheduler.now === 'function' && (defaultSourceOrScheduler = observableEmpty(defaultSourceOrScheduler));
var result = sources[selector()];
isPromise(result) && (result = observableFromPromise(result));
return result || defaultSourceOrScheduler;
});
};
/**
* Expands an observable sequence by recursively invoking selector.
*
* @param {Function} selector Selector function to invoke for each produced element, resulting in another sequence to which the selector will be invoked recursively again.
* @param {Scheduler} [scheduler] Scheduler on which to perform the expansion. If not provided, this defaults to the current thread scheduler.
* @returns {Observable} An observable sequence containing all the elements produced by the recursive expansion.
*/
observableProto.expand = function (selector, scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
var source = this;
return new AnonymousObservable(function (observer) {
var q = [],
m = new SerialDisposable(),
d = new CompositeDisposable(m),
activeCount = 0,
isAcquired = false;
var ensureActive = function () {
var isOwner = false;
if (q.length > 0) {
isOwner = !isAcquired;
isAcquired = true;
}
if (isOwner) {
m.setDisposable(scheduler.scheduleRecursive(function (self) {
var work;
if (q.length > 0) {
work = q.shift();
} else {
isAcquired = false;
return;
}
var m1 = new SingleAssignmentDisposable();
d.add(m1);
m1.setDisposable(work.subscribe(function (x) {
observer.onNext(x);
var result = null;
try {
result = selector(x);
} catch (e) {
observer.onError(e);
}
q.push(result);
activeCount++;
ensureActive();
}, observer.onError.bind(observer), function () {
d.remove(m1);
activeCount--;
if (activeCount === 0) {
observer.onCompleted();
}
}));
self();
}));
}
};
q.push(source);
activeCount++;
ensureActive();
return d;
});
};
/**
* Runs all observable sequences in parallel and collect their last elements.
*
* @example
* 1 - res = Rx.Observable.forkJoin([obs1, obs2]);
* 1 - res = Rx.Observable.forkJoin(obs1, obs2, ...);
* @returns {Observable} An observable sequence with an array collecting the last elements of all the input sequences.
*/
Observable.forkJoin = function () {
var allSources = argsOrArray(arguments, 0);
return new AnonymousObservable(function (subscriber) {
var count = allSources.length;
if (count === 0) {
subscriber.onCompleted();
return disposableEmpty;
}
var group = new CompositeDisposable(),
finished = false,
hasResults = new Array(count),
hasCompleted = new Array(count),
results = new Array(count);
for (var idx = 0; idx < count; idx++) {
(function (i) {
var source = allSources[i];
isPromise(source) && (source = observableFromPromise(source));
group.add(
source.subscribe(
function (value) {
if (!finished) {
hasResults[i] = true;
results[i] = value;
}
},
function (e) {
finished = true;
subscriber.onError(e);
group.dispose();
},
function () {
if (!finished) {
if (!hasResults[i]) {
subscriber.onCompleted();
return;
}
hasCompleted[i] = true;
for (var ix = 0; ix < count; ix++) {
if (!hasCompleted[ix]) { return; }
}
finished = true;
subscriber.onNext(results);
subscriber.onCompleted();
}
}));
})(idx);
}
return group;
});
};
/**
* Runs two observable sequences in parallel and combines their last elemenets.
*
* @param {Observable} second Second observable sequence.
* @param {Function} resultSelector Result selector function to invoke with the last elements of both sequences.
* @returns {Observable} An observable sequence with the result of calling the selector function with the last elements of both input sequences.
*/
observableProto.forkJoin = function (second, resultSelector) {
var first = this;
return new AnonymousObservable(function (observer) {
var leftStopped = false, rightStopped = false,
hasLeft = false, hasRight = false,
lastLeft, lastRight,
leftSubscription = new SingleAssignmentDisposable(), rightSubscription = new SingleAssignmentDisposable();
isPromise(second) && (second = observableFromPromise(second));
leftSubscription.setDisposable(
first.subscribe(function (left) {
hasLeft = true;
lastLeft = left;
}, function (err) {
rightSubscription.dispose();
observer.onError(err);
}, function () {
leftStopped = true;
if (rightStopped) {
if (!hasLeft) {
observer.onCompleted();
} else if (!hasRight) {
observer.onCompleted();
} else {
var result;
try {
result = resultSelector(lastLeft, lastRight);
} catch (e) {
observer.onError(e);
return;
}
observer.onNext(result);
observer.onCompleted();
}
}
})
);
rightSubscription.setDisposable(
second.subscribe(function (right) {
hasRight = true;
lastRight = right;
}, function (err) {
leftSubscription.dispose();
observer.onError(err);
}, function () {
rightStopped = true;
if (leftStopped) {
if (!hasLeft) {
observer.onCompleted();
} else if (!hasRight) {
observer.onCompleted();
} else {
var result;
try {
result = resultSelector(lastLeft, lastRight);
} catch (e) {
observer.onError(e);
return;
}
observer.onNext(result);
observer.onCompleted();
}
}
})
);
return new CompositeDisposable(leftSubscription, rightSubscription);
});
};
/**
* Comonadic bind operator.
* @param {Function} selector A transform function to apply to each element.
* @param {Object} scheduler Scheduler used to execute the operation. If not specified, defaults to the ImmediateScheduler.
* @returns {Observable} An observable sequence which results from the comonadic bind operation.
*/
observableProto.manySelect = function (selector, scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
var source = this;
return observableDefer(function () {
var chain;
return source
.map(function (x) {
var curr = new ChainObservable(x);
chain && chain.onNext(x);
chain = curr;
return curr;
})
.tap(
noop,
function (e) { chain && chain.onError(e); },
function () { chain && chain.onCompleted(); }
)
.observeOn(scheduler)
.map(selector);
});
};
var ChainObservable = (function (__super__) {
function subscribe (observer) {
var self = this, g = new CompositeDisposable();
g.add(currentThreadScheduler.schedule(function () {
observer.onNext(self.head);
g.add(self.tail.mergeObservable().subscribe(observer));
}));
return g;
}
inherits(ChainObservable, __super__);
function ChainObservable(head) {
__super__.call(this, subscribe);
this.head = head;
this.tail = new AsyncSubject();
}
addProperties(ChainObservable.prototype, Observer, {
onCompleted: function () {
this.onNext(Observable.empty());
},
onError: function (e) {
this.onNext(Observable.throwException(e));
},
onNext: function (v) {
this.tail.onNext(v);
this.tail.onCompleted();
}
});
return ChainObservable;
}(Observable));
/** @private */
var Map = (function () {
/**
* @constructor
* @private
*/
function Map() {
this.keys = [];
this.values = [];
}
/**
* @private
* @memberOf Map#
*/
Map.prototype['delete'] = function (key) {
var i = this.keys.indexOf(key);
if (i !== -1) {
this.keys.splice(i, 1);
this.values.splice(i, 1);
}
return i !== -1;
};
/**
* @private
* @memberOf Map#
*/
Map.prototype.get = function (key, fallback) {
var i = this.keys.indexOf(key);
return i !== -1 ? this.values[i] : fallback;
};
/**
* @private
* @memberOf Map#
*/
Map.prototype.set = function (key, value) {
var i = this.keys.indexOf(key);
if (i !== -1) {
this.values[i] = value;
}
this.values[this.keys.push(key) - 1] = value;
};
/**
* @private
* @memberOf Map#
*/
Map.prototype.size = function () { return this.keys.length; };
/**
* @private
* @memberOf Map#
*/
Map.prototype.has = function (key) {
return this.keys.indexOf(key) !== -1;
};
/**
* @private
* @memberOf Map#
*/
Map.prototype.getKeys = function () { return this.keys.slice(0); };
/**
* @private
* @memberOf Map#
*/
Map.prototype.getValues = function () { return this.values.slice(0); };
return Map;
}());
/**
* @constructor
* Represents a join pattern over observable sequences.
*/
function Pattern(patterns) {
this.patterns = patterns;
}
/**
* Creates a pattern that matches the current plan matches and when the specified observable sequences has an available value.
*
* @param other Observable sequence to match in addition to the current pattern.
* @return Pattern object that matches when all observable sequences in the pattern have an available value.
*/
Pattern.prototype.and = function (other) {
var patterns = this.patterns.slice(0);
patterns.push(other);
return new Pattern(patterns);
};
/**
* Matches when all observable sequences in the pattern (specified using a chain of and operators) have an available value and projects the values.
*
* @param selector Selector that will be invoked with available values from the source sequences, in the same order of the sequences in the pattern.
* @return Plan that produces the projected values, to be fed (with other plans) to the when operator.
*/
Pattern.prototype.thenDo = function (selector) {
return new Plan(this, selector);
};
function Plan(expression, selector) {
this.expression = expression;
this.selector = selector;
}
Plan.prototype.activate = function (externalSubscriptions, observer, deactivate) {
var self = this;
var joinObservers = [];
for (var i = 0, len = this.expression.patterns.length; i < len; i++) {
joinObservers.push(planCreateObserver(externalSubscriptions, this.expression.patterns[i], observer.onError.bind(observer)));
}
var activePlan = new ActivePlan(joinObservers, function () {
var result;
try {
result = self.selector.apply(self, arguments);
} catch (exception) {
observer.onError(exception);
return;
}
observer.onNext(result);
}, function () {
for (var j = 0, jlen = joinObservers.length; j < jlen; j++) {
joinObservers[j].removeActivePlan(activePlan);
}
deactivate(activePlan);
});
for (i = 0, len = joinObservers.length; i < len; i++) {
joinObservers[i].addActivePlan(activePlan);
}
return activePlan;
};
function planCreateObserver(externalSubscriptions, observable, onError) {
var entry = externalSubscriptions.get(observable);
if (!entry) {
var observer = new JoinObserver(observable, onError);
externalSubscriptions.set(observable, observer);
return observer;
}
return entry;
}
// Active Plan
function ActivePlan(joinObserverArray, onNext, onCompleted) {
var i, joinObserver;
this.joinObserverArray = joinObserverArray;
this.onNext = onNext;
this.onCompleted = onCompleted;
this.joinObservers = new Map();
for (i = 0; i < this.joinObserverArray.length; i++) {
joinObserver = this.joinObserverArray[i];
this.joinObservers.set(joinObserver, joinObserver);
}
}
ActivePlan.prototype.dequeue = function () {
var values = this.joinObservers.getValues();
for (var i = 0, len = values.length; i < len; i++) {
values[i].queue.shift();
}
};
ActivePlan.prototype.match = function () {
var firstValues, i, len, isCompleted, values, hasValues = true;
for (i = 0, len = this.joinObserverArray.length; i < len; i++) {
if (this.joinObserverArray[i].queue.length === 0) {
hasValues = false;
break;
}
}
if (hasValues) {
firstValues = [];
isCompleted = false;
for (i = 0, len = this.joinObserverArray.length; i < len; i++) {
firstValues.push(this.joinObserverArray[i].queue[0]);
if (this.joinObserverArray[i].queue[0].kind === 'C') {
isCompleted = true;
}
}
if (isCompleted) {
this.onCompleted();
} else {
this.dequeue();
values = [];
for (i = 0; i < firstValues.length; i++) {
values.push(firstValues[i].value);
}
this.onNext.apply(this, values);
}
}
};
/** @private */
var JoinObserver = (function (_super) {
inherits(JoinObserver, _super);
/**
* @constructor
* @private
*/
function JoinObserver(source, onError) {
_super.call(this);
this.source = source;
this.onError = onError;
this.queue = [];
this.activePlans = [];
this.subscription = new SingleAssignmentDisposable();
this.isDisposed = false;
}
var JoinObserverPrototype = JoinObserver.prototype;
/**
* @memberOf JoinObserver#
* @private
*/
JoinObserverPrototype.next = function (notification) {
if (!this.isDisposed) {
if (notification.kind === 'E') {
this.onError(notification.exception);
return;
}
this.queue.push(notification);
var activePlans = this.activePlans.slice(0);
for (var i = 0, len = activePlans.length; i < len; i++) {
activePlans[i].match();
}
}
};
/**
* @memberOf JoinObserver#
* @private
*/
JoinObserverPrototype.error = noop;
/**
* @memberOf JoinObserver#
* @private
*/
JoinObserverPrototype.completed = noop;
/**
* @memberOf JoinObserver#
* @private
*/
JoinObserverPrototype.addActivePlan = function (activePlan) {
this.activePlans.push(activePlan);
};
/**
* @memberOf JoinObserver#
* @private
*/
JoinObserverPrototype.subscribe = function () {
this.subscription.setDisposable(this.source.materialize().subscribe(this));
};
/**
* @memberOf JoinObserver#
* @private
*/
JoinObserverPrototype.removeActivePlan = function (activePlan) {
var idx = this.activePlans.indexOf(activePlan);
this.activePlans.splice(idx, 1);
if (this.activePlans.length === 0) {
this.dispose();
}
};
/**
* @memberOf JoinObserver#
* @private
*/
JoinObserverPrototype.dispose = function () {
_super.prototype.dispose.call(this);
if (!this.isDisposed) {
this.isDisposed = true;
this.subscription.dispose();
}
};
return JoinObserver;
} (AbstractObserver));
/**
* Creates a pattern that matches when both observable sequences have an available value.
*
* @param right Observable sequence to match with the current sequence.
* @return {Pattern} Pattern object that matches when both observable sequences have an available value.
*/
observableProto.and = function (right) {
return new Pattern([this, right]);
};
/**
* Matches when the observable sequence has an available value and projects the value.
*
* @param selector Selector that will be invoked for values in the source sequence.
* @returns {Plan} Plan that produces the projected values, to be fed (with other plans) to the when operator.
*/
observableProto.thenDo = function (selector) {
return new Pattern([this]).thenDo(selector);
};
/**
* Joins together the results from several patterns.
*
* @param plans A series of plans (specified as an Array of as a series of arguments) created by use of the Then operator on patterns.
* @returns {Observable} Observable sequence with the results form matching several patterns.
*/
Observable.when = function () {
var plans = argsOrArray(arguments, 0);
return new AnonymousObservable(function (observer) {
var activePlans = [],
externalSubscriptions = new Map(),
group,
i, len,
joinObserver,
joinValues,
outObserver;
outObserver = observerCreate(observer.onNext.bind(observer), function (exception) {
var values = externalSubscriptions.getValues();
for (var j = 0, jlen = values.length; j < jlen; j++) {
values[j].onError(exception);
}
observer.onError(exception);
}, observer.onCompleted.bind(observer));
try {
for (i = 0, len = plans.length; i < len; i++) {
activePlans.push(plans[i].activate(externalSubscriptions, outObserver, function (activePlan) {
var idx = activePlans.indexOf(activePlan);
activePlans.splice(idx, 1);
if (activePlans.length === 0) {
outObserver.onCompleted();
}
}));
}
} catch (e) {
observableThrow(e).subscribe(observer);
}
group = new CompositeDisposable();
joinValues = externalSubscriptions.getValues();
for (i = 0, len = joinValues.length; i < len; i++) {
joinObserver = joinValues[i];
joinObserver.subscribe();
group.add(joinObserver);
}
return group;
});
};
function observableTimerDate(dueTime, scheduler) {
return new AnonymousObservable(function (observer) {
return scheduler.scheduleWithAbsolute(dueTime, function () {
observer.onNext(0);
observer.onCompleted();
});
});
}
function observableTimerDateAndPeriod(dueTime, period, scheduler) {
return new AnonymousObservable(function (observer) {
var count = 0, d = dueTime, p = normalizeTime(period);
return scheduler.scheduleRecursiveWithAbsolute(d, function (self) {
if (p > 0) {
var now = scheduler.now();
d = d + p;
d <= now && (d = now + p);
}
observer.onNext(count++);
self(d);
});
});
}
function observableTimerTimeSpan(dueTime, scheduler) {
return new AnonymousObservable(function (observer) {
return scheduler.scheduleWithRelative(normalizeTime(dueTime), function () {
observer.onNext(0);
observer.onCompleted();
});
});
}
function observableTimerTimeSpanAndPeriod(dueTime, period, scheduler) {
return dueTime === period ?
new AnonymousObservable(function (observer) {
return scheduler.schedulePeriodicWithState(0, period, function (count) {
observer.onNext(count);
return count + 1;
});
}) :
observableDefer(function () {
return observableTimerDateAndPeriod(scheduler.now() + dueTime, period, scheduler);
});
}
/**
* Returns an observable sequence that produces a value after each period.
*
* @example
* 1 - res = Rx.Observable.interval(1000);
* 2 - res = Rx.Observable.interval(1000, Rx.Scheduler.timeout);
*
* @param {Number} period Period for producing the values in the resulting sequence (specified as an integer denoting milliseconds).
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, Rx.Scheduler.timeout is used.
* @returns {Observable} An observable sequence that produces a value after each period.
*/
var observableinterval = Observable.interval = function (period, scheduler) {
return observableTimerTimeSpanAndPeriod(period, period, isScheduler(scheduler) ? scheduler : timeoutScheduler);
};
/**
* Returns an observable sequence that produces a value after dueTime has elapsed and then after each period.
*
* @example
* 1 - res = Rx.Observable.timer(new Date());
* 2 - res = Rx.Observable.timer(new Date(), 1000);
* 3 - res = Rx.Observable.timer(new Date(), Rx.Scheduler.timeout);
* 4 - res = Rx.Observable.timer(new Date(), 1000, Rx.Scheduler.timeout);
*
* 5 - res = Rx.Observable.timer(5000);
* 6 - res = Rx.Observable.timer(5000, 1000);
* 7 - res = Rx.Observable.timer(5000, Rx.Scheduler.timeout);
* 8 - res = Rx.Observable.timer(5000, 1000, Rx.Scheduler.timeout);
*
* @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) at which to produce the first value.
* @param {Mixed} [periodOrScheduler] Period to produce subsequent values (specified as an integer denoting milliseconds), or the scheduler to run the timer on. If not specified, the resulting timer is not recurring.
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence that produces a value after due time has elapsed and then each period.
*/
var observableTimer = Observable.timer = function (dueTime, periodOrScheduler, scheduler) {
var period;
isScheduler(scheduler) || (scheduler = timeoutScheduler);
if (periodOrScheduler !== undefined && typeof periodOrScheduler === 'number') {
period = periodOrScheduler;
} else if (periodOrScheduler !== undefined && typeof periodOrScheduler === 'object') {
scheduler = periodOrScheduler;
}
if (dueTime instanceof Date && period === undefined) {
return observableTimerDate(dueTime.getTime(), scheduler);
}
if (dueTime instanceof Date && period !== undefined) {
period = periodOrScheduler;
return observableTimerDateAndPeriod(dueTime.getTime(), period, scheduler);
}
return period === undefined ?
observableTimerTimeSpan(dueTime, scheduler) :
observableTimerTimeSpanAndPeriod(dueTime, period, scheduler);
};
function observableDelayTimeSpan(source, dueTime, scheduler) {
return new AnonymousObservable(function (observer) {
var active = false,
cancelable = new SerialDisposable(),
exception = null,
q = [],
running = false,
subscription;
subscription = source.materialize().timestamp(scheduler).subscribe(function (notification) {
var d, shouldRun;
if (notification.value.kind === 'E') {
q = [];
q.push(notification);
exception = notification.value.exception;
shouldRun = !running;
} else {
q.push({ value: notification.value, timestamp: notification.timestamp + dueTime });
shouldRun = !active;
active = true;
}
if (shouldRun) {
if (exception !== null) {
observer.onError(exception);
} else {
d = new SingleAssignmentDisposable();
cancelable.setDisposable(d);
d.setDisposable(scheduler.scheduleRecursiveWithRelative(dueTime, function (self) {
var e, recurseDueTime, result, shouldRecurse;
if (exception !== null) {
return;
}
running = true;
do {
result = null;
if (q.length > 0 && q[0].timestamp - scheduler.now() <= 0) {
result = q.shift().value;
}
if (result !== null) {
result.accept(observer);
}
} while (result !== null);
shouldRecurse = false;
recurseDueTime = 0;
if (q.length > 0) {
shouldRecurse = true;
recurseDueTime = Math.max(0, q[0].timestamp - scheduler.now());
} else {
active = false;
}
e = exception;
running = false;
if (e !== null) {
observer.onError(e);
} else if (shouldRecurse) {
self(recurseDueTime);
}
}));
}
}
});
return new CompositeDisposable(subscription, cancelable);
});
}
function observableDelayDate(source, dueTime, scheduler) {
return observableDefer(function () {
return observableDelayTimeSpan(source, dueTime - scheduler.now(), scheduler);
});
}
/**
* Time shifts the observable sequence by dueTime. The relative time intervals between the values are preserved.
*
* @example
* 1 - res = Rx.Observable.delay(new Date());
* 2 - res = Rx.Observable.delay(new Date(), Rx.Scheduler.timeout);
*
* 3 - res = Rx.Observable.delay(5000);
* 4 - res = Rx.Observable.delay(5000, 1000, Rx.Scheduler.timeout);
* @memberOf Observable#
* @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) by which to shift the observable sequence.
* @param {Scheduler} [scheduler] Scheduler to run the delay timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} Time-shifted sequence.
*/
observableProto.delay = function (dueTime, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return dueTime instanceof Date ?
observableDelayDate(this, dueTime.getTime(), scheduler) :
observableDelayTimeSpan(this, dueTime, scheduler);
};
/**
* Ignores values from an observable sequence which are followed by another value before dueTime.
*
* @example
* 1 - res = source.throttle(5000); // 5 seconds
* 2 - res = source.throttle(5000, scheduler);
*
* @param {Number} dueTime Duration of the throttle period for each value (specified as an integer denoting milliseconds).
* @param {Scheduler} [scheduler] Scheduler to run the throttle timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} The throttled sequence.
*/
observableProto.throttle = function (dueTime, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return this.throttleWithSelector(function () { return observableTimer(dueTime, scheduler); })
};
/**
* Projects each element of an observable sequence into zero or more windows which are produced based on timing information.
*
* @example
* 1 - res = xs.windowWithTime(1000, scheduler); // non-overlapping segments of 1 second
* 2 - res = xs.windowWithTime(1000, 500 , scheduler); // segments of 1 second with time shift 0.5 seconds
*
* @param {Number} timeSpan Length of each window (specified as an integer denoting milliseconds).
* @param {Mixed} [timeShiftOrScheduler] Interval between creation of consecutive windows (specified as an integer denoting milliseconds), or an optional scheduler parameter. If not specified, the time shift corresponds to the timeSpan parameter, resulting in non-overlapping adjacent windows.
* @param {Scheduler} [scheduler] Scheduler to run windowing timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence of windows.
*/
observableProto.windowWithTime = function (timeSpan, timeShiftOrScheduler, scheduler) {
var source = this, timeShift;
timeShiftOrScheduler == null && (timeShift = timeSpan);
isScheduler(scheduler) || (scheduler = timeoutScheduler);
if (typeof timeShiftOrScheduler === 'number') {
timeShift = timeShiftOrScheduler;
} else if (typeof timeShiftOrScheduler === 'object') {
timeShift = timeSpan;
scheduler = timeShiftOrScheduler;
}
return new AnonymousObservable(function (observer) {
var groupDisposable,
nextShift = timeShift,
nextSpan = timeSpan,
q = [],
refCountDisposable,
timerD = new SerialDisposable(),
totalTime = 0;
groupDisposable = new CompositeDisposable(timerD),
refCountDisposable = new RefCountDisposable(groupDisposable);
q.push(new Subject());
observer.onNext(addRef(q[0], refCountDisposable));
createTimer();
groupDisposable.add(source.subscribe(function (x) {
var i, len;
for (i = 0, len = q.length; i < len; i++) {
q[i].onNext(x);
}
}, function (e) {
var i, len;
for (i = 0, len = q.length; i < len; i++) {
q[i].onError(e);
}
observer.onError(e);
}, function () {
var i, len;
for (i = 0, len = q.length; i < len; i++) {
q[i].onCompleted();
}
observer.onCompleted();
}));
return refCountDisposable;
function createTimer () {
var m = new SingleAssignmentDisposable(), isSpan = false, isShift = false;
timerD.setDisposable(m);
if (nextSpan === nextShift) {
isSpan = true;
isShift = true;
} else if (nextSpan < nextShift) {
isSpan = true;
} else {
isShift = true;
}
var newTotalTime = isSpan ? nextSpan : nextShift,
ts = newTotalTime - totalTime;
totalTime = newTotalTime;
isSpan && (nextSpan += timeShift);
isShift && (nextShift += timeShift);
m.setDisposable(scheduler.scheduleWithRelative(ts, function () {
var s;
if (isShift) {
s = new Subject();
q.push(s);
observer.onNext(addRef(s, refCountDisposable));
}
if (isSpan) {
s = q.shift();
s.onCompleted();
}
createTimer();
}));
}
});
};
/**
* Projects each element of an observable sequence into a window that is completed when either it's full or a given amount of time has elapsed.
* @example
* 1 - res = source.windowWithTimeOrCount(5000, 50); // 5s or 50 items
* 2 - res = source.windowWithTimeOrCount(5000, 50, scheduler); //5s or 50 items
*
* @memberOf Observable#
* @param {Number} timeSpan Maximum time length of a window.
* @param {Number} count Maximum element count of a window.
* @param {Scheduler} [scheduler] Scheduler to run windowing timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence of windows.
*/
observableProto.windowWithTimeOrCount = function (timeSpan, count, scheduler) {
var source = this;
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return new AnonymousObservable(function (observer) {
var createTimer,
groupDisposable,
n = 0,
refCountDisposable,
s = new Subject()
timerD = new SerialDisposable(),
windowId = 0;
groupDisposable = new CompositeDisposable(timerD);
refCountDisposable = new RefCountDisposable(groupDisposable);
observer.onNext(addRef(s, refCountDisposable));
createTimer(0);
groupDisposable.add(source.subscribe(function (x) {
var newId = 0, newWindow = false;
s.onNext(x);
n++;
if (n === count) {
newWindow = true;
n = 0;
newId = ++windowId;
s.onCompleted();
s = new Subject();
observer.onNext(addRef(s, refCountDisposable));
}
newWindow && createTimer(newId);
}, function (e) {
s.onError(e);
observer.onError(e);
}, function () {
s.onCompleted();
observer.onCompleted();
}));
return refCountDisposable;
function createTimer(id) {
var m = new SingleAssignmentDisposable();
timerD.setDisposable(m);
m.setDisposable(scheduler.scheduleWithRelative(timeSpan, function () {
var newId;
if (id !== windowId) { return; }
n = 0;
newId = ++windowId;
s.onCompleted();
s = new Subject();
observer.onNext(addRef(s, refCountDisposable));
createTimer(newId);
}));
}
});
};
/**
* Projects each element of an observable sequence into zero or more buffers which are produced based on timing information.
*
* @example
* 1 - res = xs.bufferWithTime(1000, scheduler); // non-overlapping segments of 1 second
* 2 - res = xs.bufferWithTime(1000, 500, scheduler; // segments of 1 second with time shift 0.5 seconds
*
* @param {Number} timeSpan Length of each buffer (specified as an integer denoting milliseconds).
* @param {Mixed} [timeShiftOrScheduler] Interval between creation of consecutive buffers (specified as an integer denoting milliseconds), or an optional scheduler parameter. If not specified, the time shift corresponds to the timeSpan parameter, resulting in non-overlapping adjacent buffers.
* @param {Scheduler} [scheduler] Scheduler to run buffer timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence of buffers.
*/
observableProto.bufferWithTime = function (timeSpan, timeShiftOrScheduler, scheduler) {
return this.windowWithTime.apply(this, arguments).selectMany(function (x) { return x.toArray(); });
};
/**
* Projects each element of an observable sequence into a buffer that is completed when either it's full or a given amount of time has elapsed.
*
* @example
* 1 - res = source.bufferWithTimeOrCount(5000, 50); // 5s or 50 items in an array
* 2 - res = source.bufferWithTimeOrCount(5000, 50, scheduler); // 5s or 50 items in an array
*
* @param {Number} timeSpan Maximum time length of a buffer.
* @param {Number} count Maximum element count of a buffer.
* @param {Scheduler} [scheduler] Scheduler to run bufferin timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence of buffers.
*/
observableProto.bufferWithTimeOrCount = function (timeSpan, count, scheduler) {
return this.windowWithTimeOrCount(timeSpan, count, scheduler).selectMany(function (x) {
return x.toArray();
});
};
/**
* Records the time interval between consecutive values in an observable sequence.
*
* @example
* 1 - res = source.timeInterval();
* 2 - res = source.timeInterval(Rx.Scheduler.timeout);
*
* @param [scheduler] Scheduler used to compute time intervals. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence with time interval information on values.
*/
observableProto.timeInterval = function (scheduler) {
var source = this;
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return observableDefer(function () {
var last = scheduler.now();
return source.map(function (x) {
var now = scheduler.now(), span = now - last;
last = now;
return { value: x, interval: span };
});
});
};
/**
* Records the timestamp for each value in an observable sequence.
*
* @example
* 1 - res = source.timestamp(); // produces { value: x, timestamp: ts }
* 2 - res = source.timestamp(Rx.Scheduler.timeout);
*
* @param {Scheduler} [scheduler] Scheduler used to compute timestamps. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence with timestamp information on values.
*/
observableProto.timestamp = function (scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return this.map(function (x) {
return { value: x, timestamp: scheduler.now() };
});
};
function sampleObservable(source, sampler) {
return new AnonymousObservable(function (observer) {
var atEnd, value, hasValue;
function sampleSubscribe() {
if (hasValue) {
hasValue = false;
observer.onNext(value);
}
atEnd && observer.onCompleted();
}
return new CompositeDisposable(
source.subscribe(function (newValue) {
hasValue = true;
value = newValue;
}, observer.onError.bind(observer), function () {
atEnd = true;
}),
sampler.subscribe(sampleSubscribe, observer.onError.bind(observer), sampleSubscribe)
);
});
}
/**
* Samples the observable sequence at each interval.
*
* @example
* 1 - res = source.sample(sampleObservable); // Sampler tick sequence
* 2 - res = source.sample(5000); // 5 seconds
* 2 - res = source.sample(5000, Rx.Scheduler.timeout); // 5 seconds
*
* @param {Mixed} intervalOrSampler Interval at which to sample (specified as an integer denoting milliseconds) or Sampler Observable.
* @param {Scheduler} [scheduler] Scheduler to run the sampling timer on. If not specified, the timeout scheduler is used.
* @returns {Observable} Sampled observable sequence.
*/
observableProto.sample = function (intervalOrSampler, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return typeof intervalOrSampler === 'number' ?
sampleObservable(this, observableinterval(intervalOrSampler, scheduler)) :
sampleObservable(this, intervalOrSampler);
};
/**
* Returns the source observable sequence or the other observable sequence if dueTime elapses.
*
* @example
* 1 - res = source.timeout(new Date()); // As a date
* 2 - res = source.timeout(5000); // 5 seconds
* 3 - res = source.timeout(new Date(), Rx.Observable.returnValue(42)); // As a date and timeout observable
* 4 - res = source.timeout(5000, Rx.Observable.returnValue(42)); // 5 seconds and timeout observable
* 5 - res = source.timeout(new Date(), Rx.Observable.returnValue(42), Rx.Scheduler.timeout); // As a date and timeout observable
* 6 - res = source.timeout(5000, Rx.Observable.returnValue(42), Rx.Scheduler.timeout); // 5 seconds and timeout observable
*
* @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) when a timeout occurs.
* @param {Observable} [other] Sequence to return in case of a timeout. If not specified, a timeout error throwing sequence will be used.
* @param {Scheduler} [scheduler] Scheduler to run the timeout timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} The source sequence switching to the other sequence in case of a timeout.
*/
observableProto.timeout = function (dueTime, other, scheduler) {
other || (other = observableThrow(new Error('Timeout')));
isScheduler(scheduler) || (scheduler = timeoutScheduler);
var source = this, schedulerMethod = dueTime instanceof Date ?
'scheduleWithAbsolute' :
'scheduleWithRelative';
return new AnonymousObservable(function (observer) {
var id = 0,
original = new SingleAssignmentDisposable(),
subscription = new SerialDisposable(),
switched = false,
timer = new SerialDisposable();
subscription.setDisposable(original);
var createTimer = function () {
var myId = id;
timer.setDisposable(scheduler[schedulerMethod](dueTime, function () {
if (id === myId) {
isPromise(other) && (other = observableFromPromise(other));
subscription.setDisposable(other.subscribe(observer));
}
}));
};
createTimer();
original.setDisposable(source.subscribe(function (x) {
if (!switched) {
id++;
observer.onNext(x);
createTimer();
}
}, function (e) {
if (!switched) {
id++;
observer.onError(e);
}
}, function () {
if (!switched) {
id++;
observer.onCompleted();
}
}));
return new CompositeDisposable(subscription, timer);
});
};
/**
* Generates an observable sequence by iterating a state from an initial state until the condition fails.
*
* @example
* res = source.generateWithAbsoluteTime(0,
* function (x) { return return true; },
* function (x) { return x + 1; },
* function (x) { return x; },
* function (x) { return new Date(); }
* });
*
* @param {Mixed} initialState Initial state.
* @param {Function} condition Condition to terminate generation (upon returning false).
* @param {Function} iterate Iteration step function.
* @param {Function} resultSelector Selector function for results produced in the sequence.
* @param {Function} timeSelector Time selector function to control the speed of values being produced each iteration, returning Date values.
* @param {Scheduler} [scheduler] Scheduler on which to run the generator loop. If not specified, the timeout scheduler is used.
* @returns {Observable} The generated sequence.
*/
Observable.generateWithAbsoluteTime = function (initialState, condition, iterate, resultSelector, timeSelector, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return new AnonymousObservable(function (observer) {
var first = true,
hasResult = false,
result,
state = initialState,
time;
return scheduler.scheduleRecursiveWithAbsolute(scheduler.now(), function (self) {
hasResult && observer.onNext(result);
try {
if (first) {
first = false;
} else {
state = iterate(state);
}
hasResult = condition(state);
if (hasResult) {
result = resultSelector(state);
time = timeSelector(state);
}
} catch (e) {
observer.onError(e);
return;
}
if (hasResult) {
self(time);
} else {
observer.onCompleted();
}
});
});
};
/**
* Generates an observable sequence by iterating a state from an initial state until the condition fails.
*
* @example
* res = source.generateWithRelativeTime(0,
* function (x) { return return true; },
* function (x) { return x + 1; },
* function (x) { return x; },
* function (x) { return 500; }
* );
*
* @param {Mixed} initialState Initial state.
* @param {Function} condition Condition to terminate generation (upon returning false).
* @param {Function} iterate Iteration step function.
* @param {Function} resultSelector Selector function for results produced in the sequence.
* @param {Function} timeSelector Time selector function to control the speed of values being produced each iteration, returning integer values denoting milliseconds.
* @param {Scheduler} [scheduler] Scheduler on which to run the generator loop. If not specified, the timeout scheduler is used.
* @returns {Observable} The generated sequence.
*/
Observable.generateWithRelativeTime = function (initialState, condition, iterate, resultSelector, timeSelector, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return new AnonymousObservable(function (observer) {
var first = true,
hasResult = false,
result,
state = initialState,
time;
return scheduler.scheduleRecursiveWithRelative(0, function (self) {
hasResult && observer.onNext(result);
try {
if (first) {
first = false;
} else {
state = iterate(state);
}
hasResult = condition(state);
if (hasResult) {
result = resultSelector(state);
time = timeSelector(state);
}
} catch (e) {
observer.onError(e);
return;
}
if (hasResult) {
self(time);
} else {
observer.onCompleted();
}
});
});
};
/**
* Time shifts the observable sequence by delaying the subscription.
*
* @example
* 1 - res = source.delaySubscription(5000); // 5s
* 2 - res = source.delaySubscription(5000, Rx.Scheduler.timeout); // 5 seconds
*
* @param {Number} dueTime Absolute or relative time to perform the subscription at.
* @param {Scheduler} [scheduler] Scheduler to run the subscription delay timer on. If not specified, the timeout scheduler is used.
* @returns {Observable} Time-shifted sequence.
*/
observableProto.delaySubscription = function (dueTime, scheduler) {
return this.delayWithSelector(observableTimer(dueTime, isScheduler(scheduler) ? scheduler : timeoutScheduler), observableEmpty);
};
/**
* Time shifts the observable sequence based on a subscription delay and a delay selector function for each element.
*
* @example
* 1 - res = source.delayWithSelector(function (x) { return Rx.Scheduler.timer(5000); }); // with selector only
* 1 - res = source.delayWithSelector(Rx.Observable.timer(2000), function (x) { return Rx.Observable.timer(x); }); // with delay and selector
*
* @param {Observable} [subscriptionDelay] Sequence indicating the delay for the subscription to the source.
* @param {Function} delayDurationSelector Selector function to retrieve a sequence indicating the delay for each given element.
* @returns {Observable} Time-shifted sequence.
*/
observableProto.delayWithSelector = function (subscriptionDelay, delayDurationSelector) {
var source = this, subDelay, selector;
if (typeof subscriptionDelay === 'function') {
selector = subscriptionDelay;
} else {
subDelay = subscriptionDelay;
selector = delayDurationSelector;
}
return new AnonymousObservable(function (observer) {
var delays = new CompositeDisposable(), atEnd = false, done = function () {
if (atEnd && delays.length === 0) {
observer.onCompleted();
}
}, subscription = new SerialDisposable(), start = function () {
subscription.setDisposable(source.subscribe(function (x) {
var delay;
try {
delay = selector(x);
} catch (error) {
observer.onError(error);
return;
}
var d = new SingleAssignmentDisposable();
delays.add(d);
d.setDisposable(delay.subscribe(function () {
observer.onNext(x);
delays.remove(d);
done();
}, observer.onError.bind(observer), function () {
observer.onNext(x);
delays.remove(d);
done();
}));
}, observer.onError.bind(observer), function () {
atEnd = true;
subscription.dispose();
done();
}));
};
if (!subDelay) {
start();
} else {
subscription.setDisposable(subDelay.subscribe(function () {
start();
}, observer.onError.bind(observer), function () { start(); }));
}
return new CompositeDisposable(subscription, delays);
});
};
/**
* Returns the source observable sequence, switching to the other observable sequence if a timeout is signaled.
*
* @example
* 1 - res = source.timeoutWithSelector(Rx.Observable.timer(500));
* 2 - res = source.timeoutWithSelector(Rx.Observable.timer(500), function (x) { return Rx.Observable.timer(200); });
* 3 - res = source.timeoutWithSelector(Rx.Observable.timer(500), function (x) { return Rx.Observable.timer(200); }, Rx.Observable.returnValue(42));
*
* @param {Observable} [firstTimeout] Observable sequence that represents the timeout for the first element. If not provided, this defaults to Observable.never().
* @param {Function} [timeoutDurationSelector] Selector to retrieve an observable sequence that represents the timeout between the current element and the next element.
* @param {Observable} [other] Sequence to return in case of a timeout. If not provided, this is set to Observable.throwException().
* @returns {Observable} The source sequence switching to the other sequence in case of a timeout.
*/
observableProto.timeoutWithSelector = function (firstTimeout, timeoutdurationSelector, other) {
if (arguments.length === 1) {
timeoutdurationSelector = firstTimeout;
var firstTimeout = observableNever();
}
other || (other = observableThrow(new Error('Timeout')));
var source = this;
return new AnonymousObservable(function (observer) {
var subscription = new SerialDisposable(), timer = new SerialDisposable(), original = new SingleAssignmentDisposable();
subscription.setDisposable(original);
var id = 0, switched = false, setTimer = function (timeout) {
var myId = id, timerWins = function () {
return id === myId;
};
var d = new SingleAssignmentDisposable();
timer.setDisposable(d);
d.setDisposable(timeout.subscribe(function () {
if (timerWins()) {
subscription.setDisposable(other.subscribe(observer));
}
d.dispose();
}, function (e) {
if (timerWins()) {
observer.onError(e);
}
}, function () {
if (timerWins()) {
subscription.setDisposable(other.subscribe(observer));
}
}));
};
setTimer(firstTimeout);
var observerWins = function () {
var res = !switched;
if (res) {
id++;
}
return res;
};
original.setDisposable(source.subscribe(function (x) {
if (observerWins()) {
observer.onNext(x);
var timeout;
try {
timeout = timeoutdurationSelector(x);
} catch (e) {
observer.onError(e);
return;
}
setTimer(timeout);
}
}, function (e) {
if (observerWins()) {
observer.onError(e);
}
}, function () {
if (observerWins()) {
observer.onCompleted();
}
}));
return new CompositeDisposable(subscription, timer);
});
};
/**
* Ignores values from an observable sequence which are followed by another value within a computed throttle duration.
*
* @example
* 1 - res = source.delayWithSelector(function (x) { return Rx.Scheduler.timer(x + x); });
*
* @param {Function} throttleDurationSelector Selector function to retrieve a sequence indicating the throttle duration for each given element.
* @returns {Observable} The throttled sequence.
*/
observableProto.throttleWithSelector = function (throttleDurationSelector) {
var source = this;
return new AnonymousObservable(function (observer) {
var value, hasValue = false, cancelable = new SerialDisposable(), id = 0, subscription = source.subscribe(function (x) {
var throttle;
try {
throttle = throttleDurationSelector(x);
} catch (e) {
observer.onError(e);
return;
}
hasValue = true;
value = x;
id++;
var currentid = id, d = new SingleAssignmentDisposable();
cancelable.setDisposable(d);
d.setDisposable(throttle.subscribe(function () {
if (hasValue && id === currentid) {
observer.onNext(value);
}
hasValue = false;
d.dispose();
}, observer.onError.bind(observer), function () {
if (hasValue && id === currentid) {
observer.onNext(value);
}
hasValue = false;
d.dispose();
}));
}, function (e) {
cancelable.dispose();
observer.onError(e);
hasValue = false;
id++;
}, function () {
cancelable.dispose();
if (hasValue) {
observer.onNext(value);
}
observer.onCompleted();
hasValue = false;
id++;
});
return new CompositeDisposable(subscription, cancelable);
});
};
/**
* Skips elements for the specified duration from the end of the observable source sequence, using the specified scheduler to run timers.
*
* 1 - res = source.skipLastWithTime(5000);
* 2 - res = source.skipLastWithTime(5000, scheduler);
*
* @description
* This operator accumulates a queue with a length enough to store elements received during the initial duration window.
* As more elements are received, elements older than the specified duration are taken from the queue and produced on the
* result sequence. This causes elements to be delayed with duration.
* @param {Number} duration Duration for skipping elements from the end of the sequence.
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout
* @returns {Observable} An observable sequence with the elements skipped during the specified duration from the end of the source sequence.
*/
observableProto.skipLastWithTime = function (duration, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
var source = this;
return new AnonymousObservable(function (observer) {
var q = [];
return source.subscribe(function (x) {
var now = scheduler.now();
q.push({ interval: now, value: x });
while (q.length > 0 && now - q[0].interval >= duration) {
observer.onNext(q.shift().value);
}
}, observer.onError.bind(observer), function () {
var now = scheduler.now();
while (q.length > 0 && now - q[0].interval >= duration) {
observer.onNext(q.shift().value);
}
observer.onCompleted();
});
});
};
/**
* Returns elements within the specified duration from the end of the observable source sequence, using the specified schedulers to run timers and to drain the collected elements.
*
* @example
* 1 - res = source.takeLastWithTime(5000, [optional timer scheduler], [optional loop scheduler]);
* @description
* This operator accumulates a queue with a length enough to store elements received during the initial duration window.
* As more elements are received, elements older than the specified duration are taken from the queue and produced on the
* result sequence. This causes elements to be delayed with duration.
* @param {Number} duration Duration for taking elements from the end of the sequence.
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @returns {Observable} An observable sequence with the elements taken during the specified duration from the end of the source sequence.
*/
observableProto.takeLastWithTime = function (duration, scheduler) {
var source = this;
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return new AnonymousObservable(function (observer) {
var q = [];
return source.subscribe(function (x) {
var now = scheduler.now();
q.push({ interval: now, value: x });
while (q.length > 0 && now - q[0].interval >= duration) {
q.shift();
}
}, observer.onError.bind(observer), function () {
var now = scheduler.now();
while (q.length > 0) {
var next = q.shift();
if (now - next.interval <= duration) {
observer.onNext(next.value);
}
}
observer.onCompleted();
});
});
};
/**
* Returns an array with the elements within the specified duration from the end of the observable source sequence, using the specified scheduler to run timers.
*
* @example
* 1 - res = source.takeLastBufferWithTime(5000, [optional scheduler]);
* @description
* This operator accumulates a queue with a length enough to store elements received during the initial duration window.
* As more elements are received, elements older than the specified duration are taken from the queue and produced on the
* result sequence. This causes elements to be delayed with duration.
* @param {Number} duration Duration for taking elements from the end of the sequence.
* @param {Scheduler} scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @returns {Observable} An observable sequence containing a single array with the elements taken during the specified duration from the end of the source sequence.
*/
observableProto.takeLastBufferWithTime = function (duration, scheduler) {
var source = this;
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return new AnonymousObservable(function (observer) {
var q = [];
return source.subscribe(function (x) {
var now = scheduler.now();
q.push({ interval: now, value: x });
while (q.length > 0 && now - q[0].interval >= duration) {
q.shift();
}
}, observer.onError.bind(observer), function () {
var now = scheduler.now(), res = [];
while (q.length > 0) {
var next = q.shift();
if (now - next.interval <= duration) {
res.push(next.value);
}
}
observer.onNext(res);
observer.onCompleted();
});
});
};
/**
* Takes elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers.
*
* @example
* 1 - res = source.takeWithTime(5000, [optional scheduler]);
* @description
* This operator accumulates a queue with a length enough to store elements received during the initial duration window.
* As more elements are received, elements older than the specified duration are taken from the queue and produced on the
* result sequence. This causes elements to be delayed with duration.
* @param {Number} duration Duration for taking elements from the start of the sequence.
* @param {Scheduler} scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @returns {Observable} An observable sequence with the elements taken during the specified duration from the start of the source sequence.
*/
observableProto.takeWithTime = function (duration, scheduler) {
var source = this;
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return new AnonymousObservable(function (observer) {
return new CompositeDisposable(scheduler.scheduleWithRelative(duration, observer.onCompleted.bind(observer)), source.subscribe(observer));
});
};
/**
* Skips elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers.
*
* @example
* 1 - res = source.skipWithTime(5000, [optional scheduler]);
*
* @description
* Specifying a zero value for duration doesn't guarantee no elements will be dropped from the start of the source sequence.
* This is a side-effect of the asynchrony introduced by the scheduler, where the action that causes callbacks from the source sequence to be forwarded
* may not execute immediately, despite the zero due time.
*
* Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the duration.
* @param {Number} duration Duration for skipping elements from the start of the sequence.
* @param {Scheduler} scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @returns {Observable} An observable sequence with the elements skipped during the specified duration from the start of the source sequence.
*/
observableProto.skipWithTime = function (duration, scheduler) {
var source = this;
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return new AnonymousObservable(function (observer) {
var open = false;
return new CompositeDisposable(
scheduler.scheduleWithRelative(duration, function () { open = true; }),
source.subscribe(function (x) { open && observer.onNext(x); }, observer.onError.bind(observer), observer.onCompleted.bind(observer)));
});
};
/**
* Skips elements from the observable source sequence until the specified start time, using the specified scheduler to run timers.
* Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the start time.
*
* @examples
* 1 - res = source.skipUntilWithTime(new Date(), [optional scheduler]);
* 2 - res = source.skipUntilWithTime(5000, [optional scheduler]);
* @param startTime Time to start taking elements from the source sequence. If this value is less than or equal to Date(), no elements will be skipped.
* @param scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @returns {Observable} An observable sequence with the elements skipped until the specified start time.
*/
observableProto.skipUntilWithTime = function (startTime, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
var source = this, schedulerMethod = startTime instanceof Date ?
'scheduleWithAbsolute' :
'scheduleWithRelative';
return new AnonymousObservable(function (observer) {
var open = false;
return new CompositeDisposable(
scheduler[schedulerMethod](startTime, function () { open = true; }),
source.subscribe(
function (x) { open && observer.onNext(x); },
observer.onError.bind(observer),
observer.onCompleted.bind(observer)));
});
};
/**
* Takes elements for the specified duration until the specified end time, using the specified scheduler to run timers.
*
* @example
* 1 - res = source.takeUntilWithTime(new Date(), [optional scheduler]);
* 2 - res = source.takeUntilWithTime(5000, [optional scheduler]);
* @param {Number | Date} endTime Time to stop taking elements from the source sequence. If this value is less than or equal to new Date(), the result stream will complete immediately.
* @param {Scheduler} scheduler Scheduler to run the timer on.
* @returns {Observable} An observable sequence with the elements taken until the specified end time.
*/
observableProto.takeUntilWithTime = function (endTime, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
var source = this, schedulerMethod = endTime instanceof Date ?
'scheduleWithAbsolute' :
'scheduleWithRelative';
return new AnonymousObservable(function (observer) {
return new CompositeDisposable(scheduler[schedulerMethod](endTime, function () {
observer.onCompleted();
}), source.subscribe(observer));
});
};
/*
* Performs a exclusive waiting for the first to finish before subscribing to another observable.
* Observables that come in between subscriptions will be dropped on the floor.
* @returns {Observable} A exclusive observable with only the results that happen when subscribed.
*/
observableProto.exclusive = function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var hasCurrent = false,
isStopped = false,
m = new SingleAssignmentDisposable(),
g = new CompositeDisposable();
g.add(m);
m.setDisposable(sources.subscribe(
function (innerSource) {
if (!hasCurrent) {
hasCurrent = true;
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
var innerSubscription = new SingleAssignmentDisposable();
g.add(innerSubscription);
innerSubscription.setDisposable(innerSource.subscribe(
observer.onNext.bind(observer),
observer.onError.bind(observer),
function () {
g.remove(innerSubscription);
hasCurrent = false;
if (isStopped && g.length === 1) {
observer.onCompleted();
}
}));
}
},
observer.onError.bind(observer),
function () {
isStopped = true;
if (!hasCurrent && g.length === 1) {
observer.onCompleted();
}
}));
return g;
});
};
/*
* Performs a exclusive map waiting for the first to finish before subscribing to another observable.
* Observables that come in between subscriptions will be dropped on the floor.
* @param {Function} selector Selector to invoke for every item in the current subscription.
* @param {Any} [thisArg] An optional context to invoke with the selector parameter.
* @returns {Observable} An exclusive observable with only the results that happen when subscribed.
*/
observableProto.exclusiveMap = function (selector, thisArg) {
var sources = this;
return new AnonymousObservable(function (observer) {
var index = 0,
hasCurrent = false,
isStopped = true,
m = new SingleAssignmentDisposable(),
g = new CompositeDisposable();
g.add(m);
m.setDisposable(sources.subscribe(
function (innerSource) {
if (!hasCurrent) {
hasCurrent = true;
innerSubscription = new SingleAssignmentDisposable();
g.add(innerSubscription);
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
innerSubscription.setDisposable(innerSource.subscribe(
function (x) {
var result;
try {
result = selector.call(thisArg, x, index++, innerSource);
} catch (e) {
observer.onError(e);
return;
}
observer.onNext(result);
},
observer.onError.bind(observer),
function () {
g.remove(innerSubscription);
hasCurrent = false;
if (isStopped && g.length === 1) {
observer.onCompleted();
}
}));
}
},
observer.onError.bind(observer),
function () {
isStopped = true;
if (g.length === 1 && !hasCurrent) {
observer.onCompleted();
}
}));
return g;
});
};
/** Provides a set of extension methods for virtual time scheduling. */
Rx.VirtualTimeScheduler = (function (__super__) {
function notImplemented() {
throw new Error('Not implemented');
}
function localNow() {
return this.toDateTimeOffset(this.clock);
}
function scheduleNow(state, action) {
return this.scheduleAbsoluteWithState(state, this.clock, action);
}
function scheduleRelative(state, dueTime, action) {
return this.scheduleRelativeWithState(state, this.toRelative(dueTime), action);
}
function scheduleAbsolute(state, dueTime, action) {
return this.scheduleRelativeWithState(state, this.toRelative(dueTime - this.now()), action);
}
function invokeAction(scheduler, action) {
action();
return disposableEmpty;
}
inherits(VirtualTimeScheduler, __super__);
/**
* Creates a new virtual time scheduler with the specified initial clock value and absolute time comparer.
*
* @constructor
* @param {Number} initialClock Initial value for the clock.
* @param {Function} comparer Comparer to determine causality of events based on absolute time.
*/
function VirtualTimeScheduler(initialClock, comparer) {
this.clock = initialClock;
this.comparer = comparer;
this.isEnabled = false;
this.queue = new PriorityQueue(1024);
__super__.call(this, localNow, scheduleNow, scheduleRelative, scheduleAbsolute);
}
var VirtualTimeSchedulerPrototype = VirtualTimeScheduler.prototype;
/**
* Adds a relative time value to an absolute time value.
* @param {Number} absolute Absolute virtual time value.
* @param {Number} relative Relative virtual time value to add.
* @return {Number} Resulting absolute virtual time sum value.
*/
VirtualTimeSchedulerPrototype.add = notImplemented;
/**
* Converts an absolute time to a number
* @param {Any} The absolute time.
* @returns {Number} The absolute time in ms
*/
VirtualTimeSchedulerPrototype.toDateTimeOffset = notImplemented;
/**
* Converts the TimeSpan value to a relative virtual time value.
* @param {Number} timeSpan TimeSpan value to convert.
* @return {Number} Corresponding relative virtual time value.
*/
VirtualTimeSchedulerPrototype.toRelative = notImplemented;
/**
* Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be emulated using recursive scheduling.
* @param {Mixed} state Initial state passed to the action upon the first iteration.
* @param {Number} period Period for running the work periodically.
* @param {Function} action Action to be executed, potentially updating the state.
* @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort).
*/
VirtualTimeSchedulerPrototype.schedulePeriodicWithState = function (state, period, action) {
var s = new SchedulePeriodicRecursive(this, state, period, action);
return s.start();
};
/**
* Schedules an action to be executed after dueTime.
* @param {Mixed} state State passed to the action to be executed.
* @param {Number} dueTime Relative time after which to execute the action.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
VirtualTimeSchedulerPrototype.scheduleRelativeWithState = function (state, dueTime, action) {
var runAt = this.add(this.clock, dueTime);
return this.scheduleAbsoluteWithState(state, runAt, action);
};
/**
* Schedules an action to be executed at dueTime.
* @param {Number} dueTime Relative time after which to execute the action.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
VirtualTimeSchedulerPrototype.scheduleRelative = function (dueTime, action) {
return this.scheduleRelativeWithState(action, dueTime, invokeAction);
};
/**
* Starts the virtual time scheduler.
*/
VirtualTimeSchedulerPrototype.start = function () {
if (!this.isEnabled) {
this.isEnabled = true;
do {
var next = this.getNext();
if (next !== null) {
this.comparer(next.dueTime, this.clock) > 0 && (this.clock = next.dueTime);
next.invoke();
} else {
this.isEnabled = false;
}
} while (this.isEnabled);
}
};
/**
* Stops the virtual time scheduler.
*/
VirtualTimeSchedulerPrototype.stop = function () {
this.isEnabled = false;
};
/**
* Advances the scheduler's clock to the specified time, running all work till that point.
* @param {Number} time Absolute time to advance the scheduler's clock to.
*/
VirtualTimeSchedulerPrototype.advanceTo = function (time) {
var dueToClock = this.comparer(this.clock, time);
if (this.comparer(this.clock, time) > 0) {
throw new Error(argumentOutOfRange);
}
if (dueToClock === 0) {
return;
}
if (!this.isEnabled) {
this.isEnabled = true;
do {
var next = this.getNext();
if (next !== null && this.comparer(next.dueTime, time) <= 0) {
this.comparer(next.dueTime, this.clock) > 0 && (this.clock = next.dueTime);
next.invoke();
} else {
this.isEnabled = false;
}
} while (this.isEnabled);
this.clock = time;
}
};
/**
* Advances the scheduler's clock by the specified relative time, running all work scheduled for that timespan.
* @param {Number} time Relative time to advance the scheduler's clock by.
*/
VirtualTimeSchedulerPrototype.advanceBy = function (time) {
var dt = this.add(this.clock, time),
dueToClock = this.comparer(this.clock, dt);
if (dueToClock > 0) { throw new Error(argumentOutOfRange); }
if (dueToClock === 0) { return; }
this.advanceTo(dt);
};
/**
* Advances the scheduler's clock by the specified relative time.
* @param {Number} time Relative time to advance the scheduler's clock by.
*/
VirtualTimeSchedulerPrototype.sleep = function (time) {
var dt = this.add(this.clock, time);
if (this.comparer(this.clock, dt) >= 0) { throw new Error(argumentOutOfRange); }
this.clock = dt;
};
/**
* Gets the next scheduled item to be executed.
* @returns {ScheduledItem} The next scheduled item.
*/
VirtualTimeSchedulerPrototype.getNext = function () {
while (this.queue.length > 0) {
var next = this.queue.peek();
if (next.isCancelled()) {
this.queue.dequeue();
} else {
return next;
}
}
return null;
};
/**
* Schedules an action to be executed at dueTime.
* @param {Scheduler} scheduler Scheduler to execute the action on.
* @param {Number} dueTime Absolute time at which to execute the action.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
VirtualTimeSchedulerPrototype.scheduleAbsolute = function (dueTime, action) {
return this.scheduleAbsoluteWithState(action, dueTime, invokeAction);
};
/**
* Schedules an action to be executed at dueTime.
* @param {Mixed} state State passed to the action to be executed.
* @param {Number} dueTime Absolute time at which to execute the action.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
VirtualTimeSchedulerPrototype.scheduleAbsoluteWithState = function (state, dueTime, action) {
var self = this;
function run(scheduler, state1) {
self.queue.remove(si);
return action(scheduler, state1);
}
var si = new ScheduledItem(this, state, run, dueTime, this.comparer);
this.queue.enqueue(si);
return si.disposable;
};
return VirtualTimeScheduler;
}(Scheduler));
/** Provides a virtual time scheduler that uses Date for absolute time and number for relative time. */
Rx.HistoricalScheduler = (function (__super__) {
inherits(HistoricalScheduler, __super__);
/**
* Creates a new historical scheduler with the specified initial clock value.
* @constructor
* @param {Number} initialClock Initial value for the clock.
* @param {Function} comparer Comparer to determine causality of events based on absolute time.
*/
function HistoricalScheduler(initialClock, comparer) {
var clock = initialClock == null ? 0 : initialClock;
var cmp = comparer || defaultSubComparer;
__super__.call(this, clock, cmp);
}
var HistoricalSchedulerProto = HistoricalScheduler.prototype;
/**
* Adds a relative time value to an absolute time value.
* @param {Number} absolute Absolute virtual time value.
* @param {Number} relative Relative virtual time value to add.
* @return {Number} Resulting absolute virtual time sum value.
*/
HistoricalSchedulerProto.add = function (absolute, relative) {
return absolute + relative;
};
HistoricalSchedulerProto.toDateTimeOffset = function (absolute) {
return new Date(absolute).getTime();
};
/**
* Converts the TimeSpan value to a relative virtual time value.
* @memberOf HistoricalScheduler
* @param {Number} timeSpan TimeSpan value to convert.
* @return {Number} Corresponding relative virtual time value.
*/
HistoricalSchedulerProto.toRelative = function (timeSpan) {
return timeSpan;
};
return HistoricalScheduler;
}(Rx.VirtualTimeScheduler));
var AnonymousObservable = Rx.AnonymousObservable = (function (__super__) {
inherits(AnonymousObservable, __super__);
// Fix subscriber to check for undefined or function returned to decorate as Disposable
function fixSubscriber(subscriber) {
if (subscriber && typeof subscriber.dispose === 'function') { return subscriber; }
return typeof subscriber === 'function' ?
disposableCreate(subscriber) :
disposableEmpty;
}
function AnonymousObservable(subscribe) {
if (!(this instanceof AnonymousObservable)) {
return new AnonymousObservable(subscribe);
}
function s(observer) {
var setDisposable = function () {
try {
autoDetachObserver.setDisposable(fixSubscriber(subscribe(autoDetachObserver)));
} catch (e) {
if (!autoDetachObserver.fail(e)) {
throw e;
}
}
};
var autoDetachObserver = new AutoDetachObserver(observer);
if (currentThreadScheduler.scheduleRequired()) {
currentThreadScheduler.schedule(setDisposable);
} else {
setDisposable();
}
return autoDetachObserver;
}
__super__.call(this, s);
}
return AnonymousObservable;
}(Observable));
/** @private */
var AutoDetachObserver = (function (_super) {
inherits(AutoDetachObserver, _super);
function AutoDetachObserver(observer) {
_super.call(this);
this.observer = observer;
this.m = new SingleAssignmentDisposable();
}
var AutoDetachObserverPrototype = AutoDetachObserver.prototype;
AutoDetachObserverPrototype.next = function (value) {
var noError = false;
try {
this.observer.onNext(value);
noError = true;
} catch (e) {
throw e;
} finally {
if (!noError) {
this.dispose();
}
}
};
AutoDetachObserverPrototype.error = function (exn) {
try {
this.observer.onError(exn);
} catch (e) {
throw e;
} finally {
this.dispose();
}
};
AutoDetachObserverPrototype.completed = function () {
try {
this.observer.onCompleted();
} catch (e) {
throw e;
} finally {
this.dispose();
}
};
AutoDetachObserverPrototype.setDisposable = function (value) { this.m.setDisposable(value); };
AutoDetachObserverPrototype.getDisposable = function (value) { return this.m.getDisposable(); };
/* @private */
AutoDetachObserverPrototype.disposable = function (value) {
return arguments.length ? this.getDisposable() : setDisposable(value);
};
AutoDetachObserverPrototype.dispose = function () {
_super.prototype.dispose.call(this);
this.m.dispose();
};
return AutoDetachObserver;
}(AbstractObserver));
/** @private */
var GroupedObservable = (function (_super) {
inherits(GroupedObservable, _super);
function subscribe(observer) {
return this.underlyingObservable.subscribe(observer);
}
/**
* @constructor
* @private
*/
function GroupedObservable(key, underlyingObservable, mergedDisposable) {
_super.call(this, subscribe);
this.key = key;
this.underlyingObservable = !mergedDisposable ?
underlyingObservable :
new AnonymousObservable(function (observer) {
return new CompositeDisposable(mergedDisposable.getDisposable(), underlyingObservable.subscribe(observer));
});
}
return GroupedObservable;
}(Observable));
/**
* Represents an object that is both an observable sequence as well as an observer.
* Each notification is broadcasted to all subscribed observers.
*/
var Subject = Rx.Subject = (function (_super) {
function subscribe(observer) {
checkDisposed.call(this);
if (!this.isStopped) {
this.observers.push(observer);
return new InnerSubscription(this, observer);
}
if (this.exception) {
observer.onError(this.exception);
return disposableEmpty;
}
observer.onCompleted();
return disposableEmpty;
}
inherits(Subject, _super);
/**
* Creates a subject.
* @constructor
*/
function Subject() {
_super.call(this, subscribe);
this.isDisposed = false,
this.isStopped = false,
this.observers = [];
}
addProperties(Subject.prototype, Observer, {
/**
* Indicates whether the subject has observers subscribed to it.
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () {
return this.observers.length > 0;
},
/**
* Notifies all subscribed observers about the end of the sequence.
*/
onCompleted: function () {
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
this.isStopped = true;
for (var i = 0, len = os.length; i < len; i++) {
os[i].onCompleted();
}
this.observers = [];
}
},
/**
* Notifies all subscribed observers about the exception.
* @param {Mixed} error The exception to send to all observers.
*/
onError: function (exception) {
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
this.isStopped = true;
this.exception = exception;
for (var i = 0, len = os.length; i < len; i++) {
os[i].onError(exception);
}
this.observers = [];
}
},
/**
* Notifies all subscribed observers about the arrival of the specified element in the sequence.
* @param {Mixed} value The value to send to all observers.
*/
onNext: function (value) {
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
for (var i = 0, len = os.length; i < len; i++) {
os[i].onNext(value);
}
}
},
/**
* Unsubscribe all observers and release resources.
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
}
});
/**
* Creates a subject from the specified observer and observable.
* @param {Observer} observer The observer used to send messages to the subject.
* @param {Observable} observable The observable used to subscribe to messages sent from the subject.
* @returns {Subject} Subject implemented using the given observer and observable.
*/
Subject.create = function (observer, observable) {
return new AnonymousSubject(observer, observable);
};
return Subject;
}(Observable));
/**
* Represents the result of an asynchronous operation.
* The last value before the OnCompleted notification, or the error received through OnError, is sent to all subscribed observers.
*/
var AsyncSubject = Rx.AsyncSubject = (function (__super__) {
function subscribe(observer) {
checkDisposed.call(this);
if (!this.isStopped) {
this.observers.push(observer);
return new InnerSubscription(this, observer);
}
var ex = this.exception,
hv = this.hasValue,
v = this.value;
if (ex) {
observer.onError(ex);
} else if (hv) {
observer.onNext(v);
observer.onCompleted();
} else {
observer.onCompleted();
}
return disposableEmpty;
}
inherits(AsyncSubject, __super__);
/**
* Creates a subject that can only receive one value and that value is cached for all future observations.
* @constructor
*/
function AsyncSubject() {
__super__.call(this, subscribe);
this.isDisposed = false;
this.isStopped = false;
this.value = null;
this.hasValue = false;
this.observers = [];
this.exception = null;
}
addProperties(AsyncSubject.prototype, Observer, {
/**
* Indicates whether the subject has observers subscribed to it.
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () {
checkDisposed.call(this);
return this.observers.length > 0;
},
/**
* Notifies all subscribed observers about the end of the sequence, also causing the last received value to be sent out (if any).
*/
onCompleted: function () {
var o, i, len;
checkDisposed.call(this);
if (!this.isStopped) {
this.isStopped = true;
var os = this.observers.slice(0),
v = this.value,
hv = this.hasValue;
if (hv) {
for (i = 0, len = os.length; i < len; i++) {
o = os[i];
o.onNext(v);
o.onCompleted();
}
} else {
for (i = 0, len = os.length; i < len; i++) {
os[i].onCompleted();
}
}
this.observers = [];
}
},
/**
* Notifies all subscribed observers about the error.
* @param {Mixed} error The Error to send to all observers.
*/
onError: function (error) {
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
this.isStopped = true;
this.exception = error;
for (var i = 0, len = os.length; i < len; i++) {
os[i].onError(error);
}
this.observers = [];
}
},
/**
* Sends a value to the subject. The last value received before successful termination will be sent to all subscribed and future observers.
* @param {Mixed} value The value to store in the subject.
*/
onNext: function (value) {
checkDisposed.call(this);
if (this.isStopped) { return; }
this.value = value;
this.hasValue = true;
},
/**
* Unsubscribe all observers and release resources.
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
this.exception = null;
this.value = null;
}
});
return AsyncSubject;
}(Observable));
var AnonymousSubject = Rx.AnonymousSubject = (function (__super__) {
inherits(AnonymousSubject, __super__);
function AnonymousSubject(observer, observable) {
this.observer = observer;
this.observable = observable;
__super__.call(this, this.observable.subscribe.bind(this.observable));
}
addProperties(AnonymousSubject.prototype, Observer, {
onCompleted: function () {
this.observer.onCompleted();
},
onError: function (exception) {
this.observer.onError(exception);
},
onNext: function (value) {
this.observer.onNext(value);
}
});
return AnonymousSubject;
}(Observable));
if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
root.Rx = Rx;
define(function() {
return Rx;
});
} else if (freeExports && freeModule) {
// in Node.js or RingoJS
if (moduleExports) {
(freeModule.exports = Rx).Rx = Rx;
} else {
freeExports.Rx = Rx;
}
} else {
// in a browser or Rhino
root.Rx = Rx;
}
}.call(this)); |
components/press/index.js | blockstack/blockstack-site | import React from 'react'
import { Box, Flex } from 'blockstack-ui'
import { useHover } from 'use-events'
import { transition } from '@common/theme'
import { Title, Text } from '@components/section/index'
import { useSectionVariant } from '@common/hooks'
import ChevronRightIcon from 'mdi-react/ChevronRightIcon'
import {
WiredLogo,
WashingtonPostLogo,
NytLogo,
EconomistLogo,
ForbesLogo,
FortuneLogo
} from '@components/vectors/index'
const Wrapper = ({ ...rest }) => <Box flexGrow={0} width={1} {...rest} />
const PublicationLogo = ({ publication, ...rest }) => {
let Component = null
let customWidth = undefined
switch (publication) {
case 'Wired':
Component = WiredLogo
customWidth = 78
break
case 'The New York Times':
Component = NytLogo
break
case 'The Washington Post':
Component = WashingtonPostLogo
break
case 'Forbes':
Component = ForbesLogo
customWidth = 82
break
case 'Fortune':
Component = FortuneLogo
customWidth = 82
break
case 'The Economist':
Component = EconomistLogo
customWidth = 78
break
}
if (Component) {
return (
<Wrapper maxWidth={customWidth} {...rest}>
<Component {...rest} />
</Wrapper>
)
}
return null
}
const Press = ({ items, ...rest }) => {
if (!items || !items.length) return null
const { text, variant } = useSectionVariant()
return (
<Flex justifyContent="space-between" flexWrap="wrap" {...rest}>
{items.map((item, key) => {
const [hovered, bind] = useHover()
return (
<Flex
flexDirection="column"
justifyContent="space-between"
bg={
variant === 'white'
? 'white'
: variant === 'ink'
? 'ink.95'
: 'blue'
}
is="a"
href={item.href}
target="_blank"
style={{
textDecoration: 'none'
}}
px={5}
pb={6}
pt={6}
key={key}
transform={hovered ? 'translateY(-5px)' : 'none'}
borderRadius="8px"
cursor={hovered ? 'pointer' : 'unset'}
flexShrink={0}
boxShadow={
hovered
? '0px 16px 24px rgba(0, 0, 0, 0.04), 0px 1px 2px rgba(0, 0, 0, 0.08)'
: '0px 2px 12px rgba(0, 0, 0, 0.04), 0px 1px 2px rgba(0, 0, 0, 0.08)'
}
width={[1, 'calc(50% - 16px)', 'calc(33.3333% - 16px)']}
mb={5}
transition={transition}
{...bind}
>
<Box>
<Flex
opacity={hovered ? 1 : 0.75}
transition={transition}
alignItems="center"
minHeight={80}
pb={5}
maxWidth={150}
>
<PublicationLogo
publication={item.publication}
color={text.body}
/>
</Flex>
<Title pr={6} is="h4">
{item.title}
</Title>
</Box>
<Text
display="inline-flex"
alignItems="center"
fontSize={1}
pt={5}
mt="auto"
justifySelf="flex-end"
color={hovered ? text.hover : text.body}
opacity={hovered ? 1 : 0.75}
transition={transition}
>
<Box is="span">Read article</Box>
<Box
transition={transition}
transform={`translate3d(${hovered ? 1 : -1}px,4px,0)`}
>
<ChevronRightIcon size="17px" />
</Box>
</Text>
</Flex>
)
})}
</Flex>
)
}
export { Press }
|
src/components/app/QuickActions.js | metasfresh/metasfresh-webui-frontend | import counterpart from 'counterpart';
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import { connect } from 'react-redux';
import Queue from 'simple-promise-queue';
import cx from 'classnames';
import { quickActionsRequest } from '../../api';
import {
openModal,
fetchedQuickActions,
deleteQuickActions,
} from '../../actions/WindowActions';
import keymap from '../../shortcuts/keymap';
import QuickActionsContextShortcuts from '../keyshortcuts/QuickActionsContextShortcuts';
import Tooltips from '../tooltips/Tooltips.js';
import QuickActionsDropdown from './QuickActionsDropdown';
const initialState = {
isDropdownOpen: false,
btnTooltip: false,
listTooltip: false,
loading: false,
};
/**
* @file Class based component.
* @module QuickActions
* @extends Component
*/
export class QuickActions extends Component {
mounted = false;
constructor(props) {
super(props);
this.state = initialState;
this.fetchActions = this.fetchActions.bind(this);
this.queue = new Queue({
autoStart: true,
});
}
componentDidMount = () => {
this.mounted = true;
const {
fetchOnInit,
selected,
windowType,
viewId,
viewProfileId,
childView,
parentView,
} = this.props;
if (fetchOnInit) {
this.queue.pushTask((res, rej) => {
this.fetchActions(
windowType,
viewId,
viewProfileId,
selected,
childView,
parentView,
res,
rej
);
});
}
};
componentWillUnmount = () => {
const { deleteQuickActions, viewId, windowType } = this.props;
this.mounted = false;
deleteQuickActions(windowType, viewId);
};
UNSAFE_componentWillReceiveProps = (nextProps) => {
const { selected, viewId, windowType } = this.props;
if (
((selected || nextProps.selected) &&
JSON.stringify(nextProps.selected) !== JSON.stringify(selected)) ||
(nextProps.viewId && nextProps.viewId !== viewId) ||
(nextProps.windowType && nextProps.windowType !== windowType)
) {
this.queue.pushTask((res, rej) => {
this.fetchActions(
nextProps.windowType,
nextProps.viewId,
nextProps.viewProfileId,
nextProps.selected,
nextProps.childView,
nextProps.parentView,
res,
rej
);
});
}
};
shouldComponentUpdate(nextProps) {
return nextProps.shouldNotUpdate !== true;
}
componentDidUpdate = (prevProps) => {
const { inBackground, inModal } = this.props;
if (inModal === false && prevProps.inModal === true) {
// gained focus after sub-modal closed
this.setState({
loading: false,
});
}
if (inBackground === true && prevProps.inBackground === false) {
// gained focus after modal closed
this.setState({
loading: false,
});
}
};
/**
* @method updateActions
* @summary ToDo: Describe the method
* @param {*} childSelection
* @todo Write the documentation
*/
updateActions = (childSelection = this.props.childView.viewSelectedIds) => {
const {
windowType,
viewId,
viewProfileId,
selected,
childView,
parentView,
} = this.props;
this.queue.pushTask((res, rej) => {
this.fetchActions(
windowType,
viewId,
viewProfileId,
selected,
{ ...childView, viewSelectedIds: childSelection },
parentView,
res,
rej
);
});
};
/**
* @method handleClickOPutside
* @summary ToDo: Describe the method
* @todo Write the documentation
*/
handleClickOutside = () => {
this.toggleDropdown();
};
/**
* @method handleClick
* @summary ToDo: Describe the method
* @param {*} action
* @todo Write the documentation
*/
handleClick = (action) => {
const { openModal, viewId, selected, childView, parentView } = this.props;
if (action.disabled) {
return;
}
this.setState({
loading: true,
});
openModal(
action.caption,
action.processId,
'process',
null,
null,
false,
viewId,
selected,
null,
null,
parentView.viewId,
parentView.viewSelectedIds,
childView.viewId,
childView.viewSelectedIds
);
this.toggleDropdown();
};
/**
* @async
* @method renderCancelButton
* @summary ToDo: Describe the method
* @param {*} windowId
* @param {*} viewId
* @param {*} viewProfileId
* @param {*} selected
* @param {*} childView
* @param {*} parentView
* @param {*} resolve
* @param {*} reject
* @todo Rewrite this as an action creator
*/
async fetchActions(
windowId,
viewId,
viewProfileId,
selected,
childView,
parentView,
resolve,
reject
) {
const { fetchedQuickActions } = this.props;
if (!this.mounted) {
return resolve();
}
if (windowId && viewId) {
await quickActionsRequest(
windowId,
viewId,
viewProfileId,
selected,
childView,
parentView
)
.then((result) => {
const [respRel, resp] = result;
if (this.mounted) {
const currentActions =
resp && resp.data ? resp.data.actions : respRel.data.actions;
const relatedActions =
resp && resp.data ? respRel.data.actions : null;
if ((parentView.viewId || childView.viewId) && relatedActions) {
const windowType = parentView.windowType
? parentView.windowType
: childView.windowType;
const id = parentView.viewId
? parentView.viewId
: childView.viewId;
fetchedQuickActions(windowType, id, relatedActions);
}
fetchedQuickActions(windowId, viewId, currentActions);
return this.setState(
{
loading: false,
},
() => resolve()
);
}
})
.catch((e) => {
// eslint-disable-next-line no-console
console.error(e);
if (this.mounted) {
return this.setState(
{
loading: false,
},
() => reject()
);
}
});
} else {
if (this.mounted) {
return this.setState(
{
loading: false,
},
() => resolve()
);
}
}
}
/**
* @method toggleDropdown
* @summary ToDo: Describe the method
* @param {*} option
* @todo Write the documentation
*/
toggleDropdown = (option) => {
this.setState({
isDropdownOpen: option,
});
};
/**
* @method toggleTooltip
* @summary ToDo: Describe the method
* @param {*} type
* @param {*} visible
* @todo Write the documentation
*/
toggleTooltip = (type, visible) => {
this.setState({
[type]: visible,
});
};
/**
* @method render
* @summary ToDo: Describe the method
* @todo Write the documentation
*/
render() {
const { isDropdownOpen, btnTooltip, listTooltip, loading } = this.state;
const {
actions,
shouldNotUpdate,
processStatus,
disabled,
className,
} = this.props;
const disabledDuringProcessing = processStatus === 'pending' || loading;
if (actions.length) {
return (
<div
className={cx(className, 'js-not-unselect ', {
disabled: disabled,
})}
>
<span className="action-label spacer-right">
{counterpart.translate('window.quickActions.caption')}:
</span>
<div className="quick-actions-wrapper">
<div
className={
'tag tag-success tag-xlg spacer-right ' +
'quick-actions-tag ' +
(actions[0].disabled || disabledDuringProcessing
? 'tag-default '
: 'pointer ')
}
onMouseEnter={() => this.toggleTooltip('listTooltip', true)}
onMouseLeave={() => this.toggleTooltip('listTooltip', false)}
onClick={(e) => {
e.preventDefault();
this.handleClick(actions[0]);
}}
>
{listTooltip && (
<Tooltips
name={keymap.QUICK_ACTION_POS}
action={'Run action'}
type={''}
/>
)}
{actions[0].caption}
</div>
<div
className={
'btn-meta-outline-secondary btn-icon-sm ' +
'btn-inline btn-icon pointer tooltip-parent ' +
(isDropdownOpen || disabledDuringProcessing
? 'btn-disabled '
: '')
}
onMouseEnter={() => this.toggleTooltip('btnTooltip', true)}
onMouseLeave={() => this.toggleTooltip('btnTooltip', false)}
onClick={() => {
this.toggleDropdown(!isDropdownOpen);
}}
>
<i className="meta-icon-down-1" />
{btnTooltip && (
<Tooltips
name={keymap.QUICK_ACTION_TOGGLE}
action={'Toggle list'}
type={''}
/>
)}
</div>
{isDropdownOpen && (
<QuickActionsDropdown
actions={actions}
handleClick={this.handleClick}
handleClickOutside={() => this.toggleDropdown(false)}
disableOnClickOutside={!isDropdownOpen}
/>
)}
</div>
<QuickActionsContextShortcuts
handleClick={() =>
shouldNotUpdate ? null : this.handleClick(actions[0])
}
stopPropagation={this.props.stopShortcutPropagation}
onClick={() => this.toggleDropdown(!isDropdownOpen)}
/>
</div>
);
} else {
return null;
}
}
}
/**
* @typedef {object} Props Component props
* @prop {func} dispatch
* @prop {object} childView
* @prop {string} windowType
* @prop {string} [viewId]
* @prop {string} [viewProfileId]
* @prop {bool} [fetchOnInit]
* @prop {bool} [inBackground]
* @prop {bool} [inModal]
* @prop {bool} [disabled]
* @prop {bool} [stopShortcutPropagation]
* @prop {string} [processStatus]
* @prop {string} [shouldNotUpdate]
* @prop {any} [selected]
* @todo Check title, buttons. Which proptype? Required or optional?
*/
QuickActions.propTypes = {
// from @connect
actions: PropTypes.array,
openModal: PropTypes.func.isRequired,
fetchedQuickActions: PropTypes.func.isRequired,
deleteQuickActions: PropTypes.func.isRequired,
// from <DocumentList>
childView: PropTypes.object.isRequired,
parentView: PropTypes.object.isRequired,
windowType: PropTypes.string.isRequired,
viewId: PropTypes.string,
viewProfileId: PropTypes.string,
fetchOnInit: PropTypes.bool,
inBackground: PropTypes.bool,
inModal: PropTypes.bool,
disabled: PropTypes.bool,
stopShortcutPropagation: PropTypes.bool,
processStatus: PropTypes.string,
shouldNotUpdate: PropTypes.any,
selected: PropTypes.any,
className: PropTypes.string,
onInvalidViewId: PropTypes.func,
};
const mapStateToProps = (state, ownProps) => {
const { viewId, windowType } = ownProps;
const key = `${windowType}${viewId ? `-${viewId}` : ''}`;
return {
actions: state.windowHandler.quickActions[key] || [],
};
};
export default connect(
mapStateToProps,
{ openModal, fetchedQuickActions, deleteQuickActions },
false,
{ forwardRef: true }
)(QuickActions);
|
client/src/containers/Login.js | HoussamOtarid/fb-photos-downloader | import React, { Component } from 'react';
import { connect } from 'react-redux';
import { Field, reduxForm } from 'redux-form';
import { Link } from 'react-router-dom';
import { loginUser } from '../actions/authActions';
class Login extends Component {
componentWillMount() {
const { authenticated } = this.props.auth;
if (authenticated) this.props.history.push('/login');
}
componentWillReceiveProps(nextProps) {
const { authenticated } = nextProps.auth;
if (authenticated) this.props.history.push('/dashboard');
}
renderField(field) {
const { label, type, input, meta: { touched, error } } = field;
const cLassName = `form-control ${touched && error ? 'is-invalid' : ''}`;
return (
<div className="form-group">
<label>{label}</label>
<input className={cLassName} type={type} {...input} />
<div className="invalid-feedback">{touched ? error : ''}</div>
</div>
);
}
onSubmit(values) {
this.props.loginUser(values);
}
renderResponse() {
const { authenticated, message } = this.props.auth;
if (!message) return;
const className = `alert ${authenticated ? 'alert-success' : 'alert-danger'}`;
return (
<div className={className} role="alert">
{message}
</div>
);
}
render() {
const { handleSubmit } = this.props;
return (
<div className="col-4 mx-auto">
{this.renderResponse()}
<form onSubmit={handleSubmit(this.onSubmit.bind(this))}>
<Field label="Email" name="email" type="text" component={this.renderField} />
<Field label="Password" name="password" type="password" component={this.renderField} />
<button type="submit" className="btn btn-secondary btn-block">
Login
</button>
<div className="text-center">
Not registred yet? <Link to="/register">Register now!</Link>
</div>
</form>
</div>
);
}
}
function validate(values) {
const errors = {};
if (!values.email) {
errors.email = 'The email is required';
}
if (!values.password) {
errors.password = 'The password is required';
}
return errors;
}
function mapStateToProps(state) {
return {
auth: state.auth
};
}
export default reduxForm({
form: 'Login',
validate
})(connect(mapStateToProps, { loginUser })(Login));
|
docs-ui/components/idBadge.stories.js | ifduyue/sentry | import React from 'react';
import {storiesOf} from '@storybook/react';
import {withInfo} from '@storybook/addon-info';
import styled from 'react-emotion';
import IdBadge from 'app/components/idBadge';
const Item = styled('div')`
padding: 8px;
background-color: white;
border: 1px dashed #fcfcfc;
margin-bottom: 30px;
`;
Item.displayName = 'Item';
const Header = styled('h2')`
font-size: 18px;
margin-bottom: 4px;
`;
Header.displayName = 'Header';
storiesOf('IdBadge', module).add(
'all',
withInfo({
text:
'These are identification badges for certain models in Sentry: Organization, Project, Team, and User.',
propTablesExclude: [Item, Header, React.Fragment],
})(() => {
const user = {
name: 'Chrissy',
email: 'chris.clark@sentry.io',
};
const team = {
slug: 'team-slug',
};
const project = {
slug: 'project-slug',
};
const organization = {
slug: 'organization-slug',
};
return (
<React.Fragment>
<Header>User Badge</Header>
<Item>
<IdBadge user={user} />
</Item>
<Header>Team Badge</Header>
<Item>
<IdBadge team={team} />
</Item>
<Header>Project Badge</Header>
<Item>
<IdBadge project={project} />
</Item>
<Header>Organization Badge</Header>
<Item>
<IdBadge organization={organization} />
</Item>
</React.Fragment>
);
})
);
|
packages/material-ui-icons/src/AcUnitTwoTone.js | kybarg/material-ui | import React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<path d="M22 11h-4.17l3.24-3.24-1.41-1.42L15 11h-2V9l4.66-4.66-1.42-1.41L13 6.17V2h-2v4.17L7.76 2.93 6.34 4.34 11 9v2H9L4.34 6.34 2.93 7.76 6.17 11H2v2h4.17l-3.24 3.24 1.41 1.42L9 13h2v2l-4.66 4.66 1.42 1.41L11 17.83V22h2v-4.17l3.24 3.24 1.42-1.41L13 15v-2h2l4.66 4.66 1.41-1.42L17.83 13H22v-2z" />
, 'AcUnitTwoTone');
|
ajax/libs/jquery/1.7.2/jquery.min.js | jish/cdnjs | /*! jQuery v1.7.2 jquery.com | jquery.org/license */
(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cu(a){if(!cj[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ck||(ck=c.createElement("iframe"),ck.frameBorder=ck.width=ck.height=0),b.appendChild(ck);if(!cl||!ck.createElement)cl=(ck.contentWindow||ck.contentDocument).document,cl.write((f.support.boxModel?"<!doctype html>":"")+"<html><body>"),cl.close();d=cl.createElement(a),cl.body.appendChild(d),e=f.css(d,"display"),b.removeChild(ck)}cj[a]=e}return cj[a]}function ct(a,b){var c={};f.each(cp.concat.apply([],cp.slice(0,b)),function(){c[this]=a});return c}function cs(){cq=b}function cr(){setTimeout(cs,0);return cq=f.now()}function ci(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ch(){try{return new a.XMLHttpRequest}catch(b){}}function cb(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function ca(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function b_(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bD.test(a)?d(a,e):b_(a+"["+(typeof e=="object"?b:"")+"]",e,c,d)});else if(!c&&f.type(b)==="object")for(var e in b)b_(a+"["+e+"]",b[e],c,d);else d(a,b)}function b$(a,c){var d,e,g=f.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((g[d]?a:e||(e={}))[d]=c[d]);e&&f.extend(!0,a,e)}function bZ(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bS,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=bZ(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=bZ(a,c,d,e,"*",g));return l}function bY(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bO),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bB(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=b==="width"?1:0,g=4;if(d>0){if(c!=="border")for(;e<g;e+=2)c||(d-=parseFloat(f.css(a,"padding"+bx[e]))||0),c==="margin"?d+=parseFloat(f.css(a,c+bx[e]))||0:d-=parseFloat(f.css(a,"border"+bx[e]+"Width"))||0;return d+"px"}d=by(a,b);if(d<0||d==null)d=a.style[b];if(bt.test(d))return d;d=parseFloat(d)||0;if(c)for(;e<g;e+=2)d+=parseFloat(f.css(a,"padding"+bx[e]))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+bx[e]+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+bx[e]))||0);return d+"px"}function bo(a){var b=c.createElement("div");bh.appendChild(b),b.innerHTML=a.outerHTML;return b.firstChild}function bn(a){var b=(a.nodeName||"").toLowerCase();b==="input"?bm(a):b!=="script"&&typeof a.getElementsByTagName!="undefined"&&f.grep(a.getElementsByTagName("input"),bm)}function bm(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bl(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bk(a,b){var c;b.nodeType===1&&(b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase(),c==="object"?b.outerHTML=a.outerHTML:c!=="input"||a.type!=="checkbox"&&a.type!=="radio"?c==="option"?b.selected=a.defaultSelected:c==="input"||c==="textarea"?b.defaultValue=a.defaultValue:c==="script"&&b.text!==a.text&&(b.text=a.text):(a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value)),b.removeAttribute(f.expando),b.removeAttribute("_submit_attached"),b.removeAttribute("_change_attached"))}function bj(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c,d,e,g=f._data(a),h=f._data(b,g),i=g.events;if(i){delete h.handle,h.events={};for(c in i)for(d=0,e=i[c].length;d<e;d++)f.event.add(b,c,i[c][d])}h.data&&(h.data=f.extend({},h.data))}}function bi(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function U(a){var b=V.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function T(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(O.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?+d:j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c<d;c++)b[a[c]]=!0;return b}var c=a.document,d=a.navigator,e=a.location,f=function(){function J(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(J,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.2",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a!=null&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){if(typeof c!="string"||!c)return null;var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:G?function(a){return a==null?"":G.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?E.call(c,a):e.merge(c,a)}return c},inArray:function(a,b,c){var d;if(b){if(H)return H.call(b,a,c);d=b.length,c=c?c<0?Math.max(0,d+c):c:0;for(;c<d;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=F.call(arguments,2),g=function(){return a.apply(c,f.concat(F.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h,i){var j,k=d==null,l=0,m=a.length;if(d&&typeof d=="object"){for(l in d)e.access(a,c,l,d[l],1,h,f);g=1}else if(f!==b){j=i===b&&e.isFunction(f),k&&(j?(j=c,c=function(a,b,c){return j.call(e(a),c)}):(c.call(a,f),c=null));if(c)for(;l<m;l++)c(a[l],d,j?f.call(a[l],l,c(a[l],d)):f,i);g=1}return g?a:k?c.call(a):m?c(a[0],d):h},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=r.exec(a)||s.exec(a)||t.exec(a)||a.indexOf("compatible")<0&&u.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){I["[object "+b+"]"]=b.toLowerCase()}),z=e.uaMatch(y),z.browser&&(e.browser[z.browser]=!0,e.browser.version=z.version),e.browser.webkit&&(e.browser.safari=!0),j.test(" ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?B=function(){c.removeEventListener("DOMContentLoaded",B,!1),e.ready()}:c.attachEvent&&(B=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",B),e.ready())});return e}(),g={};f.Callbacks=function(a){a=a?g[a]||h(a):{};var c=[],d=[],e,i,j,k,l,m,n=function(b){var d,e,g,h,i;for(d=0,e=b.length;d<e;d++)g=b[d],h=f.type(g),h==="array"?n(g):h==="function"&&(!a.unique||!p.has(g))&&c.push(g)},o=function(b,f){f=f||[],e=!a.memory||[b,f],i=!0,j=!0,m=k||0,k=0,l=c.length;for(;c&&m<l;m++)if(c[m].apply(b,f)===!1&&a.stopOnFalse){e=!0;break}j=!1,c&&(a.once?e===!0?p.disable():c=[]:d&&d.length&&(e=d.shift(),p.fireWith(e[0],e[1])))},p={add:function(){if(c){var a=c.length;n(arguments),j?l=c.length:e&&e!==!0&&(k=a,o(e[0],e[1]))}return this},remove:function(){if(c){var b=arguments,d=0,e=b.length;for(;d<e;d++)for(var f=0;f<c.length;f++)if(b[d]===c[f]){j&&f<=l&&(l--,f<=m&&m--),c.splice(f--,1);if(a.unique)break}}return this},has:function(a){if(c){var b=0,d=c.length;for(;b<d;b++)if(a===c[b])return!0}return!1},empty:function(){c=[];return this},disable:function(){c=d=e=b;return this},disabled:function(){return!c},lock:function(){d=b,(!e||e===!0)&&p.disable();return this},locked:function(){return!d},fireWith:function(b,c){d&&(j?a.once||d.push([b,c]):(!a.once||!e)&&o(b,c));return this},fire:function(){p.fireWith(this,arguments);return this},fired:function(){return!!i}};return p};var i=[].slice;f.extend({Deferred:function(a){var b=f.Callbacks("once memory"),c=f.Callbacks("once memory"),d=f.Callbacks("memory"),e="pending",g={resolve:b,reject:c,notify:d},h={done:b.add,fail:c.add,progress:d.add,state:function(){return e},isResolved:b.fired,isRejected:c.fired,then:function(a,b,c){i.done(a).fail(b).progress(c);return this},always:function(){i.done.apply(i,arguments).fail.apply(i,arguments);return this},pipe:function(a,b,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[b,"reject"],progress:[c,"notify"]},function(a,b){var c=b[0],e=b[1],g;f.isFunction(c)?i[a](function(){g=c.apply(this,arguments),g&&f.isFunction(g.promise)?g.promise().then(d.resolve,d.reject,d.notify):d[e+"With"](this===i?d:this,[g])}):i[a](d[e])})}).promise()},promise:function(a){if(a==null)a=h;else for(var b in h)a[b]=h[b];return a}},i=h.promise({}),j;for(j in g)i[j]=g[j].fire,i[j+"With"]=g[j].fireWith;i.done(function(){e="resolved"},c.disable,d.lock).fail(function(){e="rejected"},b.disable,d.lock),a&&a.call(i,i);return i},when:function(a){function m(a){return function(b){e[a]=arguments.length>1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c<d;c++)b[c]&&b[c].promise&&f.isFunction(b[c].promise)?b[c].promise().then(l(c),j.reject,m(c)):--g;g||j.resolveWith(j,b)}else j!==a&&j.resolveWith(j,d?[a]:[]);return k}}),f.support=function(){var b,d,e,g,h,i,j,k,l,m,n,o,p=c.createElement("div"),q=c.documentElement;p.setAttribute("className","t"),p.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",d=p.getElementsByTagName("*"),e=p.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=p.getElementsByTagName("input")[0],b={leadingWhitespace:p.firstChild.nodeType===3,tbody:!p.getElementsByTagName("tbody").length,htmlSerialize:!!p.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:p.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,pixelMargin:!0},f.boxModel=b.boxModel=c.compatMode==="CSS1Compat",i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete p.test}catch(r){b.deleteExpando=!1}!p.addEventListener&&p.attachEvent&&p.fireEvent&&(p.attachEvent("onclick",function(){b.noCloneEvent=!1}),p.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),i.setAttribute("name","t"),p.appendChild(i),j=c.createDocumentFragment(),j.appendChild(p.lastChild),b.checkClone=j.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,j.removeChild(i),j.appendChild(p);if(p.attachEvent)for(n in{submit:1,change:1,focusin:1})m="on"+n,o=m in p,o||(p.setAttribute(m,"return;"),o=typeof p[m]=="function"),b[n+"Bubbles"]=o;j.removeChild(p),j=g=h=p=i=null,f(function(){var d,e,g,h,i,j,l,m,n,q,r,s,t,u=c.getElementsByTagName("body")[0];!u||(m=1,t="padding:0;margin:0;border:",r="position:absolute;top:0;left:0;width:1px;height:1px;",s=t+"0;visibility:hidden;",n="style='"+r+t+"5px solid #000;",q="<div "+n+"display:block;'><div style='"+t+"0;display:block;overflow:hidden;'></div></div>"+"<table "+n+"' cellpadding='0' cellspacing='0'>"+"<tr><td></td></tr></table>",d=c.createElement("div"),d.style.cssText=s+"width:0;height:0;position:static;top:0;margin-top:"+m+"px",u.insertBefore(d,u.firstChild),p=c.createElement("div"),d.appendChild(p),p.innerHTML="<table><tr><td style='"+t+"0;display:none'></td><td>t</td></tr></table>",k=p.getElementsByTagName("td"),o=k[0].offsetHeight===0,k[0].style.display="",k[1].style.display="none",b.reliableHiddenOffsets=o&&k[0].offsetHeight===0,a.getComputedStyle&&(p.innerHTML="",l=c.createElement("div"),l.style.width="0",l.style.marginRight="0",p.style.width="2px",p.appendChild(l),b.reliableMarginRight=(parseInt((a.getComputedStyle(l,null)||{marginRight:0}).marginRight,10)||0)===0),typeof p.style.zoom!="undefined"&&(p.innerHTML="",p.style.width=p.style.padding="1px",p.style.border=0,p.style.overflow="hidden",p.style.display="inline",p.style.zoom=1,b.inlineBlockNeedsLayout=p.offsetWidth===3,p.style.display="block",p.style.overflow="visible",p.innerHTML="<div style='width:5px;'></div>",b.shrinkWrapBlocks=p.offsetWidth!==3),p.style.cssText=r+s,p.innerHTML=q,e=p.firstChild,g=e.firstChild,i=e.nextSibling.firstChild.firstChild,j={doesNotAddBorder:g.offsetTop!==5,doesAddBorderForTableAndCells:i.offsetTop===5},g.style.position="fixed",g.style.top="20px",j.fixedPosition=g.offsetTop===20||g.offsetTop===15,g.style.position=g.style.top="",e.style.overflow="hidden",e.style.position="relative",j.subtractsBorderForOverflowNotVisible=g.offsetTop===-5,j.doesNotIncludeMarginInBodyOffset=u.offsetTop!==m,a.getComputedStyle&&(p.style.marginTop="1%",b.pixelMargin=(a.getComputedStyle(p,null)||{marginTop:0}).marginTop!=="1%"),typeof d.style.zoom!="undefined"&&(d.style.zoom=1),u.removeChild(d),l=p=d=null,f.extend(b,j))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e<g;e++)delete d[b[e]];if(!(c?m:f.isEmptyObject)(d))return}}if(!c){delete j[k].data;if(!m(j[k]))return}f.support.deleteExpando||!j.setInterval?delete j[k]:j[k]=null,i&&(f.support.deleteExpando?delete a[h]:a.removeAttribute?a.removeAttribute(h):a[h]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d,e,g,h,i,j=this[0],k=0,m=null;if(a===b){if(this.length){m=f.data(j);if(j.nodeType===1&&!f._data(j,"parsedAttrs")){g=j.attributes;for(i=g.length;k<i;k++)h=g[k].name,h.indexOf("data-")===0&&(h=f.camelCase(h.substring(5)),l(j,h,m[h]));f._data(j,"parsedAttrs",!0)}}return m}if(typeof a=="object")return this.each(function(){f.data(this,a)});d=a.split(".",2),d[1]=d[1]?"."+d[1]:"",e=d[1]+"!";return f.access(this,function(c){if(c===b){m=this.triggerHandler("getData"+e,[d[0]]),m===b&&j&&(m=f.data(j,a),m=l(j,a,m));return m===b&&d[1]?this.data(d[0]):m}d[1]=c,this.each(function(){var b=f(this);b.triggerHandler("setData"+e,d),f.data(this,a,c),b.triggerHandler("changeData"+e,d)})},null,c,arguments.length>1,null,!1)},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,b){a&&(b=(b||"fx")+"mark",f._data(a,b,(f._data(a,b)||0)+1))},_unmark:function(a,b,c){a!==!0&&(c=b,b=a,a=!1);if(b){c=c||"fx";var d=c+"mark",e=a?0:(f._data(b,d)||1)-1;e?f._data(b,d,e):(f.removeData(b,d,!0),n(b,c,"mark"))}},queue:function(a,b,c){var d;if(a){b=(b||"fx")+"queue",d=f._data(a,b),c&&(!d||f.isArray(c)?d=f._data(a,b,f.makeArray(c)):d.push(c));return d||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e={};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),f._data(a,b+".run",e),d.call(a,function(){f.dequeue(a,b)},e)),c.length||(f.removeData(a,b+"queue "+b+".run",!0),n(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){var d=2;typeof a!="string"&&(c=a,a="fx",d--);if(arguments.length<d)return f.queue(this[0],a);return c===b?this:this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function m(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f.Callbacks("once memory"),!0))h++,l.add(m);m();return d.promise(c)}});var o=/[\n\t\r]/g,p=/\s+/,q=/\r/g,r=/^(?:button|input)$/i,s=/^(?:button|input|object|select|textarea)$/i,t=/^a(?:rea)?$/i,u=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,v=f.support.getSetAttribute,w,x,y;f.fn.extend({attr:function(a,b){return f.access(this,f.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,f.prop,a,b,arguments.length>1)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(p);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{g=" "+e.className+" ";for(h=0,i=b.length;h<i;h++)~g.indexOf(" "+b[h]+" ")||(g+=b[h]+" ");e.className=f.trim(g)}}}return this},removeClass:function(a){var c,d,e,g,h,i,j;if(f.isFunction(a))return this.each(function(b){f(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(p);for(d=0,e=this.length;d<e;d++){g=this[d];if(g.nodeType===1&&g.className)if(a){h=(" "+g.className+" ").replace(o," ");for(i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){f(this).toggleClass(a.call(this,c,this.className,b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(p);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(o," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.type]||f.valHooks[this.nodeName.toLowerCase()];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.type]||f.valHooks[g.nodeName.toLowerCase()];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c<d;c++){e=i[c];if(e.selected&&(f.support.optDisabled?!e.disabled:e.getAttribute("disabled")===null)&&(!e.parentNode.disabled||!f.nodeName(e.parentNode,"optgroup"))){b=f(e).val();if(j)return b;h.push(b)}}if(j&&!h.length&&i.length)return f(i[g]).val();return h},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h,i=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;i<g;i++)e=d[i],e&&(c=f.propFix[e]||e,h=u.test(e),h||f.attr(a,e,""),a.removeAttribute(v?e:c),h&&c in a&&(a[c]=!1))}},attrHooks:{type:{set:function(a,b){if(r.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},value:{get:function(a,b){if(w&&f.nodeName(a,"button"))return w.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(w&&f.nodeName(a,"button"))return w.set(a,b,c);a.value=b}}},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(a,c,d){var e,g,h,i=a.nodeType;if(!!a&&i!==3&&i!==8&&i!==2){h=i!==1||!f.isXMLDoc(a),h&&(c=f.propFix[c]||c,g=f.propHooks[c]);return d!==b?g&&"set"in g&&(e=g.set(a,d,c))!==b?e:a[c]=d:g&&"get"in g&&(e=g.get(a,c))!==null?e:a[c]}},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):s.test(a.nodeName)||t.test(a.nodeName)&&a.href?0:b}}}}),f.attrHooks.tabindex=f.propHooks.tabIndex,x={get:function(a,c){var d,e=f.prop(a,c);return e===!0||typeof e!="boolean"&&(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},v||(y={name:!0,id:!0,coords:!0},w=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&(y[c]?d.nodeValue!=="":d.specified)?d.nodeValue:b},set:function(a,b,d){var e=a.getAttributeNode(d);e||(e=c.createAttribute(d),a.setAttributeNode(e));return e.nodeValue=b+""}},f.attrHooks.tabindex.set=w.set,f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})}),f.attrHooks.contenteditable={get:w.get,set:function(a,b,c){b===""&&(b="false"),w.set(a,b,c)}}),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex);return null}})),f.support.enctype||(f.propFix.enctype="encoding"),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/(?:^|\s)hover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(
a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")};f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler,g=p.selector),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k<c.length;k++){l=A.exec(c[k])||[],m=l[1],n=(l[2]||"").split(".").sort(),s=f.event.special[m]||{},m=(g?s.delegateType:s.bindType)||m,s=f.event.special[m]||{},o=f.extend({type:m,origType:l[1],data:e,handler:d,guid:d.guid,selector:g,quick:g&&G(g),namespace:n.join(".")},p),r=j[m];if(!r){r=j[m]=[],r.delegateCount=0;if(!s.setup||s.setup.call(a,e,n,i)===!1)a.addEventListener?a.addEventListener(m,i,!1):a.attachEvent&&a.attachEvent("on"+m,i)}s.add&&(s.add.call(a,o),o.handler.guid||(o.handler.guid=d.guid)),g?r.splice(r.delegateCount++,0,o):r.push(o),f.event.global[m]=!0}a=null}},global:{},remove:function(a,b,c,d,e){var g=f.hasData(a)&&f._data(a),h,i,j,k,l,m,n,o,p,q,r,s;if(!!g&&!!(o=g.events)){b=f.trim(I(b||"")).split(" ");for(h=0;h<b.length;h++){i=A.exec(b[h])||[],j=k=i[1],l=i[2];if(!j){for(j in o)f.event.remove(a,j+b[h],c,d,!0);continue}p=f.event.special[j]||{},j=(d?p.delegateType:p.bindType)||j,r=o[j]||[],m=r.length,l=l?new RegExp("(^|\\.)"+l.split(".").sort().join("\\.(?:.*\\.)?")+"(\\.|$)"):null;for(n=0;n<r.length;n++)s=r[n],(e||k===s.origType)&&(!c||c.guid===s.guid)&&(!l||l.test(s.namespace))&&(!d||d===s.selector||d==="**"&&s.selector)&&(r.splice(n--,1),s.selector&&r.delegateCount--,p.remove&&p.remove.call(a,s));r.length===0&&m!==r.length&&((!p.teardown||p.teardown.call(a,l)===!1)&&f.removeEvent(a,j,g.handle),delete o[j])}f.isEmptyObject(o)&&(q=g.handle,q&&(q.elem=null),f.removeData(a,["events","handle"],!0))}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){if(!e||e.nodeType!==3&&e.nodeType!==8){var h=c.type||c,i=[],j,k,l,m,n,o,p,q,r,s;if(E.test(h+f.event.triggered))return;h.indexOf("!")>=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;l<r.length&&!c.isPropagationStopped();l++)m=r[l][0],c.type=r[l][1],q=(f._data(m,"events")||{})[c.type]&&f._data(m,"handle"),q&&q.apply(m,d),q=o&&m[o],q&&f.acceptData(m)&&q.apply(m,d)===!1&&c.preventDefault();c.type=h,!g&&!c.isDefaultPrevented()&&(!p._default||p._default.apply(e.ownerDocument,d)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)&&o&&e[h]&&(h!=="focus"&&h!=="blur"||c.target.offsetWidth!==0)&&!f.isWindow(e)&&(n=e[o],n&&(e[o]=null),f.event.triggered=h,e[h](),f.event.triggered=b,n&&(e[o]=n));return c.result}},dispatch:function(c){c=f.event.fix(c||a.event);var d=(f._data(this,"events")||{})[c.type]||[],e=d.delegateCount,g=[].slice.call(arguments,0),h=!c.exclusive&&!c.namespace,i=f.event.special[c.type]||{},j=[],k,l,m,n,o,p,q,r,s,t,u;g[0]=c,c.delegateTarget=this;if(!i.preDispatch||i.preDispatch.call(this,c)!==!1){if(e&&(!c.button||c.type!=="click")){n=f(this),n.context=this.ownerDocument||this;for(m=c.target;m!=this;m=m.parentNode||this)if(m.disabled!==!0){p={},r=[],n[0]=m;for(k=0;k<e;k++)s=d[k],t=s.selector,p[t]===b&&(p[t]=s.quick?H(m,s.quick):n.is(t)),p[t]&&r.push(s);r.length&&j.push({elem:m,matches:r})}}d.length>e&&j.push({elem:this,matches:d.slice(e)});for(k=0;k<j.length&&!c.isPropagationStopped();k++){q=j[k],c.currentTarget=q.elem;for(l=0;l<q.matches.length&&!c.isImmediatePropagationStopped();l++){s=q.matches[l];if(h||!c.namespace&&!s.namespace||c.namespace_re&&c.namespace_re.test(s.namespace))c.data=s.data,c.handleObj=s,o=((f.event.special[s.origType]||{}).handle||s.handler).apply(q.elem,g),o!==b&&(c.result=o,o===!1&&(c.preventDefault(),c.stopPropagation()))}}i.postDispatch&&i.postDispatch.call(this,c);return c.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(a,b){a.which==null&&(a.which=b.charCode!=null?b.charCode:b.keyCode);return a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,d){var e,f,g,h=d.button,i=d.fromElement;a.pageX==null&&d.clientX!=null&&(e=a.target.ownerDocument||c,f=e.documentElement,g=e.body,a.pageX=d.clientX+(f&&f.scrollLeft||g&&g.scrollLeft||0)-(f&&f.clientLeft||g&&g.clientLeft||0),a.pageY=d.clientY+(f&&f.scrollTop||g&&g.scrollTop||0)-(f&&f.clientTop||g&&g.clientTop||0)),!a.relatedTarget&&i&&(a.relatedTarget=i===a.target?d.toElement:i),!a.which&&h!==b&&(a.which=h&1?1:h&2?3:h&4?2:0);return a}},fix:function(a){if(a[f.expando])return a;var d,e,g=a,h=f.event.fixHooks[a.type]||{},i=h.props?this.props.concat(h.props):this.props;a=f.Event(g);for(d=i.length;d;)e=i[--d],a[e]=g[e];a.target||(a.target=g.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),a.metaKey===b&&(a.metaKey=a.ctrlKey);return h.filter?h.filter(a,g):a},special:{ready:{setup:f.bindReady},load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}},simulate:function(a,b,c,d){var e=f.extend(new f.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?f.event.trigger(e,null,b):f.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},f.event.handle=f.event.dispatch,f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},f.Event=function(a,b){if(!(this instanceof f.Event))return new f.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?K:J):this.type=a,b&&f.extend(this,b),this.timeStamp=a&&a.timeStamp||f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=K;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=K;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=K,this.stopPropagation()},isDefaultPrevented:J,isPropagationStopped:J,isImmediatePropagationStopped:J},f.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){f.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c=this,d=a.relatedTarget,e=a.handleObj,g=e.selector,h;if(!d||d!==c&&!f.contains(c,d))a.type=e.origType,h=e.handler.apply(this,arguments),a.type=b;return h}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(){if(f.nodeName(this,"form"))return!1;f.event.add(this,"click._submit keypress._submit",function(a){var c=a.target,d=f.nodeName(c,"input")||f.nodeName(c,"button")?c.form:b;d&&!d._submit_attached&&(f.event.add(d,"submit._submit",function(a){a._submit_bubble=!0}),d._submit_attached=!0)})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&f.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){if(f.nodeName(this,"form"))return!1;f.event.remove(this,"._submit")}}),f.support.changeBubbles||(f.event.special.change={setup:function(){if(z.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")f.event.add(this,"propertychange._change",function(a){a.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),f.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1,f.event.simulate("change",this,a,!0))});return!1}f.event.add(this,"beforeactivate._change",function(a){var b=a.target;z.test(b.nodeName)&&!b._change_attached&&(f.event.add(b,"change._change",function(a){this.parentNode&&!a.isSimulated&&!a.isTrigger&&f.event.simulate("change",this.parentNode,a,!0)}),b._change_attached=!0)})},handle:function(a){var b=a.target;if(this!==b||a.isSimulated||a.isTrigger||b.type!=="radio"&&b.type!=="checkbox")return a.handleObj.handler.apply(this,arguments)},teardown:function(){f.event.remove(this,"._change");return z.test(this.nodeName)}}),f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){var d=0,e=function(a){f.event.simulate(b,a.target,f.event.fix(a),!0)};f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.fn.extend({on:function(a,c,d,e,g){var h,i;if(typeof a=="object"){typeof c!="string"&&(d=d||c,c=b);for(i in a)this.on(i,c,d,a[i],g);return this}d==null&&e==null?(e=c,d=c=b):e==null&&(typeof c=="string"?(e=d,d=b):(e=d,d=c,c=b));if(e===!1)e=J;else if(!e)return this;g===1&&(h=e,e=function(a){f().off(a);return h.apply(this,arguments)},e.guid=h.guid||(h.guid=f.guid++));return this.each(function(){f.event.add(this,a,e,d,c)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,c,d){if(a&&a.preventDefault&&a.handleObj){var e=a.handleObj;f(a.delegateTarget).off(e.namespace?e.origType+"."+e.namespace:e.origType,e.selector,e.handler);return this}if(typeof a=="object"){for(var g in a)this.off(g,c,a[g]);return this}if(c===!1||typeof c=="function")d=c,c=b;d===!1&&(d=J);return this.each(function(){f.event.remove(this,a,d,c)})},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},live:function(a,b,c){f(this.context).on(a,this.selector,b,c);return this},die:function(a,b){f(this.context).off(a,this.selector||"**",b);return this},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return arguments.length==1?this.off(a,"**"):this.off(b,a,c)},trigger:function(a,b){return this.each(function(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f._data(this,"lastToggle"+a.guid)||0)%d;f._data(this,"lastToggle"+a.guid,e+1),c.preventDefault();return b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),f.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){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}if(j.nodeType===1){g||(j[d]=c,j.sizset=h);if(typeof b!="string"){if(j===b){k=!0;break}}else if(m.filter(b,[j]).length>0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}j.nodeType===1&&!g&&(j[d]=c,j.sizset=h);if(j.nodeName.toLowerCase()===b){k=j;break}j=j[a]}e[h]=k}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},m.matches=function(a,b){return m(a,null,null,b)},m.matchesSelector=function(a,b){return m(b,null,null,[a]).length>0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e<f;e++){h=o.order[e];if(g=o.leftMatch[h].exec(a)){i=g[1],g.splice(1,1);if(i.substr(i.length-1)!=="\\"){g[1]=(g[1]||"").replace(j,""),d=o.find[h](g,b,c);if(d!=null){a=a.replace(o.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},m.filter=function(a,c,d,e){var f,g,h,i,j,k,l,n,p,q=a,r=[],s=c,t=c&&c[0]&&m.isXML(c[0]);while(a&&c.length){for(h in o.filter)if((f=o.leftMatch[h].exec(a))!=null&&f[2]){k=o.filter[h],l=f[1],g=!1,f.splice(1,1);if(l.substr(l.length-1)==="\\")continue;s===r&&(r=[]);if(o.preFilter[h]){f=o.preFilter[h](f,s,d,r,e,t);if(!f)g=i=!0;else if(f===!0)continue}if(f)for(n=0;(j=s[n])!=null;n++)j&&(i=k(j,f,n,s),p=e^i,d&&i!=null?p?g=!0:s[n]=!1:p&&(r.push(j),g=!0));if(i!==b){d||(s=r),a=a.replace(o.match[h],"");if(!g)return[];break}}if(a===q)if(g==null)m.error(a);else break;q=a}return s},m.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)};var n=m.getText=function(a){var b,c,d=a.nodeType,e="";if(d){if(d===1||d===9||d===11){if(typeof a.textContent=="string")return a.textContent;if(typeof a.innerText=="string")return a.innerText.replace(k,"");for(a=a.firstChild;a;a=a.nextSibling)e+=n(a)}else if(d===3||d===4)return a.nodeValue}else for(b=0;c=a[b];b++)c.nodeType!==8&&(e+=n(c));return e},o=m.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!l.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&m.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&m.filter(b,a,!0)}},"":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("parentNode",b,f,a,d,c)},"~":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("previousSibling",b,f,a,d,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(j,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}m.error(e)},CHILD:function(a,b){var c,e,f,g,h,i,j,k=b[1],l=a;switch(k){case"only":case"first":while(l=l.previousSibling)if(l.nodeType===1)return!1;if(k==="first")return!0;l=a;case"last":while(l=l.nextSibling)if(l.nodeType===1)return!1;return!0;case"nth":c=b[2],e=b[3];if(c===1&&e===0)return!0;f=b[0],g=a.parentNode;if(g&&(g[d]!==f||!a.nodeIndex)){i=0;for(l=g.firstChild;l;l=l.nextSibling)l.nodeType===1&&(l.nodeIndex=++i);g[d]=f}j=a.nodeIndex-e;return c===0?j===0:j%c===0&&j/c>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));o.match.globalPOS=p;var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c<e;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var u,v;c.documentElement.compareDocumentPosition?u=function(a,b){if(a===b){h=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(u=function(a,b){if(a===b){h=!0;return 0}if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],g=a.parentNode,i=b.parentNode,j=g;if(g===i)return v(a,b);if(!g)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return v(e[k],f[k]);return k===c?v(a,f[k],-1):v(e[k],b,1)},v=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h<i;h++)m(a,g[h],e,c);return m.filter(f,e)};m.attr=f.attr,m.selectors.attrMap={},f.find=m,f.expr=m.selectors,f.expr[":"]=f.expr.filters,f.unique=m.uniqueSort,f.text=m.getText,f.isXMLDoc=m.isXML,f.contains=m.contains}();var L=/Until$/,M=/^(?:parents|prevUntil|prevAll)/,N=/,/,O=/^.[^:#\[\.,]*$/,P=Array.prototype.slice,Q=f.expr.match.globalPOS,R={children:!0,contents:!0,next:!0,prev:!0};f.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return f(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(f.contains(b[c],this))return!0});var e=this.pushStack("","find",a),g,h,i;for(c=0,d=this.length;c<d;c++){g=e.length,f.find(a,this[c],e);if(c>0)for(h=g;h<e.length;h++)for(i=0;i<g;i++)if(e[i]===e[h]){e.splice(h--,1);break}}return e},has:function(a){var b=f(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(f.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(T(this,a,!1),"not",a)},filter:function(a){return this.pushStack(T(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?Q.test(a)?f(a,this.context).index(this[0])>=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d<a.length;d++)f(g).is(a[d])&&c.push({selector:a[d],elem:g,level:h});g=g.parentNode,h++}return c}var i=Q.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){g=this[d];while(g){if(i?i.index(g)>-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/<tbody/i,_=/<|&#?\w+;/,ba=/<(?:script|style)/i,bb=/<(?:script|object|embed|option|style)/i,bc=new RegExp("<(?:"+V+")[\\s/>]","i"),bd=/checked\s*(?:[^=]|=\s*.checked.)/i,be=/\/(java|ecma)script/i,bf=/^\s*<!(?:\[CDATA\[|\-\-)/,bg={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,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div<div>","</div>"]),f.fn.extend({text:function(a){return f.access(this,function(a){return a===b?f.text(this):this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f
.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){return f.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return c.nodeType===1?c.innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1></$2>");try{for(;d<e;d++)c=this[d]||{},c.nodeType===1&&(f.cleanData(c.getElementsByTagName("*")),c.innerHTML=a);c=0}catch(g){}}c&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!="string"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j=="string"&&bd.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(function(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bi(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,function(a,b){b.src?f.ajax({type:"GET",global:!1,url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bf,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)})}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i,j=a[0];b&&b[0]&&(i=b[0].ownerDocument||b[0]),i.createDocumentFragment||(i=c),a.length===1&&typeof j=="string"&&j.length<512&&i===c&&j.charAt(0)==="<"&&!bb.test(j)&&(f.support.checkClone||!bd.test(j))&&(f.support.html5Clone||!bc.test(j))&&(g=!0,h=f.fragments[j],h&&h!==1&&(e=h)),e||(e=i.createDocumentFragment(),f.clean(a,i,e,d)),g&&(f.fragments[j]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||f.isXMLDoc(a)||!bc.test("<"+a.nodeName+">")?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g,h,i,j=[];b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);for(var k=0,l;(l=a[k])!=null;k++){typeof l=="number"&&(l+="");if(!l)continue;if(typeof l=="string")if(!_.test(l))l=b.createTextNode(l);else{l=l.replace(Y,"<$1></$2>");var m=(Z.exec(l)||["",""])[1].toLowerCase(),n=bg[m]||bg._default,o=n[0],p=b.createElement("div"),q=bh.childNodes,r;b===c?bh.appendChild(p):U(b).appendChild(p),p.innerHTML=n[1]+l+n[2];while(o--)p=p.lastChild;if(!f.support.tbody){var s=$.test(l),t=m==="table"&&!s?p.firstChild&&p.firstChild.childNodes:n[1]==="<table>"&&!s?p.childNodes:[];for(i=t.length-1;i>=0;--i)f.nodeName(t[i],"tbody")&&!t[i].childNodes.length&&t[i].parentNode.removeChild(t[i])}!f.support.leadingWhitespace&&X.test(l)&&p.insertBefore(b.createTextNode(X.exec(l)[0]),p.firstChild),l=p.childNodes,p&&(p.parentNode.removeChild(p),q.length>0&&(r=q[q.length-1],r&&r.parentNode&&r.parentNode.removeChild(r)))}var u;if(!f.support.appendChecked)if(l[0]&&typeof (u=l.length)=="number")for(i=0;i<u;i++)bn(l[i]);else bn(l);l.nodeType?j.push(l):j=f.merge(j,l)}if(d){g=function(a){return!a.type||be.test(a.type)};for(k=0;j[k];k++){h=j[k];if(e&&f.nodeName(h,"script")&&(!h.type||be.test(h.type)))e.push(h.parentNode?h.parentNode.removeChild(h):h);else{if(h.nodeType===1){var v=f.grep(h.getElementsByTagName("script"),g);j.splice.apply(j,[k+1,0].concat(v))}d.appendChild(h)}}}return j},cleanData:function(a){var b,c,d=f.cache,e=f.event.special,g=f.support.deleteExpando;for(var h=0,i;(i=a[h])!=null;h++){if(i.nodeName&&f.noData[i.nodeName.toLowerCase()])continue;c=i[f.expando];if(c){b=d[c];if(b&&b.events){for(var j in b.events)e[j]?f.event.remove(i,j):f.removeEvent(i,j,b.handle);b.handle&&(b.handle.elem=null)}g?delete i[f.expando]:i.removeAttribute&&i.removeAttribute(f.expando),delete d[c]}}}});var bp=/alpha\([^)]*\)/i,bq=/opacity=([^)]*)/,br=/([A-Z]|^ms)/g,bs=/^[\-+]?(?:\d*\.)?\d+$/i,bt=/^-?(?:\d*\.)?\d+(?!px)[^\d\s]+$/i,bu=/^([\-+])=([\-+.\de]+)/,bv=/^margin/,bw={position:"absolute",visibility:"hidden",display:"block"},bx=["Top","Right","Bottom","Left"],by,bz,bA;f.fn.css=function(a,c){return f.access(this,function(a,c,d){return d!==b?f.style(a,c,d):f.css(a,c)},a,c,arguments.length>1)},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=by(a,"opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d,h==="string"&&(g=bu.exec(d))&&(d=+(g[1]+1)*+g[2]+parseFloat(f.css(a,c)),h="number");if(d==null||h==="number"&&isNaN(d))return;h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(by)return by(a,c)},swap:function(a,b,c){var d={},e,f;for(f in b)d[f]=a.style[f],a.style[f]=b[f];e=c.call(a);for(f in b)a.style[f]=d[f];return e}}),f.curCSS=f.css,c.defaultView&&c.defaultView.getComputedStyle&&(bz=function(a,b){var c,d,e,g,h=a.style;b=b.replace(br,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b))),!f.support.pixelMargin&&e&&bv.test(b)&&bt.test(c)&&(g=h.width,h.width=c,c=e.width,h.width=g);return c}),c.documentElement.currentStyle&&(bA=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f==null&&g&&(e=g[b])&&(f=e),bt.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),by=bz||bA,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){if(c)return a.offsetWidth!==0?bB(a,b,d):f.swap(a,bw,function(){return bB(a,b,d)})},set:function(a,b){return bs.test(b)?b+"px":b}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bq.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bp,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bp.test(g)?g.replace(bp,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){return f.swap(a,{display:"inline-block"},function(){return b?by(a,"margin-right"):a.style.marginRight})}})}),f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)}),f.each({margin:"",padding:"",border:"Width"},function(a,b){f.cssHooks[a+b]={expand:function(c){var d,e=typeof c=="string"?c.split(" "):[c],f={};for(d=0;d<4;d++)f[a+bx[d]+b]=e[d]||e[d-2]||e[0];return f}}});var bC=/%20/g,bD=/\[\]$/,bE=/\r?\n/g,bF=/#.*$/,bG=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bH=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bI=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bJ=/^(?:GET|HEAD)$/,bK=/^\/\//,bL=/\?/,bM=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bN=/^(?:select|textarea)/i,bO=/\s+/,bP=/([?&])_=[^&]*/,bQ=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bR=f.fn.load,bS={},bT={},bU,bV,bW=["*/"]+["*"];try{bU=e.href}catch(bX){bU=c.createElement("a"),bU.href="",bU=bU.href}bV=bQ.exec(bU.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bR)return bR.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("<div>").append(c.replace(bM,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bN.test(this.nodeName)||bH.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bE,"\r\n")}}):{name:b.name,value:c.replace(bE,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b$(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b$(a,b);return a},ajaxSettings:{url:bU,isLocal:bI.test(bV[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","*":bW},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bY(bS),ajaxTransport:bY(bT),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?ca(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cb(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bG.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bF,"").replace(bK,bV[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bO),d.crossDomain==null&&(r=bQ.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bV[1]&&r[2]==bV[2]&&(r[3]||(r[1]==="http:"?80:443))==(bV[3]||(bV[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),bZ(bS,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bJ.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bL.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bP,"$1_="+x);d.url=y+(y===d.url?(bL.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bW+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=bZ(bT,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)b_(g,a[g],c,e);return d.join("&").replace(bC,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cc=f.now(),cd=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cc++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=typeof b.data=="string"&&/^application\/x\-www\-form\-urlencoded/.test(b.contentType);if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(cd.test(b.url)||e&&cd.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(cd,l),b.url===j&&(e&&(k=k.replace(cd,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var ce=a.ActiveXObject?function(){for(var a in cg)cg[a](0,1)}:!1,cf=0,cg;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ch()||ci()}:ch,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,ce&&delete cg[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n);try{m.text=h.responseText}catch(a){}try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cf,ce&&(cg||(cg={},f(a).unload(ce)),cg[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cj={},ck,cl,cm=/^(?:toggle|show|hide)$/,cn=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,co,cp=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cq;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(ct("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)d=this[g],d.style&&(e=d.style.display,!f._data(d,"olddisplay")&&e==="none"&&(e=d.style.display=""),(e===""&&f.css(d,"display")==="none"||!f.contains(d.ownerDocument.documentElement,d))&&f._data(d,"olddisplay",cu(d.nodeName)));for(g=0;g<h;g++){d=this[g];if(d.style){e=d.style.display;if(e===""||e==="none")d.style.display=f._data(d,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(ct("hide",3),a,b,c);var d,e,g=0,h=this.length;for(;g<h;g++)d=this[g],d.style&&(e=f.css(d,"display"),e!=="none"&&!f._data(d,"olddisplay")&&f._data(d,"olddisplay",e));for(g=0;g<h;g++)this[g].style&&(this[g].style.display="none");return this},_toggle:f.fn.toggle,toggle:function(a,b,c){var d=typeof a=="boolean";f.isFunction(a)&&f.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:f(this).is(":hidden");f(this)[b?"show":"hide"]()}):this.animate(ct("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){function g(){e.queue===!1&&f._mark(this);var b=f.extend({},e),c=this.nodeType===1,d=c&&f(this).is(":hidden"),g,h,i,j,k,l,m,n,o,p,q;b.animatedProperties={};for(i in a){g=f.camelCase(i),i!==g&&(a[g]=a[i],delete a[i]);if((k=f.cssHooks[g])&&"expand"in k){l=k.expand(a[g]),delete a[g];for(i in l)i in a||(a[i]=l[i])}}for(g in a){h=a[g],f.isArray(h)?(b.animatedProperties[g]=h[1],h=a[g]=h[0]):b.animatedProperties[g]=b.specialEasing&&b.specialEasing[g]||b.easing||"swing";if(h==="hide"&&d||h==="show"&&!d)return b.complete.call(this);c&&(g==="height"||g==="width")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],f.css(this,"display")==="inline"&&f.css(this,"float")==="none"&&(!f.support.inlineBlockNeedsLayout||cu(this.nodeName)==="inline"?this.style.display="inline-block":this.style.zoom=1))}b.overflow!=null&&(this.style.overflow="hidden");for(i in a)j=new f.fx(this,b,i),h=a[i],cm.test(h)?(q=f._data(this,"toggle"+i)||(h==="toggle"?d?"show":"hide":0),q?(f._data(this,"toggle"+i,q==="show"?"hide":"show"),j[q]()):j[h]()):(m=cn.exec(h),n=j.cur(),m?(o=parseFloat(m[2]),p=m[3]||(f.cssNumber[i]?"":"px"),p!=="px"&&(f.style(this,i,(o||1)+p),n=(o||1)/j.cur()*n,f.style(this,i,n+p)),m[1]&&(o=(m[1]==="-="?-1:1)*o+n),j.custom(n,o,p)):j.custom(n,h,""));return!0}var e=f.speed(b,c,d);if(f.isEmptyObject(a))return this.each(e.complete,[!1]);a=f.extend({},a);return e.queue===!1?this.each(g):this.queue(e.queue,g)},stop:function(a,c,d){typeof a!="string"&&(d=c,c=a,a=b),c&&a!==!1&&this.queue(a||"fx",[]);return this.each(function(){function h(a,b,c){var e=b[c];f.removeData(a,c,!0),e.stop(d)}var b,c=!1,e=f.timers,g=f._data(this);d||f._unmark(!0,this);if(a==null)for(b in g)g[b]&&g[b].stop&&b.indexOf(".run")===b.length-4&&h(this,g,b);else g[b=a+".run"]&&g[b].stop&&h(this,g,b);for(b=e.length;b--;)e[b].elem===this&&(a==null||e[b].queue===a)&&(d?e[b](!0):e[b].saveState(),c=!0,e.splice(b,1));(!d||!c)&&f.dequeue(this,a)})}}),f.each({slideDown:ct("show",1),slideUp:ct("hide",1),slideToggle:ct("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){f.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),f.extend({speed:function(a,b,c){var d=a&&typeof a=="object"?f.extend({},a):{complete:c||!c&&b||f.isFunction(a)&&a,duration:a,easing:c&&b||b&&!f.isFunction(b)&&b};d.duration=f.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in f.fx.speeds?f.fx.speeds[d.duration]:f.fx.speeds._default;if(d.queue==null||d.queue===!0)d.queue="fx";d.old=d.complete,d.complete=function(a){f.isFunction(d.old)&&d.old.call(this),d.queue?f.dequeue(this,d.queue):a!==!1&&f._unmark(this)};return d},easing:{linear:function(a){return a},swing:function(a){return-Math.cos(a*Math.PI)/2+.5}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig=b.orig||{}}}),f.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(f.fx.step[this.prop]||f.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=f.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,c,d){function h(a){return e.step(a)}var e=this,g=f.fx;this.startTime=cq||cr(),this.end=c,this.now=this.start=a,this.pos=this.state=0,this.unit=d||this.unit||(f.cssNumber[this.prop]?"":"px"),h.queue=this.options.queue,h.elem=this.elem,h.saveState=function(){f._data(e.elem,"fxshow"+e.prop)===b&&(e.options.hide?f._data(e.elem,"fxshow"+e.prop,e.start):e.options.show&&f._data(e.elem,"fxshow"+e.prop,e.end))},h()&&f.timers.push(h)&&!co&&(co=setInterval(g.tick,g.interval))},show:function(){var a=f._data(this.elem,"fxshow"+this.prop);this.options.orig[this.prop]=a||f.style(this.elem,this.prop),this.options.show=!0,a!==b?this.custom(this.cur(),a):this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),f(this.elem).show()},hide:function(){this.options.orig[this.prop]=f._data(this.elem,"fxshow"+this.prop)||f.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b,c,d,e=cq||cr(),g=!0,h=this.elem,i=this.options;if(a||e>=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c<b.length;c++)a=b[c],!a()&&b[c]===a&&b.splice(c--,1);b.length||f.fx.stop()},interval:13,stop:function(){clearInterval(co),co=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){f.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=a.now+a.unit:a.elem[a.prop]=a.now}}}),f.each(cp.concat.apply([],cp),function(a,b){b.indexOf("margin")&&(f.fx.step[b]=function(a){f.style(a.elem,b,Math.max(0,a.now)+a.unit)})}),f.expr&&f.expr.filters&&(f.expr.filters.animated=function(a){return f.grep(f.timers,function(b){return a===b.elem}).length});var cv,cw=/^t(?:able|d|h)$/i,cx=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?cv=function(a,b,c,d){try{d=a.getBoundingClientRect()}catch(e){}if(!d||!f.contains(c,a))return d?{top:d.top,left:d.left}:{top:0,left:0};var g=b.body,h=cy(b),i=c.clientTop||g.clientTop||0,j=c.clientLeft||g.clientLeft||0,k=h.pageYOffset||f.support.boxModel&&c.scrollTop||g.scrollTop,l=h.pageXOffset||f.support.boxModel&&c.scrollLeft||g.scrollLeft,m=d.top+k-i,n=d.left+l-j;return{top:m,left:n}}:cv=function(a,b,c){var d,e=a.offsetParent,g=a,h=b.body,i=b.defaultView,j=i?i.getComputedStyle(a,null):a.currentStyle,k=a.offsetTop,l=a.offsetLeft;while((a=a.parentNode)&&a!==h&&a!==c){if(f.support.fixedPosition&&j.position==="fixed")break;d=i?i.getComputedStyle(a,null):a.currentStyle,k-=a.scrollTop,l-=a.scrollLeft,a===e&&(k+=a.offsetTop,l+=a.offsetLeft,f.support.doesNotAddBorder&&(!f.support.doesAddBorderForTableAndCells||!cw.test(a.nodeName))&&(k+=parseFloat(d.borderTopWidth)||0,l+=parseFloat(d.borderLeftWidth)||0),g=e,e=a.offsetParent),f.support.subtractsBorderForOverflowNotVisible&&d.overflow!=="visible"&&(k+=parseFloat(d.borderTopWidth)||0,l+=parseFloat(d.borderLeftWidth)||0),j=d}if(j.position==="relative"||j.position==="static")k+=h.offsetTop,l+=h.offsetLeft;f.support.fixedPosition&&j.position==="fixed"&&(k+=Math.max(c.scrollTop,h.scrollTop),l+=Math.max(c.scrollLeft,h.scrollLeft));return{top:k,left:l}},f.fn.offset=function(a){if(arguments.length)return a===b?this:this.each(function(b){f.offset.setOffset(this,a,b)});var c=this[0],d=c&&c.ownerDocument;if(!d)return null;if(c===d.body)return f.offset.bodyOffset(c);return cv(c,d,d.documentElement)},f.offset={bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.support.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,c){var d=/Y/.test(c);f.fn[a]=function(e){return f.access(this,function(a,e,g){var h=cy(a);if(g===b)return h?c in h?h[c]:f.support.boxModel&&h.document.documentElement[e]||h.document.body[e]:a[e];h?h.scrollTo(d?f(h).scrollLeft():g,d?g:f(h).scrollTop()):a[e]=g},a,e,arguments.length,null)}}),f.each({Height:"height",Width:"width"},function(a,c){var d="client"+a,e="scroll"+a,g="offset"+a;f.fn["inner"+a]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,c,"padding")):this[c]():null},f.fn["outer"+a]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,c,a?"margin":"border")):this[c]():null},f.fn[c]=function(a){return f.access(this,function(a,c,h){var i,j,k,l;if(f.isWindow(a)){i=a.document,j=i.documentElement[d];return f.support.boxModel&&j||i.body&&i.body[d]||j}if(a.nodeType===9){i=a.documentElement;if(i[d]>=i[e])return i[d];return Math.max(a.body[e],i[e],a.body[g],i[g])}if(h===b){k=f.css(a,c),l=parseFloat(k);return f.isNumeric(l)?l:k}f(a).css(c,h)},c,a,arguments.length,null)}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window); |
src/components/Section.js | dtjv/dtjv.github.io | import React from 'react'
import { Link } from 'gatsby'
import { Container } from './Container'
import { H1 } from './Headings'
export const Section = ({ title, link, children, ...props }) => (
<Container {...props}>
<div className="flex items-baseline justify-between">
<H1>{title}</H1>
{link?.to && (
<Link
to={link.to}
className="text-xl font-bold text-blue-600 no-underline sm:text-2xl hover:text-blue-400"
aria-label={`link to ${link.to}`}
>
<span>{link.text} -></span>
</Link>
)}
</div>
{children}
</Container>
)
|
src/index.js | soyguijarro/magic-web | import React from 'react';
import ReactDOM from 'react-dom';
import { Router, browserHistory } from 'react-router';
import routes from './routes';
import './styles/index.css';
const router = (
<Router history={browserHistory}>
{routes}
</Router>
);
ReactDOM.render(
router,
document.getElementById('root')
);
|
packages/react-router/modules/withRouter.js | justjavac/react-router-CN | import React from 'react'
import Route from './Route'
/**
* A public higher-order component to access the imperative API
*/
const withRouter = (Component) => {
const C = (props) => (
<Route render={routeComponentProps => (
<Component {...props} {...routeComponentProps}/>
)}/>
)
C.displayName = `withRouter(${Component.displayName || Component.name})`
return C
}
export default withRouter
|
ajax/libs/radium/0.18.4/radium.min.js | nolsherry/cdnjs | !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.Radium=t(require("react")):e.Radium=t(e.React)}(this,function(e){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.i=function(e){return e},t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=55)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r){return r?[e,t]:e},e.exports=t.default},function(t,r){t.exports=e},function(e,t,r){"use strict";function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var r=arguments.length<=2||void 0===arguments[2]?function(e,t){return e+t}:arguments[2];return n({},e,["-webkit-","-moz-",""].map(function(e){return r(e,t)}))},e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return Array.isArray(e)&&(e=e.join(",")),null!==e.match(/-webkit-|-moz-|-ms-/)},e.exports=t.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){return Object.keys(e).map(function(t){return t+": "+e[t]+";"}).join("\n")}function i(e,t,r){if(!t)return"";var n=(0,c.default)(t,function(e,t){return(0,s.default)(t,e)}),i=(0,d.getPrefixedStyle)(n,r);return e+"{"+o((0,l.default)(i))+"}"}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;var a=r(15),s=n(a),u=r(53),l=n(u),f=r(18),c=n(f),d=r(6);e.exports=t.default},function(e,t,r){"use strict";(function(e){function n(e){return Object.keys(e).reduce(function(t,r){var n=e[r];return Array.isArray(n)?n=n.join(";"+r+":"):n&&"object"===(void 0===n?"undefined":s(n))&&"function"==typeof n.toString&&(n=n.toString()),t[r]=n,t},{})}function o(t){var r=t||e&&e.navigator&&e.navigator.userAgent;return c&&r===f||(c="all"===r?{prefix:l.default.prefixAll,prefixedKeyframes:"keyframes"}:new l.default({userAgent:r}),f=r),c}function i(e){return o(e).prefixedKeyframes}function a(e,t){var r=n(e);return o(t).prefix(r)}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};t.getPrefixedKeyframes=i,t.getPrefixedStyle=a;var u=r(25),l=function(e){return e&&e.__esModule?e:{default:e}}(u),f=void 0,c=void 0}).call(t,r(51))},function(e,t,r){"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 o=function(){function e(t){n(this,e),this._userAgent=t,this._listeners=[],this._cssSet={}}return e.prototype.subscribe=function(e){var t=this;return this._listeners.indexOf(e)===-1&&this._listeners.push(e),{remove:function(){var r=t._listeners.indexOf(e);r>-1&&t._listeners.splice(r,1)}}},e.prototype.addCSS=function(e){var t=this;return this._cssSet[e]||(this._cssSet[e]=!0,this._emitChange()),{remove:function(){delete t._cssSet[e],t._emitChange()}}},e.prototype.getCSS=function(){return Object.keys(this._cssSet).join("\n")},e.prototype._emitChange=function(){this._listeners.forEach(function(e){return e()})},e}();t.default=o,e.exports=t.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function 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)}function s(e,t){Object.getOwnPropertyNames(e).forEach(function(r){if(b.indexOf(r)<0&&!t.hasOwnProperty(r)){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n)}})}function u(e){return!(e.render||e.prototype&&e.prototype.render)}function l(e){var t,r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("function"!=typeof e){var d=f({},n,e);return function(e){return l(e,d)}}var m=e,b=m;u(b)&&(b=function(e){function t(){return o(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.render=function(){return m(this.props,this.context)},t}(c.Component),b.displayName=m.displayName||m.name);var v=(r=t=function(e){function t(){o(this,t);var r=i(this,e.apply(this,arguments));return r.state=r.state||{},r.state._radiumStyleState={},r._radiumIsMounted=!0,r}return a(t,e),t.prototype.componentWillUnmount=function(){e.prototype.componentWillUnmount&&e.prototype.componentWillUnmount.call(this),this._radiumIsMounted=!1,this._radiumMouseUpListener&&this._radiumMouseUpListener.remove(),this._radiumMediaQueryListenersByQuery&&Object.keys(this._radiumMediaQueryListenersByQuery).forEach(function(e){this._radiumMediaQueryListenersByQuery[e].remove()},this)},t.prototype.getChildContext=function(){var t=e.prototype.getChildContext?e.prototype.getChildContext.call(this):{};if(!this.props.radiumConfig)return t;var r=f({},t);return this.props.radiumConfig&&(r._radiumConfig=this.props.radiumConfig),r},t.prototype.render=function(){var t=e.prototype.render.call(this),r=this.props.radiumConfig||this.context._radiumConfig||n;return n&&r!==n&&(r=f({},n,r)),(0,y.default)(this,t,r)},t}(b),t._isRadiumEnhanced=!0,r);return s(m,v),v.propTypes&&v.propTypes.style&&(v.propTypes=f({},v.propTypes,{style:c.PropTypes.oneOfType([c.PropTypes.array,c.PropTypes.object])})),v.displayName=m.displayName||m.name||"Component",v.contextTypes=f({},v.contextTypes,{_radiumConfig:c.PropTypes.object,_radiumStyleKeeper:c.PropTypes.instanceOf(p.default)}),v.childContextTypes=f({},v.childContextTypes,{_radiumConfig:c.PropTypes.object,_radiumStyleKeeper:c.PropTypes.instanceOf(p.default)}),v}Object.defineProperty(t,"__esModule",{value:!0});var f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};t.default=l;var c=r(1),d=r(7),p=n(d),m=r(11),y=n(m),b=["arguments","callee","caller","length","name","prototype","type"];e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(16),o=function(e){return e&&e.__esModule?e:{default:e}}(n),i=function(e,t,r){var n=(0,o.default)(t);return!!e&&!!e._radiumStyleState&&!!e._radiumStyleState[n]&&e._radiumStyleState[n][r]};t.default=i,e.exports=t.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=r(57),i=n(o),a=r(58),s=n(a),u=r(59),l=n(u),f=r(61),c=n(f),d=r(62),p=n(d),m=r(63),y=n(m),b=r(64),v=n(b),h=r(65),g=n(h);t.default={checkProps:i.default,keyframes:s.default,mergeStyleArray:l.default,prefix:c.default,removeNestedStyles:p.default,resolveInteractionStyles:y.default,resolveMediaQueries:v.default,visited:g.default},e.exports=t.default},function(e,t,r){"use strict";function n(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 r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},i="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},a=r(52),s=n(a),u=r(5),l=n(u),f=r(9),c=n(f),d=r(16),p=n(d),m=r(17),y=n(m),b=r(56),v=r(10),h=n(v),g=r(24),x=n(g),k=r(1),S=n(k),_={plugins:[h.default.mergeStyleArray,h.default.checkProps,h.default.resolveMediaQueries,h.default.resolveInteractionStyles,h.default.keyframes,h.default.visited,h.default.removeNestedStyles,h.default.prefix,h.default.checkProps]},w={},O=null,j=function(e){return e.type&&!e.type._isRadiumEnhanced},P=function(e){var t=e.children,r=e.component,n=e.config,o=e.existingKeyMap;if(!t)return t;var a=void 0===t?"undefined":i(t);if("string"===a||"number"===a)return t;if("function"===a)return function(){var e=t.apply(this,arguments);return S.default.isValidElement(e)?O(r,e,n,o,!0):e};if(1===S.default.Children.count(t)&&t.type){var s=S.default.Children.only(t);return O(r,s,n,o,!0)}return S.default.Children.map(t,function(e){return S.default.isValidElement(e)?O(r,e,n,o,!0):e})},C=function(e){var t=e.component,r=e.config,n=e.existingKeyMap,i=e.props,a=i;return Object.keys(i).forEach(function(e){if("children"!==e){var s=i[e];S.default.isValidElement(s)&&(a=o({},a),a[e]=O(t,s,r,n,!0))}}),a},M=function(e){var t=e.componentName,r=e.existingKeyMap,n=e.renderedElement,o="string"==typeof n.ref?n.ref:n.key,i=(0,p.default)(o),a=!1;return function(){if(a)return i;if(a=!0,r[i]){var e=void 0;throw"string"==typeof n.type?e=n.type:n.type.constructor&&(e=n.type.constructor.displayName||n.type.constructor.name),new Error("Radium requires each element with interactive styles to have a unique key, set using either the ref or key prop. "+(o?'Key "'+o+'" is a duplicate.':"Multiple elements have no key specified.")+' Component: "'+t+'". '+(e?'Element: "'+e+'".':""))}return r[i]=!0,i}},E=function(e,t,r,n){if(e._radiumIsMounted){var i=e._lastRadiumState||e.state&&e.state._radiumStyleState||{},a={_radiumStyleState:o({},i)};a._radiumStyleState[t]=o({},a._radiumStyleState[t]),a._radiumStyleState[t][r]=n,e._lastRadiumState=a._radiumStyleState,e.setState(a)}},B=function(e){var t=e.component,r=e.config,n=e.existingKeyMap,i=e.props,a=e.renderedElement;if(!S.default.isValidElement(a)||"string"!=typeof a.type||!i.style)return i;var u=i,f=r.plugins||_.plugins,d=t.constructor.displayName||t.constructor.name,p=M({renderedElement:a,existingKeyMap:n,componentName:d}),m=function(e){return t[e]},v=function(e){return w[e]},h=function(e,r){return(0,c.default)(t.state,r||p(),e)},g=function(e,r,n){return E(t,n||p(),e,r)},k=function(e){var r=t._radiumStyleKeeper||t.context._radiumStyleKeeper;if(!r){if(D)return{remove:function(){}};throw new Error("To use plugins requiring `addCSS` (e.g. keyframes, media queries), please wrap your application in the StyleRoot component. Component name: `"+d+"`.")}return r.addCSS(e)},O=i.style;return f.forEach(function(e){var n=e({ExecutionEnvironment:x.default,addCSS:k,appendImportantToEachValue:s.default,componentName:d,config:r,cssRuleSetToString:l.default,getComponentField:m,getGlobalState:v,getState:h,hash:y.default,mergeStyles:b.mergeStyles,props:u,setState:g,isNestedStyle:b.isNestedStyle,style:O})||{};O=n.style||O,u=n.props&&Object.keys(n.props).length?o({},u,n.props):u;var i=n.componentFields||{};Object.keys(i).forEach(function(e){t[e]=i[e]});var a=n.globalState||{};Object.keys(a).forEach(function(e){w[e]=a[e]})}),O!==i.style&&(u=o({},u,{style:O})),u},T=function(e,t,r){return"string"==typeof e.type&&(t=o({},t,{"data-radium":!0})),S.default.cloneElement(e,t,r)};O=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:_,n=arguments[3],o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(n=n||{},!t||t.props&&t.props["data-radium"]||o&&!j(t))return t;var i=P({children:t.props.children,component:e,config:r,existingKeyMap:n}),a=C({component:e,config:r,existingKeyMap:n,props:t.props});return a=B({component:e,config:r,existingKeyMap:n,props:a,renderedElement:t}),i===t.props.children&&a===t.props?t:T(t,a!==t.props?a:{},i)};var D=!1;t.default=O,e.exports=t.default},function(e,t,r){"use strict";function n(e){return e in a?a[e]:a[e]=e.replace(o,"-$&").toLowerCase().replace(i,"-ms-")}var o=/[A-Z]/g,i=/^ms-/,a={};e.exports=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={Webkit:{transform:!0,transformOrigin:!0,transformOriginX:!0,transformOriginY:!0,backfaceVisibility:!0,perspective:!0,perspectiveOrigin:!0,transformStyle:!0,transformOriginZ:!0,animation:!0,animationDelay:!0,animationDirection:!0,animationFillMode:!0,animationDuration:!0,animationIterationCount:!0,animationName:!0,animationPlayState:!0,animationTimingFunction:!0,appearance:!0,userSelect:!0,fontKerning:!0,textEmphasisPosition:!0,textEmphasis:!0,textEmphasisStyle:!0,textEmphasisColor:!0,boxDecorationBreak:!0,clipPath:!0,maskImage:!0,maskMode:!0,maskRepeat:!0,maskPosition:!0,maskClip:!0,maskOrigin:!0,maskSize:!0,maskComposite:!0,mask:!0,maskBorderSource:!0,maskBorderMode:!0,maskBorderSlice:!0,maskBorderWidth:!0,maskBorderOutset:!0,maskBorderRepeat:!0,maskBorder:!0,maskType:!0,textDecorationStyle:!0,textDecorationSkip:!0,textDecorationLine:!0,textDecorationColor:!0,filter:!0,fontFeatureSettings:!0,breakAfter:!0,breakBefore:!0,breakInside:!0,columnCount:!0,columnFill:!0,columnGap:!0,columnRule:!0,columnRuleColor:!0,columnRuleStyle:!0,columnRuleWidth:!0,columns:!0,columnSpan:!0,columnWidth:!0,flex:!0,flexBasis:!0,flexDirection:!0,flexGrow:!0,flexFlow:!0,flexShrink:!0,flexWrap:!0,alignContent:!0,alignItems:!0,alignSelf:!0,justifyContent:!0,order:!0,transition:!0,transitionDelay:!0,transitionDuration:!0,transitionProperty:!0,transitionTimingFunction:!0,backdropFilter:!0,scrollSnapType:!0,scrollSnapPointsX:!0,scrollSnapPointsY:!0,scrollSnapDestination:!0,scrollSnapCoordinate:!0,shapeImageThreshold:!0,shapeImageMargin:!0,shapeImageOutside:!0,hyphens:!0,flowInto:!0,flowFrom:!0,regionFragment:!0,textSizeAdjust:!0},Moz:{appearance:!0,userSelect:!0,boxSizing:!0,textAlignLast:!0,textDecorationStyle:!0,textDecorationSkip:!0,textDecorationLine:!0,textDecorationColor:!0,tabSize:!0,hyphens:!0,fontFeatureSettings:!0,breakAfter:!0,breakBefore:!0,breakInside:!0,columnCount:!0,columnFill:!0,columnGap:!0,columnRule:!0,columnRuleColor:!0,columnRuleStyle:!0,columnRuleWidth:!0,columns:!0,columnSpan:!0,columnWidth:!0},ms:{flex:!0,flexBasis:!1,flexDirection:!0,flexGrow:!1,flexFlow:!0,flexShrink:!1,flexWrap:!0,alignContent:!1,alignItems:!1,alignSelf:!1,justifyContent:!1,order:!1,transform:!0,transformOrigin:!0,transformOriginX:!0,transformOriginY:!0,userSelect:!0,wrapFlow:!0,wrapThrough:!0,wrapMargin:!0,scrollSnapType:!0,scrollSnapPointsX:!0,scrollSnapPointsY:!0,scrollSnapDestination:!0,scrollSnapCoordinate:!0,touchAction:!0,hyphens:!0,flowInto:!0,flowFrom:!0,breakBefore:!0,breakAfter:!0,breakInside:!0,regionFragment:!0,gridTemplateColumns:!0,gridTemplateRows:!0,gridTemplateAreas:!0,gridTemplate:!0,gridAutoColumns:!0,gridAutoRows:!0,gridAutoFlow:!0,grid:!0,gridRowStart:!0,gridColumnStart:!0,gridRowEnd:!0,gridRow:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnGap:!0,gridRowGap:!0,gridArea:!0,gridGap:!0,textSizeAdjust:!0}},e.exports=t.default},function(e,t,r){"use strict";function n(e){return Object.keys(e).sort(function(e,t){return(0,i.default)(e)&&!(0,i.default)(t)?-1:!(0,i.default)(e)&&(0,i.default)(t)?1:0}).reduce(function(t,r){return t[r]=e[r],t},{})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n;var o=r(49),i=function(e){return e&&e.__esModule?e:{default:e}}(o);e.exports=t.default},function(e,t,r){"use strict";function n(e,t){return o[e]||"number"!=typeof t||0===t?t:t+"px"}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n;var o={animationIterationCount:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridColumn:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,stopOpacity:!0,strokeDashoffset:!0,strokeOpacity:!0,strokeWidth:!0};e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){return null===e||void 0===e?"main":e.toString()};t.default=n,e.exports=t.default},function(e,t,r){"use strict";function n(e){if(!e)return"";for(var t=5381,r=e.length-1;r;)t=33*t^e.charCodeAt(r),r-=1;return(t>>>0).toString(16)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n,e.exports=t.default},function(e,t,r){"use strict";function n(e,t){return Object.keys(e).reduce(function(r,n){return r[n]=t(e[n],n),r},{})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n,e.exports=t.default},function(e,t){(function(t){e.exports=t}).call(t,{})},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}function 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)}function u(e){if(!e._radiumStyleKeeper){var t=e.props.radiumConfig&&e.props.radiumConfig.userAgent||e.context._radiumConfig&&e.context._radiumConfig.userAgent;e._radiumStyleKeeper=new m.default(t)}return e._radiumStyleKeeper}Object.defineProperty(t,"__esModule",{value:!0});var l=r(1),f=n(l),c=r(8),d=n(c),p=r(7),m=n(p),y=r(54),b=n(y),v=function(e){function t(){i(this,t);var r=a(this,e.apply(this,arguments));return u(r),r}return s(t,e),t.prototype.getChildContext=function(){return{_radiumStyleKeeper:u(this)}},t.prototype.render=function(){var e=this.props,t=(e.radiumConfig,o(e,["radiumConfig"]));return f.default.createElement("div",t,this.props.children,f.default.createElement(b.default,null))},t}(l.PureComponent);v.contextTypes={_radiumConfig:l.PropTypes.object,_radiumStyleKeeper:l.PropTypes.instanceOf(m.default)},v.childContextTypes={_radiumStyleKeeper:l.PropTypes.instanceOf(m.default)},v=(0,d.default)(v),t.default=v,e.exports=t.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function 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,u,l="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},f=r(5),c=n(f),d=r(1),p=n(d),m=(u=s=function(e){function t(){return o(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype._buildStyles=function(e){var t=this,r=this.props.radiumConfig&&this.props.radiumConfig.userAgent||this.context&&this.context._radiumConfig&&this.context._radiumConfig.userAgent,n=this.props.scopeSelector,o=Object.keys(e).reduce(function(t,r){return"object"!==l(e[r])&&(t[r]=e[r]),t},{});return(Object.keys(o).length?(0,c.default)(n||"",o,r):"")+Object.keys(e).reduce(function(o,i){var a=e[i];if("mediaQueries"===i)o+=t._buildMediaQueryString(a);else if("object"===l(e[i])){var s=n?i.split(",").map(function(e){return n+" "+e.trim()}).join(","):i;o+=(0,c.default)(s,a,r)}return o},"")},t.prototype._buildMediaQueryString=function(e){var t=this,r="";return Object.keys(e).forEach(function(n){r+="@media "+n+"{"+t._buildStyles(e[n])+"}"}),r},t.prototype.render=function(){if(!this.props.rules)return null;var e=this._buildStyles(this.props.rules);return p.default.createElement("style",{dangerouslySetInnerHTML:{__html:e}})},t}(d.PureComponent),s.propTypes={radiumConfig:d.PropTypes.object,rules:d.PropTypes.object,scopeSelector:d.PropTypes.string},s.contextTypes={_radiumConfig:d.PropTypes.object},s.defaultProps={scopeSelector:""},u);t.default=m,e.exports=t.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){return{__radiumKeyframes:!0,__process:function(r){var n=(0,l.getPrefixedKeyframes)(r),o=Object.keys(e).map(function(t){return(0,a.default)(t,e[t],r)}).join("\n"),i=(t?t+"-":"")+"radium-animation-"+(0,u.default)(o);return{css:"@"+n+" "+i+" {\n"+o+"\n}\n",animationName:i}}}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var i=r(5),a=n(i),s=r(17),u=n(s),l=r(6);e.exports=t.default},function(e,t,r){"use strict";/*!
* Bowser - a browser detector
* https://github.com/ded/bowser
* MIT License | (c) Dustin Diaz 2015
*/
!function(t,n,o){void 0!==e&&e.exports?e.exports=o():r(66)("bowser",o)}(0,0,function(){function e(e){function t(t){var r=e.match(t);return r&&r.length>1&&r[1]||""}var r,n=t(/(ipod|iphone|ipad)/i).toLowerCase(),o=/like android/i.test(e),i=!o&&/android/i.test(e),s=/nexus\s*[0-6]\s*/i.test(e),u=!s&&/nexus\s*[0-9]+/i.test(e),l=/CrOS/.test(e),f=/silk/i.test(e),c=/sailfish/i.test(e),d=/tizen/i.test(e),p=/(web|hpw)os/i.test(e),m=/windows phone/i.test(e),y=(/SamsungBrowser/i.test(e),!m&&/windows/i.test(e)),b=!n&&!f&&/macintosh/i.test(e),v=!i&&!c&&!d&&!p&&/linux/i.test(e),h=t(/edge\/(\d+(\.\d+)?)/i),g=t(/version\/(\d+(\.\d+)?)/i),x=/tablet/i.test(e),k=!x&&/[^-]mobi/i.test(e),S=/xbox/i.test(e);/opera/i.test(e)?r={name:"Opera",opera:a,version:g||t(/(?:opera|opr|opios)[\s\/](\d+(\.\d+)?)/i)}:/opr|opios/i.test(e)?r={name:"Opera",opera:a,version:t(/(?:opr|opios)[\s\/](\d+(\.\d+)?)/i)||g}:/SamsungBrowser/i.test(e)?r={name:"Samsung Internet for Android",samsungBrowser:a,version:g||t(/(?:SamsungBrowser)[\s\/](\d+(\.\d+)?)/i)}:/coast/i.test(e)?r={name:"Opera Coast",coast:a,version:g||t(/(?:coast)[\s\/](\d+(\.\d+)?)/i)}:/yabrowser/i.test(e)?r={name:"Yandex Browser",yandexbrowser:a,version:g||t(/(?:yabrowser)[\s\/](\d+(\.\d+)?)/i)}:/ucbrowser/i.test(e)?r={name:"UC Browser",ucbrowser:a,version:t(/(?:ucbrowser)[\s\/](\d+(?:\.\d+)+)/i)}:/mxios/i.test(e)?r={name:"Maxthon",maxthon:a,version:t(/(?:mxios)[\s\/](\d+(?:\.\d+)+)/i)}:/epiphany/i.test(e)?r={name:"Epiphany",epiphany:a,version:t(/(?:epiphany)[\s\/](\d+(?:\.\d+)+)/i)}:/puffin/i.test(e)?r={name:"Puffin",puffin:a,version:t(/(?:puffin)[\s\/](\d+(?:\.\d+)?)/i)}:/sleipnir/i.test(e)?r={name:"Sleipnir",sleipnir:a,version:t(/(?:sleipnir)[\s\/](\d+(?:\.\d+)+)/i)}:/k-meleon/i.test(e)?r={name:"K-Meleon",kMeleon:a,version:t(/(?:k-meleon)[\s\/](\d+(?:\.\d+)+)/i)}:m?(r={name:"Windows Phone",windowsphone:a},h?(r.msedge=a,r.version=h):(r.msie=a,r.version=t(/iemobile\/(\d+(\.\d+)?)/i))):/msie|trident/i.test(e)?r={name:"Internet Explorer",msie:a,version:t(/(?:msie |rv:)(\d+(\.\d+)?)/i)}:l?r={name:"Chrome",chromeos:a,chromeBook:a,chrome:a,version:t(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)}:/chrome.+? edge/i.test(e)?r={name:"Microsoft Edge",msedge:a,version:h}:/vivaldi/i.test(e)?r={name:"Vivaldi",vivaldi:a,version:t(/vivaldi\/(\d+(\.\d+)?)/i)||g}:c?r={name:"Sailfish",sailfish:a,version:t(/sailfish\s?browser\/(\d+(\.\d+)?)/i)}:/seamonkey\//i.test(e)?r={name:"SeaMonkey",seamonkey:a,version:t(/seamonkey\/(\d+(\.\d+)?)/i)}:/firefox|iceweasel|fxios/i.test(e)?(r={name:"Firefox",firefox:a,version:t(/(?:firefox|iceweasel|fxios)[ \/](\d+(\.\d+)?)/i)},/\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(e)&&(r.firefoxos=a)):f?r={name:"Amazon Silk",silk:a,version:t(/silk\/(\d+(\.\d+)?)/i)}:/phantom/i.test(e)?r={name:"PhantomJS",phantom:a,version:t(/phantomjs\/(\d+(\.\d+)?)/i)}:/slimerjs/i.test(e)?r={name:"SlimerJS",slimer:a,version:t(/slimerjs\/(\d+(\.\d+)?)/i)}:/blackberry|\bbb\d+/i.test(e)||/rim\stablet/i.test(e)?r={name:"BlackBerry",blackberry:a,version:g||t(/blackberry[\d]+\/(\d+(\.\d+)?)/i)}:p?(r={name:"WebOS",webos:a,version:g||t(/w(?:eb)?osbrowser\/(\d+(\.\d+)?)/i)},/touchpad\//i.test(e)&&(r.touchpad=a)):/bada/i.test(e)?r={name:"Bada",bada:a,version:t(/dolfin\/(\d+(\.\d+)?)/i)}:d?r={name:"Tizen",tizen:a,version:t(/(?:tizen\s?)?browser\/(\d+(\.\d+)?)/i)||g}:/qupzilla/i.test(e)?r={name:"QupZilla",qupzilla:a,version:t(/(?:qupzilla)[\s\/](\d+(?:\.\d+)+)/i)||g}:/chromium/i.test(e)?r={name:"Chromium",chromium:a,version:t(/(?:chromium)[\s\/](\d+(?:\.\d+)?)/i)||g}:/chrome|crios|crmo/i.test(e)?r={name:"Chrome",chrome:a,version:t(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)}:i?r={name:"Android",version:g}:/safari|applewebkit/i.test(e)?(r={name:"Safari",safari:a},g&&(r.version=g)):n?(r={name:"iphone"==n?"iPhone":"ipad"==n?"iPad":"iPod"},g&&(r.version=g)):r=/googlebot/i.test(e)?{name:"Googlebot",googlebot:a,version:t(/googlebot\/(\d+(\.\d+))/i)||g}:{name:t(/^(.*)\/(.*) /),version:function(t){var r=e.match(t);return r&&r.length>1&&r[2]||""}(/^(.*)\/(.*) /)},!r.msedge&&/(apple)?webkit/i.test(e)?(/(apple)?webkit\/537\.36/i.test(e)?(r.name=r.name||"Blink",r.blink=a):(r.name=r.name||"Webkit",r.webkit=a),!r.version&&g&&(r.version=g)):!r.opera&&/gecko\//i.test(e)&&(r.name=r.name||"Gecko",r.gecko=a,r.version=r.version||t(/gecko\/(\d+(\.\d+)?)/i)),r.windowsphone||r.msedge||!i&&!r.silk?r.windowsphone||r.msedge||!n?b?r.mac=a:S?r.xbox=a:y?r.windows=a:v&&(r.linux=a):(r[n]=a,r.ios=a):r.android=a;var _="";r.windowsphone?_=t(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i):n?(_=t(/os (\d+([_\s]\d+)*) like mac os x/i),_=_.replace(/[_\s]/g,".")):i?_=t(/android[ \/-](\d+(\.\d+)*)/i):r.webos?_=t(/(?:web|hpw)os\/(\d+(\.\d+)*)/i):r.blackberry?_=t(/rim\stablet\sos\s(\d+(\.\d+)*)/i):r.bada?_=t(/bada\/(\d+(\.\d+)*)/i):r.tizen&&(_=t(/tizen[\/\s](\d+(\.\d+)*)/i)),_&&(r.osversion=_);var w=_.split(".")[0];return x||u||"ipad"==n||i&&(3==w||w>=4&&!k)||r.silk?r.tablet=a:(k||"iphone"==n||"ipod"==n||i||s||r.blackberry||r.webos||r.bada)&&(r.mobile=a),r.msedge||r.msie&&r.version>=10||r.yandexbrowser&&r.version>=15||r.vivaldi&&r.version>=1||r.chrome&&r.version>=20||r.samsungBrowser&&r.version>=4||r.firefox&&r.version>=20||r.safari&&r.version>=6||r.opera&&r.version>=10||r.ios&&r.osversion&&r.osversion.split(".")[0]>=6||r.blackberry&&r.version>=10.1||r.chromium&&r.version>=20?r.a=a:r.msie&&r.version<10||r.chrome&&r.version<20||r.firefox&&r.version<20||r.safari&&r.version<6||r.opera&&r.version<10||r.ios&&r.osversion&&r.osversion.split(".")[0]<6||r.chromium&&r.version<20?r.c=a:r.x=a,r}function t(e){return e.split(".").length}function r(e,t){var r,n=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(r=0;r<e.length;r++)n.push(t(e[r]));return n}function n(e){for(var n=Math.max(t(e[0]),t(e[1])),o=r(e,function(e){var o=n-t(e);return e+=new Array(o+1).join(".0"),r(e.split("."),function(e){return new Array(20-e.length).join("0")+e}).reverse()});--n>=0;){if(o[0][n]>o[1][n])return 1;if(o[0][n]!==o[1][n])return-1;if(0===n)return 0}}function o(t,r,o){var i=s;"string"==typeof r&&(o=r,r=void 0),void 0===r&&(r=!1),o&&(i=e(o));var a=""+i.version;for(var u in t)if(t.hasOwnProperty(u)&&i[u]){if("string"!=typeof t[u])throw new Error("Browser version in the minVersion map should be a string: "+u+": "+String(t));return n([a,t[u]])<0}return r}function i(e,t,r){return!o(e,t,r)}var a=!0,s=e("undefined"!=typeof navigator?navigator.userAgent||"":"");return s.test=function(e){for(var t=0;t<e.length;++t){var r=e[t];if("string"==typeof r&&r in s)return!0}return!1},s.isUnsupportedBrowser=o,s.compareVersions=n,s.check=i,s._detect=e,s})},function(e,t,r){"use strict";var n,o="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};/*!
Copyright (c) 2015 Jed Watson.
Based on code that is Copyright 2013-2015, Facebook, Inc.
All rights reserved.
*/
!function(){var i=!("undefined"==typeof window||!window.document||!window.document.createElement),a={canUseDOM:i,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:i&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:i&&!!window.screen};"object"===o(r(19))&&r(19)?void 0!==(n=function(){return a}.call(t,r,t,e))&&(e.exports=n):void 0!==e&&e.exports?e.exports=a:window.ExecutionEnvironment=a}()},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],r=arguments[2],n=arguments[3];Object.keys(t).forEach(function(o){var i=e[o];Array.isArray(i)?[].concat(t[o]).forEach(function(t){e[o].indexOf(t)===-1&&e[o].splice(i.indexOf(r),n?0:1,t)}):e[o]=t[o]})}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),s=r(46),u=n(s),l=r(47),f=n(l),c=r(48),d=n(c),p=r(3),m=n(p),y=r(14),b=n(y),v=r(36),h=n(v),g=r(32),x=n(g),k=r(26),S=n(k),_=r(35),w=n(_),O=r(30),j=n(O),P=r(27),C=n(P),M=r(33),E=n(M),B=r(31),T=n(B),D=r(34),A=n(D),F=r(28),I=n(F),R=r(29),W=n(R),z=[x.default,S.default,w.default,j.default,E.default,T.default,A.default,I.default,W.default,C.default],L=function(){function e(){var t=this,r=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];o(this,e);var n="undefined"!=typeof navigator?navigator.userAgent:void 0;if(this._userAgent=r.userAgent||n,this._keepUnprefixed=r.keepUnprefixed||!1,this._browserInfo=(0,f.default)(this._userAgent),!this._browserInfo||!this._browserInfo.prefix)return this._usePrefixAllFallback=!0,!1;this.cssPrefix=this._browserInfo.prefix.css,this.jsPrefix=this._browserInfo.prefix.inline,this.prefixedKeyframes=(0,d.default)(this._browserInfo);var i=this._browserInfo.browser&&h.default[this._browserInfo.browser];i?(this._requiresPrefix=Object.keys(i).filter(function(e){return i[e]>=t._browserInfo.version}).reduce(function(e,t){return e[t]=!0,e},{}),this._hasPropsRequiringPrefix=Object.keys(this._requiresPrefix).length>0):this._usePrefixAllFallback=!0}return a(e,[{key:"prefix",value:function(e){var t=this;return this._usePrefixAllFallback?(0,u.default)(e):this._hasPropsRequiringPrefix?(Object.keys(e).forEach(function(r){var n=e[r];n instanceof Object&&!Array.isArray(n)?e[r]=t.prefix(n):t._requiresPrefix[r]&&(e[t.jsPrefix+(0,m.default)(r)]=n,t._keepUnprefixed||delete e[r])}),Object.keys(e).forEach(function(r){[].concat(e[r]).forEach(function(n){z.forEach(function(o){i(e,o({property:r,value:n,styles:e,browserInfo:t._browserInfo,prefix:{js:t.jsPrefix,css:t.cssPrefix,keyframes:t.prefixedKeyframes},keepUnprefixed:t._keepUnprefixed,requiresPrefix:t._requiresPrefix}),n,t._keepUnprefixed)})})}),(0,b.default)(e)):e}}],[{key:"prefixAll",value:function(e){return(0,u.default)(e)}}]),e}();t.default=L,e.exports=t.default},function(e,t,r){"use strict";function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e){var t=e.property,r=e.value,o=e.browserInfo,i=o.browser,s=o.version,u=e.prefix.css,l=e.keepUnprefixed;if("string"==typeof r&&r.indexOf("calc(")>-1&&("firefox"===i&&s<15||"chrome"===i&&s<25||"safari"===i&&s<6.1||"ios_saf"===i&&s<7))return n({},t,(0,a.default)(r.replace(/calc\(/g,u+"calc("),r,l))}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var i=r(0),a=function(e){return e&&e.__esModule?e:{default:e}}(i);e.exports=t.default},function(e,t,r){"use strict";function n(e){var t=e.property,r=e.value,n=e.browserInfo,o=n.browser,s=n.version,u=e.prefix.css,l=e.keepUnprefixed;if("display"===t&&a[r]&&("chrome"===o&&s<29&&s>20||("safari"===o||"ios_saf"===o)&&s<9&&s>6||"opera"===o&&(15==s||16==s)))return{display:(0,i.default)(u+r,r,l)}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n;var o=r(0),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a={flex:!0,"inline-flex":!0};e.exports=t.default},function(e,t,r){"use strict";function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e){var t=e.property,r=e.value,o=e.styles,i=e.browserInfo,l=i.browser,f=i.version,c=e.prefix.css,d=e.keepUnprefixed;if((u[t]||"display"===t&&"string"==typeof r&&r.indexOf("flex")>-1)&&("ie_mob"===l||"ie"===l)&&10==f){if(d||Array.isArray(o[t])||delete o[t],"display"===t&&s[r])return{display:(0,a.default)(c+s[r],r,d)};if(u[t])return n({},u[t],s[r]||r)}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var i=r(0),a=function(e){return e&&e.__esModule?e:{default:e}}(i),s={"space-around":"distribute","space-between":"justify","flex-start":"start","flex-end":"end",flex:"flexbox","inline-flex":"inline-flexbox"},u={alignContent:"msFlexLinePack",alignSelf:"msFlexItemAlign",alignItems:"msFlexAlign",justifyContent:"msFlexPack",order:"msFlexOrder",flexGrow:"msFlexPositive",flexShrink:"msFlexNegative",flexBasis:"msPreferredSize"};e.exports=t.default},function(e,t,r){"use strict";function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e){var t=e.property,r=e.value,o=e.styles,i=e.browserInfo,l=i.browser,c=i.version,d=e.prefix.css,p=e.keepUnprefixed;if((f.indexOf(t)>-1||"display"===t&&"string"==typeof r&&r.indexOf("flex")>-1)&&("firefox"===l&&c<22||"chrome"===l&&c<21||("safari"===l||"ios_saf"===l)&&c<=6.1||"android"===l&&c<4.4||"and_uc"===l)){if(p||Array.isArray(o[t])||delete o[t],"flexDirection"===t&&"string"==typeof r)return{WebkitBoxOrient:r.indexOf("column")>-1?"vertical":"horizontal",WebkitBoxDirection:r.indexOf("reverse")>-1?"reverse":"normal"};if("display"===t&&s[r])return{display:(0,a.default)(d+s[r],r,p)};if(u[t])return n({},u[t],s[r]||r)}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var i=r(0),a=function(e){return e&&e.__esModule?e:{default:e}}(i),s={"space-around":"justify","space-between":"justify","flex-start":"start","flex-end":"end","wrap-reverse":"multiple",wrap:"multiple",flex:"box","inline-flex":"inline-box"},u={alignItems:"WebkitBoxAlign",justifyContent:"WebkitBoxPack",flexWrap:"WebkitBoxLines"},l=["alignContent","alignSelf","order","flexGrow","flexShrink","flexBasis","flexDirection"],f=Object.keys(u).concat(l);e.exports=t.default},function(e,t,r){"use strict";function n(e){var t=e.property,r=e.value,n=e.browserInfo.browser,o=e.prefix.css,s=e.keepUnprefixed;if("cursor"===t&&a[r]&&("firefox"===n||"chrome"===n||"safari"===n||"opera"===n))return{cursor:(0,i.default)(o+r,r,s)}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n;var o=r(0),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a={grab:!0,grabbing:!0};e.exports=t.default},function(e,t,r){"use strict";function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e){var t=e.property,r=e.value,o=e.browserInfo,i=o.browser,u=o.version,l=e.prefix.css,f=e.keepUnprefixed;if("string"==typeof r&&null!==r.match(s)&&("firefox"===i&&u<16||"chrome"===i&&u<26||("safari"===i||"ios_saf"===i)&&u<7||("opera"===i||"op_mini"===i)&&u<12.1||"android"===i&&u<4.4||"and_uc"===i))return n({},t,(0,a.default)(l+r,r,f))}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var i=r(0),a=function(e){return e&&e.__esModule?e:{default:e}}(i),s=/linear-gradient|radial-gradient|repeating-linear-gradient|repeating-radial-gradient/;e.exports=t.default},function(e,t,r){"use strict";function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e){var t=e.property,r=e.value,o=e.browserInfo.browser,i=e.prefix.css,s=e.keepUnprefixed;if("position"===t&&"sticky"===r&&("safari"===o||"ios_saf"===o))return n({},t,(0,a.default)(i+r,r,s))}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var i=r(0),a=function(e){return e&&e.__esModule?e:{default:e}}(i);e.exports=t.default},function(e,t,r){"use strict";function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e){var t=e.property,r=e.value,o=e.prefix.css,i=e.keepUnprefixed;if(s[t]&&u[r])return n({},t,(0,a.default)(o+r,r,i))}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var i=r(0),a=function(e){return e&&e.__esModule?e:{default:e}}(i),s={maxHeight:!0,maxWidth:!0,width:!0,height:!0,columnWidth:!0,minWidth:!0,minHeight:!0},u={"min-content":!0,"max-content":!0,"fill-available":!0,"fit-content":!0,"contain-floats":!0};e.exports=t.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e){var t=e.property,r=e.value,n=e.prefix.css,i=e.requiresPrefix,a=e.keepUnprefixed,u=(0,c.default)(t);if("string"==typeof r&&d[u]){var f=function(){var e=Object.keys(i).map(function(e){return(0,l.default)(e)}),s=r.split(/,(?![^()]*(?:\([^()]*\))?\))/g);return e.forEach(function(e){s.forEach(function(t,r){t.indexOf(e)>-1&&"order"!==e&&(s[r]=t.replace(e,n+e)+(a?","+t:""))})}),{v:o({},t,s.join(","))}}();if("object"===(void 0===f?"undefined":s(f)))return f.v}}var a="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};Object.defineProperty(t,"__esModule",{value:!0});var s="function"==typeof Symbol&&"symbol"===a(Symbol.iterator)?function(e){return void 0===e?"undefined":a(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":void 0===e?"undefined":a(e)};t.default=i;var u=r(12),l=n(u),f=r(50),c=n(f),d={transition:!0,transitionProperty:!0};e.exports=t.default},function(e,t,r){"use strict";function n(e){var t=e.property,r=e.value,n=e.browserInfo,o=n.browser,s=n.version,u=e.prefix.css,l=e.keepUnprefixed;if("cursor"===t&&a[r]&&("firefox"===o&&s<24||"chrome"===o&&s<37||"safari"===o&&s<9||"opera"===o&&s<24))return{cursor:(0,i.default)(u+r,r,l)}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n;var o=r(0),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a={"zoom-in":!0,"zoom-out":!0};e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={chrome:{transform:35,transformOrigin:35,transformOriginX:35,transformOriginY:35,backfaceVisibility:35,perspective:35,perspectiveOrigin:35,transformStyle:35,transformOriginZ:35,animation:42,animationDelay:42,animationDirection:42,animationFillMode:42,animationDuration:42,animationIterationCount:42,animationName:42,animationPlayState:42,animationTimingFunction:42,appearance:55,userSelect:55,fontKerning:32,textEmphasisPosition:55,textEmphasis:55,textEmphasisStyle:55,textEmphasisColor:55,boxDecorationBreak:55,clipPath:55,maskImage:55,maskMode:55,maskRepeat:55,maskPosition:55,maskClip:55,maskOrigin:55,maskSize:55,maskComposite:55,mask:55,maskBorderSource:55,maskBorderMode:55,maskBorderSlice:55,maskBorderWidth:55,maskBorderOutset:55,maskBorderRepeat:55,maskBorder:55,maskType:55,textDecorationStyle:55,textDecorationSkip:55,textDecorationLine:55,textDecorationColor:55,filter:52,fontFeatureSettings:47,breakAfter:49,breakBefore:49,breakInside:49,columnCount:49,columnFill:49,columnGap:49,columnRule:49,columnRuleColor:49,columnRuleStyle:49,columnRuleWidth:49,columns:49,columnSpan:49,columnWidth:49},safari:{flex:8,flexBasis:8,flexDirection:8,flexGrow:8,flexFlow:8,flexShrink:8,flexWrap:8,alignContent:8,alignItems:8,alignSelf:8,justifyContent:8,order:8,transition:6,transitionDelay:6,transitionDuration:6,transitionProperty:6,transitionTimingFunction:6,transform:8,transformOrigin:8,transformOriginX:8,transformOriginY:8,backfaceVisibility:8,perspective:8,perspectiveOrigin:8,transformStyle:8,transformOriginZ:8,animation:8,animationDelay:8,animationDirection:8,animationFillMode:8,animationDuration:8,animationIterationCount:8,animationName:8,animationPlayState:8,animationTimingFunction:8,appearance:10,userSelect:10,backdropFilter:10,fontKerning:9,scrollSnapType:10,scrollSnapPointsX:10,scrollSnapPointsY:10,scrollSnapDestination:10,scrollSnapCoordinate:10,textEmphasisPosition:7,textEmphasis:7,textEmphasisStyle:7,textEmphasisColor:7,boxDecorationBreak:10,clipPath:10,maskImage:10,maskMode:10,maskRepeat:10,maskPosition:10,maskClip:10,maskOrigin:10,maskSize:10,maskComposite:10,mask:10,maskBorderSource:10,maskBorderMode:10,maskBorderSlice:10,maskBorderWidth:10,maskBorderOutset:10,maskBorderRepeat:10,maskBorder:10,maskType:10,textDecorationStyle:10,textDecorationSkip:10,textDecorationLine:10,textDecorationColor:10,shapeImageThreshold:10,shapeImageMargin:10,shapeImageOutside:10,filter:9,hyphens:10,flowInto:10,flowFrom:10,breakBefore:8,breakAfter:8,breakInside:8,regionFragment:10,columnCount:8,columnFill:8,columnGap:8,columnRule:8,columnRuleColor:8,columnRuleStyle:8,columnRuleWidth:8,columns:8,columnSpan:8,columnWidth:8},firefox:{appearance:51,userSelect:51,boxSizing:28,textAlignLast:48,textDecorationStyle:35,textDecorationSkip:35,textDecorationLine:35,textDecorationColor:35,tabSize:51,hyphens:42,fontFeatureSettings:33,breakAfter:51,breakBefore:51,breakInside:51,columnCount:51,columnFill:51,columnGap:51,columnRule:51,columnRuleColor:51,columnRuleStyle:51,columnRuleWidth:51,columns:51,columnSpan:51,columnWidth:51},opera:{flex:16,flexBasis:16,flexDirection:16,flexGrow:16,flexFlow:16,flexShrink:16,flexWrap:16,alignContent:16,alignItems:16,alignSelf:16,justifyContent:16,order:16,transform:22,transformOrigin:22,transformOriginX:22,transformOriginY:22,backfaceVisibility:22,perspective:22,perspectiveOrigin:22,transformStyle:22,transformOriginZ:22,animation:29,animationDelay:29,animationDirection:29,animationFillMode:29,animationDuration:29,animationIterationCount:29,animationName:29,animationPlayState:29,animationTimingFunction:29,appearance:41,userSelect:41,fontKerning:19,textEmphasisPosition:41,textEmphasis:41,textEmphasisStyle:41,textEmphasisColor:41,boxDecorationBreak:41,clipPath:41,maskImage:41,maskMode:41,maskRepeat:41,maskPosition:41,maskClip:41,maskOrigin:41,maskSize:41,maskComposite:41,mask:41,maskBorderSource:41,maskBorderMode:41,maskBorderSlice:41,maskBorderWidth:41,maskBorderOutset:41,maskBorderRepeat:41,maskBorder:41,maskType:41,textDecorationStyle:41,textDecorationSkip:41,textDecorationLine:41,textDecorationColor:41,filter:39,fontFeatureSettings:34,breakAfter:36,breakBefore:36,breakInside:36,columnCount:36,columnFill:36,columnGap:36,columnRule:36,columnRuleColor:36,columnRuleStyle:36,columnRuleWidth:36,columns:36,columnSpan:36,columnWidth:36},ie:{flex:10,flexDirection:10,flexFlow:10,flexWrap:10,transform:9,transformOrigin:9,transformOriginX:9,transformOriginY:9,userSelect:11,wrapFlow:11,wrapThrough:11,wrapMargin:11,scrollSnapType:11,scrollSnapPointsX:11,scrollSnapPointsY:11,scrollSnapDestination:11,scrollSnapCoordinate:11,touchAction:10,hyphens:11,flowInto:11,flowFrom:11,breakBefore:11,breakAfter:11,breakInside:11,regionFragment:11,gridTemplateColumns:11,gridTemplateRows:11,gridTemplateAreas:11,gridTemplate:11,gridAutoColumns:11,gridAutoRows:11,gridAutoFlow:11,grid:11,gridRowStart:11,gridColumnStart:11,gridRowEnd:11,gridRow:11,gridColumn:11,gridColumnEnd:11,gridColumnGap:11,gridRowGap:11,gridArea:11,gridGap:11,textSizeAdjust:11},edge:{userSelect:14,wrapFlow:14,wrapThrough:14,wrapMargin:14,scrollSnapType:14,scrollSnapPointsX:14,scrollSnapPointsY:14,scrollSnapDestination:14,scrollSnapCoordinate:14,hyphens:14,flowInto:14,flowFrom:14,breakBefore:14,breakAfter:14,breakInside:14,regionFragment:14,gridTemplateColumns:14,gridTemplateRows:14,gridTemplateAreas:14,gridTemplate:14,gridAutoColumns:14,gridAutoRows:14,gridAutoFlow:14,grid:14,gridRowStart:14,gridColumnStart:14,gridRowEnd:14,gridRow:14,gridColumn:14,gridColumnEnd:14,gridColumnGap:14,gridRowGap:14,gridArea:14,gridGap:14},ios_saf:{flex:8.1,flexBasis:8.1,flexDirection:8.1,flexGrow:8.1,flexFlow:8.1,flexShrink:8.1,flexWrap:8.1,alignContent:8.1,alignItems:8.1,alignSelf:8.1,justifyContent:8.1,order:8.1,transition:6,transitionDelay:6,transitionDuration:6,transitionProperty:6,transitionTimingFunction:6,transform:8.1,transformOrigin:8.1,transformOriginX:8.1,transformOriginY:8.1,backfaceVisibility:8.1,perspective:8.1,perspectiveOrigin:8.1,transformStyle:8.1,transformOriginZ:8.1,animation:8.1,animationDelay:8.1,animationDirection:8.1,animationFillMode:8.1,animationDuration:8.1,animationIterationCount:8.1,animationName:8.1,animationPlayState:8.1,animationTimingFunction:8.1,appearance:9.3,userSelect:9.3,backdropFilter:9.3,fontKerning:9.3,scrollSnapType:9.3,scrollSnapPointsX:9.3,scrollSnapPointsY:9.3,scrollSnapDestination:9.3,scrollSnapCoordinate:9.3,boxDecorationBreak:9.3,clipPath:9.3,maskImage:9.3,maskMode:9.3,maskRepeat:9.3,maskPosition:9.3,maskClip:9.3,maskOrigin:9.3,maskSize:9.3,maskComposite:9.3,mask:9.3,maskBorderSource:9.3,maskBorderMode:9.3,maskBorderSlice:9.3,maskBorderWidth:9.3,maskBorderOutset:9.3,maskBorderRepeat:9.3,maskBorder:9.3,maskType:9.3,textSizeAdjust:9.3,textDecorationStyle:9.3,textDecorationSkip:9.3,textDecorationLine:9.3,textDecorationColor:9.3,shapeImageThreshold:9.3,shapeImageMargin:9.3,shapeImageOutside:9.3,filter:9,hyphens:9.3,flowInto:9.3,flowFrom:9.3,breakBefore:8.1,breakAfter:8.1,breakInside:8.1,regionFragment:9.3,columnCount:8.1,columnFill:8.1,columnGap:8.1,columnRule:8.1,columnRuleColor:8.1,columnRuleStyle:8.1,columnRuleWidth:8.1,columns:8.1,columnSpan:8.1,columnWidth:8.1},android:{flex:4.2,flexBasis:4.2,flexDirection:4.2,flexGrow:4.2,flexFlow:4.2,flexShrink:4.2,flexWrap:4.2,alignContent:4.2,alignItems:4.2,alignSelf:4.2,justifyContent:4.2,order:4.2,transition:4.2,transitionDelay:4.2,transitionDuration:4.2,transitionProperty:4.2,transitionTimingFunction:4.2,transform:4.4,transformOrigin:4.4,transformOriginX:4.4,transformOriginY:4.4,backfaceVisibility:4.4,perspective:4.4,perspectiveOrigin:4.4,transformStyle:4.4,transformOriginZ:4.4,animation:4.4,animationDelay:4.4,animationDirection:4.4,animationFillMode:4.4,animationDuration:4.4,animationIterationCount:4.4,animationName:4.4,animationPlayState:4.4,animationTimingFunction:4.4,appearance:51,userSelect:51,fontKerning:4.4,textEmphasisPosition:51,textEmphasis:51,textEmphasisStyle:51,textEmphasisColor:51,boxDecorationBreak:51,clipPath:51,maskImage:51,maskMode:51,maskRepeat:51,maskPosition:51,maskClip:51,maskOrigin:51,maskSize:51,maskComposite:51,mask:51,maskBorderSource:51,maskBorderMode:51,maskBorderSlice:51,maskBorderWidth:51,maskBorderOutset:51,maskBorderRepeat:51,maskBorder:51,maskType:51,filter:51,fontFeatureSettings:4.4,breakAfter:51,breakBefore:51,breakInside:51,columnCount:51,columnFill:51,columnGap:51,columnRule:51,columnRuleColor:51,columnRuleStyle:51,columnRuleWidth:51,columns:51,columnSpan:51,columnWidth:51},and_chr:{appearance:51,userSelect:51,textEmphasisPosition:51,textEmphasis:51,textEmphasisStyle:51,textEmphasisColor:51,boxDecorationBreak:51,clipPath:51,maskImage:51,maskMode:51,maskRepeat:51,maskPosition:51,maskClip:51,maskOrigin:51,maskSize:51,maskComposite:51,mask:51,maskBorderSource:51,maskBorderMode:51,maskBorderSlice:51,maskBorderWidth:51,maskBorderOutset:51,maskBorderRepeat:51,maskBorder:51,maskType:51,textDecorationStyle:51,textDecorationSkip:51,textDecorationLine:51,textDecorationColor:51,filter:51},and_uc:{flex:9.9,flexBasis:9.9,flexDirection:9.9,flexGrow:9.9,flexFlow:9.9,flexShrink:9.9,flexWrap:9.9,alignContent:9.9,alignItems:9.9,alignSelf:9.9,justifyContent:9.9,order:9.9,transition:9.9,transitionDelay:9.9,transitionDuration:9.9,transitionProperty:9.9,transitionTimingFunction:9.9,transform:9.9,transformOrigin:9.9,transformOriginX:9.9,transformOriginY:9.9,backfaceVisibility:9.9,perspective:9.9,perspectiveOrigin:9.9,transformStyle:9.9,transformOriginZ:9.9,animation:9.9,animationDelay:9.9,animationDirection:9.9,animationFillMode:9.9,animationDuration:9.9,animationIterationCount:9.9,animationName:9.9,animationPlayState:9.9,animationTimingFunction:9.9,appearance:9.9,userSelect:9.9,fontKerning:9.9,textEmphasisPosition:9.9,textEmphasis:9.9,textEmphasisStyle:9.9,textEmphasisColor:9.9,maskImage:9.9,maskMode:9.9,maskRepeat:9.9,maskPosition:9.9,maskClip:9.9,maskOrigin:9.9,maskSize:9.9,maskComposite:9.9,mask:9.9,maskBorderSource:9.9,maskBorderMode:9.9,maskBorderSlice:9.9,maskBorderWidth:9.9,maskBorderOutset:9.9,maskBorderRepeat:9.9,maskBorder:9.9,maskType:9.9,textSizeAdjust:9.9,filter:9.9,hyphens:9.9,flowInto:9.9,flowFrom:9.9,breakBefore:9.9,breakAfter:9.9,breakInside:9.9,regionFragment:9.9,fontFeatureSettings:9.9,columnCount:9.9,columnFill:9.9,columnGap:9.9,columnRule:9.9,columnRuleColor:9.9,columnRuleStyle:9.9,columnRuleWidth:9.9,columns:9.9,columnSpan:9.9,columnWidth:9.9},op_mini:{}},e.exports=t.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if("string"==typeof t&&!(0,u.default)(t)&&t.indexOf("calc(")>-1)return(0,a.default)(e,t,function(e,t){return t.replace(/calc\(/g,e+"calc(")})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var i=r(2),a=n(i),s=r(4),u=n(s);e.exports=t.default},function(e,t,r){"use strict";function n(e,t){if("cursor"===e&&a[t])return(0,i.default)(e,t)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n;var o=r(2),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a={"zoom-in":!0,"zoom-out":!0,grab:!0,grabbing:!0};e.exports=t.default},function(e,t,r){"use strict";function n(e,t){if("display"===e&&o[t])return{display:["-webkit-box","-moz-box","-ms-"+t+"box","-webkit-"+t,t]}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n;var o={flex:!0,"inline-flex":!0};e.exports=t.default},function(e,t,r){"use strict";function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){if(a[e])return n({},a[e],i[t]||t)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var i={"space-around":"distribute","space-between":"justify","flex-start":"start","flex-end":"end"},a={alignContent:"msFlexLinePack",alignSelf:"msFlexItemAlign",alignItems:"msFlexAlign",justifyContent:"msFlexPack",order:"msFlexOrder",flexGrow:"msFlexPositive",flexShrink:"msFlexNegative",flexBasis:"msPreferredSize"};e.exports=t.default},function(e,t,r){"use strict";function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){return"flexDirection"===e&&"string"==typeof t?{WebkitBoxOrient:t.indexOf("column")>-1?"vertical":"horizontal",WebkitBoxDirection:t.indexOf("reverse")>-1?"reverse":"normal"}:a[e]?n({},a[e],i[t]||t):void 0}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var i={"space-around":"justify","space-between":"justify","flex-start":"start","flex-end":"end","wrap-reverse":"multiple",wrap:"multiple"},a={alignItems:"WebkitBoxAlign",justifyContent:"WebkitBoxPack",flexWrap:"WebkitBoxLines"};e.exports=t.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if("string"==typeof t&&!(0,u.default)(t)&&null!==t.match(l))return(0,a.default)(e,t)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var i=r(2),a=n(i),s=r(4),u=n(s),l=/linear-gradient|radial-gradient|repeating-linear-gradient|repeating-radial-gradient/;e.exports=t.default},function(e,t,r){"use strict";function n(e,t){if("position"===e&&"sticky"===t)return{position:["-webkit-sticky","sticky"]}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n,e.exports=t.default},function(e,t,r){"use strict";function n(e,t){if(a[e]&&s[t])return(0,i.default)(e,t)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n;var o=r(2),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a={maxHeight:!0,maxWidth:!0,width:!0,height:!0,columnWidth:!0,minWidth:!0,minHeight:!0},s={"min-content":!0,"max-content":!0,"fill-available":!0,"fit-content":!0,"contain-floats":!0};e.exports=t.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){if("string"==typeof t&&y[e]){var r,n=a(t),i=n.split(/,(?![^()]*(?:\([^()]*\))?\))/g).filter(function(e){return null===e.match(/-moz-|-ms-/)}).join(",");return e.indexOf("Webkit")>-1?o({},e,i):(r={},o(r,"Webkit"+(0,f.default)(e),i),o(r,e,n),r)}}function a(e){if((0,d.default)(e))return e;var t=e.split(/,(?![^()]*(?:\([^()]*\))?\))/g);return t.forEach(function(e,r){t[r]=Object.keys(m.default).reduce(function(t,r){var n="-"+r.toLowerCase()+"-";return Object.keys(m.default[r]).forEach(function(r){var o=(0,u.default)(r);e.indexOf(o)>-1&&"order"!==o&&(t=e.replace(o,n+o)+","+t)}),t},e)}),t.join(",")}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;var s=r(12),u=n(s),l=r(3),f=n(l),c=r(4),d=n(c),p=r(13),m=n(p),y={transition:!0,transitionProperty:!0,WebkitTransition:!0,WebkitTransitionProperty:!0};e.exports=t.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){return Object.keys(e).forEach(function(t){var r=e[t];r instanceof Object&&!Array.isArray(r)?e[t]=o(r):Object.keys(s.default).forEach(function(n){s.default[n][t]&&(e[n+(0,l.default)(t)]=r)})}),Object.keys(e).forEach(function(t){[].concat(e[t]).forEach(function(r,n){E.forEach(function(n){return i(e,n(t,r))})})}),(0,c.default)(e)}function i(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];Object.keys(t).forEach(function(r){var n=e[r];Array.isArray(n)?[].concat(t[r]).forEach(function(t){var o=n.indexOf(t);o>-1&&e[r].splice(o,1),e[r].push(t)}):e[r]=t[r]})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var a=r(13),s=n(a),u=r(3),l=n(u),f=r(14),c=n(f),d=r(43),p=n(d),m=r(37),y=n(m),b=r(38),v=n(b),h=r(39),g=n(h),x=r(44),k=n(x),S=r(42),_=n(S),w=r(45),O=n(w),j=r(40),P=n(j),C=r(41),M=n(C),E=[p.default,y.default,v.default,k.default,_.default,O.default,P.default,M.default,g.default];e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(23),o=function(e){return e&&e.__esModule?e:{default:e}}(n),i={Webkit:["chrome","safari","ios","android","phantom","opera","webos","blackberry","bada","tizen","chromium","vivaldi"],Moz:["firefox","seamonkey","sailfish"],ms:["msie","msedge"]},a={chrome:[["chrome"],["chromium"]],safari:[["safari"]],firefox:[["firefox"]],edge:[["msedge"]],opera:[["opera"],["vivaldi"]],ios_saf:[["ios","mobile"],["ios","tablet"]],ie:[["msie"]],op_mini:[["opera","mobile"],["opera","tablet"]],and_uc:[["android","mobile"],["android","tablet"]],android:[["android","mobile"],["android","tablet"]]},s=function(e){if(e.firefox)return"firefox";var t="";return Object.keys(a).forEach(function(r){a[r].forEach(function(n){var o=0;n.forEach(function(t){e[t]&&(o+=1)}),n.length===o&&(t=r)})}),t};t.default=function(e){if(!e)return!1;var t=o.default._detect(e);return Object.keys(i).forEach(function(e){i[e].forEach(function(r){t[r]&&(t.prefix={inline:e,css:"-"+e.toLowerCase()+"-"})})}),t.browser=s(t),t.version=t.version?parseFloat(t.version):parseInt(parseFloat(t.osversion),10),t.osversion=parseFloat(t.osversion),"ios_saf"===t.browser&&t.version>t.osversion&&(t.version=t.osversion,t.safari=!0),"android"===t.browser&&t.chrome&&t.version>37&&(t.browser="and_chr"),"android"===t.browser&&t.osversion<5&&(t.version=t.osversion),t},e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.browser,r=e.version,n=e.prefix,o="keyframes";return("chrome"===t&&r<43||("safari"===t||"ios_saf"===t)&&r<9||"opera"===t&&r<30||"android"===t&&r<=4.4||"and_uc"===t)&&(o=n.css+o),o},e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return null!==e.match(/^(Webkit|Moz|O|ms)/)},e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.replace(/^(ms|Webkit|Moz|O)/,"");return t.charAt(0).toLowerCase()+t.slice(1)},e.exports=t.default},function(e,t,r){"use strict";var n,o="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};n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"===("undefined"==typeof window?"undefined":o(window))&&(n=window)}e.exports=n},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){return(0,u.default)(e,function(t,r){return(0,a.default)(r,e[r])+" !important"})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var i=r(15),a=n(i),s=r(18),u=n(s);e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t,r){return(t||"")+"-"+r.toLowerCase()},o=function(e){return e.replace(/([a-z])?([A-Z])/g,n)},i=function(e){return Object.keys(e).reduce(function(t,r){var n=o(r);return/^ms-/.test(n)&&(n="-"+n),t[n]=e[r],t},{})};t.default=i,e.exports=t.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function 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}),t.default=void 0;var s,u,l=r(1),f=n(l),c=r(7),d=n(c),p=(u=s=function(e){function t(){o(this,t);var r=i(this,e.apply(this,arguments));return r._onChange=function(){setTimeout(function(){r._isMounted&&r.setState(r._getCSSState())},0)},r.state=r._getCSSState(),r}return a(t,e),t.prototype.componentDidMount=function(){this._isMounted=!0,this._subscription=this.context._radiumStyleKeeper.subscribe(this._onChange),this._onChange()},t.prototype.componentWillUnmount=function(){this._isMounted=!1,this._subscription&&this._subscription.remove()},t.prototype._getCSSState=function(){return{css:this.context._radiumStyleKeeper.getCSS()}},t.prototype.render=function(){return f.default.createElement("style",{dangerouslySetInnerHTML:{__html:this.state.css}})},t}(l.PureComponent),s.contextTypes={_radiumStyleKeeper:f.default.PropTypes.instanceOf(d.default)},u);t.default=p,e.exports=t.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){return(0,a.default)(e)}Object.defineProperty(t,"__esModule",{value:!0});var i=r(8),a=n(i),s=r(10),u=n(s),l=r(21),f=n(l),c=r(20),d=n(c),p=r(9),m=n(p),y=r(22),b=n(y);r(11);o.Plugins=u.default,o.Style=f.default,o.StyleRoot=d.default,o.getState=m.default,o.keyframes=b.default,t.default=o,e.exports=t.default},function(e,t,r){"use strict";function n(e){return e&&e.constructor===Object&&e.toString===Object.prototype.toString}function o(e){var t={};return e.forEach(function(e){e&&"object"===(void 0===e?"undefined":i(e))&&(Array.isArray(e)&&(e=o(e)),Object.keys(e).forEach(function(r){if(!n(e[r])||!n(t[r]))return void(t[r]=e[r]);if(0===r.indexOf("@media"))for(var i=r;;)if(i+=" ",!t[i])return void(t[i]=e[r]);t[r]=o([t[r],e[r]])}))}),t}Object.defineProperty(t,"__esModule",{value:!0});var i="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};t.isNestedStyle=n,t.mergeStyles=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=(Object.assign,"function"==typeof Symbol&&Symbol.iterator,function(){});t.default=n,e.exports=t.default},function(e,t,r){"use strict";function n(e){var t=e.addCSS,r=e.config,n=e.style;return{style:Object.keys(n).reduce(function(e,o){var i=n[o];if("animationName"===o&&i&&i.__radiumKeyframes){var a=i,s=a.__process(r.userAgent),u=s.animationName,l=s.css;t(l),i=u}return e[o]=i,e},{})}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n,e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){var t=e.style,r=e.mergeStyles;return{style:Array.isArray(t)?r(t):t}};t.default=n,e.exports=t.default},function(e,t,r){"use strict";function n(){o.forEach(function(e){e()})}Object.defineProperty(t,"__esModule",{value:!0});var o=[],i=!1,a=function(e){return o.indexOf(e)===-1&&o.push(e),i||(window.addEventListener("mouseup",n),i=!0),{remove:function(){var t=o.indexOf(e);o.splice(t,1),0===o.length&&i&&(window.removeEventListener("mouseup",n),i=!1)}}};t.default={subscribe:a,__triggerForTests:n},e.exports=t.default},function(e,t,r){"use strict";function n(e){var t=e.config,r=e.style;return{style:(0,o.getPrefixedStyle)(r,t.userAgent)}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n;var o=r(6);e.exports=t.default},function(e,t,r){"use strict";function n(e){var t=e.isNestedStyle,r=e.style;return{style:Object.keys(r).reduce(function(e,n){var o=r[n];return t(o)||(e[n]=o),e},{})}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n,e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(60),o=function(e){return e&&e.__esModule?e:{default:e}}(n),i=function(e){return":hover"===e||":active"===e||":focus"===e},a=function(e){var t=e.ExecutionEnvironment,r=e.getComponentField,n=e.getState,a=e.mergeStyles,s=e.props,u=e.setState,l=e.style,f={},c={};if(l[":hover"]){var d=s.onMouseEnter;c.onMouseEnter=function(e){d&&d(e),u(":hover",!0)};var p=s.onMouseLeave;c.onMouseLeave=function(e){p&&p(e),u(":hover",!1)}}if(l[":active"]){var m=s.onMouseDown;c.onMouseDown=function(e){m&&m(e),f._lastMouseDown=Date.now(),u(":active","viamousedown")};var y=s.onKeyDown;c.onKeyDown=function(e){y&&y(e)," "!==e.key&&"Enter"!==e.key||u(":active","viakeydown")};var b=s.onKeyUp;c.onKeyUp=function(e){b&&b(e)," "!==e.key&&"Enter"!==e.key||u(":active",!1)}}if(l[":focus"]){var v=s.onFocus;c.onFocus=function(e){v&&v(e),u(":focus",!0)};var h=s.onBlur;c.onBlur=function(e){h&&h(e),u(":focus",!1)}}l[":active"]&&!r("_radiumMouseUpListener")&&t.canUseEventListeners&&(f._radiumMouseUpListener=o.default.subscribe(function(){Object.keys(r("state")._radiumStyleState).forEach(function(e){"viamousedown"===n(":active",e)&&u(":active",!1,e)})}));var g=s.disabled?[l[":disabled"]]:Object.keys(l).filter(function(e){return i(e)&&n(e)}).map(function(e){return l[e]}),x=a([l].concat(g));return x=Object.keys(x).reduce(function(e,t){return i(t)||":disabled"===t||(e[t]=x[t]),e},{}),{componentFields:f,props:c,style:x}};t.default=a,e.exports=t.default},function(e,t,r){"use strict";function n(e){return void 0===f&&(f=!!e.canUseDOM&&!!window&&!!window.matchMedia&&function(e){return window.matchMedia(e)}||null),f}function o(e,t){return Object.keys(e).filter(function(r){return t(e[r],r)}).reduce(function(t,r){return t[r]=e[r],t},{})}function i(e){return Object.keys(e).reduce(function(t,r){return 0!==r.indexOf("@media")&&(t[r]=e[r]),t},{})}function a(e){var t=e.addCSS,r=e.appendImportantToEachValue,n=e.cssRuleSetToString,i=e.hash,a=e.isNestedStyle,s=e.style,u=e.userAgent,l="";return Object.keys(s).filter(function(e){return 0===e.indexOf("@media")}).map(function(e){var f=r(o(s[e],function(e){return!a(e)}));if(Object.keys(f).length){var c=n("",f,u),d="rmq-"+i(e+c);t(e+"{ ."+d+c+"}"),l+=(l?" ":"")+d}}),l}function s(e){var t=e.listener,r=e.listenersByQuery,n=e.matchMedia,o=e.mediaQueryListsByQuery,i=e.query;i=i.replace("@media ","");var a=o[i];return!a&&n&&(o[i]=a=n(i)),r&&r[i]||(a.addListener(t),r[i]={remove:function(){a.removeListener(t)}}),a}function u(e){var t=e.ExecutionEnvironment,r=e.addCSS,u=e.appendImportantToEachValue,f=e.config,c=e.cssRuleSetToString,d=e.getComponentField,p=e.getGlobalState,m=e.hash,y=e.isNestedStyle,b=e.mergeStyles,v=e.props,h=e.setState,g=e.style,x=i(g),k=a({addCSS:r,appendImportantToEachValue:u,cssRuleSetToString:c,hash:m,isNestedStyle:y,style:g,userAgent:f.userAgent}),S=k?{className:k+(v.className?" "+v.className:"")}:null,_=f.matchMedia||n(t);if(!_)return{props:S,style:x};var w=l({},d("_radiumMediaQueryListenersByQuery")),O=p("mediaQueryListsByQuery")||{};return Object.keys(g).filter(function(e){return 0===e.indexOf("@media")}).map(function(e){var t=o(g[e],y);if(Object.keys(t).length){var r=s({listener:function(){return h(e,r.matches,"_all")},listenersByQuery:w,matchMedia:_,mediaQueryListsByQuery:O,query:e});r.matches&&(x=b([x,t]))}}),{componentFields:{_radiumMediaQueryListenersByQuery:w},globalState:{mediaQueryListsByQuery:O},props:S,style:x}}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};t.default=u;var f=void 0;e.exports=t.default},function(e,t,r){"use strict";function n(e){var t=e.addCSS,r=e.appendImportantToEachValue,n=e.config,o=e.cssRuleSetToString,i=e.hash,a=e.props,s=e.style,u=a.className,l=Object.keys(s).reduce(function(e,a){var l=s[a];if(":visited"===a){l=r(l);var f=o("",l,n.userAgent),c="rad-"+i(f);t("."+c+":visited"+f),u=(u?u+" ":"")+c}else e[a]=l;return e},{});return{props:u===a.className?null:{className:u},style:l}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n,e.exports=t.default},function(e,t){e.exports=function(){throw new Error("define cannot be used indirect")}}])}); |
packages/mineral-ui-icons/src/IconSentimentSatisfied.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 IconSentimentSatisfied(props: IconProps) {
const iconProps = {
rtl: false,
...props
};
return (
<Icon {...iconProps}>
<g>
<circle cx="15.5" cy="9.5" r="1.5"/><circle cx="8.5" cy="9.5" r="1.5"/><path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm0-4c-1.48 0-2.75-.81-3.45-2H6.88a5.495 5.495 0 0 0 10.24 0h-1.67c-.7 1.19-1.97 2-3.45 2z"/>
</g>
</Icon>
);
}
IconSentimentSatisfied.displayName = 'IconSentimentSatisfied';
IconSentimentSatisfied.category = 'social';
|
ajax/libs/mediaelement/2.15.0/jquery.js | callumacrae/cdnjs | /*!
* jQuery JavaScript Library v1.9.1
* http://jquery.com/
*
* Includes Sizzle.js
* http://sizzlejs.com/
*
* Copyright 2005, 2012 jQuery Foundation, Inc. and other contributors
* Released under the MIT license
* http://jquery.org/license
*
* Date: 2013-2-4
*/
(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<9
// For `typeof node.method` instead of `node.method !== undefined`
core_strundefined = typeof undefined,
// Use the correct document accordingly with window argument (sandbox)
document = window.document,
location = window.location,
// 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.9.1",
// 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 = /^(?:(<[\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,
// The number of elements contained in the matched element set
size: function() {
return this.length;
},
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({
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 ) {
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 ) {
// 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;
}
// Own properties are enumerated firstly, so to speed up,
// if last one is own, then all properties are own.
var key;
for ( key in obj ) {}
return key === undefined || 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();
}
});
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);
// 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 = [];
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 ) {
args = args || [];
args = [ context, args.slice ? args.slice() : args ];
if ( list && ( !fired || stack ) ) {
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() {
var support, 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'/>";
// Support tests won't run in some limited or non-browser environments
all = div.getElementsByTagName("*");
a = div.getElementsByTagName("a")[ 0 ];
if ( !all || !a || !all.length ) {
return {};
}
// 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";
support = {
// Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
getSetAttribute: div.className !== "t",
// IE strips leading whitespace when .innerHTML is used
leadingWhitespace: div.firstChild.nodeType === 3,
// Make sure that tbody elements aren't automatically inserted
// IE will insert them into empty tables
tbody: !div.getElementsByTagName("tbody").length,
// Make sure that link elements get serialized correctly by innerHTML
// This requires a wrapper element in IE
htmlSerialize: !!div.getElementsByTagName("link").length,
// Get the style information from getAttribute
// (IE uses .cssText instead)
style: /top/.test( a.getAttribute("style") ),
// Make sure that URLs aren't manipulated
// (IE normalizes it by default)
hrefNormalized: a.getAttribute("href") === "/a",
// Make sure that element opacity exists
// (IE uses filter instead)
// Use a regex to work around a WebKit issue. See #5145
opacity: /^0.5/.test( a.style.opacity ),
// Verify style float existence
// (IE uses styleFloat instead of cssFloat)
cssFloat: !!a.style.cssFloat,
// Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)
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)
optSelected: opt.selected,
// Tests for enctype support on a form (#6743)
enctype: !!document.createElement("form").enctype,
// Makes sure cloning an html5 element does not cause problems
// Where outerHTML is undefined, this still works
html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>",
// jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode
boxModel: document.compatMode === "CSS1Compat",
// Will be defined later
deleteExpando: true,
noCloneEvent: true,
inlineBlockNeedsLayout: false,
shrinkWrapBlocks: false,
reliableMarginRight: true,
boxSizingReliable: true,
pixelPosition: false
};
// 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), test/csp.php
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";
// 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%;";
support.boxSizing = ( div.offsetWidth === 4 );
support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 );
// 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 thisCache, ret,
internalKey = jQuery.expando,
getByName = typeof name === "string",
// We have to handle DOM nodes and JS objects differently because IE6-7
// can't GC object references properly across the DOM-JS boundary
isNode = elem.nodeType,
// Only DOM nodes need the global jQuery cache; JS object data is
// attached directly to the object so GC can occur automatically
cache = isNode ? jQuery.cache : elem,
// Only defining an ID for JS objects if its cache already exists allows
// the code to shortcut on the same path as a DOM node with no cache
id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey;
// 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)) && getByName && data === undefined ) {
return;
}
if ( !id ) {
// Only DOM nodes need a new unique ID for each element since their data
// ends up in the global cache
if ( isNode ) {
elem[ internalKey ] = id = core_deletedIds.pop() || jQuery.guid++;
} else {
id = internalKey;
}
}
if ( !cache[ id ] ) {
cache[ id ] = {};
// Avoids exposing jQuery metadata on plain JS objects when the object
// is serialized using JSON.stringify
if ( !isNode ) {
cache[ id ].toJSON = jQuery.noop;
}
}
// An object can be passed to jQuery.data instead of a key/value pair; this gets
// shallow copied over onto the existing cache
if ( typeof name === "object" || typeof name === "function" ) {
if ( pvt ) {
cache[ id ] = jQuery.extend( cache[ id ], name );
} else {
cache[ id ].data = jQuery.extend( cache[ id ].data, name );
}
}
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 ( getByName ) {
// First Try to find as-is property data
ret = thisCache[ name ];
// Test for null|undefined property data
if ( ret == null ) {
// Try to find the camelCased property
ret = thisCache[ jQuery.camelCase( name ) ];
}
} else {
ret = thisCache;
}
return ret;
}
function internalRemoveData( elem, name, pvt ) {
if ( !jQuery.acceptData( elem ) ) {
return;
}
var i, l, thisCache,
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 ) );
}
for ( i = 0, l = name.length; i < l; i++ ) {
delete thisCache[ name[i] ];
}
// If there is no data left in the cache, we want to continue
// and let the cache object itself get destroyed
if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) {
return;
}
}
}
// See jQuery.data for more information
if ( !pvt ) {
delete cache[ id ].data;
// Don't destroy the parent cache unless the internal data object
// had been the only thing left in it
if ( !isEmptyDataObject( cache[ id ] ) ) {
return;
}
}
// Destroy the cache
if ( isNode ) {
jQuery.cleanData( [ elem ], true );
// Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
} else if ( jQuery.support.deleteExpando || cache != cache.window ) {
delete cache[ id ];
// When all else fails, null
} else {
cache[ id ] = null;
}
}
jQuery.extend({
cache: {},
// Unique for each copy of jQuery on the page
// Non-digits removed to match rinlinejQuery
expando: "jQuery" + ( core_version + Math.random() ).replace( /\D/g, "" ),
// The following elements throw uncatchable exceptions if you
// attempt to add expando properties to them.
noData: {
"embed": true,
// Ban all objects except for Flash (which handle expandos)
"object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
"applet": true
},
hasData: function( elem ) {
elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
return !!elem && !isEmptyDataObject( elem );
},
data: function( elem, name, data ) {
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,
elem = this[0],
i = 0,
data = null;
// Gets all values
if ( key === undefined ) {
if ( this.length ) {
data = jQuery.data( elem );
if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
attrs = elem.attributes;
for ( ; i < attrs.length; i++ ) {
name = attrs[i].name;
if ( !name.indexOf( "data-" ) ) {
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 jQuery.access( this, function( value ) {
if ( value === undefined ) {
// Try to fetch any internally stored data first
return elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : null;
}
this.each(function() {
jQuery.data( this, key, value );
});
}, null, value, arguments.length > 1, null, true );
},
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--;
}
hooks.cur = fn;
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]/g,
rreturn = /\r/g,
rfocusable = /^(?:input|select|textarea|button|object)$/i,
rclickable = /^(?:a|area)$/i,
rboolean = /^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/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,
isBool = typeof stateVal === "boolean";
if ( jQuery.isFunction( value ) ) {
return this.each(function( i ) {
jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
});
}
return this.each(function() {
if ( type === "string" ) {
// toggle individual class names
var className,
i = 0,
self = jQuery( this ),
state = stateVal,
classNames = value.match( core_rnotwhite ) || [];
while ( (className = classNames[ i++ ]) ) {
// check each className given, space separated list
state = isBool ? state : !self.hasClass( className );
self[ state ? "addClass" : "removeClass" ]( 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,
self = jQuery(this);
if ( this.nodeType !== 1 ) {
return;
}
if ( isFunction ) {
val = value.call( this, i, self.val() );
} else {
val = value;
}
// Treat null/undefined as ""; convert numbers to string
if ( val == null ) {
val = "";
} else if ( typeof val === "number" ) {
val += "";
} else if ( jQuery.isArray( val ) ) {
val = jQuery.map(val, function ( value ) {
return value == null ? "" : value + "";
});
}
hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
// If set returns undefined, fall back to normal setting
if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
this.value = val;
}
});
}
});
jQuery.extend({
valHooks: {
option: {
get: function( elem ) {
// attributes.value is undefined in Blackberry 4.7 but
// uses .value. See #6932
var val = elem.attributes.value;
return !val || val.specified ? elem.value : elem.text;
}
},
select: {
get: function( elem ) {
var value, 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 values = jQuery.makeArray( value );
jQuery(elem).find("option").each(function() {
this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
});
if ( !values.length ) {
elem.selectedIndex = -1;
}
return values;
}
}
},
attr: function( elem, name, value ) {
var hooks, notxml, 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 );
}
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
// All attributes are lowercase
// Grab necessary hook if one is defined
if ( notxml ) {
name = name.toLowerCase();
hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook );
}
if ( value !== undefined ) {
if ( value === null ) {
jQuery.removeAttr( elem, name );
} else if ( hooks && notxml && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
return ret;
} else {
elem.setAttribute( name, value + "" );
return value;
}
} else if ( hooks && notxml && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
return ret;
} else {
// In IE9+, Flash objects don't have .getAttribute (#12945)
// Support: IE9+
if ( typeof elem.getAttribute !== core_strundefined ) {
ret = elem.getAttribute( 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 ( rboolean.test( name ) ) {
// Set corresponding property to false for boolean attributes
// Also clear defaultChecked/defaultSelected (if appropriate) for IE<8
if ( !getSetAttribute && ruseDefault.test( name ) ) {
elem[ jQuery.camelCase( "default-" + name ) ] =
elem[ propName ] = false;
} else {
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: {
tabindex: "tabIndex",
readonly: "readOnly",
"for": "htmlFor",
"class": "className",
maxlength: "maxLength",
cellspacing: "cellSpacing",
cellpadding: "cellPadding",
rowspan: "rowSpan",
colspan: "colSpan",
usemap: "useMap",
frameborder: "frameBorder",
contenteditable: "contentEditable"
},
prop: function( elem, name, value ) {
var ret, hooks, notxml,
nType = elem.nodeType;
// don't get/set properties on text, comment and attribute nodes
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
return;
}
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
if ( notxml ) {
// Fix name and attach hooks
name = jQuery.propFix[ name ] || name;
hooks = jQuery.propHooks[ name ];
}
if ( value !== undefined ) {
if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
return ret;
} else {
return ( elem[ name ] = value );
}
} else {
if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
return ret;
} else {
return elem[ name ];
}
}
},
propHooks: {
tabIndex: {
get: function( elem ) {
// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
var attributeNode = elem.getAttributeNode("tabindex");
return attributeNode && attributeNode.specified ?
parseInt( attributeNode.value, 10 ) :
rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
0 :
undefined;
}
}
}
});
// Hook for boolean attributes
boolHook = {
get: function( elem, name ) {
var
// Use .prop to determine if this attribute is understood as boolean
prop = jQuery.prop( elem, name ),
// Fetch it accordingly
attr = typeof prop === "boolean" && elem.getAttribute( name ),
detail = typeof prop === "boolean" ?
getSetInput && getSetAttribute ?
attr != null :
// oldIE fabricates an empty string for missing boolean attributes
// and conflates checked/selected into attroperties
ruseDefault.test( name ) ?
elem[ jQuery.camelCase( "default-" + name ) ] :
!!attr :
// fetch an attribute node for properties not recognized as boolean
elem.getAttributeNode( name );
return detail && detail.value !== false ?
name.toLowerCase() :
undefined;
},
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;
}
};
// fix oldIE value attroperty
if ( !getSetInput || !getSetAttribute ) {
jQuery.attrHooks.value = {
get: function( elem, name ) {
var ret = elem.getAttributeNode( name );
return jQuery.nodeName( elem, "input" ) ?
// Ignore the value *property* by using defaultValue
elem.defaultValue :
ret && ret.specified ? ret.value : undefined;
},
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 = jQuery.valHooks.button = {
get: function( elem, name ) {
var ret = elem.getAttributeNode( name );
return ret && ( name === "id" || name === "name" || name === "coords" ? ret.value !== "" : ret.specified ) ?
ret.value :
undefined;
},
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;
}
};
// Set contenteditable to false on removals(#10429)
// Setting to empty string throws an error as an invalid value
jQuery.attrHooks.contenteditable = {
get: nodeHook.get,
set: function( elem, value, name ) {
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 ] = jQuery.extend( 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 ) {
jQuery.each([ "href", "src", "width", "height" ], function( i, name ) {
jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
get: function( elem ) {
var ret = elem.getAttribute( name, 2 );
return ret == null ? undefined : ret;
}
});
});
// 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 = jQuery.extend( jQuery.propHooks.selected, {
get: function( elem ) {
var parent = elem.parentNode;
if ( parent ) {
parent.selectedIndex;
// Make sure that it also works with optgroups, see #5701
if ( parent.parentNode ) {
parent.parentNode.selectedIndex;
}
}
return null;
}
});
}
// IE6/7 call enctype encoding
if ( !jQuery.support.enctype ) {
jQuery.propFix.enctype = "encoding";
}
// Radios and checkboxes getter/setter
if ( !jQuery.support.checkOn ) {
jQuery.each([ "radio", "checkbox" ], function() {
jQuery.valHooks[ this ] = {
get: function( elem ) {
// Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
return elem.getAttribute("value") === null ? "on" : elem.value;
}
};
});
}
jQuery.each([ "radio", "checkbox" ], function() {
jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {
set: function( elem, value ) {
if ( jQuery.isArray( value ) ) {
return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
}
}
});
});
var rformElems = /^(?:input|select|textarea)$/i,
rkeyEvent = /^key/,
rmouseEvent = /^(?:mouse|contextmenu)|click/,
rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
function returnTrue() {
return true;
}
function returnFalse() {
return false;
}
/*
* 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
// jQuery(...).bind("mouseover mouseout", fn);
types = ( types || "" ).match( core_rnotwhite ) || [""];
t = types.length;
while ( t-- ) {
tmp = rtypenamespace.exec( types[t] ) || [];
type = origType = tmp[1];
namespaces = ( tmp[2] || "" ).split( "." ).sort();
// If event changes its type, use the special event handlers for the changed type
special = jQuery.event.special[ type ] || {};
// If selector defined, determine special event api type, otherwise given type
type = ( selector ? special.delegateType : special.bindType ) || type;
// Update special based on newly reset type
special = jQuery.event.special[ type ] || {};
// handleObj is passed to all event handlers
handleObj = jQuery.extend({
type: type,
origType: 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 );
event.isTrigger = true;
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( elem.ownerDocument, data ) === false) &&
!(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {
// Call a native DOM method on the target with the same name name as the event.
// Can't use an .isFunction() check here because IE6/7 fails that test.
// Don't do default actions on window, that's where global variables be (#6170)
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") ) {
for ( ; cur != this; cur = cur.parentNode || this ) {
// Don't check non-elements (#13208)
// Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
if ( cur.nodeType === 1 && (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
},
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;
}
}
},
focus: {
// Fire native event if possible so blur/focus sequence is correct
trigger: function() {
if ( this !== document.activeElement && 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 === document.activeElement && this.blur ) {
this.blur();
return false;
}
},
delegateType: "focusout"
},
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 );
});
},
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 );
},
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 );
}
}
});
/*!
* Sizzle CSS Selector Engine
* Copyright 2012 jQuery Foundation and other contributors
* Released under the MIT license
* http://sizzlejs.com/
*/
(function( window, undefined ) {
var i,
cachedruns,
Expr,
getText,
isXML,
compile,
hasDuplicate,
outermostContext,
// Local document vars
setDocument,
document,
docElem,
documentIsXML,
rbuggyQSA,
rbuggyMatches,
matches,
contains,
sortOrder,
// Instance-specific data
expando = "sizzle" + -(new Date()),
preferredDoc = window.document,
support = {},
dirruns = 0,
done = 0,
classCache = createCache(),
tokenCache = createCache(),
compilerCache = createCache(),
// General-purpose constants
strundefined = typeof undefined,
MAX_NEGATIVE = 1 << 31,
// Array methods
arr = [],
pop = arr.pop,
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;
},
// 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
operators = "([*^$|!~]?=)",
attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace +
"*(?:" + operators + 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 + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ),
rpseudo = new RegExp( pseudos ),
ridentifier = new RegExp( "^" + identifier + "$" ),
matchExpr = {
"ID": new RegExp( "^#(" + characterEncoding + ")" ),
"CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
"NAME": new RegExp( "^\\[name=['\"]?(" + 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" ),
// 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" )
},
rsibling = /[\x20\t\r\n\f]*[+~]/,
rnative = /^[^{]+\{\s*\[native code/,
// 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,
rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,
// CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
runescape = /\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,
funescape = function( _, escaped ) {
var high = "0x" + escaped - 0x10000;
// NaN means non-codepoint
return high !== high ?
escaped :
// BMP codepoint
high < 0 ?
String.fromCharCode( high + 0x10000 ) :
// Supplemental Plane codepoint (surrogate pair)
String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
};
// Use a stripped-down slice if we can't use a native one
try {
slice.call( preferredDoc.documentElement.childNodes, 0 )[0].nodeType;
} catch ( e ) {
slice = function( i ) {
var elem,
results = [];
while ( (elem = this[i++]) ) {
results.push( elem );
}
return results;
};
}
/**
* For feature detection
* @param {Function} fn The function to test for native support
*/
function isNative( fn ) {
return rnative.test( fn + "" );
}
/**
* 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 cache,
keys = [];
return (cache = function( 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);
});
}
/**
* 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 {
// release memory in IE
div = null;
}
}
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 ( !documentIsXML && !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, slice.call(context.getElementsByTagName( selector ), 0) );
return results;
// Speed-up: Sizzle(".CLASS")
} else if ( (m = match[3]) && support.getByClassName && context.getElementsByClassName ) {
push.apply( results, slice.call(context.getElementsByClassName( m ), 0) );
return results;
}
}
// QSA path
if ( support.qsa && !rbuggyQSA.test(selector) ) {
old = true;
nid = 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, slice.call( newContext.querySelectorAll(
newSelector
), 0 ) );
return results;
} catch(qsaError) {
} finally {
if ( !old ) {
context.removeAttribute("id");
}
}
}
}
}
// All others
return select( selector.replace( rtrim, "$1" ), context, results, seed );
}
/**
* 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;
};
/**
* 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;
// 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
documentIsXML = isXML( doc );
// Check if getElementsByTagName("*") returns only elements
support.tagNameNoComments = assert(function( div ) {
div.appendChild( doc.createComment("") );
return !div.getElementsByTagName("*").length;
});
// Check if attributes should be retrieved by attribute nodes
support.attributes = assert(function( div ) {
div.innerHTML = "<select></select>";
var type = typeof div.lastChild.getAttribute("multiple");
// IE8 returns a string for some attributes even when not present
return type !== "boolean" && type !== "string";
});
// Check if getElementsByClassName can be trusted
support.getByClassName = assert(function( div ) {
// Opera can't find a second classname (in 9.6)
div.innerHTML = "<div class='hidden e'></div><div class='hidden'></div>";
if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) {
return false;
}
// Safari 3.2 caches class attributes and doesn't catch changes
div.lastChild.className = "e";
return div.getElementsByClassName("e").length === 2;
});
// Check if getElementById returns elements by name
// Check if getElementsByName privileges form controls or returns elements by ID
support.getByName = assert(function( div ) {
// Inject content
div.id = expando + 0;
div.innerHTML = "<a name='" + expando + "'></a><div name='" + expando + "'></div>";
docElem.insertBefore( div, docElem.firstChild );
// Test
var pass = doc.getElementsByName &&
// buggy browsers will return fewer than the correct 2
doc.getElementsByName( expando ).length === 2 +
// buggy browsers will return more than the correct 0
doc.getElementsByName( expando + 0 ).length;
support.getIdNotName = !doc.getElementById( expando );
// Cleanup
docElem.removeChild( div );
return pass;
});
// IE6/7 return modified attributes
Expr.attrHandle = assert(function( div ) {
div.innerHTML = "<a href='#'></a>";
return div.firstChild && typeof div.firstChild.getAttribute !== strundefined &&
div.firstChild.getAttribute("href") === "#";
}) ?
{} :
{
"href": function( elem ) {
return elem.getAttribute( "href", 2 );
},
"type": function( elem ) {
return elem.getAttribute("type");
}
};
// ID find and filter
if ( support.getIdNotName ) {
Expr.find["ID"] = function( id, context ) {
if ( typeof context.getElementById !== strundefined && !documentIsXML ) {
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 {
Expr.find["ID"] = function( id, context ) {
if ( typeof context.getElementById !== strundefined && !documentIsXML ) {
var m = context.getElementById( id );
return m ?
m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ?
[m] :
undefined :
[];
}
};
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.tagNameNoComments ?
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;
};
// Name
Expr.find["NAME"] = support.getByName && function( tag, context ) {
if ( typeof context.getElementsByName !== strundefined ) {
return context.getElementsByName( name );
}
};
// Class
Expr.find["CLASS"] = support.getByClassName && function( className, context ) {
if ( typeof context.getElementsByClassName !== strundefined && !documentIsXML ) {
return context.getElementsByClassName( className );
}
};
// QSA and matchesSelector support
// matchesSelector(:active) reports false when true (IE9/Opera 11.5)
rbuggyMatches = [];
// qSa(:focus) reports false when true (Chrome 21),
// no need to also add to buggyMatches since matches checks buggyQSA
// A support test would require too much code (would include document ready)
rbuggyQSA = [ ":focus" ];
if ( (support.qsa = isNative(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 explictly
// setting a boolean content attribute,
// since its presence should be enough
// http://bugs.jquery.com/ticket/12359
div.innerHTML = "<select><option selected=''></option></select>";
// IE8 - Some boolean attributes are not treated correctly
if ( !div.querySelectorAll("[selected]").length ) {
rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" );
}
// 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 ) {
// Opera 10-12/IE8 - ^= $= *= and empty values
// Should not select anything
div.innerHTML = "<input type='hidden' i=''/>";
if ( div.querySelectorAll("[i^='']").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 = isNative( (matches = docElem.matchesSelector ||
docElem.mozMatchesSelector ||
docElem.webkitMatchesSelector ||
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 = new RegExp( rbuggyQSA.join("|") );
rbuggyMatches = new RegExp( rbuggyMatches.join("|") );
// Element contains another
// Purposefully does not implement inclusive descendent
// As in, an element does not contain itself
contains = isNative(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;
};
// Document order sorting
sortOrder = docElem.compareDocumentPosition ?
function( a, b ) {
var compare;
if ( a === b ) {
hasDuplicate = true;
return 0;
}
if ( (compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b )) ) {
if ( compare & 1 || a.parentNode && a.parentNode.nodeType === 11 ) {
if ( a === doc || contains( preferredDoc, a ) ) {
return -1;
}
if ( b === doc || contains( preferredDoc, b ) ) {
return 1;
}
return 0;
}
return compare & 4 ? -1 : 1;
}
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 :
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;
};
// Always assume the presence of duplicates if sort doesn't
// pass them to our comparison function (as in Google Chrome).
hasDuplicate = false;
[0, 0].sort( sortOrder );
support.detectDuplicates = hasDuplicate;
return document;
};
Sizzle.matches = function( expr, elements ) {
return Sizzle( expr, null, null, elements );
};
Sizzle.matchesSelector = function( elem, expr ) {
// Set document vars if needed
if ( ( elem.ownerDocument || elem ) !== document ) {
setDocument( elem );
}
// Make sure that attribute selectors are quoted
expr = expr.replace( rattributeQuotes, "='$1']" );
// rbuggyQSA always contains :focus, so no need for an existence check
if ( support.matchesSelector && !documentIsXML && (!rbuggyMatches || !rbuggyMatches.test(expr)) && !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 ) {
var val;
// Set document vars if needed
if ( ( elem.ownerDocument || elem ) !== document ) {
setDocument( elem );
}
if ( !documentIsXML ) {
name = name.toLowerCase();
}
if ( (val = Expr.attrHandle[ name ]) ) {
return val( elem );
}
if ( documentIsXML || support.attributes ) {
return elem.getAttribute( name );
}
return ( (val = elem.getAttributeNode( name )) || elem.getAttribute( name ) ) && elem[ name ] === true ?
name :
val && val.specified ? val.value : null;
};
Sizzle.error = function( msg ) {
throw new Error( "Syntax error, unrecognized expression: " + msg );
};
// Document sorting and removing duplicates
Sizzle.uniqueSort = function( results ) {
var elem,
duplicates = [],
i = 1,
j = 0;
// Unless we *know* we can detect duplicates, assume their presence
hasDuplicate = !support.detectDuplicates;
results.sort( sortOrder );
if ( hasDuplicate ) {
for ( ; (elem = results[i]); i++ ) {
if ( elem === results[ i - 1 ] ) {
j = duplicates.push( i );
}
}
while ( j-- ) {
results.splice( duplicates[ j ], 1 );
}
}
return results;
};
function siblingCheck( a, b ) {
var cur = b && a,
diff = cur && ( ~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
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
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
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]);
}
}
});
});
}
/**
* 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,
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[4] ) {
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( nodeName ) {
if ( nodeName === "*" ) {
return function() { return true; };
}
nodeName = nodeName.replace( runescape, funescape ).toLowerCase();
return 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( 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 identifider
if ( !ridentifier.test(lang || "") ) {
Sizzle.error( "unsupported lang: " + lang );
}
lang = lang.replace( runescape, funescape ).toLowerCase();
return function( elem ) {
var elemLang;
do {
if ( (elemLang = documentIsXML ?
elem.getAttribute("xml:lang") || elem.getAttribute("lang") :
elem.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;
})
}
};
// 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 );
}
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( tokens.slice( 0, i - 1 ) ).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" &&
context.nodeType === 9 && !documentIsXML &&
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, slice.call( seed, 0 ) );
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,
documentIsXML,
results,
rsibling.test( selector )
);
return results;
}
// Deprecated
Expr.pseudos["nth"] = Expr.pseudos["eq"];
// Easy API for creating new setFilters
function setFilters() {}
Expr.filters = setFilters.prototype = Expr.pseudos;
Expr.setFilters = new setFilters();
// Initialize with the default document
setDocument();
// Override sizzle attribute retrieval
Sizzle.attr = jQuery.attr;
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 );
var runtil = /Until$/,
rparentsprev = /^(?:parents|prev(?:Until|All))/,
isSimple = /^.[^:#\[\.,]*$/,
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,
len = this.length;
if ( typeof selector !== "string" ) {
self = this;
return this.pushStack( jQuery( selector ).filter(function() {
for ( i = 0; i < len; i++ ) {
if ( jQuery.contains( self[ i ], this ) ) {
return true;
}
}
}) );
}
ret = [];
for ( i = 0; i < len; i++ ) {
jQuery.find( selector, this[ 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;
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, false) );
},
filter: function( selector ) {
return this.pushStack( winnow(this, selector, true) );
},
is: function( selector ) {
return !!selector && (
typeof selector === "string" ?
// 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".
rneedsContext.test( selector ) ?
jQuery( selector, this.context ).index( this[0] ) >= 0 :
jQuery.filter( selector, this ).length > 0 :
this.filter( selector ).length > 0 );
},
closest: function( selectors, context ) {
var cur,
i = 0,
l = this.length,
ret = [],
pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
jQuery( selectors, context || this.context ) :
0;
for ( ; i < l; i++ ) {
cur = this[i];
while ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) {
if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
ret.push( cur );
break;
}
cur = cur.parentNode;
}
}
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)
);
}
});
jQuery.fn.andSelf = jQuery.fn.addBack;
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 ( !runtil.test( name ) ) {
selector = until;
}
if ( selector && typeof selector === "string" ) {
ret = jQuery.filter( selector, ret );
}
ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;
if ( this.length > 1 && rparentsprev.test( name ) ) {
ret = ret.reverse();
}
return this.pushStack( ret );
};
});
jQuery.extend({
filter: function( expr, elems, not ) {
if ( not ) {
expr = ":not(" + expr + ")";
}
return elems.length === 1 ?
jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
jQuery.find.matches(expr, elems);
},
dir: function( elem, dir, until ) {
var matched = [],
cur = elem[ dir ];
while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
if ( cur.nodeType === 1 ) {
matched.push( cur );
}
cur = cur[dir];
}
return matched;
},
sibling: function( n, elem ) {
var r = [];
for ( ; n; n = n.nextSibling ) {
if ( n.nodeType === 1 && n !== elem ) {
r.push( n );
}
}
return r;
}
});
// Implement the identical functionality for filter and not
function winnow( elements, qualifier, keep ) {
// Can't pass null or undefined to indexOf in Firefox 4
// Set to 0 to skip string check
qualifier = qualifier || 0;
if ( jQuery.isFunction( qualifier ) ) {
return jQuery.grep(elements, function( elem, i ) {
var retVal = !!qualifier.call( elem, i, elem );
return retVal === keep;
});
} else if ( qualifier.nodeType ) {
return jQuery.grep(elements, function( elem ) {
return ( elem === qualifier ) === keep;
});
} else if ( typeof qualifier === "string" ) {
var filtered = jQuery.grep(elements, function( elem ) {
return elem.nodeType === 1;
});
if ( isSimple.test( qualifier ) ) {
return jQuery.filter(qualifier, filtered, !keep);
} else {
qualifier = jQuery.filter( qualifier, filtered );
}
}
return jQuery.grep(elements, function( elem ) {
return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep;
});
}
function createSafeFragment( document ) {
var list = nodeNames.split( "|" ),
safeFrag = document.createDocumentFragment();
if ( safeFrag.createElement ) {
while ( list.length ) {
safeFrag.createElement(
list.pop()
);
}
}
return safeFrag;
}
var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" +
"header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
rinlinejQuery = / jQuery\d+="(?: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 );
},
wrapAll: function( html ) {
if ( jQuery.isFunction( html ) ) {
return this.each(function(i) {
jQuery(this).wrapAll( html.call(this, i) );
});
}
if ( this[0] ) {
// The elements to wrap the target around
var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
if ( this[0].parentNode ) {
wrap.insertBefore( this[0] );
}
wrap.map(function() {
var elem = this;
while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
elem = elem.firstChild;
}
return elem;
}).append( this );
}
return this;
},
wrapInner: function( html ) {
if ( jQuery.isFunction( html ) ) {
return this.each(function(i) {
jQuery(this).wrapInner( html.call(this, i) );
});
}
return this.each(function() {
var self = jQuery( this ),
contents = self.contents();
if ( contents.length ) {
contents.wrapAll( html );
} else {
self.append( html );
}
});
},
wrap: function( html ) {
var isFunction = jQuery.isFunction( html );
return this.each(function(i) {
jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
});
},
unwrap: function() {
return this.parent().each(function() {
if ( !jQuery.nodeName( this, "body" ) ) {
jQuery( this ).replaceWith( this.childNodes );
}
}).end();
},
append: function() {
return this.domManip(arguments, true, function( elem ) {
if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
this.appendChild( elem );
}
});
},
prepend: function() {
return this.domManip(arguments, true, function( elem ) {
if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
this.insertBefore( elem, this.firstChild );
}
});
},
before: function() {
return this.domManip( arguments, false, function( elem ) {
if ( this.parentNode ) {
this.parentNode.insertBefore( elem, this );
}
});
},
after: function() {
return this.domManip( arguments, false, 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,
i = 0;
for ( ; (elem = this[i]) != null; i++ ) {
if ( !selector || jQuery.filter( selector, [ elem ] ).length > 0 ) {
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( value ) {
var isFunc = jQuery.isFunction( value );
// Make sure that the elements are removed from the DOM before they are inserted
// this can help fix replacing a parent with child elements
if ( !isFunc && typeof value !== "string" ) {
value = jQuery( value ).not( this ).detach();
}
return this.domManip( [ value ], true, function( elem ) {
var next = this.nextSibling,
parent = this.parentNode;
if ( parent ) {
jQuery( this ).remove();
parent.insertBefore( elem, next );
}
});
},
detach: function( selector ) {
return this.remove( selector, true );
},
domManip: function( args, table, callback ) {
// 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, table ? self.html() : undefined );
}
self.domManip( args, table, callback );
});
}
if ( l ) {
fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this );
first = fragment.firstChild;
if ( fragment.childNodes.length === 1 ) {
fragment = first;
}
if ( first ) {
table = table && jQuery.nodeName( first, "tr" );
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(
table && jQuery.nodeName( this[i], "table" ) ?
findOrAppend( this[i], "tbody" ) :
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.ajax({
url: node.src,
type: "GET",
dataType: "script",
async: false,
global: false,
"throws": true
});
} else {
jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) );
}
}
}
}
// Fix #11809: Avoid leaking memory
fragment = first = null;
}
}
return this;
}
});
function findOrAppend( elem, tag ) {
return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) );
}
// Replace/restore the type attribute of script elements for safe DOM manipulation
function disableScript( elem ) {
var attr = elem.getAttributeNode("type");
elem.type = ( attr && attr.specified ) + "/" + 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 );
}
}
}
}
}
});
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 ) {
var bool = typeof state === "boolean";
return this.each(function() {
if ( bool ? state : 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;
}
}
}
},
// Exclude the following css properties to add px
cssNumber: {
"columnCount": true,
"fillOpacity": true,
"fontWeight": true,
"lineHeight": true,
"opacity": true,
"orphans": true,
"widows": true,
"zIndex": true,
"zoom": true
},
// Add in properties whose names you wish to fix before
// setting or getting the value
cssProps: {
// normalize float css property
"float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
},
// Get and set the style property on a DOM Node
style: function( elem, name, value, extra ) {
// Don't set styles on text and comment nodes
if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
return;
}
// Make sure that we're working with the right name
var ret, type, 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;
},
// A method for quickly swapping in/out CSS properties to get correct calculations
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;
}
});
// 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.hover = function( fnOver, fnOut ) {
return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
};
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.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
});
};
});
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"
},
// Data converters
// Keys separate source (or catchall "*") and destination types with a single space
converters: {
// Convert anything to text
"* text": window.String,
// Text to html (true = no transformation)
"text html": true,
// Evaluate text as a json expression
"text json": jQuery.parseJSON,
// Parse text as xml
"text xml": jQuery.parseXML
},
// For options that shouldn't be deep extended:
// you can add your own custom options here if
// and when you create one that shouldn't be
// deep extended (see ajaxExtend)
flatOptions: {
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;
// Get response data
if ( responses ) {
response = ajaxHandleResponses( s, jqXHR, responses );
}
// If successful, handle type chaining
if ( status >= 200 && status < 300 || status === 304 ) {
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if ( s.ifModified ) {
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 ) {
isSuccess = true;
statusText = "nocontent";
// if not modified
} else if ( status === 304 ) {
isSuccess = true;
statusText = "notmodified";
// If we have data, let's convert it
} else {
isSuccess = ajaxConvert( s, response );
statusText = isSuccess.state;
success = isSuccess.data;
error = isSuccess.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;
},
getScript: function( url, callback ) {
return jQuery.get( url, undefined, callback, "script" );
},
getJSON: function( url, data, callback ) {
return jQuery.get( url, data, callback, "json" );
}
});
/* Handles responses to an ajax request:
* - sets all responseXXX fields accordingly
* - finds the right dataType (mediates between content-type and expected dataType)
* - returns the corresponding response
*/
function ajaxHandleResponses( s, jqXHR, responses ) {
var firstDataType, ct, finalDataType, type,
contents = s.contents,
dataTypes = s.dataTypes,
responseFields = s.responseFields;
// Fill responseXXX fields
for ( type in responseFields ) {
if ( type in responses ) {
jqXHR[ responseFields[type] ] = responses[ type ];
}
}
// Remove auto dataType and get content-type in the process
while( dataTypes[ 0 ] === "*" ) {
dataTypes.shift();
if ( ct === undefined ) {
ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
}
}
// Check if we're dealing with a known content-type
if ( ct ) {
for ( type in contents ) {
if ( contents[ type ] && contents[ type ].test( ct ) ) {
dataTypes.unshift( type );
break;
}
}
}
// Check to see if we have a response for the expected dataType
if ( dataTypes[ 0 ] in responses ) {
finalDataType = dataTypes[ 0 ];
} else {
// Try convertible dataTypes
for ( type in responses ) {
if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
finalDataType = type;
break;
}
if ( !firstDataType ) {
firstDataType = type;
}
}
// Or just use first one
finalDataType = finalDataType || firstDataType;
}
// If we found a dataType
// We add the dataType to the list if needed
// and return the corresponding response
if ( finalDataType ) {
if ( finalDataType !== dataTypes[ 0 ] ) {
dataTypes.unshift( finalDataType );
}
return responses[ finalDataType ];
}
}
// Chain conversions given the request and the original response
function ajaxConvert( s, response ) {
var conv2, current, conv, tmp,
converters = {},
i = 0,
// Work with a copy of dataTypes in case we need to modify it for conversion
dataTypes = s.dataTypes.slice(),
prev = dataTypes[ 0 ];
// Apply the dataFilter if provided
if ( s.dataFilter ) {
response = s.dataFilter( response, s.dataType );
}
// Create converters map with lowercased keys
if ( dataTypes[ 1 ] ) {
for ( conv in s.converters ) {
converters[ conv.toLowerCase() ] = s.converters[ conv ];
}
}
// Convert to each sequential dataType, tolerating list modification
for ( ; (current = dataTypes[++i]); ) {
// There's only work to do if current dataType is non-auto
if ( current !== "*" ) {
// Convert response if prev dataType is non-auto and differs from current
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.splice( i--, 0, current );
}
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 };
}
}
}
}
// Update prev for next iteration
prev = 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 end, unit,
tween = this.createTween( prop, value ),
parts = rfxnum.exec( value ),
target = tween.cur(),
start = +target || 0,
scale = 1,
maxIterations = 20;
if ( parts ) {
end = +parts[2];
unit = parts[3] || ( jQuery.cssNumber[ prop ] ? "" : "px" );
// We need to compute starting value
if ( unit !== "px" && start ) {
// Iteratively approximate from a nonzero starting point
// Prefer the current property, because this process will be trivial if it uses the same units
// Fallback to end or a simple constant
start = jQuery.css( tween.elem, prop, true ) || end || 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 );
}
tween.unit = unit;
tween.start = start;
// If a +=/-= token was provided, we're doing a relative animation
tween.end = parts[1] ? start + ( parts[1] + 1 ) * end : end;
}
return tween;
}]
};
// Animations created synchronously will run synchronously
function createFxNow() {
setTimeout(function() {
fxNow = undefined;
});
return ( fxNow = jQuery.now() );
}
function createTweens( animation, props ) {
jQuery.each( props, function( prop, value ) {
var collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),
index = 0,
length = collection.length;
for ( ; index < length; index++ ) {
if ( collection[ index ].call( animation, prop, value ) ) {
// we're done with this property
return;
}
}
});
}
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;
}
}
createTweens( animation, props );
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 value, name, index, easing, 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, index, length,
value, dataShow, toggle,
tween, hooks, oldfire,
anim = this,
style = elem.style,
orig = {},
handled = [],
hidden = elem.nodeType && isHidden( elem );
// 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 ( index in props ) {
value = props[ index ];
if ( rfxtypes.exec( value ) ) {
delete props[ index ];
toggle = toggle || value === "toggle";
if ( value === ( hidden ? "hide" : "show" ) ) {
continue;
}
handled.push( index );
}
}
length = handled.length;
if ( length ) {
dataShow = jQuery._data( elem, "fxshow" ) || jQuery._data( elem, "fxshow", {} );
if ( "hidden" in dataShow ) {
hidden = dataShow.hidden;
}
// 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 ( index = 0 ; index < length ; index++ ) {
prop = handled[ index ];
tween = anim.createTween( prop, hidden ? dataShow[ prop ] : 0 );
orig[ prop ] = dataShow[ prop ] || jQuery.style( elem, prop );
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;
}
}
}
};
// Remove in 2.0 - this supports IE8's 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 );
doAnimation.finish = function() {
anim.stop( true );
};
// 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.cur && hooks.cur.finish ) {
hooks.cur.finish.call( this );
}
// 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 || document.documentElement;
while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position") === "static" ) ) {
offsetParent = offsetParent.offsetParent;
}
return offsetParent || document.documentElement;
});
}
});
// 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() {
// })();
// Expose jQuery to the global object
window.jQuery = window.$ = jQuery;
// Expose jQuery as an AMD module, but only for AMD loaders that
// understand the issues with loading multiple versions of jQuery
// in a page that all might call define(). The loader will indicate
// they have special allowances for multiple jQuery versions by
// specifying define.amd.jQuery = true. Register as a named module,
// since jQuery can be concatenated with other files that may use define,
// but not use a proper concatenation script that understands anonymous
// AMD modules. A named AMD is safest and most robust way to register.
// Lowercase jquery is used because AMD module names are derived from
// file names, and jQuery is normally delivered in a lowercase file name.
// Do this after creating the global so that if an AMD module wants to call
// noConflict to hide this version of jQuery, it will work.
if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
define( "jquery", [], function () { return jQuery; } );
}
})( window ); |
lib/yuilib/2in3/2.9.0/build/yui2-container/yui2-container-debug.js | deraadt/moodle | YUI.add('yui2-containercore', function(Y) { Y.use('yui2-container'); }, '3.3.0' ,{"requires": ["yui2-yahoo", "yui2-dom", "yui2-event"]});
YUI.add('yui2-container', function(Y) {
var YAHOO = Y.YUI2;
/*
Copyright (c) 2011, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.com/yui/license.html
version: 2.9.0
*/
(function () {
/**
* Config is a utility used within an Object to allow the implementer to
* maintain a list of local configuration properties and listen for changes
* to those properties dynamically using CustomEvent. The initial values are
* also maintained so that the configuration can be reset at any given point
* to its initial state.
* @namespace YAHOO.util
* @class Config
* @constructor
* @param {Object} owner The owner Object to which this Config Object belongs
*/
YAHOO.util.Config = function (owner) {
if (owner) {
this.init(owner);
}
if (!owner) { YAHOO.log("No owner specified for Config object", "error", "Config"); }
};
var Lang = YAHOO.lang,
CustomEvent = YAHOO.util.CustomEvent,
Config = YAHOO.util.Config;
/**
* Constant representing the CustomEvent type for the config changed event.
* @property YAHOO.util.Config.CONFIG_CHANGED_EVENT
* @private
* @static
* @final
*/
Config.CONFIG_CHANGED_EVENT = "configChanged";
/**
* Constant representing the boolean type string
* @property YAHOO.util.Config.BOOLEAN_TYPE
* @private
* @static
* @final
*/
Config.BOOLEAN_TYPE = "boolean";
Config.prototype = {
/**
* Object reference to the owner of this Config Object
* @property owner
* @type Object
*/
owner: null,
/**
* Boolean flag that specifies whether a queue is currently
* being executed
* @property queueInProgress
* @type Boolean
*/
queueInProgress: false,
/**
* Maintains the local collection of configuration property objects and
* their specified values
* @property config
* @private
* @type Object
*/
config: null,
/**
* Maintains the local collection of configuration property objects as
* they were initially applied.
* This object is used when resetting a property.
* @property initialConfig
* @private
* @type Object
*/
initialConfig: null,
/**
* Maintains the local, normalized CustomEvent queue
* @property eventQueue
* @private
* @type Object
*/
eventQueue: null,
/**
* Custom Event, notifying subscribers when Config properties are set
* (setProperty is called without the silent flag
* @event configChangedEvent
*/
configChangedEvent: null,
/**
* Initializes the configuration Object and all of its local members.
* @method init
* @param {Object} owner The owner Object to which this Config
* Object belongs
*/
init: function (owner) {
this.owner = owner;
this.configChangedEvent =
this.createEvent(Config.CONFIG_CHANGED_EVENT);
this.configChangedEvent.signature = CustomEvent.LIST;
this.queueInProgress = false;
this.config = {};
this.initialConfig = {};
this.eventQueue = [];
},
/**
* Validates that the value passed in is a Boolean.
* @method checkBoolean
* @param {Object} val The value to validate
* @return {Boolean} true, if the value is valid
*/
checkBoolean: function (val) {
return (typeof val == Config.BOOLEAN_TYPE);
},
/**
* Validates that the value passed in is a number.
* @method checkNumber
* @param {Object} val The value to validate
* @return {Boolean} true, if the value is valid
*/
checkNumber: function (val) {
return (!isNaN(val));
},
/**
* Fires a configuration property event using the specified value.
* @method fireEvent
* @private
* @param {String} key The configuration property's name
* @param {value} Object The value of the correct type for the property
*/
fireEvent: function ( key, value ) {
YAHOO.log("Firing Config event: " + key + "=" + value, "info", "Config");
var property = this.config[key];
if (property && property.event) {
property.event.fire(value);
}
},
/**
* Adds a property to the Config Object's private config hash.
* @method addProperty
* @param {String} key The configuration property's name
* @param {Object} propertyObject The Object containing all of this
* property's arguments
*/
addProperty: function ( key, propertyObject ) {
key = key.toLowerCase();
YAHOO.log("Added property: " + key, "info", "Config");
this.config[key] = propertyObject;
propertyObject.event = this.createEvent(key, { scope: this.owner });
propertyObject.event.signature = CustomEvent.LIST;
propertyObject.key = key;
if (propertyObject.handler) {
propertyObject.event.subscribe(propertyObject.handler,
this.owner);
}
this.setProperty(key, propertyObject.value, true);
if (! propertyObject.suppressEvent) {
this.queueProperty(key, propertyObject.value);
}
},
/**
* Returns a key-value configuration map of the values currently set in
* the Config Object.
* @method getConfig
* @return {Object} The current config, represented in a key-value map
*/
getConfig: function () {
var cfg = {},
currCfg = this.config,
prop,
property;
for (prop in currCfg) {
if (Lang.hasOwnProperty(currCfg, prop)) {
property = currCfg[prop];
if (property && property.event) {
cfg[prop] = property.value;
}
}
}
return cfg;
},
/**
* Returns the value of specified property.
* @method getProperty
* @param {String} key The name of the property
* @return {Object} The value of the specified property
*/
getProperty: function (key) {
var property = this.config[key.toLowerCase()];
if (property && property.event) {
return property.value;
} else {
return undefined;
}
},
/**
* Resets the specified property's value to its initial value.
* @method resetProperty
* @param {String} key The name of the property
* @return {Boolean} True is the property was reset, false if not
*/
resetProperty: function (key) {
key = key.toLowerCase();
var property = this.config[key];
if (property && property.event) {
if (key in this.initialConfig) {
this.setProperty(key, this.initialConfig[key]);
return true;
}
} else {
return false;
}
},
/**
* Sets the value of a property. If the silent property is passed as
* true, the property's event will not be fired.
* @method setProperty
* @param {String} key The name of the property
* @param {String} value The value to set the property to
* @param {Boolean} silent Whether the value should be set silently,
* without firing the property event.
* @return {Boolean} True, if the set was successful, false if it failed.
*/
setProperty: function (key, value, silent) {
var property;
key = key.toLowerCase();
YAHOO.log("setProperty: " + key + "=" + value, "info", "Config");
if (this.queueInProgress && ! silent) {
// Currently running through a queue...
this.queueProperty(key,value);
return true;
} else {
property = this.config[key];
if (property && property.event) {
if (property.validator && !property.validator(value)) {
return false;
} else {
property.value = value;
if (! silent) {
this.fireEvent(key, value);
this.configChangedEvent.fire([key, value]);
}
return true;
}
} else {
return false;
}
}
},
/**
* Sets the value of a property and queues its event to execute. If the
* event is already scheduled to execute, it is
* moved from its current position to the end of the queue.
* @method queueProperty
* @param {String} key The name of the property
* @param {String} value The value to set the property to
* @return {Boolean} true, if the set was successful, false if
* it failed.
*/
queueProperty: function (key, value) {
key = key.toLowerCase();
YAHOO.log("queueProperty: " + key + "=" + value, "info", "Config");
var property = this.config[key],
foundDuplicate = false,
iLen,
queueItem,
queueItemKey,
queueItemValue,
sLen,
supercedesCheck,
qLen,
queueItemCheck,
queueItemCheckKey,
queueItemCheckValue,
i,
s,
q;
if (property && property.event) {
if (!Lang.isUndefined(value) && property.validator &&
!property.validator(value)) { // validator
return false;
} else {
if (!Lang.isUndefined(value)) {
property.value = value;
} else {
value = property.value;
}
foundDuplicate = false;
iLen = this.eventQueue.length;
for (i = 0; i < iLen; i++) {
queueItem = this.eventQueue[i];
if (queueItem) {
queueItemKey = queueItem[0];
queueItemValue = queueItem[1];
if (queueItemKey == key) {
/*
found a dupe... push to end of queue, null
current item, and break
*/
this.eventQueue[i] = null;
this.eventQueue.push(
[key, (!Lang.isUndefined(value) ?
value : queueItemValue)]);
foundDuplicate = true;
break;
}
}
}
// this is a refire, or a new property in the queue
if (! foundDuplicate && !Lang.isUndefined(value)) {
this.eventQueue.push([key, value]);
}
}
if (property.supercedes) {
sLen = property.supercedes.length;
for (s = 0; s < sLen; s++) {
supercedesCheck = property.supercedes[s];
qLen = this.eventQueue.length;
for (q = 0; q < qLen; q++) {
queueItemCheck = this.eventQueue[q];
if (queueItemCheck) {
queueItemCheckKey = queueItemCheck[0];
queueItemCheckValue = queueItemCheck[1];
if (queueItemCheckKey ==
supercedesCheck.toLowerCase() ) {
this.eventQueue.push([queueItemCheckKey,
queueItemCheckValue]);
this.eventQueue[q] = null;
break;
}
}
}
}
}
YAHOO.log("Config event queue: " + this.outputEventQueue(), "info", "Config");
return true;
} else {
return false;
}
},
/**
* Fires the event for a property using the property's current value.
* @method refireEvent
* @param {String} key The name of the property
*/
refireEvent: function (key) {
key = key.toLowerCase();
var property = this.config[key];
if (property && property.event &&
!Lang.isUndefined(property.value)) {
if (this.queueInProgress) {
this.queueProperty(key);
} else {
this.fireEvent(key, property.value);
}
}
},
/**
* Applies a key-value Object literal to the configuration, replacing
* any existing values, and queueing the property events.
* Although the values will be set, fireQueue() must be called for their
* associated events to execute.
* @method applyConfig
* @param {Object} userConfig The configuration Object literal
* @param {Boolean} init When set to true, the initialConfig will
* be set to the userConfig passed in, so that calling a reset will
* reset the properties to the passed values.
*/
applyConfig: function (userConfig, init) {
var sKey,
oConfig;
if (init) {
oConfig = {};
for (sKey in userConfig) {
if (Lang.hasOwnProperty(userConfig, sKey)) {
oConfig[sKey.toLowerCase()] = userConfig[sKey];
}
}
this.initialConfig = oConfig;
}
for (sKey in userConfig) {
if (Lang.hasOwnProperty(userConfig, sKey)) {
this.queueProperty(sKey, userConfig[sKey]);
}
}
},
/**
* Refires the events for all configuration properties using their
* current values.
* @method refresh
*/
refresh: function () {
var prop;
for (prop in this.config) {
if (Lang.hasOwnProperty(this.config, prop)) {
this.refireEvent(prop);
}
}
},
/**
* Fires the normalized list of queued property change events
* @method fireQueue
*/
fireQueue: function () {
var i,
queueItem,
key,
value,
property;
this.queueInProgress = true;
for (i = 0;i < this.eventQueue.length; i++) {
queueItem = this.eventQueue[i];
if (queueItem) {
key = queueItem[0];
value = queueItem[1];
property = this.config[key];
property.value = value;
// Clear out queue entry, to avoid it being
// re-added to the queue by any queueProperty/supercedes
// calls which are invoked during fireEvent
this.eventQueue[i] = null;
this.fireEvent(key,value);
}
}
this.queueInProgress = false;
this.eventQueue = [];
},
/**
* Subscribes an external handler to the change event for any
* given property.
* @method subscribeToConfigEvent
* @param {String} key The property name
* @param {Function} handler The handler function to use subscribe to
* the property's event
* @param {Object} obj The Object to use for scoping the event handler
* (see CustomEvent documentation)
* @param {Boolean} overrideContext Optional. If true, will override
* "this" within the handler to map to the scope Object passed into the
* method.
* @return {Boolean} True, if the subscription was successful,
* otherwise false.
*/
subscribeToConfigEvent: function (key, handler, obj, overrideContext) {
var property = this.config[key.toLowerCase()];
if (property && property.event) {
if (!Config.alreadySubscribed(property.event, handler, obj)) {
property.event.subscribe(handler, obj, overrideContext);
}
return true;
} else {
return false;
}
},
/**
* Unsubscribes an external handler from the change event for any
* given property.
* @method unsubscribeFromConfigEvent
* @param {String} key The property name
* @param {Function} handler The handler function to use subscribe to
* the property's event
* @param {Object} obj The Object to use for scoping the event
* handler (see CustomEvent documentation)
* @return {Boolean} True, if the unsubscription was successful,
* otherwise false.
*/
unsubscribeFromConfigEvent: function (key, handler, obj) {
var property = this.config[key.toLowerCase()];
if (property && property.event) {
return property.event.unsubscribe(handler, obj);
} else {
return false;
}
},
/**
* Returns a string representation of the Config object
* @method toString
* @return {String} The Config object in string format.
*/
toString: function () {
var output = "Config";
if (this.owner) {
output += " [" + this.owner.toString() + "]";
}
return output;
},
/**
* Returns a string representation of the Config object's current
* CustomEvent queue
* @method outputEventQueue
* @return {String} The string list of CustomEvents currently queued
* for execution
*/
outputEventQueue: function () {
var output = "",
queueItem,
q,
nQueue = this.eventQueue.length;
for (q = 0; q < nQueue; q++) {
queueItem = this.eventQueue[q];
if (queueItem) {
output += queueItem[0] + "=" + queueItem[1] + ", ";
}
}
return output;
},
/**
* Sets all properties to null, unsubscribes all listeners from each
* property's change event and all listeners from the configChangedEvent.
* @method destroy
*/
destroy: function () {
var oConfig = this.config,
sProperty,
oProperty;
for (sProperty in oConfig) {
if (Lang.hasOwnProperty(oConfig, sProperty)) {
oProperty = oConfig[sProperty];
oProperty.event.unsubscribeAll();
oProperty.event = null;
}
}
this.configChangedEvent.unsubscribeAll();
this.configChangedEvent = null;
this.owner = null;
this.config = null;
this.initialConfig = null;
this.eventQueue = null;
}
};
/**
* Checks to determine if a particular function/Object pair are already
* subscribed to the specified CustomEvent
* @method YAHOO.util.Config.alreadySubscribed
* @static
* @param {YAHOO.util.CustomEvent} evt The CustomEvent for which to check
* the subscriptions
* @param {Function} fn The function to look for in the subscribers list
* @param {Object} obj The execution scope Object for the subscription
* @return {Boolean} true, if the function/Object pair is already subscribed
* to the CustomEvent passed in
*/
Config.alreadySubscribed = function (evt, fn, obj) {
var nSubscribers = evt.subscribers.length,
subsc,
i;
if (nSubscribers > 0) {
i = nSubscribers - 1;
do {
subsc = evt.subscribers[i];
if (subsc && subsc.obj == obj && subsc.fn == fn) {
return true;
}
}
while (i--);
}
return false;
};
YAHOO.lang.augmentProto(Config, YAHOO.util.EventProvider);
}());
(function () {
/**
* The Container family of components is designed to enable developers to
* create different kinds of content-containing modules on the web. Module
* and Overlay are the most basic containers, and they can be used directly
* or extended to build custom containers. Also part of the Container family
* are four UI controls that extend Module and Overlay: Tooltip, Panel,
* Dialog, and SimpleDialog.
* @module container
* @title Container
* @requires yahoo, dom, event
* @optional dragdrop, animation, button
*/
/**
* Module is a JavaScript representation of the Standard Module Format.
* Standard Module Format is a simple standard for markup containers where
* child nodes representing the header, body, and footer of the content are
* denoted using the CSS classes "hd", "bd", and "ft" respectively.
* Module is the base class for all other classes in the YUI
* Container package.
* @namespace YAHOO.widget
* @class Module
* @constructor
* @param {String} el The element ID representing the Module <em>OR</em>
* @param {HTMLElement} el The element representing the Module
* @param {Object} userConfig The configuration Object literal containing
* the configuration that should be set for this module. See configuration
* documentation for more details.
*/
YAHOO.widget.Module = function (el, userConfig) {
if (el) {
this.init(el, userConfig);
} else {
YAHOO.log("No element or element ID specified" +
" for Module instantiation", "error");
}
};
var Dom = YAHOO.util.Dom,
Config = YAHOO.util.Config,
Event = YAHOO.util.Event,
CustomEvent = YAHOO.util.CustomEvent,
Module = YAHOO.widget.Module,
UA = YAHOO.env.ua,
m_oModuleTemplate,
m_oHeaderTemplate,
m_oBodyTemplate,
m_oFooterTemplate,
/**
* Constant representing the name of the Module's events
* @property EVENT_TYPES
* @private
* @final
* @type Object
*/
EVENT_TYPES = {
"BEFORE_INIT": "beforeInit",
"INIT": "init",
"APPEND": "append",
"BEFORE_RENDER": "beforeRender",
"RENDER": "render",
"CHANGE_HEADER": "changeHeader",
"CHANGE_BODY": "changeBody",
"CHANGE_FOOTER": "changeFooter",
"CHANGE_CONTENT": "changeContent",
"DESTROY": "destroy",
"BEFORE_SHOW": "beforeShow",
"SHOW": "show",
"BEFORE_HIDE": "beforeHide",
"HIDE": "hide"
},
/**
* Constant representing the Module's configuration properties
* @property DEFAULT_CONFIG
* @private
* @final
* @type Object
*/
DEFAULT_CONFIG = {
"VISIBLE": {
key: "visible",
value: true,
validator: YAHOO.lang.isBoolean
},
"EFFECT": {
key: "effect",
suppressEvent: true,
supercedes: ["visible"]
},
"MONITOR_RESIZE": {
key: "monitorresize",
value: true
},
"APPEND_TO_DOCUMENT_BODY": {
key: "appendtodocumentbody",
value: false
}
};
/**
* Constant representing the prefix path to use for non-secure images
* @property YAHOO.widget.Module.IMG_ROOT
* @static
* @final
* @type String
*/
Module.IMG_ROOT = null;
/**
* Constant representing the prefix path to use for securely served images
* @property YAHOO.widget.Module.IMG_ROOT_SSL
* @static
* @final
* @type String
*/
Module.IMG_ROOT_SSL = null;
/**
* Constant for the default CSS class name that represents a Module
* @property YAHOO.widget.Module.CSS_MODULE
* @static
* @final
* @type String
*/
Module.CSS_MODULE = "yui-module";
/**
* CSS classname representing the module header. NOTE: The classname is inserted into the DOM as HTML, and should be escaped by the implementor if coming from an external source.
* @property YAHOO.widget.Module.CSS_HEADER
* @static
* @final
* @type String
*/
Module.CSS_HEADER = "hd";
/**
* CSS classname representing the module body. NOTE: The classname is inserted into the DOM as HTML, and should be escaped by the implementor if coming from an external source.
* @property YAHOO.widget.Module.CSS_BODY
* @static
* @final
* @type String
*/
Module.CSS_BODY = "bd";
/**
* CSS classname representing the module footer. NOTE: The classname is inserted into the DOM as HTML, and should be escaped by the implementor if coming from an external source.
* @property YAHOO.widget.Module.CSS_FOOTER
* @static
* @final
* @type String
*/
Module.CSS_FOOTER = "ft";
/**
* Constant representing the url for the "src" attribute of the iframe
* used to monitor changes to the browser's base font size
* @property YAHOO.widget.Module.RESIZE_MONITOR_SECURE_URL
* @static
* @final
* @type String
*/
Module.RESIZE_MONITOR_SECURE_URL = "javascript:false;";
/**
* Constant representing the buffer amount (in pixels) to use when positioning
* the text resize monitor offscreen. The resize monitor is positioned
* offscreen by an amount eqaul to its offsetHeight + the buffer value.
*
* @property YAHOO.widget.Module.RESIZE_MONITOR_BUFFER
* @static
* @type Number
*/
// Set to 1, to work around pixel offset in IE8, which increases when zoom is used
Module.RESIZE_MONITOR_BUFFER = 1;
/**
* Singleton CustomEvent fired when the font size is changed in the browser.
* Opera's "zoom" functionality currently does not support text
* size detection.
* @event YAHOO.widget.Module.textResizeEvent
*/
Module.textResizeEvent = new CustomEvent("textResize");
/**
* Helper utility method, which forces a document level
* redraw for Opera, which can help remove repaint
* irregularities after applying DOM changes.
*
* @method YAHOO.widget.Module.forceDocumentRedraw
* @static
*/
Module.forceDocumentRedraw = function() {
var docEl = document.documentElement;
if (docEl) {
docEl.className += " ";
docEl.className = YAHOO.lang.trim(docEl.className);
}
};
function createModuleTemplate() {
if (!m_oModuleTemplate) {
m_oModuleTemplate = document.createElement("div");
m_oModuleTemplate.innerHTML = ("<div class=\"" +
Module.CSS_HEADER + "\"></div>" + "<div class=\"" +
Module.CSS_BODY + "\"></div><div class=\"" +
Module.CSS_FOOTER + "\"></div>");
m_oHeaderTemplate = m_oModuleTemplate.firstChild;
m_oBodyTemplate = m_oHeaderTemplate.nextSibling;
m_oFooterTemplate = m_oBodyTemplate.nextSibling;
}
return m_oModuleTemplate;
}
function createHeader() {
if (!m_oHeaderTemplate) {
createModuleTemplate();
}
return (m_oHeaderTemplate.cloneNode(false));
}
function createBody() {
if (!m_oBodyTemplate) {
createModuleTemplate();
}
return (m_oBodyTemplate.cloneNode(false));
}
function createFooter() {
if (!m_oFooterTemplate) {
createModuleTemplate();
}
return (m_oFooterTemplate.cloneNode(false));
}
Module.prototype = {
/**
* The class's constructor function
* @property contructor
* @type Function
*/
constructor: Module,
/**
* The main module element that contains the header, body, and footer
* @property element
* @type HTMLElement
*/
element: null,
/**
* The header element, denoted with CSS class "hd"
* @property header
* @type HTMLElement
*/
header: null,
/**
* The body element, denoted with CSS class "bd"
* @property body
* @type HTMLElement
*/
body: null,
/**
* The footer element, denoted with CSS class "ft"
* @property footer
* @type HTMLElement
*/
footer: null,
/**
* The id of the element
* @property id
* @type String
*/
id: null,
/**
* A string representing the root path for all images created by
* a Module instance.
* @deprecated It is recommend that any images for a Module be applied
* via CSS using the "background-image" property.
* @property imageRoot
* @type String
*/
imageRoot: Module.IMG_ROOT,
/**
* Initializes the custom events for Module which are fired
* automatically at appropriate times by the Module class.
* @method initEvents
*/
initEvents: function () {
var SIGNATURE = CustomEvent.LIST;
/**
* CustomEvent fired prior to class initalization.
* @event beforeInitEvent
* @param {class} classRef class reference of the initializing
* class, such as this.beforeInitEvent.fire(Module)
*/
this.beforeInitEvent = this.createEvent(EVENT_TYPES.BEFORE_INIT);
this.beforeInitEvent.signature = SIGNATURE;
/**
* CustomEvent fired after class initalization.
* @event initEvent
* @param {class} classRef class reference of the initializing
* class, such as this.beforeInitEvent.fire(Module)
*/
this.initEvent = this.createEvent(EVENT_TYPES.INIT);
this.initEvent.signature = SIGNATURE;
/**
* CustomEvent fired when the Module is appended to the DOM
* @event appendEvent
*/
this.appendEvent = this.createEvent(EVENT_TYPES.APPEND);
this.appendEvent.signature = SIGNATURE;
/**
* CustomEvent fired before the Module is rendered
* @event beforeRenderEvent
*/
this.beforeRenderEvent = this.createEvent(EVENT_TYPES.BEFORE_RENDER);
this.beforeRenderEvent.signature = SIGNATURE;
/**
* CustomEvent fired after the Module is rendered
* @event renderEvent
*/
this.renderEvent = this.createEvent(EVENT_TYPES.RENDER);
this.renderEvent.signature = SIGNATURE;
/**
* CustomEvent fired when the header content of the Module
* is modified
* @event changeHeaderEvent
* @param {String/HTMLElement} content String/element representing
* the new header content
*/
this.changeHeaderEvent = this.createEvent(EVENT_TYPES.CHANGE_HEADER);
this.changeHeaderEvent.signature = SIGNATURE;
/**
* CustomEvent fired when the body content of the Module is modified
* @event changeBodyEvent
* @param {String/HTMLElement} content String/element representing
* the new body content
*/
this.changeBodyEvent = this.createEvent(EVENT_TYPES.CHANGE_BODY);
this.changeBodyEvent.signature = SIGNATURE;
/**
* CustomEvent fired when the footer content of the Module
* is modified
* @event changeFooterEvent
* @param {String/HTMLElement} content String/element representing
* the new footer content
*/
this.changeFooterEvent = this.createEvent(EVENT_TYPES.CHANGE_FOOTER);
this.changeFooterEvent.signature = SIGNATURE;
/**
* CustomEvent fired when the content of the Module is modified
* @event changeContentEvent
*/
this.changeContentEvent = this.createEvent(EVENT_TYPES.CHANGE_CONTENT);
this.changeContentEvent.signature = SIGNATURE;
/**
* CustomEvent fired when the Module is destroyed
* @event destroyEvent
*/
this.destroyEvent = this.createEvent(EVENT_TYPES.DESTROY);
this.destroyEvent.signature = SIGNATURE;
/**
* CustomEvent fired before the Module is shown
* @event beforeShowEvent
*/
this.beforeShowEvent = this.createEvent(EVENT_TYPES.BEFORE_SHOW);
this.beforeShowEvent.signature = SIGNATURE;
/**
* CustomEvent fired after the Module is shown
* @event showEvent
*/
this.showEvent = this.createEvent(EVENT_TYPES.SHOW);
this.showEvent.signature = SIGNATURE;
/**
* CustomEvent fired before the Module is hidden
* @event beforeHideEvent
*/
this.beforeHideEvent = this.createEvent(EVENT_TYPES.BEFORE_HIDE);
this.beforeHideEvent.signature = SIGNATURE;
/**
* CustomEvent fired after the Module is hidden
* @event hideEvent
*/
this.hideEvent = this.createEvent(EVENT_TYPES.HIDE);
this.hideEvent.signature = SIGNATURE;
},
/**
* String identifying whether the current platform is windows or mac. This property
* currently only identifies these 2 platforms, and returns false otherwise.
* @property platform
* @deprecated Use YAHOO.env.ua
* @type {String|Boolean}
*/
platform: function () {
var ua = navigator.userAgent.toLowerCase();
if (ua.indexOf("windows") != -1 || ua.indexOf("win32") != -1) {
return "windows";
} else if (ua.indexOf("macintosh") != -1) {
return "mac";
} else {
return false;
}
}(),
/**
* String representing the user-agent of the browser
* @deprecated Use YAHOO.env.ua
* @property browser
* @type {String|Boolean}
*/
browser: function () {
var ua = navigator.userAgent.toLowerCase();
/*
Check Opera first in case of spoof and check Safari before
Gecko since Safari's user agent string includes "like Gecko"
*/
if (ua.indexOf('opera') != -1) {
return 'opera';
} else if (ua.indexOf('msie 7') != -1) {
return 'ie7';
} else if (ua.indexOf('msie') != -1) {
return 'ie';
} else if (ua.indexOf('safari') != -1) {
return 'safari';
} else if (ua.indexOf('gecko') != -1) {
return 'gecko';
} else {
return false;
}
}(),
/**
* Boolean representing whether or not the current browsing context is
* secure (https)
* @property isSecure
* @type Boolean
*/
isSecure: function () {
if (window.location.href.toLowerCase().indexOf("https") === 0) {
return true;
} else {
return false;
}
}(),
/**
* Initializes the custom events for Module which are fired
* automatically at appropriate times by the Module class.
*/
initDefaultConfig: function () {
// Add properties //
/**
* Specifies whether the Module is visible on the page.
* @config visible
* @type Boolean
* @default true
*/
this.cfg.addProperty(DEFAULT_CONFIG.VISIBLE.key, {
handler: this.configVisible,
value: DEFAULT_CONFIG.VISIBLE.value,
validator: DEFAULT_CONFIG.VISIBLE.validator
});
/**
* <p>
* Object or array of objects representing the ContainerEffect
* classes that are active for animating the container.
* </p>
* <p>
* <strong>NOTE:</strong> Although this configuration
* property is introduced at the Module level, an out of the box
* implementation is not shipped for the Module class so setting
* the proroperty on the Module class has no effect. The Overlay
* class is the first class to provide out of the box ContainerEffect
* support.
* </p>
* @config effect
* @type Object
* @default null
*/
this.cfg.addProperty(DEFAULT_CONFIG.EFFECT.key, {
handler: this.configEffect,
suppressEvent: DEFAULT_CONFIG.EFFECT.suppressEvent,
supercedes: DEFAULT_CONFIG.EFFECT.supercedes
});
/**
* Specifies whether to create a special proxy iframe to monitor
* for user font resizing in the document
* @config monitorresize
* @type Boolean
* @default true
*/
this.cfg.addProperty(DEFAULT_CONFIG.MONITOR_RESIZE.key, {
handler: this.configMonitorResize,
value: DEFAULT_CONFIG.MONITOR_RESIZE.value
});
/**
* Specifies if the module should be rendered as the first child
* of document.body or appended as the last child when render is called
* with document.body as the "appendToNode".
* <p>
* Appending to the body while the DOM is still being constructed can
* lead to Operation Aborted errors in IE hence this flag is set to
* false by default.
* </p>
*
* @config appendtodocumentbody
* @type Boolean
* @default false
*/
this.cfg.addProperty(DEFAULT_CONFIG.APPEND_TO_DOCUMENT_BODY.key, {
value: DEFAULT_CONFIG.APPEND_TO_DOCUMENT_BODY.value
});
},
/**
* The Module class's initialization method, which is executed for
* Module and all of its subclasses. This method is automatically
* called by the constructor, and sets up all DOM references for
* pre-existing markup, and creates required markup if it is not
* already present.
* <p>
* If the element passed in does not have an id, one will be generated
* for it.
* </p>
* @method init
* @param {String} el The element ID representing the Module <em>OR</em>
* @param {HTMLElement} el The element representing the Module
* @param {Object} userConfig The configuration Object literal
* containing the configuration that should be set for this module.
* See configuration documentation for more details.
*/
init: function (el, userConfig) {
var elId, child;
this.initEvents();
this.beforeInitEvent.fire(Module);
/**
* The Module's Config object used for monitoring
* configuration properties.
* @property cfg
* @type YAHOO.util.Config
*/
this.cfg = new Config(this);
if (this.isSecure) {
this.imageRoot = Module.IMG_ROOT_SSL;
}
if (typeof el == "string") {
elId = el;
el = document.getElementById(el);
if (! el) {
el = (createModuleTemplate()).cloneNode(false);
el.id = elId;
}
}
this.id = Dom.generateId(el);
this.element = el;
child = this.element.firstChild;
if (child) {
var fndHd = false, fndBd = false, fndFt = false;
do {
// We're looking for elements
if (1 == child.nodeType) {
if (!fndHd && Dom.hasClass(child, Module.CSS_HEADER)) {
this.header = child;
fndHd = true;
} else if (!fndBd && Dom.hasClass(child, Module.CSS_BODY)) {
this.body = child;
fndBd = true;
} else if (!fndFt && Dom.hasClass(child, Module.CSS_FOOTER)){
this.footer = child;
fndFt = true;
}
}
} while ((child = child.nextSibling));
}
this.initDefaultConfig();
Dom.addClass(this.element, Module.CSS_MODULE);
if (userConfig) {
this.cfg.applyConfig(userConfig, true);
}
/*
Subscribe to the fireQueue() method of Config so that any
queued configuration changes are excecuted upon render of
the Module
*/
if (!Config.alreadySubscribed(this.renderEvent, this.cfg.fireQueue, this.cfg)) {
this.renderEvent.subscribe(this.cfg.fireQueue, this.cfg, true);
}
this.initEvent.fire(Module);
},
/**
* Initialize an empty IFRAME that is placed out of the visible area
* that can be used to detect text resize.
* @method initResizeMonitor
*/
initResizeMonitor: function () {
var isGeckoWin = (UA.gecko && this.platform == "windows");
if (isGeckoWin) {
// Help prevent spinning loading icon which
// started with FireFox 2.0.0.8/Win
var self = this;
setTimeout(function(){self._initResizeMonitor();}, 0);
} else {
this._initResizeMonitor();
}
},
/**
* Create and initialize the text resize monitoring iframe.
*
* @protected
* @method _initResizeMonitor
*/
_initResizeMonitor : function() {
var oDoc,
oIFrame,
sHTML;
function fireTextResize() {
Module.textResizeEvent.fire();
}
if (!UA.opera) {
oIFrame = Dom.get("_yuiResizeMonitor");
var supportsCWResize = this._supportsCWResize();
if (!oIFrame) {
oIFrame = document.createElement("iframe");
if (this.isSecure && Module.RESIZE_MONITOR_SECURE_URL && UA.ie) {
oIFrame.src = Module.RESIZE_MONITOR_SECURE_URL;
}
if (!supportsCWResize) {
// Can't monitor on contentWindow, so fire from inside iframe
sHTML = ["<html><head><script ",
"type=\"text/javascript\">",
"window.onresize=function(){window.parent.",
"YAHOO.widget.Module.textResizeEvent.",
"fire();};<",
"\/script></head>",
"<body></body></html>"].join('');
oIFrame.src = "data:text/html;charset=utf-8," + encodeURIComponent(sHTML);
}
oIFrame.id = "_yuiResizeMonitor";
oIFrame.title = "Text Resize Monitor";
oIFrame.tabIndex = -1;
oIFrame.setAttribute("role", "presentation");
/*
Need to set "position" property before inserting the
iframe into the document or Safari's status bar will
forever indicate the iframe is loading
(See YUILibrary bug #1723064)
*/
oIFrame.style.position = "absolute";
oIFrame.style.visibility = "hidden";
var db = document.body,
fc = db.firstChild;
if (fc) {
db.insertBefore(oIFrame, fc);
} else {
db.appendChild(oIFrame);
}
// Setting the background color fixes an issue with IE6/IE7, where
// elements in the DOM, with -ve margin-top which positioned them
// offscreen (so they would be overlapped by the iframe and its -ve top
// setting), would have their -ve margin-top ignored, when the iframe
// was added.
oIFrame.style.backgroundColor = "transparent";
oIFrame.style.borderWidth = "0";
oIFrame.style.width = "2em";
oIFrame.style.height = "2em";
oIFrame.style.left = "0";
oIFrame.style.top = (-1 * (oIFrame.offsetHeight + Module.RESIZE_MONITOR_BUFFER)) + "px";
oIFrame.style.visibility = "visible";
/*
Don't open/close the document for Gecko like we used to, since it
leads to duplicate cookies. (See YUILibrary bug #1721755)
*/
if (UA.webkit) {
oDoc = oIFrame.contentWindow.document;
oDoc.open();
oDoc.close();
}
}
if (oIFrame && oIFrame.contentWindow) {
Module.textResizeEvent.subscribe(this.onDomResize, this, true);
if (!Module.textResizeInitialized) {
if (supportsCWResize) {
if (!Event.on(oIFrame.contentWindow, "resize", fireTextResize)) {
/*
This will fail in IE if document.domain has
changed, so we must change the listener to
use the oIFrame element instead
*/
Event.on(oIFrame, "resize", fireTextResize);
}
}
Module.textResizeInitialized = true;
}
this.resizeMonitor = oIFrame;
}
}
},
/**
* Text resize monitor helper method.
* Determines if the browser supports resize events on iframe content windows.
*
* @private
* @method _supportsCWResize
*/
_supportsCWResize : function() {
/*
Gecko 1.8.0 (FF1.5), 1.8.1.0-5 (FF2) won't fire resize on contentWindow.
Gecko 1.8.1.6+ (FF2.0.0.6+) and all other browsers will fire resize on contentWindow.
We don't want to start sniffing for patch versions, so fire textResize the same
way on all FF2 flavors
*/
var bSupported = true;
if (UA.gecko && UA.gecko <= 1.8) {
bSupported = false;
}
return bSupported;
},
/**
* Event handler fired when the resize monitor element is resized.
* @method onDomResize
* @param {DOMEvent} e The DOM resize event
* @param {Object} obj The scope object passed to the handler
*/
onDomResize: function (e, obj) {
var nTop = -1 * (this.resizeMonitor.offsetHeight + Module.RESIZE_MONITOR_BUFFER);
this.resizeMonitor.style.top = nTop + "px";
this.resizeMonitor.style.left = "0";
},
/**
* Sets the Module's header content to the markup specified, or appends
* the passed element to the header.
*
* If no header is present, one will
* be automatically created. An empty string can be passed to the method
* to clear the contents of the header.
*
* @method setHeader
* @param {HTML} headerContent The markup used to set the header content.
* As a convenience, non HTMLElement objects can also be passed into
* the method, and will be treated as strings, with the header innerHTML
* set to their default toString implementations.
*
* <p>NOTE: Markup passed into this method is added to the DOM as HTML, and should be escaped by the implementor if coming from an external source.</p>
*
* <em>OR</em>
* @param {HTMLElement} headerContent The HTMLElement to append to
* <em>OR</em>
* @param {DocumentFragment} headerContent The document fragment
* containing elements which are to be added to the header
*/
setHeader: function (headerContent) {
var oHeader = this.header || (this.header = createHeader());
if (headerContent.nodeName) {
oHeader.innerHTML = "";
oHeader.appendChild(headerContent);
} else {
oHeader.innerHTML = headerContent;
}
if (this._rendered) {
this._renderHeader();
}
this.changeHeaderEvent.fire(headerContent);
this.changeContentEvent.fire();
},
/**
* Appends the passed element to the header. If no header is present,
* one will be automatically created.
* @method appendToHeader
* @param {HTMLElement | DocumentFragment} element The element to
* append to the header. In the case of a document fragment, the
* children of the fragment will be appended to the header.
*/
appendToHeader: function (element) {
var oHeader = this.header || (this.header = createHeader());
oHeader.appendChild(element);
this.changeHeaderEvent.fire(element);
this.changeContentEvent.fire();
},
/**
* Sets the Module's body content to the HTML specified.
*
* If no body is present, one will be automatically created.
*
* An empty string can be passed to the method to clear the contents of the body.
* @method setBody
* @param {HTML} bodyContent The HTML used to set the body content
* As a convenience, non HTMLElement objects can also be passed into
* the method, and will be treated as strings, with the body innerHTML
* set to their default toString implementations.
*
* <p>NOTE: Markup passed into this method is added to the DOM as HTML, and should be escaped by the implementor if coming from an external source.</p>
*
* <em>OR</em>
* @param {HTMLElement} bodyContent The HTMLElement to add as the first and only
* child of the body element.
* <em>OR</em>
* @param {DocumentFragment} bodyContent The document fragment
* containing elements which are to be added to the body
*/
setBody: function (bodyContent) {
var oBody = this.body || (this.body = createBody());
if (bodyContent.nodeName) {
oBody.innerHTML = "";
oBody.appendChild(bodyContent);
} else {
oBody.innerHTML = bodyContent;
}
if (this._rendered) {
this._renderBody();
}
this.changeBodyEvent.fire(bodyContent);
this.changeContentEvent.fire();
},
/**
* Appends the passed element to the body. If no body is present, one
* will be automatically created.
* @method appendToBody
* @param {HTMLElement | DocumentFragment} element The element to
* append to the body. In the case of a document fragment, the
* children of the fragment will be appended to the body.
*
*/
appendToBody: function (element) {
var oBody = this.body || (this.body = createBody());
oBody.appendChild(element);
this.changeBodyEvent.fire(element);
this.changeContentEvent.fire();
},
/**
* Sets the Module's footer content to the HTML specified, or appends
* the passed element to the footer. If no footer is present, one will
* be automatically created. An empty string can be passed to the method
* to clear the contents of the footer.
* @method setFooter
* @param {HTML} footerContent The HTML used to set the footer
* As a convenience, non HTMLElement objects can also be passed into
* the method, and will be treated as strings, with the footer innerHTML
* set to their default toString implementations.
*
* <p>NOTE: Markup passed into this method is added to the DOM as HTML, and should be escaped by the implementor if coming from an external source.</p>
*
* <em>OR</em>
* @param {HTMLElement} footerContent The HTMLElement to append to
* the footer
* <em>OR</em>
* @param {DocumentFragment} footerContent The document fragment containing
* elements which are to be added to the footer
*/
setFooter: function (footerContent) {
var oFooter = this.footer || (this.footer = createFooter());
if (footerContent.nodeName) {
oFooter.innerHTML = "";
oFooter.appendChild(footerContent);
} else {
oFooter.innerHTML = footerContent;
}
if (this._rendered) {
this._renderFooter();
}
this.changeFooterEvent.fire(footerContent);
this.changeContentEvent.fire();
},
/**
* Appends the passed element to the footer. If no footer is present,
* one will be automatically created.
* @method appendToFooter
* @param {HTMLElement | DocumentFragment} element The element to
* append to the footer. In the case of a document fragment, the
* children of the fragment will be appended to the footer
*/
appendToFooter: function (element) {
var oFooter = this.footer || (this.footer = createFooter());
oFooter.appendChild(element);
this.changeFooterEvent.fire(element);
this.changeContentEvent.fire();
},
/**
* Renders the Module by inserting the elements that are not already
* in the main Module into their correct places. Optionally appends
* the Module to the specified node prior to the render's execution.
* <p>
* For Modules without existing markup, the appendToNode argument
* is REQUIRED. If this argument is ommitted and the current element is
* not present in the document, the function will return false,
* indicating that the render was a failure.
* </p>
* <p>
* NOTE: As of 2.3.1, if the appendToNode is the document's body element
* then the module is rendered as the first child of the body element,
* and not appended to it, to avoid Operation Aborted errors in IE when
* rendering the module before window's load event is fired. You can
* use the appendtodocumentbody configuration property to change this
* to append to document.body if required.
* </p>
* @method render
* @param {String} appendToNode The element id to which the Module
* should be appended to prior to rendering <em>OR</em>
* @param {HTMLElement} appendToNode The element to which the Module
* should be appended to prior to rendering
* @param {HTMLElement} moduleElement OPTIONAL. The element that
* represents the actual Standard Module container.
* @return {Boolean} Success or failure of the render
*/
render: function (appendToNode, moduleElement) {
var me = this;
function appendTo(parentNode) {
if (typeof parentNode == "string") {
parentNode = document.getElementById(parentNode);
}
if (parentNode) {
me._addToParent(parentNode, me.element);
me.appendEvent.fire();
}
}
this.beforeRenderEvent.fire();
if (! moduleElement) {
moduleElement = this.element;
}
if (appendToNode) {
appendTo(appendToNode);
} else {
// No node was passed in. If the element is not already in the Dom, this fails
if (! Dom.inDocument(this.element)) {
YAHOO.log("Render failed. Must specify appendTo node if " + " Module isn't already in the DOM.", "error");
return false;
}
}
this._renderHeader(moduleElement);
this._renderBody(moduleElement);
this._renderFooter(moduleElement);
this._rendered = true;
this.renderEvent.fire();
return true;
},
/**
* Renders the currently set header into it's proper position under the
* module element. If the module element is not provided, "this.element"
* is used.
*
* @method _renderHeader
* @protected
* @param {HTMLElement} moduleElement Optional. A reference to the module element
*/
_renderHeader: function(moduleElement){
moduleElement = moduleElement || this.element;
// Need to get everything into the DOM if it isn't already
if (this.header && !Dom.inDocument(this.header)) {
// There is a header, but it's not in the DOM yet. Need to add it.
var firstChild = moduleElement.firstChild;
if (firstChild) {
moduleElement.insertBefore(this.header, firstChild);
} else {
moduleElement.appendChild(this.header);
}
}
},
/**
* Renders the currently set body into it's proper position under the
* module element. If the module element is not provided, "this.element"
* is used.
*
* @method _renderBody
* @protected
* @param {HTMLElement} moduleElement Optional. A reference to the module element.
*/
_renderBody: function(moduleElement){
moduleElement = moduleElement || this.element;
if (this.body && !Dom.inDocument(this.body)) {
// There is a body, but it's not in the DOM yet. Need to add it.
if (this.footer && Dom.isAncestor(moduleElement, this.footer)) {
moduleElement.insertBefore(this.body, this.footer);
} else {
moduleElement.appendChild(this.body);
}
}
},
/**
* Renders the currently set footer into it's proper position under the
* module element. If the module element is not provided, "this.element"
* is used.
*
* @method _renderFooter
* @protected
* @param {HTMLElement} moduleElement Optional. A reference to the module element
*/
_renderFooter: function(moduleElement){
moduleElement = moduleElement || this.element;
if (this.footer && !Dom.inDocument(this.footer)) {
// There is a footer, but it's not in the DOM yet. Need to add it.
moduleElement.appendChild(this.footer);
}
},
/**
* Removes the Module element from the DOM, sets all child elements to null, and purges the bounding element of event listeners.
* @method destroy
* @param {boolean} shallowPurge If true, only the parent element's DOM event listeners are purged. If false, or not provided, all children are also purged of DOM event listeners.
* NOTE: The flag is a "shallowPurge" flag, as opposed to what may be a more intuitive "purgeChildren" flag to maintain backwards compatibility with behavior prior to 2.9.0.
*/
destroy: function (shallowPurge) {
var parent,
purgeChildren = !(shallowPurge);
if (this.element) {
Event.purgeElement(this.element, purgeChildren);
parent = this.element.parentNode;
}
if (parent) {
parent.removeChild(this.element);
}
this.element = null;
this.header = null;
this.body = null;
this.footer = null;
Module.textResizeEvent.unsubscribe(this.onDomResize, this);
this.cfg.destroy();
this.cfg = null;
this.destroyEvent.fire();
},
/**
* Shows the Module element by setting the visible configuration
* property to true. Also fires two events: beforeShowEvent prior to
* the visibility change, and showEvent after.
* @method show
*/
show: function () {
this.cfg.setProperty("visible", true);
},
/**
* Hides the Module element by setting the visible configuration
* property to false. Also fires two events: beforeHideEvent prior to
* the visibility change, and hideEvent after.
* @method hide
*/
hide: function () {
this.cfg.setProperty("visible", false);
},
// BUILT-IN EVENT HANDLERS FOR MODULE //
/**
* Default event handler for changing the visibility property of a
* Module. By default, this is achieved by switching the "display" style
* between "block" and "none".
* This method is responsible for firing showEvent and hideEvent.
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
* @method configVisible
*/
configVisible: function (type, args, obj) {
var visible = args[0];
if (visible) {
if(this.beforeShowEvent.fire()) {
Dom.setStyle(this.element, "display", "block");
this.showEvent.fire();
}
} else {
if (this.beforeHideEvent.fire()) {
Dom.setStyle(this.element, "display", "none");
this.hideEvent.fire();
}
}
},
/**
* Default event handler for the "effect" configuration property
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
* @method configEffect
*/
configEffect: function (type, args, obj) {
this._cachedEffects = (this.cacheEffects) ? this._createEffects(args[0]) : null;
},
/**
* If true, ContainerEffects (and Anim instances) are cached when "effect" is set, and reused.
* If false, new instances are created each time the container is hidden or shown, as was the
* behavior prior to 2.9.0.
*
* @property cacheEffects
* @since 2.9.0
* @default true
* @type boolean
*/
cacheEffects : true,
/**
* Creates an array of ContainerEffect instances from the provided configs
*
* @method _createEffects
* @param {Array|Object} effectCfg An effect configuration or array of effect configurations
* @return {Array} An array of ContainerEffect instances.
* @protected
*/
_createEffects: function(effectCfg) {
var effectInstances = null,
n,
i,
eff;
if (effectCfg) {
if (effectCfg instanceof Array) {
effectInstances = [];
n = effectCfg.length;
for (i = 0; i < n; i++) {
eff = effectCfg[i];
if (eff.effect) {
effectInstances[effectInstances.length] = eff.effect(this, eff.duration);
}
}
} else if (effectCfg.effect) {
effectInstances = [effectCfg.effect(this, effectCfg.duration)];
}
}
return effectInstances;
},
/**
* Default event handler for the "monitorresize" configuration property
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
* @method configMonitorResize
*/
configMonitorResize: function (type, args, obj) {
var monitor = args[0];
if (monitor) {
this.initResizeMonitor();
} else {
Module.textResizeEvent.unsubscribe(this.onDomResize, this, true);
this.resizeMonitor = null;
}
},
/**
* This method is a protected helper, used when constructing the DOM structure for the module
* to account for situations which may cause Operation Aborted errors in IE. It should not
* be used for general DOM construction.
* <p>
* If the parentNode is not document.body, the element is appended as the last element.
* </p>
* <p>
* If the parentNode is document.body the element is added as the first child to help
* prevent Operation Aborted errors in IE.
* </p>
*
* @param {parentNode} The HTML element to which the element will be added
* @param {element} The HTML element to be added to parentNode's children
* @method _addToParent
* @protected
*/
_addToParent: function(parentNode, element) {
if (!this.cfg.getProperty("appendtodocumentbody") && parentNode === document.body && parentNode.firstChild) {
parentNode.insertBefore(element, parentNode.firstChild);
} else {
parentNode.appendChild(element);
}
},
/**
* Returns a String representation of the Object.
* @method toString
* @return {String} The string representation of the Module
*/
toString: function () {
return "Module " + this.id;
}
};
YAHOO.lang.augmentProto(Module, YAHOO.util.EventProvider);
}());
(function () {
/**
* Overlay is a Module that is absolutely positioned above the page flow. It
* has convenience methods for positioning and sizing, as well as options for
* controlling zIndex and constraining the Overlay's position to the current
* visible viewport. Overlay also contains a dynamicly generated IFRAME which
* is placed beneath it for Internet Explorer 6 and 5.x so that it will be
* properly rendered above SELECT elements.
* @namespace YAHOO.widget
* @class Overlay
* @extends YAHOO.widget.Module
* @param {String} el The element ID representing the Overlay <em>OR</em>
* @param {HTMLElement} el The element representing the Overlay
* @param {Object} userConfig The configuration object literal containing
* the configuration that should be set for this Overlay. See configuration
* documentation for more details.
* @constructor
*/
YAHOO.widget.Overlay = function (el, userConfig) {
YAHOO.widget.Overlay.superclass.constructor.call(this, el, userConfig);
};
var Lang = YAHOO.lang,
CustomEvent = YAHOO.util.CustomEvent,
Module = YAHOO.widget.Module,
Event = YAHOO.util.Event,
Dom = YAHOO.util.Dom,
Config = YAHOO.util.Config,
UA = YAHOO.env.ua,
Overlay = YAHOO.widget.Overlay,
_SUBSCRIBE = "subscribe",
_UNSUBSCRIBE = "unsubscribe",
_CONTAINED = "contained",
m_oIFrameTemplate,
/**
* Constant representing the name of the Overlay's events
* @property EVENT_TYPES
* @private
* @final
* @type Object
*/
EVENT_TYPES = {
"BEFORE_MOVE": "beforeMove",
"MOVE": "move"
},
/**
* Constant representing the Overlay's configuration properties
* @property DEFAULT_CONFIG
* @private
* @final
* @type Object
*/
DEFAULT_CONFIG = {
"X": {
key: "x",
validator: Lang.isNumber,
suppressEvent: true,
supercedes: ["iframe"]
},
"Y": {
key: "y",
validator: Lang.isNumber,
suppressEvent: true,
supercedes: ["iframe"]
},
"XY": {
key: "xy",
suppressEvent: true,
supercedes: ["iframe"]
},
"CONTEXT": {
key: "context",
suppressEvent: true,
supercedes: ["iframe"]
},
"FIXED_CENTER": {
key: "fixedcenter",
value: false,
supercedes: ["iframe", "visible"]
},
"WIDTH": {
key: "width",
suppressEvent: true,
supercedes: ["context", "fixedcenter", "iframe"]
},
"HEIGHT": {
key: "height",
suppressEvent: true,
supercedes: ["context", "fixedcenter", "iframe"]
},
"AUTO_FILL_HEIGHT" : {
key: "autofillheight",
supercedes: ["height"],
value:"body"
},
"ZINDEX": {
key: "zindex",
value: null
},
"CONSTRAIN_TO_VIEWPORT": {
key: "constraintoviewport",
value: false,
validator: Lang.isBoolean,
supercedes: ["iframe", "x", "y", "xy"]
},
"IFRAME": {
key: "iframe",
value: (UA.ie == 6 ? true : false),
validator: Lang.isBoolean,
supercedes: ["zindex"]
},
"PREVENT_CONTEXT_OVERLAP": {
key: "preventcontextoverlap",
value: false,
validator: Lang.isBoolean,
supercedes: ["constraintoviewport"]
}
};
/**
* The URL that will be placed in the iframe
* @property YAHOO.widget.Overlay.IFRAME_SRC
* @static
* @final
* @type String
*/
Overlay.IFRAME_SRC = "javascript:false;";
/**
* Number representing how much the iframe shim should be offset from each
* side of an Overlay instance, in pixels.
* @property YAHOO.widget.Overlay.IFRAME_SRC
* @default 3
* @static
* @final
* @type Number
*/
Overlay.IFRAME_OFFSET = 3;
/**
* Number representing the minimum distance an Overlay instance should be
* positioned relative to the boundaries of the browser's viewport, in pixels.
* @property YAHOO.widget.Overlay.VIEWPORT_OFFSET
* @default 10
* @static
* @final
* @type Number
*/
Overlay.VIEWPORT_OFFSET = 10;
/**
* Constant representing the top left corner of an element, used for
* configuring the context element alignment
* @property YAHOO.widget.Overlay.TOP_LEFT
* @static
* @final
* @type String
*/
Overlay.TOP_LEFT = "tl";
/**
* Constant representing the top right corner of an element, used for
* configuring the context element alignment
* @property YAHOO.widget.Overlay.TOP_RIGHT
* @static
* @final
* @type String
*/
Overlay.TOP_RIGHT = "tr";
/**
* Constant representing the top bottom left corner of an element, used for
* configuring the context element alignment
* @property YAHOO.widget.Overlay.BOTTOM_LEFT
* @static
* @final
* @type String
*/
Overlay.BOTTOM_LEFT = "bl";
/**
* Constant representing the bottom right corner of an element, used for
* configuring the context element alignment
* @property YAHOO.widget.Overlay.BOTTOM_RIGHT
* @static
* @final
* @type String
*/
Overlay.BOTTOM_RIGHT = "br";
Overlay.PREVENT_OVERLAP_X = {
"tltr": true,
"blbr": true,
"brbl": true,
"trtl": true
};
Overlay.PREVENT_OVERLAP_Y = {
"trbr": true,
"tlbl": true,
"bltl": true,
"brtr": true
};
/**
* Constant representing the default CSS class used for an Overlay
* @property YAHOO.widget.Overlay.CSS_OVERLAY
* @static
* @final
* @type String
*/
Overlay.CSS_OVERLAY = "yui-overlay";
/**
* Constant representing the default hidden CSS class used for an Overlay. This class is
* applied to the overlay's outer DIV whenever it's hidden.
*
* @property YAHOO.widget.Overlay.CSS_HIDDEN
* @static
* @final
* @type String
*/
Overlay.CSS_HIDDEN = "yui-overlay-hidden";
/**
* Constant representing the default CSS class used for an Overlay iframe shim.
*
* @property YAHOO.widget.Overlay.CSS_IFRAME
* @static
* @final
* @type String
*/
Overlay.CSS_IFRAME = "yui-overlay-iframe";
/**
* Constant representing the names of the standard module elements
* used in the overlay.
* @property YAHOO.widget.Overlay.STD_MOD_RE
* @static
* @final
* @type RegExp
*/
Overlay.STD_MOD_RE = /^\s*?(body|footer|header)\s*?$/i;
/**
* A singleton CustomEvent used for reacting to the DOM event for
* window scroll
* @event YAHOO.widget.Overlay.windowScrollEvent
*/
Overlay.windowScrollEvent = new CustomEvent("windowScroll");
/**
* A singleton CustomEvent used for reacting to the DOM event for
* window resize
* @event YAHOO.widget.Overlay.windowResizeEvent
*/
Overlay.windowResizeEvent = new CustomEvent("windowResize");
/**
* The DOM event handler used to fire the CustomEvent for window scroll
* @method YAHOO.widget.Overlay.windowScrollHandler
* @static
* @param {DOMEvent} e The DOM scroll event
*/
Overlay.windowScrollHandler = function (e) {
var t = Event.getTarget(e);
// - Webkit (Safari 2/3) and Opera 9.2x bubble scroll events from elements to window
// - FF2/3 and IE6/7, Opera 9.5x don't bubble scroll events from elements to window
// - IE doesn't recognize scroll registered on the document.
//
// Also, when document view is scrolled, IE doesn't provide a target,
// rest of the browsers set target to window.document, apart from opera
// which sets target to window.
if (!t || t === window || t === window.document) {
if (UA.ie) {
if (! window.scrollEnd) {
window.scrollEnd = -1;
}
clearTimeout(window.scrollEnd);
window.scrollEnd = setTimeout(function () {
Overlay.windowScrollEvent.fire();
}, 1);
} else {
Overlay.windowScrollEvent.fire();
}
}
};
/**
* The DOM event handler used to fire the CustomEvent for window resize
* @method YAHOO.widget.Overlay.windowResizeHandler
* @static
* @param {DOMEvent} e The DOM resize event
*/
Overlay.windowResizeHandler = function (e) {
if (UA.ie) {
if (! window.resizeEnd) {
window.resizeEnd = -1;
}
clearTimeout(window.resizeEnd);
window.resizeEnd = setTimeout(function () {
Overlay.windowResizeEvent.fire();
}, 100);
} else {
Overlay.windowResizeEvent.fire();
}
};
/**
* A boolean that indicated whether the window resize and scroll events have
* already been subscribed to.
* @property YAHOO.widget.Overlay._initialized
* @private
* @type Boolean
*/
Overlay._initialized = null;
if (Overlay._initialized === null) {
Event.on(window, "scroll", Overlay.windowScrollHandler);
Event.on(window, "resize", Overlay.windowResizeHandler);
Overlay._initialized = true;
}
/**
* Internal map of special event types, which are provided
* by the instance. It maps the event type to the custom event
* instance. Contains entries for the "windowScroll", "windowResize" and
* "textResize" static container events.
*
* @property YAHOO.widget.Overlay._TRIGGER_MAP
* @type Object
* @static
* @private
*/
Overlay._TRIGGER_MAP = {
"windowScroll" : Overlay.windowScrollEvent,
"windowResize" : Overlay.windowResizeEvent,
"textResize" : Module.textResizeEvent
};
YAHOO.extend(Overlay, Module, {
/**
* <p>
* Array of default event types which will trigger
* context alignment for the Overlay class.
* </p>
* <p>The array is empty by default for Overlay,
* but maybe populated in future releases, so classes extending
* Overlay which need to define their own set of CONTEXT_TRIGGERS
* should concatenate their super class's prototype.CONTEXT_TRIGGERS
* value with their own array of values.
* </p>
* <p>
* E.g.:
* <code>CustomOverlay.prototype.CONTEXT_TRIGGERS = YAHOO.widget.Overlay.prototype.CONTEXT_TRIGGERS.concat(["windowScroll"]);</code>
* </p>
*
* @property CONTEXT_TRIGGERS
* @type Array
* @final
*/
CONTEXT_TRIGGERS : [],
/**
* The Overlay initialization method, which is executed for Overlay and
* all of its subclasses. This method is automatically called by the
* constructor, and sets up all DOM references for pre-existing markup,
* and creates required markup if it is not already present.
* @method init
* @param {String} el The element ID representing the Overlay <em>OR</em>
* @param {HTMLElement} el The element representing the Overlay
* @param {Object} userConfig The configuration object literal
* containing the configuration that should be set for this Overlay.
* See configuration documentation for more details.
*/
init: function (el, userConfig) {
/*
Note that we don't pass the user config in here yet because we
only want it executed once, at the lowest subclass level
*/
Overlay.superclass.init.call(this, el/*, userConfig*/);
this.beforeInitEvent.fire(Overlay);
Dom.addClass(this.element, Overlay.CSS_OVERLAY);
if (userConfig) {
this.cfg.applyConfig(userConfig, true);
}
if (this.platform == "mac" && UA.gecko) {
if (! Config.alreadySubscribed(this.showEvent,
this.showMacGeckoScrollbars, this)) {
this.showEvent.subscribe(this.showMacGeckoScrollbars,
this, true);
}
if (! Config.alreadySubscribed(this.hideEvent,
this.hideMacGeckoScrollbars, this)) {
this.hideEvent.subscribe(this.hideMacGeckoScrollbars,
this, true);
}
}
this.initEvent.fire(Overlay);
},
/**
* Initializes the custom events for Overlay which are fired
* automatically at appropriate times by the Overlay class.
* @method initEvents
*/
initEvents: function () {
Overlay.superclass.initEvents.call(this);
var SIGNATURE = CustomEvent.LIST;
/**
* CustomEvent fired before the Overlay is moved.
* @event beforeMoveEvent
* @param {Number} x x coordinate
* @param {Number} y y coordinate
*/
this.beforeMoveEvent = this.createEvent(EVENT_TYPES.BEFORE_MOVE);
this.beforeMoveEvent.signature = SIGNATURE;
/**
* CustomEvent fired after the Overlay is moved.
* @event moveEvent
* @param {Number} x x coordinate
* @param {Number} y y coordinate
*/
this.moveEvent = this.createEvent(EVENT_TYPES.MOVE);
this.moveEvent.signature = SIGNATURE;
},
/**
* Initializes the class's configurable properties which can be changed
* using the Overlay's Config object (cfg).
* @method initDefaultConfig
*/
initDefaultConfig: function () {
Overlay.superclass.initDefaultConfig.call(this);
var cfg = this.cfg;
// Add overlay config properties //
/**
* The absolute x-coordinate position of the Overlay
* @config x
* @type Number
* @default null
*/
cfg.addProperty(DEFAULT_CONFIG.X.key, {
handler: this.configX,
validator: DEFAULT_CONFIG.X.validator,
suppressEvent: DEFAULT_CONFIG.X.suppressEvent,
supercedes: DEFAULT_CONFIG.X.supercedes
});
/**
* The absolute y-coordinate position of the Overlay
* @config y
* @type Number
* @default null
*/
cfg.addProperty(DEFAULT_CONFIG.Y.key, {
handler: this.configY,
validator: DEFAULT_CONFIG.Y.validator,
suppressEvent: DEFAULT_CONFIG.Y.suppressEvent,
supercedes: DEFAULT_CONFIG.Y.supercedes
});
/**
* An array with the absolute x and y positions of the Overlay
* @config xy
* @type Number[]
* @default null
*/
cfg.addProperty(DEFAULT_CONFIG.XY.key, {
handler: this.configXY,
suppressEvent: DEFAULT_CONFIG.XY.suppressEvent,
supercedes: DEFAULT_CONFIG.XY.supercedes
});
/**
* <p>
* The array of context arguments for context-sensitive positioning.
* </p>
*
* <p>
* The format of the array is: <code>[contextElementOrId, overlayCorner, contextCorner, arrayOfTriggerEvents (optional), xyOffset (optional)]</code>, the
* the 5 array elements described in detail below:
* </p>
*
* <dl>
* <dt>contextElementOrId <String|HTMLElement></dt>
* <dd>A reference to the context element to which the overlay should be aligned (or it's id).</dd>
* <dt>overlayCorner <String></dt>
* <dd>The corner of the overlay which is to be used for alignment. This corner will be aligned to the
* corner of the context element defined by the "contextCorner" entry which follows. Supported string values are:
* "tr" (top right), "tl" (top left), "br" (bottom right), or "bl" (bottom left).</dd>
* <dt>contextCorner <String></dt>
* <dd>The corner of the context element which is to be used for alignment. Supported string values are the same ones listed for the "overlayCorner" entry above.</dd>
* <dt>arrayOfTriggerEvents (optional) <Array[String|CustomEvent]></dt>
* <dd>
* <p>
* By default, context alignment is a one time operation, aligning the Overlay to the context element when context configuration property is set, or when the <a href="#method_align">align</a>
* method is invoked. However, you can use the optional "arrayOfTriggerEvents" entry to define the list of events which should force the overlay to re-align itself with the context element.
* This is useful in situations where the layout of the document may change, resulting in the context element's position being modified.
* </p>
* <p>
* The array can contain either event type strings for events the instance publishes (e.g. "beforeShow") or CustomEvent instances. Additionally the following
* 3 static container event types are also currently supported : <code>"windowResize", "windowScroll", "textResize"</code> (defined in <a href="#property__TRIGGER_MAP">_TRIGGER_MAP</a> private property).
* </p>
* </dd>
* <dt>xyOffset <Number[]></dt>
* <dd>
* A 2 element Array specifying the X and Y pixel amounts by which the Overlay should be offset from the aligned corner. e.g. [5,0] offsets the Overlay 5 pixels to the left, <em>after</em> aligning the given context corners.
* NOTE: If using this property and no triggers need to be defined, the arrayOfTriggerEvents property should be set to null to maintain correct array positions for the arguments.
* </dd>
* </dl>
*
* <p>
* For example, setting this property to <code>["img1", "tl", "bl"]</code> will
* align the Overlay's top left corner to the bottom left corner of the
* context element with id "img1".
* </p>
* <p>
* Setting this property to <code>["img1", "tl", "bl", null, [0,5]</code> will
* align the Overlay's top left corner to the bottom left corner of the
* context element with id "img1", and then offset it by 5 pixels on the Y axis (providing a 5 pixel gap between the bottom of the context element and top of the overlay).
* </p>
* <p>
* Adding the optional trigger values: <code>["img1", "tl", "bl", ["beforeShow", "windowResize"], [0,5]]</code>,
* will re-align the overlay position, whenever the "beforeShow" or "windowResize" events are fired.
* </p>
*
* @config context
* @type Array
* @default null
*/
cfg.addProperty(DEFAULT_CONFIG.CONTEXT.key, {
handler: this.configContext,
suppressEvent: DEFAULT_CONFIG.CONTEXT.suppressEvent,
supercedes: DEFAULT_CONFIG.CONTEXT.supercedes
});
/**
* Determines whether or not the Overlay should be anchored
* to the center of the viewport.
*
* <p>This property can be set to:</p>
*
* <dl>
* <dt>true</dt>
* <dd>
* To enable fixed center positioning
* <p>
* When enabled, the overlay will
* be positioned in the center of viewport when initially displayed, and
* will remain in the center of the viewport whenever the window is
* scrolled or resized.
* </p>
* <p>
* If the overlay is too big for the viewport,
* it's top left corner will be aligned with the top left corner of the viewport.
* </p>
* </dd>
* <dt>false</dt>
* <dd>
* To disable fixed center positioning.
* <p>In this case the overlay can still be
* centered as a one-off operation, by invoking the <code>center()</code> method,
* however it will not remain centered when the window is scrolled/resized.
* </dd>
* <dt>"contained"<dt>
* <dd>To enable fixed center positioning, as with the <code>true</code> option.
* <p>However, unlike setting the property to <code>true</code>,
* when the property is set to <code>"contained"</code>, if the overlay is
* too big for the viewport, it will not get automatically centered when the
* user scrolls or resizes the window (until the window is large enough to contain the
* overlay). This is useful in cases where the Overlay has both header and footer
* UI controls which the user may need to access.
* </p>
* </dd>
* </dl>
*
* @config fixedcenter
* @type Boolean | String
* @default false
*/
cfg.addProperty(DEFAULT_CONFIG.FIXED_CENTER.key, {
handler: this.configFixedCenter,
value: DEFAULT_CONFIG.FIXED_CENTER.value,
validator: DEFAULT_CONFIG.FIXED_CENTER.validator,
supercedes: DEFAULT_CONFIG.FIXED_CENTER.supercedes
});
/**
* CSS width of the Overlay.
* @config width
* @type String
* @default null
*/
cfg.addProperty(DEFAULT_CONFIG.WIDTH.key, {
handler: this.configWidth,
suppressEvent: DEFAULT_CONFIG.WIDTH.suppressEvent,
supercedes: DEFAULT_CONFIG.WIDTH.supercedes
});
/**
* CSS height of the Overlay.
* @config height
* @type String
* @default null
*/
cfg.addProperty(DEFAULT_CONFIG.HEIGHT.key, {
handler: this.configHeight,
suppressEvent: DEFAULT_CONFIG.HEIGHT.suppressEvent,
supercedes: DEFAULT_CONFIG.HEIGHT.supercedes
});
/**
* Standard module element which should auto fill out the height of the Overlay if the height config property is set.
* Supported values are "header", "body", "footer".
*
* @config autofillheight
* @type String
* @default null
*/
cfg.addProperty(DEFAULT_CONFIG.AUTO_FILL_HEIGHT.key, {
handler: this.configAutoFillHeight,
value : DEFAULT_CONFIG.AUTO_FILL_HEIGHT.value,
validator : this._validateAutoFill,
supercedes: DEFAULT_CONFIG.AUTO_FILL_HEIGHT.supercedes
});
/**
* CSS z-index of the Overlay.
* @config zIndex
* @type Number
* @default null
*/
cfg.addProperty(DEFAULT_CONFIG.ZINDEX.key, {
handler: this.configzIndex,
value: DEFAULT_CONFIG.ZINDEX.value
});
/**
* True if the Overlay should be prevented from being positioned
* out of the viewport.
* @config constraintoviewport
* @type Boolean
* @default false
*/
cfg.addProperty(DEFAULT_CONFIG.CONSTRAIN_TO_VIEWPORT.key, {
handler: this.configConstrainToViewport,
value: DEFAULT_CONFIG.CONSTRAIN_TO_VIEWPORT.value,
validator: DEFAULT_CONFIG.CONSTRAIN_TO_VIEWPORT.validator,
supercedes: DEFAULT_CONFIG.CONSTRAIN_TO_VIEWPORT.supercedes
});
/**
* @config iframe
* @description Boolean indicating whether or not the Overlay should
* have an IFRAME shim; used to prevent SELECT elements from
* poking through an Overlay instance in IE6. When set to "true",
* the iframe shim is created when the Overlay instance is intially
* made visible.
* @type Boolean
* @default true for IE6 and below, false for all other browsers.
*/
cfg.addProperty(DEFAULT_CONFIG.IFRAME.key, {
handler: this.configIframe,
value: DEFAULT_CONFIG.IFRAME.value,
validator: DEFAULT_CONFIG.IFRAME.validator,
supercedes: DEFAULT_CONFIG.IFRAME.supercedes
});
/**
* @config preventcontextoverlap
* @description Boolean indicating whether or not the Overlay should overlap its
* context element (defined using the "context" configuration property) when the
* "constraintoviewport" configuration property is set to "true".
* @type Boolean
* @default false
*/
cfg.addProperty(DEFAULT_CONFIG.PREVENT_CONTEXT_OVERLAP.key, {
value: DEFAULT_CONFIG.PREVENT_CONTEXT_OVERLAP.value,
validator: DEFAULT_CONFIG.PREVENT_CONTEXT_OVERLAP.validator,
supercedes: DEFAULT_CONFIG.PREVENT_CONTEXT_OVERLAP.supercedes
});
},
/**
* Moves the Overlay to the specified position. This function is
* identical to calling this.cfg.setProperty("xy", [x,y]);
* @method moveTo
* @param {Number} x The Overlay's new x position
* @param {Number} y The Overlay's new y position
*/
moveTo: function (x, y) {
this.cfg.setProperty("xy", [x, y]);
},
/**
* Adds a CSS class ("hide-scrollbars") and removes a CSS class
* ("show-scrollbars") to the Overlay to fix a bug in Gecko on Mac OS X
* (https://bugzilla.mozilla.org/show_bug.cgi?id=187435)
* @method hideMacGeckoScrollbars
*/
hideMacGeckoScrollbars: function () {
Dom.replaceClass(this.element, "show-scrollbars", "hide-scrollbars");
},
/**
* Adds a CSS class ("show-scrollbars") and removes a CSS class
* ("hide-scrollbars") to the Overlay to fix a bug in Gecko on Mac OS X
* (https://bugzilla.mozilla.org/show_bug.cgi?id=187435)
* @method showMacGeckoScrollbars
*/
showMacGeckoScrollbars: function () {
Dom.replaceClass(this.element, "hide-scrollbars", "show-scrollbars");
},
/**
* Internal implementation to set the visibility of the overlay in the DOM.
*
* @method _setDomVisibility
* @param {boolean} visible Whether to show or hide the Overlay's outer element
* @protected
*/
_setDomVisibility : function(show) {
Dom.setStyle(this.element, "visibility", (show) ? "visible" : "hidden");
var hiddenClass = Overlay.CSS_HIDDEN;
if (show) {
Dom.removeClass(this.element, hiddenClass);
} else {
Dom.addClass(this.element, hiddenClass);
}
},
// BEGIN BUILT-IN PROPERTY EVENT HANDLERS //
/**
* The default event handler fired when the "visible" property is
* changed. This method is responsible for firing showEvent
* and hideEvent.
* @method configVisible
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
configVisible: function (type, args, obj) {
var visible = args[0],
currentVis = Dom.getStyle(this.element, "visibility"),
effects = this._cachedEffects || this._createEffects(this.cfg.getProperty("effect")),
isMacGecko = (this.platform == "mac" && UA.gecko),
alreadySubscribed = Config.alreadySubscribed,
ei, e, j, k, h,
nEffectInstances;
if (currentVis == "inherit") {
e = this.element.parentNode;
while (e.nodeType != 9 && e.nodeType != 11) {
currentVis = Dom.getStyle(e, "visibility");
if (currentVis != "inherit") {
break;
}
e = e.parentNode;
}
if (currentVis == "inherit") {
currentVis = "visible";
}
}
if (visible) { // Show
if (isMacGecko) {
this.showMacGeckoScrollbars();
}
if (effects) { // Animate in
if (visible) { // Animate in if not showing
// Fading out is a bit of a hack, but didn't want to risk doing
// something broader (e.g a generic this._animatingOut) for 2.9.0
if (currentVis != "visible" || currentVis === "" || this._fadingOut) {
if (this.beforeShowEvent.fire()) {
nEffectInstances = effects.length;
for (j = 0; j < nEffectInstances; j++) {
ei = effects[j];
if (j === 0 && !alreadySubscribed(ei.animateInCompleteEvent, this.showEvent.fire, this.showEvent)) {
ei.animateInCompleteEvent.subscribe(this.showEvent.fire, this.showEvent, true);
}
ei.animateIn();
}
}
}
}
} else { // Show
if (currentVis != "visible" || currentVis === "") {
if (this.beforeShowEvent.fire()) {
this._setDomVisibility(true);
this.cfg.refireEvent("iframe");
this.showEvent.fire();
}
} else {
this._setDomVisibility(true);
}
}
} else { // Hide
if (isMacGecko) {
this.hideMacGeckoScrollbars();
}
if (effects) { // Animate out if showing
if (currentVis == "visible" || this._fadingIn) {
if (this.beforeHideEvent.fire()) {
nEffectInstances = effects.length;
for (k = 0; k < nEffectInstances; k++) {
h = effects[k];
if (k === 0 && !alreadySubscribed(h.animateOutCompleteEvent, this.hideEvent.fire, this.hideEvent)) {
h.animateOutCompleteEvent.subscribe(this.hideEvent.fire, this.hideEvent, true);
}
h.animateOut();
}
}
} else if (currentVis === "") {
this._setDomVisibility(false);
}
} else { // Simple hide
if (currentVis == "visible" || currentVis === "") {
if (this.beforeHideEvent.fire()) {
this._setDomVisibility(false);
this.hideEvent.fire();
}
} else {
this._setDomVisibility(false);
}
}
}
},
/**
* Fixed center event handler used for centering on scroll/resize, but only if
* the overlay is visible and, if "fixedcenter" is set to "contained", only if
* the overlay fits within the viewport.
*
* @method doCenterOnDOMEvent
*/
doCenterOnDOMEvent: function () {
var cfg = this.cfg,
fc = cfg.getProperty("fixedcenter");
if (cfg.getProperty("visible")) {
if (fc && (fc !== _CONTAINED || this.fitsInViewport())) {
this.center();
}
}
},
/**
* Determines if the Overlay (including the offset value defined by Overlay.VIEWPORT_OFFSET)
* will fit entirely inside the viewport, in both dimensions - width and height.
*
* @method fitsInViewport
* @return boolean true if the Overlay will fit, false if not
*/
fitsInViewport : function() {
var nViewportOffset = Overlay.VIEWPORT_OFFSET,
element = this.element,
elementWidth = element.offsetWidth,
elementHeight = element.offsetHeight,
viewportWidth = Dom.getViewportWidth(),
viewportHeight = Dom.getViewportHeight();
return ((elementWidth + nViewportOffset < viewportWidth) && (elementHeight + nViewportOffset < viewportHeight));
},
/**
* The default event handler fired when the "fixedcenter" property
* is changed.
* @method configFixedCenter
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
configFixedCenter: function (type, args, obj) {
var val = args[0],
alreadySubscribed = Config.alreadySubscribed,
windowResizeEvent = Overlay.windowResizeEvent,
windowScrollEvent = Overlay.windowScrollEvent;
if (val) {
this.center();
if (!alreadySubscribed(this.beforeShowEvent, this.center)) {
this.beforeShowEvent.subscribe(this.center);
}
if (!alreadySubscribed(windowResizeEvent, this.doCenterOnDOMEvent, this)) {
windowResizeEvent.subscribe(this.doCenterOnDOMEvent, this, true);
}
if (!alreadySubscribed(windowScrollEvent, this.doCenterOnDOMEvent, this)) {
windowScrollEvent.subscribe(this.doCenterOnDOMEvent, this, true);
}
} else {
this.beforeShowEvent.unsubscribe(this.center);
windowResizeEvent.unsubscribe(this.doCenterOnDOMEvent, this);
windowScrollEvent.unsubscribe(this.doCenterOnDOMEvent, this);
}
},
/**
* The default event handler fired when the "height" property is changed.
* @method configHeight
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
configHeight: function (type, args, obj) {
var height = args[0],
el = this.element;
Dom.setStyle(el, "height", height);
this.cfg.refireEvent("iframe");
},
/**
* The default event handler fired when the "autofillheight" property is changed.
* @method configAutoFillHeight
*
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
configAutoFillHeight: function (type, args, obj) {
var fillEl = args[0],
cfg = this.cfg,
autoFillHeight = "autofillheight",
height = "height",
currEl = cfg.getProperty(autoFillHeight),
autoFill = this._autoFillOnHeightChange;
cfg.unsubscribeFromConfigEvent(height, autoFill);
Module.textResizeEvent.unsubscribe(autoFill);
this.changeContentEvent.unsubscribe(autoFill);
if (currEl && fillEl !== currEl && this[currEl]) {
Dom.setStyle(this[currEl], height, "");
}
if (fillEl) {
fillEl = Lang.trim(fillEl.toLowerCase());
cfg.subscribeToConfigEvent(height, autoFill, this[fillEl], this);
Module.textResizeEvent.subscribe(autoFill, this[fillEl], this);
this.changeContentEvent.subscribe(autoFill, this[fillEl], this);
cfg.setProperty(autoFillHeight, fillEl, true);
}
},
/**
* The default event handler fired when the "width" property is changed.
* @method configWidth
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
configWidth: function (type, args, obj) {
var width = args[0],
el = this.element;
Dom.setStyle(el, "width", width);
this.cfg.refireEvent("iframe");
},
/**
* The default event handler fired when the "zIndex" property is changed.
* @method configzIndex
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
configzIndex: function (type, args, obj) {
var zIndex = args[0],
el = this.element;
if (! zIndex) {
zIndex = Dom.getStyle(el, "zIndex");
if (! zIndex || isNaN(zIndex)) {
zIndex = 0;
}
}
if (this.iframe || this.cfg.getProperty("iframe") === true) {
if (zIndex <= 0) {
zIndex = 1;
}
}
Dom.setStyle(el, "zIndex", zIndex);
this.cfg.setProperty("zIndex", zIndex, true);
if (this.iframe) {
this.stackIframe();
}
},
/**
* The default event handler fired when the "xy" property is changed.
* @method configXY
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
configXY: function (type, args, obj) {
var pos = args[0],
x = pos[0],
y = pos[1];
this.cfg.setProperty("x", x);
this.cfg.setProperty("y", y);
this.beforeMoveEvent.fire([x, y]);
x = this.cfg.getProperty("x");
y = this.cfg.getProperty("y");
YAHOO.log(("xy: " + [x, y]), "iframe");
this.cfg.refireEvent("iframe");
this.moveEvent.fire([x, y]);
},
/**
* The default event handler fired when the "x" property is changed.
* @method configX
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
configX: function (type, args, obj) {
var x = args[0],
y = this.cfg.getProperty("y");
this.cfg.setProperty("x", x, true);
this.cfg.setProperty("y", y, true);
this.beforeMoveEvent.fire([x, y]);
x = this.cfg.getProperty("x");
y = this.cfg.getProperty("y");
Dom.setX(this.element, x, true);
this.cfg.setProperty("xy", [x, y], true);
this.cfg.refireEvent("iframe");
this.moveEvent.fire([x, y]);
},
/**
* The default event handler fired when the "y" property is changed.
* @method configY
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
configY: function (type, args, obj) {
var x = this.cfg.getProperty("x"),
y = args[0];
this.cfg.setProperty("x", x, true);
this.cfg.setProperty("y", y, true);
this.beforeMoveEvent.fire([x, y]);
x = this.cfg.getProperty("x");
y = this.cfg.getProperty("y");
Dom.setY(this.element, y, true);
this.cfg.setProperty("xy", [x, y], true);
this.cfg.refireEvent("iframe");
this.moveEvent.fire([x, y]);
},
/**
* Shows the iframe shim, if it has been enabled.
* @method showIframe
*/
showIframe: function () {
var oIFrame = this.iframe,
oParentNode;
if (oIFrame) {
oParentNode = this.element.parentNode;
if (oParentNode != oIFrame.parentNode) {
this._addToParent(oParentNode, oIFrame);
}
oIFrame.style.display = "block";
}
},
/**
* Hides the iframe shim, if it has been enabled.
* @method hideIframe
*/
hideIframe: function () {
if (this.iframe) {
this.iframe.style.display = "none";
}
},
/**
* Syncronizes the size and position of iframe shim to that of its
* corresponding Overlay instance.
* @method syncIframe
*/
syncIframe: function () {
var oIFrame = this.iframe,
oElement = this.element,
nOffset = Overlay.IFRAME_OFFSET,
nDimensionOffset = (nOffset * 2),
aXY;
if (oIFrame) {
// Size <iframe>
oIFrame.style.width = (oElement.offsetWidth + nDimensionOffset + "px");
oIFrame.style.height = (oElement.offsetHeight + nDimensionOffset + "px");
// Position <iframe>
aXY = this.cfg.getProperty("xy");
if (!Lang.isArray(aXY) || (isNaN(aXY[0]) || isNaN(aXY[1]))) {
this.syncPosition();
aXY = this.cfg.getProperty("xy");
}
Dom.setXY(oIFrame, [(aXY[0] - nOffset), (aXY[1] - nOffset)]);
}
},
/**
* Sets the zindex of the iframe shim, if it exists, based on the zindex of
* the Overlay element. The zindex of the iframe is set to be one less
* than the Overlay element's zindex.
*
* <p>NOTE: This method will not bump up the zindex of the Overlay element
* to ensure that the iframe shim has a non-negative zindex.
* If you require the iframe zindex to be 0 or higher, the zindex of
* the Overlay element should be set to a value greater than 0, before
* this method is called.
* </p>
* @method stackIframe
*/
stackIframe: function () {
if (this.iframe) {
var overlayZ = Dom.getStyle(this.element, "zIndex");
if (!YAHOO.lang.isUndefined(overlayZ) && !isNaN(overlayZ)) {
Dom.setStyle(this.iframe, "zIndex", (overlayZ - 1));
}
}
},
/**
* The default event handler fired when the "iframe" property is changed.
* @method configIframe
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
configIframe: function (type, args, obj) {
var bIFrame = args[0];
function createIFrame() {
var oIFrame = this.iframe,
oElement = this.element,
oParent;
if (!oIFrame) {
if (!m_oIFrameTemplate) {
m_oIFrameTemplate = document.createElement("iframe");
if (this.isSecure) {
m_oIFrameTemplate.src = Overlay.IFRAME_SRC;
}
/*
Set the opacity of the <iframe> to 0 so that it
doesn't modify the opacity of any transparent
elements that may be on top of it (like a shadow).
*/
if (UA.ie) {
m_oIFrameTemplate.style.filter = "alpha(opacity=0)";
/*
Need to set the "frameBorder" property to 0
supress the default <iframe> border in IE.
Setting the CSS "border" property alone
doesn't supress it.
*/
m_oIFrameTemplate.frameBorder = 0;
}
else {
m_oIFrameTemplate.style.opacity = "0";
}
m_oIFrameTemplate.style.position = "absolute";
m_oIFrameTemplate.style.border = "none";
m_oIFrameTemplate.style.margin = "0";
m_oIFrameTemplate.style.padding = "0";
m_oIFrameTemplate.style.display = "none";
m_oIFrameTemplate.tabIndex = -1;
m_oIFrameTemplate.className = Overlay.CSS_IFRAME;
}
oIFrame = m_oIFrameTemplate.cloneNode(false);
oIFrame.id = this.id + "_f";
oParent = oElement.parentNode;
var parentNode = oParent || document.body;
this._addToParent(parentNode, oIFrame);
this.iframe = oIFrame;
}
/*
Show the <iframe> before positioning it since the "setXY"
method of DOM requires the element be in the document
and visible.
*/
this.showIframe();
/*
Syncronize the size and position of the <iframe> to that
of the Overlay.
*/
this.syncIframe();
this.stackIframe();
// Add event listeners to update the <iframe> when necessary
if (!this._hasIframeEventListeners) {
this.showEvent.subscribe(this.showIframe);
this.hideEvent.subscribe(this.hideIframe);
this.changeContentEvent.subscribe(this.syncIframe);
this._hasIframeEventListeners = true;
}
}
function onBeforeShow() {
createIFrame.call(this);
this.beforeShowEvent.unsubscribe(onBeforeShow);
this._iframeDeferred = false;
}
if (bIFrame) { // <iframe> shim is enabled
if (this.cfg.getProperty("visible")) {
createIFrame.call(this);
} else {
if (!this._iframeDeferred) {
this.beforeShowEvent.subscribe(onBeforeShow);
this._iframeDeferred = true;
}
}
} else { // <iframe> shim is disabled
this.hideIframe();
if (this._hasIframeEventListeners) {
this.showEvent.unsubscribe(this.showIframe);
this.hideEvent.unsubscribe(this.hideIframe);
this.changeContentEvent.unsubscribe(this.syncIframe);
this._hasIframeEventListeners = false;
}
}
},
/**
* Set's the container's XY value from DOM if not already set.
*
* Differs from syncPosition, in that the XY value is only sync'd with DOM if
* not already set. The method also refire's the XY config property event, so any
* beforeMove, Move event listeners are invoked.
*
* @method _primeXYFromDOM
* @protected
*/
_primeXYFromDOM : function() {
if (YAHOO.lang.isUndefined(this.cfg.getProperty("xy"))) {
// Set CFG XY based on DOM XY
this.syncPosition();
// Account for XY being set silently in syncPosition (no moveTo fired/called)
this.cfg.refireEvent("xy");
this.beforeShowEvent.unsubscribe(this._primeXYFromDOM);
}
},
/**
* The default event handler fired when the "constraintoviewport"
* property is changed.
* @method configConstrainToViewport
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for
* the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
configConstrainToViewport: function (type, args, obj) {
var val = args[0];
if (val) {
if (! Config.alreadySubscribed(this.beforeMoveEvent, this.enforceConstraints, this)) {
this.beforeMoveEvent.subscribe(this.enforceConstraints, this, true);
}
if (! Config.alreadySubscribed(this.beforeShowEvent, this._primeXYFromDOM)) {
this.beforeShowEvent.subscribe(this._primeXYFromDOM);
}
} else {
this.beforeShowEvent.unsubscribe(this._primeXYFromDOM);
this.beforeMoveEvent.unsubscribe(this.enforceConstraints, this);
}
},
/**
* The default event handler fired when the "context" property
* is changed.
*
* @method configContext
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
configContext: function (type, args, obj) {
var contextArgs = args[0],
contextEl,
elementMagnetCorner,
contextMagnetCorner,
triggers,
offset,
defTriggers = this.CONTEXT_TRIGGERS;
if (contextArgs) {
contextEl = contextArgs[0];
elementMagnetCorner = contextArgs[1];
contextMagnetCorner = contextArgs[2];
triggers = contextArgs[3];
offset = contextArgs[4];
if (defTriggers && defTriggers.length > 0) {
triggers = (triggers || []).concat(defTriggers);
}
if (contextEl) {
if (typeof contextEl == "string") {
this.cfg.setProperty("context", [
document.getElementById(contextEl),
elementMagnetCorner,
contextMagnetCorner,
triggers,
offset],
true);
}
if (elementMagnetCorner && contextMagnetCorner) {
this.align(elementMagnetCorner, contextMagnetCorner, offset);
}
if (this._contextTriggers) {
// Unsubscribe Old Set
this._processTriggers(this._contextTriggers, _UNSUBSCRIBE, this._alignOnTrigger);
}
if (triggers) {
// Subscribe New Set
this._processTriggers(triggers, _SUBSCRIBE, this._alignOnTrigger);
this._contextTriggers = triggers;
}
}
}
},
/**
* Custom Event handler for context alignment triggers. Invokes the align method
*
* @method _alignOnTrigger
* @protected
*
* @param {String} type The event type (not used by the default implementation)
* @param {Any[]} args The array of arguments for the trigger event (not used by the default implementation)
*/
_alignOnTrigger: function(type, args) {
this.align();
},
/**
* Helper method to locate the custom event instance for the event name string
* passed in. As a convenience measure, any custom events passed in are returned.
*
* @method _findTriggerCE
* @private
*
* @param {String|CustomEvent} t Either a CustomEvent, or event type (e.g. "windowScroll") for which a
* custom event instance needs to be looked up from the Overlay._TRIGGER_MAP.
*/
_findTriggerCE : function(t) {
var tce = null;
if (t instanceof CustomEvent) {
tce = t;
} else if (Overlay._TRIGGER_MAP[t]) {
tce = Overlay._TRIGGER_MAP[t];
}
return tce;
},
/**
* Utility method that subscribes or unsubscribes the given
* function from the list of trigger events provided.
*
* @method _processTriggers
* @protected
*
* @param {Array[String|CustomEvent]} triggers An array of either CustomEvents, event type strings
* (e.g. "beforeShow", "windowScroll") to/from which the provided function should be
* subscribed/unsubscribed respectively.
*
* @param {String} mode Either "subscribe" or "unsubscribe", specifying whether or not
* we are subscribing or unsubscribing trigger listeners
*
* @param {Function} fn The function to be subscribed/unsubscribed to/from the trigger event.
* Context is always set to the overlay instance, and no additional object argument
* get passed to the subscribed function.
*/
_processTriggers : function(triggers, mode, fn) {
var t, tce;
for (var i = 0, l = triggers.length; i < l; ++i) {
t = triggers[i];
tce = this._findTriggerCE(t);
if (tce) {
tce[mode](fn, this, true);
} else {
this[mode](t, fn);
}
}
},
// END BUILT-IN PROPERTY EVENT HANDLERS //
/**
* Aligns the Overlay to its context element using the specified corner
* points (represented by the constants TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT,
* and BOTTOM_RIGHT.
* @method align
* @param {String} elementAlign The String representing the corner of
* the Overlay that should be aligned to the context element
* @param {String} contextAlign The corner of the context element
* that the elementAlign corner should stick to.
* @param {Number[]} xyOffset Optional. A 2 element array specifying the x and y pixel offsets which should be applied
* after aligning the element and context corners. For example, passing in [5, -10] for this value, would offset the
* Overlay by 5 pixels along the X axis (horizontally) and -10 pixels along the Y axis (vertically) after aligning the specified corners.
*/
align: function (elementAlign, contextAlign, xyOffset) {
var contextArgs = this.cfg.getProperty("context"),
me = this,
context,
element,
contextRegion;
function doAlign(v, h) {
var alignX = null, alignY = null;
switch (elementAlign) {
case Overlay.TOP_LEFT:
alignX = h;
alignY = v;
break;
case Overlay.TOP_RIGHT:
alignX = h - element.offsetWidth;
alignY = v;
break;
case Overlay.BOTTOM_LEFT:
alignX = h;
alignY = v - element.offsetHeight;
break;
case Overlay.BOTTOM_RIGHT:
alignX = h - element.offsetWidth;
alignY = v - element.offsetHeight;
break;
}
if (alignX !== null && alignY !== null) {
if (xyOffset) {
alignX += xyOffset[0];
alignY += xyOffset[1];
}
me.moveTo(alignX, alignY);
}
}
if (contextArgs) {
context = contextArgs[0];
element = this.element;
me = this;
if (! elementAlign) {
elementAlign = contextArgs[1];
}
if (! contextAlign) {
contextAlign = contextArgs[2];
}
if (!xyOffset && contextArgs[4]) {
xyOffset = contextArgs[4];
}
if (element && context) {
contextRegion = Dom.getRegion(context);
switch (contextAlign) {
case Overlay.TOP_LEFT:
doAlign(contextRegion.top, contextRegion.left);
break;
case Overlay.TOP_RIGHT:
doAlign(contextRegion.top, contextRegion.right);
break;
case Overlay.BOTTOM_LEFT:
doAlign(contextRegion.bottom, contextRegion.left);
break;
case Overlay.BOTTOM_RIGHT:
doAlign(contextRegion.bottom, contextRegion.right);
break;
}
}
}
},
/**
* The default event handler executed when the moveEvent is fired, if the
* "constraintoviewport" is set to true.
* @method enforceConstraints
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
enforceConstraints: function (type, args, obj) {
var pos = args[0];
var cXY = this.getConstrainedXY(pos[0], pos[1]);
this.cfg.setProperty("x", cXY[0], true);
this.cfg.setProperty("y", cXY[1], true);
this.cfg.setProperty("xy", cXY, true);
},
/**
* Shared implementation method for getConstrainedX and getConstrainedY.
*
* <p>
* Given a coordinate value, returns the calculated coordinate required to
* position the Overlay if it is to be constrained to the viewport, based on the
* current element size, viewport dimensions, scroll values and preventoverlap
* settings
* </p>
*
* @method _getConstrainedPos
* @protected
* @param {String} pos The coordinate which needs to be constrained, either "x" or "y"
* @param {Number} The coordinate value which needs to be constrained
* @return {Number} The constrained coordinate value
*/
_getConstrainedPos: function(pos, val) {
var overlayEl = this.element,
buffer = Overlay.VIEWPORT_OFFSET,
x = (pos == "x"),
overlaySize = (x) ? overlayEl.offsetWidth : overlayEl.offsetHeight,
viewportSize = (x) ? Dom.getViewportWidth() : Dom.getViewportHeight(),
docScroll = (x) ? Dom.getDocumentScrollLeft() : Dom.getDocumentScrollTop(),
overlapPositions = (x) ? Overlay.PREVENT_OVERLAP_X : Overlay.PREVENT_OVERLAP_Y,
context = this.cfg.getProperty("context"),
bOverlayFitsInViewport = (overlaySize + buffer < viewportSize),
bPreventContextOverlap = this.cfg.getProperty("preventcontextoverlap") && context && overlapPositions[(context[1] + context[2])],
minConstraint = docScroll + buffer,
maxConstraint = docScroll + viewportSize - overlaySize - buffer,
constrainedVal = val;
if (val < minConstraint || val > maxConstraint) {
if (bPreventContextOverlap) {
constrainedVal = this._preventOverlap(pos, context[0], overlaySize, viewportSize, docScroll);
} else {
if (bOverlayFitsInViewport) {
if (val < minConstraint) {
constrainedVal = minConstraint;
} else if (val > maxConstraint) {
constrainedVal = maxConstraint;
}
} else {
constrainedVal = minConstraint;
}
}
}
return constrainedVal;
},
/**
* Helper method, used to position the Overlap to prevent overlap with the
* context element (used when preventcontextoverlap is enabled)
*
* @method _preventOverlap
* @protected
* @param {String} pos The coordinate to prevent overlap for, either "x" or "y".
* @param {HTMLElement} contextEl The context element
* @param {Number} overlaySize The related overlay dimension value (for "x", the width, for "y", the height)
* @param {Number} viewportSize The related viewport dimension value (for "x", the width, for "y", the height)
* @param {Object} docScroll The related document scroll value (for "x", the scrollLeft, for "y", the scrollTop)
*
* @return {Number} The new coordinate value which was set to prevent overlap
*/
_preventOverlap : function(pos, contextEl, overlaySize, viewportSize, docScroll) {
var x = (pos == "x"),
buffer = Overlay.VIEWPORT_OFFSET,
overlay = this,
contextElPos = ((x) ? Dom.getX(contextEl) : Dom.getY(contextEl)) - docScroll,
contextElSize = (x) ? contextEl.offsetWidth : contextEl.offsetHeight,
minRegionSize = contextElPos - buffer,
maxRegionSize = (viewportSize - (contextElPos + contextElSize)) - buffer,
bFlipped = false,
flip = function () {
var flippedVal;
if ((overlay.cfg.getProperty(pos) - docScroll) > contextElPos) {
flippedVal = (contextElPos - overlaySize);
} else {
flippedVal = (contextElPos + contextElSize);
}
overlay.cfg.setProperty(pos, (flippedVal + docScroll), true);
return flippedVal;
},
setPosition = function () {
var displayRegionSize = ((overlay.cfg.getProperty(pos) - docScroll) > contextElPos) ? maxRegionSize : minRegionSize,
position;
if (overlaySize > displayRegionSize) {
if (bFlipped) {
/*
All possible positions and values have been
tried, but none were successful, so fall back
to the original size and position.
*/
flip();
} else {
flip();
bFlipped = true;
position = setPosition();
}
}
return position;
};
setPosition();
return this.cfg.getProperty(pos);
},
/**
* Given x coordinate value, returns the calculated x coordinate required to
* position the Overlay if it is to be constrained to the viewport, based on the
* current element size, viewport dimensions and scroll values.
*
* @param {Number} x The X coordinate value to be constrained
* @return {Number} The constrained x coordinate
*/
getConstrainedX: function (x) {
return this._getConstrainedPos("x", x);
},
/**
* Given y coordinate value, returns the calculated y coordinate required to
* position the Overlay if it is to be constrained to the viewport, based on the
* current element size, viewport dimensions and scroll values.
*
* @param {Number} y The Y coordinate value to be constrained
* @return {Number} The constrained y coordinate
*/
getConstrainedY : function (y) {
return this._getConstrainedPos("y", y);
},
/**
* Given x, y coordinate values, returns the calculated coordinates required to
* position the Overlay if it is to be constrained to the viewport, based on the
* current element size, viewport dimensions and scroll values.
*
* @param {Number} x The X coordinate value to be constrained
* @param {Number} y The Y coordinate value to be constrained
* @return {Array} The constrained x and y coordinates at index 0 and 1 respectively;
*/
getConstrainedXY: function(x, y) {
return [this.getConstrainedX(x), this.getConstrainedY(y)];
},
/**
* Centers the container in the viewport.
* @method center
*/
center: function () {
var nViewportOffset = Overlay.VIEWPORT_OFFSET,
elementWidth = this.element.offsetWidth,
elementHeight = this.element.offsetHeight,
viewPortWidth = Dom.getViewportWidth(),
viewPortHeight = Dom.getViewportHeight(),
x,
y;
if (elementWidth < viewPortWidth) {
x = (viewPortWidth / 2) - (elementWidth / 2) + Dom.getDocumentScrollLeft();
} else {
x = nViewportOffset + Dom.getDocumentScrollLeft();
}
if (elementHeight < viewPortHeight) {
y = (viewPortHeight / 2) - (elementHeight / 2) + Dom.getDocumentScrollTop();
} else {
y = nViewportOffset + Dom.getDocumentScrollTop();
}
this.cfg.setProperty("xy", [parseInt(x, 10), parseInt(y, 10)]);
this.cfg.refireEvent("iframe");
if (UA.webkit) {
this.forceContainerRedraw();
}
},
/**
* Synchronizes the Panel's "xy", "x", and "y" properties with the
* Panel's position in the DOM. This is primarily used to update
* position information during drag & drop.
* @method syncPosition
*/
syncPosition: function () {
var pos = Dom.getXY(this.element);
this.cfg.setProperty("x", pos[0], true);
this.cfg.setProperty("y", pos[1], true);
this.cfg.setProperty("xy", pos, true);
},
/**
* Event handler fired when the resize monitor element is resized.
* @method onDomResize
* @param {DOMEvent} e The resize DOM event
* @param {Object} obj The scope object
*/
onDomResize: function (e, obj) {
var me = this;
Overlay.superclass.onDomResize.call(this, e, obj);
setTimeout(function () {
me.syncPosition();
me.cfg.refireEvent("iframe");
me.cfg.refireEvent("context");
}, 0);
},
/**
* Determines the content box height of the given element (height of the element, without padding or borders) in pixels.
*
* @method _getComputedHeight
* @private
* @param {HTMLElement} el The element for which the content height needs to be determined
* @return {Number} The content box height of the given element, or null if it could not be determined.
*/
_getComputedHeight : (function() {
if (document.defaultView && document.defaultView.getComputedStyle) {
return function(el) {
var height = null;
if (el.ownerDocument && el.ownerDocument.defaultView) {
var computed = el.ownerDocument.defaultView.getComputedStyle(el, '');
if (computed) {
height = parseInt(computed.height, 10);
}
}
return (Lang.isNumber(height)) ? height : null;
};
} else {
return function(el) {
var height = null;
if (el.style.pixelHeight) {
height = el.style.pixelHeight;
}
return (Lang.isNumber(height)) ? height : null;
};
}
})(),
/**
* autofillheight validator. Verifies that the autofill value is either null
* or one of the strings : "body", "header" or "footer".
*
* @method _validateAutoFillHeight
* @protected
* @param {String} val
* @return true, if valid, false otherwise
*/
_validateAutoFillHeight : function(val) {
return (!val) || (Lang.isString(val) && Overlay.STD_MOD_RE.test(val));
},
/**
* The default custom event handler executed when the overlay's height is changed,
* if the autofillheight property has been set.
*
* @method _autoFillOnHeightChange
* @protected
* @param {String} type The event type
* @param {Array} args The array of arguments passed to event subscribers
* @param {HTMLElement} el The header, body or footer element which is to be resized to fill
* out the containers height
*/
_autoFillOnHeightChange : function(type, args, el) {
var height = this.cfg.getProperty("height");
if ((height && height !== "auto") || (height === 0)) {
this.fillHeight(el);
}
},
/**
* Returns the sub-pixel height of the el, using getBoundingClientRect, if available,
* otherwise returns the offsetHeight
* @method _getPreciseHeight
* @private
* @param {HTMLElement} el
* @return {Float} The sub-pixel height if supported by the browser, else the rounded height.
*/
_getPreciseHeight : function(el) {
var height = el.offsetHeight;
if (el.getBoundingClientRect) {
var rect = el.getBoundingClientRect();
height = rect.bottom - rect.top;
}
return height;
},
/**
* <p>
* Sets the height on the provided header, body or footer element to
* fill out the height of the container. It determines the height of the
* containers content box, based on it's configured height value, and
* sets the height of the autofillheight element to fill out any
* space remaining after the other standard module element heights
* have been accounted for.
* </p>
* <p><strong>NOTE:</strong> This method is not designed to work if an explicit
* height has not been set on the container, since for an "auto" height container,
* the heights of the header/body/footer will drive the height of the container.</p>
*
* @method fillHeight
* @param {HTMLElement} el The element which should be resized to fill out the height
* of the container element.
*/
fillHeight : function(el) {
if (el) {
var container = this.innerElement || this.element,
containerEls = [this.header, this.body, this.footer],
containerEl,
total = 0,
filled = 0,
remaining = 0,
validEl = false;
for (var i = 0, l = containerEls.length; i < l; i++) {
containerEl = containerEls[i];
if (containerEl) {
if (el !== containerEl) {
filled += this._getPreciseHeight(containerEl);
} else {
validEl = true;
}
}
}
if (validEl) {
if (UA.ie || UA.opera) {
// Need to set height to 0, to allow height to be reduced
Dom.setStyle(el, 'height', 0 + 'px');
}
total = this._getComputedHeight(container);
// Fallback, if we can't get computed value for content height
if (total === null) {
Dom.addClass(container, "yui-override-padding");
total = container.clientHeight; // Content, No Border, 0 Padding (set by yui-override-padding)
Dom.removeClass(container, "yui-override-padding");
}
remaining = Math.max(total - filled, 0);
Dom.setStyle(el, "height", remaining + "px");
// Re-adjust height if required, to account for el padding and border
if (el.offsetHeight != remaining) {
remaining = Math.max(remaining - (el.offsetHeight - remaining), 0);
}
Dom.setStyle(el, "height", remaining + "px");
}
}
},
/**
* Places the Overlay on top of all other instances of
* YAHOO.widget.Overlay.
* @method bringToTop
*/
bringToTop: function () {
var aOverlays = [],
oElement = this.element;
function compareZIndexDesc(p_oOverlay1, p_oOverlay2) {
var sZIndex1 = Dom.getStyle(p_oOverlay1, "zIndex"),
sZIndex2 = Dom.getStyle(p_oOverlay2, "zIndex"),
nZIndex1 = (!sZIndex1 || isNaN(sZIndex1)) ? 0 : parseInt(sZIndex1, 10),
nZIndex2 = (!sZIndex2 || isNaN(sZIndex2)) ? 0 : parseInt(sZIndex2, 10);
if (nZIndex1 > nZIndex2) {
return -1;
} else if (nZIndex1 < nZIndex2) {
return 1;
} else {
return 0;
}
}
function isOverlayElement(p_oElement) {
var isOverlay = Dom.hasClass(p_oElement, Overlay.CSS_OVERLAY),
Panel = YAHOO.widget.Panel;
if (isOverlay && !Dom.isAncestor(oElement, p_oElement)) {
if (Panel && Dom.hasClass(p_oElement, Panel.CSS_PANEL)) {
aOverlays[aOverlays.length] = p_oElement.parentNode;
} else {
aOverlays[aOverlays.length] = p_oElement;
}
}
}
Dom.getElementsBy(isOverlayElement, "div", document.body);
aOverlays.sort(compareZIndexDesc);
var oTopOverlay = aOverlays[0],
nTopZIndex;
if (oTopOverlay) {
nTopZIndex = Dom.getStyle(oTopOverlay, "zIndex");
if (!isNaN(nTopZIndex)) {
var bRequiresBump = false;
if (oTopOverlay != oElement) {
bRequiresBump = true;
} else if (aOverlays.length > 1) {
var nNextZIndex = Dom.getStyle(aOverlays[1], "zIndex");
// Don't rely on DOM order to stack if 2 overlays are at the same zindex.
if (!isNaN(nNextZIndex) && (nTopZIndex == nNextZIndex)) {
bRequiresBump = true;
}
}
if (bRequiresBump) {
this.cfg.setProperty("zindex", (parseInt(nTopZIndex, 10) + 2));
}
}
}
},
/**
* Removes the Overlay element from the DOM and sets all child
* elements to null.
* @method destroy
* @param {boolean} shallowPurge If true, only the parent element's DOM event listeners are purged. If false, or not provided, all children are also purged of DOM event listeners.
* NOTE: The flag is a "shallowPurge" flag, as opposed to what may be a more intuitive "purgeChildren" flag to maintain backwards compatibility with behavior prior to 2.9.0.
*/
destroy: function (shallowPurge) {
if (this.iframe) {
this.iframe.parentNode.removeChild(this.iframe);
}
this.iframe = null;
Overlay.windowResizeEvent.unsubscribe(
this.doCenterOnDOMEvent, this);
Overlay.windowScrollEvent.unsubscribe(
this.doCenterOnDOMEvent, this);
Module.textResizeEvent.unsubscribe(this._autoFillOnHeightChange);
if (this._contextTriggers) {
// Unsubscribe context triggers - to cover context triggers which listen for global
// events such as windowResize and windowScroll. Easier just to unsubscribe all
this._processTriggers(this._contextTriggers, _UNSUBSCRIBE, this._alignOnTrigger);
}
Overlay.superclass.destroy.call(this, shallowPurge);
},
/**
* Can be used to force the container to repaint/redraw it's contents.
* <p>
* By default applies and then removes a 1px bottom margin through the
* application/removal of a "yui-force-redraw" class.
* </p>
* <p>
* It is currently used by Overlay to force a repaint for webkit
* browsers, when centering.
* </p>
* @method forceContainerRedraw
*/
forceContainerRedraw : function() {
var c = this;
Dom.addClass(c.element, "yui-force-redraw");
setTimeout(function() {
Dom.removeClass(c.element, "yui-force-redraw");
}, 0);
},
/**
* Returns a String representation of the object.
* @method toString
* @return {String} The string representation of the Overlay.
*/
toString: function () {
return "Overlay " + this.id;
}
});
}());
(function () {
/**
* OverlayManager is used for maintaining the focus status of
* multiple Overlays.
* @namespace YAHOO.widget
* @namespace YAHOO.widget
* @class OverlayManager
* @constructor
* @param {Array} overlays Optional. A collection of Overlays to register
* with the manager.
* @param {Object} userConfig The object literal representing the user
* configuration of the OverlayManager
*/
YAHOO.widget.OverlayManager = function (userConfig) {
this.init(userConfig);
};
var Overlay = YAHOO.widget.Overlay,
Event = YAHOO.util.Event,
Dom = YAHOO.util.Dom,
Config = YAHOO.util.Config,
CustomEvent = YAHOO.util.CustomEvent,
OverlayManager = YAHOO.widget.OverlayManager;
/**
* The CSS class representing a focused Overlay
* @property OverlayManager.CSS_FOCUSED
* @static
* @final
* @type String
*/
OverlayManager.CSS_FOCUSED = "focused";
OverlayManager.prototype = {
/**
* The class's constructor function
* @property contructor
* @type Function
*/
constructor: OverlayManager,
/**
* The array of Overlays that are currently registered
* @property overlays
* @type YAHOO.widget.Overlay[]
*/
overlays: null,
/**
* Initializes the default configuration of the OverlayManager
* @method initDefaultConfig
*/
initDefaultConfig: function () {
/**
* The collection of registered Overlays in use by
* the OverlayManager
* @config overlays
* @type YAHOO.widget.Overlay[]
* @default null
*/
this.cfg.addProperty("overlays", { suppressEvent: true } );
/**
* The default DOM event that should be used to focus an Overlay
* @config focusevent
* @type String
* @default "mousedown"
*/
this.cfg.addProperty("focusevent", { value: "mousedown" } );
},
/**
* Initializes the OverlayManager
* @method init
* @param {Overlay[]} overlays Optional. A collection of Overlays to
* register with the manager.
* @param {Object} userConfig The object literal representing the user
* configuration of the OverlayManager
*/
init: function (userConfig) {
/**
* The OverlayManager's Config object used for monitoring
* configuration properties.
* @property cfg
* @type Config
*/
this.cfg = new Config(this);
this.initDefaultConfig();
if (userConfig) {
this.cfg.applyConfig(userConfig, true);
}
this.cfg.fireQueue();
/**
* The currently activated Overlay
* @property activeOverlay
* @private
* @type YAHOO.widget.Overlay
*/
var activeOverlay = null;
/**
* Returns the currently focused Overlay
* @method getActive
* @return {Overlay} The currently focused Overlay
*/
this.getActive = function () {
return activeOverlay;
};
/**
* Focuses the specified Overlay
* @method focus
* @param {Overlay} overlay The Overlay to focus
* @param {String} overlay The id of the Overlay to focus
*/
this.focus = function (overlay) {
var o = this.find(overlay);
if (o) {
o.focus();
}
};
/**
* Removes the specified Overlay from the manager
* @method remove
* @param {Overlay} overlay The Overlay to remove
* @param {String} overlay The id of the Overlay to remove
*/
this.remove = function (overlay) {
var o = this.find(overlay),
originalZ;
if (o) {
if (activeOverlay == o) {
activeOverlay = null;
}
var bDestroyed = (o.element === null && o.cfg === null) ? true : false;
if (!bDestroyed) {
// Set it's zindex so that it's sorted to the end.
originalZ = Dom.getStyle(o.element, "zIndex");
o.cfg.setProperty("zIndex", -1000, true);
}
this.overlays.sort(this.compareZIndexDesc);
this.overlays = this.overlays.slice(0, (this.overlays.length - 1));
o.hideEvent.unsubscribe(o.blur);
o.destroyEvent.unsubscribe(this._onOverlayDestroy, o);
o.focusEvent.unsubscribe(this._onOverlayFocusHandler, o);
o.blurEvent.unsubscribe(this._onOverlayBlurHandler, o);
if (!bDestroyed) {
Event.removeListener(o.element, this.cfg.getProperty("focusevent"), this._onOverlayElementFocus);
o.cfg.setProperty("zIndex", originalZ, true);
o.cfg.setProperty("manager", null);
}
/* _managed Flag for custom or existing. Don't want to remove existing */
if (o.focusEvent._managed) { o.focusEvent = null; }
if (o.blurEvent._managed) { o.blurEvent = null; }
if (o.focus._managed) { o.focus = null; }
if (o.blur._managed) { o.blur = null; }
}
};
/**
* Removes focus from all registered Overlays in the manager
* @method blurAll
*/
this.blurAll = function () {
var nOverlays = this.overlays.length,
i;
if (nOverlays > 0) {
i = nOverlays - 1;
do {
this.overlays[i].blur();
}
while(i--);
}
};
/**
* Updates the state of the OverlayManager and overlay, as a result of the overlay
* being blurred.
*
* @method _manageBlur
* @param {Overlay} overlay The overlay instance which got blurred.
* @protected
*/
this._manageBlur = function (overlay) {
var changed = false;
if (activeOverlay == overlay) {
Dom.removeClass(activeOverlay.element, OverlayManager.CSS_FOCUSED);
activeOverlay = null;
changed = true;
}
return changed;
};
/**
* Updates the state of the OverlayManager and overlay, as a result of the overlay
* receiving focus.
*
* @method _manageFocus
* @param {Overlay} overlay The overlay instance which got focus.
* @protected
*/
this._manageFocus = function(overlay) {
var changed = false;
if (activeOverlay != overlay) {
if (activeOverlay) {
activeOverlay.blur();
}
activeOverlay = overlay;
this.bringToTop(activeOverlay);
Dom.addClass(activeOverlay.element, OverlayManager.CSS_FOCUSED);
changed = true;
}
return changed;
};
var overlays = this.cfg.getProperty("overlays");
if (! this.overlays) {
this.overlays = [];
}
if (overlays) {
this.register(overlays);
this.overlays.sort(this.compareZIndexDesc);
}
},
/**
* @method _onOverlayElementFocus
* @description Event handler for the DOM event that is used to focus
* the Overlay instance as specified by the "focusevent"
* configuration property.
* @private
* @param {Event} p_oEvent Object representing the DOM event
* object passed back by the event utility (Event).
*/
_onOverlayElementFocus: function (p_oEvent) {
var oTarget = Event.getTarget(p_oEvent),
oClose = this.close;
if (oClose && (oTarget == oClose || Dom.isAncestor(oClose, oTarget))) {
this.blur();
} else {
this.focus();
}
},
/**
* @method _onOverlayDestroy
* @description "destroy" event handler for the Overlay.
* @private
* @param {String} p_sType String representing the name of the event
* that was fired.
* @param {Array} p_aArgs Array of arguments sent when the event
* was fired.
* @param {Overlay} p_oOverlay Object representing the overlay that
* fired the event.
*/
_onOverlayDestroy: function (p_sType, p_aArgs, p_oOverlay) {
this.remove(p_oOverlay);
},
/**
* @method _onOverlayFocusHandler
*
* @description focusEvent Handler, used to delegate to _manageFocus with the correct arguments.
*
* @private
* @param {String} p_sType String representing the name of the event
* that was fired.
* @param {Array} p_aArgs Array of arguments sent when the event
* was fired.
* @param {Overlay} p_oOverlay Object representing the overlay that
* fired the event.
*/
_onOverlayFocusHandler: function(p_sType, p_aArgs, p_oOverlay) {
this._manageFocus(p_oOverlay);
},
/**
* @method _onOverlayBlurHandler
* @description blurEvent Handler, used to delegate to _manageBlur with the correct arguments.
*
* @private
* @param {String} p_sType String representing the name of the event
* that was fired.
* @param {Array} p_aArgs Array of arguments sent when the event
* was fired.
* @param {Overlay} p_oOverlay Object representing the overlay that
* fired the event.
*/
_onOverlayBlurHandler: function(p_sType, p_aArgs, p_oOverlay) {
this._manageBlur(p_oOverlay);
},
/**
* Subscribes to the Overlay based instance focusEvent, to allow the OverlayManager to
* monitor focus state.
*
* If the instance already has a focusEvent (e.g. Menu), OverlayManager will subscribe
* to the existing focusEvent, however if a focusEvent or focus method does not exist
* on the instance, the _bindFocus method will add them, and the focus method will
* update the OverlayManager's state directly.
*
* @method _bindFocus
* @param {Overlay} overlay The overlay for which focus needs to be managed
* @protected
*/
_bindFocus : function(overlay) {
var mgr = this;
if (!overlay.focusEvent) {
overlay.focusEvent = overlay.createEvent("focus");
overlay.focusEvent.signature = CustomEvent.LIST;
overlay.focusEvent._managed = true;
} else {
overlay.focusEvent.subscribe(mgr._onOverlayFocusHandler, overlay, mgr);
}
if (!overlay.focus) {
Event.on(overlay.element, mgr.cfg.getProperty("focusevent"), mgr._onOverlayElementFocus, null, overlay);
overlay.focus = function () {
if (mgr._manageFocus(this)) {
// For Panel/Dialog
if (this.cfg.getProperty("visible") && this.focusFirst) {
this.focusFirst();
}
this.focusEvent.fire();
}
};
overlay.focus._managed = true;
}
},
/**
* Subscribes to the Overlay based instance's blurEvent to allow the OverlayManager to
* monitor blur state.
*
* If the instance already has a blurEvent (e.g. Menu), OverlayManager will subscribe
* to the existing blurEvent, however if a blurEvent or blur method does not exist
* on the instance, the _bindBlur method will add them, and the blur method
* update the OverlayManager's state directly.
*
* @method _bindBlur
* @param {Overlay} overlay The overlay for which blur needs to be managed
* @protected
*/
_bindBlur : function(overlay) {
var mgr = this;
if (!overlay.blurEvent) {
overlay.blurEvent = overlay.createEvent("blur");
overlay.blurEvent.signature = CustomEvent.LIST;
overlay.focusEvent._managed = true;
} else {
overlay.blurEvent.subscribe(mgr._onOverlayBlurHandler, overlay, mgr);
}
if (!overlay.blur) {
overlay.blur = function () {
if (mgr._manageBlur(this)) {
this.blurEvent.fire();
}
};
overlay.blur._managed = true;
}
overlay.hideEvent.subscribe(overlay.blur);
},
/**
* Subscribes to the Overlay based instance's destroyEvent, to allow the Overlay
* to be removed for the OverlayManager when destroyed.
*
* @method _bindDestroy
* @param {Overlay} overlay The overlay instance being managed
* @protected
*/
_bindDestroy : function(overlay) {
var mgr = this;
overlay.destroyEvent.subscribe(mgr._onOverlayDestroy, overlay, mgr);
},
/**
* Ensures the zIndex configuration property on the managed overlay based instance
* is set to the computed zIndex value from the DOM (with "auto" translating to 0).
*
* @method _syncZIndex
* @param {Overlay} overlay The overlay instance being managed
* @protected
*/
_syncZIndex : function(overlay) {
var zIndex = Dom.getStyle(overlay.element, "zIndex");
if (!isNaN(zIndex)) {
overlay.cfg.setProperty("zIndex", parseInt(zIndex, 10));
} else {
overlay.cfg.setProperty("zIndex", 0);
}
},
/**
* Registers an Overlay or an array of Overlays with the manager. Upon
* registration, the Overlay receives functions for focus and blur,
* along with CustomEvents for each.
*
* @method register
* @param {Overlay} overlay An Overlay to register with the manager.
* @param {Overlay[]} overlay An array of Overlays to register with
* the manager.
* @return {boolean} true if any Overlays are registered.
*/
register: function (overlay) {
var registered = false,
i,
n;
if (overlay instanceof Overlay) {
overlay.cfg.addProperty("manager", { value: this } );
this._bindFocus(overlay);
this._bindBlur(overlay);
this._bindDestroy(overlay);
this._syncZIndex(overlay);
this.overlays.push(overlay);
this.bringToTop(overlay);
registered = true;
} else if (overlay instanceof Array) {
for (i = 0, n = overlay.length; i < n; i++) {
registered = this.register(overlay[i]) || registered;
}
}
return registered;
},
/**
* Places the specified Overlay instance on top of all other
* Overlay instances.
* @method bringToTop
* @param {YAHOO.widget.Overlay} p_oOverlay Object representing an
* Overlay instance.
* @param {String} p_oOverlay String representing the id of an
* Overlay instance.
*/
bringToTop: function (p_oOverlay) {
var oOverlay = this.find(p_oOverlay),
nTopZIndex,
oTopOverlay,
aOverlays;
if (oOverlay) {
aOverlays = this.overlays;
aOverlays.sort(this.compareZIndexDesc);
oTopOverlay = aOverlays[0];
if (oTopOverlay) {
nTopZIndex = Dom.getStyle(oTopOverlay.element, "zIndex");
if (!isNaN(nTopZIndex)) {
var bRequiresBump = false;
if (oTopOverlay !== oOverlay) {
bRequiresBump = true;
} else if (aOverlays.length > 1) {
var nNextZIndex = Dom.getStyle(aOverlays[1].element, "zIndex");
// Don't rely on DOM order to stack if 2 overlays are at the same zindex.
if (!isNaN(nNextZIndex) && (nTopZIndex == nNextZIndex)) {
bRequiresBump = true;
}
}
if (bRequiresBump) {
oOverlay.cfg.setProperty("zindex", (parseInt(nTopZIndex, 10) + 2));
}
}
aOverlays.sort(this.compareZIndexDesc);
}
}
},
/**
* Attempts to locate an Overlay by instance or ID.
* @method find
* @param {Overlay} overlay An Overlay to locate within the manager
* @param {String} overlay An Overlay id to locate within the manager
* @return {Overlay} The requested Overlay, if found, or null if it
* cannot be located.
*/
find: function (overlay) {
var isInstance = overlay instanceof Overlay,
overlays = this.overlays,
n = overlays.length,
found = null,
o,
i;
if (isInstance || typeof overlay == "string") {
for (i = n-1; i >= 0; i--) {
o = overlays[i];
if ((isInstance && (o === overlay)) || (o.id == overlay)) {
found = o;
break;
}
}
}
return found;
},
/**
* Used for sorting the manager's Overlays by z-index.
* @method compareZIndexDesc
* @private
* @return {Number} 0, 1, or -1, depending on where the Overlay should
* fall in the stacking order.
*/
compareZIndexDesc: function (o1, o2) {
var zIndex1 = (o1.cfg) ? o1.cfg.getProperty("zIndex") : null, // Sort invalid (destroyed)
zIndex2 = (o2.cfg) ? o2.cfg.getProperty("zIndex") : null; // objects at bottom.
if (zIndex1 === null && zIndex2 === null) {
return 0;
} else if (zIndex1 === null){
return 1;
} else if (zIndex2 === null) {
return -1;
} else if (zIndex1 > zIndex2) {
return -1;
} else if (zIndex1 < zIndex2) {
return 1;
} else {
return 0;
}
},
/**
* Shows all Overlays in the manager.
* @method showAll
*/
showAll: function () {
var overlays = this.overlays,
n = overlays.length,
i;
for (i = n - 1; i >= 0; i--) {
overlays[i].show();
}
},
/**
* Hides all Overlays in the manager.
* @method hideAll
*/
hideAll: function () {
var overlays = this.overlays,
n = overlays.length,
i;
for (i = n - 1; i >= 0; i--) {
overlays[i].hide();
}
},
/**
* Returns a string representation of the object.
* @method toString
* @return {String} The string representation of the OverlayManager
*/
toString: function () {
return "OverlayManager";
}
};
}());
(function () {
/**
* Tooltip is an implementation of Overlay that behaves like an OS tooltip,
* displaying when the user mouses over a particular element, and
* disappearing on mouse out.
* @namespace YAHOO.widget
* @class Tooltip
* @extends YAHOO.widget.Overlay
* @constructor
* @param {String} el The element ID representing the Tooltip <em>OR</em>
* @param {HTMLElement} el The element representing the Tooltip
* @param {Object} userConfig The configuration object literal containing
* the configuration that should be set for this Overlay. See configuration
* documentation for more details.
*/
YAHOO.widget.Tooltip = function (el, userConfig) {
YAHOO.widget.Tooltip.superclass.constructor.call(this, el, userConfig);
};
var Lang = YAHOO.lang,
Event = YAHOO.util.Event,
CustomEvent = YAHOO.util.CustomEvent,
Dom = YAHOO.util.Dom,
Tooltip = YAHOO.widget.Tooltip,
UA = YAHOO.env.ua,
bIEQuirks = (UA.ie && (UA.ie <= 6 || document.compatMode == "BackCompat")),
m_oShadowTemplate,
/**
* Constant representing the Tooltip's configuration properties
* @property DEFAULT_CONFIG
* @private
* @final
* @type Object
*/
DEFAULT_CONFIG = {
"PREVENT_OVERLAP": {
key: "preventoverlap",
value: true,
validator: Lang.isBoolean,
supercedes: ["x", "y", "xy"]
},
"SHOW_DELAY": {
key: "showdelay",
value: 200,
validator: Lang.isNumber
},
"AUTO_DISMISS_DELAY": {
key: "autodismissdelay",
value: 5000,
validator: Lang.isNumber
},
"HIDE_DELAY": {
key: "hidedelay",
value: 250,
validator: Lang.isNumber
},
"TEXT": {
key: "text",
suppressEvent: true
},
"CONTAINER": {
key: "container"
},
"DISABLED": {
key: "disabled",
value: false,
suppressEvent: true
},
"XY_OFFSET": {
key: "xyoffset",
value: [0, 25],
suppressEvent: true
}
},
/**
* Constant representing the name of the Tooltip's events
* @property EVENT_TYPES
* @private
* @final
* @type Object
*/
EVENT_TYPES = {
"CONTEXT_MOUSE_OVER": "contextMouseOver",
"CONTEXT_MOUSE_OUT": "contextMouseOut",
"CONTEXT_TRIGGER": "contextTrigger"
};
/**
* Constant representing the Tooltip CSS class
* @property YAHOO.widget.Tooltip.CSS_TOOLTIP
* @static
* @final
* @type String
*/
Tooltip.CSS_TOOLTIP = "yui-tt";
function restoreOriginalWidth(sOriginalWidth, sForcedWidth) {
var oConfig = this.cfg,
sCurrentWidth = oConfig.getProperty("width");
if (sCurrentWidth == sForcedWidth) {
oConfig.setProperty("width", sOriginalWidth);
}
}
/*
changeContent event handler that sets a Tooltip instance's "width"
configuration property to the value of its root HTML
elements's offsetWidth if a specific width has not been set.
*/
function setWidthToOffsetWidth(p_sType, p_aArgs) {
if ("_originalWidth" in this) {
restoreOriginalWidth.call(this, this._originalWidth, this._forcedWidth);
}
var oBody = document.body,
oConfig = this.cfg,
sOriginalWidth = oConfig.getProperty("width"),
sNewWidth,
oClone;
if ((!sOriginalWidth || sOriginalWidth == "auto") &&
(oConfig.getProperty("container") != oBody ||
oConfig.getProperty("x") >= Dom.getViewportWidth() ||
oConfig.getProperty("y") >= Dom.getViewportHeight())) {
oClone = this.element.cloneNode(true);
oClone.style.visibility = "hidden";
oClone.style.top = "0px";
oClone.style.left = "0px";
oBody.appendChild(oClone);
sNewWidth = (oClone.offsetWidth + "px");
oBody.removeChild(oClone);
oClone = null;
oConfig.setProperty("width", sNewWidth);
oConfig.refireEvent("xy");
this._originalWidth = sOriginalWidth || "";
this._forcedWidth = sNewWidth;
}
}
// "onDOMReady" that renders the ToolTip
function onDOMReady(p_sType, p_aArgs, p_oObject) {
this.render(p_oObject);
}
// "init" event handler that automatically renders the Tooltip
function onInit() {
Event.onDOMReady(onDOMReady, this.cfg.getProperty("container"), this);
}
YAHOO.extend(Tooltip, YAHOO.widget.Overlay, {
/**
* The Tooltip initialization method. This method is automatically
* called by the constructor. A Tooltip is automatically rendered by
* the init method, and it also is set to be invisible by default,
* and constrained to viewport by default as well.
* @method init
* @param {String} el The element ID representing the Tooltip <em>OR</em>
* @param {HTMLElement} el The element representing the Tooltip
* @param {Object} userConfig The configuration object literal
* containing the configuration that should be set for this Tooltip.
* See configuration documentation for more details.
*/
init: function (el, userConfig) {
this.logger = new YAHOO.widget.LogWriter(this.toString());
Tooltip.superclass.init.call(this, el);
this.beforeInitEvent.fire(Tooltip);
Dom.addClass(this.element, Tooltip.CSS_TOOLTIP);
if (userConfig) {
this.cfg.applyConfig(userConfig, true);
}
this.cfg.queueProperty("visible", false);
this.cfg.queueProperty("constraintoviewport", true);
this.setBody("");
this.subscribe("changeContent", setWidthToOffsetWidth);
this.subscribe("init", onInit);
this.subscribe("render", this.onRender);
this.initEvent.fire(Tooltip);
},
/**
* Initializes the custom events for Tooltip
* @method initEvents
*/
initEvents: function () {
Tooltip.superclass.initEvents.call(this);
var SIGNATURE = CustomEvent.LIST;
/**
* CustomEvent fired when user mouses over a context element. Returning false from
* a subscriber to this event will prevent the tooltip from being displayed for
* the current context element.
*
* @event contextMouseOverEvent
* @param {HTMLElement} context The context element which the user just moused over
* @param {DOMEvent} e The DOM event object, associated with the mouse over
*/
this.contextMouseOverEvent = this.createEvent(EVENT_TYPES.CONTEXT_MOUSE_OVER);
this.contextMouseOverEvent.signature = SIGNATURE;
/**
* CustomEvent fired when the user mouses out of a context element.
*
* @event contextMouseOutEvent
* @param {HTMLElement} context The context element which the user just moused out of
* @param {DOMEvent} e The DOM event object, associated with the mouse out
*/
this.contextMouseOutEvent = this.createEvent(EVENT_TYPES.CONTEXT_MOUSE_OUT);
this.contextMouseOutEvent.signature = SIGNATURE;
/**
* CustomEvent fired just before the tooltip is displayed for the current context.
* <p>
* You can subscribe to this event if you need to set up the text for the
* tooltip based on the context element for which it is about to be displayed.
* </p>
* <p>This event differs from the beforeShow event in following respects:</p>
* <ol>
* <li>
* When moving from one context element to another, if the tooltip is not
* hidden (the <code>hidedelay</code> is not reached), the beforeShow and Show events will not
* be fired when the tooltip is displayed for the new context since it is already visible.
* However the contextTrigger event is always fired before displaying the tooltip for
* a new context.
* </li>
* <li>
* The trigger event provides access to the context element, allowing you to
* set the text of the tooltip based on context element for which the tooltip is
* triggered.
* </li>
* </ol>
* <p>
* It is not possible to prevent the tooltip from being displayed
* using this event. You can use the contextMouseOverEvent if you need to prevent
* the tooltip from being displayed.
* </p>
* @event contextTriggerEvent
* @param {HTMLElement} context The context element for which the tooltip is triggered
*/
this.contextTriggerEvent = this.createEvent(EVENT_TYPES.CONTEXT_TRIGGER);
this.contextTriggerEvent.signature = SIGNATURE;
},
/**
* Initializes the class's configurable properties which can be
* changed using the Overlay's Config object (cfg).
* @method initDefaultConfig
*/
initDefaultConfig: function () {
Tooltip.superclass.initDefaultConfig.call(this);
/**
* Specifies whether the Tooltip should be kept from overlapping
* its context element.
* @config preventoverlap
* @type Boolean
* @default true
*/
this.cfg.addProperty(DEFAULT_CONFIG.PREVENT_OVERLAP.key, {
value: DEFAULT_CONFIG.PREVENT_OVERLAP.value,
validator: DEFAULT_CONFIG.PREVENT_OVERLAP.validator,
supercedes: DEFAULT_CONFIG.PREVENT_OVERLAP.supercedes
});
/**
* The number of milliseconds to wait before showing a Tooltip
* on mouseover.
* @config showdelay
* @type Number
* @default 200
*/
this.cfg.addProperty(DEFAULT_CONFIG.SHOW_DELAY.key, {
handler: this.configShowDelay,
value: 200,
validator: DEFAULT_CONFIG.SHOW_DELAY.validator
});
/**
* The number of milliseconds to wait before automatically
* dismissing a Tooltip after the mouse has been resting on the
* context element.
* @config autodismissdelay
* @type Number
* @default 5000
*/
this.cfg.addProperty(DEFAULT_CONFIG.AUTO_DISMISS_DELAY.key, {
handler: this.configAutoDismissDelay,
value: DEFAULT_CONFIG.AUTO_DISMISS_DELAY.value,
validator: DEFAULT_CONFIG.AUTO_DISMISS_DELAY.validator
});
/**
* The number of milliseconds to wait before hiding a Tooltip
* after mouseout.
* @config hidedelay
* @type Number
* @default 250
*/
this.cfg.addProperty(DEFAULT_CONFIG.HIDE_DELAY.key, {
handler: this.configHideDelay,
value: DEFAULT_CONFIG.HIDE_DELAY.value,
validator: DEFAULT_CONFIG.HIDE_DELAY.validator
});
/**
* Specifies the Tooltip's text. The text is inserted into the DOM as HTML, and should be escaped by the implementor if coming from an external source.
* @config text
* @type HTML
* @default null
*/
this.cfg.addProperty(DEFAULT_CONFIG.TEXT.key, {
handler: this.configText,
suppressEvent: DEFAULT_CONFIG.TEXT.suppressEvent
});
/**
* Specifies the container element that the Tooltip's markup
* should be rendered into.
* @config container
* @type HTMLElement/String
* @default document.body
*/
this.cfg.addProperty(DEFAULT_CONFIG.CONTAINER.key, {
handler: this.configContainer,
value: document.body
});
/**
* Specifies whether or not the tooltip is disabled. Disabled tooltips
* will not be displayed. If the tooltip is driven by the title attribute
* of the context element, the title attribute will still be removed for
* disabled tooltips, to prevent default tooltip behavior.
*
* @config disabled
* @type Boolean
* @default false
*/
this.cfg.addProperty(DEFAULT_CONFIG.DISABLED.key, {
handler: this.configContainer,
value: DEFAULT_CONFIG.DISABLED.value,
supressEvent: DEFAULT_CONFIG.DISABLED.suppressEvent
});
/**
* Specifies the XY offset from the mouse position, where the tooltip should be displayed, specified
* as a 2 element array (e.g. [10, 20]);
*
* @config xyoffset
* @type Array
* @default [0, 25]
*/
this.cfg.addProperty(DEFAULT_CONFIG.XY_OFFSET.key, {
value: DEFAULT_CONFIG.XY_OFFSET.value.concat(),
supressEvent: DEFAULT_CONFIG.XY_OFFSET.suppressEvent
});
/**
* Specifies the element or elements that the Tooltip should be
* anchored to on mouseover.
* @config context
* @type HTMLElement[]/String[]
* @default null
*/
/**
* String representing the width of the Tooltip. <em>Please note:
* </em> As of version 2.3 if either no value or a value of "auto"
* is specified, and the Toolip's "container" configuration property
* is set to something other than <code>document.body</code> or
* its "context" element resides outside the immediately visible
* portion of the document, the width of the Tooltip will be
* calculated based on the offsetWidth of its root HTML and set just
* before it is made visible. The original value will be
* restored when the Tooltip is hidden. This ensures the Tooltip is
* rendered at a usable width. For more information see
* YUILibrary bug #1685496 and YUILibrary
* bug #1735423.
* @config width
* @type String
* @default null
*/
},
// BEGIN BUILT-IN PROPERTY EVENT HANDLERS //
/**
* The default event handler fired when the "text" property is changed.
* @method configText
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
configText: function (type, args, obj) {
var text = args[0];
if (text) {
this.setBody(text);
}
},
/**
* The default event handler fired when the "container" property
* is changed.
* @method configContainer
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For
* configuration handlers, args[0] will equal the newly applied value
* for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
configContainer: function (type, args, obj) {
var container = args[0];
if (typeof container == 'string') {
this.cfg.setProperty("container", document.getElementById(container), true);
}
},
/**
* @method _removeEventListeners
* @description Removes all of the DOM event handlers from the HTML
* element(s) that trigger the display of the tooltip.
* @protected
*/
_removeEventListeners: function () {
var aElements = this._context,
nElements,
oElement,
i;
if (aElements) {
nElements = aElements.length;
if (nElements > 0) {
i = nElements - 1;
do {
oElement = aElements[i];
Event.removeListener(oElement, "mouseover", this.onContextMouseOver);
Event.removeListener(oElement, "mousemove", this.onContextMouseMove);
Event.removeListener(oElement, "mouseout", this.onContextMouseOut);
}
while (i--);
}
}
},
/**
* The default event handler fired when the "context" property
* is changed.
* @method configContext
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
configContext: function (type, args, obj) {
var context = args[0],
aElements,
nElements,
oElement,
i;
if (context) {
// Normalize parameter into an array
if (! (context instanceof Array)) {
if (typeof context == "string") {
this.cfg.setProperty("context", [document.getElementById(context)], true);
} else { // Assuming this is an element
this.cfg.setProperty("context", [context], true);
}
context = this.cfg.getProperty("context");
}
// Remove any existing mouseover/mouseout listeners
this._removeEventListeners();
// Add mouseover/mouseout listeners to context elements
this._context = context;
aElements = this._context;
if (aElements) {
nElements = aElements.length;
if (nElements > 0) {
i = nElements - 1;
do {
oElement = aElements[i];
Event.on(oElement, "mouseover", this.onContextMouseOver, this);
Event.on(oElement, "mousemove", this.onContextMouseMove, this);
Event.on(oElement, "mouseout", this.onContextMouseOut, this);
}
while (i--);
}
}
}
},
// END BUILT-IN PROPERTY EVENT HANDLERS //
// BEGIN BUILT-IN DOM EVENT HANDLERS //
/**
* The default event handler fired when the user moves the mouse while
* over the context element.
* @method onContextMouseMove
* @param {DOMEvent} e The current DOM event
* @param {Object} obj The object argument
*/
onContextMouseMove: function (e, obj) {
obj.pageX = Event.getPageX(e);
obj.pageY = Event.getPageY(e);
},
/**
* The default event handler fired when the user mouses over the
* context element.
* @method onContextMouseOver
* @param {DOMEvent} e The current DOM event
* @param {Object} obj The object argument
*/
onContextMouseOver: function (e, obj) {
var context = this;
if (context.title) {
obj._tempTitle = context.title;
context.title = "";
}
// Fire first, to honor disabled set in the listner
if (obj.fireEvent("contextMouseOver", context, e) !== false && !obj.cfg.getProperty("disabled")) {
// Stop the tooltip from being hidden (set on last mouseout)
if (obj.hideProcId) {
clearTimeout(obj.hideProcId);
obj.logger.log("Clearing hide timer: " + obj.hideProcId, "time");
obj.hideProcId = null;
}
Event.on(context, "mousemove", obj.onContextMouseMove, obj);
/**
* The unique process ID associated with the thread responsible
* for showing the Tooltip.
* @type int
*/
obj.showProcId = obj.doShow(e, context);
obj.logger.log("Setting show tooltip timeout: " + obj.showProcId, "time");
}
},
/**
* The default event handler fired when the user mouses out of
* the context element.
* @method onContextMouseOut
* @param {DOMEvent} e The current DOM event
* @param {Object} obj The object argument
*/
onContextMouseOut: function (e, obj) {
var el = this;
if (obj._tempTitle) {
el.title = obj._tempTitle;
obj._tempTitle = null;
}
if (obj.showProcId) {
clearTimeout(obj.showProcId);
obj.logger.log("Clearing show timer: " + obj.showProcId, "time");
obj.showProcId = null;
}
if (obj.hideProcId) {
clearTimeout(obj.hideProcId);
obj.logger.log("Clearing hide timer: " + obj.hideProcId, "time");
obj.hideProcId = null;
}
obj.fireEvent("contextMouseOut", el, e);
obj.hideProcId = setTimeout(function () {
obj.hide();
}, obj.cfg.getProperty("hidedelay"));
},
// END BUILT-IN DOM EVENT HANDLERS //
/**
* Processes the showing of the Tooltip by setting the timeout delay
* and offset of the Tooltip.
* @method doShow
* @param {DOMEvent} e The current DOM event
* @param {HTMLElement} context The current context element
* @return {Number} The process ID of the timeout function associated
* with doShow
*/
doShow: function (e, context) {
var offset = this.cfg.getProperty("xyoffset"),
xOffset = offset[0],
yOffset = offset[1],
me = this;
if (UA.opera && context.tagName &&
context.tagName.toUpperCase() == "A") {
yOffset += 12;
}
return setTimeout(function () {
var txt = me.cfg.getProperty("text");
// title does not over-ride text
if (me._tempTitle && (txt === "" || YAHOO.lang.isUndefined(txt) || YAHOO.lang.isNull(txt))) {
me.setBody(me._tempTitle);
} else {
me.cfg.refireEvent("text");
}
me.logger.log("Show tooltip", "time");
me.moveTo(me.pageX + xOffset, me.pageY + yOffset);
if (me.cfg.getProperty("preventoverlap")) {
me.preventOverlap(me.pageX, me.pageY);
}
Event.removeListener(context, "mousemove", me.onContextMouseMove);
me.contextTriggerEvent.fire(context);
me.show();
me.hideProcId = me.doHide();
me.logger.log("Hide tooltip time active: " + me.hideProcId, "time");
}, this.cfg.getProperty("showdelay"));
},
/**
* Sets the timeout for the auto-dismiss delay, which by default is 5
* seconds, meaning that a tooltip will automatically dismiss itself
* after 5 seconds of being displayed.
* @method doHide
*/
doHide: function () {
var me = this;
me.logger.log("Setting hide tooltip timeout", "time");
return setTimeout(function () {
me.logger.log("Hide tooltip", "time");
me.hide();
}, this.cfg.getProperty("autodismissdelay"));
},
/**
* Fired when the Tooltip is moved, this event handler is used to
* prevent the Tooltip from overlapping with its context element.
* @method preventOverlay
* @param {Number} pageX The x coordinate position of the mouse pointer
* @param {Number} pageY The y coordinate position of the mouse pointer
*/
preventOverlap: function (pageX, pageY) {
var height = this.element.offsetHeight,
mousePoint = new YAHOO.util.Point(pageX, pageY),
elementRegion = Dom.getRegion(this.element);
elementRegion.top -= 5;
elementRegion.left -= 5;
elementRegion.right += 5;
elementRegion.bottom += 5;
this.logger.log("context " + elementRegion, "ttip");
this.logger.log("mouse " + mousePoint, "ttip");
if (elementRegion.contains(mousePoint)) {
this.logger.log("OVERLAP", "warn");
this.cfg.setProperty("y", (pageY - height - 5));
}
},
/**
* @method onRender
* @description "render" event handler for the Tooltip.
* @param {String} p_sType String representing the name of the event
* that was fired.
* @param {Array} p_aArgs Array of arguments sent when the event
* was fired.
*/
onRender: function (p_sType, p_aArgs) {
function sizeShadow() {
var oElement = this.element,
oShadow = this.underlay;
if (oShadow) {
oShadow.style.width = (oElement.offsetWidth + 6) + "px";
oShadow.style.height = (oElement.offsetHeight + 1) + "px";
}
}
function addShadowVisibleClass() {
Dom.addClass(this.underlay, "yui-tt-shadow-visible");
if (UA.ie) {
this.forceUnderlayRedraw();
}
}
function removeShadowVisibleClass() {
Dom.removeClass(this.underlay, "yui-tt-shadow-visible");
}
function createShadow() {
var oShadow = this.underlay,
oElement,
Module,
nIE,
me;
if (!oShadow) {
oElement = this.element;
Module = YAHOO.widget.Module;
nIE = UA.ie;
me = this;
if (!m_oShadowTemplate) {
m_oShadowTemplate = document.createElement("div");
m_oShadowTemplate.className = "yui-tt-shadow";
}
oShadow = m_oShadowTemplate.cloneNode(false);
oElement.appendChild(oShadow);
this.underlay = oShadow;
// Backward compatibility, even though it's probably
// intended to be "private", it isn't marked as such in the api docs
this._shadow = this.underlay;
addShadowVisibleClass.call(this);
this.subscribe("beforeShow", addShadowVisibleClass);
this.subscribe("hide", removeShadowVisibleClass);
if (bIEQuirks) {
window.setTimeout(function () {
sizeShadow.call(me);
}, 0);
this.cfg.subscribeToConfigEvent("width", sizeShadow);
this.cfg.subscribeToConfigEvent("height", sizeShadow);
this.subscribe("changeContent", sizeShadow);
Module.textResizeEvent.subscribe(sizeShadow, this, true);
this.subscribe("destroy", function () {
Module.textResizeEvent.unsubscribe(sizeShadow, this);
});
}
}
}
function onBeforeShow() {
createShadow.call(this);
this.unsubscribe("beforeShow", onBeforeShow);
}
if (this.cfg.getProperty("visible")) {
createShadow.call(this);
} else {
this.subscribe("beforeShow", onBeforeShow);
}
},
/**
* Forces the underlay element to be repainted, through the application/removal
* of a yui-force-redraw class to the underlay element.
*
* @method forceUnderlayRedraw
*/
forceUnderlayRedraw : function() {
var tt = this;
Dom.addClass(tt.underlay, "yui-force-redraw");
setTimeout(function() {Dom.removeClass(tt.underlay, "yui-force-redraw");}, 0);
},
/**
* Removes the Tooltip element from the DOM and sets all child
* elements to null.
* @method destroy
*/
destroy: function () {
// Remove any existing mouseover/mouseout listeners
this._removeEventListeners();
Tooltip.superclass.destroy.call(this);
},
/**
* Returns a string representation of the object.
* @method toString
* @return {String} The string representation of the Tooltip
*/
toString: function () {
return "Tooltip " + this.id;
}
});
}());
(function () {
/**
* Panel is an implementation of Overlay that behaves like an OS window,
* with a draggable header and an optional close icon at the top right.
* @namespace YAHOO.widget
* @class Panel
* @extends YAHOO.widget.Overlay
* @constructor
* @param {String} el The element ID representing the Panel <em>OR</em>
* @param {HTMLElement} el The element representing the Panel
* @param {Object} userConfig The configuration object literal containing
* the configuration that should be set for this Panel. See configuration
* documentation for more details.
*/
YAHOO.widget.Panel = function (el, userConfig) {
YAHOO.widget.Panel.superclass.constructor.call(this, el, userConfig);
};
var _currentModal = null;
var Lang = YAHOO.lang,
Util = YAHOO.util,
Dom = Util.Dom,
Event = Util.Event,
CustomEvent = Util.CustomEvent,
KeyListener = YAHOO.util.KeyListener,
Config = Util.Config,
Overlay = YAHOO.widget.Overlay,
Panel = YAHOO.widget.Panel,
UA = YAHOO.env.ua,
bIEQuirks = (UA.ie && (UA.ie <= 6 || document.compatMode == "BackCompat")),
m_oMaskTemplate,
m_oUnderlayTemplate,
m_oCloseIconTemplate,
/**
* Constant representing the name of the Panel's events
* @property EVENT_TYPES
* @private
* @final
* @type Object
*/
EVENT_TYPES = {
"BEFORE_SHOW_MASK" : "beforeShowMask",
"BEFORE_HIDE_MASK" : "beforeHideMask",
"SHOW_MASK": "showMask",
"HIDE_MASK": "hideMask",
"DRAG": "drag"
},
/**
* Constant representing the Panel's configuration properties
* @property DEFAULT_CONFIG
* @private
* @final
* @type Object
*/
DEFAULT_CONFIG = {
"CLOSE": {
key: "close",
value: true,
validator: Lang.isBoolean,
supercedes: ["visible"]
},
"DRAGGABLE": {
key: "draggable",
value: (Util.DD ? true : false),
validator: Lang.isBoolean,
supercedes: ["visible"]
},
"DRAG_ONLY" : {
key: "dragonly",
value: false,
validator: Lang.isBoolean,
supercedes: ["draggable"]
},
"UNDERLAY": {
key: "underlay",
value: "shadow",
supercedes: ["visible"]
},
"MODAL": {
key: "modal",
value: false,
validator: Lang.isBoolean,
supercedes: ["visible", "zindex"]
},
"KEY_LISTENERS": {
key: "keylisteners",
suppressEvent: true,
supercedes: ["visible"]
},
"STRINGS" : {
key: "strings",
supercedes: ["close"],
validator: Lang.isObject,
value: {
close: "Close"
}
}
};
/**
* Constant representing the default CSS class used for a Panel
* @property YAHOO.widget.Panel.CSS_PANEL
* @static
* @final
* @type String
*/
Panel.CSS_PANEL = "yui-panel";
/**
* Constant representing the default CSS class used for a Panel's
* wrapping container
* @property YAHOO.widget.Panel.CSS_PANEL_CONTAINER
* @static
* @final
* @type String
*/
Panel.CSS_PANEL_CONTAINER = "yui-panel-container";
/**
* Constant representing the default set of focusable elements
* on the pagewhich Modal Panels will prevent access to, when
* the modal mask is displayed
*
* @property YAHOO.widget.Panel.FOCUSABLE
* @static
* @type Array
*/
Panel.FOCUSABLE = [
"a",
"button",
"select",
"textarea",
"input",
"iframe"
];
// Private CustomEvent listeners
/*
"beforeRender" event handler that creates an empty header for a Panel
instance if its "draggable" configuration property is set to "true"
and no header has been created.
*/
function createHeader(p_sType, p_aArgs) {
if (!this.header && this.cfg.getProperty("draggable")) {
this.setHeader(" ");
}
}
/*
"hide" event handler that sets a Panel instance's "width"
configuration property back to its original value before
"setWidthToOffsetWidth" was called.
*/
function restoreOriginalWidth(p_sType, p_aArgs, p_oObject) {
var sOriginalWidth = p_oObject[0],
sNewWidth = p_oObject[1],
oConfig = this.cfg,
sCurrentWidth = oConfig.getProperty("width");
if (sCurrentWidth == sNewWidth) {
oConfig.setProperty("width", sOriginalWidth);
}
this.unsubscribe("hide", restoreOriginalWidth, p_oObject);
}
/*
"beforeShow" event handler that sets a Panel instance's "width"
configuration property to the value of its root HTML
elements's offsetWidth
*/
function setWidthToOffsetWidth(p_sType, p_aArgs) {
var oConfig,
sOriginalWidth,
sNewWidth;
if (bIEQuirks) {
oConfig = this.cfg;
sOriginalWidth = oConfig.getProperty("width");
if (!sOriginalWidth || sOriginalWidth == "auto") {
sNewWidth = (this.element.offsetWidth + "px");
oConfig.setProperty("width", sNewWidth);
this.subscribe("hide", restoreOriginalWidth,
[(sOriginalWidth || ""), sNewWidth]);
}
}
}
YAHOO.extend(Panel, Overlay, {
/**
* The Overlay initialization method, which is executed for Overlay and
* all of its subclasses. This method is automatically called by the
* constructor, and sets up all DOM references for pre-existing markup,
* and creates required markup if it is not already present.
* @method init
* @param {String} el The element ID representing the Overlay <em>OR</em>
* @param {HTMLElement} el The element representing the Overlay
* @param {Object} userConfig The configuration object literal
* containing the configuration that should be set for this Overlay.
* See configuration documentation for more details.
*/
init: function (el, userConfig) {
/*
Note that we don't pass the user config in here yet because
we only want it executed once, at the lowest subclass level
*/
Panel.superclass.init.call(this, el/*, userConfig*/);
this.beforeInitEvent.fire(Panel);
Dom.addClass(this.element, Panel.CSS_PANEL);
this.buildWrapper();
if (userConfig) {
this.cfg.applyConfig(userConfig, true);
}
this.subscribe("showMask", this._addFocusHandlers);
this.subscribe("hideMask", this._removeFocusHandlers);
this.subscribe("beforeRender", createHeader);
this.subscribe("render", function() {
this.setFirstLastFocusable();
this.subscribe("changeContent", this.setFirstLastFocusable);
});
this.subscribe("show", this._focusOnShow);
this.initEvent.fire(Panel);
},
/**
* @method _onElementFocus
* @private
*
* "focus" event handler for a focuable element. Used to automatically
* blur the element when it receives focus to ensure that a Panel
* instance's modality is not compromised.
*
* @param {Event} e The DOM event object
*/
_onElementFocus : function(e){
if(_currentModal === this) {
var target = Event.getTarget(e),
doc = document.documentElement,
insideDoc = (target !== doc && target !== window);
// mask and documentElement checks added for IE, which focuses on the mask when it's clicked on, and focuses on
// the documentElement, when the document scrollbars are clicked on
if (insideDoc && target !== this.element && target !== this.mask && !Dom.isAncestor(this.element, target)) {
try {
this._focusFirstModal();
} catch(err){
// Just in case we fail to focus
try {
if (insideDoc && target !== document.body) {
target.blur();
}
} catch(err2) { }
}
}
}
},
/**
* Focuses on the first element if present, otherwise falls back to the focus mechanisms used for
* modality. This method does not try/catch focus failures. The caller is responsible for catching exceptions,
* and taking remedial measures.
*
* @method _focusFirstModal
*/
_focusFirstModal : function() {
var el = this.firstElement;
if (el) {
el.focus();
} else {
if (this._modalFocus) {
this._modalFocus.focus();
} else {
this.innerElement.focus();
}
}
},
/**
* @method _addFocusHandlers
* @protected
*
* "showMask" event handler that adds a "focus" event handler to all
* focusable elements in the document to enforce a Panel instance's
* modality from being compromised.
*
* @param p_sType {String} Custom event type
* @param p_aArgs {Array} Custom event arguments
*/
_addFocusHandlers: function(p_sType, p_aArgs) {
if (!this.firstElement) {
if (UA.webkit || UA.opera) {
if (!this._modalFocus) {
this._createHiddenFocusElement();
}
} else {
this.innerElement.tabIndex = 0;
}
}
this._setTabLoop(this.firstElement, this.lastElement);
Event.onFocus(document.documentElement, this._onElementFocus, this, true);
_currentModal = this;
},
/**
* Creates a hidden focusable element, used to focus on,
* to enforce modality for browsers in which focus cannot
* be applied to the container box.
*
* @method _createHiddenFocusElement
* @private
*/
_createHiddenFocusElement : function() {
var e = document.createElement("button");
e.style.height = "1px";
e.style.width = "1px";
e.style.position = "absolute";
e.style.left = "-10000em";
e.style.opacity = 0;
e.tabIndex = -1;
this.innerElement.appendChild(e);
this._modalFocus = e;
},
/**
* @method _removeFocusHandlers
* @protected
*
* "hideMask" event handler that removes all "focus" event handlers added
* by the "addFocusEventHandlers" method.
*
* @param p_sType {String} Event type
* @param p_aArgs {Array} Event Arguments
*/
_removeFocusHandlers: function(p_sType, p_aArgs) {
Event.removeFocusListener(document.documentElement, this._onElementFocus, this);
if (_currentModal == this) {
_currentModal = null;
}
},
/**
* Focus handler for the show event
*
* @method _focusOnShow
* @param {String} type Event Type
* @param {Array} args Event arguments
* @param {Object} obj Additional data
*/
_focusOnShow : function(type, args, obj) {
if (args && args[1]) {
Event.stopEvent(args[1]);
}
if (!this.focusFirst(type, args, obj)) {
if (this.cfg.getProperty("modal")) {
this._focusFirstModal();
}
}
},
/**
* Sets focus to the first element in the Panel.
*
* @method focusFirst
* @return {Boolean} true, if successfully focused, false otherwise
*/
focusFirst: function (type, args, obj) {
var el = this.firstElement, focused = false;
if (args && args[1]) {
Event.stopEvent(args[1]);
}
if (el) {
try {
el.focus();
focused = true;
} catch(err) {
// Ignore
}
}
return focused;
},
/**
* Sets focus to the last element in the Panel.
*
* @method focusLast
* @return {Boolean} true, if successfully focused, false otherwise
*/
focusLast: function (type, args, obj) {
var el = this.lastElement, focused = false;
if (args && args[1]) {
Event.stopEvent(args[1]);
}
if (el) {
try {
el.focus();
focused = true;
} catch(err) {
// Ignore
}
}
return focused;
},
/**
* Protected internal method for setTabLoop, which can be used by
* subclasses to jump in and modify the arguments passed in if required.
*
* @method _setTabLoop
* @param {HTMLElement} firstElement
* @param {HTMLElement} lastElement
* @protected
*
*/
_setTabLoop : function(firstElement, lastElement) {
this.setTabLoop(firstElement, lastElement);
},
/**
* Sets up a tab, shift-tab loop between the first and last elements
* provided. NOTE: Sets up the preventBackTab and preventTabOut KeyListener
* instance properties, which are reset everytime this method is invoked.
*
* @method setTabLoop
* @param {HTMLElement} firstElement
* @param {HTMLElement} lastElement
*
*/
setTabLoop : function(firstElement, lastElement) {
var backTab = this.preventBackTab, tab = this.preventTabOut,
showEvent = this.showEvent, hideEvent = this.hideEvent;
if (backTab) {
backTab.disable();
showEvent.unsubscribe(backTab.enable, backTab);
hideEvent.unsubscribe(backTab.disable, backTab);
backTab = this.preventBackTab = null;
}
if (tab) {
tab.disable();
showEvent.unsubscribe(tab.enable, tab);
hideEvent.unsubscribe(tab.disable,tab);
tab = this.preventTabOut = null;
}
if (firstElement) {
this.preventBackTab = new KeyListener(firstElement,
{shift:true, keys:9},
{fn:this.focusLast, scope:this, correctScope:true}
);
backTab = this.preventBackTab;
showEvent.subscribe(backTab.enable, backTab, true);
hideEvent.subscribe(backTab.disable,backTab, true);
}
if (lastElement) {
this.preventTabOut = new KeyListener(lastElement,
{shift:false, keys:9},
{fn:this.focusFirst, scope:this, correctScope:true}
);
tab = this.preventTabOut;
showEvent.subscribe(tab.enable, tab, true);
hideEvent.subscribe(tab.disable,tab, true);
}
},
/**
* Returns an array of the currently focusable items which reside within
* Panel. The set of focusable elements the method looks for are defined
* in the Panel.FOCUSABLE static property
*
* @method getFocusableElements
* @param {HTMLElement} root element to start from.
*/
getFocusableElements : function(root) {
root = root || this.innerElement;
var focusable = {}, panel = this;
for (var i = 0; i < Panel.FOCUSABLE.length; i++) {
focusable[Panel.FOCUSABLE[i]] = true;
}
// Not looking by Tag, since we want elements in DOM order
return Dom.getElementsBy(function(el) { return panel._testIfFocusable(el, focusable); }, null, root);
},
/**
* This is the test method used by getFocusableElements, to determine which elements to
* include in the focusable elements list. Users may override this to customize behavior.
*
* @method _testIfFocusable
* @param {Object} el The element being tested
* @param {Object} focusable The hash of known focusable elements, created by an array-to-map operation on Panel.FOCUSABLE
* @protected
*/
_testIfFocusable: function(el, focusable) {
if (el.focus && el.type !== "hidden" && !el.disabled && focusable[el.tagName.toLowerCase()]) {
return true;
}
return false;
},
/**
* Sets the firstElement and lastElement instance properties
* to the first and last focusable elements in the Panel.
*
* @method setFirstLastFocusable
*/
setFirstLastFocusable : function() {
this.firstElement = null;
this.lastElement = null;
var elements = this.getFocusableElements();
this.focusableElements = elements;
if (elements.length > 0) {
this.firstElement = elements[0];
this.lastElement = elements[elements.length - 1];
}
if (this.cfg.getProperty("modal")) {
this._setTabLoop(this.firstElement, this.lastElement);
}
},
/**
* Initializes the custom events for Module which are fired
* automatically at appropriate times by the Module class.
*/
initEvents: function () {
Panel.superclass.initEvents.call(this);
var SIGNATURE = CustomEvent.LIST;
/**
* CustomEvent fired after the modality mask is shown
* @event showMaskEvent
*/
this.showMaskEvent = this.createEvent(EVENT_TYPES.SHOW_MASK);
this.showMaskEvent.signature = SIGNATURE;
/**
* CustomEvent fired before the modality mask is shown. Subscribers can return false to prevent the
* mask from being shown
* @event beforeShowMaskEvent
*/
this.beforeShowMaskEvent = this.createEvent(EVENT_TYPES.BEFORE_SHOW_MASK);
this.beforeShowMaskEvent.signature = SIGNATURE;
/**
* CustomEvent fired after the modality mask is hidden
* @event hideMaskEvent
*/
this.hideMaskEvent = this.createEvent(EVENT_TYPES.HIDE_MASK);
this.hideMaskEvent.signature = SIGNATURE;
/**
* CustomEvent fired before the modality mask is hidden. Subscribers can return false to prevent the
* mask from being hidden
* @event beforeHideMaskEvent
*/
this.beforeHideMaskEvent = this.createEvent(EVENT_TYPES.BEFORE_HIDE_MASK);
this.beforeHideMaskEvent.signature = SIGNATURE;
/**
* CustomEvent when the Panel is dragged
* @event dragEvent
*/
this.dragEvent = this.createEvent(EVENT_TYPES.DRAG);
this.dragEvent.signature = SIGNATURE;
},
/**
* Initializes the class's configurable properties which can be changed
* using the Panel's Config object (cfg).
* @method initDefaultConfig
*/
initDefaultConfig: function () {
Panel.superclass.initDefaultConfig.call(this);
// Add panel config properties //
/**
* True if the Panel should display a "close" button
* @config close
* @type Boolean
* @default true
*/
this.cfg.addProperty(DEFAULT_CONFIG.CLOSE.key, {
handler: this.configClose,
value: DEFAULT_CONFIG.CLOSE.value,
validator: DEFAULT_CONFIG.CLOSE.validator,
supercedes: DEFAULT_CONFIG.CLOSE.supercedes
});
/**
* Boolean specifying if the Panel should be draggable. The default
* value is "true" if the Drag and Drop utility is included,
* otherwise it is "false." <strong>PLEASE NOTE:</strong> There is a
* known issue in IE 6 (Strict Mode and Quirks Mode) and IE 7
* (Quirks Mode) where Panels that either don't have a value set for
* their "width" configuration property, or their "width"
* configuration property is set to "auto" will only be draggable by
* placing the mouse on the text of the Panel's header element.
* To fix this bug, draggable Panels missing a value for their
* "width" configuration property, or whose "width" configuration
* property is set to "auto" will have it set to the value of
* their root HTML element's offsetWidth before they are made
* visible. The calculated width is then removed when the Panel is
* hidden. <em>This fix is only applied to draggable Panels in IE 6
* (Strict Mode and Quirks Mode) and IE 7 (Quirks Mode)</em>. For
* more information on this issue see:
* YUILibrary bugs #1726972 and #1589210.
* @config draggable
* @type Boolean
* @default true
*/
this.cfg.addProperty(DEFAULT_CONFIG.DRAGGABLE.key, {
handler: this.configDraggable,
value: (Util.DD) ? true : false,
validator: DEFAULT_CONFIG.DRAGGABLE.validator,
supercedes: DEFAULT_CONFIG.DRAGGABLE.supercedes
});
/**
* Boolean specifying if the draggable Panel should be drag only, not interacting with drop
* targets on the page.
* <p>
* When set to true, draggable Panels will not check to see if they are over drop targets,
* or fire the DragDrop events required to support drop target interaction (onDragEnter,
* onDragOver, onDragOut, onDragDrop etc.).
* If the Panel is not designed to be dropped on any target elements on the page, then this
* flag can be set to true to improve performance.
* </p>
* <p>
* When set to false, all drop target related events will be fired.
* </p>
* <p>
* The property is set to false by default to maintain backwards compatibility but should be
* set to true if drop target interaction is not required for the Panel, to improve performance.</p>
*
* @config dragOnly
* @type Boolean
* @default false
*/
this.cfg.addProperty(DEFAULT_CONFIG.DRAG_ONLY.key, {
value: DEFAULT_CONFIG.DRAG_ONLY.value,
validator: DEFAULT_CONFIG.DRAG_ONLY.validator,
supercedes: DEFAULT_CONFIG.DRAG_ONLY.supercedes
});
/**
* Sets the type of underlay to display for the Panel. Valid values
* are "shadow," "matte," and "none". <strong>PLEASE NOTE:</strong>
* The creation of the underlay element is deferred until the Panel
* is initially made visible. For Gecko-based browsers on Mac
* OS X the underlay elment is always created as it is used as a
* shim to prevent Aqua scrollbars below a Panel instance from poking
* through it (See YUILibrary bug #1723530).
* @config underlay
* @type String
* @default shadow
*/
this.cfg.addProperty(DEFAULT_CONFIG.UNDERLAY.key, {
handler: this.configUnderlay,
value: DEFAULT_CONFIG.UNDERLAY.value,
supercedes: DEFAULT_CONFIG.UNDERLAY.supercedes
});
/**
* True if the Panel should be displayed in a modal fashion,
* automatically creating a transparent mask over the document that
* will not be removed until the Panel is dismissed.
* @config modal
* @type Boolean
* @default false
*/
this.cfg.addProperty(DEFAULT_CONFIG.MODAL.key, {
handler: this.configModal,
value: DEFAULT_CONFIG.MODAL.value,
validator: DEFAULT_CONFIG.MODAL.validator,
supercedes: DEFAULT_CONFIG.MODAL.supercedes
});
/**
* A KeyListener (or array of KeyListeners) that will be enabled
* when the Panel is shown, and disabled when the Panel is hidden.
* @config keylisteners
* @type YAHOO.util.KeyListener[]
* @default null
*/
this.cfg.addProperty(DEFAULT_CONFIG.KEY_LISTENERS.key, {
handler: this.configKeyListeners,
suppressEvent: DEFAULT_CONFIG.KEY_LISTENERS.suppressEvent,
supercedes: DEFAULT_CONFIG.KEY_LISTENERS.supercedes
});
/**
* UI Strings used by the Panel. The strings are inserted into the DOM as HTML, and should be escaped by the implementor if coming from an external source.
*
* @config strings
* @type Object
* @default An object literal with the properties shown below:
* <dl>
* <dt>close</dt><dd><em>HTML</em> : The markup to use as the label for the close icon. Defaults to "Close".</dd>
* </dl>
*/
this.cfg.addProperty(DEFAULT_CONFIG.STRINGS.key, {
value:DEFAULT_CONFIG.STRINGS.value,
handler:this.configStrings,
validator:DEFAULT_CONFIG.STRINGS.validator,
supercedes:DEFAULT_CONFIG.STRINGS.supercedes
});
},
// BEGIN BUILT-IN PROPERTY EVENT HANDLERS //
/**
* The default event handler fired when the "close" property is changed.
* The method controls the appending or hiding of the close icon at the
* top right of the Panel.
* @method configClose
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
configClose: function (type, args, obj) {
var val = args[0],
oClose = this.close,
strings = this.cfg.getProperty("strings"),
fc;
if (val) {
if (!oClose) {
if (!m_oCloseIconTemplate) {
m_oCloseIconTemplate = document.createElement("a");
m_oCloseIconTemplate.className = "container-close";
m_oCloseIconTemplate.href = "#";
}
oClose = m_oCloseIconTemplate.cloneNode(true);
fc = this.innerElement.firstChild;
if (fc) {
this.innerElement.insertBefore(oClose, fc);
} else {
this.innerElement.appendChild(oClose);
}
oClose.innerHTML = (strings && strings.close) ? strings.close : " ";
Event.on(oClose, "click", this._doClose, this, true);
this.close = oClose;
} else {
oClose.style.display = "block";
}
} else {
if (oClose) {
oClose.style.display = "none";
}
}
},
/**
* Event handler for the close icon
*
* @method _doClose
* @protected
*
* @param {DOMEvent} e
*/
_doClose : function (e) {
Event.preventDefault(e);
this.hide();
},
/**
* The default event handler fired when the "draggable" property
* is changed.
* @method configDraggable
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
configDraggable: function (type, args, obj) {
var val = args[0];
if (val) {
if (!Util.DD) {
YAHOO.log("DD dependency not met.", "error");
this.cfg.setProperty("draggable", false);
return;
}
if (this.header) {
Dom.setStyle(this.header, "cursor", "move");
this.registerDragDrop();
}
this.subscribe("beforeShow", setWidthToOffsetWidth);
} else {
if (this.dd) {
this.dd.unreg();
}
if (this.header) {
Dom.setStyle(this.header,"cursor","auto");
}
this.unsubscribe("beforeShow", setWidthToOffsetWidth);
}
},
/**
* The default event handler fired when the "underlay" property
* is changed.
* @method configUnderlay
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
configUnderlay: function (type, args, obj) {
var bMacGecko = (this.platform == "mac" && UA.gecko),
sUnderlay = args[0].toLowerCase(),
oUnderlay = this.underlay,
oElement = this.element;
function createUnderlay() {
var bNew = false;
if (!oUnderlay) { // create if not already in DOM
if (!m_oUnderlayTemplate) {
m_oUnderlayTemplate = document.createElement("div");
m_oUnderlayTemplate.className = "underlay";
}
oUnderlay = m_oUnderlayTemplate.cloneNode(false);
this.element.appendChild(oUnderlay);
this.underlay = oUnderlay;
if (bIEQuirks) {
this.sizeUnderlay();
this.cfg.subscribeToConfigEvent("width", this.sizeUnderlay);
this.cfg.subscribeToConfigEvent("height", this.sizeUnderlay);
this.changeContentEvent.subscribe(this.sizeUnderlay);
YAHOO.widget.Module.textResizeEvent.subscribe(this.sizeUnderlay, this, true);
}
if (UA.webkit && UA.webkit < 420) {
this.changeContentEvent.subscribe(this.forceUnderlayRedraw);
}
bNew = true;
}
}
function onBeforeShow() {
var bNew = createUnderlay.call(this);
if (!bNew && bIEQuirks) {
this.sizeUnderlay();
}
this._underlayDeferred = false;
this.beforeShowEvent.unsubscribe(onBeforeShow);
}
function destroyUnderlay() {
if (this._underlayDeferred) {
this.beforeShowEvent.unsubscribe(onBeforeShow);
this._underlayDeferred = false;
}
if (oUnderlay) {
this.cfg.unsubscribeFromConfigEvent("width", this.sizeUnderlay);
this.cfg.unsubscribeFromConfigEvent("height",this.sizeUnderlay);
this.changeContentEvent.unsubscribe(this.sizeUnderlay);
this.changeContentEvent.unsubscribe(this.forceUnderlayRedraw);
YAHOO.widget.Module.textResizeEvent.unsubscribe(this.sizeUnderlay, this, true);
this.element.removeChild(oUnderlay);
this.underlay = null;
}
}
switch (sUnderlay) {
case "shadow":
Dom.removeClass(oElement, "matte");
Dom.addClass(oElement, "shadow");
break;
case "matte":
if (!bMacGecko) {
destroyUnderlay.call(this);
}
Dom.removeClass(oElement, "shadow");
Dom.addClass(oElement, "matte");
break;
default:
if (!bMacGecko) {
destroyUnderlay.call(this);
}
Dom.removeClass(oElement, "shadow");
Dom.removeClass(oElement, "matte");
break;
}
if ((sUnderlay == "shadow") || (bMacGecko && !oUnderlay)) {
if (this.cfg.getProperty("visible")) {
var bNew = createUnderlay.call(this);
if (!bNew && bIEQuirks) {
this.sizeUnderlay();
}
} else {
if (!this._underlayDeferred) {
this.beforeShowEvent.subscribe(onBeforeShow);
this._underlayDeferred = true;
}
}
}
},
/**
* The default event handler fired when the "modal" property is
* changed. This handler subscribes or unsubscribes to the show and hide
* events to handle the display or hide of the modality mask.
* @method configModal
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
configModal: function (type, args, obj) {
var modal = args[0];
if (modal) {
if (!this._hasModalityEventListeners) {
this.subscribe("beforeShow", this.buildMask);
this.subscribe("beforeShow", this.bringToTop);
this.subscribe("beforeShow", this.showMask);
this.subscribe("hide", this.hideMask);
Overlay.windowResizeEvent.subscribe(this.sizeMask,
this, true);
this._hasModalityEventListeners = true;
}
} else {
if (this._hasModalityEventListeners) {
if (this.cfg.getProperty("visible")) {
this.hideMask();
this.removeMask();
}
this.unsubscribe("beforeShow", this.buildMask);
this.unsubscribe("beforeShow", this.bringToTop);
this.unsubscribe("beforeShow", this.showMask);
this.unsubscribe("hide", this.hideMask);
Overlay.windowResizeEvent.unsubscribe(this.sizeMask, this);
this._hasModalityEventListeners = false;
}
}
},
/**
* Removes the modality mask.
* @method removeMask
*/
removeMask: function () {
var oMask = this.mask,
oParentNode;
if (oMask) {
/*
Hide the mask before destroying it to ensure that DOM
event handlers on focusable elements get removed.
*/
this.hideMask();
oParentNode = oMask.parentNode;
if (oParentNode) {
oParentNode.removeChild(oMask);
}
this.mask = null;
}
},
/**
* The default event handler fired when the "keylisteners" property
* is changed.
* @method configKeyListeners
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
configKeyListeners: function (type, args, obj) {
var listeners = args[0],
listener,
nListeners,
i;
if (listeners) {
if (listeners instanceof Array) {
nListeners = listeners.length;
for (i = 0; i < nListeners; i++) {
listener = listeners[i];
if (!Config.alreadySubscribed(this.showEvent,
listener.enable, listener)) {
this.showEvent.subscribe(listener.enable,
listener, true);
}
if (!Config.alreadySubscribed(this.hideEvent,
listener.disable, listener)) {
this.hideEvent.subscribe(listener.disable,
listener, true);
this.destroyEvent.subscribe(listener.disable,
listener, true);
}
}
} else {
if (!Config.alreadySubscribed(this.showEvent,
listeners.enable, listeners)) {
this.showEvent.subscribe(listeners.enable,
listeners, true);
}
if (!Config.alreadySubscribed(this.hideEvent,
listeners.disable, listeners)) {
this.hideEvent.subscribe(listeners.disable,
listeners, true);
this.destroyEvent.subscribe(listeners.disable,
listeners, true);
}
}
}
},
/**
* The default handler for the "strings" property
* @method configStrings
*/
configStrings : function(type, args, obj) {
var val = Lang.merge(DEFAULT_CONFIG.STRINGS.value, args[0]);
this.cfg.setProperty(DEFAULT_CONFIG.STRINGS.key, val, true);
},
/**
* The default event handler fired when the "height" property is changed.
* @method configHeight
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
configHeight: function (type, args, obj) {
var height = args[0],
el = this.innerElement;
Dom.setStyle(el, "height", height);
this.cfg.refireEvent("iframe");
},
/**
* The default custom event handler executed when the Panel's height is changed,
* if the autofillheight property has been set.
*
* @method _autoFillOnHeightChange
* @protected
* @param {String} type The event type
* @param {Array} args The array of arguments passed to event subscribers
* @param {HTMLElement} el The header, body or footer element which is to be resized to fill
* out the containers height
*/
_autoFillOnHeightChange : function(type, args, el) {
Panel.superclass._autoFillOnHeightChange.apply(this, arguments);
if (bIEQuirks) {
var panel = this;
setTimeout(function() {
panel.sizeUnderlay();
},0);
}
},
/**
* The default event handler fired when the "width" property is changed.
* @method configWidth
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
configWidth: function (type, args, obj) {
var width = args[0],
el = this.innerElement;
Dom.setStyle(el, "width", width);
this.cfg.refireEvent("iframe");
},
/**
* The default event handler fired when the "zIndex" property is changed.
* @method configzIndex
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
configzIndex: function (type, args, obj) {
Panel.superclass.configzIndex.call(this, type, args, obj);
if (this.mask || this.cfg.getProperty("modal") === true) {
var panelZ = Dom.getStyle(this.element, "zIndex");
if (!panelZ || isNaN(panelZ)) {
panelZ = 0;
}
if (panelZ === 0) {
// Recursive call to configzindex (which should be stopped
// from going further because panelZ should no longer === 0)
this.cfg.setProperty("zIndex", 1);
} else {
this.stackMask();
}
}
},
// END BUILT-IN PROPERTY EVENT HANDLERS //
/**
* Builds the wrapping container around the Panel that is used for
* positioning the shadow and matte underlays. The container element is
* assigned to a local instance variable called container, and the
* element is reinserted inside of it.
* @method buildWrapper
*/
buildWrapper: function () {
var elementParent = this.element.parentNode,
originalElement = this.element,
wrapper = document.createElement("div");
wrapper.className = Panel.CSS_PANEL_CONTAINER;
wrapper.id = originalElement.id + "_c";
if (elementParent) {
elementParent.insertBefore(wrapper, originalElement);
}
wrapper.appendChild(originalElement);
this.element = wrapper;
this.innerElement = originalElement;
Dom.setStyle(this.innerElement, "visibility", "inherit");
},
/**
* Adjusts the size of the shadow based on the size of the element.
* @method sizeUnderlay
*/
sizeUnderlay: function () {
var oUnderlay = this.underlay,
oElement;
if (oUnderlay) {
oElement = this.element;
oUnderlay.style.width = oElement.offsetWidth + "px";
oUnderlay.style.height = oElement.offsetHeight + "px";
}
},
/**
* Registers the Panel's header for drag & drop capability.
* @method registerDragDrop
*/
registerDragDrop: function () {
var me = this;
if (this.header) {
if (!Util.DD) {
YAHOO.log("DD dependency not met.", "error");
return;
}
var bDragOnly = (this.cfg.getProperty("dragonly") === true);
/**
* The YAHOO.util.DD instance, used to implement the draggable header for the panel if draggable is enabled
*
* @property dd
* @type YAHOO.util.DD
*/
this.dd = new Util.DD(this.element.id, this.id, {dragOnly: bDragOnly});
if (!this.header.id) {
this.header.id = this.id + "_h";
}
this.dd.startDrag = function () {
var offsetHeight,
offsetWidth,
viewPortWidth,
viewPortHeight,
scrollX,
scrollY;
if (YAHOO.env.ua.ie == 6) {
Dom.addClass(me.element,"drag");
}
if (me.cfg.getProperty("constraintoviewport")) {
var nViewportOffset = Overlay.VIEWPORT_OFFSET;
offsetHeight = me.element.offsetHeight;
offsetWidth = me.element.offsetWidth;
viewPortWidth = Dom.getViewportWidth();
viewPortHeight = Dom.getViewportHeight();
scrollX = Dom.getDocumentScrollLeft();
scrollY = Dom.getDocumentScrollTop();
if (offsetHeight + nViewportOffset < viewPortHeight) {
this.minY = scrollY + nViewportOffset;
this.maxY = scrollY + viewPortHeight - offsetHeight - nViewportOffset;
} else {
this.minY = scrollY + nViewportOffset;
this.maxY = scrollY + nViewportOffset;
}
if (offsetWidth + nViewportOffset < viewPortWidth) {
this.minX = scrollX + nViewportOffset;
this.maxX = scrollX + viewPortWidth - offsetWidth - nViewportOffset;
} else {
this.minX = scrollX + nViewportOffset;
this.maxX = scrollX + nViewportOffset;
}
this.constrainX = true;
this.constrainY = true;
} else {
this.constrainX = false;
this.constrainY = false;
}
me.dragEvent.fire("startDrag", arguments);
};
this.dd.onDrag = function () {
me.syncPosition();
me.cfg.refireEvent("iframe");
if (this.platform == "mac" && YAHOO.env.ua.gecko) {
this.showMacGeckoScrollbars();
}
me.dragEvent.fire("onDrag", arguments);
};
this.dd.endDrag = function () {
if (YAHOO.env.ua.ie == 6) {
Dom.removeClass(me.element,"drag");
}
me.dragEvent.fire("endDrag", arguments);
me.moveEvent.fire(me.cfg.getProperty("xy"));
};
this.dd.setHandleElId(this.header.id);
this.dd.addInvalidHandleType("INPUT");
this.dd.addInvalidHandleType("SELECT");
this.dd.addInvalidHandleType("TEXTAREA");
}
},
/**
* Builds the mask that is laid over the document when the Panel is
* configured to be modal.
* @method buildMask
*/
buildMask: function () {
var oMask = this.mask;
if (!oMask) {
if (!m_oMaskTemplate) {
m_oMaskTemplate = document.createElement("div");
m_oMaskTemplate.className = "mask";
m_oMaskTemplate.innerHTML = " ";
}
oMask = m_oMaskTemplate.cloneNode(true);
oMask.id = this.id + "_mask";
document.body.insertBefore(oMask, document.body.firstChild);
this.mask = oMask;
if (YAHOO.env.ua.gecko && this.platform == "mac") {
Dom.addClass(this.mask, "block-scrollbars");
}
// Stack mask based on the element zindex
this.stackMask();
}
},
/**
* Hides the modality mask.
* @method hideMask
*/
hideMask: function () {
if (this.cfg.getProperty("modal") && this.mask && this.beforeHideMaskEvent.fire()) {
this.mask.style.display = "none";
Dom.removeClass(document.body, "masked");
this.hideMaskEvent.fire();
}
},
/**
* Shows the modality mask.
* @method showMask
*/
showMask: function () {
if (this.cfg.getProperty("modal") && this.mask && this.beforeShowMaskEvent.fire()) {
Dom.addClass(document.body, "masked");
this.sizeMask();
this.mask.style.display = "block";
this.showMaskEvent.fire();
}
},
/**
* Sets the size of the modality mask to cover the entire scrollable
* area of the document
* @method sizeMask
*/
sizeMask: function () {
if (this.mask) {
// Shrink mask first, so it doesn't affect the document size.
var mask = this.mask,
viewWidth = Dom.getViewportWidth(),
viewHeight = Dom.getViewportHeight();
if (mask.offsetHeight > viewHeight) {
mask.style.height = viewHeight + "px";
}
if (mask.offsetWidth > viewWidth) {
mask.style.width = viewWidth + "px";
}
// Then size it to the document
mask.style.height = Dom.getDocumentHeight() + "px";
mask.style.width = Dom.getDocumentWidth() + "px";
}
},
/**
* Sets the zindex of the mask, if it exists, based on the zindex of
* the Panel element. The zindex of the mask is set to be one less
* than the Panel element's zindex.
*
* <p>NOTE: This method will not bump up the zindex of the Panel
* to ensure that the mask has a non-negative zindex. If you require the
* mask zindex to be 0 or higher, the zindex of the Panel
* should be set to a value higher than 0, before this method is called.
* </p>
* @method stackMask
*/
stackMask: function() {
if (this.mask) {
var panelZ = Dom.getStyle(this.element, "zIndex");
if (!YAHOO.lang.isUndefined(panelZ) && !isNaN(panelZ)) {
Dom.setStyle(this.mask, "zIndex", panelZ - 1);
}
}
},
/**
* Renders the Panel by inserting the elements that are not already in
* the main Panel into their correct places. Optionally appends the
* Panel to the specified node prior to the render's execution. NOTE:
* For Panels without existing markup, the appendToNode argument is
* REQUIRED. If this argument is ommitted and the current element is
* not present in the document, the function will return false,
* indicating that the render was a failure.
* @method render
* @param {String} appendToNode The element id to which the Module
* should be appended to prior to rendering <em>OR</em>
* @param {HTMLElement} appendToNode The element to which the Module
* should be appended to prior to rendering
* @return {boolean} Success or failure of the render
*/
render: function (appendToNode) {
return Panel.superclass.render.call(this, appendToNode, this.innerElement);
},
/**
* Renders the currently set header into it's proper position under the
* module element. If the module element is not provided, "this.innerElement"
* is used.
*
* @method _renderHeader
* @protected
* @param {HTMLElement} moduleElement Optional. A reference to the module element
*/
_renderHeader: function(moduleElement){
moduleElement = moduleElement || this.innerElement;
Panel.superclass._renderHeader.call(this, moduleElement);
},
/**
* Renders the currently set body into it's proper position under the
* module element. If the module element is not provided, "this.innerElement"
* is used.
*
* @method _renderBody
* @protected
* @param {HTMLElement} moduleElement Optional. A reference to the module element.
*/
_renderBody: function(moduleElement){
moduleElement = moduleElement || this.innerElement;
Panel.superclass._renderBody.call(this, moduleElement);
},
/**
* Renders the currently set footer into it's proper position under the
* module element. If the module element is not provided, "this.innerElement"
* is used.
*
* @method _renderFooter
* @protected
* @param {HTMLElement} moduleElement Optional. A reference to the module element
*/
_renderFooter: function(moduleElement){
moduleElement = moduleElement || this.innerElement;
Panel.superclass._renderFooter.call(this, moduleElement);
},
/**
* Removes the Panel element from the DOM and sets all child elements
* to null.
* @method destroy
* @param {boolean} shallowPurge If true, only the parent element's DOM event listeners are purged. If false, or not provided, all children are also purged of DOM event listeners.
* NOTE: The flag is a "shallowPurge" flag, as opposed to what may be a more intuitive "purgeChildren" flag to maintain backwards compatibility with behavior prior to 2.9.0.
*/
destroy: function (shallowPurge) {
Overlay.windowResizeEvent.unsubscribe(this.sizeMask, this);
this.removeMask();
if (this.close) {
Event.purgeElement(this.close);
}
Panel.superclass.destroy.call(this, shallowPurge);
},
/**
* Forces the underlay element to be repainted through the application/removal
* of a yui-force-redraw class to the underlay element.
*
* @method forceUnderlayRedraw
*/
forceUnderlayRedraw : function () {
var u = this.underlay;
Dom.addClass(u, "yui-force-redraw");
setTimeout(function(){Dom.removeClass(u, "yui-force-redraw");}, 0);
},
/**
* Returns a String representation of the object.
* @method toString
* @return {String} The string representation of the Panel.
*/
toString: function () {
return "Panel " + this.id;
}
});
}());
(function () {
/**
* <p>
* Dialog is an implementation of Panel that can be used to submit form
* data.
* </p>
* <p>
* Built-in functionality for buttons with event handlers is included.
* If the optional YUI Button dependancy is included on the page, the buttons
* created will be instances of YAHOO.widget.Button, otherwise regular HTML buttons
* will be created.
* </p>
* <p>
* Forms can be processed in 3 ways -- via an asynchronous Connection utility call,
* a simple form POST or GET, or manually. The YUI Connection utility should be
* included if you're using the default "async" postmethod, but is not required if
* you're using any of the other postmethod values.
* </p>
* @namespace YAHOO.widget
* @class Dialog
* @extends YAHOO.widget.Panel
* @constructor
* @param {String} el The element ID representing the Dialog <em>OR</em>
* @param {HTMLElement} el The element representing the Dialog
* @param {Object} userConfig The configuration object literal containing
* the configuration that should be set for this Dialog. See configuration
* documentation for more details.
*/
YAHOO.widget.Dialog = function (el, userConfig) {
YAHOO.widget.Dialog.superclass.constructor.call(this, el, userConfig);
};
var Event = YAHOO.util.Event,
CustomEvent = YAHOO.util.CustomEvent,
Dom = YAHOO.util.Dom,
Dialog = YAHOO.widget.Dialog,
Lang = YAHOO.lang,
/**
* Constant representing the name of the Dialog's events
* @property EVENT_TYPES
* @private
* @final
* @type Object
*/
EVENT_TYPES = {
"BEFORE_SUBMIT": "beforeSubmit",
"SUBMIT": "submit",
"MANUAL_SUBMIT": "manualSubmit",
"ASYNC_SUBMIT": "asyncSubmit",
"FORM_SUBMIT": "formSubmit",
"CANCEL": "cancel"
},
/**
* Constant representing the Dialog's configuration properties
* @property DEFAULT_CONFIG
* @private
* @final
* @type Object
*/
DEFAULT_CONFIG = {
"POST_METHOD": {
key: "postmethod",
value: "async"
},
"POST_DATA" : {
key: "postdata",
value: null
},
"BUTTONS": {
key: "buttons",
value: "none",
supercedes: ["visible"]
},
"HIDEAFTERSUBMIT" : {
key: "hideaftersubmit",
value: true
}
};
/**
* Constant representing the default CSS class used for a Dialog
* @property YAHOO.widget.Dialog.CSS_DIALOG
* @static
* @final
* @type String
*/
Dialog.CSS_DIALOG = "yui-dialog";
function removeButtonEventHandlers() {
var aButtons = this._aButtons,
nButtons,
oButton,
i;
if (Lang.isArray(aButtons)) {
nButtons = aButtons.length;
if (nButtons > 0) {
i = nButtons - 1;
do {
oButton = aButtons[i];
if (YAHOO.widget.Button && oButton instanceof YAHOO.widget.Button) {
oButton.destroy();
}
else if (oButton.tagName.toUpperCase() == "BUTTON") {
Event.purgeElement(oButton);
Event.purgeElement(oButton, false);
}
}
while (i--);
}
}
}
YAHOO.extend(Dialog, YAHOO.widget.Panel, {
/**
* @property form
* @description Object reference to the Dialog's
* <code><form></code> element.
* @default null
* @type <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/
* level-one-html.html#ID-40002357">HTMLFormElement</a>
*/
form: null,
/**
* Initializes the class's configurable properties which can be changed
* using the Dialog's Config object (cfg).
* @method initDefaultConfig
*/
initDefaultConfig: function () {
Dialog.superclass.initDefaultConfig.call(this);
/**
* The internally maintained callback object for use with the
* Connection utility. The format of the callback object is
* similar to Connection Manager's callback object and is
* simply passed through to Connection Manager when the async
* request is made.
* @property callback
* @type Object
*/
this.callback = {
/**
* The function to execute upon success of the
* Connection submission (when the form does not
* contain a file input element).
*
* @property callback.success
* @type Function
*/
success: null,
/**
* The function to execute upon failure of the
* Connection submission
* @property callback.failure
* @type Function
*/
failure: null,
/**
*<p>
* The function to execute upon success of the
* Connection submission, when the form contains
* a file input element.
* </p>
* <p>
* <em>NOTE:</em> Connection manager will not
* invoke the success or failure handlers for the file
* upload use case. This will be the only callback
* handler invoked.
* </p>
* <p>
* For more information, see the <a href="http://developer.yahoo.com/yui/connection/#file">
* Connection Manager documenation on file uploads</a>.
* </p>
* @property callback.upload
* @type Function
*/
/**
* The arbitrary argument or arguments to pass to the Connection
* callback functions
* @property callback.argument
* @type Object
*/
argument: null
};
// Add form dialog config properties //
/**
* The method to use for posting the Dialog's form. Possible values
* are "async", "form", and "manual".
* @config postmethod
* @type String
* @default async
*/
this.cfg.addProperty(DEFAULT_CONFIG.POST_METHOD.key, {
handler: this.configPostMethod,
value: DEFAULT_CONFIG.POST_METHOD.value,
validator: function (val) {
if (val != "form" && val != "async" && val != "none" &&
val != "manual") {
return false;
} else {
return true;
}
}
});
/**
* Any additional post data which needs to be sent when using the
* <a href="#config_postmethod">async</a> postmethod for dialog POST submissions.
* The format for the post data string is defined by Connection Manager's
* <a href="YAHOO.util.Connect.html#method_asyncRequest">asyncRequest</a>
* method.
* @config postdata
* @type String
* @default null
*/
this.cfg.addProperty(DEFAULT_CONFIG.POST_DATA.key, {
value: DEFAULT_CONFIG.POST_DATA.value
});
/**
* This property is used to configure whether or not the
* dialog should be automatically hidden after submit.
*
* @config hideaftersubmit
* @type Boolean
* @default true
*/
this.cfg.addProperty(DEFAULT_CONFIG.HIDEAFTERSUBMIT.key, {
value: DEFAULT_CONFIG.HIDEAFTERSUBMIT.value
});
/**
* Array of object literals, each containing a set of properties
* defining a button to be appended into the Dialog's footer.
*
* <p>Each button object in the buttons array can have three properties:</p>
* <dl>
* <dt>text:</dt>
* <dd>
* The text that will display on the face of the button. The text can
* include HTML, as long as it is compliant with HTML Button specifications. The text is added to the DOM as HTML,
* and should be escaped by the implementor if coming from an external source.
* </dd>
* <dt>handler:</dt>
* <dd>Can be either:
* <ol>
* <li>A reference to a function that should fire when the
* button is clicked. (In this case scope of this function is
* always its Dialog instance.)</li>
*
* <li>An object literal representing the code to be
* executed when the button is clicked.
*
* <p>Format:</p>
*
* <p>
* <code>{
* <br>
* <strong>fn:</strong> Function, //
* The handler to call when the event fires.
* <br>
* <strong>obj:</strong> Object, //
* An object to pass back to the handler.
* <br>
* <strong>scope:</strong> Object //
* The object to use for the scope of the handler.
* <br>
* }</code>
* </p>
* </li>
* </ol>
* </dd>
* <dt>isDefault:</dt>
* <dd>
* An optional boolean value that specifies that a button
* should be highlighted and focused by default.
* </dd>
* </dl>
*
* <em>NOTE:</em>If the YUI Button Widget is included on the page,
* the buttons created will be instances of YAHOO.widget.Button.
* Otherwise, HTML Buttons (<code><BUTTON></code>) will be
* created.
*
* @config buttons
* @type {Array|String}
* @default "none"
*/
this.cfg.addProperty(DEFAULT_CONFIG.BUTTONS.key, {
handler: this.configButtons,
value: DEFAULT_CONFIG.BUTTONS.value,
supercedes : DEFAULT_CONFIG.BUTTONS.supercedes
});
},
/**
* Initializes the custom events for Dialog which are fired
* automatically at appropriate times by the Dialog class.
* @method initEvents
*/
initEvents: function () {
Dialog.superclass.initEvents.call(this);
var SIGNATURE = CustomEvent.LIST;
/**
* CustomEvent fired prior to submission
* @event beforeSubmitEvent
*/
this.beforeSubmitEvent =
this.createEvent(EVENT_TYPES.BEFORE_SUBMIT);
this.beforeSubmitEvent.signature = SIGNATURE;
/**
* CustomEvent fired after submission
* @event submitEvent
*/
this.submitEvent = this.createEvent(EVENT_TYPES.SUBMIT);
this.submitEvent.signature = SIGNATURE;
/**
* CustomEvent fired for manual submission, before the generic submit event is fired
* @event manualSubmitEvent
*/
this.manualSubmitEvent =
this.createEvent(EVENT_TYPES.MANUAL_SUBMIT);
this.manualSubmitEvent.signature = SIGNATURE;
/**
* CustomEvent fired after asynchronous submission, before the generic submit event is fired
*
* @event asyncSubmitEvent
* @param {Object} conn The connection object, returned by YAHOO.util.Connect.asyncRequest
*/
this.asyncSubmitEvent = this.createEvent(EVENT_TYPES.ASYNC_SUBMIT);
this.asyncSubmitEvent.signature = SIGNATURE;
/**
* CustomEvent fired after form-based submission, before the generic submit event is fired
* @event formSubmitEvent
*/
this.formSubmitEvent = this.createEvent(EVENT_TYPES.FORM_SUBMIT);
this.formSubmitEvent.signature = SIGNATURE;
/**
* CustomEvent fired after cancel
* @event cancelEvent
*/
this.cancelEvent = this.createEvent(EVENT_TYPES.CANCEL);
this.cancelEvent.signature = SIGNATURE;
},
/**
* The Dialog initialization method, which is executed for Dialog and
* all of its subclasses. This method is automatically called by the
* constructor, and sets up all DOM references for pre-existing markup,
* and creates required markup if it is not already present.
*
* @method init
* @param {String} el The element ID representing the Dialog <em>OR</em>
* @param {HTMLElement} el The element representing the Dialog
* @param {Object} userConfig The configuration object literal
* containing the configuration that should be set for this Dialog.
* See configuration documentation for more details.
*/
init: function (el, userConfig) {
/*
Note that we don't pass the user config in here yet because
we only want it executed once, at the lowest subclass level
*/
Dialog.superclass.init.call(this, el/*, userConfig*/);
this.beforeInitEvent.fire(Dialog);
Dom.addClass(this.element, Dialog.CSS_DIALOG);
this.cfg.setProperty("visible", false);
if (userConfig) {
this.cfg.applyConfig(userConfig, true);
}
//this.showEvent.subscribe(this.focusFirst, this, true);
this.beforeHideEvent.subscribe(this.blurButtons, this, true);
this.subscribe("changeBody", this.registerForm);
this.initEvent.fire(Dialog);
},
/**
* Submits the Dialog's form depending on the value of the
* "postmethod" configuration property. <strong>Please note:
* </strong> As of version 2.3 this method will automatically handle
* asyncronous file uploads should the Dialog instance's form contain
* <code><input type="file"></code> elements. If a Dialog
* instance will be handling asyncronous file uploads, its
* <code>callback</code> property will need to be setup with a
* <code>upload</code> handler rather than the standard
* <code>success</code> and, or <code>failure</code> handlers. For more
* information, see the <a href="http://developer.yahoo.com/yui/
* connection/#file">Connection Manager documenation on file uploads</a>.
* @method doSubmit
*/
doSubmit: function () {
var Connect = YAHOO.util.Connect,
oForm = this.form,
bUseFileUpload = false,
bUseSecureFileUpload = false,
aElements,
nElements,
i,
formAttrs;
switch (this.cfg.getProperty("postmethod")) {
case "async":
aElements = oForm.elements;
nElements = aElements.length;
if (nElements > 0) {
i = nElements - 1;
do {
if (aElements[i].type == "file") {
bUseFileUpload = true;
break;
}
}
while(i--);
}
if (bUseFileUpload && YAHOO.env.ua.ie && this.isSecure) {
bUseSecureFileUpload = true;
}
formAttrs = this._getFormAttributes(oForm);
Connect.setForm(oForm, bUseFileUpload, bUseSecureFileUpload);
var postData = this.cfg.getProperty("postdata");
var c = Connect.asyncRequest(formAttrs.method, formAttrs.action, this.callback, postData);
this.asyncSubmitEvent.fire(c);
break;
case "form":
oForm.submit();
this.formSubmitEvent.fire();
break;
case "none":
case "manual":
this.manualSubmitEvent.fire();
break;
}
},
/**
* Retrieves important attributes (currently method and action) from
* the form element, accounting for any elements which may have the same name
* as the attributes. Defaults to "POST" and "" for method and action respectively
* if the attribute cannot be retrieved.
*
* @method _getFormAttributes
* @protected
* @param {HTMLFormElement} oForm The HTML Form element from which to retrieve the attributes
* @return {Object} Object literal, with method and action String properties.
*/
_getFormAttributes : function(oForm){
var attrs = {
method : null,
action : null
};
if (oForm) {
if (oForm.getAttributeNode) {
var action = oForm.getAttributeNode("action");
var method = oForm.getAttributeNode("method");
if (action) {
attrs.action = action.value;
}
if (method) {
attrs.method = method.value;
}
} else {
attrs.action = oForm.getAttribute("action");
attrs.method = oForm.getAttribute("method");
}
}
attrs.method = (Lang.isString(attrs.method) ? attrs.method : "POST").toUpperCase();
attrs.action = Lang.isString(attrs.action) ? attrs.action : "";
return attrs;
},
/**
* Prepares the Dialog's internal FORM object, creating one if one is
* not currently present.
* @method registerForm
*/
registerForm: function() {
var form = this.element.getElementsByTagName("form")[0];
if (this.form) {
if (this.form == form && Dom.isAncestor(this.element, this.form)) {
return;
} else {
Event.purgeElement(this.form);
this.form = null;
}
}
if (!form) {
form = document.createElement("form");
form.name = "frm_" + this.id;
this.body.appendChild(form);
}
if (form) {
this.form = form;
Event.on(form, "submit", this._submitHandler, this, true);
}
},
/**
* Internal handler for the form submit event
*
* @method _submitHandler
* @protected
* @param {DOMEvent} e The DOM Event object
*/
_submitHandler : function(e) {
Event.stopEvent(e);
this.submit();
this.form.blur();
},
/**
* Sets up a tab, shift-tab loop between the first and last elements
* provided. NOTE: Sets up the preventBackTab and preventTabOut KeyListener
* instance properties, which are reset everytime this method is invoked.
*
* @method setTabLoop
* @param {HTMLElement} firstElement
* @param {HTMLElement} lastElement
*
*/
setTabLoop : function(firstElement, lastElement) {
firstElement = firstElement || this.firstButton;
lastElement = lastElement || this.lastButton;
Dialog.superclass.setTabLoop.call(this, firstElement, lastElement);
},
/**
* Protected internal method for setTabLoop, which can be used by
* subclasses to jump in and modify the arguments passed in if required.
*
* @method _setTabLoop
* @param {HTMLElement} firstElement
* @param {HTMLElement} lastElement
* @protected
*/
_setTabLoop : function(firstElement, lastElement) {
firstElement = firstElement || this.firstButton;
lastElement = this.lastButton || lastElement;
this.setTabLoop(firstElement, lastElement);
},
/**
* Configures instance properties, pointing to the
* first and last focusable elements in the Dialog's form.
*
* @method setFirstLastFocusable
*/
setFirstLastFocusable : function() {
Dialog.superclass.setFirstLastFocusable.call(this);
var i, l, el, elements = this.focusableElements;
this.firstFormElement = null;
this.lastFormElement = null;
if (this.form && elements && elements.length > 0) {
l = elements.length;
for (i = 0; i < l; ++i) {
el = elements[i];
if (this.form === el.form) {
this.firstFormElement = el;
break;
}
}
for (i = l-1; i >= 0; --i) {
el = elements[i];
if (this.form === el.form) {
this.lastFormElement = el;
break;
}
}
}
},
// BEGIN BUILT-IN PROPERTY EVENT HANDLERS //
/**
* The default event handler fired when the "close" property is
* changed. The method controls the appending or hiding of the close
* icon at the top right of the Dialog.
* @method configClose
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For
* configuration handlers, args[0] will equal the newly applied value
* for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
configClose: function (type, args, obj) {
Dialog.superclass.configClose.apply(this, arguments);
},
/**
* Event handler for the close icon
*
* @method _doClose
* @protected
*
* @param {DOMEvent} e
*/
_doClose : function(e) {
Event.preventDefault(e);
this.cancel();
},
/**
* The default event handler for the "buttons" configuration property
* @method configButtons
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
configButtons: function (type, args, obj) {
var Button = YAHOO.widget.Button,
aButtons = args[0],
oInnerElement = this.innerElement,
oButton,
oButtonEl,
oYUIButton,
nButtons,
oSpan,
oFooter,
i;
removeButtonEventHandlers.call(this);
this._aButtons = null;
if (Lang.isArray(aButtons)) {
oSpan = document.createElement("span");
oSpan.className = "button-group";
nButtons = aButtons.length;
this._aButtons = [];
this.defaultHtmlButton = null;
for (i = 0; i < nButtons; i++) {
oButton = aButtons[i];
if (Button) {
oYUIButton = new Button({ label: oButton.text, type:oButton.type });
oYUIButton.appendTo(oSpan);
oButtonEl = oYUIButton.get("element");
if (oButton.isDefault) {
oYUIButton.addClass("default");
this.defaultHtmlButton = oButtonEl;
}
if (Lang.isFunction(oButton.handler)) {
oYUIButton.set("onclick", {
fn: oButton.handler,
obj: this,
scope: this
});
} else if (Lang.isObject(oButton.handler) && Lang.isFunction(oButton.handler.fn)) {
oYUIButton.set("onclick", {
fn: oButton.handler.fn,
obj: ((!Lang.isUndefined(oButton.handler.obj)) ? oButton.handler.obj : this),
scope: (oButton.handler.scope || this)
});
}
this._aButtons[this._aButtons.length] = oYUIButton;
} else {
oButtonEl = document.createElement("button");
oButtonEl.setAttribute("type", "button");
if (oButton.isDefault) {
oButtonEl.className = "default";
this.defaultHtmlButton = oButtonEl;
}
oButtonEl.innerHTML = oButton.text;
if (Lang.isFunction(oButton.handler)) {
Event.on(oButtonEl, "click", oButton.handler, this, true);
} else if (Lang.isObject(oButton.handler) &&
Lang.isFunction(oButton.handler.fn)) {
Event.on(oButtonEl, "click",
oButton.handler.fn,
((!Lang.isUndefined(oButton.handler.obj)) ? oButton.handler.obj : this),
(oButton.handler.scope || this));
}
oSpan.appendChild(oButtonEl);
this._aButtons[this._aButtons.length] = oButtonEl;
}
oButton.htmlButton = oButtonEl;
if (i === 0) {
this.firstButton = oButtonEl;
}
if (i == (nButtons - 1)) {
this.lastButton = oButtonEl;
}
}
this.setFooter(oSpan);
oFooter = this.footer;
if (Dom.inDocument(this.element) && !Dom.isAncestor(oInnerElement, oFooter)) {
oInnerElement.appendChild(oFooter);
}
this.buttonSpan = oSpan;
} else { // Do cleanup
oSpan = this.buttonSpan;
oFooter = this.footer;
if (oSpan && oFooter) {
oFooter.removeChild(oSpan);
this.buttonSpan = null;
this.firstButton = null;
this.lastButton = null;
this.defaultHtmlButton = null;
}
}
this.changeContentEvent.fire();
},
/**
* @method getButtons
* @description Returns an array containing each of the Dialog's
* buttons, by default an array of HTML <code><BUTTON></code>
* elements. If the Dialog's buttons were created using the
* YAHOO.widget.Button class (via the inclusion of the optional Button
* dependency on the page), an array of YAHOO.widget.Button instances
* is returned.
* @return {Array}
*/
getButtons: function () {
return this._aButtons || null;
},
/**
* <p>
* Sets focus to the first focusable element in the Dialog's form if found,
* else, the default button if found, else the first button defined via the
* "buttons" configuration property.
* </p>
* <p>
* This method is invoked when the Dialog is made visible.
* </p>
* @method focusFirst
* @return {Boolean} true, if focused. false if not
*/
focusFirst: function (type, args, obj) {
var el = this.firstFormElement,
focused = false;
if (args && args[1]) {
Event.stopEvent(args[1]);
// When tabbing here, use firstElement instead of firstFormElement
if (args[0] === 9 && this.firstElement) {
el = this.firstElement;
}
}
if (el) {
try {
el.focus();
focused = true;
} catch(oException) {
// Ignore
}
} else {
if (this.defaultHtmlButton) {
focused = this.focusDefaultButton();
} else {
focused = this.focusFirstButton();
}
}
return focused;
},
/**
* Sets focus to the last element in the Dialog's form or the last
* button defined via the "buttons" configuration property.
* @method focusLast
* @return {Boolean} true, if focused. false if not
*/
focusLast: function (type, args, obj) {
var aButtons = this.cfg.getProperty("buttons"),
el = this.lastFormElement,
focused = false;
if (args && args[1]) {
Event.stopEvent(args[1]);
// When tabbing here, use lastElement instead of lastFormElement
if (args[0] === 9 && this.lastElement) {
el = this.lastElement;
}
}
if (aButtons && Lang.isArray(aButtons)) {
focused = this.focusLastButton();
} else {
if (el) {
try {
el.focus();
focused = true;
} catch(oException) {
// Ignore
}
}
}
return focused;
},
/**
* Helper method to normalize button references. It either returns the
* YUI Button instance for the given element if found,
* or the passes back the HTMLElement reference if a corresponding YUI Button
* reference is not found or YAHOO.widget.Button does not exist on the page.
*
* @method _getButton
* @private
* @param {HTMLElement} button
* @return {YAHOO.widget.Button|HTMLElement}
*/
_getButton : function(button) {
var Button = YAHOO.widget.Button;
// If we have an HTML button and YUI Button is on the page,
// get the YUI Button reference if available.
if (Button && button && button.nodeName && button.id) {
button = Button.getButton(button.id) || button;
}
return button;
},
/**
* Sets the focus to the button that is designated as the default via
* the "buttons" configuration property. By default, this method is
* called when the Dialog is made visible.
* @method focusDefaultButton
* @return {Boolean} true if focused, false if not
*/
focusDefaultButton: function () {
var button = this._getButton(this.defaultHtmlButton),
focused = false;
if (button) {
/*
Place the call to the "focus" method inside a try/catch
block to prevent IE from throwing JavaScript errors if
the element is disabled or hidden.
*/
try {
button.focus();
focused = true;
} catch(oException) {
}
}
return focused;
},
/**
* Blurs all the buttons defined via the "buttons"
* configuration property.
* @method blurButtons
*/
blurButtons: function () {
var aButtons = this.cfg.getProperty("buttons"),
nButtons,
oButton,
oElement,
i;
if (aButtons && Lang.isArray(aButtons)) {
nButtons = aButtons.length;
if (nButtons > 0) {
i = (nButtons - 1);
do {
oButton = aButtons[i];
if (oButton) {
oElement = this._getButton(oButton.htmlButton);
if (oElement) {
/*
Place the call to the "blur" method inside
a try/catch block to prevent IE from
throwing JavaScript errors if the element
is disabled or hidden.
*/
try {
oElement.blur();
} catch(oException) {
// ignore
}
}
}
} while(i--);
}
}
},
/**
* Sets the focus to the first button created via the "buttons"
* configuration property.
* @method focusFirstButton
* @return {Boolean} true, if focused. false if not
*/
focusFirstButton: function () {
var aButtons = this.cfg.getProperty("buttons"),
oButton,
oElement,
focused = false;
if (aButtons && Lang.isArray(aButtons)) {
oButton = aButtons[0];
if (oButton) {
oElement = this._getButton(oButton.htmlButton);
if (oElement) {
/*
Place the call to the "focus" method inside a
try/catch block to prevent IE from throwing
JavaScript errors if the element is disabled
or hidden.
*/
try {
oElement.focus();
focused = true;
} catch(oException) {
// ignore
}
}
}
}
return focused;
},
/**
* Sets the focus to the last button created via the "buttons"
* configuration property.
* @method focusLastButton
* @return {Boolean} true, if focused. false if not
*/
focusLastButton: function () {
var aButtons = this.cfg.getProperty("buttons"),
nButtons,
oButton,
oElement,
focused = false;
if (aButtons && Lang.isArray(aButtons)) {
nButtons = aButtons.length;
if (nButtons > 0) {
oButton = aButtons[(nButtons - 1)];
if (oButton) {
oElement = this._getButton(oButton.htmlButton);
if (oElement) {
/*
Place the call to the "focus" method inside a
try/catch block to prevent IE from throwing
JavaScript errors if the element is disabled
or hidden.
*/
try {
oElement.focus();
focused = true;
} catch(oException) {
// Ignore
}
}
}
}
}
return focused;
},
/**
* The default event handler for the "postmethod" configuration property
* @method configPostMethod
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For
* configuration handlers, args[0] will equal the newly applied value
* for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
configPostMethod: function (type, args, obj) {
this.registerForm();
},
// END BUILT-IN PROPERTY EVENT HANDLERS //
/**
* Built-in function hook for writing a validation function that will
* be checked for a "true" value prior to a submit. This function, as
* implemented by default, always returns true, so it should be
* overridden if validation is necessary.
* @method validate
*/
validate: function () {
return true;
},
/**
* Executes a submit of the Dialog if validation
* is successful. By default the Dialog is hidden
* after submission, but you can set the "hideaftersubmit"
* configuration property to false, to prevent the Dialog
* from being hidden.
*
* @method submit
*/
submit: function () {
if (this.validate()) {
if (this.beforeSubmitEvent.fire()) {
this.doSubmit();
this.submitEvent.fire();
if (this.cfg.getProperty("hideaftersubmit")) {
this.hide();
}
return true;
} else {
return false;
}
} else {
return false;
}
},
/**
* Executes the cancel of the Dialog followed by a hide.
* @method cancel
*/
cancel: function () {
this.cancelEvent.fire();
this.hide();
},
/**
* Returns a JSON-compatible data structure representing the data
* currently contained in the form.
* @method getData
* @return {Object} A JSON object reprsenting the data of the
* current form.
*/
getData: function () {
var oForm = this.form,
aElements,
nTotalElements,
oData,
sName,
oElement,
nElements,
sType,
sTagName,
aOptions,
nOptions,
aValues,
oOption,
oRadio,
oCheckbox,
valueAttr,
i,
n;
function isFormElement(p_oElement) {
var sTag = p_oElement.tagName.toUpperCase();
return ((sTag == "INPUT" || sTag == "TEXTAREA" ||
sTag == "SELECT") && p_oElement.name == sName);
}
if (oForm) {
aElements = oForm.elements;
nTotalElements = aElements.length;
oData = {};
for (i = 0; i < nTotalElements; i++) {
sName = aElements[i].name;
/*
Using "Dom.getElementsBy" to safeguard user from JS
errors that result from giving a form field (or set of
fields) the same name as a native method of a form
(like "submit") or a DOM collection (such as the "item"
method). Originally tried accessing fields via the
"namedItem" method of the "element" collection, but
discovered that it won't return a collection of fields
in Gecko.
*/
oElement = Dom.getElementsBy(isFormElement, "*", oForm);
nElements = oElement.length;
if (nElements > 0) {
if (nElements == 1) {
oElement = oElement[0];
sType = oElement.type;
sTagName = oElement.tagName.toUpperCase();
switch (sTagName) {
case "INPUT":
if (sType == "checkbox") {
oData[sName] = oElement.checked;
} else if (sType != "radio") {
oData[sName] = oElement.value;
}
break;
case "TEXTAREA":
oData[sName] = oElement.value;
break;
case "SELECT":
aOptions = oElement.options;
nOptions = aOptions.length;
aValues = [];
for (n = 0; n < nOptions; n++) {
oOption = aOptions[n];
if (oOption.selected) {
valueAttr = oOption.attributes.value;
aValues[aValues.length] = (valueAttr && valueAttr.specified) ? oOption.value : oOption.text;
}
}
oData[sName] = aValues;
break;
}
} else {
sType = oElement[0].type;
switch (sType) {
case "radio":
for (n = 0; n < nElements; n++) {
oRadio = oElement[n];
if (oRadio.checked) {
oData[sName] = oRadio.value;
break;
}
}
break;
case "checkbox":
aValues = [];
for (n = 0; n < nElements; n++) {
oCheckbox = oElement[n];
if (oCheckbox.checked) {
aValues[aValues.length] = oCheckbox.value;
}
}
oData[sName] = aValues;
break;
}
}
}
}
}
return oData;
},
/**
* Removes the Panel element from the DOM and sets all child elements
* to null.
* @method destroy
* @param {boolean} shallowPurge If true, only the parent element's DOM event listeners are purged. If false, or not provided, all children are also purged of DOM event listeners.
* NOTE: The flag is a "shallowPurge" flag, as opposed to what may be a more intuitive "purgeChildren" flag to maintain backwards compatibility with behavior prior to 2.9.0.
*/
destroy: function (shallowPurge) {
removeButtonEventHandlers.call(this);
this._aButtons = null;
var aForms = this.element.getElementsByTagName("form"),
oForm;
if (aForms.length > 0) {
oForm = aForms[0];
if (oForm) {
Event.purgeElement(oForm);
if (oForm.parentNode) {
oForm.parentNode.removeChild(oForm);
}
this.form = null;
}
}
Dialog.superclass.destroy.call(this, shallowPurge);
},
/**
* Returns a string representation of the object.
* @method toString
* @return {String} The string representation of the Dialog
*/
toString: function () {
return "Dialog " + this.id;
}
});
}());
(function () {
/**
* SimpleDialog is a simple implementation of Dialog that can be used to
* submit a single value. Forms can be processed in 3 ways -- via an
* asynchronous Connection utility call, a simple form POST or GET,
* or manually.
* @namespace YAHOO.widget
* @class SimpleDialog
* @extends YAHOO.widget.Dialog
* @constructor
* @param {String} el The element ID representing the SimpleDialog
* <em>OR</em>
* @param {HTMLElement} el The element representing the SimpleDialog
* @param {Object} userConfig The configuration object literal containing
* the configuration that should be set for this SimpleDialog. See
* configuration documentation for more details.
*/
YAHOO.widget.SimpleDialog = function (el, userConfig) {
YAHOO.widget.SimpleDialog.superclass.constructor.call(this,
el, userConfig);
};
var Dom = YAHOO.util.Dom,
SimpleDialog = YAHOO.widget.SimpleDialog,
/**
* Constant representing the SimpleDialog's configuration properties
* @property DEFAULT_CONFIG
* @private
* @final
* @type Object
*/
DEFAULT_CONFIG = {
"ICON": {
key: "icon",
value: "none",
suppressEvent: true
},
"TEXT": {
key: "text",
value: "",
suppressEvent: true,
supercedes: ["icon"]
}
};
/**
* Constant for the standard network icon for a blocking action
* @property YAHOO.widget.SimpleDialog.ICON_BLOCK
* @static
* @final
* @type String
*/
SimpleDialog.ICON_BLOCK = "blckicon";
/**
* Constant for the standard network icon for alarm
* @property YAHOO.widget.SimpleDialog.ICON_ALARM
* @static
* @final
* @type String
*/
SimpleDialog.ICON_ALARM = "alrticon";
/**
* Constant for the standard network icon for help
* @property YAHOO.widget.SimpleDialog.ICON_HELP
* @static
* @final
* @type String
*/
SimpleDialog.ICON_HELP = "hlpicon";
/**
* Constant for the standard network icon for info
* @property YAHOO.widget.SimpleDialog.ICON_INFO
* @static
* @final
* @type String
*/
SimpleDialog.ICON_INFO = "infoicon";
/**
* Constant for the standard network icon for warn
* @property YAHOO.widget.SimpleDialog.ICON_WARN
* @static
* @final
* @type String
*/
SimpleDialog.ICON_WARN = "warnicon";
/**
* Constant for the standard network icon for a tip
* @property YAHOO.widget.SimpleDialog.ICON_TIP
* @static
* @final
* @type String
*/
SimpleDialog.ICON_TIP = "tipicon";
/**
* Constant representing the name of the CSS class applied to the element
* created by the "icon" configuration property.
* @property YAHOO.widget.SimpleDialog.ICON_CSS_CLASSNAME
* @static
* @final
* @type String
*/
SimpleDialog.ICON_CSS_CLASSNAME = "yui-icon";
/**
* Constant representing the default CSS class used for a SimpleDialog
* @property YAHOO.widget.SimpleDialog.CSS_SIMPLEDIALOG
* @static
* @final
* @type String
*/
SimpleDialog.CSS_SIMPLEDIALOG = "yui-simple-dialog";
YAHOO.extend(SimpleDialog, YAHOO.widget.Dialog, {
/**
* Initializes the class's configurable properties which can be changed
* using the SimpleDialog's Config object (cfg).
* @method initDefaultConfig
*/
initDefaultConfig: function () {
SimpleDialog.superclass.initDefaultConfig.call(this);
// Add dialog config properties //
/**
* Sets the informational icon for the SimpleDialog
* @config icon
* @type String
* @default "none"
*/
this.cfg.addProperty(DEFAULT_CONFIG.ICON.key, {
handler: this.configIcon,
value: DEFAULT_CONFIG.ICON.value,
suppressEvent: DEFAULT_CONFIG.ICON.suppressEvent
});
/**
* Sets the text for the SimpleDialog. The text is inserted into the DOM as HTML, and should be escaped by the implementor if coming from an external source.
* @config text
* @type HTML
* @default ""
*/
this.cfg.addProperty(DEFAULT_CONFIG.TEXT.key, {
handler: this.configText,
value: DEFAULT_CONFIG.TEXT.value,
suppressEvent: DEFAULT_CONFIG.TEXT.suppressEvent,
supercedes: DEFAULT_CONFIG.TEXT.supercedes
});
},
/**
* The SimpleDialog initialization method, which is executed for
* SimpleDialog and all of its subclasses. This method is automatically
* called by the constructor, and sets up all DOM references for
* pre-existing markup, and creates required markup if it is not
* already present.
* @method init
* @param {String} el The element ID representing the SimpleDialog
* <em>OR</em>
* @param {HTMLElement} el The element representing the SimpleDialog
* @param {Object} userConfig The configuration object literal
* containing the configuration that should be set for this
* SimpleDialog. See configuration documentation for more details.
*/
init: function (el, userConfig) {
/*
Note that we don't pass the user config in here yet because we
only want it executed once, at the lowest subclass level
*/
SimpleDialog.superclass.init.call(this, el/*, userConfig*/);
this.beforeInitEvent.fire(SimpleDialog);
Dom.addClass(this.element, SimpleDialog.CSS_SIMPLEDIALOG);
this.cfg.queueProperty("postmethod", "manual");
if (userConfig) {
this.cfg.applyConfig(userConfig, true);
}
this.beforeRenderEvent.subscribe(function () {
if (! this.body) {
this.setBody("");
}
}, this, true);
this.initEvent.fire(SimpleDialog);
},
/**
* Prepares the SimpleDialog's internal FORM object, creating one if one
* is not currently present, and adding the value hidden field.
* @method registerForm
*/
registerForm: function () {
SimpleDialog.superclass.registerForm.call(this);
var doc = this.form.ownerDocument,
input = doc.createElement("input");
input.type = "hidden";
input.name = this.id;
input.value = "";
this.form.appendChild(input);
},
// BEGIN BUILT-IN PROPERTY EVENT HANDLERS //
/**
* Fired when the "icon" property is set.
* @method configIcon
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
configIcon: function (type,args,obj) {
var sIcon = args[0],
oBody = this.body,
sCSSClass = SimpleDialog.ICON_CSS_CLASSNAME,
aElements,
oIcon,
oIconParent;
if (sIcon && sIcon != "none") {
aElements = Dom.getElementsByClassName(sCSSClass, "*" , oBody);
if (aElements.length === 1) {
oIcon = aElements[0];
oIconParent = oIcon.parentNode;
if (oIconParent) {
oIconParent.removeChild(oIcon);
oIcon = null;
}
}
if (sIcon.indexOf(".") == -1) {
oIcon = document.createElement("span");
oIcon.className = (sCSSClass + " " + sIcon);
oIcon.innerHTML = " ";
} else {
oIcon = document.createElement("img");
oIcon.src = (this.imageRoot + sIcon);
oIcon.className = sCSSClass;
}
if (oIcon) {
oBody.insertBefore(oIcon, oBody.firstChild);
}
}
},
/**
* Fired when the "text" property is set.
* @method configText
* @param {String} type The CustomEvent type (usually the property name)
* @param {Object[]} args The CustomEvent arguments. For configuration
* handlers, args[0] will equal the newly applied value for the property.
* @param {Object} obj The scope object. For configuration handlers,
* this will usually equal the owner.
*/
configText: function (type,args,obj) {
var text = args[0];
if (text) {
this.setBody(text);
this.cfg.refireEvent("icon");
}
},
// END BUILT-IN PROPERTY EVENT HANDLERS //
/**
* Returns a string representation of the object.
* @method toString
* @return {String} The string representation of the SimpleDialog
*/
toString: function () {
return "SimpleDialog " + this.id;
}
/**
* <p>
* Sets the SimpleDialog's body content to the HTML specified.
* If no body is present, one will be automatically created.
* An empty string can be passed to the method to clear the contents of the body.
* </p>
* <p><strong>NOTE:</strong> SimpleDialog provides the <a href="#config_text">text</a>
* and <a href="#config_icon">icon</a> configuration properties to set the contents
* of it's body element in accordance with the UI design for a SimpleDialog (an
* icon and message text). Calling setBody on the SimpleDialog will not enforce this
* UI design constraint and will replace the entire contents of the SimpleDialog body.
* It should only be used if you wish the replace the default icon/text body structure
* of a SimpleDialog with your own custom markup.</p>
*
* @method setBody
* @param {HTML} bodyContent The HTML used to set the body.
* As a convenience, non HTMLElement objects can also be passed into
* the method, and will be treated as strings, with the body innerHTML
* set to their default toString implementations.
*
* <p>NOTE: Markup passed into this method is added to the DOM as HTML, and should be escaped by the implementor if coming from an external source.</p>
*
* <em>OR</em>
* @param {HTMLElement} bodyContent The HTMLElement to add as the first and only child of the body element.
* <em>OR</em>
* @param {DocumentFragment} bodyContent The document fragment
* containing elements which are to be added to the body
*/
});
}());
(function () {
/**
* ContainerEffect encapsulates animation transitions that are executed when
* an Overlay is shown or hidden.
* @namespace YAHOO.widget
* @class ContainerEffect
* @constructor
* @param {YAHOO.widget.Overlay} overlay The Overlay that the animation
* should be associated with
* @param {Object} attrIn The object literal representing the animation
* arguments to be used for the animate-in transition. The arguments for
* this literal are: attributes(object, see YAHOO.util.Anim for description),
* duration(Number), and method(i.e. Easing.easeIn).
* @param {Object} attrOut The object literal representing the animation
* arguments to be used for the animate-out transition. The arguments for
* this literal are: attributes(object, see YAHOO.util.Anim for description),
* duration(Number), and method(i.e. Easing.easeIn).
* @param {HTMLElement} targetElement Optional. The target element that
* should be animated during the transition. Defaults to overlay.element.
* @param {class} Optional. The animation class to instantiate. Defaults to
* YAHOO.util.Anim. Other options include YAHOO.util.Motion.
*/
YAHOO.widget.ContainerEffect = function (overlay, attrIn, attrOut, targetElement, animClass) {
if (!animClass) {
animClass = YAHOO.util.Anim;
}
/**
* The overlay to animate
* @property overlay
* @type YAHOO.widget.Overlay
*/
this.overlay = overlay;
/**
* The animation attributes to use when transitioning into view
* @property attrIn
* @type Object
*/
this.attrIn = attrIn;
/**
* The animation attributes to use when transitioning out of view
* @property attrOut
* @type Object
*/
this.attrOut = attrOut;
/**
* The target element to be animated
* @property targetElement
* @type HTMLElement
*/
this.targetElement = targetElement || overlay.element;
/**
* The animation class to use for animating the overlay
* @property animClass
* @type class
*/
this.animClass = animClass;
};
var Dom = YAHOO.util.Dom,
CustomEvent = YAHOO.util.CustomEvent,
ContainerEffect = YAHOO.widget.ContainerEffect;
/**
* A pre-configured ContainerEffect instance that can be used for fading
* an overlay in and out.
* @method FADE
* @static
* @param {YAHOO.widget.Overlay} overlay The Overlay object to animate
* @param {Number} dur The duration of the animation
* @return {YAHOO.widget.ContainerEffect} The configured ContainerEffect object
*/
ContainerEffect.FADE = function (overlay, dur) {
var Easing = YAHOO.util.Easing,
fin = {
attributes: {opacity:{from:0, to:1}},
duration: dur,
method: Easing.easeIn
},
fout = {
attributes: {opacity:{to:0}},
duration: dur,
method: Easing.easeOut
},
fade = new ContainerEffect(overlay, fin, fout, overlay.element);
fade.handleUnderlayStart = function() {
var underlay = this.overlay.underlay;
if (underlay && YAHOO.env.ua.ie) {
var hasFilters = (underlay.filters && underlay.filters.length > 0);
if(hasFilters) {
Dom.addClass(overlay.element, "yui-effect-fade");
}
}
};
fade.handleUnderlayComplete = function() {
var underlay = this.overlay.underlay;
if (underlay && YAHOO.env.ua.ie) {
Dom.removeClass(overlay.element, "yui-effect-fade");
}
};
fade.handleStartAnimateIn = function (type, args, obj) {
obj.overlay._fadingIn = true;
Dom.addClass(obj.overlay.element, "hide-select");
if (!obj.overlay.underlay) {
obj.overlay.cfg.refireEvent("underlay");
}
obj.handleUnderlayStart();
obj.overlay._setDomVisibility(true);
Dom.setStyle(obj.overlay.element, "opacity", 0);
};
fade.handleCompleteAnimateIn = function (type,args,obj) {
obj.overlay._fadingIn = false;
Dom.removeClass(obj.overlay.element, "hide-select");
if (obj.overlay.element.style.filter) {
obj.overlay.element.style.filter = null;
}
obj.handleUnderlayComplete();
obj.overlay.cfg.refireEvent("iframe");
obj.animateInCompleteEvent.fire();
};
fade.handleStartAnimateOut = function (type, args, obj) {
obj.overlay._fadingOut = true;
Dom.addClass(obj.overlay.element, "hide-select");
obj.handleUnderlayStart();
};
fade.handleCompleteAnimateOut = function (type, args, obj) {
obj.overlay._fadingOut = false;
Dom.removeClass(obj.overlay.element, "hide-select");
if (obj.overlay.element.style.filter) {
obj.overlay.element.style.filter = null;
}
obj.overlay._setDomVisibility(false);
Dom.setStyle(obj.overlay.element, "opacity", 1);
obj.handleUnderlayComplete();
obj.overlay.cfg.refireEvent("iframe");
obj.animateOutCompleteEvent.fire();
};
fade.init();
return fade;
};
/**
* A pre-configured ContainerEffect instance that can be used for sliding an
* overlay in and out.
* @method SLIDE
* @static
* @param {YAHOO.widget.Overlay} overlay The Overlay object to animate
* @param {Number} dur The duration of the animation
* @return {YAHOO.widget.ContainerEffect} The configured ContainerEffect object
*/
ContainerEffect.SLIDE = function (overlay, dur) {
var Easing = YAHOO.util.Easing,
x = overlay.cfg.getProperty("x") || Dom.getX(overlay.element),
y = overlay.cfg.getProperty("y") || Dom.getY(overlay.element),
clientWidth = Dom.getClientWidth(),
offsetWidth = overlay.element.offsetWidth,
sin = {
attributes: { points: { to: [x, y] } },
duration: dur,
method: Easing.easeIn
},
sout = {
attributes: { points: { to: [(clientWidth + 25), y] } },
duration: dur,
method: Easing.easeOut
},
slide = new ContainerEffect(overlay, sin, sout, overlay.element, YAHOO.util.Motion);
slide.handleStartAnimateIn = function (type,args,obj) {
obj.overlay.element.style.left = ((-25) - offsetWidth) + "px";
obj.overlay.element.style.top = y + "px";
};
slide.handleTweenAnimateIn = function (type, args, obj) {
var pos = Dom.getXY(obj.overlay.element),
currentX = pos[0],
currentY = pos[1];
if (Dom.getStyle(obj.overlay.element, "visibility") ==
"hidden" && currentX < x) {
obj.overlay._setDomVisibility(true);
}
obj.overlay.cfg.setProperty("xy", [currentX, currentY], true);
obj.overlay.cfg.refireEvent("iframe");
};
slide.handleCompleteAnimateIn = function (type, args, obj) {
obj.overlay.cfg.setProperty("xy", [x, y], true);
obj.startX = x;
obj.startY = y;
obj.overlay.cfg.refireEvent("iframe");
obj.animateInCompleteEvent.fire();
};
slide.handleStartAnimateOut = function (type, args, obj) {
var vw = Dom.getViewportWidth(),
pos = Dom.getXY(obj.overlay.element),
yso = pos[1];
obj.animOut.attributes.points.to = [(vw + 25), yso];
};
slide.handleTweenAnimateOut = function (type, args, obj) {
var pos = Dom.getXY(obj.overlay.element),
xto = pos[0],
yto = pos[1];
obj.overlay.cfg.setProperty("xy", [xto, yto], true);
obj.overlay.cfg.refireEvent("iframe");
};
slide.handleCompleteAnimateOut = function (type, args, obj) {
obj.overlay._setDomVisibility(false);
obj.overlay.cfg.setProperty("xy", [x, y]);
obj.animateOutCompleteEvent.fire();
};
slide.init();
return slide;
};
ContainerEffect.prototype = {
/**
* Initializes the animation classes and events.
* @method init
*/
init: function () {
this.beforeAnimateInEvent = this.createEvent("beforeAnimateIn");
this.beforeAnimateInEvent.signature = CustomEvent.LIST;
this.beforeAnimateOutEvent = this.createEvent("beforeAnimateOut");
this.beforeAnimateOutEvent.signature = CustomEvent.LIST;
this.animateInCompleteEvent = this.createEvent("animateInComplete");
this.animateInCompleteEvent.signature = CustomEvent.LIST;
this.animateOutCompleteEvent = this.createEvent("animateOutComplete");
this.animateOutCompleteEvent.signature = CustomEvent.LIST;
this.animIn = new this.animClass(
this.targetElement,
this.attrIn.attributes,
this.attrIn.duration,
this.attrIn.method);
this.animIn.onStart.subscribe(this.handleStartAnimateIn, this);
this.animIn.onTween.subscribe(this.handleTweenAnimateIn, this);
this.animIn.onComplete.subscribe(this.handleCompleteAnimateIn,this);
this.animOut = new this.animClass(
this.targetElement,
this.attrOut.attributes,
this.attrOut.duration,
this.attrOut.method);
this.animOut.onStart.subscribe(this.handleStartAnimateOut, this);
this.animOut.onTween.subscribe(this.handleTweenAnimateOut, this);
this.animOut.onComplete.subscribe(this.handleCompleteAnimateOut, this);
},
/**
* Triggers the in-animation.
* @method animateIn
*/
animateIn: function () {
this._stopAnims(this.lastFrameOnStop);
this.beforeAnimateInEvent.fire();
this.animIn.animate();
},
/**
* Triggers the out-animation.
* @method animateOut
*/
animateOut: function () {
this._stopAnims(this.lastFrameOnStop);
this.beforeAnimateOutEvent.fire();
this.animOut.animate();
},
/**
* Flag to define whether Anim should jump to the last frame,
* when animateIn or animateOut is stopped.
*
* @property lastFrameOnStop
* @default true
* @type boolean
*/
lastFrameOnStop : true,
/**
* Stops both animIn and animOut instances, if in progress.
*
* @method _stopAnims
* @param {boolean} finish If true, animation will jump to final frame.
* @protected
*/
_stopAnims : function(finish) {
if (this.animOut && this.animOut.isAnimated()) {
this.animOut.stop(finish);
}
if (this.animIn && this.animIn.isAnimated()) {
this.animIn.stop(finish);
}
},
/**
* The default onStart handler for the in-animation.
* @method handleStartAnimateIn
* @param {String} type The CustomEvent type
* @param {Object[]} args The CustomEvent arguments
* @param {Object} obj The scope object
*/
handleStartAnimateIn: function (type, args, obj) { },
/**
* The default onTween handler for the in-animation.
* @method handleTweenAnimateIn
* @param {String} type The CustomEvent type
* @param {Object[]} args The CustomEvent arguments
* @param {Object} obj The scope object
*/
handleTweenAnimateIn: function (type, args, obj) { },
/**
* The default onComplete handler for the in-animation.
* @method handleCompleteAnimateIn
* @param {String} type The CustomEvent type
* @param {Object[]} args The CustomEvent arguments
* @param {Object} obj The scope object
*/
handleCompleteAnimateIn: function (type, args, obj) { },
/**
* The default onStart handler for the out-animation.
* @method handleStartAnimateOut
* @param {String} type The CustomEvent type
* @param {Object[]} args The CustomEvent arguments
* @param {Object} obj The scope object
*/
handleStartAnimateOut: function (type, args, obj) { },
/**
* The default onTween handler for the out-animation.
* @method handleTweenAnimateOut
* @param {String} type The CustomEvent type
* @param {Object[]} args The CustomEvent arguments
* @param {Object} obj The scope object
*/
handleTweenAnimateOut: function (type, args, obj) { },
/**
* The default onComplete handler for the out-animation.
* @method handleCompleteAnimateOut
* @param {String} type The CustomEvent type
* @param {Object[]} args The CustomEvent arguments
* @param {Object} obj The scope object
*/
handleCompleteAnimateOut: function (type, args, obj) { },
/**
* Returns a string representation of the object.
* @method toString
* @return {String} The string representation of the ContainerEffect
*/
toString: function () {
var output = "ContainerEffect";
if (this.overlay) {
output += " [" + this.overlay.toString() + "]";
}
return output;
}
};
YAHOO.lang.augmentProto(ContainerEffect, YAHOO.util.EventProvider);
})();
YAHOO.register("container", YAHOO.widget.Module, {version: "2.9.0", build: "2800"});
}, '2.9.0' ,{"requires": ["yui2-yahoo", "yui2-dom", "yui2-event", "yui2-skin-sam-container"], "supersedes": ["yui2-containercore"], "optional": ["yui2-animation", "yui2-dragdrop", "yui2-connection"]});
|
app/node_modules/morgan/node_modules/debug/src/browser.js | DanielRasta/AB-Landing-page | /**
* This is the web browser implementation of `debug()`.
*
* Expose `debug()` as the module.
*/
exports = module.exports = require('./debug');
exports.log = log;
exports.formatArgs = formatArgs;
exports.save = save;
exports.load = load;
exports.useColors = useColors;
exports.storage = 'undefined' != typeof chrome
&& 'undefined' != typeof chrome.storage
? chrome.storage.local
: localstorage();
/**
* Colors.
*/
exports.colors = [
'lightseagreen',
'forestgreen',
'goldenrod',
'dodgerblue',
'darkorchid',
'crimson'
];
/**
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
* and the Firebug extension (any Firefox version) are known
* to support "%c" CSS customizations.
*
* TODO: add a `localStorage` variable to explicitly enable/disable colors
*/
function useColors() {
// NB: In an Electron preload script, document will be defined but not fully
// initialized. Since we know we're in Chrome, we'll just detect this case
// explicitly
if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') {
return true;
}
// is webkit? http://stackoverflow.com/a/16459606/376773
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
// is firebug? http://stackoverflow.com/a/398120/376773
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
// is firefox >= v31?
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
// double check webkit in userAgent just in case we are in a worker
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
}
/**
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
*/
exports.formatters.j = function(v) {
try {
return JSON.stringify(v);
} catch (err) {
return '[UnexpectedJSONParseError]: ' + err.message;
}
};
/**
* Colorize log arguments if enabled.
*
* @api public
*/
function formatArgs(args) {
var useColors = this.useColors;
args[0] = (useColors ? '%c' : '')
+ this.namespace
+ (useColors ? ' %c' : ' ')
+ args[0]
+ (useColors ? '%c ' : ' ')
+ '+' + exports.humanize(this.diff);
if (!useColors) return;
var c = 'color: ' + this.color;
args.splice(1, 0, c, 'color: inherit')
// the final "%c" is somewhat tricky, because there could be other
// arguments passed either before or after the %c, so we need to
// figure out the correct index to insert the CSS into
var index = 0;
var lastC = 0;
args[0].replace(/%[a-zA-Z%]/g, function(match) {
if ('%%' === match) return;
index++;
if ('%c' === match) {
// we only are interested in the *last* %c
// (the user may have provided their own)
lastC = index;
}
});
args.splice(lastC, 0, c);
}
/**
* Invokes `console.log()` when available.
* No-op when `console.log` is not a "function".
*
* @api public
*/
function log() {
// this hackery is required for IE8/9, where
// the `console.log` function doesn't have 'apply'
return 'object' === typeof console
&& console.log
&& Function.prototype.apply.call(console.log, console, arguments);
}
/**
* Save `namespaces`.
*
* @param {String} namespaces
* @api private
*/
function save(namespaces) {
try {
if (null == namespaces) {
exports.storage.removeItem('debug');
} else {
exports.storage.debug = namespaces;
}
} catch(e) {}
}
/**
* Load `namespaces`.
*
* @return {String} returns the previously persisted debug modes
* @api private
*/
function load() {
var r;
try {
r = exports.storage.debug;
} catch(e) {}
// If debug isn't set in LS, and we're in Electron, try to load $DEBUG
if (!r && typeof process !== 'undefined' && 'env' in process) {
r = process.env.DEBUG;
}
return r;
}
/**
* Enable namespaces listed in `localStorage.debug` initially.
*/
exports.enable(load());
/**
* Localstorage attempts to return the localstorage.
*
* This is necessary because safari throws
* when a user disables cookies/localstorage
* and you attempt to access it.
*
* @return {LocalStorage}
* @api private
*/
function localstorage() {
try {
return window.localStorage;
} catch (e) {}
}
|
packages/material-ui-icons/src/LocalParkingTwoTone.js | Kagami/material-ui | import React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<React.Fragment><path fill="none" d="M0 0h24v24H0V0z" /><path d="M13 3H6v18h4v-6h3c3.31 0 6-2.69 6-6s-2.69-6-6-6zm.2 8H10V7h3.2c1.1 0 2 .9 2 2s-.9 2-2 2z" /></React.Fragment>
, 'LocalParkingTwoTone');
|
__tests__/components/SearchInput-test.js | odedre/grommet-final | // (C) Copyright 2014-2016 Hewlett Packard Enterprise Development LP
import React from 'react';
import renderer from 'react-test-renderer';
import SearchInput from '../../src/js/components/SearchInput';
// needed because this:
// https://github.com/facebook/jest/issues/1353
jest.mock('react-dom');
describe('SearchInput', () => {
it('has correct default options', () => {
const component = renderer.create(
<SearchInput id="item1" name="item-1" value="one" />
);
let tree = component.toJSON();
expect(tree).toMatchSnapshot();
});
});
|
src/components/TextInput/TextInput-test.js | jzhang300/carbon-components-react | import React from 'react';
import TextInput from '../TextInput';
import { mount, shallow } from 'enzyme';
describe('TextInput', () => {
describe('renders as expected', () => {
const wrapper = mount(
<TextInput id="test" className="extra-class" labelText="testlabel" />
);
const textInput = () => wrapper.find('input');
describe('input', () => {
it('renders as expected', () => {
expect(textInput().length).toBe(1);
});
it('has the expected classes', () => {
expect(textInput().hasClass('bx--text-input')).toEqual(true);
});
it('should add extra classes that are passed via className', () => {
expect(textInput().hasClass('extra-class')).toEqual(true);
});
it('should set type as expected', () => {
expect(textInput().props().type).toEqual('text');
wrapper.setProps({ type: 'email' });
expect(textInput().props().type).toEqual('email');
});
it('should set value as expected', () => {
expect(textInput().props().defaultValue).toEqual(undefined);
wrapper.setProps({ defaultValue: 'test' });
expect(textInput().props().defaultValue).toEqual('test');
});
it('should set disabled as expected', () => {
expect(textInput().props().disabled).toEqual(false);
wrapper.setProps({ disabled: true });
expect(textInput().props().disabled).toEqual(true);
});
it('should set placeholder as expected', () => {
expect(textInput().props().placeholder).not.toBeDefined();
wrapper.setProps({ placeholder: 'Enter text' });
expect(textInput().props().placeholder).toEqual('Enter text');
});
});
describe('label', () => {
wrapper.setProps({ labelText: 'Email Input' });
const renderedLabel = wrapper.find('label');
it('renders a label', () => {
expect(renderedLabel.length).toBe(1);
});
it('has the expected classes', () => {
expect(renderedLabel.hasClass('bx--label')).toEqual(true);
});
it('should set label as expected', () => {
expect(renderedLabel.text()).toEqual('Email Input');
});
});
});
describe('events', () => {
describe('disabled textinput', () => {
const onClick = jest.fn();
const onChange = jest.fn();
const wrapper = shallow(
<TextInput
id="test"
labelText="testlabel"
onClick={onClick}
onChange={onChange}
disabled
/>
);
const input = wrapper.find('input');
it('should not invoke onClick', () => {
input.simulate('click');
expect(onClick).not.toBeCalled();
});
it('should not invoke onChange', () => {
input.simulate('change');
expect(onChange).not.toBeCalled();
});
});
describe('enabled textinput', () => {
const onClick = jest.fn();
const onChange = jest.fn();
const wrapper = shallow(
<TextInput
labelText="testlabel"
id="test"
onClick={onClick}
onChange={onChange}
/>
);
const input = wrapper.find('input');
const eventObject = {
target: {
defaultValue: 'test',
},
};
it('should invoke onClick when input is clicked', () => {
input.simulate('click');
expect(onClick).toBeCalled();
});
it('should invoke onChange when input value is changed', () => {
input.simulate('change', eventObject);
expect(onChange).toBeCalledWith(eventObject);
});
});
});
});
|
packages/playground/stories/SpaceTypeIcon.story.js | appearhere/bloom | import React from 'react';
import { storiesOf } from '@storybook/react';
import {
SpaceTypeIcon
} from '@appearhere/bloom';
const story = storiesOf('SpaceTypeIcon', module);
const icons = [
'shopShare',
'event',
'barRestaurant',
'market',
'retail',
'unique',
'shoppingCentre',
];
icons.forEach(icon => {
story.add(icon, () => (
<div>
{icon}: <SpaceTypeIcon name={icon} />
</div>
));
});
|
src/js/expansionpanel/index.js | HBM/md-components |
import React from 'react'
import classnames from 'classnames'
import {ChevronRight} from '../icon/'
export default class ExpansionPanel extends React.Component {
state = {
isOpen: false
}
toggle = () => {
this.setState({
isOpen: !this.state.isOpen
})
}
render () {
return (
<div className={classnames('mdc-ExpansionPanel', {
'is-open': this.state.isOpen
}, this.props.className)}>
<button
className={classnames('mdc-ExpansionPanel-toggle', {
'mdc-ExpansionPanel-toggle--dense': this.props.dense
})}
onClick={this.toggle}
>
{this.props.top}
<ChevronRight className={classnames('mdc-ExpansionPanel-chevron', {
'is-open': this.state.isOpen
})} />
</button>
<div className={classnames('mdc-ExpansionPanel-content', {
'is-open': this.state.isOpen
})}>
{this.props.children}
</div>
</div>
)
}
}
|
packages/showcase/misc/2d-dragable-plot.js | uber/react-vis | // Copyright (c) 2016 - 2017 Uber Technologies, Inc.
//
// 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.
import React from 'react';
import {
XYPlot,
XAxis,
YAxis,
VerticalGridLines,
HorizontalGridLines,
MarkSeries,
Highlight,
Hint
} from 'react-vis';
import {generateSeededRandom} from '../showcase-utils';
const seededRandom = generateSeededRandom(3);
// randomly generated data
const data = [...new Array(30)].map(() => ({
x: seededRandom() * 5,
y: seededRandom() * 10
}));
export default class BidirectionDragChart extends React.Component {
state = {
filter: null,
hovered: null,
highlighting: false
};
render() {
const {filter, hovered, highlighting} = this.state;
const highlightPoint = d => {
if (!filter) {
return false;
}
const leftRight = d.x <= filter.right && d.x >= filter.left;
const upDown = d.y <= filter.top && d.y >= filter.bottom;
return leftRight && upDown;
};
const numSelectedPoints = filter ? data.filter(highlightPoint).length : 0;
return (
<div>
<XYPlot width={300} height={300}>
<VerticalGridLines />
<HorizontalGridLines />
<XAxis />
<YAxis />
<Highlight
drag
onBrushStart={() => this.setState({highlighting: true})}
onBrush={area => this.setState({filter: area})}
onBrushEnd={area =>
this.setState({highlighting: false, filter: area})
}
onDragStart={() => this.setState({highlighting: true})}
onDrag={area => this.setState({filter: area})}
onDragEnd={area =>
this.setState({highlighting: false, filter: area})
}
/>
<MarkSeries
className="mark-series-example"
strokeWidth={2}
opacity="0.8"
sizeRange={[5, 15]}
style={{pointerEvents: highlighting ? 'none' : ''}}
colorType="literal"
getColor={d => (highlightPoint(d) ? '#EF5D28' : '#12939A')}
onValueMouseOver={d => this.setState({hovered: d})}
onValueMouseOut={() => this.setState({hovered: false})}
data={data}
/>
{hovered && <Hint value={hovered} />}
</XYPlot>
<p>{`There are ${numSelectedPoints} selected points`}</p>
</div>
);
}
}
|
js/components/newItem/index.js | gectorat/react-native-app |
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { View, List, ListItem, InputGroup, Input, Button } from 'native-base';
import { openDrawer } from '../../actions/drawer';
import { popRoute } from '../../actions/route';
import { createPost } from '../../actions/post';
import styles from './styles';
import { v1 } from 'react-native-uuid';
const placeholder = {
email: 'Email',
subject: 'Subject',
description: 'Description'
};
class NewItem extends Component {
static propTypes = {
popRoute: React.PropTypes.func,
addItem: React.PropTypes.func,
openDrawer: React.PropTypes.func,
name: React.PropTypes.string,
index: React.PropTypes.number,
list: React.PropTypes.arrayOf(React.PropTypes.string),
}
constructor(){
super();
this.state = { description: '' }
}
addNewRequest() {
const { title, body } = this.state;
this.props.createPost({ id: v1(), timestamp: +new Date, title, body});
}
updateDescription(body){
this.setState({body});
}
updateTitle(title){
this.setState({title});
}
popRoute() {
this.props.popRoute();
}
render() {
const { props: { name, index, list } } = this;
return (
<View>
<List>
<ListItem>
<InputGroup>
<Input placeholder={placeholder.email}/>
</InputGroup>
</ListItem>
<ListItem>
<InputGroup>
<Input
value={this.state.title}
onChangeText={(e) => this.updateTitle(e)}
placeholder={placeholder.subject}/>
</InputGroup>
</ListItem>
<ListItem>
<InputGroup>
<Input
multiline
numberOfLines={5}
height={150}
value={this.state.body}
onChangeText={(e) => this.updateDescription(e)}
placeholder={placeholder.description}/>
</InputGroup>
</ListItem>
</List>
<Button block info onPress={()=>this.addNewRequest()}>Ask for advance</Button>
</View>
);
}
}
function bindAction(dispatch) {
return {
openDrawer: () => dispatch(openDrawer()),
createPost: (data) => dispatch(createPost(data)),
addItem: (text) => dispatch(addItem(text)),
popRoute: () => dispatch(popRoute()),
};
}
function mapStateToProps(state) {
return {
name: state.user.name,
index: state.list.selectedIndex,
list: state.list.list,
};
}
export default connect(mapStateToProps, bindAction)(NewItem);
|
src/main/resources/web/js/jquery.js | blackducksoftware/vulnerability-collector | /*! jQuery v1.11.1 | (c) 2005, 2014 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.1",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)>=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=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"+-new Date,v=a.document,w=0,x=0,y=gb(),z=gb(),A=gb(),B=function(a,b){return a===b&&(l=!0),0},C="undefined",D=1<<31,E={}.hasOwnProperty,F=[],G=F.pop,H=F.push,I=F.push,J=F.slice,K=F.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},L="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",N="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=N.replace("w","w#"),P="\\["+M+"*("+N+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+O+"))|)"+M+"*\\]",Q=":("+N+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+P+")*)|.*)\\)|)",R=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),S=new RegExp("^"+M+"*,"+M+"*"),T=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),V=new RegExp(Q),W=new RegExp("^"+O+"$"),X={ID:new RegExp("^#("+N+")"),CLASS:new RegExp("^\\.("+N+")"),TAG:new RegExp("^("+N.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+Q),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+L+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ab=/[+~]/,bb=/'|\\/g,cb=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),db=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)};try{I.apply(F=J.call(v.childNodes),v.childNodes),F[v.childNodes.length].nodeType}catch(eb){I={apply:F.length?function(a,b){H.apply(a,J.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fb(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||[],!a||"string"!=typeof a)return d;if(1!==(k=b.nodeType)&&9!==k)return[];if(p&&!e){if(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 I.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return I.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=9===k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(bb,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+qb(o[l]);w=ab.test(a)&&ob(b.parentNode)||b,x=o.join(",")}if(x)try{return I.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function gb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function hb(a){return a[u]=!0,a}function ib(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function jb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function kb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||D)-(~a.sourceIndex||D);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function lb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function nb(a){return hb(function(b){return b=+b,hb(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 ob(a){return a&&typeof a.getElementsByTagName!==C&&a}c=fb.support={},f=fb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fb.setDocument=function(a){var b,e=a?a.ownerDocument||a:v,g=e.defaultView;return e!==n&&9===e.nodeType&&e.documentElement?(n=e,o=e.documentElement,p=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){m()},!1):g.attachEvent&&g.attachEvent("onunload",function(){m()})),c.attributes=ib(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ib(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(e.getElementsByClassName)&&ib(function(a){return a.innerHTML="<div class='a'></div><div class='a i'></div>",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=ib(function(a){return o.appendChild(a).id=u,!e.getElementsByName||!e.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==C&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){var c=typeof a.getAttributeNode!==C&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==C?b.getElementsByTagName(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 typeof b.getElementsByClassName!==C&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(e.querySelectorAll))&&(ib(function(a){a.innerHTML="<select msallowclip=''><option selected=''></option></select>",a.querySelectorAll("[msallowclip^='']").length&&q.push("[*^$]="+M+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+M+"*(?:value|"+L+")"),a.querySelectorAll(":checked").length||q.push(":checked")}),ib(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+M+"*[*^$|!~]?="),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))&&ib(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",Q)}),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===e||a.ownerDocument===v&&t(v,a)?-1:b===e||b.ownerDocument===v&&t(v,b)?1:k?K.call(k,a)-K.call(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],i=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:k?K.call(k,a)-K.call(k,b):0;if(f===g)return kb(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?kb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},e):n},fb.matches=function(a,b){return fb(a,null,null,b)},fb.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 fb(b,n,null,[a]).length>0},fb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&E.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},fb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fb.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=fb.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=fb.selectors={cacheLength:50,createPseudo:hb,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(cb,db),a[3]=(a[3]||a[4]||a[5]||"").replace(cb,db),"~="===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]||fb.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]&&fb.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(cb,db).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("(^|"+M+")"+a+"("+M+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==C&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fb.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+" ").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()]||fb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?hb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=K.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:hb(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?hb(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),!c.pop()}}),has:hb(function(a){return function(b){return fb(a,b).length>0}}),contains:hb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:hb(function(a){return W.test(a||"")||fb.error("unsupported lang: "+a),a=a.replace(cb,db).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:nb(function(){return[0]}),last:nb(function(a,b){return[b-1]}),eq:nb(function(a,b,c){return[0>c?c+b:c]}),even:nb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:nb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:nb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:nb(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]=lb(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=mb(b);function pb(){}pb.prototype=d.filters=d.pseudos,d.setFilters=new pb,g=fb.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?fb.error(a):z(a,i).slice(0)};function qb(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function rb(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 sb(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 tb(a,b,c){for(var d=0,e=b.length;e>d;d++)fb(a,b[d],c);return c}function ub(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 vb(a,b,c,d,e,f){return d&&!d[u]&&(d=vb(d)),e&&!e[u]&&(e=vb(e,f)),hb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||tb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ub(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ub(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?K.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ub(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):I.apply(g,r)})}function wb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=rb(function(a){return a===b},h,!0),l=rb(function(a){return K.call(b,a)>-1},h,!0),m=[function(a,c,d){return!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>i;i++)if(c=d.relative[a[i].type])m=[rb(sb(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 vb(i>1&&sb(m),i>1&&qb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&wb(a.slice(i,e)),f>e&&wb(a=a.slice(e)),f>e&&qb(a))}m.push(c)}return sb(m)}function xb(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]=G.call(i));s=ub(s)}I.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&fb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?hb(f):f}return h=fb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xb(e,d)),f.selector=a}return f},i=fb.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(cb,db),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(cb,db),ab.test(j[0].type)&&ob(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qb(j),!a)return I.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,ab.test(a)&&ob(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ib(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ib(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||jb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ib(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||jb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ib(function(a){return null==a.getAttribute("disabled")})||jb(L,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fb}(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 ab(){return!0}function bb(){return!1}function cb(){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!==cb()&&this.focus)try{return this.focus(),!1}catch(a){}},delegateType:"focusin"},blur:{trigger:function(){return this===cb()&&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?ab:bb):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:bb,isPropagationStopped:bb,isImmediatePropagationStopped:bb,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=ab,a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=ab,a&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=ab,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=bb;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=bb),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 db(a){var b=eb.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}var eb="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",fb=/ jQuery\d+="(?:null|\d+)"/g,gb=new RegExp("<(?:"+eb+")[\\s/>]","i"),hb=/^\s+/,ib=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,jb=/<([\w:]+)/,kb=/<tbody/i,lb=/<|&#?\w+;/,mb=/<(?:script|style|link)/i,nb=/checked\s*(?:[^=]|=\s*.checked.)/i,ob=/^$|\/(?:java|ecma)script/i,pb=/^true\/(.*)/,qb=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,rb={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>"]},sb=db(y),tb=sb.appendChild(y.createElement("div"));rb.optgroup=rb.option,rb.tbody=rb.tfoot=rb.colgroup=rb.caption=rb.thead,rb.th=rb.td;function ub(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,ub(d,b));return void 0===b||b&&m.nodeName(a,b)?m.merge([a],f):f}function vb(a){W.test(a.type)&&(a.defaultChecked=a.checked)}function wb(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 xb(a){return a.type=(null!==m.find.attr(a,"type"))+"/"+a.type,a}function yb(a){var b=pb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function zb(a,b){for(var c,d=0;null!=(c=a[d]);d++)m._data(c,"globalEval",!b||m._data(b[d],"globalEval"))}function Ab(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 Bb(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?(xb(b).text=a.text,yb(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)||!gb.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(tb.innerHTML=a.outerHTML,tb.removeChild(f=tb.firstChild)),!(k.noCloneEvent&&k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||m.isXMLDoc(a)))for(d=ub(f),h=ub(a),g=0;null!=(e=h[g]);++g)d[g]&&Bb(e,d[g]);if(b)if(c)for(h=h||ub(a),d=d||ub(f),g=0;null!=(e=h[g]);g++)Ab(e,d[g]);else Ab(a,f);return d=ub(f,"script"),d.length>0&&zb(d,!i&&ub(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=db(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(lb.test(f)){h=h||o.appendChild(b.createElement("div")),i=(jb.exec(f)||["",""])[1].toLowerCase(),l=rb[i]||rb._default,h.innerHTML=l[1]+f.replace(ib,"<$1></$2>")+l[2],e=l[0];while(e--)h=h.lastChild;if(!k.leadingWhitespace&&hb.test(f)&&p.push(b.createTextNode(hb.exec(f)[0])),!k.tbody){f="table"!==i||kb.test(f)?"<table>"!==l[1]||kb.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(ub(p,"input"),vb),q=0;while(f=p[q++])if((!d||-1===m.inArray(f,d))&&(g=m.contains(f.ownerDocument,f),h=ub(o.appendChild(f),"script"),g&&zb(h),c)){e=0;while(f=h[e++])ob.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=wb(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=wb(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(ub(c)),c.parentNode&&(b&&m.contains(c.ownerDocument,c)&&zb(ub(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(ub(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(fb,""):void 0;if(!("string"!=typeof a||mb.test(a)||!k.htmlSerialize&&gb.test(a)||!k.leadingWhitespace&&hb.test(a)||rb[(jb.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(ib,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(m.cleanData(ub(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(ub(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&&nb.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(ub(i,"script"),xb),f=g.length;l>j;j++)d=i,j!==o&&(d=m.clone(d,!0,!0),f&&m.merge(g,ub(d,"script"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,m.map(g,yb),j=0;f>j;j++)d=g[j],ob.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(qb,"")));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 Cb,Db={};function Eb(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 Fb(a){var b=y,c=Db[a];return c||(c=Eb(a,b),"none"!==c&&c||(Cb=(Cb||m("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=(Cb[0].contentWindow||Cb[0].contentDocument).document,b.write(),b.close(),c=Eb(a,b),Cb.detach()),Db[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 Gb=/^margin/,Hb=new RegExp("^("+S+")(?!px)[a-z%]+$","i"),Ib,Jb,Kb=/^(top|right|bottom|left)$/;a.getComputedStyle?(Ib=function(a){return a.ownerDocument.defaultView.getComputedStyle(a,null)},Jb=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ib(a),g=c?c.getPropertyValue(b)||c[b]:void 0,c&&(""!==g||m.contains(a.ownerDocument,a)||(g=m.style(a,b)),Hb.test(g)&&Gb.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&&(Ib=function(a){return a.currentStyle},Jb=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ib(a),g=c?c[b]:void 0,null==g&&h&&h[b]&&(g=h[b]),Hb.test(g)&&!Kb.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 Lb(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.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 Mb=/alpha\([^)]*\)/i,Nb=/opacity\s*=\s*([^)]*)/,Ob=/^(none|table(?!-c[ea]).+)/,Pb=new RegExp("^("+S+")(.*)$","i"),Qb=new RegExp("^([+-])=("+S+")","i"),Rb={position:"absolute",visibility:"hidden",display:"block"},Sb={letterSpacing:"0",fontWeight:"400"},Tb=["Webkit","O","Moz","ms"];function Ub(a,b){if(b in a)return b;var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=Tb.length;while(e--)if(b=Tb[e]+c,b in a)return b;return d}function Vb(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",Fb(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 Wb(a,b,c){var d=Pb.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Xb(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 Yb(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=Ib(a),g=k.boxSizing&&"border-box"===m.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=Jb(a,b,f),(0>e||null==e)&&(e=a.style[b]),Hb.test(e))return e;d=g&&(k.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Xb(a,b,c||(g?"border":"content"),d,f)+"px"}m.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Jb(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]=Ub(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=Qb.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]=Ub(a.style,h)),g=m.cssHooks[b]||m.cssHooks[h],g&&"get"in g&&(f=g.get(a,!0,c)),void 0===f&&(f=Jb(a,b,d)),"normal"===f&&b in Sb&&(f=Sb[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?Ob.test(m.css(a,"display"))&&0===a.offsetWidth?m.swap(a,Rb,function(){return Yb(a,b,d)}):Yb(a,b,d):void 0},set:function(a,c,d){var e=d&&Ib(a);return Wb(a,c,d?Xb(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 Nb.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(Mb,""))&&c.removeAttribute&&(c.removeAttribute("filter"),""===b||d&&!d.filter)||(c.filter=Mb.test(f)?f.replace(Mb,e):f+" "+e)}}),m.cssHooks.marginRight=Lb(k.reliableMarginRight,function(a,b){return b?m.swap(a,{display:"inline-block"},Jb,[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}},Gb.test(a)||(m.cssHooks[a+b].set=Wb)}),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=Ib(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 Vb(this,!0)},hide:function(){return Vb(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 Zb(a,b,c,d,e){return new Zb.prototype.init(a,b,c,d,e)}m.Tween=Zb,Zb.prototype={constructor:Zb,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=Zb.propHooks[this.prop];return a&&a.get?a.get(this):Zb.propHooks._default.get(this)},run:function(a){var b,c=Zb.propHooks[this.prop];return this.pos=b=this.options.duration?m.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):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):Zb.propHooks._default.set(this),this}},Zb.prototype.init.prototype=Zb.prototype,Zb.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}}},Zb.propHooks.scrollTop=Zb.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=Zb.prototype.init,m.fx.step={};var $b,_b,ac=/^(?:toggle|show|hide)$/,bc=new RegExp("^(?:([+-])=|)("+S+")([a-z%]*)$","i"),cc=/queueHooks$/,dc=[ic],ec={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=bc.exec(b),f=e&&e[3]||(m.cssNumber[a]?"":"px"),g=(m.cssNumber[a]||"px"!==f&&+d)&&bc.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 fc(){return setTimeout(function(){$b=void 0}),$b=m.now()}function gc(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 hc(a,b,c){for(var d,e=(ec[b]||[]).concat(ec["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function ic(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")||Fb(a.nodeName):j,"inline"===l&&"none"===m.css(a,"float")&&(k.inlineBlockNeedsLayout&&"inline"!==Fb(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],ac.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?Fb(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=hc(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 jc(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 kc(a,b,c){var d,e,f=0,g=dc.length,h=m.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=$b||fc(),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:$b||fc(),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(jc(k,j.opts.specialEasing);g>f;f++)if(d=dc[f].call(j,a,k,j.opts))return d;return m.map(k,hc,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(kc,{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],ec[c]=ec[c]||[],ec[c].unshift(b)},prefilter:function(a,b){b?dc.unshift(a):dc.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=kc(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&&cc.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(gc(b,!0),a,d,e)}}),m.each({slideDown:gc("show"),slideUp:gc("hide"),slideToggle:gc("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($b=m.now();c<b.length;c++)a=b[c],a()||b[c]!==a||b.splice(c--,1);b.length||m.fx.stop(),$b=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(){_b||(_b=setInterval(m.fx.tick,m.fx.interval))},m.fx.stop=function(){clearInterval(_b),_b=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 lc=/\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(lc,""):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 mc,nc,oc=m.expr.attrHandle,pc=/^(?:checked|selected)$/i,qc=k.getSetAttribute,rc=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)?nc:mc)),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)?rc&&qc||!pc.test(c)?a[d]=!1:a[m.camelCase("default-"+c)]=a[d]=!1:m.attr(a,c,""),a.removeAttribute(qc?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}}}}}),nc={set:function(a,b,c){return b===!1?m.removeAttr(a,c):rc&&qc||!pc.test(c)?a.setAttribute(!qc&&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=oc[b]||m.find.attr;oc[b]=rc&&qc||!pc.test(b)?function(a,b,d){var e,f;return d||(f=oc[b],oc[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,oc[b]=f),e}:function(a,b,c){return c?void 0:a[m.camelCase("default-"+b)]?b.toLowerCase():null}}),rc&&qc||(m.attrHooks.value={set:function(a,b,c){return m.nodeName(a,"input")?void(a.defaultValue=b):mc&&mc.set(a,b,c)}}),qc||(mc={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}},oc.id=oc.name=oc.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:mc.set},m.attrHooks.contenteditable={set:function(a,b,c){mc.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 sc=/^(?:input|select|textarea|button|object)$/i,tc=/^(?: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):sc.test(a.nodeName)||tc.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 uc=/[\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(uc," "):" ")){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(uc," "):"")){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(uc," ").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 vc=m.now(),wc=/\?/,xc=/(,)|(\[|{)|(}|])|"(?:[^"\\\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(xc,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 yc,zc,Ac=/#.*$/,Bc=/([?&])_=[^&]*/,Cc=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Dc=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Ec=/^(?:GET|HEAD)$/,Fc=/^\/\//,Gc=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Hc={},Ic={},Jc="*/".concat("*");try{zc=location.href}catch(Kc){zc=y.createElement("a"),zc.href="",zc=zc.href}yc=Gc.exec(zc.toLowerCase())||[];function Lc(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 Mc(a,b,c,d){var e={},f=a===Ic;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 Nc(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 Oc(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 Pc(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:zc,type:"GET",isLocal:Dc.test(yc[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Jc,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?Nc(Nc(a,m.ajaxSettings),b):Nc(m.ajaxSettings,a)},ajaxPrefilter:Lc(Hc),ajaxTransport:Lc(Ic),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=Cc.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||zc)+"").replace(Ac,"").replace(Fc,yc[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=m.trim(k.dataType||"*").toLowerCase().match(E)||[""],null==k.crossDomain&&(c=Gc.exec(k.url.toLowerCase()),k.crossDomain=!(!c||c[1]===yc[1]&&c[2]===yc[2]&&(c[3]||("http:"===c[1]?"80":"443"))===(yc[3]||("http:"===yc[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=m.param(k.data,k.traditional)),Mc(Hc,k,b,v),2===t)return v;h=k.global,h&&0===m.active++&&m.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!Ec.test(k.type),e=k.url,k.hasContent||(k.data&&(e=k.url+=(wc.test(e)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=Bc.test(e)?e.replace(Bc,"$1_="+vc++):e+(wc.test(e)?"&":"?")+"_="+vc++)),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]?", "+Jc+"; 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=Mc(Ic,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=Oc(k,v,c)),u=Pc(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.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){m.fn[b]=function(a){return this.on(b,a)}}),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 Qc=/%20/g,Rc=/\[\]$/,Sc=/\r?\n/g,Tc=/^(?:submit|button|image|reset|file)$/i,Uc=/^(?:input|select|textarea|keygen)/i;function Vc(a,b,c,d){var e;if(m.isArray(b))m.each(b,function(b,e){c||Rc.test(a)?d(a,e):Vc(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==m.type(b))d(a,b);else for(e in b)Vc(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)Vc(c,a[c],b,e);return d.join("&").replace(Qc,"+")},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")&&Uc.test(this.nodeName)&&!Tc.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(Sc,"\r\n")}}):{name:b.name,value:c.replace(Sc,"\r\n")}}).get()}}),m.ajaxSettings.xhr=void 0!==a.ActiveXObject?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&Zc()||$c()}:Zc;var Wc=0,Xc={},Yc=m.ajaxSettings.xhr();a.ActiveXObject&&m(a).on("unload",function(){for(var a in Xc)Xc[a](void 0,!0)}),k.cors=!!Yc&&"withCredentials"in Yc,Yc=k.ajax=!!Yc,Yc&&m.ajaxTransport(function(a){if(!a.crossDomain||k.cors){var b;return{send:function(c,d){var e,f=a.xhr(),g=++Wc;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 Xc[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=Xc[g]=b:b()},abort:function(){b&&b(void 0,!0)}}}});function Zc(){try{return new a.XMLHttpRequest}catch(b){}}function $c(){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 _c=[],ad=/(=)\?(?=&|$)|\?\?/;m.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=_c.pop()||m.expando+"_"+vc++;return this[a]=!0,a}}),m.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(ad.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&ad.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(ad,"$1"+e):b.jsonp!==!1&&(b.url+=(wc.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,_c.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 bd=m.fn.load;m.fn.load=function(a,b,c){if("string"!=typeof a&&bd)return bd.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.expr.filters.animated=function(a){return m.grep(m.timers,function(b){return a===b.elem}).length};var cd=a.document.documentElement;function dd(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=dd(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||cd;while(a&&!m.nodeName(a,"html")&&"static"===m.css(a,"position"))a=a.offsetParent;return a||cd})}}),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=dd(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]=Lb(k.pixelPosition,function(a,c){return c?(c=Jb(a,b),Hb.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 ed=a.jQuery,fd=a.$;return m.noConflict=function(b){return a.$===m&&(a.$=fd),b&&a.jQuery===m&&(a.jQuery=ed),m},typeof b===K&&(a.jQuery=a.$=m),m}); |
node_modules/react-icons/md/query-builder.js | bengimbel/Solstice-React-Contacts-Project |
import React from 'react'
import Icon from 'react-icon-base'
const MdQueryBuilder = props => (
<Icon viewBox="0 0 40 40" {...props}>
<g><path d="m20.9 11.6v8.8l7.5 4.4-1.3 2.2-8.7-5.4v-10h2.5z m-0.9 21.8q5.5 0 9.4-4t4-9.4-4-9.4-9.4-4-9.4 4-4 9.4 4 9.4 9.4 4z m0-30q6.9 0 11.8 4.8t4.8 11.8-4.8 11.8-11.8 4.8-11.8-4.8-4.8-11.8 4.8-11.8 11.8-4.8z"/></g>
</Icon>
)
export default MdQueryBuilder
|
sites/all/modules/jquery_update/replace/jquery/1.9/jquery.min.js | mjlavin80/digital_london | /*! jQuery v1.9.1 | (c) 2005, 2012 jQuery Foundation, Inc. | jquery.org/license
//@ sourceMappingURL=jquery.min.map
*/(function(e,t){var n,r,i=typeof t,o=e.document,a=e.location,s=e.jQuery,u=e.$,l={},c=[],p="1.9.1",f=c.concat,d=c.push,h=c.slice,g=c.indexOf,m=l.toString,y=l.hasOwnProperty,v=p.trim,b=function(e,t){return new b.fn.init(e,t,r)},x=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,w=/\S+/g,T=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,k=/^[\],:{}\s]*$/,E=/(?:^|:|,)(?:\s*\[)+/g,S=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,A=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,j=/^-ms-/,D=/-([\da-z])/gi,L=function(e,t){return t.toUpperCase()},H=function(e){(o.addEventListener||"load"===e.type||"complete"===o.readyState)&&(q(),b.ready())},q=function(){o.addEventListener?(o.removeEventListener("DOMContentLoaded",H,!1),e.removeEventListener("load",H,!1)):(o.detachEvent("onreadystatechange",H),e.detachEvent("onload",H))};b.fn=b.prototype={jquery:p,constructor:b,init:function(e,n,r){var i,a;if(!e)return this;if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:N.exec(e),!i||!i[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(i[1]){if(n=n instanceof b?n[0]:n,b.merge(this,b.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:o,!0)),C.test(i[1])&&b.isPlainObject(n))for(i in n)b.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}if(a=o.getElementById(i[2]),a&&a.parentNode){if(a.id!==i[2])return r.find(e);this.length=1,this[0]=a}return this.context=o,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):b.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),b.makeArray(e,this))},selector:"",length:0,size:function(){return this.length},toArray:function(){return h.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=b.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return b.each(this,e,t)},ready:function(e){return b.ready.promise().done(e),this},slice:function(){return this.pushStack(h.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(b.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:d,sort:[].sort,splice:[].splice},b.fn.init.prototype=b.fn,b.extend=b.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},u=1,l=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},u=2),"object"==typeof s||b.isFunction(s)||(s={}),l===u&&(s=this,--u);l>u;u++)if(null!=(o=arguments[u]))for(i in o)e=s[i],r=o[i],s!==r&&(c&&r&&(b.isPlainObject(r)||(n=b.isArray(r)))?(n?(n=!1,a=e&&b.isArray(e)?e:[]):a=e&&b.isPlainObject(e)?e:{},s[i]=b.extend(c,a,r)):r!==t&&(s[i]=r));return s},b.extend({noConflict:function(t){return e.$===b&&(e.$=u),t&&e.jQuery===b&&(e.jQuery=s),b},isReady:!1,readyWait:1,holdReady:function(e){e?b.readyWait++:b.ready(!0)},ready:function(e){if(e===!0?!--b.readyWait:!b.isReady){if(!o.body)return setTimeout(b.ready);b.isReady=!0,e!==!0&&--b.readyWait>0||(n.resolveWith(o,[b]),b.fn.trigger&&b(o).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===b.type(e)},isArray:Array.isArray||function(e){return"array"===b.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[m.call(e)]||"object":typeof e},isPlainObject:function(e){if(!e||"object"!==b.type(e)||e.nodeType||b.isWindow(e))return!1;try{if(e.constructor&&!y.call(e,"constructor")&&!y.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||y.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||o;var r=C.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=b.buildFragment([e],t,i),i&&b(i).remove(),b.merge([],r.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=b.trim(n),n&&k.test(n.replace(S,"@").replace(A,"]").replace(E,"")))?Function("return "+n)():(b.error("Invalid JSON: "+n),t)},parseXML:function(n){var r,i;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(o){r=t}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||b.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&b.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(j,"ms-").replace(D,L)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,a=M(e);if(n){if(a){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(a){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:v&&!v.call("\ufeff\u00a0")?function(e){return null==e?"":v.call(e)}:function(e){return null==e?"":(e+"").replace(T,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(M(Object(e))?b.merge(n,"string"==typeof e?[e]:e):d.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(g)return g.call(t,e,n);for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,o=0;if("number"==typeof r)for(;r>o;o++)e[i++]=n[o];else while(n[o]!==t)e[i++]=n[o++];return e.length=i,e},grep:function(e,t,n){var r,i=[],o=0,a=e.length;for(n=!!n;a>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,a=M(e),s=[];if(a)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(s[s.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(s[s.length]=r);return f.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(o=e[n],n=e,e=o),b.isFunction(e)?(r=h.call(arguments,2),i=function(){return e.apply(n||this,r.concat(h.call(arguments)))},i.guid=e.guid=e.guid||b.guid++,i):t},access:function(e,n,r,i,o,a,s){var u=0,l=e.length,c=null==r;if("object"===b.type(r)){o=!0;for(u in r)b.access(e,n,u,r[u],!0,a,s)}else if(i!==t&&(o=!0,b.isFunction(i)||(s=!0),c&&(s?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(b(e),n)})),n))for(;l>u;u++)n(e[u],r,s?i:i.call(e[u],u,n(e[u],r)));return o?e:c?n.call(e):l?n(e[0],r):a},now:function(){return(new Date).getTime()}}),b.ready.promise=function(t){if(!n)if(n=b.Deferred(),"complete"===o.readyState)setTimeout(b.ready);else if(o.addEventListener)o.addEventListener("DOMContentLoaded",H,!1),e.addEventListener("load",H,!1);else{o.attachEvent("onreadystatechange",H),e.attachEvent("onload",H);var r=!1;try{r=null==e.frameElement&&o.documentElement}catch(i){}r&&r.doScroll&&function a(){if(!b.isReady){try{r.doScroll("left")}catch(e){return setTimeout(a,50)}q(),b.ready()}}()}return n.promise(t)},b.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function M(e){var t=e.length,n=b.type(e);return b.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}r=b(o);var _={};function F(e){var t=_[e]={};return b.each(e.match(w)||[],function(e,n){t[n]=!0}),t}b.Callbacks=function(e){e="string"==typeof e?_[e]||F(e):b.extend({},e);var n,r,i,o,a,s,u=[],l=!e.once&&[],c=function(t){for(r=e.memory&&t,i=!0,a=s||0,s=0,o=u.length,n=!0;u&&o>a;a++)if(u[a].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}n=!1,u&&(l?l.length&&c(l.shift()):r?u=[]:p.disable())},p={add:function(){if(u){var t=u.length;(function i(t){b.each(t,function(t,n){var r=b.type(n);"function"===r?e.unique&&p.has(n)||u.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=u.length:r&&(s=t,c(r))}return this},remove:function(){return u&&b.each(arguments,function(e,t){var r;while((r=b.inArray(t,u,r))>-1)u.splice(r,1),n&&(o>=r&&o--,a>=r&&a--)}),this},has:function(e){return e?b.inArray(e,u)>-1:!(!u||!u.length)},empty:function(){return u=[],this},disable:function(){return u=l=r=t,this},disabled:function(){return!u},lock:function(){return l=t,r||p.disable(),this},locked:function(){return!l},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],!u||i&&!l||(n?l.push(t):c(t)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!i}};return p},b.extend({Deferred:function(e){var t=[["resolve","done",b.Callbacks("once memory"),"resolved"],["reject","fail",b.Callbacks("once memory"),"rejected"],["notify","progress",b.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return b.Deferred(function(n){b.each(t,function(t,o){var a=o[0],s=b.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&b.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[a+"With"](this===r?n.promise():this,s?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?b.extend(e,r):r}},i={};return r.pipe=r.then,b.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=h.call(arguments),r=n.length,i=1!==r||e&&b.isFunction(e.promise)?r:0,o=1===i?e:b.Deferred(),a=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?h.call(arguments):r,n===s?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},s,u,l;if(r>1)for(s=Array(r),u=Array(r),l=Array(r);r>t;t++)n[t]&&b.isFunction(n[t].promise)?n[t].promise().done(a(t,l,n)).fail(o.reject).progress(a(t,u,s)):--i;return i||o.resolveWith(l,n),o.promise()}}),b.support=function(){var t,n,r,a,s,u,l,c,p,f,d=o.createElement("div");if(d.setAttribute("className","t"),d.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=d.getElementsByTagName("*"),r=d.getElementsByTagName("a")[0],!n||!r||!n.length)return{};s=o.createElement("select"),l=s.appendChild(o.createElement("option")),a=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t={getSetAttribute:"t"!==d.className,leadingWhitespace:3===d.firstChild.nodeType,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/top/.test(r.getAttribute("style")),hrefNormalized:"/a"===r.getAttribute("href"),opacity:/^0.5/.test(r.style.opacity),cssFloat:!!r.style.cssFloat,checkOn:!!a.value,optSelected:l.selected,enctype:!!o.createElement("form").enctype,html5Clone:"<:nav></:nav>"!==o.createElement("nav").cloneNode(!0).outerHTML,boxModel:"CSS1Compat"===o.compatMode,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},a.checked=!0,t.noCloneChecked=a.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!l.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}a=o.createElement("input"),a.setAttribute("value",""),t.input=""===a.getAttribute("value"),a.value="t",a.setAttribute("type","radio"),t.radioValue="t"===a.value,a.setAttribute("checked","t"),a.setAttribute("name","t"),u=o.createDocumentFragment(),u.appendChild(a),t.appendChecked=a.checked,t.checkClone=u.cloneNode(!0).cloneNode(!0).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!0).click());for(f in{submit:!0,change:!0,focusin:!0})d.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||d.attributes[c].expando===!1;return d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip,b(function(){var n,r,a,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",u=o.getElementsByTagName("body")[0];u&&(n=o.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",u.appendChild(n).appendChild(d),d.innerHTML="<table><tr><td></td><td>t</td></tr></table>",a=d.getElementsByTagName("td"),a[0].style.cssText="padding:0;margin:0;border:0;display:none",p=0===a[0].offsetHeight,a[0].style.display="",a[1].style.display="none",t.reliableHiddenOffsets=p&&0===a[0].offsetHeight,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",t.boxSizing=4===d.offsetWidth,t.doesNotIncludeMarginInBodyOffset=1!==u.offsetTop,e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(d,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(d,null)||{width:"4px"}).width,r=d.appendChild(o.createElement("div")),r.style.cssText=d.style.cssText=s,r.style.marginRight=r.style.width="0",d.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),typeof d.style.zoom!==i&&(d.innerHTML="",d.style.cssText=s+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===d.offsetWidth,d.style.display="block",d.innerHTML="<div></div>",d.firstChild.style.width="5px",t.shrinkWrapBlocks=3!==d.offsetWidth,t.inlineBlockNeedsLayout&&(u.style.zoom=1)),u.removeChild(n),n=d=a=r=null)}),n=s=u=l=r=a=null,t}();var O=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,B=/([A-Z])/g;function P(e,n,r,i){if(b.acceptData(e)){var o,a,s=b.expando,u="string"==typeof n,l=e.nodeType,p=l?b.cache:e,f=l?e[s]:e[s]&&s;if(f&&p[f]&&(i||p[f].data)||!u||r!==t)return f||(l?e[s]=f=c.pop()||b.guid++:f=s),p[f]||(p[f]={},l||(p[f].toJSON=b.noop)),("object"==typeof n||"function"==typeof n)&&(i?p[f]=b.extend(p[f],n):p[f].data=b.extend(p[f].data,n)),o=p[f],i||(o.data||(o.data={}),o=o.data),r!==t&&(o[b.camelCase(n)]=r),u?(a=o[n],null==a&&(a=o[b.camelCase(n)])):a=o,a}}function R(e,t,n){if(b.acceptData(e)){var r,i,o,a=e.nodeType,s=a?b.cache:e,u=a?e[b.expando]:b.expando;if(s[u]){if(t&&(o=n?s[u]:s[u].data)){b.isArray(t)?t=t.concat(b.map(t,b.camelCase)):t in o?t=[t]:(t=b.camelCase(t),t=t in o?[t]:t.split(" "));for(r=0,i=t.length;i>r;r++)delete o[t[r]];if(!(n?$:b.isEmptyObject)(o))return}(n||(delete s[u].data,$(s[u])))&&(a?b.cleanData([e],!0):b.support.deleteExpando||s!=s.window?delete s[u]:s[u]=null)}}}b.extend({cache:{},expando:"jQuery"+(p+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?b.cache[e[b.expando]]:e[b.expando],!!e&&!$(e)},data:function(e,t,n){return P(e,t,n)},removeData:function(e,t){return R(e,t)},_data:function(e,t,n){return P(e,t,n,!0)},_removeData:function(e,t){return R(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!==e.nodeType&&9!==e.nodeType)return!1;var t=e.nodeName&&b.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),b.fn.extend({data:function(e,n){var r,i,o=this[0],a=0,s=null;if(e===t){if(this.length&&(s=b.data(o),1===o.nodeType&&!b._data(o,"parsedAttrs"))){for(r=o.attributes;r.length>a;a++)i=r[a].name,i.indexOf("data-")||(i=b.camelCase(i.slice(5)),W(o,i,s[i]));b._data(o,"parsedAttrs",!0)}return s}return"object"==typeof e?this.each(function(){b.data(this,e)}):b.access(this,function(n){return n===t?o?W(o,e,b.data(o,e)):null:(this.each(function(){b.data(this,e,n)}),t)},null,n,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){b.removeData(this,e)})}});function W(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(B,"-$1").toLowerCase();if(r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:O.test(r)?b.parseJSON(r):r}catch(o){}b.data(e,n,r)}else r=t}return r}function $(e){var t;for(t in e)if(("data"!==t||!b.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}b.extend({queue:function(e,n,r){var i;return e?(n=(n||"fx")+"queue",i=b._data(e,n),r&&(!i||b.isArray(r)?i=b._data(e,n,b.makeArray(r)):i.push(r)),i||[]):t},dequeue:function(e,t){t=t||"fx";var n=b.queue(e,t),r=n.length,i=n.shift(),o=b._queueHooks(e,t),a=function(){b.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),o.cur=i,i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return b._data(e,n)||b._data(e,n,{empty:b.Callbacks("once memory").add(function(){b._removeData(e,t+"queue"),b._removeData(e,n)})})}}),b.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),r>arguments.length?b.queue(this[0],e):n===t?this:this.each(function(){var t=b.queue(this,e,n);b._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&b.dequeue(this,e)})},dequeue:function(e){return this.each(function(){b.dequeue(this,e)})},delay:function(e,t){return e=b.fx?b.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,o=b.Deferred(),a=this,s=this.length,u=function(){--i||o.resolveWith(a,[a])};"string"!=typeof e&&(n=e,e=t),e=e||"fx";while(s--)r=b._data(a[s],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(u));return u(),o.promise(n)}});var I,z,X=/[\t\r\n]/g,U=/\r/g,V=/^(?:input|select|textarea|button|object)$/i,Y=/^(?:a|area)$/i,J=/^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i,G=/^(?:checked|selected)$/i,Q=b.support.getSetAttribute,K=b.support.input;b.fn.extend({attr:function(e,t){return b.access(this,b.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){b.removeAttr(this,e)})},prop:function(e,t){return b.access(this,b.prop,e,t,arguments.length>1)},removeProp:function(e){return e=b.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,o,a=0,s=this.length,u="string"==typeof e&&e;if(b.isFunction(e))return this.each(function(t){b(this).addClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(X," "):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=b.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,a=0,s=this.length,u=0===arguments.length||"string"==typeof e&&e;if(b.isFunction(e))return this.each(function(t){b(this).removeClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(X," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?b.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e,r="boolean"==typeof t;return b.isFunction(e)?this.each(function(n){b(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var o,a=0,s=b(this),u=t,l=e.match(w)||[];while(o=l[a++])u=r?u:!s.hasClass(o),s[u?"addClass":"removeClass"](o)}else(n===i||"boolean"===n)&&(this.className&&b._data(this,"__className__",this.className),this.className=this.className||e===!1?"":b._data(this,"__className__")||"")})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(X," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,o=this[0];{if(arguments.length)return i=b.isFunction(e),this.each(function(n){var o,a=b(this);1===this.nodeType&&(o=i?e.call(this,n,a.val()):e,null==o?o="":"number"==typeof o?o+="":b.isArray(o)&&(o=b.map(o,function(e){return null==e?"":e+""})),r=b.valHooks[this.type]||b.valHooks[this.nodeName.toLowerCase()],r&&"set"in r&&r.set(this,o,"value")!==t||(this.value=o))});if(o)return r=b.valHooks[o.type]||b.valHooks[o.nodeName.toLowerCase()],r&&"get"in r&&(n=r.get(o,"value"))!==t?n:(n=o.value,"string"==typeof n?n.replace(U,""):null==n?"":n)}}}),b.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,a=o?null:[],s=o?i+1:r.length,u=0>i?s:o?i:0;for(;s>u;u++)if(n=r[u],!(!n.selected&&u!==i||(b.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&b.nodeName(n.parentNode,"optgroup"))){if(t=b(n).val(),o)return t;a.push(t)}return a},set:function(e,t){var n=b.makeArray(t);return b(e).find("option").each(function(){this.selected=b.inArray(b(this).val(),n)>=0}),n.length||(e.selectedIndex=-1),n}}},attr:function(e,n,r){var o,a,s,u=e.nodeType;if(e&&3!==u&&8!==u&&2!==u)return typeof e.getAttribute===i?b.prop(e,n,r):(a=1!==u||!b.isXMLDoc(e),a&&(n=n.toLowerCase(),o=b.attrHooks[n]||(J.test(n)?z:I)),r===t?o&&a&&"get"in o&&null!==(s=o.get(e,n))?s:(typeof e.getAttribute!==i&&(s=e.getAttribute(n)),null==s?t:s):null!==r?o&&a&&"set"in o&&(s=o.set(e,r,n))!==t?s:(e.setAttribute(n,r+""),r):(b.removeAttr(e,n),t))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(w);if(o&&1===e.nodeType)while(n=o[i++])r=b.propFix[n]||n,J.test(n)?!Q&&G.test(n)?e[b.camelCase("default-"+n)]=e[r]=!1:e[r]=!1:b.attr(e,n,""),e.removeAttribute(Q?n:r)},attrHooks:{type:{set:function(e,t){if(!b.support.radioValue&&"radio"===t&&b.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(e,n,r){var i,o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return a=1!==s||!b.isXMLDoc(e),a&&(n=b.propFix[n]||n,o=b.propHooks[n]),r!==t?o&&"set"in o&&(i=o.set(e,r,n))!==t?i:e[n]=r:o&&"get"in o&&null!==(i=o.get(e,n))?i:e[n]},propHooks:{tabIndex:{get:function(e){var n=e.getAttributeNode("tabindex");return n&&n.specified?parseInt(n.value,10):V.test(e.nodeName)||Y.test(e.nodeName)&&e.href?0:t}}}}),z={get:function(e,n){var r=b.prop(e,n),i="boolean"==typeof r&&e.getAttribute(n),o="boolean"==typeof r?K&&Q?null!=i:G.test(n)?e[b.camelCase("default-"+n)]:!!i:e.getAttributeNode(n);return o&&o.value!==!1?n.toLowerCase():t},set:function(e,t,n){return t===!1?b.removeAttr(e,n):K&&Q||!G.test(n)?e.setAttribute(!Q&&b.propFix[n]||n,n):e[b.camelCase("default-"+n)]=e[n]=!0,n}},K&&Q||(b.attrHooks.value={get:function(e,n){var r=e.getAttributeNode(n);return b.nodeName(e,"input")?e.defaultValue:r&&r.specified?r.value:t},set:function(e,n,r){return b.nodeName(e,"input")?(e.defaultValue=n,t):I&&I.set(e,n,r)}}),Q||(I=b.valHooks.button={get:function(e,n){var r=e.getAttributeNode(n);return r&&("id"===n||"name"===n||"coords"===n?""!==r.value:r.specified)?r.value:t},set:function(e,n,r){var i=e.getAttributeNode(r);return i||e.setAttributeNode(i=e.ownerDocument.createAttribute(r)),i.value=n+="","value"===r||n===e.getAttribute(r)?n:t}},b.attrHooks.contenteditable={get:I.get,set:function(e,t,n){I.set(e,""===t?!1:t,n)}},b.each(["width","height"],function(e,n){b.attrHooks[n]=b.extend(b.attrHooks[n],{set:function(e,r){return""===r?(e.setAttribute(n,"auto"),r):t}})})),b.support.hrefNormalized||(b.each(["href","src","width","height"],function(e,n){b.attrHooks[n]=b.extend(b.attrHooks[n],{get:function(e){var r=e.getAttribute(n,2);return null==r?t:r}})}),b.each(["href","src"],function(e,t){b.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}})),b.support.style||(b.attrHooks.style={get:function(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t+""}}),b.support.optSelected||(b.propHooks.selected=b.extend(b.propHooks.selected,{get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),b.support.enctype||(b.propFix.enctype="encoding"),b.support.checkOn||b.each(["radio","checkbox"],function(){b.valHooks[this]={get:function(e){return null===e.getAttribute("value")?"on":e.value}}}),b.each(["radio","checkbox"],function(){b.valHooks[this]=b.extend(b.valHooks[this],{set:function(e,n){return b.isArray(n)?e.checked=b.inArray(b(e).val(),n)>=0:t}})});var Z=/^(?:input|select|textarea)$/i,et=/^key/,tt=/^(?:mouse|contextmenu)|click/,nt=/^(?:focusinfocus|focusoutblur)$/,rt=/^([^.]*)(?:\.(.+)|)$/;function it(){return!0}function ot(){return!1}b.event={global:{},add:function(e,n,r,o,a){var s,u,l,c,p,f,d,h,g,m,y,v=b._data(e);if(v){r.handler&&(c=r,r=c.handler,a=c.selector),r.guid||(r.guid=b.guid++),(u=v.events)||(u=v.events={}),(f=v.handle)||(f=v.handle=function(e){return typeof b===i||e&&b.event.triggered===e.type?t:b.event.dispatch.apply(f.elem,arguments)},f.elem=e),n=(n||"").match(w)||[""],l=n.length;while(l--)s=rt.exec(n[l])||[],g=y=s[1],m=(s[2]||"").split(".").sort(),p=b.event.special[g]||{},g=(a?p.delegateType:p.bindType)||g,p=b.event.special[g]||{},d=b.extend({type:g,origType:y,data:o,handler:r,guid:r.guid,selector:a,needsContext:a&&b.expr.match.needsContext.test(a),namespace:m.join(".")},c),(h=u[g])||(h=u[g]=[],h.delegateCount=0,p.setup&&p.setup.call(e,o,m,f)!==!1||(e.addEventListener?e.addEventListener(g,f,!1):e.attachEvent&&e.attachEvent("on"+g,f))),p.add&&(p.add.call(e,d),d.handler.guid||(d.handler.guid=r.guid)),a?h.splice(h.delegateCount++,0,d):h.push(d),b.event.global[g]=!0;e=null}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,p,f,d,h,g,m=b.hasData(e)&&b._data(e);if(m&&(c=m.events)){t=(t||"").match(w)||[""],l=t.length;while(l--)if(s=rt.exec(t[l])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){p=b.event.special[d]||{},d=(r?p.delegateType:p.bindType)||d,f=c[d]||[],s=s[2]&&RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),u=o=f.length;while(o--)a=f[o],!i&&g!==a.origType||n&&n.guid!==a.guid||s&&!s.test(a.namespace)||r&&r!==a.selector&&("**"!==r||!a.selector)||(f.splice(o,1),a.selector&&f.delegateCount--,p.remove&&p.remove.call(e,a));u&&!f.length&&(p.teardown&&p.teardown.call(e,h,m.handle)!==!1||b.removeEvent(e,d,m.handle),delete c[d])}else for(d in c)b.event.remove(e,d+t[l],n,r,!0);b.isEmptyObject(c)&&(delete m.handle,b._removeData(e,"events"))}},trigger:function(n,r,i,a){var s,u,l,c,p,f,d,h=[i||o],g=y.call(n,"type")?n.type:n,m=y.call(n,"namespace")?n.namespace.split("."):[];if(l=f=i=i||o,3!==i.nodeType&&8!==i.nodeType&&!nt.test(g+b.event.triggered)&&(g.indexOf(".")>=0&&(m=g.split("."),g=m.shift(),m.sort()),u=0>g.indexOf(":")&&"on"+g,n=n[b.expando]?n:new b.Event(g,"object"==typeof n&&n),n.isTrigger=!0,n.namespace=m.join("."),n.namespace_re=n.namespace?RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,n.result=t,n.target||(n.target=i),r=null==r?[n]:b.makeArray(r,[n]),p=b.event.special[g]||{},a||!p.trigger||p.trigger.apply(i,r)!==!1)){if(!a&&!p.noBubble&&!b.isWindow(i)){for(c=p.delegateType||g,nt.test(c+g)||(l=l.parentNode);l;l=l.parentNode)h.push(l),f=l;f===(i.ownerDocument||o)&&h.push(f.defaultView||f.parentWindow||e)}d=0;while((l=h[d++])&&!n.isPropagationStopped())n.type=d>1?c:p.bindType||g,s=(b._data(l,"events")||{})[n.type]&&b._data(l,"handle"),s&&s.apply(l,r),s=u&&l[u],s&&b.acceptData(l)&&s.apply&&s.apply(l,r)===!1&&n.preventDefault();if(n.type=g,!(a||n.isDefaultPrevented()||p._default&&p._default.apply(i.ownerDocument,r)!==!1||"click"===g&&b.nodeName(i,"a")||!b.acceptData(i)||!u||!i[g]||b.isWindow(i))){f=i[u],f&&(i[u]=null),b.event.triggered=g;try{i[g]()}catch(v){}b.event.triggered=t,f&&(i[u]=f)}return n.result}},dispatch:function(e){e=b.event.fix(e);var n,r,i,o,a,s=[],u=h.call(arguments),l=(b._data(this,"events")||{})[e.type]||[],c=b.event.special[e.type]||{};if(u[0]=e,e.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,e)!==!1){s=b.event.handlers.call(this,e,l),n=0;while((o=s[n++])&&!e.isPropagationStopped()){e.currentTarget=o.elem,a=0;while((i=o.handlers[a++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(i.namespace))&&(e.handleObj=i,e.data=i.data,r=((b.event.special[i.origType]||{}).handle||i.handler).apply(o.elem,u),r!==t&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,n){var r,i,o,a,s=[],u=n.delegateCount,l=e.target;if(u&&l.nodeType&&(!e.button||"click"!==e.type))for(;l!=this;l=l.parentNode||this)if(1===l.nodeType&&(l.disabled!==!0||"click"!==e.type)){for(o=[],a=0;u>a;a++)i=n[a],r=i.selector+" ",o[r]===t&&(o[r]=i.needsContext?b(r,this).index(l)>=0:b.find(r,this,null,[l]).length),o[r]&&o.push(i);o.length&&s.push({elem:l,handlers:o})}return n.length>u&&s.push({elem:this,handlers:n.slice(u)}),s},fix:function(e){if(e[b.expando])return e;var t,n,r,i=e.type,a=e,s=this.fixHooks[i];s||(this.fixHooks[i]=s=tt.test(i)?this.mouseHooks:et.test(i)?this.keyHooks:{}),r=s.props?this.props.concat(s.props):this.props,e=new b.Event(a),t=r.length;while(t--)n=r[t],e[n]=a[n];return e.target||(e.target=a.srcElement||o),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,a):e},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,i,a,s=n.button,u=n.fromElement;return null==e.pageX&&null!=n.clientX&&(i=e.target.ownerDocument||o,a=i.documentElement,r=i.body,e.pageX=n.clientX+(a&&a.scrollLeft||r&&r.scrollLeft||0)-(a&&a.clientLeft||r&&r.clientLeft||0),e.pageY=n.clientY+(a&&a.scrollTop||r&&r.scrollTop||0)-(a&&a.clientTop||r&&r.clientTop||0)),!e.relatedTarget&&u&&(e.relatedTarget=u===e.target?n.toElement:u),e.which||s===t||(e.which=1&s?1:2&s?3:4&s?2:0),e}},special:{load:{noBubble:!0},click:{trigger:function(){return b.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):t}},focus:{trigger:function(){if(this!==o.activeElement&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===o.activeElement&&this.blur?(this.blur(),!1):t},delegateType:"focusout"},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=b.extend(new b.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?b.event.trigger(i,null,t):b.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},b.removeEvent=o.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]===i&&(e[r]=null),e.detachEvent(r,n))},b.Event=function(e,n){return this instanceof b.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?it:ot):this.type=e,n&&b.extend(this,n),this.timeStamp=e&&e.timeStamp||b.now(),this[b.expando]=!0,t):new b.Event(e,n)},b.Event.prototype={isDefaultPrevented:ot,isPropagationStopped:ot,isImmediatePropagationStopped:ot,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=it,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=it,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=it,this.stopPropagation()}},b.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){b.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;
return(!i||i!==r&&!b.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),b.support.submitBubbles||(b.event.special.submit={setup:function(){return b.nodeName(this,"form")?!1:(b.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=b.nodeName(n,"input")||b.nodeName(n,"button")?n.form:t;r&&!b._data(r,"submitBubbles")&&(b.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),b._data(r,"submitBubbles",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&b.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return b.nodeName(this,"form")?!1:(b.event.remove(this,"._submit"),t)}}),b.support.changeBubbles||(b.event.special.change={setup:function(){return Z.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(b.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),b.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),b.event.simulate("change",this,e,!0)})),!1):(b.event.add(this,"beforeactivate._change",function(e){var t=e.target;Z.test(t.nodeName)&&!b._data(t,"changeBubbles")&&(b.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||b.event.simulate("change",this.parentNode,e,!0)}),b._data(t,"changeBubbles",!0))}),t)},handle:function(e){var n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?e.handleObj.handler.apply(this,arguments):t},teardown:function(){return b.event.remove(this,"._change"),!Z.test(this.nodeName)}}),b.support.focusinBubbles||b.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){b.event.simulate(t,e.target,b.event.fix(e),!0)};b.event.special[t]={setup:function(){0===n++&&o.addEventListener(e,r,!0)},teardown:function(){0===--n&&o.removeEventListener(e,r,!0)}}}),b.fn.extend({on:function(e,n,r,i,o){var a,s;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=t);for(a in e)this.on(a,n,r,e[a],o);return this}if(null==r&&null==i?(i=n,r=n=t):null==i&&("string"==typeof n?(i=r,r=t):(i=r,r=n,n=t)),i===!1)i=ot;else if(!i)return this;return 1===o&&(s=i,i=function(e){return b().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=b.guid++)),this.each(function(){b.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,o;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,b(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(o in e)this.off(o,n,e[o]);return this}return(n===!1||"function"==typeof n)&&(r=n,n=t),r===!1&&(r=ot),this.each(function(){b.event.remove(this,e,r,n)})},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},trigger:function(e,t){return this.each(function(){b.event.trigger(e,t,this)})},triggerHandler:function(e,n){var r=this[0];return r?b.event.trigger(e,n,r,!0):t}}),function(e,t){var n,r,i,o,a,s,u,l,c,p,f,d,h,g,m,y,v,x="sizzle"+-new Date,w=e.document,T={},N=0,C=0,k=it(),E=it(),S=it(),A=typeof t,j=1<<31,D=[],L=D.pop,H=D.push,q=D.slice,M=D.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},_="[\\x20\\t\\r\\n\\f]",F="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=F.replace("w","w#"),B="([*^$|!~]?=)",P="\\["+_+"*("+F+")"+_+"*(?:"+B+_+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+O+")|)|)"+_+"*\\]",R=":("+F+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+P.replace(3,8)+")*)|.*)\\)|)",W=RegExp("^"+_+"+|((?:^|[^\\\\])(?:\\\\.)*)"+_+"+$","g"),$=RegExp("^"+_+"*,"+_+"*"),I=RegExp("^"+_+"*([\\x20\\t\\r\\n\\f>+~])"+_+"*"),z=RegExp(R),X=RegExp("^"+O+"$"),U={ID:RegExp("^#("+F+")"),CLASS:RegExp("^\\.("+F+")"),NAME:RegExp("^\\[name=['\"]?("+F+")['\"]?\\]"),TAG:RegExp("^("+F.replace("w","w*")+")"),ATTR:RegExp("^"+P),PSEUDO:RegExp("^"+R),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+_+"*(even|odd|(([+-]|)(\\d*)n|)"+_+"*(?:([+-]|)"+_+"*(\\d+)|))"+_+"*\\)|)","i"),needsContext:RegExp("^"+_+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+_+"*((?:-\\d)?\\d*)"+_+"*\\)|)(?=[^-]|$)","i")},V=/[\x20\t\r\n\f]*[+~]/,Y=/^[^{]+\{\s*\[native code/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,G=/^(?:input|select|textarea|button)$/i,Q=/^h\d$/i,K=/'|\\/g,Z=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,et=/\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,tt=function(e,t){var n="0x"+t-65536;return n!==n?t:0>n?String.fromCharCode(n+65536):String.fromCharCode(55296|n>>10,56320|1023&n)};try{q.call(w.documentElement.childNodes,0)[0].nodeType}catch(nt){q=function(e){var t,n=[];while(t=this[e++])n.push(t);return n}}function rt(e){return Y.test(e+"")}function it(){var e,t=[];return e=function(n,r){return t.push(n+=" ")>i.cacheLength&&delete e[t.shift()],e[n]=r}}function ot(e){return e[x]=!0,e}function at(e){var t=p.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}}function st(e,t,n,r){var i,o,a,s,u,l,f,g,m,v;if((t?t.ownerDocument||t:w)!==p&&c(t),t=t||p,n=n||[],!e||"string"!=typeof e)return n;if(1!==(s=t.nodeType)&&9!==s)return[];if(!d&&!r){if(i=J.exec(e))if(a=i[1]){if(9===s){if(o=t.getElementById(a),!o||!o.parentNode)return n;if(o.id===a)return n.push(o),n}else if(t.ownerDocument&&(o=t.ownerDocument.getElementById(a))&&y(t,o)&&o.id===a)return n.push(o),n}else{if(i[2])return H.apply(n,q.call(t.getElementsByTagName(e),0)),n;if((a=i[3])&&T.getByClassName&&t.getElementsByClassName)return H.apply(n,q.call(t.getElementsByClassName(a),0)),n}if(T.qsa&&!h.test(e)){if(f=!0,g=x,m=t,v=9===s&&e,1===s&&"object"!==t.nodeName.toLowerCase()){l=ft(e),(f=t.getAttribute("id"))?g=f.replace(K,"\\$&"):t.setAttribute("id",g),g="[id='"+g+"'] ",u=l.length;while(u--)l[u]=g+dt(l[u]);m=V.test(e)&&t.parentNode||t,v=l.join(",")}if(v)try{return H.apply(n,q.call(m.querySelectorAll(v),0)),n}catch(b){}finally{f||t.removeAttribute("id")}}}return wt(e.replace(W,"$1"),t,n,r)}a=st.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},c=st.setDocument=function(e){var n=e?e.ownerDocument||e:w;return n!==p&&9===n.nodeType&&n.documentElement?(p=n,f=n.documentElement,d=a(n),T.tagNameNoComments=at(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),T.attributes=at(function(e){e.innerHTML="<select></select>";var t=typeof e.lastChild.getAttribute("multiple");return"boolean"!==t&&"string"!==t}),T.getByClassName=at(function(e){return e.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",e.getElementsByClassName&&e.getElementsByClassName("e").length?(e.lastChild.className="e",2===e.getElementsByClassName("e").length):!1}),T.getByName=at(function(e){e.id=x+0,e.innerHTML="<a name='"+x+"'></a><div name='"+x+"'></div>",f.insertBefore(e,f.firstChild);var t=n.getElementsByName&&n.getElementsByName(x).length===2+n.getElementsByName(x+0).length;return T.getIdNotName=!n.getElementById(x),f.removeChild(e),t}),i.attrHandle=at(function(e){return e.innerHTML="<a href='#'></a>",e.firstChild&&typeof e.firstChild.getAttribute!==A&&"#"===e.firstChild.getAttribute("href")})?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},T.getIdNotName?(i.find.ID=function(e,t){if(typeof t.getElementById!==A&&!d){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},i.filter.ID=function(e){var t=e.replace(et,tt);return function(e){return e.getAttribute("id")===t}}):(i.find.ID=function(e,n){if(typeof n.getElementById!==A&&!d){var r=n.getElementById(e);return r?r.id===e||typeof r.getAttributeNode!==A&&r.getAttributeNode("id").value===e?[r]:t:[]}},i.filter.ID=function(e){var t=e.replace(et,tt);return function(e){var n=typeof e.getAttributeNode!==A&&e.getAttributeNode("id");return n&&n.value===t}}),i.find.TAG=T.tagNameNoComments?function(e,n){return typeof n.getElementsByTagName!==A?n.getElementsByTagName(e):t}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},i.find.NAME=T.getByName&&function(e,n){return typeof n.getElementsByName!==A?n.getElementsByName(name):t},i.find.CLASS=T.getByClassName&&function(e,n){return typeof n.getElementsByClassName===A||d?t:n.getElementsByClassName(e)},g=[],h=[":focus"],(T.qsa=rt(n.querySelectorAll))&&(at(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||h.push("\\["+_+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||h.push(":checked")}),at(function(e){e.innerHTML="<input type='hidden' i=''/>",e.querySelectorAll("[i^='']").length&&h.push("[*^$]="+_+"*(?:\"\"|'')"),e.querySelectorAll(":enabled").length||h.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),h.push(",.*:")})),(T.matchesSelector=rt(m=f.matchesSelector||f.mozMatchesSelector||f.webkitMatchesSelector||f.oMatchesSelector||f.msMatchesSelector))&&at(function(e){T.disconnectedMatch=m.call(e,"div"),m.call(e,"[s!='']:x"),g.push("!=",R)}),h=RegExp(h.join("|")),g=RegExp(g.join("|")),y=rt(f.contains)||f.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},v=f.compareDocumentPosition?function(e,t){var r;return e===t?(u=!0,0):(r=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(t))?1&r||e.parentNode&&11===e.parentNode.nodeType?e===n||y(w,e)?-1:t===n||y(w,t)?1:0:4&r?-1:1:e.compareDocumentPosition?-1:1}:function(e,t){var r,i=0,o=e.parentNode,a=t.parentNode,s=[e],l=[t];if(e===t)return u=!0,0;if(!o||!a)return e===n?-1:t===n?1:o?-1:a?1:0;if(o===a)return ut(e,t);r=e;while(r=r.parentNode)s.unshift(r);r=t;while(r=r.parentNode)l.unshift(r);while(s[i]===l[i])i++;return i?ut(s[i],l[i]):s[i]===w?-1:l[i]===w?1:0},u=!1,[0,0].sort(v),T.detectDuplicates=u,p):p},st.matches=function(e,t){return st(e,null,null,t)},st.matchesSelector=function(e,t){if((e.ownerDocument||e)!==p&&c(e),t=t.replace(Z,"='$1']"),!(!T.matchesSelector||d||g&&g.test(t)||h.test(t)))try{var n=m.call(e,t);if(n||T.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(r){}return st(t,p,null,[e]).length>0},st.contains=function(e,t){return(e.ownerDocument||e)!==p&&c(e),y(e,t)},st.attr=function(e,t){var n;return(e.ownerDocument||e)!==p&&c(e),d||(t=t.toLowerCase()),(n=i.attrHandle[t])?n(e):d||T.attributes?e.getAttribute(t):((n=e.getAttributeNode(t))||e.getAttribute(t))&&e[t]===!0?t:n&&n.specified?n.value:null},st.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},st.uniqueSort=function(e){var t,n=[],r=1,i=0;if(u=!T.detectDuplicates,e.sort(v),u){for(;t=e[r];r++)t===e[r-1]&&(i=n.push(r));while(i--)e.splice(n[i],1)}return e};function ut(e,t){var n=t&&e,r=n&&(~t.sourceIndex||j)-(~e.sourceIndex||j);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function lt(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function ct(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function pt(e){return ot(function(t){return t=+t,ot(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}o=st.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=o(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=o(t);return n},i=st.selectors={cacheLength:50,createPseudo:ot,match:U,find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(et,tt),e[3]=(e[4]||e[5]||"").replace(et,tt),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||st.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&st.error(e[0]),e},PSEUDO:function(e){var t,n=!e[5]&&e[2];return U.CHILD.test(e[0])?null:(e[4]?e[2]=e[4]:n&&z.test(n)&&(t=ft(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){return"*"===e?function(){return!0}:(e=e.replace(et,tt).toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=k[e+" "];return t||(t=RegExp("(^|"+_+")"+e+"("+_+"|$)"))&&k(e,function(e){return t.test(e.className||typeof e.getAttribute!==A&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=st.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,p,f,d,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!u&&!s;if(m){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===y:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?m.firstChild:m.lastChild],a&&v){c=m[x]||(m[x]={}),l=c[e]||[],d=l[0]===N&&l[1],f=l[0]===N&&l[2],p=d&&m.childNodes[d];while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if(1===p.nodeType&&++f&&p===t){c[e]=[N,d,f];break}}else if(v&&(l=(t[x]||(t[x]={}))[e])&&l[0]===N)f=l[1];else while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===y:1===p.nodeType)&&++f&&(v&&((p[x]||(p[x]={}))[e]=[N,f]),p===t))break;return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||st.error("unsupported pseudo: "+e);return r[x]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?ot(function(e,n){var i,o=r(e,t),a=o.length;while(a--)i=M.call(e,o[a]),e[i]=!(n[i]=o[a])}):function(e){return r(e,0,n)}):r}},pseudos:{not:ot(function(e){var t=[],n=[],r=s(e.replace(W,"$1"));return r[x]?ot(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:ot(function(e){return function(t){return st(e,t).length>0}}),contains:ot(function(e){return function(t){return(t.textContent||t.innerText||o(t)).indexOf(e)>-1}}),lang:ot(function(e){return X.test(e||"")||st.error("unsupported lang: "+e),e=e.replace(et,tt).toLowerCase(),function(t){var n;do if(n=d?t.getAttribute("xml:lang")||t.getAttribute("lang"):t.lang)return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===f},focus:function(e){return e===p.activeElement&&(!p.hasFocus||p.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!i.pseudos.empty(e)},header:function(e){return Q.test(e.nodeName)},input:function(e){return G.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:pt(function(){return[0]}),last:pt(function(e,t){return[t-1]}),eq:pt(function(e,t,n){return[0>n?n+t:n]}),even:pt(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:pt(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:pt(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:pt(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}};for(n in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})i.pseudos[n]=lt(n);for(n in{submit:!0,reset:!0})i.pseudos[n]=ct(n);function ft(e,t){var n,r,o,a,s,u,l,c=E[e+" "];if(c)return t?0:c.slice(0);s=e,u=[],l=i.preFilter;while(s){(!n||(r=$.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),u.push(o=[])),n=!1,(r=I.exec(s))&&(n=r.shift(),o.push({value:n,type:r[0].replace(W," ")}),s=s.slice(n.length));for(a in i.filter)!(r=U[a].exec(s))||l[a]&&!(r=l[a](r))||(n=r.shift(),o.push({value:n,type:a,matches:r}),s=s.slice(n.length));if(!n)break}return t?s.length:s?st.error(e):E(e,u).slice(0)}function dt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function ht(e,t,n){var i=t.dir,o=n&&"parentNode"===i,a=C++;return t.first?function(t,n,r){while(t=t[i])if(1===t.nodeType||o)return e(t,n,r)}:function(t,n,s){var u,l,c,p=N+" "+a;if(s){while(t=t[i])if((1===t.nodeType||o)&&e(t,n,s))return!0}else while(t=t[i])if(1===t.nodeType||o)if(c=t[x]||(t[x]={}),(l=c[i])&&l[0]===p){if((u=l[1])===!0||u===r)return u===!0}else if(l=c[i]=[p],l[1]=e(t,n,s)||r,l[1]===!0)return!0}}function gt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function mt(e,t,n,r,i){var o,a=[],s=0,u=e.length,l=null!=t;for(;u>s;s++)(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),l&&t.push(s));return a}function yt(e,t,n,r,i,o){return r&&!r[x]&&(r=yt(r)),i&&!i[x]&&(i=yt(i,o)),ot(function(o,a,s,u){var l,c,p,f=[],d=[],h=a.length,g=o||xt(t||"*",s.nodeType?[s]:s,[]),m=!e||!o&&t?g:mt(g,f,e,s,u),y=n?i||(o?e:h||r)?[]:a:m;if(n&&n(m,y,s,u),r){l=mt(y,d),r(l,[],s,u),c=l.length;while(c--)(p=l[c])&&(y[d[c]]=!(m[d[c]]=p))}if(o){if(i||e){if(i){l=[],c=y.length;while(c--)(p=y[c])&&l.push(m[c]=p);i(null,y=[],l,u)}c=y.length;while(c--)(p=y[c])&&(l=i?M.call(o,p):f[c])>-1&&(o[l]=!(a[l]=p))}}else y=mt(y===a?y.splice(h,y.length):y),i?i(null,a,y,u):H.apply(a,y)})}function vt(e){var t,n,r,o=e.length,a=i.relative[e[0].type],s=a||i.relative[" "],u=a?1:0,c=ht(function(e){return e===t},s,!0),p=ht(function(e){return M.call(t,e)>-1},s,!0),f=[function(e,n,r){return!a&&(r||n!==l)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;o>u;u++)if(n=i.relative[e[u].type])f=[ht(gt(f),n)];else{if(n=i.filter[e[u].type].apply(null,e[u].matches),n[x]){for(r=++u;o>r;r++)if(i.relative[e[r].type])break;return yt(u>1&>(f),u>1&&dt(e.slice(0,u-1)).replace(W,"$1"),n,r>u&&vt(e.slice(u,r)),o>r&&vt(e=e.slice(r)),o>r&&dt(e))}f.push(n)}return gt(f)}function bt(e,t){var n=0,o=t.length>0,a=e.length>0,s=function(s,u,c,f,d){var h,g,m,y=[],v=0,b="0",x=s&&[],w=null!=d,T=l,C=s||a&&i.find.TAG("*",d&&u.parentNode||u),k=N+=null==T?1:Math.random()||.1;for(w&&(l=u!==p&&u,r=n);null!=(h=C[b]);b++){if(a&&h){g=0;while(m=e[g++])if(m(h,u,c)){f.push(h);break}w&&(N=k,r=++n)}o&&((h=!m&&h)&&v--,s&&x.push(h))}if(v+=b,o&&b!==v){g=0;while(m=t[g++])m(x,y,u,c);if(s){if(v>0)while(b--)x[b]||y[b]||(y[b]=L.call(f));y=mt(y)}H.apply(f,y),w&&!s&&y.length>0&&v+t.length>1&&st.uniqueSort(f)}return w&&(N=k,l=T),x};return o?ot(s):s}s=st.compile=function(e,t){var n,r=[],i=[],o=S[e+" "];if(!o){t||(t=ft(e)),n=t.length;while(n--)o=vt(t[n]),o[x]?r.push(o):i.push(o);o=S(e,bt(i,r))}return o};function xt(e,t,n){var r=0,i=t.length;for(;i>r;r++)st(e,t[r],n);return n}function wt(e,t,n,r){var o,a,u,l,c,p=ft(e);if(!r&&1===p.length){if(a=p[0]=p[0].slice(0),a.length>2&&"ID"===(u=a[0]).type&&9===t.nodeType&&!d&&i.relative[a[1].type]){if(t=i.find.ID(u.matches[0].replace(et,tt),t)[0],!t)return n;e=e.slice(a.shift().value.length)}o=U.needsContext.test(e)?0:a.length;while(o--){if(u=a[o],i.relative[l=u.type])break;if((c=i.find[l])&&(r=c(u.matches[0].replace(et,tt),V.test(a[0].type)&&t.parentNode||t))){if(a.splice(o,1),e=r.length&&dt(a),!e)return H.apply(n,q.call(r,0)),n;break}}}return s(e,p)(r,t,d,n,V.test(e)),n}i.pseudos.nth=i.pseudos.eq;function Tt(){}i.filters=Tt.prototype=i.pseudos,i.setFilters=new Tt,c(),st.attr=b.attr,b.find=st,b.expr=st.selectors,b.expr[":"]=b.expr.pseudos,b.unique=st.uniqueSort,b.text=st.getText,b.isXMLDoc=st.isXML,b.contains=st.contains}(e);var at=/Until$/,st=/^(?:parents|prev(?:Until|All))/,ut=/^.[^:#\[\.,]*$/,lt=b.expr.match.needsContext,ct={children:!0,contents:!0,next:!0,prev:!0};b.fn.extend({find:function(e){var t,n,r,i=this.length;if("string"!=typeof e)return r=this,this.pushStack(b(e).filter(function(){for(t=0;i>t;t++)if(b.contains(r[t],this))return!0}));for(n=[],t=0;i>t;t++)b.find(e,this[t],n);return n=this.pushStack(i>1?b.unique(n):n),n.selector=(this.selector?this.selector+" ":"")+e,n},has:function(e){var t,n=b(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(b.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e,!1))},filter:function(e){return this.pushStack(ft(this,e,!0))},is:function(e){return!!e&&("string"==typeof e?lt.test(e)?b(e,this.context).index(this[0])>=0:b.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n,r=0,i=this.length,o=[],a=lt.test(e)||"string"!=typeof e?b(e,t||this.context):0;for(;i>r;r++){n=this[r];while(n&&n.ownerDocument&&n!==t&&11!==n.nodeType){if(a?a.index(n)>-1:b.find.matchesSelector(n,e)){o.push(n);break}n=n.parentNode}}return this.pushStack(o.length>1?b.unique(o):o)},index:function(e){return e?"string"==typeof e?b.inArray(this[0],b(e)):b.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?b(e,t):b.makeArray(e&&e.nodeType?[e]:e),r=b.merge(this.get(),n);return this.pushStack(b.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),b.fn.andSelf=b.fn.addBack;function pt(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}b.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return b.dir(e,"parentNode")},parentsUntil:function(e,t,n){return b.dir(e,"parentNode",n)},next:function(e){return pt(e,"nextSibling")},prev:function(e){return pt(e,"previousSibling")},nextAll:function(e){return b.dir(e,"nextSibling")},prevAll:function(e){return b.dir(e,"previousSibling")},nextUntil:function(e,t,n){return b.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return b.dir(e,"previousSibling",n)},siblings:function(e){return b.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return b.sibling(e.firstChild)},contents:function(e){return b.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:b.merge([],e.childNodes)}},function(e,t){b.fn[e]=function(n,r){var i=b.map(this,t,n);return at.test(e)||(r=n),r&&"string"==typeof r&&(i=b.filter(r,i)),i=this.length>1&&!ct[e]?b.unique(i):i,this.length>1&&st.test(e)&&(i=i.reverse()),this.pushStack(i)}}),b.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),1===t.length?b.find.matchesSelector(t[0],e)?[t[0]]:[]:b.find.matches(e,t)},dir:function(e,n,r){var i=[],o=e[n];while(o&&9!==o.nodeType&&(r===t||1!==o.nodeType||!b(o).is(r)))1===o.nodeType&&i.push(o),o=o[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});function ft(e,t,n){if(t=t||0,b.isFunction(t))return b.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return b.grep(e,function(e){return e===t===n});if("string"==typeof t){var r=b.grep(e,function(e){return 1===e.nodeType});if(ut.test(t))return b.filter(t,r,!n);t=b.filter(t,r)}return b.grep(e,function(e){return b.inArray(e,t)>=0===n})}function dt(e){var t=ht.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}var ht="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",gt=/ jQuery\d+="(?:null|\d+)"/g,mt=RegExp("<(?:"+ht+")[\\s/>]","i"),yt=/^\s+/,vt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bt=/<([\w:]+)/,xt=/<tbody/i,wt=/<|&#?\w+;/,Tt=/<(?:script|style|link)/i,Nt=/^(?:checkbox|radio)$/i,Ct=/checked\s*(?:[^=]|=\s*.checked.)/i,kt=/^$|\/(?:java|ecma)script/i,Et=/^true\/(.*)/,St=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,At={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:b.support.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},jt=dt(o),Dt=jt.appendChild(o.createElement("div"));At.optgroup=At.option,At.tbody=At.tfoot=At.colgroup=At.caption=At.thead,At.th=At.td,b.fn.extend({text:function(e){return b.access(this,function(e){return e===t?b.text(this):this.empty().append((this[0]&&this[0].ownerDocument||o).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(b.isFunction(e))return this.each(function(t){b(this).wrapAll(e.call(this,t))});if(this[0]){var t=b(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&1===e.firstChild.nodeType)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return b.isFunction(e)?this.each(function(t){b(this).wrapInner(e.call(this,t))}):this.each(function(){var t=b(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=b.isFunction(e);return this.each(function(n){b(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){b.nodeName(this,"body")||b(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.insertBefore(e,this.firstChild)})},before:function(){return this.domManip(arguments,!1,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,!1,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=0;for(;null!=(n=this[r]);r++)(!e||b.filter(e,[n]).length>0)&&(t||1!==n.nodeType||b.cleanData(Ot(n)),n.parentNode&&(t&&b.contains(n.ownerDocument,n)&&Mt(Ot(n,"script")),n.parentNode.removeChild(n)));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++){1===e.nodeType&&b.cleanData(Ot(e,!1));while(e.firstChild)e.removeChild(e.firstChild);e.options&&b.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return b.clone(this,e,t)})},html:function(e){return b.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return 1===n.nodeType?n.innerHTML.replace(gt,""):t;if(!("string"!=typeof e||Tt.test(e)||!b.support.htmlSerialize&&mt.test(e)||!b.support.leadingWhitespace&&yt.test(e)||At[(bt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(vt,"<$1></$2>");try{for(;i>r;r++)n=this[r]||{},1===n.nodeType&&(b.cleanData(Ot(n,!1)),n.innerHTML=e);n=0}catch(o){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){var t=b.isFunction(e);return t||"string"==typeof e||(e=b(e).not(this).detach()),this.domManip([e],!0,function(e){var t=this.nextSibling,n=this.parentNode;n&&(b(this).remove(),n.insertBefore(e,t))})},detach:function(e){return this.remove(e,!0)},domManip:function(e,n,r){e=f.apply([],e);var i,o,a,s,u,l,c=0,p=this.length,d=this,h=p-1,g=e[0],m=b.isFunction(g);if(m||!(1>=p||"string"!=typeof g||b.support.checkClone)&&Ct.test(g))return this.each(function(i){var o=d.eq(i);m&&(e[0]=g.call(this,i,n?o.html():t)),o.domManip(e,n,r)});if(p&&(l=b.buildFragment(e,this[0].ownerDocument,!1,this),i=l.firstChild,1===l.childNodes.length&&(l=i),i)){for(n=n&&b.nodeName(i,"tr"),s=b.map(Ot(l,"script"),Ht),a=s.length;p>c;c++)o=l,c!==h&&(o=b.clone(o,!0,!0),a&&b.merge(s,Ot(o,"script"))),r.call(n&&b.nodeName(this[c],"table")?Lt(this[c],"tbody"):this[c],o,c);if(a)for(u=s[s.length-1].ownerDocument,b.map(s,qt),c=0;a>c;c++)o=s[c],kt.test(o.type||"")&&!b._data(o,"globalEval")&&b.contains(u,o)&&(o.src?b.ajax({url:o.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):b.globalEval((o.text||o.textContent||o.innerHTML||"").replace(St,"")));l=i=null}return this}});function Lt(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function Ht(e){var t=e.getAttributeNode("type");return e.type=(t&&t.specified)+"/"+e.type,e}function qt(e){var t=Et.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function Mt(e,t){var n,r=0;for(;null!=(n=e[r]);r++)b._data(n,"globalEval",!t||b._data(t[r],"globalEval"))}function _t(e,t){if(1===t.nodeType&&b.hasData(e)){var n,r,i,o=b._data(e),a=b._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;i>r;r++)b.event.add(t,n,s[n][r])}a.data&&(a.data=b.extend({},a.data))}}function Ft(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!b.support.noCloneEvent&&t[b.expando]){i=b._data(t);for(r in i.events)b.removeEvent(t,r,i.handle);t.removeAttribute(b.expando)}"script"===n&&t.text!==e.text?(Ht(t).text=e.text,qt(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),b.support.html5Clone&&e.innerHTML&&!b.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Nt.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}b.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){b.fn[e]=function(e){var n,r=0,i=[],o=b(e),a=o.length-1;for(;a>=r;r++)n=r===a?this:this.clone(!0),b(o[r])[t](n),d.apply(i,n.get());return this.pushStack(i)}});function Ot(e,n){var r,o,a=0,s=typeof e.getElementsByTagName!==i?e.getElementsByTagName(n||"*"):typeof e.querySelectorAll!==i?e.querySelectorAll(n||"*"):t;if(!s)for(s=[],r=e.childNodes||e;null!=(o=r[a]);a++)!n||b.nodeName(o,n)?s.push(o):b.merge(s,Ot(o,n));return n===t||n&&b.nodeName(e,n)?b.merge([e],s):s}function Bt(e){Nt.test(e.type)&&(e.defaultChecked=e.checked)}b.extend({clone:function(e,t,n){var r,i,o,a,s,u=b.contains(e.ownerDocument,e);if(b.support.html5Clone||b.isXMLDoc(e)||!mt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(Dt.innerHTML=e.outerHTML,Dt.removeChild(o=Dt.firstChild)),!(b.support.noCloneEvent&&b.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||b.isXMLDoc(e)))for(r=Ot(o),s=Ot(e),a=0;null!=(i=s[a]);++a)r[a]&&Ft(i,r[a]);if(t)if(n)for(s=s||Ot(e),r=r||Ot(o),a=0;null!=(i=s[a]);a++)_t(i,r[a]);else _t(e,o);return r=Ot(o,"script"),r.length>0&&Mt(r,!u&&Ot(e,"script")),r=s=i=null,o},buildFragment:function(e,t,n,r){var i,o,a,s,u,l,c,p=e.length,f=dt(t),d=[],h=0;for(;p>h;h++)if(o=e[h],o||0===o)if("object"===b.type(o))b.merge(d,o.nodeType?[o]:o);else if(wt.test(o)){s=s||f.appendChild(t.createElement("div")),u=(bt.exec(o)||["",""])[1].toLowerCase(),c=At[u]||At._default,s.innerHTML=c[1]+o.replace(vt,"<$1></$2>")+c[2],i=c[0];while(i--)s=s.lastChild;if(!b.support.leadingWhitespace&&yt.test(o)&&d.push(t.createTextNode(yt.exec(o)[0])),!b.support.tbody){o="table"!==u||xt.test(o)?"<table>"!==c[1]||xt.test(o)?0:s:s.firstChild,i=o&&o.childNodes.length;while(i--)b.nodeName(l=o.childNodes[i],"tbody")&&!l.childNodes.length&&o.removeChild(l)
}b.merge(d,s.childNodes),s.textContent="";while(s.firstChild)s.removeChild(s.firstChild);s=f.lastChild}else d.push(t.createTextNode(o));s&&f.removeChild(s),b.support.appendChecked||b.grep(Ot(d,"input"),Bt),h=0;while(o=d[h++])if((!r||-1===b.inArray(o,r))&&(a=b.contains(o.ownerDocument,o),s=Ot(f.appendChild(o),"script"),a&&Mt(s),n)){i=0;while(o=s[i++])kt.test(o.type||"")&&n.push(o)}return s=null,f},cleanData:function(e,t){var n,r,o,a,s=0,u=b.expando,l=b.cache,p=b.support.deleteExpando,f=b.event.special;for(;null!=(n=e[s]);s++)if((t||b.acceptData(n))&&(o=n[u],a=o&&l[o])){if(a.events)for(r in a.events)f[r]?b.event.remove(n,r):b.removeEvent(n,r,a.handle);l[o]&&(delete l[o],p?delete n[u]:typeof n.removeAttribute!==i?n.removeAttribute(u):n[u]=null,c.push(o))}}});var Pt,Rt,Wt,$t=/alpha\([^)]*\)/i,It=/opacity\s*=\s*([^)]*)/,zt=/^(top|right|bottom|left)$/,Xt=/^(none|table(?!-c[ea]).+)/,Ut=/^margin/,Vt=RegExp("^("+x+")(.*)$","i"),Yt=RegExp("^("+x+")(?!px)[a-z%]+$","i"),Jt=RegExp("^([+-])=("+x+")","i"),Gt={BODY:"block"},Qt={position:"absolute",visibility:"hidden",display:"block"},Kt={letterSpacing:0,fontWeight:400},Zt=["Top","Right","Bottom","Left"],en=["Webkit","O","Moz","ms"];function tn(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=en.length;while(i--)if(t=en[i]+n,t in e)return t;return r}function nn(e,t){return e=t||e,"none"===b.css(e,"display")||!b.contains(e.ownerDocument,e)}function rn(e,t){var n,r,i,o=[],a=0,s=e.length;for(;s>a;a++)r=e[a],r.style&&(o[a]=b._data(r,"olddisplay"),n=r.style.display,t?(o[a]||"none"!==n||(r.style.display=""),""===r.style.display&&nn(r)&&(o[a]=b._data(r,"olddisplay",un(r.nodeName)))):o[a]||(i=nn(r),(n&&"none"!==n||!i)&&b._data(r,"olddisplay",i?n:b.css(r,"display"))));for(a=0;s>a;a++)r=e[a],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[a]||"":"none"));return e}b.fn.extend({css:function(e,n){return b.access(this,function(e,n,r){var i,o,a={},s=0;if(b.isArray(n)){for(o=Rt(e),i=n.length;i>s;s++)a[n[s]]=b.css(e,n[s],!1,o);return a}return r!==t?b.style(e,n,r):b.css(e,n)},e,n,arguments.length>1)},show:function(){return rn(this,!0)},hide:function(){return rn(this)},toggle:function(e){var t="boolean"==typeof e;return this.each(function(){(t?e:nn(this))?b(this).show():b(this).hide()})}}),b.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Wt(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":b.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,s,u=b.camelCase(n),l=e.style;if(n=b.cssProps[u]||(b.cssProps[u]=tn(l,u)),s=b.cssHooks[n]||b.cssHooks[u],r===t)return s&&"get"in s&&(o=s.get(e,!1,i))!==t?o:l[n];if(a=typeof r,"string"===a&&(o=Jt.exec(r))&&(r=(o[1]+1)*o[2]+parseFloat(b.css(e,n)),a="number"),!(null==r||"number"===a&&isNaN(r)||("number"!==a||b.cssNumber[u]||(r+="px"),b.support.clearCloneStyle||""!==r||0!==n.indexOf("background")||(l[n]="inherit"),s&&"set"in s&&(r=s.set(e,r,i))===t)))try{l[n]=r}catch(c){}}},css:function(e,n,r,i){var o,a,s,u=b.camelCase(n);return n=b.cssProps[u]||(b.cssProps[u]=tn(e.style,u)),s=b.cssHooks[n]||b.cssHooks[u],s&&"get"in s&&(a=s.get(e,!0,r)),a===t&&(a=Wt(e,n,i)),"normal"===a&&n in Kt&&(a=Kt[n]),""===r||r?(o=parseFloat(a),r===!0||b.isNumeric(o)?o||0:a):a},swap:function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i}}),e.getComputedStyle?(Rt=function(t){return e.getComputedStyle(t,null)},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),u=s?s.getPropertyValue(n)||s[n]:t,l=e.style;return s&&(""!==u||b.contains(e.ownerDocument,e)||(u=b.style(e,n)),Yt.test(u)&&Ut.test(n)&&(i=l.width,o=l.minWidth,a=l.maxWidth,l.minWidth=l.maxWidth=l.width=u,u=s.width,l.width=i,l.minWidth=o,l.maxWidth=a)),u}):o.documentElement.currentStyle&&(Rt=function(e){return e.currentStyle},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),u=s?s[n]:t,l=e.style;return null==u&&l&&l[n]&&(u=l[n]),Yt.test(u)&&!zt.test(n)&&(i=l.left,o=e.runtimeStyle,a=o&&o.left,a&&(o.left=e.currentStyle.left),l.left="fontSize"===n?"1em":u,u=l.pixelLeft+"px",l.left=i,a&&(o.left=a)),""===u?"auto":u});function on(e,t,n){var r=Vt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function an(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:0,a=0;for(;4>o;o+=2)"margin"===n&&(a+=b.css(e,n+Zt[o],!0,i)),r?("content"===n&&(a-=b.css(e,"padding"+Zt[o],!0,i)),"margin"!==n&&(a-=b.css(e,"border"+Zt[o]+"Width",!0,i))):(a+=b.css(e,"padding"+Zt[o],!0,i),"padding"!==n&&(a+=b.css(e,"border"+Zt[o]+"Width",!0,i)));return a}function sn(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=Rt(e),a=b.support.boxSizing&&"border-box"===b.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=Wt(e,t,o),(0>i||null==i)&&(i=e.style[t]),Yt.test(i))return i;r=a&&(b.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+an(e,t,n||(a?"border":"content"),r,o)+"px"}function un(e){var t=o,n=Gt[e];return n||(n=ln(e,t),"none"!==n&&n||(Pt=(Pt||b("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(t.documentElement),t=(Pt[0].contentWindow||Pt[0].contentDocument).document,t.write("<!doctype html><html><body>"),t.close(),n=ln(e,t),Pt.detach()),Gt[e]=n),n}function ln(e,t){var n=b(t.createElement(e)).appendTo(t.body),r=b.css(n[0],"display");return n.remove(),r}b.each(["height","width"],function(e,n){b.cssHooks[n]={get:function(e,r,i){return r?0===e.offsetWidth&&Xt.test(b.css(e,"display"))?b.swap(e,Qt,function(){return sn(e,n,i)}):sn(e,n,i):t},set:function(e,t,r){var i=r&&Rt(e);return on(e,t,r?an(e,n,r,b.support.boxSizing&&"border-box"===b.css(e,"boxSizing",!1,i),i):0)}}}),b.support.opacity||(b.cssHooks.opacity={get:function(e,t){return It.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=b.isNumeric(t)?"alpha(opacity="+100*t+")":"",o=r&&r.filter||n.filter||"";n.zoom=1,(t>=1||""===t)&&""===b.trim(o.replace($t,""))&&n.removeAttribute&&(n.removeAttribute("filter"),""===t||r&&!r.filter)||(n.filter=$t.test(o)?o.replace($t,i):o+" "+i)}}),b(function(){b.support.reliableMarginRight||(b.cssHooks.marginRight={get:function(e,n){return n?b.swap(e,{display:"inline-block"},Wt,[e,"marginRight"]):t}}),!b.support.pixelPosition&&b.fn.position&&b.each(["top","left"],function(e,n){b.cssHooks[n]={get:function(e,r){return r?(r=Wt(e,n),Yt.test(r)?b(e).position()[n]+"px":r):t}}})}),b.expr&&b.expr.filters&&(b.expr.filters.hidden=function(e){return 0>=e.offsetWidth&&0>=e.offsetHeight||!b.support.reliableHiddenOffsets&&"none"===(e.style&&e.style.display||b.css(e,"display"))},b.expr.filters.visible=function(e){return!b.expr.filters.hidden(e)}),b.each({margin:"",padding:"",border:"Width"},function(e,t){b.cssHooks[e+t]={expand:function(n){var r=0,i={},o="string"==typeof n?n.split(" "):[n];for(;4>r;r++)i[e+Zt[r]+t]=o[r]||o[r-2]||o[0];return i}},Ut.test(e)||(b.cssHooks[e+t].set=on)});var cn=/%20/g,pn=/\[\]$/,fn=/\r?\n/g,dn=/^(?:submit|button|image|reset|file)$/i,hn=/^(?:input|select|textarea|keygen)/i;b.fn.extend({serialize:function(){return b.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=b.prop(this,"elements");return e?b.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!b(this).is(":disabled")&&hn.test(this.nodeName)&&!dn.test(e)&&(this.checked||!Nt.test(e))}).map(function(e,t){var n=b(this).val();return null==n?null:b.isArray(n)?b.map(n,function(e){return{name:t.name,value:e.replace(fn,"\r\n")}}):{name:t.name,value:n.replace(fn,"\r\n")}}).get()}}),b.param=function(e,n){var r,i=[],o=function(e,t){t=b.isFunction(t)?t():null==t?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(n===t&&(n=b.ajaxSettings&&b.ajaxSettings.traditional),b.isArray(e)||e.jquery&&!b.isPlainObject(e))b.each(e,function(){o(this.name,this.value)});else for(r in e)gn(r,e[r],n,o);return i.join("&").replace(cn,"+")};function gn(e,t,n,r){var i;if(b.isArray(t))b.each(t,function(t,i){n||pn.test(e)?r(e,i):gn(e+"["+("object"==typeof i?t:"")+"]",i,n,r)});else if(n||"object"!==b.type(t))r(e,t);else for(i in t)gn(e+"["+i+"]",t[i],n,r)}b.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){b.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),b.fn.hover=function(e,t){return this.mouseenter(e).mouseleave(t||e)};var mn,yn,vn=b.now(),bn=/\?/,xn=/#.*$/,wn=/([?&])_=[^&]*/,Tn=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Nn=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Cn=/^(?:GET|HEAD)$/,kn=/^\/\//,En=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,Sn=b.fn.load,An={},jn={},Dn="*/".concat("*");try{yn=a.href}catch(Ln){yn=o.createElement("a"),yn.href="",yn=yn.href}mn=En.exec(yn.toLowerCase())||[];function Hn(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(w)||[];if(b.isFunction(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function qn(e,n,r,i){var o={},a=e===jn;function s(u){var l;return o[u]=!0,b.each(e[u]||[],function(e,u){var c=u(n,r,i);return"string"!=typeof c||a||o[c]?a?!(l=c):t:(n.dataTypes.unshift(c),s(c),!1)}),l}return s(n.dataTypes[0])||!o["*"]&&s("*")}function Mn(e,n){var r,i,o=b.ajaxSettings.flatOptions||{};for(i in n)n[i]!==t&&((o[i]?e:r||(r={}))[i]=n[i]);return r&&b.extend(!0,e,r),e}b.fn.load=function(e,n,r){if("string"!=typeof e&&Sn)return Sn.apply(this,arguments);var i,o,a,s=this,u=e.indexOf(" ");return u>=0&&(i=e.slice(u,e.length),e=e.slice(0,u)),b.isFunction(n)?(r=n,n=t):n&&"object"==typeof n&&(a="POST"),s.length>0&&b.ajax({url:e,type:a,dataType:"html",data:n}).done(function(e){o=arguments,s.html(i?b("<div>").append(b.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){s.each(r,o||[e.responseText,t,e])}),this},b.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){b.fn[t]=function(e){return this.on(t,e)}}),b.each(["get","post"],function(e,n){b[n]=function(e,r,i,o){return b.isFunction(r)&&(o=o||i,i=r,r=t),b.ajax({url:e,type:n,dataType:o,data:r,success:i})}}),b.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:yn,type:"GET",isLocal:Nn.test(mn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Dn,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":b.parseJSON,"text xml":b.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Mn(Mn(e,b.ajaxSettings),t):Mn(b.ajaxSettings,e)},ajaxPrefilter:Hn(An),ajaxTransport:Hn(jn),ajax:function(e,n){"object"==typeof e&&(n=e,e=t),n=n||{};var r,i,o,a,s,u,l,c,p=b.ajaxSetup({},n),f=p.context||p,d=p.context&&(f.nodeType||f.jquery)?b(f):b.event,h=b.Deferred(),g=b.Callbacks("once memory"),m=p.statusCode||{},y={},v={},x=0,T="canceled",N={readyState:0,getResponseHeader:function(e){var t;if(2===x){if(!c){c={};while(t=Tn.exec(a))c[t[1].toLowerCase()]=t[2]}t=c[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===x?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return x||(e=v[n]=v[n]||e,y[e]=t),this},overrideMimeType:function(e){return x||(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>x)for(t in e)m[t]=[m[t],e[t]];else N.always(e[N.status]);return this},abort:function(e){var t=e||T;return l&&l.abort(t),k(0,t),this}};if(h.promise(N).complete=g.add,N.success=N.done,N.error=N.fail,p.url=((e||p.url||yn)+"").replace(xn,"").replace(kn,mn[1]+"//"),p.type=n.method||n.type||p.method||p.type,p.dataTypes=b.trim(p.dataType||"*").toLowerCase().match(w)||[""],null==p.crossDomain&&(r=En.exec(p.url.toLowerCase()),p.crossDomain=!(!r||r[1]===mn[1]&&r[2]===mn[2]&&(r[3]||("http:"===r[1]?80:443))==(mn[3]||("http:"===mn[1]?80:443)))),p.data&&p.processData&&"string"!=typeof p.data&&(p.data=b.param(p.data,p.traditional)),qn(An,p,n,N),2===x)return N;u=p.global,u&&0===b.active++&&b.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Cn.test(p.type),o=p.url,p.hasContent||(p.data&&(o=p.url+=(bn.test(o)?"&":"?")+p.data,delete p.data),p.cache===!1&&(p.url=wn.test(o)?o.replace(wn,"$1_="+vn++):o+(bn.test(o)?"&":"?")+"_="+vn++)),p.ifModified&&(b.lastModified[o]&&N.setRequestHeader("If-Modified-Since",b.lastModified[o]),b.etag[o]&&N.setRequestHeader("If-None-Match",b.etag[o])),(p.data&&p.hasContent&&p.contentType!==!1||n.contentType)&&N.setRequestHeader("Content-Type",p.contentType),N.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+Dn+"; q=0.01":""):p.accepts["*"]);for(i in p.headers)N.setRequestHeader(i,p.headers[i]);if(p.beforeSend&&(p.beforeSend.call(f,N,p)===!1||2===x))return N.abort();T="abort";for(i in{success:1,error:1,complete:1})N[i](p[i]);if(l=qn(jn,p,n,N)){N.readyState=1,u&&d.trigger("ajaxSend",[N,p]),p.async&&p.timeout>0&&(s=setTimeout(function(){N.abort("timeout")},p.timeout));try{x=1,l.send(y,k)}catch(C){if(!(2>x))throw C;k(-1,C)}}else k(-1,"No Transport");function k(e,n,r,i){var c,y,v,w,T,C=n;2!==x&&(x=2,s&&clearTimeout(s),l=t,a=i||"",N.readyState=e>0?4:0,r&&(w=_n(p,N,r)),e>=200&&300>e||304===e?(p.ifModified&&(T=N.getResponseHeader("Last-Modified"),T&&(b.lastModified[o]=T),T=N.getResponseHeader("etag"),T&&(b.etag[o]=T)),204===e?(c=!0,C="nocontent"):304===e?(c=!0,C="notmodified"):(c=Fn(p,w),C=c.state,y=c.data,v=c.error,c=!v)):(v=C,(e||!C)&&(C="error",0>e&&(e=0))),N.status=e,N.statusText=(n||C)+"",c?h.resolveWith(f,[y,C,N]):h.rejectWith(f,[N,C,v]),N.statusCode(m),m=t,u&&d.trigger(c?"ajaxSuccess":"ajaxError",[N,p,c?y:v]),g.fireWith(f,[N,C]),u&&(d.trigger("ajaxComplete",[N,p]),--b.active||b.event.trigger("ajaxStop")))}return N},getScript:function(e,n){return b.get(e,t,n,"script")},getJSON:function(e,t,n){return b.get(e,t,n,"json")}});function _n(e,n,r){var i,o,a,s,u=e.contents,l=e.dataTypes,c=e.responseFields;for(s in c)s in r&&(n[c[s]]=r[s]);while("*"===l[0])l.shift(),o===t&&(o=e.mimeType||n.getResponseHeader("Content-Type"));if(o)for(s in u)if(u[s]&&u[s].test(o)){l.unshift(s);break}if(l[0]in r)a=l[0];else{for(s in r){if(!l[0]||e.converters[s+" "+l[0]]){a=s;break}i||(i=s)}a=a||i}return a?(a!==l[0]&&l.unshift(a),r[a]):t}function Fn(e,t){var n,r,i,o,a={},s=0,u=e.dataTypes.slice(),l=u[0];if(e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u[1])for(i in e.converters)a[i.toLowerCase()]=e.converters[i];for(;r=u[++s];)if("*"!==r){if("*"!==l&&l!==r){if(i=a[l+" "+r]||a["* "+r],!i)for(n in a)if(o=n.split(" "),o[1]===r&&(i=a[l+" "+o[0]]||a["* "+o[0]])){i===!0?i=a[n]:a[n]!==!0&&(r=o[0],u.splice(s--,0,r));break}if(i!==!0)if(i&&e["throws"])t=i(t);else try{t=i(t)}catch(c){return{state:"parsererror",error:i?c:"No conversion from "+l+" to "+r}}}l=r}return{state:"success",data:t}}b.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return b.globalEval(e),e}}}),b.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),b.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=o.head||b("head")[0]||o.documentElement;return{send:function(t,i){n=o.createElement("script"),n.async=!0,e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,t){(t||!n.readyState||/loaded|complete/.test(n.readyState))&&(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),n=null,t||i(200,"success"))},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(t,!0)}}}});var On=[],Bn=/(=)\?(?=&|$)|\?\?/;b.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=On.pop()||b.expando+"_"+vn++;return this[e]=!0,e}}),b.ajaxPrefilter("json jsonp",function(n,r,i){var o,a,s,u=n.jsonp!==!1&&(Bn.test(n.url)?"url":"string"==typeof n.data&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Bn.test(n.data)&&"data");return u||"jsonp"===n.dataTypes[0]?(o=n.jsonpCallback=b.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,u?n[u]=n[u].replace(Bn,"$1"+o):n.jsonp!==!1&&(n.url+=(bn.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return s||b.error(o+" was not called"),s[0]},n.dataTypes[0]="json",a=e[o],e[o]=function(){s=arguments},i.always(function(){e[o]=a,n[o]&&(n.jsonpCallback=r.jsonpCallback,On.push(o)),s&&b.isFunction(a)&&a(s[0]),s=a=t}),"script"):t});var Pn,Rn,Wn=0,$n=e.ActiveXObject&&function(){var e;for(e in Pn)Pn[e](t,!0)};function In(){try{return new e.XMLHttpRequest}catch(t){}}function zn(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}b.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&In()||zn()}:In,Rn=b.ajaxSettings.xhr(),b.support.cors=!!Rn&&"withCredentials"in Rn,Rn=b.support.ajax=!!Rn,Rn&&b.ajaxTransport(function(n){if(!n.crossDomain||b.support.cors){var r;return{send:function(i,o){var a,s,u=n.xhr();if(n.username?u.open(n.type,n.url,n.async,n.username,n.password):u.open(n.type,n.url,n.async),n.xhrFields)for(s in n.xhrFields)u[s]=n.xhrFields[s];n.mimeType&&u.overrideMimeType&&u.overrideMimeType(n.mimeType),n.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");try{for(s in i)u.setRequestHeader(s,i[s])}catch(l){}u.send(n.hasContent&&n.data||null),r=function(e,i){var s,l,c,p;try{if(r&&(i||4===u.readyState))if(r=t,a&&(u.onreadystatechange=b.noop,$n&&delete Pn[a]),i)4!==u.readyState&&u.abort();else{p={},s=u.status,l=u.getAllResponseHeaders(),"string"==typeof u.responseText&&(p.text=u.responseText);try{c=u.statusText}catch(f){c=""}s||!n.isLocal||n.crossDomain?1223===s&&(s=204):s=p.text?200:404}}catch(d){i||o(-1,d)}p&&o(s,c,p,l)},n.async?4===u.readyState?setTimeout(r):(a=++Wn,$n&&(Pn||(Pn={},b(e).unload($n)),Pn[a]=r),u.onreadystatechange=r):r()},abort:function(){r&&r(t,!0)}}}});var Xn,Un,Vn=/^(?:toggle|show|hide)$/,Yn=RegExp("^(?:([+-])=|)("+x+")([a-z%]*)$","i"),Jn=/queueHooks$/,Gn=[nr],Qn={"*":[function(e,t){var n,r,i=this.createTween(e,t),o=Yn.exec(t),a=i.cur(),s=+a||0,u=1,l=20;if(o){if(n=+o[2],r=o[3]||(b.cssNumber[e]?"":"px"),"px"!==r&&s){s=b.css(i.elem,e,!0)||n||1;do u=u||".5",s/=u,b.style(i.elem,e,s+r);while(u!==(u=i.cur()/a)&&1!==u&&--l)}i.unit=r,i.start=s,i.end=o[1]?s+(o[1]+1)*n:n}return i}]};function Kn(){return setTimeout(function(){Xn=t}),Xn=b.now()}function Zn(e,t){b.each(t,function(t,n){var r=(Qn[t]||[]).concat(Qn["*"]),i=0,o=r.length;for(;o>i;i++)if(r[i].call(e,t,n))return})}function er(e,t,n){var r,i,o=0,a=Gn.length,s=b.Deferred().always(function(){delete u.elem}),u=function(){if(i)return!1;var t=Xn||Kn(),n=Math.max(0,l.startTime+l.duration-t),r=n/l.duration||0,o=1-r,a=0,u=l.tweens.length;for(;u>a;a++)l.tweens[a].run(o);return s.notifyWith(e,[l,o,n]),1>o&&u?n:(s.resolveWith(e,[l]),!1)},l=s.promise({elem:e,props:b.extend({},t),opts:b.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Xn||Kn(),duration:n.duration,tweens:[],createTween:function(t,n){var r=b.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){var n=0,r=t?l.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)l.tweens[n].run(1);return t?s.resolveWith(e,[l,t]):s.rejectWith(e,[l,t]),this}}),c=l.props;for(tr(c,l.opts.specialEasing);a>o;o++)if(r=Gn[o].call(l,e,c,l.opts))return r;return Zn(l,c),b.isFunction(l.opts.start)&&l.opts.start.call(e,l),b.fx.timer(b.extend(u,{elem:e,anim:l,queue:l.opts.queue})),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always)}function tr(e,t){var n,r,i,o,a;for(i in e)if(r=b.camelCase(i),o=t[r],n=e[i],b.isArray(n)&&(o=n[1],n=e[i]=n[0]),i!==r&&(e[r]=n,delete e[i]),a=b.cssHooks[r],a&&"expand"in a){n=a.expand(n),delete e[r];for(i in n)i in e||(e[i]=n[i],t[i]=o)}else t[r]=o}b.Animation=b.extend(er,{tweener:function(e,t){b.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;i>r;r++)n=e[r],Qn[n]=Qn[n]||[],Qn[n].unshift(t)},prefilter:function(e,t){t?Gn.unshift(e):Gn.push(e)}});function nr(e,t,n){var r,i,o,a,s,u,l,c,p,f=this,d=e.style,h={},g=[],m=e.nodeType&&nn(e);n.queue||(c=b._queueHooks(e,"fx"),null==c.unqueued&&(c.unqueued=0,p=c.empty.fire,c.empty.fire=function(){c.unqueued||p()}),c.unqueued++,f.always(function(){f.always(function(){c.unqueued--,b.queue(e,"fx").length||c.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[d.overflow,d.overflowX,d.overflowY],"inline"===b.css(e,"display")&&"none"===b.css(e,"float")&&(b.support.inlineBlockNeedsLayout&&"inline"!==un(e.nodeName)?d.zoom=1:d.display="inline-block")),n.overflow&&(d.overflow="hidden",b.support.shrinkWrapBlocks||f.always(function(){d.overflow=n.overflow[0],d.overflowX=n.overflow[1],d.overflowY=n.overflow[2]}));for(i in t)if(a=t[i],Vn.exec(a)){if(delete t[i],u=u||"toggle"===a,a===(m?"hide":"show"))continue;g.push(i)}if(o=g.length){s=b._data(e,"fxshow")||b._data(e,"fxshow",{}),"hidden"in s&&(m=s.hidden),u&&(s.hidden=!m),m?b(e).show():f.done(function(){b(e).hide()}),f.done(function(){var t;b._removeData(e,"fxshow");for(t in h)b.style(e,t,h[t])});for(i=0;o>i;i++)r=g[i],l=f.createTween(r,m?s[r]:0),h[r]=s[r]||b.style(e,r),r in s||(s[r]=l.start,m&&(l.end=l.start,l.start="width"===r||"height"===r?1:0))}}function rr(e,t,n,r,i){return new rr.prototype.init(e,t,n,r,i)}b.Tween=rr,rr.prototype={constructor:rr,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(b.cssNumber[n]?"":"px")},cur:function(){var e=rr.propHooks[this.prop];return e&&e.get?e.get(this):rr.propHooks._default.get(this)},run:function(e){var t,n=rr.propHooks[this.prop];return this.pos=t=this.options.duration?b.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):rr.propHooks._default.set(this),this}},rr.prototype.init.prototype=rr.prototype,rr.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=b.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){b.fx.step[e.prop]?b.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[b.cssProps[e.prop]]||b.cssHooks[e.prop])?b.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},rr.propHooks.scrollTop=rr.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},b.each(["toggle","show","hide"],function(e,t){var n=b.fn[t];b.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ir(t,!0),e,r,i)}}),b.fn.extend({fadeTo:function(e,t,n,r){return this.filter(nn).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=b.isEmptyObject(e),o=b.speed(t,n,r),a=function(){var t=er(this,b.extend({},e),o);a.finish=function(){t.stop(!0)},(i||b._data(this,"finish"))&&t.stop(!0)};return a.finish=a,i||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",o=b.timers,a=b._data(this);if(n)a[n]&&a[n].stop&&i(a[n]);else for(n in a)a[n]&&a[n].stop&&Jn.test(n)&&i(a[n]);for(n=o.length;n--;)o[n].elem!==this||null!=e&&o[n].queue!==e||(o[n].anim.stop(r),t=!1,o.splice(n,1));(t||!r)&&b.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=b._data(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=b.timers,a=r?r.length:0;for(n.finish=!0,b.queue(this,e,[]),i&&i.cur&&i.cur.finish&&i.cur.finish.call(this),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;a>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}});function ir(e,t){var n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t)n=Zt[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}b.each({slideDown:ir("show"),slideUp:ir("hide"),slideToggle:ir("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){b.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),b.speed=function(e,t,n){var r=e&&"object"==typeof e?b.extend({},e):{complete:n||!n&&t||b.isFunction(e)&&e,duration:e,easing:n&&t||t&&!b.isFunction(t)&&t};return r.duration=b.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in b.fx.speeds?b.fx.speeds[r.duration]:b.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){b.isFunction(r.old)&&r.old.call(this),r.queue&&b.dequeue(this,r.queue)},r},b.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},b.timers=[],b.fx=rr.prototype.init,b.fx.tick=function(){var e,n=b.timers,r=0;for(Xn=b.now();n.length>r;r++)e=n[r],e()||n[r]!==e||n.splice(r--,1);n.length||b.fx.stop(),Xn=t},b.fx.timer=function(e){e()&&b.timers.push(e)&&b.fx.start()},b.fx.interval=13,b.fx.start=function(){Un||(Un=setInterval(b.fx.tick,b.fx.interval))},b.fx.stop=function(){clearInterval(Un),Un=null},b.fx.speeds={slow:600,fast:200,_default:400},b.fx.step={},b.expr&&b.expr.filters&&(b.expr.filters.animated=function(e){return b.grep(b.timers,function(t){return e===t.elem}).length}),b.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){b.offset.setOffset(this,e,t)});var n,r,o={top:0,left:0},a=this[0],s=a&&a.ownerDocument;if(s)return n=s.documentElement,b.contains(n,a)?(typeof a.getBoundingClientRect!==i&&(o=a.getBoundingClientRect()),r=or(s),{top:o.top+(r.pageYOffset||n.scrollTop)-(n.clientTop||0),left:o.left+(r.pageXOffset||n.scrollLeft)-(n.clientLeft||0)}):o},b.offset={setOffset:function(e,t,n){var r=b.css(e,"position");"static"===r&&(e.style.position="relative");var i=b(e),o=i.offset(),a=b.css(e,"top"),s=b.css(e,"left"),u=("absolute"===r||"fixed"===r)&&b.inArray("auto",[a,s])>-1,l={},c={},p,f;u?(c=i.position(),p=c.top,f=c.left):(p=parseFloat(a)||0,f=parseFloat(s)||0),b.isFunction(t)&&(t=t.call(e,n,o)),null!=t.top&&(l.top=t.top-o.top+p),null!=t.left&&(l.left=t.left-o.left+f),"using"in t?t.using.call(e,l):i.css(l)}},b.fn.extend({position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===b.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),b.nodeName(e[0],"html")||(n=e.offset()),n.top+=b.css(e[0],"borderTopWidth",!0),n.left+=b.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-b.css(r,"marginTop",!0),left:t.left-n.left-b.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||o.documentElement;while(e&&!b.nodeName(e,"html")&&"static"===b.css(e,"position"))e=e.offsetParent;return e||o.documentElement})}}),b.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);b.fn[e]=function(i){return b.access(this,function(e,i,o){var a=or(e);return o===t?a?n in a?a[n]:a.document.documentElement[i]:e[i]:(a?a.scrollTo(r?b(a).scrollLeft():o,r?o:b(a).scrollTop()):e[i]=o,t)},e,i,arguments.length,null)}});function or(e){return b.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}b.each({Height:"height",Width:"width"},function(e,n){b.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){b.fn[i]=function(i,o){var a=arguments.length&&(r||"boolean"!=typeof i),s=r||(i===!0||o===!0?"margin":"border");return b.access(this,function(n,r,i){var o;return b.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(o=n.documentElement,Math.max(n.body["scroll"+e],o["scroll"+e],n.body["offset"+e],o["offset"+e],o["client"+e])):i===t?b.css(n,r,s):b.style(n,r,i,s)},n,a?i:t,a,null)}})}),e.jQuery=e.$=b,"function"==typeof define&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return b})})(window); |
ajax/libs/6to5/1.12.5/browser.js | mzdani/cdnjs | !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.to5=e()}}(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){(function(root,mod){if(typeof exports=="object"&&typeof module=="object")return mod(exports);if(typeof define=="function"&&define.amd)return define(["exports"],mod);mod(root.acorn||(root.acorn={}))})(this,function(exports){"use strict";exports.version="0.9.1";var options,input,inputLen,sourceFile;exports.parse=function(inpt,opts){input=String(inpt);inputLen=input.length;setOptions(opts);initTokenState();initParserState();return parseTopLevel(options.program)};var defaultOptions=exports.defaultOptions={ecmaVersion:5,strictSemicolons:false,allowTrailingCommas:true,forbidReserved:false,allowReturnOutsideFunction:false,locations:false,onToken:null,onComment:null,ranges:false,program:null,sourceFile:null,directSourceFile:null,preserveParens:false};exports.parseExpressionAt=function(inpt,pos,opts){input=String(inpt);inputLen=input.length;setOptions(opts);initTokenState(pos);initParserState();return parseExpression()};var isArray=function(obj){return Object.prototype.toString.call(obj)==="[object Array]"};function setOptions(opts){options=opts||{};for(var opt in defaultOptions)if(!has(options,opt))options[opt]=defaultOptions[opt];sourceFile=options.sourceFile||null;if(isArray(options.onToken)){var tokens=options.onToken;options.onToken=function(token){tokens.push(token)}}if(isArray(options.onComment)){var comments=options.onComment;options.onComment=function(block,text,start,end,startLoc,endLoc){var comment={type:block?"Block":"Line",value:text,start:start,end:end};if(options.locations){comment.loc=new SourceLocation;comment.loc.start=startLoc;comment.loc.end=endLoc}if(options.ranges)comment.range=[start,end];comments.push(comment)}}if(options.strictMode){strict=true}if(options.ecmaVersion>=7){isKeyword=isEcma7Keyword}else if(options.ecmaVersion===6){isKeyword=isEcma6Keyword}else{isKeyword=isEcma5AndLessKeyword}}var getLineInfo=exports.getLineInfo=function(input,offset){for(var line=1,cur=0;;){lineBreak.lastIndex=cur;var match=lineBreak.exec(input);if(match&&match.index<offset){++line;cur=match.index+match[0].length}else break}return{line:line,column:offset-cur}};function Token(){this.type=tokType;this.value=tokVal;this.start=tokStart;this.end=tokEnd;if(options.locations){this.loc=new SourceLocation;this.loc.end=tokEndLoc;this.startLoc=tokStartLoc;this.endLoc=tokEndLoc}if(options.ranges)this.range=[tokStart,tokEnd]}exports.Token=Token;exports.tokenize=function(inpt,opts){input=String(inpt);inputLen=input.length;setOptions(opts);initTokenState();function getToken(forceRegexp){lastEnd=tokEnd;readToken(forceRegexp);return new Token}getToken.jumpTo=function(pos,reAllowed){tokPos=pos;if(options.locations){tokCurLine=1;tokLineStart=lineBreak.lastIndex=0;var match;while((match=lineBreak.exec(input))&&match.index<pos){++tokCurLine;tokLineStart=match.index+match[0].length}}tokRegexpAllowed=reAllowed;skipSpace()};return getToken};var tokPos;var tokStart,tokEnd;var tokStartLoc,tokEndLoc;var tokType,tokVal;var tokRegexpAllowed;var tokCurLine,tokLineStart;var lastStart,lastEnd,lastEndLoc;var inFunction,inGenerator,inAsync,labels,strict,inXJSChild,inXJSTag,inXJSChildExpression;var metParenL;var inTemplate;function initParserState(){lastStart=lastEnd=tokPos;if(options.locations)lastEndLoc=new Position;inFunction=inGenerator=inAsync=strict=false;labels=[];readToken()}function raise(pos,message){var loc=getLineInfo(input,pos);message+=" ("+loc.line+":"+loc.column+")";var err=new SyntaxError(message);err.pos=pos;err.loc=loc;err.raisedAt=tokPos;throw err}var empty=[];var _num={type:"num"},_regexp={type:"regexp"},_string={type:"string"};var _name={type:"name"},_eof={type:"eof"};var _xjsName={type:"xjsName"},_xjsText={type:"xjsText"};var _break={keyword:"break"},_case={keyword:"case",beforeExpr:true},_catch={keyword:"catch"};var _continue={keyword:"continue"},_debugger={keyword:"debugger"},_default={keyword:"default"};var _do={keyword:"do",isLoop:true},_else={keyword:"else",beforeExpr:true};var _finally={keyword:"finally"},_for={keyword:"for",isLoop:true},_function={keyword:"function"};var _if={keyword:"if"},_return={keyword:"return",beforeExpr:true},_switch={keyword:"switch"};var _throw={keyword:"throw",beforeExpr:true},_try={keyword:"try"},_var={keyword:"var"};var _let={keyword:"let"},_const={keyword:"const"};var _while={keyword:"while",isLoop:true},_with={keyword:"with"},_new={keyword:"new",beforeExpr:true};var _this={keyword:"this"};var _class={keyword:"class"},_extends={keyword:"extends",beforeExpr:true};var _export={keyword:"export"},_import={keyword:"import"};var _yield={keyword:"yield",beforeExpr:true};var _async={keyword:"async"},_await={keyword:"await",beforeExpr:true};var _null={keyword:"null",atomValue:null},_true={keyword:"true",atomValue:true};var _false={keyword:"false",atomValue:false};var _in={keyword:"in",binop:7,beforeExpr:true};var keywordTypes={"break":_break,"case":_case,"catch":_catch,"continue":_continue,"debugger":_debugger,"default":_default,"do":_do,"else":_else,"finally":_finally,"for":_for,"function":_function,"if":_if,"return":_return,"switch":_switch,"throw":_throw,"try":_try,"var":_var,let:_let,"const":_const,"while":_while,"with":_with,"null":_null,"true":_true,"false":_false,"new":_new,"in":_in,"instanceof":{keyword:"instanceof",binop:7,beforeExpr:true},"this":_this,"typeof":{keyword:"typeof",prefix:true,beforeExpr:true},"void":{keyword:"void",prefix:true,beforeExpr:true},"delete":{keyword:"delete",prefix:true,beforeExpr:true},"class":_class,"extends":_extends,"export":_export,"import":_import,"yield":_yield,await:_await,async:_async};var _bracketL={type:"[",beforeExpr:true},_bracketR={type:"]"},_braceL={type:"{",beforeExpr:true};var _braceR={type:"}"},_parenL={type:"(",beforeExpr:true},_parenR={type:")"};var _comma={type:",",beforeExpr:true},_semi={type:";",beforeExpr:true};var _colon={type:":",beforeExpr:true},_dot={type:"."},_ellipsis={type:"..."},_question={type:"?",beforeExpr:true};var _arrow={type:"=>",beforeExpr:true},_bquote={type:"`"},_dollarBraceL={type:"${",beforeExpr:true};var _ltSlash={type:"</"};var _slash={binop:10,beforeExpr:true},_eq={isAssign:true,beforeExpr:true};var _assign={isAssign:true,beforeExpr:true};var _incDec={postfix:true,prefix:true,isUpdate:true},_prefix={prefix:true,beforeExpr:true};var _logicalOR={binop:1,beforeExpr:true};var _logicalAND={binop:2,beforeExpr:true};var _bitwiseOR={binop:3,beforeExpr:true};var _bitwiseXOR={binop:4,beforeExpr:true};var _bitwiseAND={binop:5,beforeExpr:true};var _equality={binop:6,beforeExpr:true};var _relational={binop:7,beforeExpr:true};var _bitShift={binop:8,beforeExpr:true};var _plusMin={binop:9,prefix:true,beforeExpr:true};var _modulo={binop:10,beforeExpr:true};var _star={binop:10,beforeExpr:true};var _lt={binop:7,beforeExpr:true},_gt={binop:7,beforeExpr:true};exports.tokTypes={bracketL:_bracketL,bracketR:_bracketR,braceL:_braceL,braceR:_braceR,parenL:_parenL,parenR:_parenR,comma:_comma,semi:_semi,colon:_colon,dot:_dot,ellipsis:_ellipsis,question:_question,slash:_slash,eq:_eq,name:_name,eof:_eof,num:_num,regexp:_regexp,string:_string,arrow:_arrow,bquote:_bquote,dollarBraceL:_dollarBraceL,xjsName:_xjsName,xjsText:_xjsText};for(var kw in keywordTypes)exports.tokTypes["_"+kw]=keywordTypes[kw];function makePredicate(words){words=words.split(" ");var f="",cats=[];out:for(var i=0;i<words.length;++i){for(var j=0;j<cats.length;++j)if(cats[j][0].length==words[i].length){cats[j].push(words[i]);continue out}cats.push([words[i]])}function compareTo(arr){if(arr.length==1)return f+="return str === "+JSON.stringify(arr[0])+";";f+="switch(str){";for(var i=0;i<arr.length;++i)f+="case "+JSON.stringify(arr[i])+":";f+="return true}return false;"}if(cats.length>3){cats.sort(function(a,b){return b.length-a.length});f+="switch(str.length){";for(var i=0;i<cats.length;++i){var cat=cats[i];f+="case "+cat[0].length+":";compareTo(cat)}f+="}"}else{compareTo(words)}return new Function("str",f)}var isReservedWord3=makePredicate("abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile");var isReservedWord5=makePredicate("class enum extends super const export import");var isStrictReservedWord=makePredicate("implements interface let package private protected public static yield");var isStrictBadIdWord=makePredicate("eval arguments");var ecma5AndLessKeywords="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this";var isEcma5AndLessKeyword=makePredicate(ecma5AndLessKeywords);var ecma6AndLessKeywords=ecma5AndLessKeywords+" let const class extends export import yield";var isEcma6Keyword=makePredicate(ecma6AndLessKeywords);var isEcma7Keyword=makePredicate(ecma6AndLessKeywords+" async await");var isKeyword=isEcma5AndLessKeyword;var nonASCIIwhitespace=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;var nonASCIIidentifierStartChars="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠ-ࢲऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞭꞰꞱꟷ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭟꭤꭥꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ";var nonASCIIidentifierChars="̀-ͯ҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣤ-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఃా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഁ-ഃാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ංඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ູົຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏ᦰ-ᧀᧈᧉ᧐-᧙ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭ᳲ-᳴᳸᳹᷀-᷵᷼-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧꢀꢁꢴ-꣄꣐-꣙꣠-꣱꤀-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︭︳︴﹍-﹏0-9_";var nonASCIIidentifierStart=new RegExp("["+nonASCIIidentifierStartChars+"]");var nonASCIIidentifier=new RegExp("["+nonASCIIidentifierStartChars+nonASCIIidentifierChars+"]");var newline=/[\n\r\u2028\u2029]/;var lineBreak=/\r\n|[\n\r\u2028\u2029]/g;var isIdentifierStart=exports.isIdentifierStart=function(code){if(code<65)return code===36;if(code<91)return true;if(code<97)return code===95;if(code<123)return true;return code>=170&&nonASCIIidentifierStart.test(String.fromCharCode(code))};var isIdentifierChar=exports.isIdentifierChar=function(code){if(code<48)return code===36;if(code<58)return true;if(code<65)return false;if(code<91)return true;if(code<97)return code===95;if(code<123)return true;return code>=170&&nonASCIIidentifier.test(String.fromCharCode(code))};function Position(){this.line=tokCurLine;this.column=tokPos-tokLineStart}function initTokenState(pos){if(pos){tokPos=pos;tokLineStart=Math.max(0,input.lastIndexOf("\n",pos));tokCurLine=input.slice(0,tokLineStart).split(newline).length}else{tokCurLine=1;tokPos=tokLineStart=0}tokRegexpAllowed=true;metParenL=0;inTemplate=inXJSChild=inXJSTag=false;skipSpace()}function finishToken(type,val,shouldSkipSpace){tokEnd=tokPos;if(options.locations)tokEndLoc=new Position;tokType=type;if(shouldSkipSpace!==false&&!(inXJSChild&&tokType!==_braceL)){skipSpace()}tokVal=val;tokRegexpAllowed=type.beforeExpr;if(options.onToken){options.onToken(new Token)}}function skipBlockComment(){var startLoc=options.onComment&&options.locations&&new Position;var start=tokPos,end=input.indexOf("*/",tokPos+=2);if(end===-1)raise(tokPos-2,"Unterminated comment");tokPos=end+2;if(options.locations){lineBreak.lastIndex=start;var match;while((match=lineBreak.exec(input))&&match.index<tokPos){++tokCurLine;tokLineStart=match.index+match[0].length}}if(options.onComment)options.onComment(true,input.slice(start+2,end),start,tokPos,startLoc,options.locations&&new Position)}function skipLineComment(startSkip){var start=tokPos;var startLoc=options.onComment&&options.locations&&new Position;var ch=input.charCodeAt(tokPos+=startSkip);while(tokPos<inputLen&&ch!==10&&ch!==13&&ch!==8232&&ch!==8233){++tokPos;ch=input.charCodeAt(tokPos)}if(options.onComment)options.onComment(false,input.slice(start+startSkip,tokPos),start,tokPos,startLoc,options.locations&&new Position)}function skipSpace(){while(tokPos<inputLen){var ch=input.charCodeAt(tokPos);if(ch===32){++tokPos}else if(ch===13){++tokPos;var next=input.charCodeAt(tokPos);if(next===10){++tokPos}if(options.locations){++tokCurLine;tokLineStart=tokPos}}else if(ch===10||ch===8232||ch===8233){++tokPos;if(options.locations){++tokCurLine;tokLineStart=tokPos}}else if(ch>8&&ch<14){++tokPos}else if(ch===47){var next=input.charCodeAt(tokPos+1);if(next===42){skipBlockComment()}else if(next===47){skipLineComment(2)}else break}else if(ch===160){++tokPos}else if(ch>=5760&&nonASCIIwhitespace.test(String.fromCharCode(ch))){++tokPos}else{break}}}function readToken_dot(){var next=input.charCodeAt(tokPos+1);if(next>=48&&next<=57)return readNumber(true);var next2=input.charCodeAt(tokPos+2);if(options.ecmaVersion>=6&&next===46&&next2===46){tokPos+=3;return finishToken(_ellipsis)}else{++tokPos;return finishToken(_dot)}}function readToken_slash(){var next=input.charCodeAt(tokPos+1);if(tokRegexpAllowed){++tokPos;return readRegexp()}if(next===61)return finishOp(_assign,2);return finishOp(_slash,1)}function readToken_mult_modulo(code){var next=input.charCodeAt(tokPos+1);if(next===61)return finishOp(_assign,2);return finishOp(code===42?_star:_modulo,1)}function readToken_pipe_amp(code){var next=input.charCodeAt(tokPos+1);if(next===code)return finishOp(code===124?_logicalOR:_logicalAND,2);if(next===61)return finishOp(_assign,2);return finishOp(code===124?_bitwiseOR:_bitwiseAND,1)}function readToken_caret(){var next=input.charCodeAt(tokPos+1);if(next===61)return finishOp(_assign,2);return finishOp(_bitwiseXOR,1)}function readToken_plus_min(code){var next=input.charCodeAt(tokPos+1);if(next===code){if(next==45&&input.charCodeAt(tokPos+2)==62&&newline.test(input.slice(lastEnd,tokPos))){skipLineComment(3);skipSpace();return readToken()}return finishOp(_incDec,2)}if(next===61)return finishOp(_assign,2);return finishOp(_plusMin,1)}function readToken_lt_gt(code){var next=input.charCodeAt(tokPos+1);var size=1;if(next===code){size=code===62&&input.charCodeAt(tokPos+2)===62?3:2;if(input.charCodeAt(tokPos+size)===61)return finishOp(_assign,size+1);return finishOp(_bitShift,size)}if(next==33&&code==60&&input.charCodeAt(tokPos+2)==45&&input.charCodeAt(tokPos+3)==45){skipLineComment(4);skipSpace();return readToken()}if(next===61){size=input.charCodeAt(tokPos+2)===61?3:2;return finishOp(_relational,size)}if(next===47){size=2;return finishOp(_ltSlash,size)}return code===60?finishOp(_lt,size):finishOp(_gt,size,!inXJSTag)}function readToken_eq_excl(code){var next=input.charCodeAt(tokPos+1);if(next===61)return finishOp(_equality,input.charCodeAt(tokPos+2)===61?3:2);if(code===61&&next===62&&options.ecmaVersion>=6){tokPos+=2;return finishToken(_arrow)}return finishOp(code===61?_eq:_prefix,1)}function getTemplateToken(code){if(tokType===_string){if(code===96){++tokPos;return finishToken(_bquote)}else if(code===36&&input.charCodeAt(tokPos+1)===123){tokPos+=2;return finishToken(_dollarBraceL)}}if(code===125){++tokPos;return finishToken(_braceR,undefined,false)}return readTmplString()}function getTokenFromCode(code){switch(code){case 46:return readToken_dot();case 40:++tokPos;return finishToken(_parenL);case 41:++tokPos;return finishToken(_parenR);case 59:++tokPos;return finishToken(_semi);case 44:++tokPos;return finishToken(_comma);case 91:++tokPos;return finishToken(_bracketL);case 93:++tokPos;return finishToken(_bracketR);case 123:++tokPos;return finishToken(_braceL);case 125:++tokPos;return finishToken(_braceR,undefined,!inXJSChildExpression);case 58:++tokPos;return finishToken(_colon);case 63:++tokPos;return finishToken(_question);case 96:if(options.ecmaVersion>=6){++tokPos;return finishToken(_bquote,undefined,false)}case 48:var next=input.charCodeAt(tokPos+1);if(next===120||next===88)return readRadixNumber(16);if(options.ecmaVersion>=6){if(next===111||next===79)return readRadixNumber(8);if(next===98||next===66)return readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return readNumber(false);case 34:case 39:return inXJSTag?readXJSStringLiteral():readString(code);case 47:return readToken_slash();case 37:case 42:return readToken_mult_modulo(code);case 124:case 38:return readToken_pipe_amp(code);case 94:return readToken_caret();case 43:case 45:return readToken_plus_min(code);case 60:case 62:return readToken_lt_gt(code);case 61:case 33:return readToken_eq_excl(code);case 126:return finishOp(_prefix,1)}return false}function readToken(forceRegexp){if(!forceRegexp)tokStart=tokPos;else tokPos=tokStart+1;if(options.locations)tokStartLoc=new Position;if(forceRegexp)return readRegexp();if(tokPos>=inputLen)return finishToken(_eof);var code=input.charCodeAt(tokPos);if(inXJSChild&&tokType!==_braceL&&code!==60&&code!==123&&code!==125){return readXJSText(["<","{"])}if(inTemplate)return getTemplateToken(code);if(isIdentifierStart(code)||code===92)return readWord();var tok=getTokenFromCode(code);if(tok===false){var ch=String.fromCharCode(code);if(ch==="\\"||nonASCIIidentifierStart.test(ch))return readWord();raise(tokPos,"Unexpected character '"+ch+"'")}return tok}function finishOp(type,size,shouldSkipSpace){var str=input.slice(tokPos,tokPos+size);tokPos+=size;finishToken(type,str,shouldSkipSpace)}var regexpUnicodeSupport=false;try{new RegExp("","u");regexpUnicodeSupport=true}catch(e){}function readRegexp(){var content="",escaped,inClass,start=tokPos;for(;;){if(tokPos>=inputLen)raise(start,"Unterminated regular expression");var ch=nextChar();if(newline.test(ch))raise(start,"Unterminated regular expression");if(!escaped){if(ch==="[")inClass=true;else if(ch==="]"&&inClass)inClass=false;else if(ch==="/"&&!inClass)break;escaped=ch==="\\"}else escaped=false;++tokPos}var content=input.slice(start,tokPos);++tokPos;var mods=readWord1();var tmp=content;if(mods){var validFlags=/^[gmsiy]*$/;if(options.ecmaVersion>=6)validFlags=/^[gmsiyu]*$/;if(!validFlags.test(mods))raise(start,"Invalid regular expression flag");if(mods.indexOf("u")>=0&&!regexpUnicodeSupport){tmp=tmp.replace(/\\u\{([0-9a-fA-F]{5,6})\}/g,"x").replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x")}}try{new RegExp(tmp)}catch(e){if(e instanceof SyntaxError)raise(start,"Error parsing regular expression: "+e.message);raise(e)}try{var value=new RegExp(content,mods)}catch(err){value=null}return finishToken(_regexp,{pattern:content,flags:mods,value:value})}function readInt(radix,len){var start=tokPos,total=0;for(var i=0,e=len==null?Infinity:len;i<e;++i){var code=input.charCodeAt(tokPos),val;if(code>=97)val=code-97+10;else if(code>=65)val=code-65+10;else if(code>=48&&code<=57)val=code-48;else val=Infinity;if(val>=radix)break;++tokPos;total=total*radix+val}if(tokPos===start||len!=null&&tokPos-start!==len)return null;return total}function readRadixNumber(radix){tokPos+=2;var val=readInt(radix);if(val==null)raise(tokStart+2,"Expected number in radix "+radix);if(isIdentifierStart(input.charCodeAt(tokPos)))raise(tokPos,"Identifier directly after number");return finishToken(_num,val)}function readNumber(startsWithDot){var start=tokPos,isFloat=false,octal=input.charCodeAt(tokPos)===48;if(!startsWithDot&&readInt(10)===null)raise(start,"Invalid number");if(input.charCodeAt(tokPos)===46){++tokPos;readInt(10);isFloat=true}var next=input.charCodeAt(tokPos);if(next===69||next===101){next=input.charCodeAt(++tokPos);if(next===43||next===45)++tokPos;if(readInt(10)===null)raise(start,"Invalid number");isFloat=true}if(isIdentifierStart(input.charCodeAt(tokPos)))raise(tokPos,"Identifier directly after number");var str=input.slice(start,tokPos),val;if(isFloat)val=parseFloat(str);else if(!octal||str.length===1)val=parseInt(str,10);else if(/[89]/.test(str)||strict)raise(start,"Invalid number");else val=parseInt(str,8);return finishToken(_num,val)}function readCodePoint(){var ch=input.charCodeAt(tokPos),code;if(ch===123){if(options.ecmaVersion<6)unexpected();++tokPos;code=readHexChar(input.indexOf("}",tokPos)-tokPos);++tokPos;if(code>1114111)unexpected()}else{code=readHexChar(4)}if(code<=65535){return String.fromCharCode(code)}var cu1=(code-65536>>10)+55296;var cu2=(code-65536&1023)+56320;return String.fromCharCode(cu1,cu2)}function readString(quote){++tokPos;var out="";for(;;){if(tokPos>=inputLen)raise(tokStart,"Unterminated string constant");var ch=input.charCodeAt(tokPos);if(ch===quote){++tokPos;return finishToken(_string,out)}if(ch===92){out+=readEscapedChar()}else{++tokPos;if(newline.test(String.fromCharCode(ch))){raise(tokStart,"Unterminated string constant")}out+=String.fromCharCode(ch)}}}function readTmplString(){var out="";for(;;){if(tokPos>=inputLen)raise(tokStart,"Unterminated string constant");var ch=input.charCodeAt(tokPos);if(ch===96||ch===36&&input.charCodeAt(tokPos+1)===123)return finishToken(_string,out);if(ch===92){out+=readEscapedChar()}else{++tokPos;if(newline.test(String.fromCharCode(ch))){if(ch===13&&input.charCodeAt(tokPos)===10){++tokPos;ch=10}if(options.locations){++tokCurLine;tokLineStart=tokPos}}out+=String.fromCharCode(ch)}}}function readEscapedChar(){var ch=input.charCodeAt(++tokPos);var octal=/^[0-7]+/.exec(input.slice(tokPos,tokPos+3));if(octal)octal=octal[0];while(octal&&parseInt(octal,8)>255)octal=octal.slice(0,-1);if(octal==="0")octal=null;++tokPos;if(octal){if(strict)raise(tokPos-2,"Octal literal in strict mode");tokPos+=octal.length-1;return String.fromCharCode(parseInt(octal,8))}else{switch(ch){case 110:return"\n";case 114:return"\r";case 120:return String.fromCharCode(readHexChar(2));case 117:return readCodePoint();case 116:return" ";case 98:return"\b";case 118:return"";case 102:return"\f";case 48:return"\x00";case 13:if(input.charCodeAt(tokPos)===10)++tokPos;case 10:if(options.locations){tokLineStart=tokPos;++tokCurLine}return"";default:return String.fromCharCode(ch)}}}var XHTMLEntities={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:"♦"};function readXJSEntity(){var str="",count=0,entity;var ch=nextChar();if(ch!=="&")raise(tokPos,"Entity must start with an ampersand");tokPos++;while(tokPos<inputLen&&count++<10){ch=nextChar();tokPos++;if(ch===";"){break}str+=ch}if(str[0]==="#"&&str[1]==="x"){entity=String.fromCharCode(parseInt(str.substr(2),16))}else if(str[0]==="#"){entity=String.fromCharCode(parseInt(str.substr(1),10))}else{entity=XHTMLEntities[str]}return entity}function readXJSText(stopChars){var str="";while(tokPos<inputLen){var ch=nextChar();if(stopChars.indexOf(ch)!==-1){break}if(ch==="&"){str+=readXJSEntity()}else{++tokPos;if(ch==="\r"&&nextChar()==="\n"){str+=ch;++tokPos;ch="\n"}if(ch==="\n"&&options.locations){tokLineStart=tokPos;++tokCurLine}str+=ch}}return finishToken(_xjsText,str)}function readXJSStringLiteral(){var quote=input.charCodeAt(tokPos);if(quote!==34&"e!==39){raise("String literal must starts with a quote")}++tokPos;readXJSText([String.fromCharCode(quote)]);if(quote!==input.charCodeAt(tokPos)){unexpected()}++tokPos;return finishToken(tokType,tokVal)}function readHexChar(len){var n=readInt(16,len);if(n===null)raise(tokStart,"Bad character escape sequence");return n}var containsEsc;function readWord1(){containsEsc=false;var word,first=true,start=tokPos;for(;;){var ch=input.charCodeAt(tokPos);if(isIdentifierChar(ch)||inXJSTag&&ch===45){if(containsEsc)word+=nextChar();++tokPos}else if(ch===92&&!inXJSTag){if(!containsEsc)word=input.slice(start,tokPos);containsEsc=true;if(input.charCodeAt(++tokPos)!=117)raise(tokPos,"Expecting Unicode escape sequence \\uXXXX");++tokPos;var esc=readHexChar(4);var escStr=String.fromCharCode(esc);if(!escStr)raise(tokPos-1,"Invalid Unicode escape");if(!(first?isIdentifierStart(esc):isIdentifierChar(esc)))raise(tokPos-4,"Invalid Unicode escape");word+=escStr}else{break}first=false}return containsEsc?word:input.slice(start,tokPos)}function readWord(){var word=readWord1();var type=inXJSTag?_xjsName:_name;if(!containsEsc&&isKeyword(word))type=keywordTypes[word];return finishToken(type,word)}function next(){lastStart=tokStart;lastEnd=tokEnd;lastEndLoc=tokEndLoc;readToken()}function setStrict(strct){strict=strct;tokPos=tokStart;if(options.locations){while(tokPos<tokLineStart){tokLineStart=input.lastIndexOf("\n",tokLineStart-2)+1;--tokCurLine}}skipSpace();readToken()}function Node(){this.type=null;this.start=tokStart;this.end=null}exports.Node=Node;function SourceLocation(){this.start=tokStartLoc;this.end=null;if(sourceFile!==null)this.source=sourceFile}function startNode(){var node=new Node;if(options.locations)node.loc=new SourceLocation;if(options.directSourceFile)node.sourceFile=options.directSourceFile;if(options.ranges)node.range=[tokStart,0];return node}function storeCurrentPos(){return options.locations?[tokStart,tokStartLoc]:tokStart}function startNodeAt(pos){var node=new Node,start=pos;if(options.locations){node.loc=new SourceLocation;node.loc.start=start[1];start=pos[0]}node.start=start;if(options.directSourceFile)node.sourceFile=options.directSourceFile;if(options.ranges)node.range=[start,0];return node}function finishNode(node,type){node.type=type;node.end=lastEnd;if(options.locations)node.loc.end=lastEndLoc;if(options.ranges)node.range[1]=lastEnd;return node}function isUseStrict(stmt){return options.ecmaVersion>=5&&stmt.type==="ExpressionStatement"&&stmt.expression.type==="Literal"&&stmt.expression.value==="use strict"}function eat(type){if(tokType===type){next();return true}else{return false}}function canInsertSemicolon(){return!options.strictSemicolons&&(tokType===_eof||tokType===_braceR||newline.test(input.slice(lastEnd,tokStart)))}function semicolon(){if(!eat(_semi)&&!canInsertSemicolon())unexpected()}function expect(type){eat(type)||unexpected()}function nextChar(){return input.charAt(tokPos)}function unexpected(pos){raise(pos!=null?pos:tokStart,"Unexpected token")}function has(obj,propName){return Object.prototype.hasOwnProperty.call(obj,propName)}function toAssignable(node,allowSpread,checkType){if(options.ecmaVersion>=6&&node){switch(node.type){case"Identifier":case"MemberExpression":break;case"ObjectExpression":node.type="ObjectPattern";for(var i=0;i<node.properties.length;i++){var prop=node.properties[i];if(prop.kind!=="init")unexpected(prop.key.start);toAssignable(prop.value,false,checkType)}break;case"ArrayExpression":node.type="ArrayPattern";for(var i=0,lastI=node.elements.length-1;i<=lastI;i++){toAssignable(node.elements[i],i===lastI,checkType)}break;case"SpreadElement":if(allowSpread){toAssignable(node.argument,false,checkType);checkSpreadAssign(node.argument)}else{unexpected(node.start)}break;default:if(checkType)unexpected(node.start)}}return node}function checkSpreadAssign(node){if(node.type!=="Identifier"&&node.type!=="ArrayPattern")unexpected(node.start)}function checkFunctionParam(param,nameHash){switch(param.type){case"Identifier":if(isStrictReservedWord(param.name)||isStrictBadIdWord(param.name))raise(param.start,"Defining '"+param.name+"' in strict mode");if(has(nameHash,param.name))raise(param.start,"Argument name clash in strict mode");nameHash[param.name]=true;break;case"ObjectPattern":for(var i=0;i<param.properties.length;i++)checkFunctionParam(param.properties[i].value,nameHash);break;case"ArrayPattern":for(var i=0;i<param.elements.length;i++){var elem=param.elements[i];if(elem)checkFunctionParam(elem,nameHash)}break}}function checkPropClash(prop,propHash){if(options.ecmaVersion>=6)return;var key=prop.key,name;switch(key.type){case"Identifier":name=key.name;break;case"Literal":name=String(key.value);break;default:return}var kind=prop.kind||"init",other;if(has(propHash,name)){other=propHash[name];var isGetSet=kind!=="init";if((strict||isGetSet)&&other[kind]||!(isGetSet^other.init))raise(key.start,"Redefinition of property")}else{other=propHash[name]={init:false,get:false,set:false}}other[kind]=true}function checkLVal(expr,isBinding){switch(expr.type){case"Identifier":if(strict&&(isStrictBadIdWord(expr.name)||isStrictReservedWord(expr.name)))raise(expr.start,isBinding?"Binding "+expr.name+" in strict mode":"Assigning to "+expr.name+" in strict mode");break;case"MemberExpression":if(!isBinding)break;
case"ObjectPattern":for(var i=0;i<expr.properties.length;i++)checkLVal(expr.properties[i].value,isBinding);break;case"ArrayPattern":for(var i=0;i<expr.elements.length;i++){var elem=expr.elements[i];if(elem)checkLVal(elem,isBinding)}break;case"SpreadElement":break;default:raise(expr.start,"Assigning to rvalue")}}function parseTopLevel(program){var node=program||startNode(),first=true;if(!program)node.body=[];while(tokType!==_eof){var stmt=parseStatement();node.body.push(stmt);if(first&&isUseStrict(stmt))setStrict(true);first=false}return finishNode(node,"Program")}var loopLabel={kind:"loop"},switchLabel={kind:"switch"};function parseStatement(){if(tokType===_slash||tokType===_assign&&tokVal=="/=")readToken(true);var starttype=tokType,node=startNode();switch(starttype){case _break:case _continue:return parseBreakContinueStatement(node,starttype.keyword);case _debugger:return parseDebuggerStatement(node);case _do:return parseDoStatement(node);case _for:return parseForStatement(node);case _async:return parseAsync(node,true);case _function:return parseFunctionStatement(node);case _class:return parseClass(node,true);case _if:return parseIfStatement(node);case _return:return parseReturnStatement(node);case _switch:return parseSwitchStatement(node);case _throw:return parseThrowStatement(node);case _try:return parseTryStatement(node);case _var:case _let:case _const:return parseVarStatement(node,starttype.keyword);case _while:return parseWhileStatement(node);case _with:return parseWithStatement(node);case _braceL:return parseBlock();case _semi:return parseEmptyStatement(node);case _export:return parseExport(node);case _import:return parseImport(node);default:var maybeName=tokVal,expr=parseExpression();if(starttype===_name&&expr.type==="Identifier"&&eat(_colon))return parseLabeledStatement(node,maybeName,expr);else return parseExpressionStatement(node,expr)}}function parseBreakContinueStatement(node,keyword){var isBreak=keyword=="break";next();if(eat(_semi)||canInsertSemicolon())node.label=null;else if(tokType!==_name)unexpected();else{node.label=parseIdent();semicolon()}for(var i=0;i<labels.length;++i){var lab=labels[i];if(node.label==null||lab.name===node.label.name){if(lab.kind!=null&&(isBreak||lab.kind==="loop"))break;if(node.label&&isBreak)break}}if(i===labels.length)raise(node.start,"Unsyntactic "+keyword);return finishNode(node,isBreak?"BreakStatement":"ContinueStatement")}function parseDebuggerStatement(node){next();semicolon();return finishNode(node,"DebuggerStatement")}function parseDoStatement(node){next();labels.push(loopLabel);node.body=parseStatement();labels.pop();expect(_while);node.test=parseParenExpression();semicolon();return finishNode(node,"DoWhileStatement")}function parseForStatement(node){next();labels.push(loopLabel);expect(_parenL);if(tokType===_semi)return parseFor(node,null);if(tokType===_var||tokType===_let){var init=startNode(),varKind=tokType.keyword,isLet=tokType===_let;next();parseVar(init,true,varKind);finishNode(init,"VariableDeclaration");if((tokType===_in||options.ecmaVersion>=6&&tokType===_name&&tokVal==="of")&&init.declarations.length===1&&!(isLet&&init.declarations[0].init))return parseForIn(node,init);return parseFor(node,init)}var init=parseExpression(false,true);if(tokType===_in||options.ecmaVersion>=6&&tokType===_name&&tokVal==="of"){checkLVal(init);return parseForIn(node,init)}return parseFor(node,init)}function parseFunctionStatement(node){next();return parseFunction(node,true,false)}function parseAsync(node,isStatement){if(options.ecmaVersion<7){unexpected()}next();switch(tokType){case _function:next();return parseFunction(node,isStatement,true);if(!isStatement)unexpected();case _name:var id=parseIdent(tokType!==_name);if(eat(_arrow)){return parseArrowExpression(node,[id],true)}case _parenL:var oldParenL=++metParenL;var exprList=[];next();if(tokType!==_parenR){var val=parseExpression();exprList=val.type==="SequenceExpression"?val.expressions:[val]}expect(_parenR);if(metParenL===oldParenL&&eat(_arrow)){return parseArrowExpression(node,exprList,true)}default:unexpected()}}function parseIfStatement(node){next();node.test=parseParenExpression();node.consequent=parseStatement();node.alternate=eat(_else)?parseStatement():null;return finishNode(node,"IfStatement")}function parseReturnStatement(node){if(!inFunction&&!options.allowReturnOutsideFunction)raise(tokStart,"'return' outside of function");next();if(eat(_semi)||canInsertSemicolon())node.argument=null;else{node.argument=parseExpression();semicolon()}return finishNode(node,"ReturnStatement")}function parseSwitchStatement(node){next();node.discriminant=parseParenExpression();node.cases=[];expect(_braceL);labels.push(switchLabel);for(var cur,sawDefault;tokType!=_braceR;){if(tokType===_case||tokType===_default){var isCase=tokType===_case;if(cur)finishNode(cur,"SwitchCase");node.cases.push(cur=startNode());cur.consequent=[];next();if(isCase)cur.test=parseExpression();else{if(sawDefault)raise(lastStart,"Multiple default clauses");sawDefault=true;cur.test=null}expect(_colon)}else{if(!cur)unexpected();cur.consequent.push(parseStatement())}}if(cur)finishNode(cur,"SwitchCase");next();labels.pop();return finishNode(node,"SwitchStatement")}function parseThrowStatement(node){next();if(newline.test(input.slice(lastEnd,tokStart)))raise(lastEnd,"Illegal newline after throw");node.argument=parseExpression();semicolon();return finishNode(node,"ThrowStatement")}function parseTryStatement(node){next();node.block=parseBlock();node.handler=null;if(tokType===_catch){var clause=startNode();next();expect(_parenL);clause.param=parseIdent();if(strict&&isStrictBadIdWord(clause.param.name))raise(clause.param.start,"Binding "+clause.param.name+" in strict mode");expect(_parenR);clause.guard=null;clause.body=parseBlock();node.handler=finishNode(clause,"CatchClause")}node.guardedHandlers=empty;node.finalizer=eat(_finally)?parseBlock():null;if(!node.handler&&!node.finalizer)raise(node.start,"Missing catch or finally clause");return finishNode(node,"TryStatement")}function parseVarStatement(node,kind){next();parseVar(node,false,kind);semicolon();return finishNode(node,"VariableDeclaration")}function parseWhileStatement(node){next();node.test=parseParenExpression();labels.push(loopLabel);node.body=parseStatement();labels.pop();return finishNode(node,"WhileStatement")}function parseWithStatement(node){if(strict)raise(tokStart,"'with' in strict mode");next();node.object=parseParenExpression();node.body=parseStatement();return finishNode(node,"WithStatement")}function parseEmptyStatement(node){next();return finishNode(node,"EmptyStatement")}function parseLabeledStatement(node,maybeName,expr){for(var i=0;i<labels.length;++i)if(labels[i].name===maybeName)raise(expr.start,"Label '"+maybeName+"' is already declared");var kind=tokType.isLoop?"loop":tokType===_switch?"switch":null;labels.push({name:maybeName,kind:kind});node.body=parseStatement();labels.pop();node.label=expr;return finishNode(node,"LabeledStatement")}function parseExpressionStatement(node,expr){node.expression=expr;semicolon();return finishNode(node,"ExpressionStatement")}function parseParenExpression(){expect(_parenL);var val=parseExpression();expect(_parenR);return val}function parseBlock(allowStrict){var node=startNode(),first=true,oldStrict;node.body=[];expect(_braceL);while(!eat(_braceR)){var stmt=parseStatement();node.body.push(stmt);if(first&&allowStrict&&isUseStrict(stmt)){oldStrict=strict;setStrict(strict=true)}first=false}if(oldStrict===false)setStrict(false);return finishNode(node,"BlockStatement")}function parseFor(node,init){node.init=init;expect(_semi);node.test=tokType===_semi?null:parseExpression();expect(_semi);node.update=tokType===_parenR?null:parseExpression();expect(_parenR);node.body=parseStatement();labels.pop();return finishNode(node,"ForStatement")}function parseForIn(node,init){var type=tokType===_in?"ForInStatement":"ForOfStatement";next();node.left=init;node.right=parseExpression();expect(_parenR);node.body=parseStatement();labels.pop();return finishNode(node,type)}function parseVar(node,noIn,kind){node.declarations=[];node.kind=kind;for(;;){var decl=startNode();decl.id=options.ecmaVersion>=6?toAssignable(parseExprAtom()):parseIdent();checkLVal(decl.id,true);decl.init=eat(_eq)?parseExpression(true,noIn):kind===_const.keyword?unexpected():null;node.declarations.push(finishNode(decl,"VariableDeclarator"));if(!eat(_comma))break}return node}function parseExpression(noComma,noIn){var start=storeCurrentPos();var expr=parseMaybeAssign(noIn);if(!noComma&&tokType===_comma){var node=startNodeAt(start);node.expressions=[expr];while(eat(_comma))node.expressions.push(parseMaybeAssign(noIn));return finishNode(node,"SequenceExpression")}return expr}function parseMaybeAssign(noIn){var start=storeCurrentPos();var left=parseMaybeConditional(noIn);if(tokType.isAssign){var node=startNodeAt(start);node.operator=tokVal;node.left=tokType===_eq?toAssignable(left):left;checkLVal(left);next();node.right=parseMaybeAssign(noIn);return finishNode(node,"AssignmentExpression")}return left}function parseMaybeConditional(noIn){var start=storeCurrentPos();var expr=parseExprOps(noIn);if(eat(_question)){var node=startNodeAt(start);node.test=expr;node.consequent=parseExpression(true);expect(_colon);node.alternate=parseExpression(true,noIn);return finishNode(node,"ConditionalExpression")}return expr}function parseExprOps(noIn){var start=storeCurrentPos();return parseExprOp(parseMaybeUnary(),start,-1,noIn)}function parseExprOp(left,leftStart,minPrec,noIn){var prec=tokType.binop;if(prec!=null&&(!noIn||tokType!==_in)){if(prec>minPrec){var node=startNodeAt(leftStart);node.left=left;node.operator=tokVal;var op=tokType;next();var start=storeCurrentPos();node.right=parseExprOp(parseMaybeUnary(),start,prec,noIn);finishNode(node,op===_logicalOR||op===_logicalAND?"LogicalExpression":"BinaryExpression");return parseExprOp(node,leftStart,minPrec,noIn)}}return left}function parseMaybeUnary(){if(tokType.prefix){var node=startNode(),update=tokType.isUpdate;node.operator=tokVal;node.prefix=true;tokRegexpAllowed=true;next();node.argument=parseMaybeUnary();if(update)checkLVal(node.argument);else if(strict&&node.operator==="delete"&&node.argument.type==="Identifier")raise(node.start,"Deleting local variable in strict mode");return finishNode(node,update?"UpdateExpression":"UnaryExpression")}var start=storeCurrentPos();var expr=parseExprSubscripts();while(tokType.postfix&&!canInsertSemicolon()){var node=startNodeAt(start);node.operator=tokVal;node.prefix=false;node.argument=expr;checkLVal(expr);next();expr=finishNode(node,"UpdateExpression")}return expr}function parseExprSubscripts(){var start=storeCurrentPos();return parseSubscripts(parseExprAtom(),start)}function parseSubscripts(base,start,noCalls){if(eat(_dot)){var node=startNodeAt(start);node.object=base;node.property=parseIdent(true);node.computed=false;return parseSubscripts(finishNode(node,"MemberExpression"),start,noCalls)}else if(eat(_bracketL)){var node=startNodeAt(start);node.object=base;node.property=parseExpression();node.computed=true;expect(_bracketR);return parseSubscripts(finishNode(node,"MemberExpression"),start,noCalls)}else if(!noCalls&&eat(_parenL)){var node=startNodeAt(start);node.callee=base;node.arguments=parseExprList(_parenR,false);return parseSubscripts(finishNode(node,"CallExpression"),start,noCalls)}else if(tokType===_bquote){var node=startNodeAt(start);node.tag=base;node.quasi=parseTemplate();return parseSubscripts(finishNode(node,"TaggedTemplateExpression"),start,noCalls)}return base}function parseExprAtom(){switch(tokType){case _this:var node=startNode();next();return finishNode(node,"ThisExpression");case _yield:if(inGenerator)return parseYield();case _await:if(inAsync)return parseAwait();case _name:var start=storeCurrentPos();var id=parseIdent(tokType!==_name);if(eat(_arrow)){return parseArrowExpression(startNodeAt(start),[id])}return id;case _regexp:var node=startNode();node.regex={pattern:tokVal.pattern,flags:tokVal.flags};node.value=tokVal.value;node.raw=input.slice(tokStart,tokEnd);next();return finishNode(node,"Literal");case _num:case _string:case _xjsText:var node=startNode();node.value=tokVal;node.raw=input.slice(tokStart,tokEnd);next();return finishNode(node,"Literal");case _null:case _true:case _false:var node=startNode();node.value=tokType.atomValue;node.raw=tokType.keyword;next();return finishNode(node,"Literal");case _parenL:var start=storeCurrentPos();var tokStartLoc1=tokStartLoc,tokStart1=tokStart,val,exprList;next();if(options.ecmaVersion>=7&&tokType===_for){val=parseComprehension(startNodeAt(start),true)}else{var oldParenL=++metParenL;if(tokType!==_parenR){val=parseExpression();exprList=val.type==="SequenceExpression"?val.expressions:[val]}else{exprList=[]}expect(_parenR);if(metParenL===oldParenL&&eat(_arrow)){val=parseArrowExpression(startNodeAt(start),exprList)}else{if(!val)unexpected(lastStart);if(options.ecmaVersion>=6){for(var i=0;i<exprList.length;i++){if(exprList[i].type==="SpreadElement")unexpected()}}if(options.preserveParens){var par=startNodeAt(start);par.expression=val;val=finishNode(par,"ParenthesizedExpression")}}}return val;case _bracketL:var node=startNode();next();if(options.ecmaVersion>=7&&tokType===_for){return parseComprehension(node,false)}node.elements=parseExprList(_bracketR,true,true);return finishNode(node,"ArrayExpression");case _braceL:return parseObj();case _async:return parseAsync(startNode(),false);case _function:var node=startNode();next();return parseFunction(node,false,false);case _class:return parseClass(startNode(),false);case _new:return parseNew();case _ellipsis:return parseSpread();case _bquote:return parseTemplate();case _lt:return parseXJSElement();default:unexpected()}}function parseNew(){var node=startNode();next();var start=storeCurrentPos();node.callee=parseSubscripts(parseExprAtom(),start,true);if(eat(_parenL))node.arguments=parseExprList(_parenR,false);else node.arguments=empty;return finishNode(node,"NewExpression")}function parseSpread(){var node=startNode();next();node.argument=parseExpression(true);return finishNode(node,"SpreadElement")}function parseTemplate(){var node=startNode();node.expressions=[];node.quasis=[];inTemplate=true;next();for(;;){var elem=startNode();elem.value={cooked:tokVal,raw:input.slice(tokStart,tokEnd)};elem.tail=false;next();node.quasis.push(finishNode(elem,"TemplateElement"));if(tokType===_bquote){elem.tail=true;break}inTemplate=false;expect(_dollarBraceL);node.expressions.push(parseExpression());inTemplate=true;tokPos=tokEnd;expect(_braceR)}inTemplate=false;next();return finishNode(node,"TemplateLiteral")}function parseObj(){var node=startNode(),first=true,propHash={};node.properties=[];next();while(!eat(_braceR)){if(!first){expect(_comma);if(options.allowTrailingCommas&&eat(_braceR))break}else first=false;var prop=startNode(),isGenerator,isAsync;if(options.ecmaVersion>=7){isAsync=eat(_async);if(isAsync&&tokType===_star)unexpected()}if(options.ecmaVersion>=6){prop.method=false;prop.shorthand=false;isGenerator=eat(_star)}parsePropertyName(prop);if(eat(_colon)){prop.value=parseExpression(true);prop.kind="init"}else if(options.ecmaVersion>=6&&tokType===_parenL){prop.kind="init";prop.method=true;prop.value=parseMethod(isGenerator,isAsync)}else if(options.ecmaVersion>=5&&!prop.computed&&prop.key.type==="Identifier"&&(prop.key.name==="get"||prop.key.name==="set")){if(isGenerator||isAsync)unexpected();prop.kind=prop.key.name;parsePropertyName(prop);prop.value=parseMethod(false,false)}else if(options.ecmaVersion>=6&&!prop.computed&&prop.key.type==="Identifier"){prop.kind="init";prop.value=prop.key;prop.shorthand=true}else unexpected();checkPropClash(prop,propHash);node.properties.push(finishNode(prop,"Property"))}return finishNode(node,"ObjectExpression")}function parsePropertyName(prop){if(options.ecmaVersion>=6){if(eat(_bracketL)){prop.computed=true;prop.key=parseExpression();expect(_bracketR);return}else{prop.computed=false}}prop.key=tokType===_num||tokType===_string?parseExprAtom():parseIdent(true)}function initFunction(node,isAsync){node.id=null;node.params=[];if(options.ecmaVersion>=6){node.defaults=[];node.rest=null;node.generator=false}if(options.ecmaVersion>=7){node.async=isAsync}}function parseFunction(node,isStatement,isAsync,allowExpressionBody){initFunction(node,isAsync);if(options.ecmaVersion>=6){if(isAsync&&tokType===_star)unexpected();node.generator=eat(_star)}if(isStatement||tokType===_name){node.id=parseIdent()}parseFunctionParams(node);parseFunctionBody(node,allowExpressionBody);return finishNode(node,isStatement?"FunctionDeclaration":"FunctionExpression")}function parseMethod(isGenerator,isAsync){var node=startNode();initFunction(node,isAsync);parseFunctionParams(node);var allowExpressionBody;if(options.ecmaVersion>=6){node.generator=isGenerator;allowExpressionBody=true}else{allowExpressionBody=false}parseFunctionBody(node,allowExpressionBody);return finishNode(node,"FunctionExpression")}function parseArrowExpression(node,params,isAsync){initFunction(node,isAsync);var defaults=node.defaults,hasDefaults=false;for(var i=0,lastI=params.length-1;i<=lastI;i++){var param=params[i];if(param.type==="AssignmentExpression"&¶m.operator==="="){hasDefaults=true;params[i]=param.left;defaults.push(param.right)}else{toAssignable(param,i===lastI,true);defaults.push(null);if(param.type==="SpreadElement"){params.length--;node.rest=param.argument;break}}}node.params=params;if(!hasDefaults)node.defaults=[];parseFunctionBody(node,true);return finishNode(node,"ArrowFunctionExpression")}function parseFunctionParams(node){var defaults=[],hasDefaults=false;expect(_parenL);for(;;){if(eat(_parenR)){break}else if(options.ecmaVersion>=6&&eat(_ellipsis)){node.rest=toAssignable(parseExprAtom(),false,true);checkSpreadAssign(node.rest);expect(_parenR);defaults.push(null);break}else{node.params.push(options.ecmaVersion>=6?toAssignable(parseExprAtom(),false,true):parseIdent());if(options.ecmaVersion>=6){if(eat(_eq)){hasDefaults=true;defaults.push(parseExpression(true))}else{defaults.push(null)}}if(!eat(_comma)){expect(_parenR);break}}}if(hasDefaults)node.defaults=defaults}function parseFunctionBody(node,allowExpression){var isExpression=allowExpression&&tokType!==_braceL;var oldInAsync=inAsync;inAsync=node.async;if(isExpression){node.body=parseExpression(true);node.expression=true}else{var oldInFunc=inFunction,oldInGen=inGenerator,oldLabels=labels;inFunction=true;inGenerator=node.generator;labels=[];node.body=parseBlock(true);node.expression=false;inFunction=oldInFunc;inGenerator=oldInGen;labels=oldLabels}inAsync=oldInAsync;if(strict||!isExpression&&node.body.body.length&&isUseStrict(node.body.body[0])){var nameHash={};if(node.id)checkFunctionParam(node.id,{});for(var i=0;i<node.params.length;i++)checkFunctionParam(node.params[i],nameHash);if(node.rest)checkFunctionParam(node.rest,nameHash)}}function parseClass(node,isStatement){next();node.id=tokType===_name?parseIdent():isStatement?unexpected():null;node.superClass=eat(_extends)?parseExpression():null;var classBody=startNode();classBody.body=[];expect(_braceL);while(!eat(_braceR)){var method=startNode();if(tokType===_name&&tokVal==="static"){next();method["static"]=true}else{method["static"]=false}var isAsync=false;if(options.ecmaVersion>=7){isAsync=eat(_async);if(isAsync&&tokType===_star)unexpected()}var isGenerator=eat(_star);parsePropertyName(method);if(tokType!==_parenL&&!method.computed&&method.key.type==="Identifier"&&(method.key.name==="get"||method.key.name==="set")){if(isGenerator||isAsync)unexpected();method.kind=method.key.name;parsePropertyName(method)}else{method.kind=""}method.value=parseMethod(isGenerator,isAsync);classBody.body.push(finishNode(method,"MethodDefinition"));eat(_semi)}node.body=finishNode(classBody,"ClassBody");return finishNode(node,isStatement?"ClassDeclaration":"ClassExpression")}function parseExprList(close,allowTrailingComma,allowEmpty){var elts=[],first=true;while(!eat(close)){if(!first){expect(_comma);if(allowTrailingComma&&options.allowTrailingCommas&&eat(close))break}else first=false;if(allowEmpty&&tokType===_comma)elts.push(null);else elts.push(parseExpression(true))}return elts}function parseIdent(liberal){var node=startNode();if(liberal&&options.forbidReserved=="everywhere")liberal=false;if(tokType===_name){if(!liberal&&(options.forbidReserved&&(options.ecmaVersion===3?isReservedWord3:isReservedWord5)(tokVal)||strict&&isStrictReservedWord(tokVal))&&input.slice(tokStart,tokEnd).indexOf("\\")==-1)raise(tokStart,"The keyword '"+tokVal+"' is reserved");node.name=tokVal}else if(liberal&&tokType.keyword){node.name=tokType.keyword}else{unexpected()}tokRegexpAllowed=false;next();return finishNode(node,"Identifier")}function parseExport(node){next();if(tokType===_var||tokType===_const||tokType===_let||tokType===_function||tokType===_class){node.declaration=parseStatement();node["default"]=false;node.specifiers=null;node.source=null}else if(eat(_default)){node.declaration=parseExpression(true);node["default"]=true;node.specifiers=null;node.source=null;semicolon()}else{var isBatch=tokType===_star;node.declaration=null;node["default"]=false;node.specifiers=parseExportSpecifiers();if(tokType===_name&&tokVal==="from"){next();node.source=tokType===_string?parseExprAtom():unexpected()}else{if(isBatch)unexpected();node.source=null}semicolon()}return finishNode(node,"ExportDeclaration")}function parseExportSpecifiers(){var nodes=[],first=true;if(tokType===_star){var node=startNode();next();nodes.push(finishNode(node,"ExportBatchSpecifier"))}else{expect(_braceL);while(!eat(_braceR)){if(!first){expect(_comma);if(options.allowTrailingCommas&&eat(_braceR))break}else first=false;var node=startNode();node.id=parseIdent();if(tokType===_name&&tokVal==="as"){next();node.name=parseIdent(true)}else{node.name=null}nodes.push(finishNode(node,"ExportSpecifier"))}}return nodes}function parseImport(node){next();if(tokType===_string){node.specifiers=[];node.source=parseExprAtom();node.kind=""}else{node.specifiers=parseImportSpecifiers();if(tokType!==_name||tokVal!=="from")unexpected();next();node.source=tokType===_string?parseExprAtom():unexpected();node.kind=node.specifiers[0]["default"]?"default":"named"}semicolon();return finishNode(node,"ImportDeclaration")}function parseImportSpecifiers(){var nodes=[],first=true;if(tokType===_star){var node=startNode();next();if(tokType!==_name||tokVal!=="as")unexpected();next();node.name=parseIdent();checkLVal(node.name,true);nodes.push(finishNode(node,"ImportBatchSpecifier"));return nodes}if(tokType===_name){var node=startNode();node.id=parseIdent();checkLVal(node.id,true);node.name=null;node["default"]=true;nodes.push(finishNode(node,"ImportSpecifier"));if(!eat(_comma))return nodes}expect(_braceL);while(!eat(_braceR)){if(!first){expect(_comma);if(options.allowTrailingCommas&&eat(_braceR))break}else first=false;var node=startNode();node.id=parseIdent(true);if(tokType===_name&&tokVal==="as"){next();node.name=parseIdent()}else{node.name=null}checkLVal(node.name||node.id,true);node["default"]=false;nodes.push(finishNode(node,"ImportSpecifier"))}return nodes}function parseYield(){var node=startNode();next();if(eat(_semi)||canInsertSemicolon()){node.delegate=false;node.argument=null}else{node.delegate=eat(_star);node.argument=parseExpression(true)}return finishNode(node,"YieldExpression")}function parseAwait(){var node=startNode();next();if(eat(_semi)||canInsertSemicolon()){unexpected()}node.delegate=eat(_star);node.argument=parseExpression(true);return finishNode(node,"AwaitExpression")}function parseComprehension(node,isGenerator){node.blocks=[];while(tokType===_for){var block=startNode();next();expect(_parenL);block.left=toAssignable(parseExprAtom());checkLVal(block.left,true);if(tokType!==_name||tokVal!=="of")unexpected();next();block.of=true;block.right=parseExpression();expect(_parenR);node.blocks.push(finishNode(block,"ComprehensionBlock"))}node.filter=eat(_if)?parseParenExpression():null;node.body=parseExpression();expect(isGenerator?_parenR:_bracketR);node.generator=isGenerator;return finishNode(node,"ComprehensionExpression")}function getQualifiedXJSName(object){if(object.type==="XJSIdentifier"){return object.name}if(object.type==="XJSNamespacedName"){return object.namespace.name+":"+object.name.name}if(object.type==="XJSMemberExpression"){return getQualifiedXJSName(object.object)+"."+getQualifiedXJSName(object.property)}}function parseXJSIdentifier(){var node=startNode();if(tokType===_xjsName){node.name=tokVal}else if(tokType.keyword){node.name=tokType.keyword}else{unexpected()}tokRegexpAllowed=false;next();return finishNode(node,"XJSIdentifier")}function parseXJSNamespacedName(){var node=startNode();node.namespace=parseXJSIdentifier();expect(_colon);node.name=parseXJSIdentifier();return finishNode(node,"XJSNamespacedName")}function parseXJSMemberExpression(){var start=storeCurrentPos();var node=parseXJSIdentifier();while(eat(_dot)){var newNode=startNodeAt(start);newNode.object=node;newNode.property=parseXJSIdentifier();node=finishNode(newNode,"XJSMemberExpression")}return node}function parseXJSElementName(){switch(nextChar()){case":":return parseXJSNamespacedName();case".":return parseXJSMemberExpression();default:return parseXJSIdentifier()}}function parseXJSAttributeName(){if(nextChar()===":"){return parseXJSNamespacedName()}return parseXJSIdentifier()}function parseXJSAttributeValue(){switch(tokType){case _braceL:var node=parseXJSExpressionContainer();if(node.expression.type==="XJSEmptyExpression"){raise(node.start,"XJS attributes must only be assigned a non-empty "+"expression")}return node;case _lt:return parseXJSElement();case _xjsText:return parseExprAtom();default:raise(tokStart,"XJS value should be either an expression or a quoted XJS text")}}function parseXJSEmptyExpression(){if(tokType!==_braceR){unexpected()}var tmp;tmp=tokStart;tokStart=lastEnd;lastEnd=tmp;tmp=tokStartLoc;tokStartLoc=lastEndLoc;lastEndLoc=tmp;return finishNode(startNode(),"XJSEmptyExpression")}function parseXJSExpressionContainer(){var node=startNode();var origInXJSTag=inXJSTag,origInXJSChild=inXJSChild;inXJSTag=false;inXJSChild=false;inXJSChildExpression=origInXJSChild;next();node.expression=tokType===_braceR?parseXJSEmptyExpression():parseExpression();inXJSTag=origInXJSTag;inXJSChild=origInXJSChild;inXJSChildExpression=false;expect(_braceR);return finishNode(node,"XJSExpressionContainer")}function parseXJSAttribute(){if(tokType===_braceL){var tokStart1=tokStart,tokStartLoc1=tokStartLoc;var origInXJSTag=inXJSTag;inXJSTag=false;next();var node=parseSpread();inXJSTag=origInXJSTag;expect(_braceR);node.type="XJSSpreadAttribute";node.start=tokStart1;node.end=lastEnd;if(options.locations){node.loc.start=tokStartLoc1;node.loc.end=lastEndLoc}if(options.ranges){node.range=[tokStart1,lastEnd]}return node}var node=startNode();node.name=parseXJSAttributeName();if(tokType===_eq){next();node.value=parseXJSAttributeValue()}else{node.value=null}return finishNode(node,"XJSAttribute")}function parseXJSChild(){switch(tokType){case _braceL:return parseXJSExpressionContainer();case _xjsText:return parseExprAtom();default:return parseXJSElement()}}function parseXJSOpeningElement(){var node=startNode(),attributes=node.attributes=[];var origInXJSChild=inXJSChild;var origInXJSTag=inXJSTag;inXJSChild=false;inXJSTag=true;next();node.name=parseXJSElementName();while(tokType!==_eof&&tokType!==_slash&&tokType!==_gt){attributes.push(parseXJSAttribute())}inXJSTag=false;if(node.selfClosing=!!eat(_slash)){inXJSTag=origInXJSTag;inXJSChild=origInXJSChild}else{inXJSChild=true}expect(_gt);return finishNode(node,"XJSOpeningElement")}function parseXJSClosingElement(){var node=startNode();var origInXJSChild=inXJSChild;var origInXJSTag=inXJSTag;inXJSChild=false;inXJSTag=true;tokRegexpAllowed=false;expect(_ltSlash);node.name=parseXJSElementName();skipSpace();inXJSChild=origInXJSChild;inXJSTag=origInXJSTag;tokRegexpAllowed=false;expect(_gt);return finishNode(node,"XJSClosingElement")}function parseXJSElement(){var node=startNode();var children=[];var origInXJSChild=inXJSChild;var openingElement=parseXJSOpeningElement();var closingElement=null;if(!openingElement.selfClosing){while(tokType!==_eof&&tokType!==_ltSlash){inXJSChild=true;children.push(parseXJSChild())}inXJSChild=origInXJSChild;closingElement=parseXJSClosingElement();if(getQualifiedXJSName(closingElement.name)!==getQualifiedXJSName(openingElement.name)){raise(closingElement.start,"Expected corresponding XJS closing tag for '"+getQualifiedXJSName(openingElement.name)+"'")}}if(!origInXJSChild&&tokType===_lt){raise(tokStart,"Adjacent XJS elements must be wrapped in an enclosing tag")}node.openingElement=openingElement;node.closingElement=closingElement;node.children=children;return finishNode(node,"XJSElement")}})},{}],2:[function(require,module,exports){var transform=module.exports=require("./transformation/transform");transform.transform=transform;transform.eval=function(code,opts){opts=opts||{};opts.filename=opts.filename||"eval";opts.sourceMap="inline";return eval(transform(code,opts).code)};transform.run=function(code,opts){opts=opts||{};opts.sourceMap="inline";return new Function(transform(code,opts).code)()};transform.load=function(url,callback,opts,hold){opts=opts||{};opts.filename=opts.filename||url;var xhr=window.ActiveXObject?new window.ActiveXObject("Microsoft.XMLHTTP"):new window.XMLHttpRequest;xhr.open("GET",url,true);if("overrideMimeType"in xhr)xhr.overrideMimeType("text/plain");xhr.onreadystatechange=function(){if(xhr.readyState!==4)return;var status=xhr.status;if(status===0||status===200){var param=[xhr.responseText,opts];if(!hold)transform.run.apply(transform,param);if(callback)callback(param)}else{throw new Error("Could not load "+url)}};xhr.send(null)};var runScripts=function(){var scripts=[];var types=["text/ecmascript-6","text/6to5"];var index=0;var exec=function(){var param=scripts[index];if(param instanceof Array){transform.run.apply(transform,param);index++;exec()}};var run=function(script,i){var opts={};if(script.src){transform.load(script.src,function(param){scripts[i]=param;exec()},opts,true)}else{opts.filename="embedded";scripts[i]=[script.innerHTML,opts]}};var _scripts=window.document.getElementsByTagName("script");for(var i in _scripts){var _script=_scripts[i];if(types.indexOf(_script.type)>=0)scripts.push(_script)}for(i in scripts){run(scripts[i],i)}exec()};if(window.addEventListener){window.addEventListener("DOMContentLoaded",runScripts,false)}else{window.attachEvent("onload",runScripts)}},{"./transformation/transform":27}],3:[function(require,module,exports){module.exports=File;var SHEBANG_REGEX=/^\#\!.*/;var transform=require("./transformation/transform");var generate=require("./generation/generator");var Scope=require("./traverse/scope");var util=require("./util");var t=require("./types");var _=require("lodash");function File(opts){this.opts=File.normaliseOptions(opts);this.moduleFormatter=this.getModuleFormatter(this.opts.modules);this.declarations={};this.uids={};this.ast={}}File.declarations=["extends","class-props","slice","apply-constructor"];File.normaliseOptions=function(opts){opts=_.cloneDeep(opts||{});_.defaults(opts,{whitespace:true,blacklist:[],whitelist:[],sourceMap:false,filename:"unknown",modules:"common",runtime:false,code:true});opts.filename=opts.filename.replace(/\\/g,"/");_.defaults(opts,{sourceFileName:opts.filename,sourceMapName:opts.filename});if(opts.runtime===true){opts.runtime="to5Runtime"}transform._ensureTransformerNames("blacklist",opts.blacklist);transform._ensureTransformerNames("whitelist",opts.whitelist);return opts};File.prototype.getModuleFormatter=function(type){var ModuleFormatter=transform.moduleFormatters[type];if(!ModuleFormatter){var loc=util.resolve(type);if(loc)ModuleFormatter=require(loc)}if(!ModuleFormatter){throw new ReferenceError("unknown module formatter type "+type)}return new ModuleFormatter(this)};File.prototype.parseShebang=function(code){var shebangMatch=code.match(SHEBANG_REGEX);
if(shebangMatch){this.shebang=shebangMatch[0];code=code.replace(SHEBANG_REGEX,"")}return code};File.prototype.addDeclaration=function(name){if(!_.contains(File.declarations,name)){throw new ReferenceError("unknown declaration "+name)}var declar=this.declarations[name];if(declar)return declar.uid;var ref;var runtimeNamespace=this.opts.runtime;if(runtimeNamespace){name=t.identifier(t.toIdentifier(name));return t.memberExpression(t.identifier(runtimeNamespace),name)}else{ref=util.template(name)}var uid=t.identifier(this.generateUid(name));this.declarations[name]={uid:uid,node:ref};return uid};File.prototype.errorWithNode=function(node,msg,Error){Error=Error||SyntaxError;var loc=node.loc.start;var err=new Error("Line "+loc.line+": "+msg);err.loc=loc;return err};File.prototype.parse=function(code){code=(code||"")+"";var self=this;this.code=code;code=this.parseShebang(code);return util.parse(this.opts,code,function(tree){self.transform(tree);return self.generate()})};File.prototype.transform=function(ast){this.ast=ast;this.scope=new Scope(null,ast.program);var self=this;_.each(transform.transformers,function(transformer){transformer.transform(self)})};File.prototype.generate=function(){var opts=this.opts;var ast=this.ast;if(!opts.code){return{code:"",map:null,ast:ast}}var result=generate(ast,opts,this.code);if(this.shebang){result.code=this.shebang+"\n"+result.code}if(opts.sourceMap==="inline"){result.code+="\n"+util.sourceMapToComment(result.map)}result.ast=result;return result};File.prototype.generateUid=function(name,scope){name=t.toIdentifier(name);scope=scope||this.scope;var uid;do{uid=this._generateUid(name)}while(scope.has(uid));return uid};File.prototype._generateUid=function(name){var uids=this.uids;var i=uids[name]||1;var id=name;if(i>1)id+=i;uids[name]=i+1;return"_"+id}},{"./generation/generator":5,"./transformation/transform":27,"./traverse/scope":55,"./types":58,"./util":60,lodash:91}],4:[function(require,module,exports){module.exports=Buffer;var util=require("../util");var _=require("lodash");function Buffer(position,format){this.position=position;this._indent=format.indent.base;this.format=format;this.buf=""}Buffer.prototype.get=function(){return util.trimRight(this.buf)};Buffer.prototype.getIndent=function(){if(this.format.compact){return""}else{return util.repeat(this._indent,this.format.indent.style)}};Buffer.prototype.indentSize=function(){return this.getIndent().length};Buffer.prototype.indent=function(){this._indent++};Buffer.prototype.dedent=function(){this._indent--};Buffer.prototype.semicolon=function(){if(this.format.semicolons)this.push(";")};Buffer.prototype.ensureSemicolon=function(){if(!this.isLast(";"))this.semicolon()};Buffer.prototype.rightBrace=function(){this.newline(true);this.push("}")};Buffer.prototype.keyword=function(name){this.push(name);this.push(" ")};Buffer.prototype.space=function(){if(this.buf&&!this.isLast([" ","\n"])){this.push(" ")}};Buffer.prototype.removeLast=function(cha){if(!this.isLast(cha))return;this.buf=this.buf.slice(0,-1);this.position.unshift(cha)};Buffer.prototype.newline=function(i,removeLast){if(!this.buf)return;if(this.format.compact)return;if(this.endsWith("{\n"))return;if(_.isBoolean(i)){removeLast=i;i=null}if(_.isNumber(i)){if(this.endsWith(util.repeat(i,"\n")))return;var self=this;_.times(i,function(){self.newline(null,removeLast)});return}if(removeLast&&this.isLast("\n"))this.removeLast("\n");this.removeLast(" ");this.buf=this.buf.replace(/\n +$/,"\n");this._push("\n")};Buffer.prototype.push=function(str,noIndent){if(this._indent&&!noIndent&&str!=="\n"){var indent=this.getIndent();str=str.replace(/\n/g,"\n"+indent);if(this.isLast("\n"))str=indent+str}this._push(str)};Buffer.prototype._push=function(str){this.position.push(str);this.buf+=str};Buffer.prototype.endsWith=function(str){return this.buf.slice(-str.length)===str};Buffer.prototype.isLast=function(cha,trimRight){var buf=this.buf;if(trimRight)buf=util.trimRight(buf);var chars=[].concat(cha);return _.contains(chars,_.last(buf))}},{"../util":60,lodash:91}],5:[function(require,module,exports){module.exports=function(ast,opts,code){var gen=new CodeGenerator(ast,opts,code);return gen.generate()};module.exports.CodeGenerator=CodeGenerator;var Whitespace=require("./whitespace");var SourceMap=require("./source-map");var Position=require("./position");var Buffer=require("./buffer");var util=require("../util");var n=require("./node");var t=require("../types");var _=require("lodash");function CodeGenerator(ast,opts,code){opts=opts||{};this.comments=ast.comments||[];this.tokens=ast.tokens||[];this.format=CodeGenerator.normaliseOptions(opts);this.ast=ast;this.whitespace=new Whitespace(this.tokens,this.comments);this.position=new Position;this.map=new SourceMap(this.position,opts,code);this.buffer=new Buffer(this.position,this.format)}_.each(Buffer.prototype,function(fn,key){CodeGenerator.prototype[key]=function(){return fn.apply(this.buffer,arguments)}});CodeGenerator.normaliseOptions=function(opts){opts=opts.format||{};opts=_.merge({parentheses:true,semicolons:true,comments:true,compact:false,indent:{adjustMultilineComment:true,style:" ",base:0}},opts);return opts};CodeGenerator.generators={templateLiterals:require("./generators/template-literals"),comprehensions:require("./generators/comprehensions"),expressions:require("./generators/expressions"),statements:require("./generators/statements"),classes:require("./generators/classes"),methods:require("./generators/methods"),modules:require("./generators/modules"),types:require("./generators/types"),base:require("./generators/base"),jsx:require("./generators/jsx")};_.each(CodeGenerator.generators,function(generator){_.extend(CodeGenerator.prototype,generator)});CodeGenerator.prototype.generate=function(){var ast=this.ast;this.print(ast);return{map:this.map.get(),code:this.buffer.get()}};CodeGenerator.prototype.buildPrint=function(parent){var self=this;var print=function(node,opts){return self.print(node,parent,opts)};print.sequence=function(nodes,opts){opts=opts||{};opts.statement=true;return self.printJoin(print,nodes,opts)};print.join=function(nodes,opts){return self.printJoin(print,nodes,opts)};print.block=function(node){return self.printBlock(print,node)};print.indentOnComments=function(node){return self.printAndIndentOnComments(print,node)};return print};CodeGenerator.prototype.print=function(node,parent,opts){if(!node)return"";var self=this;opts=opts||{};var newline=function(leading){if(!opts.statement&&!n.isUserWhitespacable(node,parent)){return}var lines=0;if(node.start!=null){if(leading){lines=self.whitespace.getNewlinesBefore(node)}else{lines=self.whitespace.getNewlinesAfter(node)}}else{if(!leading)lines++;var needs=n.needsWhitespaceAfter;if(leading)needs=n.needsWhitespaceBefore;lines+=needs(node,parent)}self.newline(lines)};if(this[node.type]){this.printLeadingComments(node,parent);newline(true);if(opts.before)opts.before();this.map.mark(node,"start");var needsParens=parent!==node._parent&&n.needsParens(node,parent);if(needsParens)this.push("(");this[node.type](node,this.buildPrint(node),parent);if(needsParens)this.push(")");this.map.mark(node,"end");if(opts.after)opts.after();newline(false);this.printTrailingComments(node,parent)}else{throw new ReferenceError("unknown node "+node.type+" "+JSON.stringify(node))}};CodeGenerator.prototype.printJoin=function(print,nodes,opts){opts=opts||{};var self=this;var len=nodes.length;if(opts.indent)self.indent();_.each(nodes,function(node,i){print(node,{statement:opts.statement,after:function(){if(opts.iterator){opts.iterator(node,i)}if(opts.separator&&i<len-1){self.push(opts.separator)}}})});if(opts.indent)self.dedent()};CodeGenerator.prototype.printAndIndentOnComments=function(print,node){var indent=!!node.leadingComments;if(indent)this.indent();print(node);if(indent)this.dedent()};CodeGenerator.prototype.printBlock=function(print,node){if(t.isEmptyStatement(node)){this.semicolon()}else{this.push(" ");print(node)}};CodeGenerator.prototype.generateComment=function(comment){var val=comment.value;if(comment.type==="Line"){val="//"+val}else{val="/*"+val+"*/"}return val};CodeGenerator.prototype.printTrailingComments=function(node,parent){this._printComments(this.getComments("trailingComments",node,parent))};CodeGenerator.prototype.printLeadingComments=function(node,parent){this._printComments(this.getComments("leadingComments",node,parent))};CodeGenerator.prototype.getComments=function(key,node,parent){if(t.isExpressionStatement(parent)){return[]}var comments=[];var nodes=[node];var self=this;if(t.isExpressionStatement(node)){nodes.push(node.argument)}_.each(nodes,function(node){comments=comments.concat(self._getComments(key,node))});return comments};CodeGenerator.prototype._getComments=function(key,node){return node&&node[key]||[]};CodeGenerator.prototype._printComments=function(comments){if(this.format.compact)return;if(!this.format.comments)return;if(!comments||!comments.length)return;var self=this;_.each(comments,function(comment){self.newline(self.whitespace.getNewlinesBefore(comment));var column=self.position.column;var val=self.generateComment(comment);if(column&&!self.isLast(["\n"," ","[","{"])){self._push(" ");column++}if(comment.type==="Block"&&self.format.indent.adjustMultilineComment){var offset=comment.loc.start.column;if(offset){var newlineRegex=new RegExp("\\n\\s{1,"+offset+"}","g");val=val.replace(newlineRegex,"\n")}var indent=Math.max(self.indentSize(),column);val=val.replace(/\n/g,"\n"+util.repeat(indent))}if(column===0){val=self.getIndent()+val}self._push(val);self.newline(self.whitespace.getNewlinesAfter(comment))})}},{"../types":58,"../util":60,"./buffer":4,"./generators/base":6,"./generators/classes":7,"./generators/comprehensions":8,"./generators/expressions":9,"./generators/jsx":10,"./generators/methods":11,"./generators/modules":12,"./generators/statements":13,"./generators/template-literals":14,"./generators/types":15,"./node":16,"./position":19,"./source-map":20,"./whitespace":21,lodash:91}],6:[function(require,module,exports){exports.File=function(node,print){print(node.program)};exports.Program=function(node,print){print.sequence(node.body)};exports.BlockStatement=function(node,print){if(node.body.length===0){this.push("{}")}else{this.push("{");this.newline();print.sequence(node.body,{indent:true});this.removeLast("\n");this.rightBrace()}}},{}],7:[function(require,module,exports){exports.ClassExpression=exports.ClassDeclaration=function(node,print){this.push("class");if(node.id){this.space();print(node.id)}if(node.superClass){this.push(" extends ");print(node.superClass)}this.space();print(node.body)};exports.ClassBody=function(node,print){if(node.body.length===0){this.push("{}")}else{this.push("{");this.newline();this.indent();print.sequence(node.body);this.dedent();this.rightBrace()}}},{}],8:[function(require,module,exports){exports.ComprehensionBlock=function(node,print){this.keyword("for");this.push("(");print(node.left);this.push(" of ");print(node.right);this.push(")")};exports.ComprehensionExpression=function(node,print){this.push(node.generator?"(":"[");print.join(node.blocks,{separator:" "});this.space();if(node.filter){this.keyword("if");this.push("(");print(node.filter);this.push(")");this.space()}print(node.body);this.push(node.generator?")":"]")}},{}],9:[function(require,module,exports){var t=require("../../types");exports.UnaryExpression=function(node,print){var hasSpace=/[a-z]$/.test(node.operator);var arg=node.argument;if(t.isUpdateExpression(arg)||t.isUnaryExpression(arg)){hasSpace=true}if(t.isUnaryExpression(arg)&&arg.operator==="!"){hasSpace=false}this.push(node.operator);if(hasSpace)this.space();print(node.argument)};exports.ParenthesizedExpression=function(node,print){this.push("(");print(node.expression);this.push(")")};exports.UpdateExpression=function(node,print){if(node.prefix){this.push(node.operator);print(node.argument)}else{print(node.argument);this.push(node.operator)}};exports.ConditionalExpression=function(node,print){print(node.test);this.push(" ? ");print(node.consequent);this.push(" : ");print(node.alternate)};exports.NewExpression=function(node,print){this.push("new ");print(node.callee);if(node.arguments.length||this.format.parentheses){this.push("(");print.join(node.arguments,{separator:", "});this.push(")")}};exports.SequenceExpression=function(node,print){print.join(node.expressions,{separator:", "})};exports.ThisExpression=function(){this.push("this")};exports.CallExpression=function(node,print){print(node.callee);this.push("(");print.join(node.arguments,{separator:", "});this.push(")")};var buildYieldAwait=function(keyword){return function(node,print){this.push(keyword);if(node.delegate)this.push("*");if(node.argument){this.space();print(node.argument)}}};exports.YieldExpression=buildYieldAwait("yield");exports.AwaitExpression=buildYieldAwait("await");exports.EmptyStatement=function(){this.semicolon()};exports.ExpressionStatement=function(node,print){print(node.expression);this.semicolon()};exports.BinaryExpression=exports.LogicalExpression=exports.AssignmentExpression=function(node,print){print(node.left);this.push(" "+node.operator+" ");print(node.right)};exports.MemberExpression=function(node,print){print(node.object);if(node.computed){this.push("[");print(node.property);this.push("]")}else{this.push(".");print(node.property)}}},{"../../types":58}],10:[function(require,module,exports){var t=require("../../types");var _=require("lodash");exports.XJSAttribute=function(node,print){print(node.name);if(node.value){this.push("=");print(node.value)}};exports.XJSIdentifier=function(node){this.push(node.name)};exports.XJSNamespacedName=function(node,print){print(node.namespace);this.push(":");print(node.name)};exports.XJSMemberExpression=function(node,print){print(node.object);this.push(".");print(node.property)};exports.XJSSpreadAttribute=function(node,print){this.push("{...");print(node.argument);this.push("}")};exports.XJSExpressionContainer=function(node,print){this.push("{");print(node.expression);this.push("}")};exports.XJSElement=function(node,print){var self=this;var open=node.openingElement;print(open);if(open.selfClosing)return;this.indent();_.each(node.children,function(child){if(t.isLiteral(child)){self.push(child.value)}else{print(child)}});this.dedent();print(node.closingElement)};exports.XJSOpeningElement=function(node,print){this.push("<");print(node.name);if(node.attributes.length>0){this.space();print.join(node.attributes,{separator:" "})}this.push(node.selfClosing?" />":">")};exports.XJSClosingElement=function(node,print){this.push("</");print(node.name);this.push(">")};exports.XJSEmptyExpression=function(){this.push("null")}},{"../../types":58,lodash:91}],11:[function(require,module,exports){var t=require("../../types");exports._params=function(node,print){var self=this;this.push("(");print.join(node.params,{separator:", ",iterator:function(param,i){var def=node.defaults&&node.defaults[i];if(def){self.push(" = ");print(def)}}});if(node.rest){if(node.params.length){this.push(", ")}this.push("...");print(node.rest)}this.push(")")};exports._method=function(node,print){var value=node.value;var kind=node.kind;var key=node.key;if(!kind||kind==="init"){if(value.generator){this.push("*")}}else{this.push(kind+" ")}if(node.computed){this.push("[");print(key);this.push("]")}else{print(key)}this._params(value,print);this.space();print(value.body)};exports.MethodDefinition=function(node,print){if(node.static){this.push("static ")}this._method(node,print)};exports.FunctionDeclaration=exports.FunctionExpression=function(node,print){this.push("function");if(node.generator)this.push("*");this.space();if(node.id)print(node.id);this._params(node,print);this.space();print(node.body)};exports.ArrowFunctionExpression=function(node,print){if(node.params.length===1&&!node.defaults.length&&!node.rest&&t.isIdentifier(node.params[0])){print(node.params[0])}else{this._params(node,print)}this.push(" => ");print(node.body)}},{"../../types":58}],12:[function(require,module,exports){var t=require("../../types");var _=require("lodash");exports.ImportSpecifier=exports.ExportSpecifier=function(node,print){print(node.id);if(node.name){this.push(" as ");print(node.name)}};exports.ExportBatchSpecifier=function(){this.push("*")};exports.ExportDeclaration=function(node,print){this.push("export ");var specifiers=node.specifiers;if(node.default){this.push("default ")}if(node.declaration){print(node.declaration)}else{if(specifiers.length===1&&t.isExportBatchSpecifier(specifiers[0])){this.push("*")}else{this.push("{");if(specifiers.length){this.space();print.join(specifiers,{separator:", "});this.space()}this.push("}")}if(node.source){this.push(" from ");print(node.source)}}this.ensureSemicolon()};exports.ImportDeclaration=function(node,print){var self=this;this.push("import ");var specfiers=node.specifiers;if(specfiers&&specfiers.length){var foundImportSpecifier=false;_.each(node.specifiers,function(spec,i){if(+i>0){self.push(", ")}if(!spec.default&&spec.type!=="ImportBatchSpecifier"&&!foundImportSpecifier){foundImportSpecifier=true;self.push("{ ")}print(spec)});if(foundImportSpecifier){this.push(" }")}this.push(" from ")}print(node.source);this.semicolon()};exports.ImportBatchSpecifier=function(node,print){this.push("* as ");print(node.name)}},{"../../types":58,lodash:91}],13:[function(require,module,exports){var t=require("../../types");exports.WithStatement=function(node,print){this.keyword("with");this.push("(");print(node.object);print.block(node.body)};exports.IfStatement=function(node,print){this.keyword("if");this.push("(");print(node.test);this.push(") ");print.indentOnComments(node.consequent);if(node.alternate){if(this.isLast("}"))this.space();this.keyword("else");print.indentOnComments(node.alternate)}};exports.ForStatement=function(node,print){this.keyword("for");this.push("(");print(node.init);this.push(";");if(node.test){this.space();print(node.test)}this.push(";");if(node.update){this.space();print(node.update)}this.push(")");print.block(node.body)};exports.WhileStatement=function(node,print){this.keyword("while");this.push("(");print(node.test);this.push(")");print.block(node.body)};var buildForXStatement=function(op){return function(node,print){this.keyword("for");this.push("(");print(node.left);this.push(" "+op+" ");print(node.right);this.push(")");print.block(node.body)}};exports.ForInStatement=buildForXStatement("in");exports.ForOfStatement=buildForXStatement("of");exports.DoWhileStatement=function(node,print){this.keyword("do");print(node.body);this.space();this.keyword("while");this.push("(");print(node.test);this.push(");")};var buildLabelStatement=function(prefix,key){return function(node,print){this.push(prefix);var label=node[key||"label"];if(label){this.space();print(label)}this.semicolon()}};exports.ContinueStatement=buildLabelStatement("continue");exports.ReturnStatement=buildLabelStatement("return","argument");exports.BreakStatement=buildLabelStatement("break");exports.LabeledStatement=function(node,print){print(node.label);this.push(": ");print(node.body)};exports.TryStatement=function(node,print){this.keyword("try");print(node.block);this.space();print(node.handler);if(node.finalizer){this.space();this.push("finally ");print(node.finalizer)}};exports.CatchClause=function(node,print){this.keyword("catch");this.push("(");print(node.param);this.push(") ");print(node.body)};exports.ThrowStatement=function(node,print){this.push("throw ");print(node.argument);this.semicolon()};exports.SwitchStatement=function(node,print){this.keyword("switch");this.push("(");print(node.discriminant);this.push(") {");print.sequence(node.cases,{indent:true});this.push("}")};exports.SwitchCase=function(node,print){if(node.test){this.push("case ");print(node.test);this.push(":")}else{this.push("default:")}if(node.consequent.length===1){this.space();print(node.consequent[0])}else if(node.consequent.length>1){this.newline();print.sequence(node.consequent,{indent:true})}};exports.DebuggerStatement=function(){this.push("debugger;")};exports.VariableDeclaration=function(node,print,parent){this.push(node.kind+" ");print.join(node.declarations,{separator:", "});if(!t.isFor(parent)){this.semicolon()}};exports.VariableDeclarator=function(node,print){if(node.init){print(node.id);this.push(" = ");print(node.init)}else{print(node.id)}}},{"../../types":58}],14:[function(require,module,exports){var _=require("lodash");exports.TaggedTemplateExpression=function(node,print){print(node.tag);print(node.quasi)};exports.TemplateElement=function(node){this._push(node.value.raw)};exports.TemplateLiteral=function(node,print){this.push("`");var quasis=node.quasis;var self=this;var len=quasis.length;_.each(quasis,function(quasi,i){print(quasi);if(i+1<len){self.push("${ ");print(node.expressions[i]);self.push(" }")}});this._push("`")}},{lodash:91}],15:[function(require,module,exports){var _=require("lodash");exports.Identifier=function(node){this.push(node.name)};exports.SpreadElement=function(node,print){this.push("...");print(node.argument)};exports.ObjectExpression=exports.ObjectPattern=function(node,print){var props=node.properties;if(props.length){this.push("{");this.space();print.join(props,{separator:", ",indent:true});this.space();this.push("}")}else{this.push("{}")}};exports.Property=function(node,print){if(node.method||node.kind==="get"||node.kind==="set"){this._method(node,print)}else{if(node.computed){this.push("[");print(node.key);this.push("]")}else{print(node.key);if(node.shorthand)return}this.push(": ");print(node.value)}};exports.ArrayExpression=exports.ArrayPattern=function(node,print){var elems=node.elements;var self=this;var len=elems.length;this.push("[");_.each(elems,function(elem,i){if(!elem){self.push(",")}else{if(i>0)self.push(" ");print(elem);if(i<len-1)self.push(",")}});this.push("]")};exports.Literal=function(node){var val=node.value;var type=typeof val;if(type==="boolean"||type==="number"||type==="string"){this.push(JSON.stringify(val))}else if(node.regex){this.push("/"+node.regex.pattern+"/"+node.regex.flags)}else if(val===null){this.push("null")}else if(node.raw){this.push(node.raw)}}},{lodash:91}],16:[function(require,module,exports){module.exports=Node;var whitespace=require("./whitespace");var parens=require("./parentheses");var t=require("../../types");var _=require("lodash");var find=function(obj,node,parent){var result;_.each(obj,function(fn,type){if(t["is"+type](node)){result=fn(node,parent);if(result!=null)return false}});return result};function Node(node,parent){this.parent=parent;this.node=node}Node.prototype.isUserWhitespacable=function(){var node=this.node;if(t.isUserWhitespacable(node)){return true}return false};Node.prototype.needsWhitespace=function(type){var parent=this.parent;var node=this.node;if(!node)return 0;if(t.isExpressionStatement(node)){node=node.expression}var lines=find(whitespace[type].nodes,node,parent);if(lines)return lines;_.each(find(whitespace[type].list,node,parent),function(expr){lines=Node.needsWhitespace(expr,node,type);if(lines)return false});return lines||0};Node.prototype.needsWhitespaceBefore=function(){return this.needsWhitespace("before")};Node.prototype.needsWhitespaceAfter=function(){return this.needsWhitespace("after")};Node.prototype.needsParens=function(){var parent=this.parent;var node=this.node;if(!parent)return false;if(t.isNewExpression(parent)&&parent.callee===node){return t.isCallExpression(node)||_.some(node,function(val){return t.isCallExpression(val)})}return find(parens,node,parent)};_.each(Node.prototype,function(fn,key){Node[key]=function(node,parent){var n=new Node(node,parent);var args=_.toArray(arguments).slice(2);return n[key].apply(n,args)}})},{"../../types":58,"./parentheses":17,"./whitespace":18,lodash:91}],17:[function(require,module,exports){var t=require("../../types");var _=require("lodash");var PRECEDENCE={};_.each([["||"],["&&"],["|"],["^"],["&"],["==","===","!=","!=="],["<",">","<=",">=","in","instanceof"],[">>","<<",">>>"],["+","-"],["*","/","%"]],function(tier,i){_.each(tier,function(op){PRECEDENCE[op]=i})});exports.Binary=function(node,parent){if(t.isCallExpression(parent)&&parent.callee===node){return true}if(t.isUnaryLike(parent)){return true}if(t.isMemberExpression(parent)&&parent.object===node){return true}if(t.isBinary(parent)){var parentOp=parent.operator;var parentPos=PRECEDENCE[parentOp];var nodeOp=node.operator;var nodePos=PRECEDENCE[nodeOp];if(parentPos>nodePos){return true}if(parentPos===nodePos&&parent.right===node){return true}}};exports.BinaryExpression=function(node,parent){if(node.operator==="in"){if(t.isVariableDeclarator(parent)){return true}if(t.isFor(parent)){return true}}};exports.SequenceExpression=function(node,parent){if(t.isForStatement(parent)){return false}if(t.isExpressionStatement(parent)&&parent.expression===node){return false}return true};exports.YieldExpression=function(node,parent){return t.isBinary(parent)||t.isUnaryLike(parent)||t.isCallExpression(parent)||t.isMemberExpression(parent)||t.isNewExpression(parent)||t.isConditionalExpression(parent)||t.isYieldExpression(parent)};exports.Literal=function(node,parent){if(_.isNumber(node.value)&&t.isMemberExpression(parent)&&parent.object===node){return true}};exports.ClassExpression=function(node,parent){return t.isExpressionStatement(parent)};exports.UnaryLike=function(node,parent){return t.isMemberExpression(parent)&&parent.object===node};exports.FunctionExpression=function(node,parent){if(t.isExpressionStatement(parent)){return true}if(t.isMemberExpression(parent)&&parent.object===node){return true}if(t.isCallExpression(parent)&&parent.callee===node){return true}};exports.AssignmentExpression=exports.ConditionalExpression=function(node,parent){if(t.isUnaryLike(parent)){return true}if(t.isBinary(parent)){return true}if(t.isCallExpression(parent)&&parent.callee===node){return true}if(t.isConditionalExpression(parent)&&parent.test===node){return true}if(t.isMemberExpression(parent)&&parent.object===node){return true}return false}},{"../../types":58,lodash:91}],18:[function(require,module,exports){var _=require("lodash");var t=require("../../types");exports.before={nodes:{Property:function(node,parent){if(parent.properties[0]===node){return 1}},SwitchCase:function(node,parent){if(parent.cases[0]===node){return 1}},CallExpression:function(node){if(t.isFunction(node.callee)){return 1}}}};exports.after={nodes:{},list:{VariableDeclaration:function(node){return _.map(node.declarations,"init")},ArrayExpression:function(node){return node.elements},ObjectExpression:function(node){return node.properties}}};_.each({Function:1,Class:1,For:1,SwitchStatement:1,IfStatement:{before:1},CallExpression:{after:1},Literal:{after:1}},function(amounts,type){if(_.isNumber(amounts))amounts={after:amounts,before:amounts};_.each(amounts,function(amount,key){exports[key].nodes[type]=function(){return amount}})})},{"../../types":58,lodash:91}],19:[function(require,module,exports){module.exports=Position;var _=require("lodash");function Position(){this.line=1;this.column=0}Position.prototype.push=function(str){var self=this;_.each(str,function(cha){if(cha==="\n"){self.line++;self.column=0}else{self.column++}})};Position.prototype.unshift=function(str){var self=this;_.each(str,function(cha){if(cha==="\n"){self.line--}else{self.column--}})}},{lodash:91}],20:[function(require,module,exports){module.exports=SourceMap;var sourceMap=require("source-map");var t=require("../types");function SourceMap(position,opts,code){this.position=position;this.opts=opts;if(opts.sourceMap){this.map=new sourceMap.SourceMapGenerator({file:opts.sourceMapName});this.map.setSourceContent(opts.sourceFileName,code)}else{this.map=null}}SourceMap.prototype.get=function(){var map=this.map;if(map){return map.toJSON()}else{return map}};SourceMap.prototype.mark=function(node,type){var loc=node.loc;if(!loc)return;var map=this.map;if(!map)return;if(t.isProgram(node)||t.isFile(node))return;var position=this.position;var generated={line:position.line,column:position.column};var original=loc[type];if(generated.line===original.line&&generated.column===original.column)return;map.addMapping({source:this.opts.sourceFileName,generated:generated,original:original})}},{"../types":58,"source-map":113}],21:[function(require,module,exports){module.exports=Whitespace;var _=require("lodash");function Whitespace(tokens,comments){this.tokens=_.sortBy(tokens.concat(comments),"start");this.used=[]}Whitespace.prototype.getNewlinesBefore=function(node){var startToken;var endToken;var tokens=this.tokens;_.each(tokens,function(token,i){if(node.start===token.start){startToken=tokens[i-1];endToken=token;return false}});return this.getNewlinesBetween(startToken,endToken)};Whitespace.prototype.getNewlinesAfter=function(node){var startToken;var endToken;var tokens=this.tokens;_.each(tokens,function(token,i){if(node.end===token.end){startToken=token;endToken=tokens[i+1];return false}});return this.getNewlinesBetween(startToken,endToken)};Whitespace.prototype.getNewlinesBetween=function(startToken,endToken){var start=startToken?startToken.loc.end.line:1;var end=endToken.loc.start.line;var lines=0;for(var line=start;line<end;line++){if(!_.contains(this.used,line)){this.used.push(line);lines++}}return lines}},{lodash:91}],22:[function(require,module,exports){var t=require("./types");var _=require("lodash");var types=require("ast-types");var def=types.Type.def;def("File").bases("Node").build("program").field("program",def("Program"));def("ParenthesizedExpression").bases("Expression").build("expression").field("expression",def("Expression"));def("ImportBatchSpecifier").bases("Specifier").build("name").field("name",def("Identifier"));types.finalize();var estraverse=require("estraverse");_.extend(estraverse.VisitorKeys,t.VISITOR_KEYS)},{"./types":58,"ast-types":74,estraverse:86,lodash:91}],23:[function(require,module,exports){module.exports=AMDFormatter;var CommonJSFormatter=require("./common");var util=require("../../util");var t=require("../../types");var _=require("lodash");function AMDFormatter(file){this.file=file;this.ids={}}util.inherits(AMDFormatter,CommonJSFormatter);AMDFormatter.prototype.transform=function(ast){var program=ast.program;var body=program.body;var names=[t.literal("exports")];_.each(this.ids,function(id,name){names.push(t.literal(name))});names=t.arrayExpression(names);var params=_.values(this.ids);params.unshift(t.identifier("exports"));var container=t.functionExpression(null,params,t.blockStatement(body));var call=t.callExpression(t.identifier("define"),[names,container]);program.body=[t.expressionStatement(call)]};AMDFormatter.prototype._push=function(node){var id=node.source.value;var ids=this.ids;if(ids[id]){return ids[id]}else{return this.ids[id]=t.identifier(this.file.generateUid(id))}};AMDFormatter.prototype.import=function(node){this._push(node)};AMDFormatter.prototype.importSpecifier=function(specifier,node,nodes){var key=t.getSpecifierName(specifier);var id=specifier.id;if(specifier.default){id=t.identifier("default")}var ref;if(t.isImportBatchSpecifier(specifier)){ref=this._push(node)}else{ref=t.memberExpression(this._push(node),id,false)}nodes.push(t.variableDeclaration("var",[t.variableDeclarator(key,ref)]))};AMDFormatter.prototype.exportSpecifier=function(specifier,node,nodes){var self=this;return this._exportSpecifier(function(){return self._push(node)},specifier,node,nodes)}},{"../../types":58,"../../util":60,"./common":24,lodash:91}],24:[function(require,module,exports){module.exports=CommonJSFormatter;var util=require("../../util");var t=require("../../types");function CommonJSFormatter(file){this.file=file}CommonJSFormatter.prototype.import=function(node,nodes){nodes.push(util.template("require",{MODULE_NAME:node.source.raw},true))};CommonJSFormatter.prototype.importSpecifier=function(specifier,node,nodes){var variableName=t.getSpecifierName(specifier);if(specifier.default){specifier.id=t.identifier("default")}var templateName="require-assign";
if(specifier.type!=="ImportBatchSpecifier")templateName+="-key";nodes.push(util.template(templateName,{VARIABLE_NAME:variableName,MODULE_NAME:node.source.raw,KEY:specifier.id}))};CommonJSFormatter.prototype.export=function(node,nodes){var declar=node.declaration;if(node.default){var ref=declar;if(t.isClass(ref)||t.isFunction(ref)){if(ref.id){nodes.push(t.toStatement(ref));ref=ref.id}}nodes.push(util.template("exports-default",{VALUE:ref},true))}else{var assign;if(t.isVariableDeclaration(declar)){var decl=declar.declarations[0];if(decl.init){decl.init=util.template("exports-assign",{VALUE:decl.init,KEY:decl.id})}nodes.push(declar)}else{assign=util.template("exports-assign",{VALUE:declar.id,KEY:declar.id},true);nodes.push(t.toStatement(declar));nodes.push(assign);if(t.isFunctionDeclaration(declar)){assign._blockHoist=true}}}};CommonJSFormatter.prototype._exportSpecifier=function(getRef,specifier,node,nodes){var variableName=t.getSpecifierName(specifier);var inherits=false;if(node.specifiers.length===1)inherits=node;if(node.source){if(t.isExportBatchSpecifier(specifier)){nodes.push(util.template("exports-wildcard",{OBJECT:getRef()},true))}else{nodes.push(util.template("exports-assign-key",{VARIABLE_NAME:variableName.name,OBJECT:getRef(),KEY:specifier.id},true))}}else{nodes.push(util.template("exports-assign",{VALUE:specifier.id,KEY:variableName},true))}};CommonJSFormatter.prototype.exportSpecifier=function(specifier,node,nodes){return this._exportSpecifier(function(){return t.callExpression(t.identifier("require"),[node.source])},specifier,node,nodes)}},{"../../types":58,"../../util":60}],25:[function(require,module,exports){module.exports=IgnoreFormatter;var t=require("../../types");function IgnoreFormatter(){}IgnoreFormatter.prototype.import=function(){};IgnoreFormatter.prototype.importSpecifier=function(){};IgnoreFormatter.prototype.export=function(node,nodes){var declar=t.toStatement(node.declaration,true);if(declar)nodes.push(t.inherits(declar,node))};IgnoreFormatter.prototype.exportSpecifier=function(){}},{"../../types":58}],26:[function(require,module,exports){module.exports=UMDFormatter;var AMDFormatter=require("./amd");var util=require("../../util");var t=require("../../types");var _=require("lodash");function UMDFormatter(file){this.file=file;this.ids={}}util.inherits(UMDFormatter,AMDFormatter);UMDFormatter.prototype.transform=function(ast){var program=ast.program;var body=program.body;var names=[];_.each(this.ids,function(id,name){names.push(t.literal(name))});var ids=_.values(this.ids);var args=[t.identifier("exports")].concat(ids);var factory=t.functionExpression(null,args,t.blockStatement(body));var runner=util.template("umd-runner-body",{AMD_ARGUMENTS:t.arrayExpression([t.literal("exports")].concat(names)),COMMON_ARGUMENTS:names.map(function(name){return t.callExpression(t.identifier("require"),[name])})});var call=t.callExpression(runner,[factory]);program.body=[t.expressionStatement(call)]}},{"../../types":58,"../../util":60,"./amd":23,lodash:91}],27:[function(require,module,exports){module.exports=transform;var Transformer=require("./transformer");var File=require("../file");var _=require("lodash");function transform(code,opts){var file=new File(opts);return file.parse(code)}transform._ensureTransformerNames=function(type,keys){_.each(keys,function(key){if(!_.has(transform.transformers,key)){throw new ReferenceError("unknown transformer "+key+" specified in "+type)}})};transform.transformers={};transform.moduleFormatters={common:require("./modules/common"),ignore:require("./modules/ignore"),amd:require("./modules/amd"),umd:require("./modules/umd")};_.each({modules:require("./transformers/modules"),propertyNameShorthand:require("./transformers/property-name-shorthand"),constants:require("./transformers/constants"),arrayComprehension:require("./transformers/array-comprehension"),generatorComprehension:require("./transformers/generator-comprehension"),arrowFunctions:require("./transformers/arrow-functions"),classes:require("./transformers/classes"),_propertyLiterals:require("./transformers/_property-literals"),computedPropertyNames:require("./transformers/computed-property-names"),spread:require("./transformers/spread"),templateLiterals:require("./transformers/template-literals"),propertyMethodAssignment:require("./transformers/property-method-assignment"),defaultParameters:require("./transformers/default-parameters"),restParameters:require("./transformers/rest-parameters"),destructuring:require("./transformers/destructuring"),letScoping:require("./transformers/let-scoping"),forOf:require("./transformers/for-of"),unicodeRegex:require("./transformers/unicode-regex"),react:require("./transformers/react"),_aliasFunctions:require("./transformers/_alias-functions"),_blockHoist:require("./transformers/_block-hoist"),_declarations:require("./transformers/_declarations"),generators:require("./transformers/generators"),useStrict:require("./transformers/use-strict"),_moduleFormatter:require("./transformers/_module-formatter")},function(transformer,key){transform.transformers[key]=new Transformer(key,transformer)})},{"../file":3,"./modules/amd":23,"./modules/common":24,"./modules/ignore":25,"./modules/umd":26,"./transformer":28,"./transformers/_alias-functions":29,"./transformers/_block-hoist":30,"./transformers/_declarations":31,"./transformers/_module-formatter":32,"./transformers/_property-literals":33,"./transformers/array-comprehension":34,"./transformers/arrow-functions":35,"./transformers/classes":36,"./transformers/computed-property-names":37,"./transformers/constants":38,"./transformers/default-parameters":39,"./transformers/destructuring":40,"./transformers/for-of":41,"./transformers/generator-comprehension":42,"./transformers/generators":43,"./transformers/let-scoping":44,"./transformers/modules":45,"./transformers/property-method-assignment":46,"./transformers/property-name-shorthand":47,"./transformers/react":48,"./transformers/rest-parameters":49,"./transformers/spread":50,"./transformers/template-literals":51,"./transformers/unicode-regex":52,"./transformers/use-strict":53,lodash:91}],28:[function(require,module,exports){module.exports=Transformer;var traverse=require("../traverse");var t=require("../types");var _=require("lodash");function Transformer(key,transformer){this.transformer=Transformer.normalise(transformer);this.key=key}Transformer.normalise=function(transformer){if(_.isFunction(transformer)){transformer={ast:transformer}}_.each(transformer,function(fns,type){if(type[0]==="_")return;if(_.isFunction(fns))fns={enter:fns};transformer[type]=fns});return transformer};Transformer.prototype.transform=function(file){if(!this.canRun(file))return;var transformer=this.transformer;var ast=file.ast;var astRun=function(key){if(transformer.ast&&transformer.ast[key]){transformer.ast[key](ast,file)}};astRun("enter");var build=function(exit){return function(node,parent,scope){var types=[node.type].concat(t.ALIAS_KEYS[node.type]||[]);var fns=transformer.all;_.each(types,function(type){fns=transformer[type]||fns});if(!fns)return;var fn=fns.enter;if(exit)fn=fns.exit;if(!fn)return;return fn(node,parent,file,scope)}};traverse(ast,{enter:build(),exit:build(true)});astRun("exit")};Transformer.prototype.canRun=function(file){var opts=file.opts;var key=this.key;var blacklist=opts.blacklist;if(blacklist.length&&_.contains(blacklist,key))return false;if(key[0]!=="_"){var whitelist=opts.whitelist;if(whitelist.length&&!_.contains(whitelist,key))return false}return true}},{"../traverse":54,"../types":58,lodash:91}],29:[function(require,module,exports){var traverse=require("../../traverse");var t=require("../../types");var go=function(getBody,node,file,scope){var argumentsId;var thisId;var getArgumentsId=function(){return argumentsId=argumentsId||t.identifier(file.generateUid("arguments",scope))};var getThisId=function(){return thisId=thisId||t.identifier(file.generateUid("this",scope))};traverse(node,function(node){if(!node._aliasFunction){if(t.isFunction(node)){return false}else{return}}traverse(node,function(node,parent){if(t.isFunction(node)&&!node._aliasFunction){return false}if(node._ignoreAliasFunctions)return;var getId;if(t.isIdentifier(node)&&node.name==="arguments"){getId=getArgumentsId}else if(t.isThisExpression(node)){getId=getThisId}else{return}if(t.isReferenced(node,parent))return getId()});return false});var body;var pushDeclaration=function(id,init){body=body||getBody();body.unshift(t.variableDeclaration("var",[t.variableDeclarator(id,init)]))};if(argumentsId){pushDeclaration(argumentsId,t.identifier("arguments"))}if(thisId){pushDeclaration(thisId,t.identifier("this"))}};exports.Program=function(node,parent,file,scope){go(function(){return node.body},node,file,scope)};exports.FunctionDeclaration=exports.FunctionExpression=function(node,parent,file,scope){go(function(){t.ensureBlock(node);return node.body.body},node,file,scope)}},{"../../traverse":54,"../../types":58}],30:[function(require,module,exports){exports.BlockStatement=exports.Program={exit:function(node){var unshift=[];node.body=node.body.filter(function(bodyNode){if(bodyNode._blockHoist){unshift.push(bodyNode);return false}else{return true}});node.body=unshift.concat(node.body)}}},{}],31:[function(require,module,exports){var t=require("../../types");var _=require("lodash");module.exports=function(ast,file){var body=ast.program.body;_.each(file.declarations,function(declar){body.unshift(t.variableDeclaration("var",[t.variableDeclarator(declar.uid,declar.node)]))})}},{"../../types":58,lodash:91}],32:[function(require,module,exports){var transform=require("../transform");exports.ast={exit:function(ast,file){if(!transform.transformers.modules.canRun(file))return;if(file.moduleFormatter.transform){file.moduleFormatter.transform(ast)}}}},{"../transform":27}],33:[function(require,module,exports){var esutils=require("esutils");var t=require("../../types");var _=require("lodash");exports.Property=function(node){var key=node.key;if(t.isLiteral(key)&&_.isString(key.value)&&esutils.keyword.isIdentifierName(key.value)){key.type="Identifier";key.name=key.value;delete key.value;node.computed=false}}},{"../../types":58,esutils:90,lodash:91}],34:[function(require,module,exports){var util=require("../../util");var t=require("../../types");var _=require("lodash");var singleArrayExpression=function(node){var block=node.blocks[0];var templateName="array-expression-comprehension-map";if(node.filter)templateName="array-expression-comprehension-filter";var result=util.template(templateName,{STATEMENT:node.body,FILTER:node.filter,ARRAY:block.right,KEY:block.left});_.each([result.callee.object,result],function(call){if(t.isCallExpression(call)){call.arguments[0]._aliasFunction=true}});return result};var multiple=function(node,file){var uid=file.generateUid("arr");var container=util.template("array-comprehension-container",{KEY:uid});container.callee.expression._aliasFunction=true;var block=container.callee.expression.body;var body=block.body;var returnStatement=body.pop();body.push(exports._build(node,function(){return util.template("array-push",{STATEMENT:node.body,KEY:uid},true)}));body.push(returnStatement);return container};exports._build=function(node,buildBody){var self=node.blocks.shift();if(!self)return;var child=exports._build(node,buildBody);if(!child){child=buildBody();if(node.filter){child=t.ifStatement(node.filter,t.blockStatement([child]))}}return t.forOfStatement(t.variableDeclaration("var",[t.variableDeclarator(self.left)]),self.right,t.blockStatement([child]))};exports.ComprehensionExpression=function(node,parent,file){if(node.generator)return;if(node.blocks.length===1&&t.isArrayExpression(node.blocks[0].right)){return singleArrayExpression(node)}else{return multiple(node,file)}}},{"../../types":58,"../../util":60,lodash:91}],35:[function(require,module,exports){var t=require("../../types");exports.ArrowFunctionExpression=function(node){t.ensureBlock(node);node._aliasFunction=true;node.expression=false;node.type="FunctionExpression";return node}},{"../../types":58}],36:[function(require,module,exports){var traverse=require("../../traverse");var util=require("../../util");var t=require("../../types");var _=require("lodash");exports.ClassDeclaration=function(node,parent,file,scope){return t.variableDeclaration("var",[t.variableDeclarator(node.id,new Class(node,file,scope).run())])};exports.ClassExpression=function(node,parent,file,scope){return new Class(node,file,scope).run()};var getMemberExpressionObject=function(node){while(t.isMemberExpression(node)){node=node.object}return node};function Class(node,file,scope){this.scope=scope;this.node=node;this.file=file;this.instanceMutatorMap={};this.staticMutatorMap={};this.hasConstructor=false;this.className=node.id||t.identifier(file.generateUid("class",scope));this.superName=node.superClass}Class.prototype.run=function(){var superClassArgument=this.superName;var superClassCallee=this.superName;var superName=this.superName;var className=this.className;var file=this.file;if(superName){if(t.isMemberExpression(superName)){superClassArgument=superClassCallee=getMemberExpressionObject(superName)}else if(!t.isIdentifier(superName)){superClassArgument=superName;superClassCallee=superName=t.identifier(file.generateUid("ref",this.scope))}}this.superName=superName;var container=util.template("class",{CLASS_NAME:className});var block=container.callee.expression.body;var body=this.body=block.body;var constructor=this.constructor=body[0].declarations[0].init;if(this.node.id)constructor.id=className;var returnStatement=body.pop();if(superName){body.push(t.expressionStatement(t.callExpression(file.addDeclaration("extends"),[className,superName])));container.arguments.push(superClassArgument);container.callee.expression.params.push(superClassCallee)}this.buildBody();if(body.length===1){return constructor}else{body.push(returnStatement);return container}};Class.prototype.buildBody=function(){var constructor=this.constructor;var className=this.className;var superName=this.superName;var classBody=this.node.body.body;var body=this.body;var self=this;_.each(classBody,function(node){self.replaceInstanceSuperReferences(node);if(node.key.name==="constructor"){self.pushConstructor(node)}else{self.pushMethod(node)}});if(!this.hasConstructor&&superName){constructor.body.body.push(util.template("class-super-constructor-call",{SUPER_NAME:superName},true))}var instanceProps;var staticProps;if(!_.isEmpty(this.instanceMutatorMap)){var protoId=util.template("prototype-identifier",{CLASS_NAME:className});instanceProps=util.buildDefineProperties(this.instanceMutatorMap,protoId)}if(!_.isEmpty(this.staticMutatorMap)){staticProps=util.buildDefineProperties(this.staticMutatorMap,className)}if(instanceProps||staticProps){staticProps=staticProps||t.literal(null);var args=[className,staticProps];if(instanceProps)args.push(instanceProps);body.push(t.expressionStatement(t.callExpression(this.file.addDeclaration("class-props"),args)))}};Class.prototype.pushMethod=function(node){var methodName=node.key;var mutatorMap=this.instanceMutatorMap;if(node.static)mutatorMap=this.staticMutatorMap;var kind=node.kind;if(kind===""){kind="value";util.pushMutatorMap(mutatorMap,methodName,"writable",t.identifier("true"))}util.pushMutatorMap(mutatorMap,methodName,kind,node)};Class.prototype.superIdentifier=function(methodNode,id,parent){var methodName=methodNode.key;var superName=this.superName||t.identifier("Function");if(parent.property===id){return}else if(t.isCallExpression(parent,{callee:id})){parent.arguments.unshift(t.thisExpression());if(methodName.name==="constructor"){return t.memberExpression(superName,t.identifier("call"))}else{id=superName;if(!methodNode.static){id=t.memberExpression(id,t.identifier("prototype"))}id=t.memberExpression(id,methodName,methodNode.computed);return t.memberExpression(id,t.identifier("call"))}}else if(t.isMemberExpression(parent)&&!methodNode.static){return t.memberExpression(superName,t.identifier("prototype"))}else{return superName}};Class.prototype.replaceInstanceSuperReferences=function(methodNode){var method=methodNode.value;var self=this;traverse(method,function(node,parent){if(t.isIdentifier(node,{name:"super"})){return self.superIdentifier(methodNode,node,parent)}else if(t.isCallExpression(node)){var callee=node.callee;if(!t.isMemberExpression(callee))return;if(callee.object.name!=="super")return;callee.property=t.memberExpression(callee.property,t.identifier("call"));node.arguments.unshift(t.thisExpression())}})};Class.prototype.pushConstructor=function(method){if(method.kind!==""){throw this.file.errorWithNode(method,"illegal kind for constructor method")}var construct=this.constructor;var fn=method.value;this.hasConstructor=true;t.inherits(construct,fn);construct.defaults=fn.defaults;construct.params=fn.params;construct.body=fn.body;construct.rest=fn.rest}},{"../../traverse":54,"../../types":58,"../../util":60,lodash:91}],37:[function(require,module,exports){var util=require("../../util");var t=require("../../types");var _=require("lodash");exports.ObjectExpression=function(node,parent,file){var hasComputed=false;var computed=[];node.properties=node.properties.filter(function(prop){if(prop.computed){hasComputed=true;computed.unshift(prop);return false}else{return true}});if(!hasComputed)return;var objId=util.getUid(parent,file);var container=util.template("function-return-obj",{KEY:objId,OBJECT:node});var containerCallee=container.callee.expression;var containerBody=containerCallee.body.body;containerCallee._aliasFunction=true;_.each(computed,function(prop){containerBody.unshift(t.expressionStatement(t.assignmentExpression("=",t.memberExpression(objId,prop.key,true),prop.value)))});return container}},{"../../types":58,"../../util":60,lodash:91}],38:[function(require,module,exports){var traverse=require("../../traverse");var t=require("../../types");var _=require("lodash");exports.Program=exports.BlockStatement=exports.ForInStatement=exports.ForOfStatement=exports.ForStatement=function(node,parent,file){var constants=[];var check=function(node,names){_.each(names,function(name){if(constants.indexOf(name)>=0){throw file.errorWithNode(node,name+" is read-only")}})};var getIds=function(node){return t.getIds(node,false,["MemberExpression"])};_.each(node.body,function(child){if(child&&t.isVariableDeclaration(child,{kind:"const"})){_.each(child.declarations,function(declar){_.each(getIds(declar),function(name){check(declar,[name]);constants.push(name)});declar._ignoreConstant=true});child._ignoreConstant=true;child.kind="let"}});if(!constants.length)return;traverse(node,function(child){if(child._ignoreConstant)return;if(t.isVariableDeclarator(child)||t.isDeclaration(child)||t.isAssignmentExpression(child)){check(child,getIds(child))}})}},{"../../traverse":54,"../../types":58,lodash:91}],39:[function(require,module,exports){var util=require("../../util");var t=require("../../types");var _=require("lodash");exports.Function=function(node){if(!node.defaults||!node.defaults.length)return;t.ensureBlock(node);_.each(node.defaults,function(def,i){if(!def)return;var param=node.params[i];node.body.body.unshift(util.template("if-undefined-set-to",{VARIABLE:param,DEFAULT:def},true))});node.defaults=[]}},{"../../types":58,"../../util":60,lodash:91}],40:[function(require,module,exports){var t=require("../../types");var _=require("lodash");var buildVariableAssign=function(kind,id,init){if(kind===false){return t.expressionStatement(t.assignmentExpression("=",id,init))}else{return t.variableDeclaration(kind,[t.variableDeclarator(id,init)])}};var push=function(kind,nodes,elem,parentId){if(t.isObjectPattern(elem)){pushObjectPattern(kind,nodes,elem,parentId)}else if(t.isArrayPattern(elem)){pushArrayPattern(kind,nodes,elem,parentId)}else if(t.isMemberExpression(elem)){nodes.push(buildVariableAssign(false,elem,parentId))}else{nodes.push(buildVariableAssign(kind,elem,parentId))}};var pushObjectPattern=function(kind,nodes,pattern,parentId){_.each(pattern.properties,function(prop){var pattern2=prop.value;var patternId2=t.memberExpression(parentId,prop.key);if(t.isPattern(pattern2)){push(kind,nodes,pattern2,patternId2)}else{nodes.push(buildVariableAssign(kind,pattern2,patternId2))}})};var pushArrayPattern=function(kind,nodes,pattern,parentId){_.each(pattern.elements,function(elem,i){if(!elem)return;var newPatternId;if(t.isSpreadElement(elem)){newPatternId=t.callExpression(t.memberExpression(parentId,t.identifier("slice")),[t.literal(i)]);elem=elem.argument}else{newPatternId=t.memberExpression(parentId,t.literal(i),true)}push(kind,nodes,elem,newPatternId)})};var pushPattern=function(opts){var kind=opts.kind;var nodes=opts.nodes;var pattern=opts.pattern;var parentId=opts.id;var file=opts.file;var scope=opts.scope;if(!t.isMemberExpression(parentId)&&!t.isIdentifier(parentId)){var key=t.identifier(file.generateUid("ref",scope));nodes.push(t.variableDeclaration("var",[t.variableDeclarator(key,parentId)]));parentId=key}push(kind,nodes,pattern,parentId)};exports.ForInStatement=exports.ForOfStatement=function(node,parent,file,scope){var declar=node.left;if(!t.isVariableDeclaration(declar))return;var pattern=declar.declarations[0].id;if(!t.isPattern(pattern))return;var key=t.identifier(file.generateUid("ref",scope));node.left=t.variableDeclaration(declar.kind,[t.variableDeclarator(key,null)]);var nodes=[];push(declar.kind,nodes,pattern,key);t.ensureBlock(node);var block=node.body;block.body=nodes.concat(block.body)};exports.Function=function(node,parent,file,scope){var nodes=[];var hasDestructuring=false;node.params=node.params.map(function(pattern){if(!t.isPattern(pattern))return pattern;hasDestructuring=true;var parentId=t.identifier(file.generateUid("ref",scope));pushPattern({kind:"var",nodes:nodes,pattern:pattern,id:parentId,file:file,scope:scope});return parentId});if(!hasDestructuring)return;t.ensureBlock(node);var block=node.body;block.body=nodes.concat(block.body)};exports.ExpressionStatement=function(node,parent,file,scope){var expr=node.expression;if(expr.type!=="AssignmentExpression")return;if(!t.isPattern(expr.left))return;var nodes=[];var ref=t.identifier(file.generateUid("ref",scope));nodes.push(t.variableDeclaration("var",[t.variableDeclarator(ref,expr.right)]));push(false,nodes,expr.left,ref);return nodes};exports.VariableDeclaration=function(node,parent,file,scope){if(t.isForInStatement(parent)||t.isForOfStatement(parent))return;var nodes=[];var hasPattern=false;_.each(node.declarations,function(declar){if(t.isPattern(declar.id)){hasPattern=true;return false}});if(!hasPattern)return;_.each(node.declarations,function(declar){var patternId=declar.init;var pattern=declar.id;if(t.isPattern(pattern)&&patternId){pushPattern({kind:node.kind,nodes:nodes,pattern:pattern,id:patternId,file:file,scope:scope})}else{nodes.push(buildVariableAssign(node.kind,declar.id,declar.init))}});if(!t.isProgram(parent)&&!t.isBlockStatement(parent)){var declar;_.each(nodes,function(node){declar=declar||t.variableDeclaration(node.kind,[]);if(!t.isVariableDeclaration(node)&&declar.kind!==node.kind){throw file.errorWithNode(node,"Cannot use this node within the current parent")}declar.declarations=declar.declarations.concat(node.declarations)});return declar}return nodes}},{"../../types":58,lodash:91}],41:[function(require,module,exports){var util=require("../../util");var t=require("../../types");exports.ForOfStatement=function(node,parent,file,scope){var left=node.left;var declar;var stepKey=t.identifier(file.generateUid("step",scope));var stepValueId=t.memberExpression(stepKey,t.identifier("value"));if(t.isIdentifier(left)){declar=t.expressionStatement(t.assignmentExpression("=",left,stepValueId))}else if(t.isVariableDeclaration(left)){declar=t.variableDeclaration(left.kind,[t.variableDeclarator(left.declarations[0].id,stepValueId)])}else{return}var node2=util.template("for-of",{ITERATOR_KEY:file.generateUid("iterator",scope),STEP_KEY:stepKey,OBJECT:node.right});t.ensureBlock(node);var block=node2.body;block.body.push(declar);block.body=block.body.concat(node.body.body);return node2}},{"../../types":58,"../../util":60}],42:[function(require,module,exports){var arrayComprehension=require("./array-comprehension");var t=require("../../types");exports.ComprehensionExpression=function(node){if(!node.generator)return;var body=[];var container=t.functionExpression(null,[],t.blockStatement(body),true);body.push(arrayComprehension._build(node,function(){return t.expressionStatement(t.yieldExpression(node.body))}));return t.callExpression(container,[])}},{"../../types":58,"./array-comprehension":34}],43:[function(require,module,exports){var regenerator=require("regenerator-6to5");module.exports=regenerator.transform},{"regenerator-6to5":98}],44:[function(require,module,exports){var traverse=require("../../traverse");var util=require("../../util");var t=require("../../types");var _=require("lodash");var isLet=function(node){if(!t.isVariableDeclaration(node))return false;if(node._let)return true;if(node.kind!=="let")return false;node._let=true;node.kind="var";return true};var isVar=function(node){return t.isVariableDeclaration(node,{kind:"var"})&&!isLet(node)};var standardiseLets=function(declars){_.each(declars,function(declar){delete declar._let})};exports.VariableDeclaration=function(node){isLet(node)};exports.For=function(node,parent,file,scope){var init=node.left||node.init;if(isLet(init)){t.ensureBlock(node);node.body._letDeclars=[init]}if(t.isLabeledStatement(parent)){node.label=parent.label}var letScoping=new LetScoping(node,node.body,parent,file,scope);letScoping.run();if(node.label&&!t.isLabeledStatement(parent)){return t.labeledStatement(node.label,node)}};exports.BlockStatement=function(block,parent,file,scope){if(!t.isFor(parent)){var letScoping=new LetScoping(false,block,parent,file,scope);letScoping.run()}};function LetScoping(forParent,block,parent,file,scope){this.forParent=forParent;this.parent=parent;this.scope=scope;this.block=block;this.file=file;this.letReferences={};this.body=[];this.info=this.getInfo()}LetScoping.prototype.run=function(){var block=this.block;if(block._letDone)return;block._letDone=true;if(t.isFunction(this.parent))return;if(!this.info.keys.length)return this.noClosure();var referencesInClosure=this.getLetReferences();if(!referencesInClosure)return this.noClosure();this.has=this.checkFor();this.hoistVarDeclarations();standardiseLets(this.info.declarators);var letReferences=_.values(this.letReferences);var fn=t.functionExpression(null,letReferences,t.blockStatement(block.body));fn._aliasFunction=true;block.body=this.body;var params=this.getParams(letReferences);var call=t.callExpression(fn,params);var ret=t.identifier(this.file.generateUid("ret",this.scope));this.build(ret,call)};LetScoping.prototype.noClosure=function(){var replacements=this.info.duplicates;var declarators=this.info.declarators;var block=this.block;standardiseLets(declarators);if(_.isEmpty(replacements))return;traverse(block,function(node,parent){if(!t.isIdentifier(node))return;if(!t.isReferenced(node,parent))return;node.name=replacements[node.name]||node.name})};LetScoping.prototype.getInfo=function(){var block=this.block;var scope=this.scope;var file=this.file;var opts={outsideKeys:[],declarators:block._letDeclars||[],duplicates:{},keys:[]};_.each(opts.declarators,function(declar){opts.declarators.push(declar);var keys=t.getIds(declar);opts.outsideKeys=opts.outsideKeys.concat(keys);opts.keys=opts.keys.concat(keys)});_.each(block.body,function(declar){if(!isLet(declar))return;_.each(t.getIds(declar,true),function(id,key){var has=scope.parentGet(key);if(has&&has!==id){opts.duplicates[key]=id.name=file.generateUid(key,scope)}opts.keys.push(key)})});return opts};LetScoping.prototype.checkFor=function(){var has={hasContinue:false,hasReturn:false,hasBreak:false};if(this.forParent){traverse(this.block,function(node){var replace;if(t.isFunction(node)||t.isFor(node)){return false}else if(t.isBreakStatement(node)&&!node.label){has.hasBreak=true;replace=t.returnStatement(t.literal("break"))}else if(t.isContinueStatement(node)&&!node.label){has.hasContinue=true;replace=t.returnStatement(t.literal("continue"))}else if(t.isReturnStatement(node)){has.hasReturn=true;replace=t.returnStatement(t.objectExpression([t.property("init",t.identifier("v"),node.argument||t.identifier("undefined"))]))}if(replace)return t.inherits(replace,node)})}return has};LetScoping.prototype.hoistVarDeclarations=function(){var self=this;traverse(this.block,function(node){if(t.isForStatement(node)){if(isVar(node.init)){node.init=t.sequenceExpression(self.pushDeclar(node.init))}}else if(t.isFor(node)){if(isVar(node.left)){node.left=node.left.declarations[0].id}}else if(isVar(node)){return self.pushDeclar(node).map(t.expressionStatement)}else if(t.isFunction(node)){return false}})};LetScoping.prototype.getParams=function(params){var info=this.info;params=_.cloneDeep(params);_.each(params,function(param){param.name=info.duplicates[param.name]||param.name});return params};LetScoping.prototype.getLetReferences=function(){var closurify=false;var self=this;traverse(this.block,function(node,parent,scope){if(t.isFunction(node)){traverse(node,function(node,parent){if(!t.isIdentifier(node))return;if(!t.isReferenced(node,parent))return;if(scope.hasOwn(node.name))return;closurify=true;if(!_.contains(self.info.outsideKeys,node.name))return;self.letReferences[node.name]=node});return false}else if(t.isFor(node)){return false}});return closurify};LetScoping.prototype.buildPushDeclar=function(node){this.body.push(t.variableDeclaration(node.kind,node.declarations.map(function(declar){return t.variableDeclarator(declar.id)})));var replace=[];_.each(node.declarations,function(declar){if(!declar.init)return;var expr=t.assignmentExpression("=",declar.id,declar.init);replace.push(t.inherits(expr,declar))});return replace};LetScoping.prototype.build=function(ret,call){var has=this.has;if(has.hasReturn||has.hasBreak||has.hasContinue){this.buildHas(ret,call)}else{this.body.push(t.expressionStatement(call))}};LetScoping.prototype.buildHas=function(ret,call){var body=this.body;body.push(t.variableDeclaration("var",[t.variableDeclarator(ret,call)]));var forParent=this.forParent;var retCheck;var has=this.has;var cases=[];if(has.hasReturn){retCheck=util.template("let-scoping-return",{RETURN:ret})}if(has.hasBreak||has.hasContinue){var label=forParent.label=forParent.label||t.identifier(this.file.generateUid("loop",this.scope));if(has.hasBreak){cases.push(t.switchCase(t.literal("break"),[t.breakStatement(label)]))}if(has.hasContinue){cases.push(t.switchCase(t.literal("continue"),[t.continueStatement(label)]))}if(has.hasReturn){cases.push(t.switchCase(null,[retCheck]))}if(cases.length===1){var single=cases[0];body.push(t.ifStatement(t.binaryExpression("===",ret,single.test),single.consequent[0]))}else{body.push(t.switchStatement(ret,cases))}}else{if(has.hasReturn)body.push(retCheck)}}},{"../../traverse":54,"../../types":58,"../../util":60,lodash:91}],45:[function(require,module,exports){var _=require("lodash");exports.ImportDeclaration=function(node,parent,file){var nodes=[];if(node.specifiers.length){_.each(node.specifiers,function(specifier){file.moduleFormatter.importSpecifier(specifier,node,nodes)})}else{file.moduleFormatter.import(node,nodes)}return nodes};exports.ExportDeclaration=function(node,parent,file){var nodes=[];if(node.declaration){file.moduleFormatter.export(node,nodes)}else{_.each(node.specifiers,function(specifier){file.moduleFormatter.exportSpecifier(specifier,node,nodes)})}return nodes}},{lodash:91}],46:[function(require,module,exports){var util=require("../../util");var _=require("lodash");exports.Property=function(node){if(node.method)node.method=false};exports.ObjectExpression=function(node,parent,file){var mutatorMap={};node.properties=node.properties.filter(function(prop){if(prop.kind==="get"||prop.kind==="set"){util.pushMutatorMap(mutatorMap,prop.key,prop.kind,prop.value);return false}else{return true
}});if(_.isEmpty(mutatorMap))return;var objId=util.getUid(parent,file);return util.template("object-define-properties-closure",{KEY:objId,OBJECT:node,CONTENT:util.template("object-define-properties",{OBJECT:objId,PROPS:util.buildDefineProperties(mutatorMap)})})}},{"../../util":60,lodash:91}],47:[function(require,module,exports){exports.Property=function(node){if(node.shorthand)node.shorthand=false}},{}],48:[function(require,module,exports){var esutils=require("esutils");var t=require("../../types");var _=require("lodash");exports.XJSIdentifier=function(node){if(esutils.keyword.isIdentifierName(node.name)){node.type="Identifier"}else{return t.literal(node.name)}};exports.XJSNamespacedName=function(node,parent,file){throw file.errorWithNode(node,"Namespace tags are not supported. ReactJSX is not XML.")};exports.XJSMemberExpression={exit:function(node){node.computed=t.isLiteral(node.property);node.type="MemberExpression"}};exports.XJSExpressionContainer=function(node){return node.expression};exports.XJSAttribute={exit:function(node){var value=node.value||t.literal(true);return t.property("init",node.name,value)}};exports.XJSOpeningElement={exit:function(node){var tagExpr=node.name;var args=[];var tagName;if(t.isIdentifier(tagExpr)){tagName=tagExpr.name}else if(t.isLiteral(tagExpr)){tagName=tagExpr.value}if(tagName&&(/[a-z]/.exec(tagName[0])||_.contains(tagName,"-"))){args.push(t.literal(tagName))}else{args.push(tagExpr)}var props=node.attributes;if(props.length){var _props=[];var objs=[];var pushProps=function(){if(!_props.length)return;objs.push(t.objectExpression(_props));_props=[]};while(props.length){var prop=props.shift();if(t.isXJSSpreadAttribute(prop)){pushProps();objs.push(prop.argument)}else{_props.push(prop)}}pushProps();if(objs.length===1){props=objs[0]}else{if(!t.isObjectExpression(objs[0])){objs.unshift(t.objectExpression([]))}props=t.callExpression(t.memberExpression(t.identifier("React"),t.identifier("__spread")),objs)}}else{props=t.literal(null)}args.push(props);tagExpr=t.memberExpression(t.identifier("React"),t.identifier("createElement"));return t.callExpression(tagExpr,args)}};exports.XJSElement={exit:function(node){var callExpr=node.openingElement;var childrenToRender=node.children.filter(function(child){return!(t.isLiteral(child)&&_.isString(child.value)&&child.value.match(/^[ \t]*[\r\n][ \t\r\n]*$/))});_.each(childrenToRender,function(child){callExpr.arguments.push(child)});return t.inherits(callExpr,node)}};var addDisplayName=function(id,call){if(!call||!t.isCallExpression(call))return;var callee=call.callee;if(!t.isMemberExpression(callee))return;var obj=callee.object;if(!t.isIdentifier(obj,{name:"React"}))return;var prop=callee.property;if(!t.isIdentifier(prop,{name:"createClass"}))return;var args=call.arguments;if(args.length!==1)return;var first=args[0];if(!t.isObjectExpression(first))return;var props=first.properties;var safe=true;_.each(props,function(prop){if(t.isIdentifier(prop.key,{name:"displayName"})){return safe=false}});if(safe){props.unshift(t.property("init",t.identifier("displayName"),t.literal(id)))}};exports.AssignmentExpression=exports.Property=exports.VariableDeclarator=function(node){var left,right;if(t.isAssignmentExpression(node)){left=node.left;right=node.right}else if(t.isProperty(node)){left=node.key;right=node.value}else if(t.isVariableDeclarator(node)){left=node.id;right=node.init}if(t.isMemberExpression(left)){left=left.property}if(t.isIdentifier(left)){addDisplayName(left.name,right)}}},{"../../types":58,esutils:90,lodash:91}],49:[function(require,module,exports){var util=require("../../util");var t=require("../../types");exports.Function=function(node,parent,file){if(!node.rest)return;var rest=node.rest;delete node.rest;var templateName="arguments-slice-assign";if(node.params.length)templateName+="-arg";t.ensureBlock(node);var template=util.template(templateName,{SLICE_KEY:file.addDeclaration("slice"),VARIABLE_NAME:rest,SLICE_ARG:t.literal(node.params.length)});template.declarations[0].init.arguments[0]._ignoreAliasFunctions=true;node.body.body.unshift(template)}},{"../../types":58,"../../util":60}],50:[function(require,module,exports){var t=require("../../types");var _=require("lodash");var getSpreadLiteral=function(spread){var literal=spread.argument;if(!t.isArrayExpression(literal)){literal=t.callExpression(t.memberExpression(t.identifier("Array"),t.identifier("from")),[literal])}return literal};var hasSpread=function(nodes){var has=false;_.each(nodes,function(node){if(t.isSpreadElement(node)){has=true;return false}});return has};var build=function(props){var nodes=[];var _props=[];var push=function(){if(!_props.length)return;nodes.push(t.arrayExpression(_props));_props=[]};_.each(props,function(prop){if(t.isSpreadElement(prop)){push();nodes.push(getSpreadLiteral(prop))}else{_props.push(prop)}});push();return nodes};exports.ArrayExpression=function(node){var elements=node.elements;if(!hasSpread(elements))return;var nodes=build(elements);var first=nodes.shift();if(!nodes.length)return first;return t.callExpression(t.memberExpression(first,t.identifier("concat")),nodes)};exports.CallExpression=function(node){var args=node.arguments;if(!hasSpread(args))return;var contextLiteral=t.literal(null);node.arguments=[];var nodes=build(args);var first=nodes.shift();if(nodes.length){node.arguments.push(t.callExpression(t.memberExpression(first,t.identifier("concat")),nodes))}else{node.arguments.push(first)}var callee=node.callee;if(t.isMemberExpression(callee)){contextLiteral=callee.object;if(callee.computed){callee.object=t.memberExpression(callee.object,callee.property,true);callee.property=t.identifier("apply");callee.computed=false}else{callee.property=t.memberExpression(callee.property,t.identifier("apply"))}}else{node.callee=t.memberExpression(node.callee,t.identifier("apply"))}node.arguments.unshift(contextLiteral)};exports.NewExpression=function(node,parent,file){var args=node.arguments;if(!hasSpread(args))return;var nodes=build(args);var first=nodes.shift();if(nodes.length){args=t.callExpression(t.memberExpression(first,t.identifier("concat")),nodes)}else{args=first}return t.callExpression(file.addDeclaration("apply-constructor"),[node.callee,args])}},{"../../types":58,lodash:91}],51:[function(require,module,exports){var t=require("../../types");var _=require("lodash");var buildBinaryExpression=function(left,right){return t.binaryExpression("+",left,right)};exports.TaggedTemplateExpression=function(node){var args=[];var quasi=node.quasi;var strings=quasi.quasis.map(function(elem){return t.literal(elem.value.raw)});args.push(t.arrayExpression(strings));_.each(quasi.expressions,function(expr){args.push(expr)});return t.callExpression(node.tag,args)};exports.TemplateLiteral=function(node){var nodes=[];_.each(node.quasis,function(elem){nodes.push(t.literal(elem.value.raw));var expr=node.expressions.shift();if(expr){if(t.isBinary(expr))expr=t.parenthesizedExpression(expr);nodes.push(expr)}});if(nodes.length>1){var last=_.last(nodes);if(t.isLiteral(last,{value:""}))nodes.pop();var root=buildBinaryExpression(nodes.shift(),nodes.shift());_.each(nodes,function(node){root=buildBinaryExpression(root,node)});return root}else{return nodes[0]}}},{"../../types":58,lodash:91}],52:[function(require,module,exports){var rewritePattern=require("regexpu/rewrite-pattern");var _=require("lodash");exports.Literal=function(node){var regex=node.regex;if(!regex)return;var flags=regex.flags.split("");if(!_.contains(regex.flags,"u"))return;_.pull(flags,"u");regex.pattern=rewritePattern(regex.pattern,regex.flags);regex.flags=flags.join("")}},{lodash:91,"regexpu/rewrite-pattern":112}],53:[function(require,module,exports){var t=require("../../types");module.exports=function(ast){var body=ast.program.body;var first=body[0];var noStrict=!first||!t.isExpressionStatement(first)||!t.isLiteral(first.expression)||first.expression.value!=="use strict";if(noStrict){body.unshift(t.expressionStatement(t.literal("use strict")))}}},{"../../types":58}],54:[function(require,module,exports){module.exports=traverse;var Scope=require("./scope");var t=require("../types");var _=require("lodash");function traverse(parent,callbacks,opts){if(!parent)return;if(_.isArray(parent)){_.each(parent,function(node){traverse(node,callbacks,opts)});return}var keys=t.VISITOR_KEYS[parent.type];if(!keys)return;opts=opts||{};if(_.isArray(opts))opts={blacklist:opts};var blacklistTypes=opts.blacklist||[];if(_.isFunction(callbacks))callbacks={enter:callbacks};_.each(keys,function(key){var nodes=parent[key];if(!nodes)return;var handle=function(obj,key){var node=obj[key];if(!node)return;if(_.contains(blacklistTypes,node.type))return;var maybeReplace=function(result){if(result===false)return;if(result!=null)node=obj[key]=result};var opts2=_.clone(opts);if(t.isScope(node))opts2.scope=new Scope(opts.scope,node);if(callbacks.enter){var result=callbacks.enter(node,parent,opts2.scope);maybeReplace(result);if(result===false)return}traverse(node,callbacks,opts2);if(callbacks.exit){maybeReplace(callbacks.exit(node,parent,opts2.scope))}};if(_.isArray(nodes)){_.each(nodes,function(node,i){handle(nodes,i)});parent[key]=_.flatten(parent[key])}else{handle(parent,key)}})}traverse.removeProperties=function(tree){var clear=function(node){delete node.extendedRange;delete node._scopeIds;delete node._parent;delete node.tokens;delete node.range;delete node.start;delete node.end;delete node.loc;delete node.raw;clearComments(node.trailingComments);clearComments(node.leadingComments)};var clearComments=function(comments){_.each(comments,clear)};clear(tree);traverse(tree,clear);return tree};traverse.hasType=function(tree,type,blacklistTypes){blacklistTypes=[].concat(blacklistTypes||[]);var has=false;if(_.contains(blacklistTypes,tree.type))return false;if(tree.type===type)return true;traverse(tree,function(node){if(node.type===type){has=true;return false}},{blacklist:blacklistTypes});return has}},{"../types":58,"./scope":55,lodash:91}],55:[function(require,module,exports){module.exports=Scope;var traverse=require("./index");var t=require("../types");var _=require("lodash");function Scope(parent,block){this.parent=parent;this.block=block;this.ids=this.getIds();this.getIds()}Scope.prototype.getIds=function(){var block=this.block;if(block._scopeIds)return block._scopeIds;var self=this;var ids=block._scopeIds={};if(t.isBlockStatement(block)){_.each(block.body,function(node){if(t.isVariableDeclaration(node)&&node.kind!=="var"){self.add(node,ids)}})}else if(t.isProgram(block)||t.isFunction(block)){traverse(block,function(node,parent){if(parent!==block&&t.isVariableDeclaration(node)&&node.kind!=="var"){return}if(t.isDeclaration(node)){self.add(node,ids)}else if(t.isFunction(node)){return false}})}else if(t.isCatchClause(block)){self.add(block.param,ids)}if(t.isFunction(block)){_.each(block.params,function(param){self.add(param,ids)})}return ids};Scope.prototype.add=function(node,ids){_.merge(ids||this.ids,t.getIds(node,true))};Scope.prototype.get=function(id){return id&&(this.getOwn(id)||this.parentGet(id))};Scope.prototype.getOwn=function(id){return _.has(this.ids,id)&&this.ids[id]};Scope.prototype.parentGet=function(id){return this.parent&&this.parent.get(id)};Scope.prototype.has=function(id){return id&&(this.hasOwn(id)||this.parentHas(id))};Scope.prototype.hasOwn=function(id){return!!this.getOwn(id)};Scope.prototype.parentHas=function(id){return this.parent&&this.parent.has(id)}},{"../types":58,"./index":54,lodash:91}],56:[function(require,module,exports){module.exports={ExpressionStatement:["Statement"],BreakStatement:["Statement"],ContinueStatement:["Statement"],DebuggerStatement:["Statement"],DoWhileStatement:["Statement"],IfStatement:["Statement"],ReturnStatement:["Statement"],SwitchStatement:["Statement"],ThrowStatement:["Statement"],TryStatement:["Statement"],WhileStatement:["Statement"],WithStatement:["Statement"],EmptyStatement:["Statement"],LabeledStatement:["Statement"],VariableDeclaration:["Statement","Declaration"],ExportDeclaration:["Statement","Declaration"],ImportDeclaration:["Statement","Declaration"],ArrowFunctionExpression:["Scope","Function"],FunctionDeclaration:["Statement","Declaration","Scope","Function"],FunctionExpression:["Scope","Function"],BlockStatement:["Statement","Scope"],Program:["Scope"],CatchClause:["Scope"],LogicalExpression:["Binary"],BinaryExpression:["Binary"],UnaryExpression:["UnaryLike"],SpreadProperty:["UnaryLike"],SpreadElement:["UnaryLike"],ClassDeclaration:["Statement","Declaration","Class"],ClassExpression:["Class"],ForOfStatement:["Statement","For"],ForInStatement:["Statement","For"],ForStatement:["Statement","For"],ObjectPattern:["Pattern"],ArrayPattern:["Pattern"],Property:["UserWhitespacable"]}},{}],57:[function(require,module,exports){module.exports={ArrayExpression:["elements"],AssignmentExpression:["operator","left","right"],BinaryExpression:["operator","left","right"],BlockStatement:["body"],CallExpression:["callee","arguments"],ConditionalExpression:["test","consequent","alternate"],ExpressionStatement:["expression"],File:["program","comments","tokens"],FunctionExpression:["id","params","body","generator"],Identifier:["name"],IfStatement:["test","consequent","alternate"],Literal:["value"],MemberExpression:["object","property","computed"],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ParenthesizedExpression:["expression"],Program:["body"],Property:["kind","key","value","computed"],ReturnStatement:["argument"],SequenceExpression:["expressions"],UnaryExpression:["operator","argument","prefix"],VariableDeclaration:["kind","declarations"],VariableDeclarator:["id","init"]}},{}],58:[function(require,module,exports){var _=require("lodash");var t=exports;t.VISITOR_KEYS=require("./visitor-keys");_.each(t.VISITOR_KEYS,function(keys,type){t["is"+type]=function(node,opts){return node&&node.type===type&&t.shallowEqual(node,opts)}});t.BUILDER_KEYS=_.defaults(require("./builder-keys"),t.VISITOR_KEYS);_.each(t.BUILDER_KEYS,function(keys,type){t[type[0].toLowerCase()+type.slice(1)]=function(){var args=arguments;var node={type:type};_.each(keys,function(key,i){node[key]=args[i]});return node}});t.ALIAS_KEYS=require("./alias-keys");var _aliases={};_.each(t.ALIAS_KEYS,function(aliases,type){_.each(aliases,function(alias){var types=_aliases[alias]=_aliases[alias]||[];types.push(type)})});_.each(_aliases,function(types,type){t[type.toUpperCase()+"_TYPES"]=types;t["is"+type]=function(node,opts){return node&&_.contains(types,node.type)&&t.shallowEqual(node,opts)}});t.shallowEqual=function(actual,expected){var same=true;if(expected){_.each(expected,function(val,key){if(actual[key]!==val){return same=false}})}return same};t.isReferenced=function(node,parent){if(t.isProperty(parent)&&parent.key===node)return false;var isMemberExpression=t.isMemberExpression(parent);var isComputedProperty=isMemberExpression&&parent.property===node&&parent.computed;var isObject=isMemberExpression&&parent.object===node;if(!isMemberExpression||isComputedProperty||isObject)return true;return false};t.toIdentifier=function(name){if(t.isIdentifier(name))return name.name;name=name.replace(/[^a-zA-Z0-9]/g,"-");name=name.replace(/^[-0-9]+/,"");name=name.replace(/[-_\s]+(.)?/g,function(match,c){return c?c.toUpperCase():""});return name};t.ensureBlock=function(node){node.body=t.toBlock(node.body,node)};t.toStatement=function(node,ignore){var mustHaveId=false;var newType;if(t.isClass(node)){mustHaveId=true;newType="ClassDeclaration"}else if(t.isFunction(node)){mustHaveId=true;newType="FunctionDeclaration"}else if(t.isStatement(node)){newType=node.type}if(mustHaveId&&!node.id){newType=false}if(!newType){if(ignore){return false}else{throw new Error("cannot turn "+node.type+" to a statement")}}node.type=newType;return node};t.toBlock=function(node,parent){if(t.isBlockStatement(node)){return node}if(!_.isArray(node)){if(!t.isStatement(node)){if(t.isFunction(parent)){node=t.returnStatement(node)}else{node=t.expressionStatement(node)}}node=[node]}return t.blockStatement(node)};t.getIds=function(node,map,ignoreTypes){ignoreTypes=ignoreTypes||[];var search=[node];var ids={};while(search.length){var id=search.shift();if(!id)continue;if(_.contains(ignoreTypes,id.type))continue;var nodeKey=t.getIds.nodes[id.type];var arrKey=t.getIds.arrays[id.type];if(t.isIdentifier(id)){ids[id.name]=id}else if(nodeKey){if(id[nodeKey])search.push(id[nodeKey])}else if(arrKey){search=search.concat(id[arrKey]||[])}}if(!map)ids=_.keys(ids);return ids};t.getIds.nodes={AssignmentExpression:"left",ImportSpecifier:"id",ExportSpecifier:"id",VariableDeclarator:"id",FunctionDeclaration:"id",ClassDeclaration:"id",ParenthesizedExpression:"expression",MemeberExpression:"object",SpreadElement:"argument",Property:"value"};t.getIds.arrays={ExportDeclaration:"specifiers",ImportDeclaration:"specifiers",VariableDeclaration:"declarations",ArrayPattern:"elements",ObjectPattern:"properties"};t.inherits=function(child,parent){child.loc=parent.loc;child.end=parent.end;child.range=parent.range;child.start=parent.start;child.leadingComments=parent.leadingComments;child.trailingComments=parent.trailingComments;return child};t.getSpecifierName=function(specifier){return specifier.name||specifier.id}},{"./alias-keys":56,"./builder-keys":57,"./visitor-keys":59,lodash:91}],59:[function(require,module,exports){module.exports={ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","defaults","rest","body"],AssignmentExpression:["left","right"],AwaitExpression:["argument"],BinaryExpression:["left","right"],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"],ParenthesizedExpression:["expression"],Program:["body"],Property:["key","value"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["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"],WhileStatement:["test","body"],WithStatement:["object","body"],XJSAttribute:["name","value"],XJSClosingElement:["name"],XJSElement:["openingElement","closingElement","children"],XJSEmptyExpression:[],XJSExpressionContainer:["expression"],XJSIdentifier:[],XJSMemberExpression:["object","property"],XJSNamespacedName:["namespace","name"],XJSOpeningElement:["name","attributes"],XJSSpreadAttribute:["argument"],YieldExpression:["argument"]}},{}],60:[function(require,module,exports){(function(Buffer,__dirname){require("./patch");var estraverse=require("estraverse");var traverse=require("./traverse");var acorn=require("acorn-6to5");var path=require("path");var util=require("util");var fs=require("fs");var t=require("./types");var _=require("lodash");exports.inherits=util.inherits;exports.canCompile=function(filename,altExts){var exts=altExts||[".js",".jsx",".es6"];var ext=path.extname(filename);return _.contains(exts,ext)};exports.resolve=function(loc){try{return require.resolve(loc)}catch(err){return null}};exports.trimRight=function(str){return str.replace(/[\n\s]+$/g,"")};exports.list=function(val){return val?val.split(","):[]};exports.getUid=function(parent,file){var node;if(t.isAssignmentExpression(parent)){node=parent.left}else if(t.isVariableDeclarator(parent)){node=parent.id}var id="ref";if(t.isIdentifier(node))id=node.name;return t.identifier(file.generateUid(id))};exports.isAbsolute=function(loc){if(!loc)return false;if(loc[0]==="/")return true;if(loc[1]===":"&&loc[2]==="\\")return true;return false};exports.sourceMapToComment=function(map){var json=JSON.stringify(map);var base64=new Buffer(json).toString("base64");return"//# sourceMappingURL=data:application/json;base64,"+base64};exports.pushMutatorMap=function(mutatorMap,key,kind,method){var alias;if(t.isIdentifier(key)){alias=key.name;if(method.computed)alias="computed:"+alias}else if(t.isLiteral(key)){alias=String(key.value)}else{alias=JSON.stringify(traverse.removeProperties(_.cloneDeep(key)))}var map;if(_.has(mutatorMap,alias)){map=mutatorMap[alias]}else{map={}}mutatorMap[alias]=map;map._key=key;if(method.computed){map._computed=true}map[kind]=method};exports.buildDefineProperties=function(mutatorMap){var objExpr=t.objectExpression([]);_.each(mutatorMap,function(map){var mapNode=t.objectExpression([]);var propNode=t.property("init",map._key,mapNode,map._computed);_.each(map,function(node,key){if(key[0]==="_")return;node=_.clone(node);if(t.isMethodDefinition(node))node=node.value;mapNode.properties.push(t.property("init",t.identifier(key),node))});objExpr.properties.push(propNode)});return objExpr};exports.template=function(name,nodes,keepExpression){var template=exports.templates[name];if(!template)throw new ReferenceError("unknown template "+name);if(nodes===true){keepExpression=true;nodes=null}template=_.cloneDeep(template);var inherits=false;if(nodes){inherits=nodes.inherits;delete nodes.inherits;if(!_.isEmpty(nodes)){traverse(template,function(node){if(t.isIdentifier(node)&&_.has(nodes,node.name)){var newNode=nodes[node.name];if(_.isString(newNode)){node.name=newNode}else{return newNode}}})}}var node=template.body[0];if(!keepExpression&&t.isExpressionStatement(node)){node=node.expression;if(t.isParenthesizedExpression(node))node=node.expression}if(inherits){node=t.inherits(node,inherits)}return node};exports.codeFrame=function(lines,lineNumber,colNumber){colNumber=Math.max(colNumber,0);lines=lines.split("\n");var start=Math.max(lineNumber-3,0);var end=Math.min(lines.length,lineNumber+3);var width=(end+"").length;if(!lineNumber&&!colNumber){start=0;end=lines.length}return"\n"+lines.slice(start,end).map(function(line,i){var curr=i+start+1;var gutter=curr===lineNumber?"> ":" ";var sep=curr+exports.repeat(width+1);gutter+=sep+"| ";var str=gutter+line;if(colNumber&&curr===lineNumber){str+="\n";str+=exports.repeat(gutter.length-2);str+="|"+exports.repeat(colNumber)+"^"}return str}).join("\n")};exports.repeat=function(width,cha){cha=cha||" ";return new Array(width+1).join(cha)};exports.parse=function(opts,code,callback){try{var comments=[];var tokens=[];var ast=acorn.parse(code,{allowReturnOutsideFunction:true,preserveParens:true,ecmaVersion:Infinity,strictMode:true,onComment:comments,locations:true,onToken:tokens,ranges:true});estraverse.attachComments(ast,comments,tokens);ast=t.file(ast,comments,tokens);traverse(ast,function(node,parent){node._parent=parent});if(callback){return callback(ast)}else{return ast}}catch(err){if(!err._6to5){err._6to5=true;var message=opts.filename+": "+err.message;var loc=err.loc;if(loc){var frame=exports.codeFrame(code,loc.line,loc.column);message+=frame}if(err.stack)err.stack=err.stack.replace(err.message,message);err.message=message}throw err}};exports.parseTemplate=function(loc,code){var ast=exports.parse({filename:loc},code).program;return traverse.removeProperties(ast)};var loadTemplates=function(){var templates={};var templatesLoc=__dirname+"/templates";if(!fs.existsSync(templatesLoc)){throw new Error("no templates directory - this is most likely the "+"result of a broken `npm publish`. Please report to "+"https://githut.com/6to5/6to5/issues")}_.each(fs.readdirSync(templatesLoc),function(name){if(name[0]===".")return;var key=path.basename(name,path.extname(name));var loc=templatesLoc+"/"+name;var code=fs.readFileSync(loc,"utf8");templates[key]=exports.parseTemplate(loc,code)});return templates};try{exports.templates=require("../../templates.json")}catch(err){if(err.code!=="MODULE_NOT_FOUND")throw err;Object.defineProperty(exports,"templates",{get:function(){return exports.templates=loadTemplates()}})}}).call(this,require("buffer").Buffer,"/lib/6to5")},{"../../templates.json":123,"./patch":22,"./traverse":54,"./types":58,"acorn-6to5":1,buffer:77,estraverse:86,fs:75,lodash:91,path:82,util:85}],61:[function(require,module,exports){var types=require("../lib/types");var Type=types.Type;var def=Type.def;var or=Type.or;var builtin=types.builtInTypes;var isString=builtin.string;var isNumber=builtin.number;var isBoolean=builtin.boolean;var isRegExp=builtin.RegExp;var shared=require("../lib/shared");var defaults=shared.defaults;var geq=shared.geq;def("Node").field("type",isString).field("loc",or(def("SourceLocation"),null),defaults["null"],true);def("SourceLocation").build("start","end","source").field("start",def("Position")).field("end",def("Position")).field("source",or(isString,null),defaults["null"]);def("Position").build("line","column").field("line",geq(1)).field("column",geq(0));def("Program").bases("Node").build("body").field("body",[def("Statement")]);def("Function").bases("Node").field("id",or(def("Identifier"),null),defaults["null"]).field("params",[def("Pattern")]).field("body",or(def("BlockStatement"),def("Expression")));def("Statement").bases("Node");def("EmptyStatement").bases("Statement").build();def("BlockStatement").bases("Statement").build("body").field("body",[def("Statement")]);def("ExpressionStatement").bases("Statement").build("expression").field("expression",def("Expression"));def("IfStatement").bases("Statement").build("test","consequent","alternate").field("test",def("Expression")).field("consequent",def("Statement")).field("alternate",or(def("Statement"),null),defaults["null"]);def("LabeledStatement").bases("Statement").build("label","body").field("label",def("Identifier")).field("body",def("Statement"));def("BreakStatement").bases("Statement").build("label").field("label",or(def("Identifier"),null),defaults["null"]);def("ContinueStatement").bases("Statement").build("label").field("label",or(def("Identifier"),null),defaults["null"]);def("WithStatement").bases("Statement").build("object","body").field("object",def("Expression")).field("body",def("Statement"));def("SwitchStatement").bases("Statement").build("discriminant","cases","lexical").field("discriminant",def("Expression")).field("cases",[def("SwitchCase")]).field("lexical",isBoolean,defaults["false"]);def("ReturnStatement").bases("Statement").build("argument").field("argument",or(def("Expression"),null));def("ThrowStatement").bases("Statement").build("argument").field("argument",def("Expression"));def("TryStatement").bases("Statement").build("block","handler","finalizer").field("block",def("BlockStatement")).field("handler",or(def("CatchClause"),null),function(){return this.handlers&&this.handlers[0]||null}).field("handlers",[def("CatchClause")],function(){return this.handler?[this.handler]:[]},true).field("guardedHandlers",[def("CatchClause")],defaults.emptyArray).field("finalizer",or(def("BlockStatement"),null),defaults["null"]);def("CatchClause").bases("Node").build("param","guard","body").field("param",def("Pattern")).field("guard",or(def("Expression"),null),defaults["null"]).field("body",def("BlockStatement"));def("WhileStatement").bases("Statement").build("test","body").field("test",def("Expression")).field("body",def("Statement"));def("DoWhileStatement").bases("Statement").build("body","test").field("body",def("Statement")).field("test",def("Expression"));def("ForStatement").bases("Statement").build("init","test","update","body").field("init",or(def("VariableDeclaration"),def("Expression"),null)).field("test",or(def("Expression"),null)).field("update",or(def("Expression"),null)).field("body",def("Statement"));def("ForInStatement").bases("Statement").build("left","right","body","each").field("left",or(def("VariableDeclaration"),def("Expression"))).field("right",def("Expression")).field("body",def("Statement")).field("each",isBoolean);def("DebuggerStatement").bases("Statement").build();def("Declaration").bases("Statement");def("FunctionDeclaration").bases("Function","Declaration").build("id","params","body").field("id",def("Identifier"));def("FunctionExpression").bases("Function","Expression").build("id","params","body");def("VariableDeclaration").bases("Declaration").build("kind","declarations").field("kind",or("var","let","const")).field("declarations",[or(def("VariableDeclarator"),def("Identifier"))]);def("VariableDeclarator").bases("Node").build("id","init").field("id",def("Pattern")).field("init",or(def("Expression"),null));def("Expression").bases("Node","Pattern");def("ThisExpression").bases("Expression").build();def("ArrayExpression").bases("Expression").build("elements").field("elements",[or(def("Expression"),null)]);def("ObjectExpression").bases("Expression").build("properties").field("properties",[def("Property")]);def("Property").bases("Node").build("kind","key","value").field("kind",or("init","get","set")).field("key",or(def("Literal"),def("Identifier"))).field("value",def("Expression"));def("SequenceExpression").bases("Expression").build("expressions").field("expressions",[def("Expression")]);var UnaryOperator=or("-","+","!","~","typeof","void","delete");def("UnaryExpression").bases("Expression").build("operator","argument","prefix").field("operator",UnaryOperator).field("argument",def("Expression")).field("prefix",isBoolean,defaults["true"]);var BinaryOperator=or("==","!=","===","!==","<","<=",">",">=","<<",">>",">>>","+","-","*","/","%","&","|","^","in","instanceof","..");def("BinaryExpression").bases("Expression").build("operator","left","right").field("operator",BinaryOperator).field("left",def("Expression")).field("right",def("Expression"));var AssignmentOperator=or("=","+=","-=","*=","/=","%=","<<=",">>=",">>>=","|=","^=","&=");def("AssignmentExpression").bases("Expression").build("operator","left","right").field("operator",AssignmentOperator).field("left",def("Pattern")).field("right",def("Expression"));var UpdateOperator=or("++","--");def("UpdateExpression").bases("Expression").build("operator","argument","prefix").field("operator",UpdateOperator).field("argument",def("Expression")).field("prefix",isBoolean);var LogicalOperator=or("||","&&");def("LogicalExpression").bases("Expression").build("operator","left","right").field("operator",LogicalOperator).field("left",def("Expression")).field("right",def("Expression"));def("ConditionalExpression").bases("Expression").build("test","consequent","alternate").field("test",def("Expression")).field("consequent",def("Expression")).field("alternate",def("Expression"));def("NewExpression").bases("Expression").build("callee","arguments").field("callee",def("Expression")).field("arguments",[def("Expression")]);def("CallExpression").bases("Expression").build("callee","arguments").field("callee",def("Expression")).field("arguments",[def("Expression")]);def("MemberExpression").bases("Expression").build("object","property","computed").field("object",def("Expression")).field("property",or(def("Identifier"),def("Expression"))).field("computed",isBoolean);
def("Pattern").bases("Node");def("ObjectPattern").bases("Pattern").build("properties").field("properties",[def("PropertyPattern")]);def("PropertyPattern").bases("Pattern").build("key","pattern").field("key",or(def("Literal"),def("Identifier"))).field("pattern",def("Pattern"));def("ArrayPattern").bases("Pattern").build("elements").field("elements",[or(def("Pattern"),null)]);def("SwitchCase").bases("Node").build("test","consequent").field("test",or(def("Expression"),null)).field("consequent",[def("Statement")]);def("Identifier").bases("Node","Expression","Pattern").build("name").field("name",isString);def("Literal").bases("Node","Expression").build("value").field("value",or(isString,isBoolean,null,isNumber,isRegExp))},{"../lib/shared":72,"../lib/types":73}],62:[function(require,module,exports){require("./core");var types=require("../lib/types");var def=types.Type.def;var or=types.Type.or;var builtin=types.builtInTypes;var isString=builtin.string;var isBoolean=builtin.boolean;def("XMLDefaultDeclaration").bases("Declaration").field("namespace",def("Expression"));def("XMLAnyName").bases("Expression");def("XMLQualifiedIdentifier").bases("Expression").field("left",or(def("Identifier"),def("XMLAnyName"))).field("right",or(def("Identifier"),def("Expression"))).field("computed",isBoolean);def("XMLFunctionQualifiedIdentifier").bases("Expression").field("right",or(def("Identifier"),def("Expression"))).field("computed",isBoolean);def("XMLAttributeSelector").bases("Expression").field("attribute",def("Expression"));def("XMLFilterExpression").bases("Expression").field("left",def("Expression")).field("right",def("Expression"));def("XMLElement").bases("XML","Expression").field("contents",[def("XML")]);def("XMLList").bases("XML","Expression").field("contents",[def("XML")]);def("XML").bases("Node");def("XMLEscape").bases("XML").field("expression",def("Expression"));def("XMLText").bases("XML").field("text",isString);def("XMLStartTag").bases("XML").field("contents",[def("XML")]);def("XMLEndTag").bases("XML").field("contents",[def("XML")]);def("XMLPointTag").bases("XML").field("contents",[def("XML")]);def("XMLName").bases("XML").field("contents",or(isString,[def("XML")]));def("XMLAttribute").bases("XML").field("value",isString);def("XMLCdata").bases("XML").field("contents",isString);def("XMLComment").bases("XML").field("contents",isString);def("XMLProcessingInstruction").bases("XML").field("target",isString).field("contents",or(isString,null))},{"../lib/types":73,"./core":61}],63:[function(require,module,exports){require("./core");var types=require("../lib/types");var def=types.Type.def;var or=types.Type.or;var builtin=types.builtInTypes;var isBoolean=builtin.boolean;var isObject=builtin.object;var isString=builtin.string;var defaults=require("../lib/shared").defaults;def("Function").field("generator",isBoolean,defaults["false"]).field("expression",isBoolean,defaults["false"]).field("defaults",[or(def("Expression"),null)],defaults.emptyArray).field("rest",or(def("Identifier"),null),defaults["null"]);def("FunctionDeclaration").build("id","params","body","generator","expression");def("FunctionExpression").build("id","params","body","generator","expression");def("ArrowFunctionExpression").bases("Function","Expression").build("params","body","expression").field("id",null,defaults["null"]).field("generator",false);def("YieldExpression").bases("Expression").build("argument","delegate").field("argument",or(def("Expression"),null)).field("delegate",isBoolean,defaults["false"]);def("GeneratorExpression").bases("Expression").build("body","blocks","filter").field("body",def("Expression")).field("blocks",[def("ComprehensionBlock")]).field("filter",or(def("Expression"),null));def("ComprehensionExpression").bases("Expression").build("body","blocks","filter").field("body",def("Expression")).field("blocks",[def("ComprehensionBlock")]).field("filter",or(def("Expression"),null));def("ComprehensionBlock").bases("Node").build("left","right","each").field("left",def("Pattern")).field("right",def("Expression")).field("each",isBoolean);def("ModuleSpecifier").bases("Literal").build("value").field("value",isString);def("Property").field("method",isBoolean,defaults["false"]).field("shorthand",isBoolean,defaults["false"]).field("computed",isBoolean,defaults["false"]);def("MethodDefinition").bases("Declaration").build("kind","key","value").field("kind",or("init","get","set","")).field("key",or(def("Literal"),def("Identifier"))).field("value",def("Function"));def("SpreadElement").bases("Node").build("argument").field("argument",def("Expression"));def("ArrayExpression").field("elements",[or(def("Expression"),def("SpreadElement"),null)]);def("NewExpression").field("arguments",[or(def("Expression"),def("SpreadElement"))]);def("CallExpression").field("arguments",[or(def("Expression"),def("SpreadElement"))]);def("SpreadElementPattern").bases("Pattern").build("argument").field("argument",def("Pattern"));var ClassBodyElement=or(def("MethodDefinition"),def("VariableDeclarator"),def("ClassPropertyDefinition"),def("ClassProperty"));def("ClassProperty").bases("Declaration").build("id").field("id",def("Identifier"));def("ClassPropertyDefinition").bases("Declaration").build("definition").field("definition",ClassBodyElement);def("ClassBody").bases("Declaration").build("body").field("body",[ClassBodyElement]);def("ClassDeclaration").bases("Declaration").build("id","body","superClass").field("id",def("Identifier")).field("body",def("ClassBody")).field("superClass",or(def("Expression"),null),defaults["null"]);def("ClassExpression").bases("Expression").build("id","body","superClass").field("id",or(def("Identifier"),null),defaults["null"]).field("body",def("ClassBody")).field("superClass",or(def("Expression"),null),defaults["null"]);def("Specifier").bases("Node");def("NamedSpecifier").bases("Specifier").field("id",def("Identifier")).field("name",or(def("Identifier"),null),defaults["null"]);def("ExportSpecifier").bases("NamedSpecifier").build("id","name");def("ExportBatchSpecifier").bases("Specifier").build();def("ImportSpecifier").bases("NamedSpecifier").build("id","name");def("ImportNamespaceSpecifier").bases("Specifier").build("id").field("id",def("Identifier"));def("ImportDefaultSpecifier").bases("Specifier").build("id").field("id",def("Identifier"));def("ExportDeclaration").bases("Declaration").build("default","declaration","specifiers","source").field("default",isBoolean).field("declaration",or(def("Declaration"),def("Expression"),null)).field("specifiers",[or(def("ExportSpecifier"),def("ExportBatchSpecifier"))],defaults.emptyArray).field("source",or(def("ModuleSpecifier"),null),defaults["null"]);def("ImportDeclaration").bases("Declaration").build("specifiers","source").field("specifiers",[or(def("ImportSpecifier"),def("ImportNamespaceSpecifier"),def("ImportDefaultSpecifier"))],defaults.emptyArray).field("source",def("ModuleSpecifier"));def("TaggedTemplateExpression").bases("Expression").field("tag",def("Expression")).field("quasi",def("TemplateLiteral"));def("TemplateLiteral").bases("Expression").build("quasis","expressions").field("quasis",[def("TemplateElement")]).field("expressions",[def("Expression")]);def("TemplateElement").bases("Node").build("value","tail").field("value",{cooked:isString,raw:isString}).field("tail",isBoolean)},{"../lib/shared":72,"../lib/types":73,"./core":61}],64:[function(require,module,exports){require("./core");var types=require("../lib/types");var def=types.Type.def;var or=types.Type.or;var builtin=types.builtInTypes;var isBoolean=builtin.boolean;var defaults=require("../lib/shared").defaults;def("Function").field("async",isBoolean,defaults["false"]);def("SpreadProperty").bases("Node").build("argument").field("argument",def("Expression"));def("ObjectExpression").field("properties",[or(def("Property"),def("SpreadProperty"))]);def("SpreadPropertyPattern").bases("Pattern").build("argument").field("argument",def("Pattern"));def("ObjectPattern").field("properties",[or(def("PropertyPattern"),def("SpreadPropertyPattern"))]);def("AwaitExpression").bases("Expression").build("argument","all").field("argument",or(def("Expression"),null)).field("all",isBoolean,defaults["false"])},{"../lib/shared":72,"../lib/types":73,"./core":61}],65:[function(require,module,exports){require("./core");var types=require("../lib/types");var def=types.Type.def;var or=types.Type.or;var builtin=types.builtInTypes;var isString=builtin.string;var isBoolean=builtin.boolean;var defaults=require("../lib/shared").defaults;def("XJSAttribute").bases("Node").build("name","value").field("name",or(def("XJSIdentifier"),def("XJSNamespacedName"))).field("value",or(def("Literal"),def("XJSExpressionContainer"),null),defaults["null"]);def("XJSIdentifier").bases("Node").build("name").field("name",isString);def("XJSNamespacedName").bases("Node").build("namespace","name").field("namespace",def("XJSIdentifier")).field("name",def("XJSIdentifier"));def("XJSMemberExpression").bases("MemberExpression").build("object","property").field("object",or(def("XJSIdentifier"),def("XJSMemberExpression"))).field("property",def("XJSIdentifier")).field("computed",isBoolean,defaults.false);var XJSElementName=or(def("XJSIdentifier"),def("XJSNamespacedName"),def("XJSMemberExpression"));def("XJSSpreadAttribute").bases("Node").build("argument").field("argument",def("Expression"));var XJSAttributes=[or(def("XJSAttribute"),def("XJSSpreadAttribute"))];def("XJSExpressionContainer").bases("Expression").build("expression").field("expression",def("Expression"));def("XJSElement").bases("Expression").build("openingElement","closingElement","children").field("openingElement",def("XJSOpeningElement")).field("closingElement",or(def("XJSClosingElement"),null),defaults["null"]).field("children",[or(def("XJSElement"),def("XJSExpressionContainer"),def("XJSText"),def("Literal"))],defaults.emptyArray).field("name",XJSElementName,function(){return this.openingElement.name}).field("selfClosing",isBoolean,function(){return this.openingElement.selfClosing}).field("attributes",XJSAttributes,function(){return this.openingElement.attributes});def("XJSOpeningElement").bases("Node").build("name","attributes","selfClosing").field("name",XJSElementName).field("attributes",XJSAttributes,defaults.emptyArray).field("selfClosing",isBoolean,defaults["false"]);def("XJSClosingElement").bases("Node").build("name").field("name",XJSElementName);def("XJSText").bases("Literal").build("value").field("value",isString);def("XJSEmptyExpression").bases("Expression").build();def("TypeAnnotatedIdentifier").bases("Pattern").build("annotation","identifier").field("annotation",def("TypeAnnotation")).field("identifier",def("Identifier"));def("TypeAnnotation").bases("Pattern").build("annotatedType","templateTypes","paramTypes","returnType","unionType","nullable").field("annotatedType",def("Identifier")).field("templateTypes",or([def("TypeAnnotation")],null)).field("paramTypes",or([def("TypeAnnotation")],null)).field("returnType",or(def("TypeAnnotation"),null)).field("unionType",or(def("TypeAnnotation"),null)).field("nullable",isBoolean);def("Identifier").field("annotation",or(def("TypeAnnotation"),null),defaults["null"]);def("Function").field("returnType",or(def("TypeAnnotation"),null),defaults["null"]);def("ClassProperty").field("id",or(def("Identifier"),def("TypeAnnotatedIdentifier")))},{"../lib/shared":72,"../lib/types":73,"./core":61}],66:[function(require,module,exports){require("./core");var types=require("../lib/types");var def=types.Type.def;var or=types.Type.or;var geq=require("../lib/shared").geq;def("ForOfStatement").bases("Statement").build("left","right","body").field("left",or(def("VariableDeclaration"),def("Expression"))).field("right",def("Expression")).field("body",def("Statement"));def("LetStatement").bases("Statement").build("head","body").field("head",[def("VariableDeclarator")]).field("body",def("Statement"));def("LetExpression").bases("Expression").build("head","body").field("head",[def("VariableDeclarator")]).field("body",def("Expression"));def("GraphExpression").bases("Expression").build("index","expression").field("index",geq(0)).field("expression",def("Literal"));def("GraphIndexExpression").bases("Expression").build("index").field("index",geq(0))},{"../lib/shared":72,"../lib/types":73,"./core":61}],67:[function(require,module,exports){var assert=require("assert");var types=require("../main");var getFieldNames=types.getFieldNames;var getFieldValue=types.getFieldValue;var isArray=types.builtInTypes.array;var isObject=types.builtInTypes.object;var isDate=types.builtInTypes.Date;var isRegExp=types.builtInTypes.RegExp;var hasOwn=Object.prototype.hasOwnProperty;function astNodesAreEquivalent(a,b,problemPath){if(isArray.check(problemPath)){problemPath.length=0}else{problemPath=null}return areEquivalent(a,b,problemPath)}astNodesAreEquivalent.assert=function(a,b){var problemPath=[];if(!astNodesAreEquivalent(a,b,problemPath)){if(problemPath.length===0){assert.strictEqual(a,b)}else{assert.ok(false,"Nodes differ in the following path: "+problemPath.map(subscriptForProperty).join(""))}}};function subscriptForProperty(property){if(/[_$a-z][_$a-z0-9]*/i.test(property)){return"."+property}return"["+JSON.stringify(property)+"]"}function areEquivalent(a,b,problemPath){if(a===b){return true}if(isArray.check(a)){return arraysAreEquivalent(a,b,problemPath)}if(isObject.check(a)){return objectsAreEquivalent(a,b,problemPath)}if(isDate.check(a)){return isDate.check(b)&&+a===+b}if(isRegExp.check(a)){return isRegExp.check(b)&&(a.source===b.source&&a.global===b.global&&a.multiline===b.multiline&&a.ignoreCase===b.ignoreCase)}return a==b}function arraysAreEquivalent(a,b,problemPath){isArray.assert(a);var aLength=a.length;if(!isArray.check(b)||b.length!==aLength){if(problemPath){problemPath.push("length")}return false}for(var i=0;i<aLength;++i){if(problemPath){problemPath.push(i)}if(i in a!==i in b){return false}if(!areEquivalent(a[i],b[i],problemPath)){return false}if(problemPath){assert.strictEqual(problemPath.pop(),i)}}return true}function objectsAreEquivalent(a,b,problemPath){isObject.assert(a);if(!isObject.check(b)){return false}if(a.type!==b.type){if(problemPath){problemPath.push("type")}return false}var aNames=getFieldNames(a);var aNameCount=aNames.length;var bNames=getFieldNames(b);var bNameCount=bNames.length;if(aNameCount===bNameCount){for(var i=0;i<aNameCount;++i){var name=aNames[i];var aChild=getFieldValue(a,name);var bChild=getFieldValue(b,name);if(problemPath){problemPath.push(name)}if(!areEquivalent(aChild,bChild,problemPath)){return false}if(problemPath){assert.strictEqual(problemPath.pop(),name)}}return true}if(!problemPath){return false}var seenNames=Object.create(null);for(i=0;i<aNameCount;++i){seenNames[aNames[i]]=true}for(i=0;i<bNameCount;++i){name=bNames[i];if(!hasOwn.call(seenNames,name)){problemPath.push(name);return false}delete seenNames[name]}for(name in seenNames){problemPath.push(name);break}return false}module.exports=astNodesAreEquivalent},{"../main":74,assert:76}],68:[function(require,module,exports){var assert=require("assert");var types=require("./types");var n=types.namedTypes;var isNumber=types.builtInTypes.number;var isArray=types.builtInTypes.array;var Path=require("./path");var Scope=require("./scope");function NodePath(value,parentPath,name){assert.ok(this instanceof NodePath);Path.call(this,value,parentPath,name)}require("util").inherits(NodePath,Path);var NPp=NodePath.prototype;Object.defineProperties(NPp,{node:{get:function(){Object.defineProperty(this,"node",{configurable:true,value:this._computeNode()});return this.node}},parent:{get:function(){Object.defineProperty(this,"parent",{configurable:true,value:this._computeParent()});return this.parent}},scope:{get:function(){Object.defineProperty(this,"scope",{configurable:true,value:this._computeScope()});return this.scope}}});NPp.replace=function(){delete this.node;delete this.parent;delete this.scope;return Path.prototype.replace.apply(this,arguments)};NPp.prune=function(){var remainingNodePath=this.parent;this.replace();if(n.VariableDeclaration.check(remainingNodePath.node)){var declarations=remainingNodePath.get("declarations").value;if(!declarations||declarations.length===0){return remainingNodePath.prune()}}else if(n.ExpressionStatement.check(remainingNodePath.node)){if(!remainingNodePath.get("expression").value){return remainingNodePath.prune()}}return remainingNodePath};NPp._computeNode=function(){var value=this.value;if(n.Node.check(value)){return value}var pp=this.parentPath;return pp&&pp.node||null};NPp._computeParent=function(){var value=this.value;var pp=this.parentPath;if(!n.Node.check(value)){while(pp&&!n.Node.check(pp.value)){pp=pp.parentPath}if(pp){pp=pp.parentPath}}while(pp&&!n.Node.check(pp.value)){pp=pp.parentPath}return pp||null};NPp._computeScope=function(){var value=this.value;var pp=this.parentPath;var scope=pp&&pp.scope;if(n.Node.check(value)&&Scope.isEstablishedBy(value)){scope=new Scope(this,scope)}return scope||null};NPp.getValueProperty=function(name){return types.getFieldValue(this.value,name)};NPp.needsParens=function(assumeExpressionContext){if(!this.parent)return false;var node=this.node;if(node!==this.value)return false;var parent=this.parent.node;assert.notStrictEqual(node,parent);if(!n.Expression.check(node))return false;if(isUnaryLike(node))return n.MemberExpression.check(parent)&&this.name==="object"&&parent.object===node;if(isBinary(node)){if(n.CallExpression.check(parent)&&this.name==="callee"){assert.strictEqual(parent.callee,node);return true}if(isUnaryLike(parent))return true;if(n.MemberExpression.check(parent)&&this.name==="object"){assert.strictEqual(parent.object,node);return true}if(isBinary(parent)){var po=parent.operator;var pp=PRECEDENCE[po];var no=node.operator;var np=PRECEDENCE[no];if(pp>np){return true}if(pp===np&&this.name==="right"){assert.strictEqual(parent.right,node);return true}}}if(n.SequenceExpression.check(node)){if(n.ForStatement.check(parent)){return false}if(n.ExpressionStatement.check(parent)&&this.name==="expression"){return false}return true}if(n.YieldExpression.check(node))return isBinary(parent)||n.CallExpression.check(parent)||n.MemberExpression.check(parent)||n.NewExpression.check(parent)||n.ConditionalExpression.check(parent)||isUnaryLike(parent)||n.YieldExpression.check(parent);if(n.NewExpression.check(parent)&&this.name==="callee"){assert.strictEqual(parent.callee,node);return containsCallExpression(node)}if(n.Literal.check(node)&&isNumber.check(node.value)&&n.MemberExpression.check(parent)&&this.name==="object"){assert.strictEqual(parent.object,node);return true}if(n.AssignmentExpression.check(node)||n.ConditionalExpression.check(node)){if(isUnaryLike(parent))return true;if(isBinary(parent))return true;if(n.CallExpression.check(parent)&&this.name==="callee"){assert.strictEqual(parent.callee,node);return true}if(n.ConditionalExpression.check(parent)&&this.name==="test"){assert.strictEqual(parent.test,node);return true}if(n.MemberExpression.check(parent)&&this.name==="object"){assert.strictEqual(parent.object,node);return true}}if(assumeExpressionContext!==true&&!this.canBeFirstInStatement()&&this.firstInStatement())return true;return false};function isBinary(node){return n.BinaryExpression.check(node)||n.LogicalExpression.check(node)}function isUnaryLike(node){return n.UnaryExpression.check(node)||n.SpreadElement&&n.SpreadElement.check(node)||n.SpreadProperty&&n.SpreadProperty.check(node)}var PRECEDENCE={};[["||"],["&&"],["|"],["^"],["&"],["==","===","!=","!=="],["<",">","<=",">=","in","instanceof"],[">>","<<",">>>"],["+","-"],["*","/","%"]].forEach(function(tier,i){tier.forEach(function(op){PRECEDENCE[op]=i})});function containsCallExpression(node){if(n.CallExpression.check(node)){return true}if(isArray.check(node)){return node.some(containsCallExpression)}if(n.Node.check(node)){return types.someField(node,function(name,child){return containsCallExpression(child)})}return false}NPp.canBeFirstInStatement=function(){var node=this.node;return!n.FunctionExpression.check(node)&&!n.ObjectExpression.check(node)};NPp.firstInStatement=function(){return firstInStatement(this)};function firstInStatement(path){for(var node,parent;path.parent;path=path.parent){node=path.node;parent=path.parent.node;if(n.BlockStatement.check(parent)&&path.parent.name==="body"&&path.name===0){assert.strictEqual(parent.body[0],node);return true}if(n.ExpressionStatement.check(parent)&&path.name==="expression"){assert.strictEqual(parent.expression,node);return true}if(n.SequenceExpression.check(parent)&&path.parent.name==="expressions"&&path.name===0){assert.strictEqual(parent.expressions[0],node);continue}if(n.CallExpression.check(parent)&&path.name==="callee"){assert.strictEqual(parent.callee,node);continue}if(n.MemberExpression.check(parent)&&path.name==="object"){assert.strictEqual(parent.object,node);continue}if(n.ConditionalExpression.check(parent)&&path.name==="test"){assert.strictEqual(parent.test,node);continue}if(isBinary(parent)&&path.name==="left"){assert.strictEqual(parent.left,node);continue}if(n.UnaryExpression.check(parent)&&!parent.prefix&&path.name==="argument"){assert.strictEqual(parent.argument,node);continue}return false}return true}module.exports=NodePath},{"./path":70,"./scope":71,"./types":73,assert:76,util:85}],69:[function(require,module,exports){var assert=require("assert");var types=require("./types");var NodePath=require("./node-path");var Node=types.namedTypes.Node;var isArray=types.builtInTypes.array;var isObject=types.builtInTypes.object;var isFunction=types.builtInTypes.function;var hasOwn=Object.prototype.hasOwnProperty;var undefined;function PathVisitor(){assert.ok(this instanceof PathVisitor);this._reusableContextStack=[];this._methodNameTable=computeMethodNameTable(this);this.Context=makeContextConstructor(this)}function computeMethodNameTable(visitor){var typeNames=Object.create(null);for(var methodName in visitor){if(/^visit[A-Z]/.test(methodName)){typeNames[methodName.slice("visit".length)]=true}}var supertypeTable=types.computeSupertypeLookupTable(typeNames);var methodNameTable=Object.create(null);for(var typeName in supertypeTable){if(hasOwn.call(supertypeTable,typeName)){methodName="visit"+supertypeTable[typeName];if(isFunction.check(visitor[methodName])){methodNameTable[typeName]=methodName}}}return methodNameTable}PathVisitor.fromMethodsObject=function fromMethodsObject(methods){if(methods instanceof PathVisitor){return methods}if(!isObject.check(methods)){return new PathVisitor}function Visitor(){assert.ok(this instanceof Visitor);PathVisitor.call(this)}var Vp=Visitor.prototype=Object.create(PVp);Vp.constructor=Visitor;extend(Vp,methods);extend(Visitor,PathVisitor);isFunction.assert(Visitor.fromMethodsObject);isFunction.assert(Visitor.visit);return new Visitor};function extend(target,source){for(var property in source){if(hasOwn.call(source,property)){target[property]=source[property]}}return target}PathVisitor.visit=function visit(node,methods){var visitor=PathVisitor.fromMethodsObject(methods);if(node instanceof NodePath){visitor.visit(node);return node.value}var rootPath=new NodePath({root:node});visitor.visit(rootPath.get("root"));return rootPath.value.root};var PVp=PathVisitor.prototype;PVp.visit=function(path){if(this instanceof this.Context){return this.visitor.visit(path)}assert.ok(path instanceof NodePath);var value=path.value;var methodName=Node.check(value)&&this._methodNameTable[value.type];if(methodName){var context=this.acquireContext(path);try{context.invokeVisitorMethod(methodName)}finally{this.releaseContext(context)}}else{visitChildren(path,this)}};function visitChildren(path,visitor){assert.ok(path instanceof NodePath);assert.ok(visitor instanceof PathVisitor);var value=path.value;if(isArray.check(value)){path.each(visitor.visit,visitor)}else if(!isObject.check(value)){}else{var childNames=types.getFieldNames(value);var childCount=childNames.length;var childPaths=[];for(var i=0;i<childCount;++i){var childName=childNames[i];if(!hasOwn.call(value,childName)){value[childName]=types.getFieldValue(value,childName)}childPaths.push(path.get(childName))}for(var i=0;i<childCount;++i){visitor.visit(childPaths[i])}}}PVp.acquireContext=function(path){if(this._reusableContextStack.length===0){return new this.Context(path)}return this._reusableContextStack.pop().reset(path)};PVp.releaseContext=function(context){assert.ok(context instanceof this.Context);this._reusableContextStack.push(context);context.currentPath=null};function makeContextConstructor(visitor){function Context(path){assert.ok(this instanceof Context);assert.ok(this instanceof PathVisitor);assert.ok(path instanceof NodePath);Object.defineProperty(this,"visitor",{value:visitor,writable:false,enumerable:true,configurable:false});this.currentPath=path;this.needToCallTraverse=true;Object.seal(this)}assert.ok(visitor instanceof PathVisitor);var Cp=Context.prototype=Object.create(visitor);Cp.constructor=Context;extend(Cp,sharedContextProtoMethods);return Context}var sharedContextProtoMethods=Object.create(null);sharedContextProtoMethods.reset=function reset(path){assert.ok(this instanceof this.Context);assert.ok(path instanceof NodePath);this.currentPath=path;this.needToCallTraverse=true;return this};sharedContextProtoMethods.invokeVisitorMethod=function invokeVisitorMethod(methodName){assert.ok(this instanceof this.Context);assert.ok(this.currentPath instanceof NodePath);var result=this.visitor[methodName].call(this,this.currentPath);if(result===false){this.needToCallTraverse=false}else if(result!==undefined){this.currentPath=this.currentPath.replace(result)[0];if(this.needToCallTraverse){this.traverse(this.currentPath)}}assert.strictEqual(this.needToCallTraverse,false,"Must either call this.traverse or return false in "+methodName)};sharedContextProtoMethods.traverse=function traverse(path,newVisitor){assert.ok(this instanceof this.Context);assert.ok(path instanceof NodePath);assert.ok(this.currentPath instanceof NodePath);this.needToCallTraverse=false;visitChildren(path,PathVisitor.fromMethodsObject(newVisitor||this.visitor))};module.exports=PathVisitor},{"./node-path":68,"./types":73,assert:76}],70:[function(require,module,exports){var assert=require("assert");var Op=Object.prototype;var hasOwn=Op.hasOwnProperty;var types=require("./types");var isArray=types.builtInTypes.array;var isNumber=types.builtInTypes.number;var Ap=Array.prototype;var slice=Ap.slice;var map=Ap.map;function Path(value,parentPath,name){assert.ok(this instanceof Path);if(parentPath){assert.ok(parentPath instanceof Path)}else{parentPath=null;name=null}this.value=value;this.parentPath=parentPath;this.name=name;this.__childCache=null}var Pp=Path.prototype;function getChildCache(path){return path.__childCache||(path.__childCache=Object.create(null))}function getChildPath(path,name){var cache=getChildCache(path);var actualChildValue=path.getValueProperty(name);var childPath=cache[name];if(!hasOwn.call(cache,name)||childPath.value!==actualChildValue){childPath=cache[name]=new path.constructor(actualChildValue,path,name)}return childPath}Pp.getValueProperty=function getValueProperty(name){return this.value[name]};Pp.get=function get(name){var path=this;var names=arguments;var count=names.length;for(var i=0;i<count;++i){path=getChildPath(path,names[i])}return path};Pp.each=function each(callback,context){var childPaths=[];var len=this.value.length;var i=0;for(var i=0;i<len;++i){if(hasOwn.call(this.value,i)){childPaths[i]=this.get(i)}}context=context||this;for(i=0;i<len;++i){if(hasOwn.call(childPaths,i)){callback.call(context,childPaths[i])}}};Pp.map=function map(callback,context){var result=[];this.each(function(childPath){result.push(callback.call(this,childPath))},context);return result};Pp.filter=function filter(callback,context){var result=[];this.each(function(childPath){if(callback.call(this,childPath)){result.push(childPath)}},context);return result};function emptyMoves(){}function getMoves(path,offset,start,end){isArray.assert(path.value);if(offset===0){return emptyMoves}var length=path.value.length;if(length<1){return emptyMoves}var argc=arguments.length;if(argc===2){start=0;end=length}else if(argc===3){start=Math.max(start,0);end=length}else{start=Math.max(start,0);end=Math.min(end,length)}isNumber.assert(start);isNumber.assert(end);var moves=Object.create(null);var cache=getChildCache(path);for(var i=start;i<end;++i){if(hasOwn.call(path.value,i)){var childPath=path.get(i);assert.strictEqual(childPath.name,i);var newIndex=i+offset;childPath.name=newIndex;moves[newIndex]=childPath;delete cache[i]}}delete cache.length;return function(){for(var newIndex in moves){var childPath=moves[newIndex];assert.strictEqual(childPath.name,+newIndex);cache[newIndex]=childPath;path.value[newIndex]=childPath.value}}}Pp.shift=function shift(){var move=getMoves(this,-1);var result=this.value.shift();move();return result};Pp.unshift=function unshift(node){var move=getMoves(this,arguments.length);var result=this.value.unshift.apply(this.value,arguments);move();return result};Pp.push=function push(node){isArray.assert(this.value);delete getChildCache(this).length;return this.value.push.apply(this.value,arguments)};Pp.pop=function pop(){isArray.assert(this.value);var cache=getChildCache(this);delete cache[this.value.length-1];delete cache.length;return this.value.pop()};Pp.insertAt=function insertAt(index,node){var argc=arguments.length;var move=getMoves(this,argc-1,index);if(move===emptyMoves){return this}index=Math.max(index,0);for(var i=1;i<argc;++i){this.value[index+i-1]=arguments[i]}move();return this};Pp.insertBefore=function insertBefore(node){var pp=this.parentPath;var argc=arguments.length;var insertAtArgs=[this.name];for(var i=0;i<argc;++i){insertAtArgs.push(arguments[i])}return pp.insertAt.apply(pp,insertAtArgs)};Pp.insertAfter=function insertAfter(node){var pp=this.parentPath;var argc=arguments.length;var insertAtArgs=[this.name+1];for(var i=0;i<argc;++i){insertAtArgs.push(arguments[i])}return pp.insertAt.apply(pp,insertAtArgs)};function repairRelationshipWithParent(path){assert.ok(path instanceof Path);var pp=path.parentPath;if(!pp){return path}var parentValue=pp.value;var parentCache=getChildCache(pp);if(parentValue[path.name]===path.value){parentCache[path.name]=path}else if(isArray.check(parentValue)){var i=parentValue.indexOf(path.value);if(i>=0){parentCache[path.name=i]=path}}else{parentValue[path.name]=path.value;parentCache[path.name]=path}assert.strictEqual(parentValue[path.name],path.value);assert.strictEqual(path.parentPath.get(path.name),path);return path}Pp.replace=function replace(replacement){var results=[];var parentValue=this.parentPath.value;var parentCache=getChildCache(this.parentPath);var count=arguments.length;repairRelationshipWithParent(this);if(isArray.check(parentValue)){var originalLength=parentValue.length;var move=getMoves(this.parentPath,count-1,this.name+1);var spliceArgs=[this.name,1];for(var i=0;i<count;++i){spliceArgs.push(arguments[i])}var splicedOut=parentValue.splice.apply(parentValue,spliceArgs);assert.strictEqual(splicedOut[0],this.value);assert.strictEqual(parentValue.length,originalLength-1+count);move();if(count===0){delete this.value;delete parentCache[this.name];this.__childCache=null}else{assert.strictEqual(parentValue[this.name],replacement);if(this.value!==replacement){this.value=replacement;this.__childCache=null}for(i=0;i<count;++i){results.push(this.parentPath.get(this.name+i))}assert.strictEqual(results[0],this)}}else if(count===1){if(this.value!==replacement){this.__childCache=null}this.value=parentValue[this.name]=replacement;results.push(this)}else if(count===0){delete parentValue[this.name];delete this.value;this.__childCache=null}else{assert.ok(false,"Could not replace path")}return results};module.exports=Path},{"./types":73,assert:76}],71:[function(require,module,exports){var assert=require("assert");var types=require("./types");var Type=types.Type;var namedTypes=types.namedTypes;var Node=namedTypes.Node;
var isArray=types.builtInTypes.array;var hasOwn=Object.prototype.hasOwnProperty;var b=types.builders;function Scope(path,parentScope){assert.ok(this instanceof Scope);assert.ok(path instanceof require("./node-path"));ScopeType.assert(path.value);var depth;if(parentScope){assert.ok(parentScope instanceof Scope);depth=parentScope.depth+1}else{parentScope=null;depth=0}Object.defineProperties(this,{path:{value:path},node:{value:path.value},isGlobal:{value:!parentScope,enumerable:true},depth:{value:depth},parent:{value:parentScope},bindings:{value:{}}})}var scopeTypes=[namedTypes.Program,namedTypes.Function,namedTypes.CatchClause];var ScopeType=Type.or.apply(Type,scopeTypes);Scope.isEstablishedBy=function(node){return ScopeType.check(node)};var Sp=Scope.prototype;Sp.didScan=false;Sp.declares=function(name){this.scan();return hasOwn.call(this.bindings,name)};Sp.declareTemporary=function(prefix){if(prefix){assert.ok(/^[a-z$_]/i.test(prefix),prefix)}else{prefix="t$"}prefix+=this.depth.toString(36)+"$";this.scan();var index=0;while(this.declares(prefix+index)){++index}var name=prefix+index;return this.bindings[name]=types.builders.identifier(name)};Sp.injectTemporary=function(identifier,init){identifier||(identifier=this.declareTemporary());var bodyPath=this.path.get("body");if(namedTypes.BlockStatement.check(bodyPath.value)){bodyPath=bodyPath.get("body")}bodyPath.unshift(b.variableDeclaration("var",[b.variableDeclarator(identifier,init||null)]));return identifier};Sp.scan=function(force){if(force||!this.didScan){for(var name in this.bindings){delete this.bindings[name]}scanScope(this.path,this.bindings);this.didScan=true}};Sp.getBindings=function(){this.scan();return this.bindings};function scanScope(path,bindings){var node=path.value;ScopeType.assert(node);if(namedTypes.CatchClause.check(node)){addPattern(path.get("param"),bindings)}else{recursiveScanScope(path,bindings)}}function recursiveScanScope(path,bindings){var node=path.value;if(path.parent&&namedTypes.FunctionExpression.check(path.parent.node)&&path.parent.node.id){addPattern(path.parent.get("id"),bindings)}if(!node){}else if(isArray.check(node)){path.each(function(childPath){recursiveScanChild(childPath,bindings)})}else if(namedTypes.Function.check(node)){path.get("params").each(function(paramPath){addPattern(paramPath,bindings)});recursiveScanChild(path.get("body"),bindings)}else if(namedTypes.VariableDeclarator.check(node)){addPattern(path.get("id"),bindings);recursiveScanChild(path.get("init"),bindings)}else if(node.type==="ImportSpecifier"||node.type==="ImportNamespaceSpecifier"||node.type==="ImportDefaultSpecifier"){addPattern(node.name?path.get("name"):path.get("id"),bindings)}else if(Node.check(node)){types.eachField(node,function(name,child){var childPath=path.get(name);assert.strictEqual(childPath.value,child);recursiveScanChild(childPath,bindings)})}}function recursiveScanChild(path,bindings){var node=path.value;if(!node){}else if(namedTypes.FunctionDeclaration.check(node)){addPattern(path.get("id"),bindings)}else if(namedTypes.ClassDeclaration&&namedTypes.ClassDeclaration.check(node)){addPattern(path.get("id"),bindings)}else if(Scope.isEstablishedBy(node)){if(namedTypes.CatchClause.check(node)){var catchParamName=node.param.name;var hadBinding=hasOwn.call(bindings,catchParamName);recursiveScanScope(path.get("body"),bindings);if(!hadBinding){delete bindings[catchParamName]}}}else{recursiveScanScope(path,bindings)}}function addPattern(patternPath,bindings){var pattern=patternPath.value;namedTypes.Pattern.assert(pattern);if(namedTypes.Identifier.check(pattern)){if(hasOwn.call(bindings,pattern.name)){bindings[pattern.name].push(patternPath)}else{bindings[pattern.name]=[patternPath]}}else if(namedTypes.SpreadElement&&namedTypes.SpreadElement.check(pattern)){addPattern(patternPath.get("argument"),bindings)}}Sp.lookup=function(name){for(var scope=this;scope;scope=scope.parent)if(scope.declares(name))break;return scope};Sp.getGlobalScope=function(){var scope=this;while(!scope.isGlobal)scope=scope.parent;return scope};module.exports=Scope},{"./node-path":68,"./types":73,assert:76}],72:[function(require,module,exports){var types=require("../lib/types");var Type=types.Type;var builtin=types.builtInTypes;var isNumber=builtin.number;exports.geq=function(than){return new Type(function(value){return isNumber.check(value)&&value>=than},isNumber+" >= "+than)};exports.defaults={"null":function(){return null},emptyArray:function(){return[]},"false":function(){return false},"true":function(){return true},undefined:function(){}};var naiveIsPrimitive=Type.or(builtin.string,builtin.number,builtin.boolean,builtin.null,builtin.undefined);exports.isPrimitive=new Type(function(value){if(value===null)return true;var type=typeof value;return!(type==="object"||type==="function")},naiveIsPrimitive.toString())},{"../lib/types":73}],73:[function(require,module,exports){var assert=require("assert");var Ap=Array.prototype;var slice=Ap.slice;var map=Ap.map;var each=Ap.forEach;var Op=Object.prototype;var objToStr=Op.toString;var funObjStr=objToStr.call(function(){});var strObjStr=objToStr.call("");var hasOwn=Op.hasOwnProperty;function Type(check,name){var self=this;assert.ok(self instanceof Type,self);assert.strictEqual(objToStr.call(check),funObjStr,check+" is not a function");var nameObjStr=objToStr.call(name);assert.ok(nameObjStr===funObjStr||nameObjStr===strObjStr,name+" is neither a function nor a string");Object.defineProperties(self,{name:{value:name},check:{value:function(value,deep){var result=check.call(self,value,deep);if(!result&&deep&&objToStr.call(deep)===funObjStr)deep(self,value);return result}}})}var Tp=Type.prototype;exports.Type=Type;Tp.assert=function(value,deep){if(!this.check(value,deep)){var str=shallowStringify(value);assert.ok(false,str+" does not match type "+this);return false}return true};function shallowStringify(value){if(isObject.check(value))return"{"+Object.keys(value).map(function(key){return key+": "+value[key]}).join(", ")+"}";if(isArray.check(value))return"["+value.map(shallowStringify).join(", ")+"]";return JSON.stringify(value)}Tp.toString=function(){var name=this.name;if(isString.check(name))return name;if(isFunction.check(name))return name.call(this)+"";return name+" type"};var builtInTypes={};exports.builtInTypes=builtInTypes;function defBuiltInType(example,name){var objStr=objToStr.call(example);Object.defineProperty(builtInTypes,name,{enumerable:true,value:new Type(function(value){return objToStr.call(value)===objStr},name)});return builtInTypes[name]}var isString=defBuiltInType("","string");var isFunction=defBuiltInType(function(){},"function");var isArray=defBuiltInType([],"array");var isObject=defBuiltInType({},"object");var isRegExp=defBuiltInType(/./,"RegExp");var isDate=defBuiltInType(new Date,"Date");var isNumber=defBuiltInType(3,"number");var isBoolean=defBuiltInType(true,"boolean");var isNull=defBuiltInType(null,"null");var isUndefined=defBuiltInType(void 0,"undefined");function toType(from,name){if(from instanceof Type)return from;if(from instanceof Def)return from.type;if(isArray.check(from))return Type.fromArray(from);if(isObject.check(from))return Type.fromObject(from);if(isFunction.check(from))return new Type(from,name);return new Type(function(value){return value===from},isUndefined.check(name)?function(){return from+""}:name)}Type.or=function(){var types=[];var len=arguments.length;for(var i=0;i<len;++i)types.push(toType(arguments[i]));return new Type(function(value,deep){for(var i=0;i<len;++i)if(types[i].check(value,deep))return true;return false},function(){return types.join(" | ")})};Type.fromArray=function(arr){assert.ok(isArray.check(arr));assert.strictEqual(arr.length,1,"only one element type is permitted for typed arrays");return toType(arr[0]).arrayOf()};Tp.arrayOf=function(){var elemType=this;return new Type(function(value,deep){return isArray.check(value)&&value.every(function(elem){return elemType.check(elem,deep)})},function(){return"["+elemType+"]"})};Type.fromObject=function(obj){var fields=Object.keys(obj).map(function(name){return new Field(name,obj[name])});return new Type(function(value,deep){return isObject.check(value)&&fields.every(function(field){return field.type.check(value[field.name],deep)})},function(){return"{ "+fields.join(", ")+" }"})};function Field(name,type,defaultFn,hidden){var self=this;assert.ok(self instanceof Field);isString.assert(name);type=toType(type);var properties={name:{value:name},type:{value:type},hidden:{value:!!hidden}};if(isFunction.check(defaultFn)){properties.defaultFn={value:defaultFn}}Object.defineProperties(self,properties)}var Fp=Field.prototype;Fp.toString=function(){return JSON.stringify(this.name)+": "+this.type};Fp.getValue=function(obj){var value=obj[this.name];if(!isUndefined.check(value))return value;if(this.defaultFn)value=this.defaultFn.call(obj);return value};Type.def=function(typeName){isString.assert(typeName);return hasOwn.call(defCache,typeName)?defCache[typeName]:defCache[typeName]=new Def(typeName)};var defCache=Object.create(null);function Def(typeName){var self=this;assert.ok(self instanceof Def);Object.defineProperties(self,{typeName:{value:typeName},baseNames:{value:[]},ownFields:{value:Object.create(null)},allSupertypes:{value:Object.create(null)},supertypeList:{value:[]},allFields:{value:Object.create(null)},fieldNames:{value:[]},type:{value:new Type(function(value,deep){return self.check(value,deep)},typeName)}})}Def.fromValue=function(value){if(value&&typeof value==="object"){var type=value.type;if(typeof type==="string"&&hasOwn.call(defCache,type)){var d=defCache[type];if(d.finalized){return d}}}return null};var Dp=Def.prototype;Dp.isSupertypeOf=function(that){if(that instanceof Def){assert.strictEqual(this.finalized,true);assert.strictEqual(that.finalized,true);return hasOwn.call(that.allSupertypes,this.typeName)}else{assert.ok(false,that+" is not a Def")}};exports.getSupertypeNames=function(typeName){assert.ok(hasOwn.call(defCache,typeName));var d=defCache[typeName];assert.strictEqual(d.finalized,true);return d.supertypeList.slice(1)};exports.computeSupertypeLookupTable=function(candidates){var table={};for(var typeName in defCache){if(hasOwn.call(defCache,typeName)){var d=defCache[typeName];assert.strictEqual(d.finalized,true);for(var i=0;i<d.supertypeList.length;++i){var superTypeName=d.supertypeList[i];if(hasOwn.call(candidates,superTypeName)){table[typeName]=superTypeName;break}}}}return table};Dp.checkAllFields=function(value,deep){var allFields=this.allFields;assert.strictEqual(this.finalized,true);function checkFieldByName(name){var field=allFields[name];var type=field.type;var child=field.getValue(value);return type.check(child,deep)}return isObject.check(value)&&Object.keys(allFields).every(checkFieldByName)};Dp.check=function(value,deep){assert.strictEqual(this.finalized,true,"prematurely checking unfinalized type "+this.typeName);if(!isObject.check(value))return false;var vDef=Def.fromValue(value);if(!vDef){if(this.typeName==="SourceLocation"||this.typeName==="Position"){return this.checkAllFields(value,deep)}return false}if(deep&&vDef===this)return this.checkAllFields(value,deep);if(!this.isSupertypeOf(vDef))return false;if(!deep)return true;return vDef.checkAllFields(value,deep)&&this.checkAllFields(value,false)};Dp.bases=function(){var bases=this.baseNames;assert.strictEqual(this.finalized,false);each.call(arguments,function(baseName){isString.assert(baseName);if(bases.indexOf(baseName)<0)bases.push(baseName)});return this};Object.defineProperty(Dp,"buildable",{value:false});var builders={};exports.builders=builders;var nodePrototype={};exports.defineMethod=function(name,func){var old=nodePrototype[name];if(isUndefined.check(func)){delete nodePrototype[name]}else{isFunction.assert(func);Object.defineProperty(nodePrototype,name,{enumerable:true,configurable:true,value:func})}return old};Dp.build=function(){var self=this;Object.defineProperty(self,"buildParams",{value:slice.call(arguments),writable:false,enumerable:false,configurable:true});assert.strictEqual(self.finalized,false);isString.arrayOf().assert(self.buildParams);if(self.buildable){return self}self.field("type",self.typeName,function(){return self.typeName});Object.defineProperty(self,"buildable",{value:true});Object.defineProperty(builders,getBuilderName(self.typeName),{enumerable:true,value:function(){var args=arguments;var argc=args.length;var built=Object.create(nodePrototype);assert.ok(self.finalized,"attempting to instantiate unfinalized type "+self.typeName);function add(param,i){if(hasOwn.call(built,param))return;var all=self.allFields;assert.ok(hasOwn.call(all,param),param);var field=all[param];var type=field.type;var value;if(isNumber.check(i)&&i<argc){value=args[i]}else if(field.defaultFn){value=field.defaultFn.call(built)}else{var message="no value or default function given for field "+JSON.stringify(param)+" of "+self.typeName+"("+self.buildParams.map(function(name){return all[name]}).join(", ")+")";assert.ok(false,message)}assert.ok(type.check(value),shallowStringify(value)+" does not match field "+field+" of type "+self.typeName);built[param]=value}self.buildParams.forEach(function(param,i){add(param,i)});Object.keys(self.allFields).forEach(function(param){add(param)});assert.strictEqual(built.type,self.typeName);return built}});return self};function getBuilderName(typeName){return typeName.replace(/^[A-Z]+/,function(upperCasePrefix){var len=upperCasePrefix.length;switch(len){case 0:return"";case 1:return upperCasePrefix.toLowerCase();default:return upperCasePrefix.slice(0,len-1).toLowerCase()+upperCasePrefix.charAt(len-1)}})}Dp.field=function(name,type,defaultFn,hidden){assert.strictEqual(this.finalized,false);this.ownFields[name]=new Field(name,type,defaultFn,hidden);return this};var namedTypes={};exports.namedTypes=namedTypes;function getFieldNames(object){var d=Def.fromValue(object);if(d){return d.fieldNames.slice(0)}assert.strictEqual("type"in object,false,"did not recognize object of type "+JSON.stringify(object.type));return Object.keys(object)}exports.getFieldNames=getFieldNames;function getFieldValue(object,fieldName){var d=Def.fromValue(object);if(d){var field=d.allFields[fieldName];if(field){return field.getValue(object)}}return object[fieldName]}exports.getFieldValue=getFieldValue;exports.eachField=function(object,callback,context){getFieldNames(object).forEach(function(name){callback.call(this,name,getFieldValue(object,name))},context)};exports.someField=function(object,callback,context){return getFieldNames(object).some(function(name){return callback.call(this,name,getFieldValue(object,name))},context)};Object.defineProperty(Dp,"finalized",{value:false});Dp.finalize=function(){if(!this.finalized){var allFields=this.allFields;var allSupertypes=this.allSupertypes;this.baseNames.forEach(function(name){var def=defCache[name];def.finalize();extend(allFields,def.allFields);extend(allSupertypes,def.allSupertypes)});extend(allFields,this.ownFields);allSupertypes[this.typeName]=this;this.fieldNames.length=0;for(var fieldName in allFields){if(hasOwn.call(allFields,fieldName)&&!allFields[fieldName].hidden){this.fieldNames.push(fieldName)}}Object.defineProperty(namedTypes,this.typeName,{enumerable:true,value:this.type});Object.defineProperty(this,"finalized",{value:true});populateSupertypeList(this.typeName,this.supertypeList)}};function populateSupertypeList(typeName,list){list.length=0;list.push(typeName);var lastSeen=Object.create(null);for(var pos=0;pos<list.length;++pos){typeName=list[pos];var d=defCache[typeName];assert.strictEqual(d.finalized,true);if(hasOwn.call(lastSeen,typeName)){delete list[lastSeen[typeName]]}lastSeen[typeName]=pos;list.push.apply(list,d.baseNames)}for(var to=0,from=to,len=list.length;from<len;++from){if(hasOwn.call(list,from)){list[to++]=list[from]}}list.length=to}function extend(into,from){Object.keys(from).forEach(function(name){into[name]=from[name]});return into}exports.finalize=function(){Object.keys(defCache).forEach(function(name){defCache[name].finalize()})}},{assert:76}],74:[function(require,module,exports){var types=require("./lib/types");require("./def/core");require("./def/es6");require("./def/es7");require("./def/mozilla");require("./def/e4x");require("./def/fb-harmony");types.finalize();exports.Type=types.Type;exports.builtInTypes=types.builtInTypes;exports.namedTypes=types.namedTypes;exports.builders=types.builders;exports.defineMethod=types.defineMethod;exports.getFieldNames=types.getFieldNames;exports.getFieldValue=types.getFieldValue;exports.eachField=types.eachField;exports.someField=types.someField;exports.getSupertypeNames=types.getSupertypeNames;exports.astNodesAreEquivalent=require("./lib/equiv");exports.finalize=types.finalize;exports.NodePath=require("./lib/node-path");exports.PathVisitor=require("./lib/path-visitor");exports.visit=exports.PathVisitor.visit},{"./def/core":61,"./def/e4x":62,"./def/es6":63,"./def/es7":64,"./def/fb-harmony":65,"./def/mozilla":66,"./lib/equiv":67,"./lib/node-path":68,"./lib/path-visitor":69,"./lib/types":73}],75:[function(require,module,exports){},{}],76:[function(require,module,exports){var util=require("util/");var pSlice=Array.prototype.slice;var hasOwn=Object.prototype.hasOwnProperty;var assert=module.exports=ok;assert.AssertionError=function AssertionError(options){this.name="AssertionError";this.actual=options.actual;this.expected=options.expected;this.operator=options.operator;if(options.message){this.message=options.message;this.generatedMessage=false}else{this.message=getMessage(this);this.generatedMessage=true}var stackStartFunction=options.stackStartFunction||fail;if(Error.captureStackTrace){Error.captureStackTrace(this,stackStartFunction)}else{var err=new Error;if(err.stack){var out=err.stack;var fn_name=stackStartFunction.name;var idx=out.indexOf("\n"+fn_name);if(idx>=0){var next_line=out.indexOf("\n",idx+1);out=out.substring(next_line+1)}this.stack=out}}};util.inherits(assert.AssertionError,Error);function replacer(key,value){if(util.isUndefined(value)){return""+value}if(util.isNumber(value)&&(isNaN(value)||!isFinite(value))){return value.toString()}if(util.isFunction(value)||util.isRegExp(value)){return value.toString()}return value}function truncate(s,n){if(util.isString(s)){return s.length<n?s:s.slice(0,n)}else{return s}}function getMessage(self){return truncate(JSON.stringify(self.actual,replacer),128)+" "+self.operator+" "+truncate(JSON.stringify(self.expected,replacer),128)}function fail(actual,expected,message,operator,stackStartFunction){throw new assert.AssertionError({message:message,actual:actual,expected:expected,operator:operator,stackStartFunction:stackStartFunction})}assert.fail=fail;function ok(value,message){if(!value)fail(value,true,message,"==",assert.ok)}assert.ok=ok;assert.equal=function equal(actual,expected,message){if(actual!=expected)fail(actual,expected,message,"==",assert.equal)};assert.notEqual=function notEqual(actual,expected,message){if(actual==expected){fail(actual,expected,message,"!=",assert.notEqual)}};assert.deepEqual=function deepEqual(actual,expected,message){if(!_deepEqual(actual,expected)){fail(actual,expected,message,"deepEqual",assert.deepEqual)}};function _deepEqual(actual,expected){if(actual===expected){return true}else if(util.isBuffer(actual)&&util.isBuffer(expected)){if(actual.length!=expected.length)return false;for(var i=0;i<actual.length;i++){if(actual[i]!==expected[i])return false}return true}else if(util.isDate(actual)&&util.isDate(expected)){return actual.getTime()===expected.getTime()}else if(util.isRegExp(actual)&&util.isRegExp(expected)){return actual.source===expected.source&&actual.global===expected.global&&actual.multiline===expected.multiline&&actual.lastIndex===expected.lastIndex&&actual.ignoreCase===expected.ignoreCase}else if(!util.isObject(actual)&&!util.isObject(expected)){return actual==expected}else{return objEquiv(actual,expected)}}function isArguments(object){return Object.prototype.toString.call(object)=="[object Arguments]"}function objEquiv(a,b){if(util.isNullOrUndefined(a)||util.isNullOrUndefined(b))return false;if(a.prototype!==b.prototype)return false;if(isArguments(a)){if(!isArguments(b)){return false}a=pSlice.call(a);b=pSlice.call(b);return _deepEqual(a,b)}try{var ka=objectKeys(a),kb=objectKeys(b),key,i}catch(e){return false}if(ka.length!=kb.length)return false;ka.sort();kb.sort();for(i=ka.length-1;i>=0;i--){if(ka[i]!=kb[i])return false}for(i=ka.length-1;i>=0;i--){key=ka[i];if(!_deepEqual(a[key],b[key]))return false}return true}assert.notDeepEqual=function notDeepEqual(actual,expected,message){if(_deepEqual(actual,expected)){fail(actual,expected,message,"notDeepEqual",assert.notDeepEqual)}};assert.strictEqual=function strictEqual(actual,expected,message){if(actual!==expected){fail(actual,expected,message,"===",assert.strictEqual)}};assert.notStrictEqual=function notStrictEqual(actual,expected,message){if(actual===expected){fail(actual,expected,message,"!==",assert.notStrictEqual)}};function expectedException(actual,expected){if(!actual||!expected){return false}if(Object.prototype.toString.call(expected)=="[object RegExp]"){return expected.test(actual)}else if(actual instanceof expected){return true}else if(expected.call({},actual)===true){return true}return false}function _throws(shouldThrow,block,expected,message){var actual;if(util.isString(expected)){message=expected;expected=null}try{block()}catch(e){actual=e}message=(expected&&expected.name?" ("+expected.name+").":".")+(message?" "+message:".");if(shouldThrow&&!actual){fail(actual,expected,"Missing expected exception"+message)}if(!shouldThrow&&expectedException(actual,expected)){fail(actual,expected,"Got unwanted exception"+message)}if(shouldThrow&&actual&&expected&&!expectedException(actual,expected)||!shouldThrow&&actual){throw actual}}assert.throws=function(block,error,message){_throws.apply(this,[true].concat(pSlice.call(arguments)))};assert.doesNotThrow=function(block,message){_throws.apply(this,[false].concat(pSlice.call(arguments)))};assert.ifError=function(err){if(err){throw err}};var objectKeys=Object.keys||function(obj){var keys=[];for(var key in obj){if(hasOwn.call(obj,key))keys.push(key)}return keys}},{"util/":85}],77:[function(require,module,exports){var base64=require("base64-js");var ieee754=require("ieee754");var isArray=require("is-array");exports.Buffer=Buffer;exports.SlowBuffer=Buffer;exports.INSPECT_MAX_BYTES=50;Buffer.poolSize=8192;var kMaxLength=1073741823;Buffer.TYPED_ARRAY_SUPPORT=function(){try{var buf=new ArrayBuffer(0);var arr=new Uint8Array(buf);arr.foo=function(){return 42};return 42===arr.foo()&&typeof arr.subarray==="function"&&new Uint8Array(1).subarray(1,1).byteLength===0}catch(e){return false}}();function Buffer(subject,encoding,noZero){if(!(this instanceof Buffer))return new Buffer(subject,encoding,noZero);var type=typeof subject;var length;if(type==="number")length=subject>0?subject>>>0:0;else if(type==="string"){if(encoding==="base64")subject=base64clean(subject);length=Buffer.byteLength(subject,encoding)}else if(type==="object"&&subject!==null){if(subject.type==="Buffer"&&isArray(subject.data))subject=subject.data;length=+subject.length>0?Math.floor(+subject.length):0}else throw new TypeError("must start with number, buffer, array or string");if(this.length>kMaxLength)throw new RangeError("Attempt to allocate Buffer larger than maximum "+"size: 0x"+kMaxLength.toString(16)+" bytes");var buf;if(Buffer.TYPED_ARRAY_SUPPORT){buf=Buffer._augment(new Uint8Array(length))}else{buf=this;buf.length=length;buf._isBuffer=true}var i;if(Buffer.TYPED_ARRAY_SUPPORT&&typeof subject.byteLength==="number"){buf._set(subject)}else if(isArrayish(subject)){if(Buffer.isBuffer(subject)){for(i=0;i<length;i++)buf[i]=subject.readUInt8(i)}else{for(i=0;i<length;i++)buf[i]=(subject[i]%256+256)%256}}else if(type==="string"){buf.write(subject,0,encoding)}else if(type==="number"&&!Buffer.TYPED_ARRAY_SUPPORT&&!noZero){for(i=0;i<length;i++){buf[i]=0}}return buf}Buffer.isBuffer=function(b){return!!(b!=null&&b._isBuffer)};Buffer.compare=function(a,b){if(!Buffer.isBuffer(a)||!Buffer.isBuffer(b))throw new TypeError("Arguments must be Buffers");var x=a.length;var y=b.length;for(var i=0,len=Math.min(x,y);i<len&&a[i]===b[i];i++){}if(i!==len){x=a[i];y=b[i]}if(x<y)return-1;if(y<x)return 1;return 0};Buffer.isEncoding=function(encoding){switch(String(encoding).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 true;default:return false}};Buffer.concat=function(list,totalLength){if(!isArray(list))throw new TypeError("Usage: Buffer.concat(list[, length])");if(list.length===0){return new Buffer(0)}else if(list.length===1){return list[0]}var i;if(totalLength===undefined){totalLength=0;for(i=0;i<list.length;i++){totalLength+=list[i].length}}var buf=new Buffer(totalLength);var pos=0;for(i=0;i<list.length;i++){var item=list[i];item.copy(buf,pos);pos+=item.length}return buf};Buffer.byteLength=function(str,encoding){var ret;str=str+"";switch(encoding||"utf8"){case"ascii":case"binary":case"raw":ret=str.length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":ret=str.length*2;break;case"hex":ret=str.length>>>1;break;case"utf8":case"utf-8":ret=utf8ToBytes(str).length;break;case"base64":ret=base64ToBytes(str).length;break;default:ret=str.length}return ret};Buffer.prototype.length=undefined;Buffer.prototype.parent=undefined;Buffer.prototype.toString=function(encoding,start,end){var loweredCase=false;start=start>>>0;end=end===undefined||end===Infinity?this.length:end>>>0;if(!encoding)encoding="utf8";if(start<0)start=0;if(end>this.length)end=this.length;if(end<=start)return"";while(true){switch(encoding){case"hex":return hexSlice(this,start,end);case"utf8":case"utf-8":return utf8Slice(this,start,end);case"ascii":return asciiSlice(this,start,end);case"binary":return binarySlice(this,start,end);case"base64":return base64Slice(this,start,end);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,start,end);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(encoding+"").toLowerCase();loweredCase=true}}};Buffer.prototype.equals=function(b){if(!Buffer.isBuffer(b))throw new TypeError("Argument must be a Buffer");return Buffer.compare(this,b)===0};Buffer.prototype.inspect=function(){var str="";var max=exports.INSPECT_MAX_BYTES;if(this.length>0){str=this.toString("hex",0,max).match(/.{2}/g).join(" ");if(this.length>max)str+=" ... "}return"<Buffer "+str+">"};Buffer.prototype.compare=function(b){if(!Buffer.isBuffer(b))throw new TypeError("Argument must be a Buffer");return Buffer.compare(this,b)};Buffer.prototype.get=function(offset){console.log(".get() is deprecated. Access using array indexes instead.");return this.readUInt8(offset)};Buffer.prototype.set=function(v,offset){console.log(".set() is deprecated. Access using array indexes instead.");return this.writeUInt8(v,offset)};function hexWrite(buf,string,offset,length){offset=Number(offset)||0;var remaining=buf.length-offset;if(!length){length=remaining}else{length=Number(length);if(length>remaining){length=remaining}}var strLen=string.length;if(strLen%2!==0)throw new Error("Invalid hex string");if(length>strLen/2){length=strLen/2}for(var i=0;i<length;i++){var byte=parseInt(string.substr(i*2,2),16);if(isNaN(byte))throw new Error("Invalid hex string");buf[offset+i]=byte}return i}function utf8Write(buf,string,offset,length){var charsWritten=blitBuffer(utf8ToBytes(string),buf,offset,length);return charsWritten}function asciiWrite(buf,string,offset,length){var charsWritten=blitBuffer(asciiToBytes(string),buf,offset,length);return charsWritten}function binaryWrite(buf,string,offset,length){return asciiWrite(buf,string,offset,length)}function base64Write(buf,string,offset,length){var charsWritten=blitBuffer(base64ToBytes(string),buf,offset,length);return charsWritten}function utf16leWrite(buf,string,offset,length){var charsWritten=blitBuffer(utf16leToBytes(string),buf,offset,length);return charsWritten}Buffer.prototype.write=function(string,offset,length,encoding){if(isFinite(offset)){if(!isFinite(length)){encoding=length;length=undefined}}else{var swap=encoding;encoding=offset;offset=length;length=swap}offset=Number(offset)||0;var remaining=this.length-offset;if(!length){length=remaining}else{length=Number(length);if(length>remaining){length=remaining}}encoding=String(encoding||"utf8").toLowerCase();var ret;switch(encoding){case"hex":ret=hexWrite(this,string,offset,length);break;case"utf8":case"utf-8":ret=utf8Write(this,string,offset,length);break;case"ascii":ret=asciiWrite(this,string,offset,length);break;case"binary":ret=binaryWrite(this,string,offset,length);break;case"base64":ret=base64Write(this,string,offset,length);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":ret=utf16leWrite(this,string,offset,length);break;default:throw new TypeError("Unknown encoding: "+encoding)}return ret};Buffer.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function base64Slice(buf,start,end){if(start===0&&end===buf.length){return base64.fromByteArray(buf)}else{return base64.fromByteArray(buf.slice(start,end))}}function utf8Slice(buf,start,end){var res="";var tmp="";end=Math.min(buf.length,end);for(var i=start;i<end;i++){if(buf[i]<=127){res+=decodeUtf8Char(tmp)+String.fromCharCode(buf[i]);tmp=""}else{tmp+="%"+buf[i].toString(16)}}return res+decodeUtf8Char(tmp)}function asciiSlice(buf,start,end){var ret="";end=Math.min(buf.length,end);for(var i=start;i<end;i++){ret+=String.fromCharCode(buf[i])}return ret}function binarySlice(buf,start,end){return asciiSlice(buf,start,end)}function hexSlice(buf,start,end){var len=buf.length;if(!start||start<0)start=0;if(!end||end<0||end>len)end=len;var out="";for(var i=start;i<end;i++){out+=toHex(buf[i])}return out}function utf16leSlice(buf,start,end){var bytes=buf.slice(start,end);var res="";for(var i=0;i<bytes.length;i+=2){res+=String.fromCharCode(bytes[i]+bytes[i+1]*256)}return res}Buffer.prototype.slice=function(start,end){var len=this.length;start=~~start;end=end===undefined?len:~~end;if(start<0){start+=len;if(start<0)start=0}else if(start>len){start=len}if(end<0){end+=len;if(end<0)end=0}else if(end>len){end=len}if(end<start)end=start;if(Buffer.TYPED_ARRAY_SUPPORT){return Buffer._augment(this.subarray(start,end))}else{var sliceLen=end-start;var newBuf=new Buffer(sliceLen,undefined,true);for(var i=0;i<sliceLen;i++){newBuf[i]=this[i+start]}return newBuf}};function checkOffset(offset,ext,length){if(offset%1!==0||offset<0)throw new RangeError("offset is not uint");if(offset+ext>length)throw new RangeError("Trying to access beyond buffer length")}Buffer.prototype.readUInt8=function(offset,noAssert){if(!noAssert)checkOffset(offset,1,this.length);return this[offset]};Buffer.prototype.readUInt16LE=function(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);return this[offset]|this[offset+1]<<8};Buffer.prototype.readUInt16BE=function(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);return this[offset]<<8|this[offset+1]};Buffer.prototype.readUInt32LE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return(this[offset]|this[offset+1]<<8|this[offset+2]<<16)+this[offset+3]*16777216};Buffer.prototype.readUInt32BE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]*16777216+(this[offset+1]<<16|this[offset+2]<<8|this[offset+3])};Buffer.prototype.readInt8=function(offset,noAssert){if(!noAssert)checkOffset(offset,1,this.length);if(!(this[offset]&128))return this[offset];return(255-this[offset]+1)*-1};Buffer.prototype.readInt16LE=function(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset]|this[offset+1]<<8;return val&32768?val|4294901760:val};Buffer.prototype.readInt16BE=function(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);
var val=this[offset+1]|this[offset]<<8;return val&32768?val|4294901760:val};Buffer.prototype.readInt32LE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]|this[offset+1]<<8|this[offset+2]<<16|this[offset+3]<<24};Buffer.prototype.readInt32BE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]<<24|this[offset+1]<<16|this[offset+2]<<8|this[offset+3]};Buffer.prototype.readFloatLE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,true,23,4)};Buffer.prototype.readFloatBE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,false,23,4)};Buffer.prototype.readDoubleLE=function(offset,noAssert){if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,true,52,8)};Buffer.prototype.readDoubleBE=function(offset,noAssert){if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,false,52,8)};function checkInt(buf,value,offset,ext,max,min){if(!Buffer.isBuffer(buf))throw new TypeError("buffer must be a Buffer instance");if(value>max||value<min)throw new TypeError("value is out of bounds");if(offset+ext>buf.length)throw new TypeError("index out of range")}Buffer.prototype.writeUInt8=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,1,255,0);if(!Buffer.TYPED_ARRAY_SUPPORT)value=Math.floor(value);this[offset]=value;return offset+1};function objectWriteUInt16(buf,value,offset,littleEndian){if(value<0)value=65535+value+1;for(var i=0,j=Math.min(buf.length-offset,2);i<j;i++){buf[offset+i]=(value&255<<8*(littleEndian?i:1-i))>>>(littleEndian?i:1-i)*8}}Buffer.prototype.writeUInt16LE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,65535,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value;this[offset+1]=value>>>8}else objectWriteUInt16(this,value,offset,true);return offset+2};Buffer.prototype.writeUInt16BE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,65535,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>8;this[offset+1]=value}else objectWriteUInt16(this,value,offset,false);return offset+2};function objectWriteUInt32(buf,value,offset,littleEndian){if(value<0)value=4294967295+value+1;for(var i=0,j=Math.min(buf.length-offset,4);i<j;i++){buf[offset+i]=value>>>(littleEndian?i:3-i)*8&255}}Buffer.prototype.writeUInt32LE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,4294967295,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset+3]=value>>>24;this[offset+2]=value>>>16;this[offset+1]=value>>>8;this[offset]=value}else objectWriteUInt32(this,value,offset,true);return offset+4};Buffer.prototype.writeUInt32BE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,4294967295,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value}else objectWriteUInt32(this,value,offset,false);return offset+4};Buffer.prototype.writeInt8=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,1,127,-128);if(!Buffer.TYPED_ARRAY_SUPPORT)value=Math.floor(value);if(value<0)value=255+value+1;this[offset]=value;return offset+1};Buffer.prototype.writeInt16LE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,32767,-32768);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value;this[offset+1]=value>>>8}else objectWriteUInt16(this,value,offset,true);return offset+2};Buffer.prototype.writeInt16BE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,32767,-32768);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>8;this[offset+1]=value}else objectWriteUInt16(this,value,offset,false);return offset+2};Buffer.prototype.writeInt32LE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value;this[offset+1]=value>>>8;this[offset+2]=value>>>16;this[offset+3]=value>>>24}else objectWriteUInt32(this,value,offset,true);return offset+4};Buffer.prototype.writeInt32BE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);if(value<0)value=4294967295+value+1;if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value}else objectWriteUInt32(this,value,offset,false);return offset+4};function checkIEEE754(buf,value,offset,ext,max,min){if(value>max||value<min)throw new TypeError("value is out of bounds");if(offset+ext>buf.length)throw new TypeError("index out of range")}function writeFloat(buf,value,offset,littleEndian,noAssert){if(!noAssert)checkIEEE754(buf,value,offset,4,3.4028234663852886e38,-3.4028234663852886e38);ieee754.write(buf,value,offset,littleEndian,23,4);return offset+4}Buffer.prototype.writeFloatLE=function(value,offset,noAssert){return writeFloat(this,value,offset,true,noAssert)};Buffer.prototype.writeFloatBE=function(value,offset,noAssert){return writeFloat(this,value,offset,false,noAssert)};function writeDouble(buf,value,offset,littleEndian,noAssert){if(!noAssert)checkIEEE754(buf,value,offset,8,1.7976931348623157e308,-1.7976931348623157e308);ieee754.write(buf,value,offset,littleEndian,52,8);return offset+8}Buffer.prototype.writeDoubleLE=function(value,offset,noAssert){return writeDouble(this,value,offset,true,noAssert)};Buffer.prototype.writeDoubleBE=function(value,offset,noAssert){return writeDouble(this,value,offset,false,noAssert)};Buffer.prototype.copy=function(target,target_start,start,end){var source=this;if(!start)start=0;if(!end&&end!==0)end=this.length;if(!target_start)target_start=0;if(end===start)return;if(target.length===0||source.length===0)return;if(end<start)throw new TypeError("sourceEnd < sourceStart");if(target_start<0||target_start>=target.length)throw new TypeError("targetStart out of bounds");if(start<0||start>=source.length)throw new TypeError("sourceStart out of bounds");if(end<0||end>source.length)throw new TypeError("sourceEnd out of bounds");if(end>this.length)end=this.length;if(target.length-target_start<end-start)end=target.length-target_start+start;var len=end-start;if(len<1e3||!Buffer.TYPED_ARRAY_SUPPORT){for(var i=0;i<len;i++){target[i+target_start]=this[i+start]}}else{target._set(this.subarray(start,start+len),target_start)}};Buffer.prototype.fill=function(value,start,end){if(!value)value=0;if(!start)start=0;if(!end)end=this.length;if(end<start)throw new TypeError("end < start");if(end===start)return;if(this.length===0)return;if(start<0||start>=this.length)throw new TypeError("start out of bounds");if(end<0||end>this.length)throw new TypeError("end out of bounds");var i;if(typeof value==="number"){for(i=start;i<end;i++){this[i]=value}}else{var bytes=utf8ToBytes(value.toString());var len=bytes.length;for(i=start;i<end;i++){this[i]=bytes[i%len]}}return this};Buffer.prototype.toArrayBuffer=function(){if(typeof Uint8Array!=="undefined"){if(Buffer.TYPED_ARRAY_SUPPORT){return new Buffer(this).buffer}else{var buf=new Uint8Array(this.length);for(var i=0,len=buf.length;i<len;i+=1){buf[i]=this[i]}return buf.buffer}}else{throw new TypeError("Buffer.toArrayBuffer not supported in this browser")}};var BP=Buffer.prototype;Buffer._augment=function(arr){arr.constructor=Buffer;arr._isBuffer=true;arr._get=arr.get;arr._set=arr.set;arr.get=BP.get;arr.set=BP.set;arr.write=BP.write;arr.toString=BP.toString;arr.toLocaleString=BP.toString;arr.toJSON=BP.toJSON;arr.equals=BP.equals;arr.compare=BP.compare;arr.copy=BP.copy;arr.slice=BP.slice;arr.readUInt8=BP.readUInt8;arr.readUInt16LE=BP.readUInt16LE;arr.readUInt16BE=BP.readUInt16BE;arr.readUInt32LE=BP.readUInt32LE;arr.readUInt32BE=BP.readUInt32BE;arr.readInt8=BP.readInt8;arr.readInt16LE=BP.readInt16LE;arr.readInt16BE=BP.readInt16BE;arr.readInt32LE=BP.readInt32LE;arr.readInt32BE=BP.readInt32BE;arr.readFloatLE=BP.readFloatLE;arr.readFloatBE=BP.readFloatBE;arr.readDoubleLE=BP.readDoubleLE;arr.readDoubleBE=BP.readDoubleBE;arr.writeUInt8=BP.writeUInt8;arr.writeUInt16LE=BP.writeUInt16LE;arr.writeUInt16BE=BP.writeUInt16BE;arr.writeUInt32LE=BP.writeUInt32LE;arr.writeUInt32BE=BP.writeUInt32BE;arr.writeInt8=BP.writeInt8;arr.writeInt16LE=BP.writeInt16LE;arr.writeInt16BE=BP.writeInt16BE;arr.writeInt32LE=BP.writeInt32LE;arr.writeInt32BE=BP.writeInt32BE;arr.writeFloatLE=BP.writeFloatLE;arr.writeFloatBE=BP.writeFloatBE;arr.writeDoubleLE=BP.writeDoubleLE;arr.writeDoubleBE=BP.writeDoubleBE;arr.fill=BP.fill;arr.inspect=BP.inspect;arr.toArrayBuffer=BP.toArrayBuffer;return arr};var INVALID_BASE64_RE=/[^+\/0-9A-z]/g;function base64clean(str){str=stringtrim(str).replace(INVALID_BASE64_RE,"");while(str.length%4!==0){str=str+"="}return str}function stringtrim(str){if(str.trim)return str.trim();return str.replace(/^\s+|\s+$/g,"")}function isArrayish(subject){return isArray(subject)||Buffer.isBuffer(subject)||subject&&typeof subject==="object"&&typeof subject.length==="number"}function toHex(n){if(n<16)return"0"+n.toString(16);return n.toString(16)}function utf8ToBytes(str){var byteArray=[];for(var i=0;i<str.length;i++){var b=str.charCodeAt(i);if(b<=127){byteArray.push(b)}else{var start=i;if(b>=55296&&b<=57343)i++;var h=encodeURIComponent(str.slice(start,i+1)).substr(1).split("%");for(var j=0;j<h.length;j++){byteArray.push(parseInt(h[j],16))}}}return byteArray}function asciiToBytes(str){var byteArray=[];for(var i=0;i<str.length;i++){byteArray.push(str.charCodeAt(i)&255)}return byteArray}function utf16leToBytes(str){var c,hi,lo;var byteArray=[];for(var i=0;i<str.length;i++){c=str.charCodeAt(i);hi=c>>8;lo=c%256;byteArray.push(lo);byteArray.push(hi)}return byteArray}function base64ToBytes(str){return base64.toByteArray(str)}function blitBuffer(src,dst,offset,length){for(var i=0;i<length;i++){if(i+offset>=dst.length||i>=src.length)break;dst[i+offset]=src[i]}return i}function decodeUtf8Char(str){try{return decodeURIComponent(str)}catch(err){return String.fromCharCode(65533)}}},{"base64-js":78,ieee754:79,"is-array":80}],78:[function(require,module,exports){var lookup="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";(function(exports){"use strict";var Arr=typeof Uint8Array!=="undefined"?Uint8Array:Array;var PLUS="+".charCodeAt(0);var SLASH="/".charCodeAt(0);var NUMBER="0".charCodeAt(0);var LOWER="a".charCodeAt(0);var UPPER="A".charCodeAt(0);function decode(elt){var code=elt.charCodeAt(0);if(code===PLUS)return 62;if(code===SLASH)return 63;if(code<NUMBER)return-1;if(code<NUMBER+10)return code-NUMBER+26+26;if(code<UPPER+26)return code-UPPER;if(code<LOWER+26)return code-LOWER+26}function b64ToByteArray(b64){var i,j,l,tmp,placeHolders,arr;if(b64.length%4>0){throw new Error("Invalid string. Length must be a multiple of 4")}var len=b64.length;placeHolders="="===b64.charAt(len-2)?2:"="===b64.charAt(len-1)?1:0;arr=new Arr(b64.length*3/4-placeHolders);l=placeHolders>0?b64.length-4:b64.length;var L=0;function push(v){arr[L++]=v}for(i=0,j=0;i<l;i+=4,j+=3){tmp=decode(b64.charAt(i))<<18|decode(b64.charAt(i+1))<<12|decode(b64.charAt(i+2))<<6|decode(b64.charAt(i+3));push((tmp&16711680)>>16);push((tmp&65280)>>8);push(tmp&255)}if(placeHolders===2){tmp=decode(b64.charAt(i))<<2|decode(b64.charAt(i+1))>>4;push(tmp&255)}else if(placeHolders===1){tmp=decode(b64.charAt(i))<<10|decode(b64.charAt(i+1))<<4|decode(b64.charAt(i+2))>>2;push(tmp>>8&255);push(tmp&255)}return arr}function uint8ToBase64(uint8){var i,extraBytes=uint8.length%3,output="",temp,length;function encode(num){return lookup.charAt(num)}function tripletToBase64(num){return encode(num>>18&63)+encode(num>>12&63)+encode(num>>6&63)+encode(num&63)}for(i=0,length=uint8.length-extraBytes;i<length;i+=3){temp=(uint8[i]<<16)+(uint8[i+1]<<8)+uint8[i+2];output+=tripletToBase64(temp)}switch(extraBytes){case 1:temp=uint8[uint8.length-1];output+=encode(temp>>2);output+=encode(temp<<4&63);output+="==";break;case 2:temp=(uint8[uint8.length-2]<<8)+uint8[uint8.length-1];output+=encode(temp>>10);output+=encode(temp>>4&63);output+=encode(temp<<2&63);output+="=";break}return output}exports.toByteArray=b64ToByteArray;exports.fromByteArray=uint8ToBase64})(typeof exports==="undefined"?this.base64js={}:exports)},{}],79:[function(require,module,exports){exports.read=function(buffer,offset,isLE,mLen,nBytes){var e,m,eLen=nBytes*8-mLen-1,eMax=(1<<eLen)-1,eBias=eMax>>1,nBits=-7,i=isLE?nBytes-1:0,d=isLE?-1:1,s=buffer[offset+i];i+=d;e=s&(1<<-nBits)-1;s>>=-nBits;nBits+=eLen;for(;nBits>0;e=e*256+buffer[offset+i],i+=d,nBits-=8);m=e&(1<<-nBits)-1;e>>=-nBits;nBits+=mLen;for(;nBits>0;m=m*256+buffer[offset+i],i+=d,nBits-=8);if(e===0){e=1-eBias}else if(e===eMax){return m?NaN:(s?-1:1)*Infinity}else{m=m+Math.pow(2,mLen);e=e-eBias}return(s?-1:1)*m*Math.pow(2,e-mLen)};exports.write=function(buffer,value,offset,isLE,mLen,nBytes){var e,m,c,eLen=nBytes*8-mLen-1,eMax=(1<<eLen)-1,eBias=eMax>>1,rt=mLen===23?Math.pow(2,-24)-Math.pow(2,-77):0,i=isLE?0:nBytes-1,d=isLE?1:-1,s=value<0||value===0&&1/value<0?1:0;value=Math.abs(value);if(isNaN(value)||value===Infinity){m=isNaN(value)?1:0;e=eMax}else{e=Math.floor(Math.log(value)/Math.LN2);if(value*(c=Math.pow(2,-e))<1){e--;c*=2}if(e+eBias>=1){value+=rt/c}else{value+=rt*Math.pow(2,1-eBias)}if(value*c>=2){e++;c/=2}if(e+eBias>=eMax){m=0;e=eMax}else if(e+eBias>=1){m=(value*c-1)*Math.pow(2,mLen);e=e+eBias}else{m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen);e=0}}for(;mLen>=8;buffer[offset+i]=m&255,i+=d,m/=256,mLen-=8);e=e<<mLen|m;eLen+=mLen;for(;eLen>0;buffer[offset+i]=e&255,i+=d,e/=256,eLen-=8);buffer[offset+i-d]|=s*128}},{}],80:[function(require,module,exports){var isArray=Array.isArray;var str=Object.prototype.toString;module.exports=isArray||function(val){return!!val&&"[object Array]"==str.call(val)}},{}],81:[function(require,module,exports){if(typeof Object.create==="function"){module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:false,writable:true,configurable:true}})}}else{module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype;ctor.prototype=new TempCtor;ctor.prototype.constructor=ctor}}},{}],82:[function(require,module,exports){(function(process){function normalizeArray(parts,allowAboveRoot){var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==="."){parts.splice(i,1)}else if(last===".."){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up--;up){parts.unshift("..")}}return parts}var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;var splitPath=function(filename){return splitPathRe.exec(filename).slice(1)};exports.resolve=function(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:process.cwd();if(typeof path!=="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!path){continue}resolvedPath=path+"/"+resolvedPath;resolvedAbsolute=path.charAt(0)==="/"}resolvedPath=normalizeArray(filter(resolvedPath.split("/"),function(p){return!!p}),!resolvedAbsolute).join("/");return(resolvedAbsolute?"/":"")+resolvedPath||"."};exports.normalize=function(path){var isAbsolute=exports.isAbsolute(path),trailingSlash=substr(path,-1)==="/";path=normalizeArray(filter(path.split("/"),function(p){return!!p}),!isAbsolute).join("/");if(!path&&!isAbsolute){path="."}if(path&&trailingSlash){path+="/"}return(isAbsolute?"/":"")+path};exports.isAbsolute=function(path){return path.charAt(0)==="/"};exports.join=function(){var paths=Array.prototype.slice.call(arguments,0);return exports.normalize(filter(paths,function(p,index){if(typeof p!=="string"){throw new TypeError("Arguments to path.join must be strings")}return p}).join("/"))};exports.relative=function(from,to){from=exports.resolve(from).substr(1);to=exports.resolve(to).substr(1);function trim(arr){var start=0;for(;start<arr.length;start++){if(arr[start]!=="")break}var end=arr.length-1;for(;end>=0;end--){if(arr[end]!=="")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split("/"));var toParts=trim(to.split("/"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i<length;i++){if(fromParts[i]!==toParts[i]){samePartsLength=i;break}}var outputParts=[];for(var i=samePartsLength;i<fromParts.length;i++){outputParts.push("..")}outputParts=outputParts.concat(toParts.slice(samePartsLength));return outputParts.join("/")};exports.sep="/";exports.delimiter=":";exports.dirname=function(path){var result=splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){return"."}if(dir){dir=dir.substr(0,dir.length-1)}return root+dir};exports.basename=function(path,ext){var f=splitPath(path)[2];if(ext&&f.substr(-1*ext.length)===ext){f=f.substr(0,f.length-ext.length)}return f};exports.extname=function(path){return splitPath(path)[3]};function filter(xs,f){if(xs.filter)return xs.filter(f);var res=[];for(var i=0;i<xs.length;i++){if(f(xs[i],i,xs))res.push(xs[i])}return res}var substr="ab".substr(-1)==="b"?function(str,start,len){return str.substr(start,len)}:function(str,start,len){if(start<0)start=str.length+start;return str.substr(start,len)}}).call(this,require("_process"))},{_process:83}],83:[function(require,module,exports){var process=module.exports={};process.nextTick=function(){var canSetImmediate=typeof window!=="undefined"&&window.setImmediate;var canMutationObserver=typeof window!=="undefined"&&window.MutationObserver;var canPost=typeof window!=="undefined"&&window.postMessage&&window.addEventListener;if(canSetImmediate){return function(f){return window.setImmediate(f)}}var queue=[];if(canMutationObserver){var hiddenDiv=document.createElement("div");var observer=new MutationObserver(function(){var queueList=queue.slice();queue.length=0;queueList.forEach(function(fn){fn()})});observer.observe(hiddenDiv,{attributes:true});return function nextTick(fn){if(!queue.length){hiddenDiv.setAttribute("yes","no")}queue.push(fn)}}if(canPost){window.addEventListener("message",function(ev){var source=ev.source;if((source===window||source===null)&&ev.data==="process-tick"){ev.stopPropagation();if(queue.length>0){var fn=queue.shift();fn()}}},true);return function nextTick(fn){queue.push(fn);window.postMessage("process-tick","*")}}return function nextTick(fn){setTimeout(fn,0)}}();process.title="browser";process.browser=true;process.env={};process.argv=[];function noop(){}process.on=noop;process.addListener=noop;process.once=noop;process.off=noop;process.removeListener=noop;process.removeAllListeners=noop;process.emit=noop;process.binding=function(name){throw new Error("process.binding is not supported")};process.cwd=function(){return"/"};process.chdir=function(dir){throw new Error("process.chdir is not supported")}},{}],84:[function(require,module,exports){module.exports=function isBuffer(arg){return arg&&typeof arg==="object"&&typeof arg.copy==="function"&&typeof arg.fill==="function"&&typeof arg.readUInt8==="function"}},{}],85:[function(require,module,exports){(function(process,global){var formatRegExp=/%[sdj%]/g;exports.format=function(f){if(!isString(f)){var objects=[];for(var i=0;i<arguments.length;i++){objects.push(inspect(arguments[i]))}return objects.join(" ")}var i=1;var args=arguments;var len=args.length;var str=String(f).replace(formatRegExp,function(x){if(x==="%%")return"%";if(i>=len)return x;switch(x){case"%s":return String(args[i++]);case"%d":return Number(args[i++]);case"%j":try{return JSON.stringify(args[i++])}catch(_){return"[Circular]"}default:return x}});for(var x=args[i];i<len;x=args[++i]){if(isNull(x)||!isObject(x)){str+=" "+x}else{str+=" "+inspect(x)}}return str};exports.deprecate=function(fn,msg){if(isUndefined(global.process)){return function(){return exports.deprecate(fn,msg).apply(this,arguments)}}if(process.noDeprecation===true){return fn}var warned=false;function deprecated(){if(!warned){if(process.throwDeprecation){throw new Error(msg)}else if(process.traceDeprecation){console.trace(msg)}else{console.error(msg)}warned=true}return fn.apply(this,arguments)}return deprecated};var debugs={};var debugEnviron;exports.debuglog=function(set){if(isUndefined(debugEnviron))debugEnviron=process.env.NODE_DEBUG||"";set=set.toUpperCase();if(!debugs[set]){if(new RegExp("\\b"+set+"\\b","i").test(debugEnviron)){var pid=process.pid;debugs[set]=function(){var msg=exports.format.apply(exports,arguments);console.error("%s %d: %s",set,pid,msg)}}else{debugs[set]=function(){}}}return debugs[set]};function inspect(obj,opts){var ctx={seen:[],stylize:stylizeNoColor};if(arguments.length>=3)ctx.depth=arguments[2];if(arguments.length>=4)ctx.colors=arguments[3];if(isBoolean(opts)){ctx.showHidden=opts}else if(opts){exports._extend(ctx,opts)}if(isUndefined(ctx.showHidden))ctx.showHidden=false;if(isUndefined(ctx.depth))ctx.depth=2;if(isUndefined(ctx.colors))ctx.colors=false;if(isUndefined(ctx.customInspect))ctx.customInspect=true;if(ctx.colors)ctx.stylize=stylizeWithColor;return formatValue(ctx,obj,ctx.depth)}exports.inspect=inspect;inspect.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]};inspect.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"};function stylizeWithColor(str,styleType){var style=inspect.styles[styleType];if(style){return"["+inspect.colors[style][0]+"m"+str+"["+inspect.colors[style][1]+"m"}else{return str}}function stylizeNoColor(str,styleType){return str}function arrayToHash(array){var hash={};array.forEach(function(val,idx){hash[val]=true});return hash}function formatValue(ctx,value,recurseTimes){if(ctx.customInspect&&value&&isFunction(value.inspect)&&value.inspect!==exports.inspect&&!(value.constructor&&value.constructor.prototype===value)){var ret=value.inspect(recurseTimes,ctx);if(!isString(ret)){ret=formatValue(ctx,ret,recurseTimes)}return ret}var primitive=formatPrimitive(ctx,value);if(primitive){return primitive}var keys=Object.keys(value);var visibleKeys=arrayToHash(keys);if(ctx.showHidden){keys=Object.getOwnPropertyNames(value)}if(isError(value)&&(keys.indexOf("message")>=0||keys.indexOf("description")>=0)){return formatError(value)}if(keys.length===0){if(isFunction(value)){var name=value.name?": "+value.name:"";return ctx.stylize("[Function"+name+"]","special")}if(isRegExp(value)){return ctx.stylize(RegExp.prototype.toString.call(value),"regexp")}if(isDate(value)){return ctx.stylize(Date.prototype.toString.call(value),"date")}if(isError(value)){return formatError(value)}}var base="",array=false,braces=["{","}"];if(isArray(value)){array=true;braces=["[","]"]}if(isFunction(value)){var n=value.name?": "+value.name:"";base=" [Function"+n+"]"}if(isRegExp(value)){base=" "+RegExp.prototype.toString.call(value)}if(isDate(value)){base=" "+Date.prototype.toUTCString.call(value)}if(isError(value)){base=" "+formatError(value)}if(keys.length===0&&(!array||value.length==0)){return braces[0]+base+braces[1]}if(recurseTimes<0){if(isRegExp(value)){return ctx.stylize(RegExp.prototype.toString.call(value),"regexp")}else{return ctx.stylize("[Object]","special")}}ctx.seen.push(value);var output;if(array){output=formatArray(ctx,value,recurseTimes,visibleKeys,keys)}else{output=keys.map(function(key){return formatProperty(ctx,value,recurseTimes,visibleKeys,key,array)})}ctx.seen.pop();return reduceToSingleString(output,base,braces)}function formatPrimitive(ctx,value){if(isUndefined(value))return ctx.stylize("undefined","undefined");if(isString(value)){var simple="'"+JSON.stringify(value).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return ctx.stylize(simple,"string")}if(isNumber(value))return ctx.stylize(""+value,"number");if(isBoolean(value))return ctx.stylize(""+value,"boolean");if(isNull(value))return ctx.stylize("null","null")}function formatError(value){return"["+Error.prototype.toString.call(value)+"]"}function formatArray(ctx,value,recurseTimes,visibleKeys,keys){var output=[];for(var i=0,l=value.length;i<l;++i){if(hasOwnProperty(value,String(i))){output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,String(i),true))}else{output.push("")}}keys.forEach(function(key){if(!key.match(/^\d+$/)){output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,key,true))}});return output}function formatProperty(ctx,value,recurseTimes,visibleKeys,key,array){var name,str,desc;desc=Object.getOwnPropertyDescriptor(value,key)||{value:value[key]};if(desc.get){if(desc.set){str=ctx.stylize("[Getter/Setter]","special")}else{str=ctx.stylize("[Getter]","special")}}else{if(desc.set){str=ctx.stylize("[Setter]","special")}}if(!hasOwnProperty(visibleKeys,key)){name="["+key+"]"}if(!str){if(ctx.seen.indexOf(desc.value)<0){if(isNull(recurseTimes)){str=formatValue(ctx,desc.value,null)}else{str=formatValue(ctx,desc.value,recurseTimes-1)}if(str.indexOf("\n")>-1){if(array){str=str.split("\n").map(function(line){return" "+line}).join("\n").substr(2)}else{str="\n"+str.split("\n").map(function(line){return" "+line}).join("\n")}}}else{str=ctx.stylize("[Circular]","special")}}if(isUndefined(name)){if(array&&key.match(/^\d+$/)){return str}name=JSON.stringify(""+key);if(name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)){name=name.substr(1,name.length-2);name=ctx.stylize(name,"name")}else{name=name.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'");name=ctx.stylize(name,"string")}}return name+": "+str}function reduceToSingleString(output,base,braces){var numLinesEst=0;var length=output.reduce(function(prev,cur){numLinesEst++;if(cur.indexOf("\n")>=0)numLinesEst++;return prev+cur.replace(/\u001b\[\d\d?m/g,"").length+1},0);if(length>60){return braces[0]+(base===""?"":base+"\n ")+" "+output.join(",\n ")+" "+braces[1]}return braces[0]+base+" "+output.join(", ")+" "+braces[1]}function isArray(ar){return Array.isArray(ar)}exports.isArray=isArray;function isBoolean(arg){return typeof arg==="boolean"}exports.isBoolean=isBoolean;function isNull(arg){return arg===null}exports.isNull=isNull;function isNullOrUndefined(arg){return arg==null}exports.isNullOrUndefined=isNullOrUndefined;function isNumber(arg){return typeof arg==="number"}exports.isNumber=isNumber;function isString(arg){return typeof arg==="string"}exports.isString=isString;function isSymbol(arg){return typeof arg==="symbol"}exports.isSymbol=isSymbol;function isUndefined(arg){return arg===void 0}exports.isUndefined=isUndefined;function isRegExp(re){return isObject(re)&&objectToString(re)==="[object RegExp]"}exports.isRegExp=isRegExp;function isObject(arg){return typeof arg==="object"&&arg!==null}exports.isObject=isObject;function isDate(d){return isObject(d)&&objectToString(d)==="[object Date]"}exports.isDate=isDate;function isError(e){return isObject(e)&&(objectToString(e)==="[object Error]"||e instanceof Error)}exports.isError=isError;function isFunction(arg){return typeof arg==="function"}exports.isFunction=isFunction;function isPrimitive(arg){return arg===null||typeof arg==="boolean"||typeof arg==="number"||typeof arg==="string"||typeof arg==="symbol"||typeof arg==="undefined"}exports.isPrimitive=isPrimitive;exports.isBuffer=require("./support/isBuffer");function objectToString(o){return Object.prototype.toString.call(o)}function pad(n){return n<10?"0"+n.toString(10):n.toString(10)}var months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function timestamp(){var d=new Date;var time=[pad(d.getHours()),pad(d.getMinutes()),pad(d.getSeconds())].join(":");return[d.getDate(),months[d.getMonth()],time].join(" ")}exports.log=function(){console.log("%s - %s",timestamp(),exports.format.apply(exports,arguments))};exports.inherits=require("inherits");exports._extend=function(origin,add){if(!add||!isObject(add))return origin;var keys=Object.keys(add);var i=keys.length;while(i--){origin[keys[i]]=add[keys[i]]}return origin};function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}}).call(this,require("_process"),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./support/isBuffer":84,_process:83,inherits:81}],86:[function(require,module,exports){(function(root,factory){"use strict";if(typeof define==="function"&&define.amd){define(["exports"],factory)}else if(typeof exports!=="undefined"){factory(exports)}else{factory(root.estraverse={})}})(this,function(exports){"use strict";var Syntax,isArray,VisitorOption,VisitorKeys,objectCreate,objectKeys,BREAK,SKIP,REMOVE;function ignoreJSHintError(){}isArray=Array.isArray;if(!isArray){isArray=function isArray(array){return Object.prototype.toString.call(array)==="[object Array]"}}function deepCopy(obj){var ret={},key,val;for(key in obj){if(obj.hasOwnProperty(key)){val=obj[key];if(typeof val==="object"&&val!==null){ret[key]=deepCopy(val)}else{ret[key]=val}}}return ret}function shallowCopy(obj){var ret={},key;for(key in obj){if(obj.hasOwnProperty(key)){ret[key]=obj[key]}}return ret}ignoreJSHintError(shallowCopy);function upperBound(array,func){var diff,len,i,current;len=array.length;i=0;while(len){diff=len>>>1;current=i+diff;if(func(array[current])){len=diff}else{i=current+1;len-=diff+1}}return i}function lowerBound(array,func){var diff,len,i,current;len=array.length;i=0;while(len){diff=len>>>1;current=i+diff;if(func(array[current])){i=current+1;len-=diff+1}else{len=diff}}return i}ignoreJSHintError(lowerBound);objectCreate=Object.create||function(){function F(){}return function(o){F.prototype=o;return new F}}();objectKeys=Object.keys||function(o){var keys=[],key;for(key in o){keys.push(key)}return keys};function extend(to,from){objectKeys(from).forEach(function(key){to[key]=from[key]});return to}Syntax={AssignmentExpression:"AssignmentExpression",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",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"};
VisitorKeys={AssignmentExpression:["left","right"],ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","defaults","rest","body"],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"]};BREAK={};SKIP={};REMOVE={};VisitorOption={Break:BREAK,Skip:SKIP,Remove:REMOVE};function Reference(parent,key){this.parent=parent;this.key=key}Reference.prototype.replace=function replace(node){this.parent[this.key]=node};Reference.prototype.remove=function remove(){if(isArray(this.parent)){this.parent.splice(this.key,1);return true}else{this.replace(null);return false}};function Element(node,path,wrap,ref){this.node=node;this.path=path;this.wrap=wrap;this.ref=ref}function Controller(){}Controller.prototype.path=function path(){var i,iz,j,jz,result,element;function addToPath(result,path){if(isArray(path)){for(j=0,jz=path.length;j<jz;++j){result.push(path[j])}}else{result.push(path)}}if(!this.__current.path){return null}result=[];for(i=2,iz=this.__leavelist.length;i<iz;++i){element=this.__leavelist[i];addToPath(result,element.path)}addToPath(result,this.__current.path);return result};Controller.prototype.parents=function parents(){var i,iz,result;result=[];for(i=1,iz=this.__leavelist.length;i<iz;++i){result.push(this.__leavelist[i].node)}return result};Controller.prototype.current=function current(){return this.__current.node};Controller.prototype.__execute=function __execute(callback,element){var previous,result;result=undefined;previous=this.__current;this.__current=element;this.__state=null;if(callback){result=callback.call(this,element.node,this.__leavelist[this.__leavelist.length-1].node)}this.__current=previous;return result};Controller.prototype.notify=function notify(flag){this.__state=flag};Controller.prototype.skip=function(){this.notify(SKIP)};Controller.prototype["break"]=function(){this.notify(BREAK)};Controller.prototype.remove=function(){this.notify(REMOVE)};Controller.prototype.__initialize=function(root,visitor){this.visitor=visitor;this.root=root;this.__worklist=[];this.__leavelist=[];this.__current=null;this.__state=null;this.__fallback=visitor.fallback==="iteration";this.__keys=VisitorKeys;if(visitor.keys){this.__keys=extend(objectCreate(this.__keys),visitor.keys)}};function isNode(node){if(node==null){return false}return typeof node==="object"&&typeof node.type==="string"}function isProperty(nodeType,key){return(nodeType===Syntax.ObjectExpression||nodeType===Syntax.ObjectPattern)&&"properties"===key}Controller.prototype.traverse=function traverse(root,visitor){var worklist,leavelist,element,node,nodeType,ret,key,current,current2,candidates,candidate,sentinel;this.__initialize(root,visitor);sentinel={};worklist=this.__worklist;leavelist=this.__leavelist;worklist.push(new Element(root,null,null,null));leavelist.push(new Element(null,null,null,null));while(worklist.length){element=worklist.pop();if(element===sentinel){element=leavelist.pop();ret=this.__execute(visitor.leave,element);if(this.__state===BREAK||ret===BREAK){return}continue}if(element.node){ret=this.__execute(visitor.enter,element);if(this.__state===BREAK||ret===BREAK){return}worklist.push(sentinel);leavelist.push(element);if(this.__state===SKIP||ret===SKIP){continue}node=element.node;nodeType=element.wrap||node.type;candidates=this.__keys[nodeType];if(!candidates){if(this.__fallback){candidates=objectKeys(node)}else{throw new Error("Unknown node type "+nodeType+".")}}current=candidates.length;while((current-=1)>=0){key=candidates[current];candidate=node[key];if(!candidate){continue}if(isArray(candidate)){current2=candidate.length;while((current2-=1)>=0){if(!candidate[current2]){continue}if(isProperty(nodeType,candidates[current])){element=new Element(candidate[current2],[key,current2],"Property",null)}else if(isNode(candidate[current2])){element=new Element(candidate[current2],[key,current2],null,null)}else{continue}worklist.push(element)}}else if(isNode(candidate)){worklist.push(new Element(candidate,key,null,null))}}}}};Controller.prototype.replace=function replace(root,visitor){function removeElem(){var i,nextElem,parent;if(element.ref.remove()){parent=element.ref.parent;for(i=1;i<worklist.length;i++){nextElem=worklist[i];if(nextElem===sentinel||nextElem.ref.parent!==parent){break}nextElem.path[nextElem.path.length-1]=--nextElem.ref.key}}}var worklist,leavelist,node,nodeType,target,element,current,current2,candidates,candidate,sentinel,outer,key;this.__initialize(root,visitor);sentinel={};worklist=this.__worklist;leavelist=this.__leavelist;outer={root:root};element=new Element(root,null,null,new Reference(outer,"root"));worklist.push(element);leavelist.push(element);while(worklist.length){element=worklist.pop();if(element===sentinel){element=leavelist.pop();target=this.__execute(visitor.leave,element);if(target!==undefined&&target!==BREAK&&target!==SKIP&&target!==REMOVE){element.ref.replace(target)}if(this.__state===REMOVE||target===REMOVE){removeElem()}if(this.__state===BREAK||target===BREAK){return outer.root}continue}target=this.__execute(visitor.enter,element);if(target!==undefined&&target!==BREAK&&target!==SKIP&&target!==REMOVE){element.ref.replace(target);element.node=target}if(this.__state===REMOVE||target===REMOVE){removeElem();element.node=null}if(this.__state===BREAK||target===BREAK){return outer.root}node=element.node;if(!node){continue}worklist.push(sentinel);leavelist.push(element);if(this.__state===SKIP||target===SKIP){continue}nodeType=element.wrap||node.type;candidates=this.__keys[nodeType];if(!candidates){if(this.__fallback){candidates=objectKeys(node)}else{throw new Error("Unknown node type "+nodeType+".")}}current=candidates.length;while((current-=1)>=0){key=candidates[current];candidate=node[key];if(!candidate){continue}if(isArray(candidate)){current2=candidate.length;while((current2-=1)>=0){if(!candidate[current2]){continue}if(isProperty(nodeType,candidates[current])){element=new Element(candidate[current2],[key,current2],"Property",new Reference(candidate,current2))}else if(isNode(candidate[current2])){element=new Element(candidate[current2],[key,current2],null,new Reference(candidate,current2))}else{continue}worklist.push(element)}}else if(isNode(candidate)){worklist.push(new Element(candidate,key,null,new Reference(node,key)))}}}return outer.root};function traverse(root,visitor){var controller=new Controller;return controller.traverse(root,visitor)}function replace(root,visitor){var controller=new Controller;return controller.replace(root,visitor)}function extendCommentRange(comment,tokens){var target;target=upperBound(tokens,function search(token){return token.range[0]>comment.range[0]});comment.extendedRange=[comment.range[0],comment.range[1]];if(target!==tokens.length){comment.extendedRange[1]=tokens[target].range[0]}target-=1;if(target>=0){comment.extendedRange[0]=tokens[target].range[1]}return comment}function attachComments(tree,providedComments,tokens){var comments=[],comment,len,i,cursor;if(!tree.range){throw new Error("attachComments needs range information")}if(!tokens.length){if(providedComments.length){for(i=0,len=providedComments.length;i<len;i+=1){comment=deepCopy(providedComments[i]);comment.extendedRange=[0,tree.range[0]];comments.push(comment)}tree.leadingComments=comments}return tree}for(i=0,len=providedComments.length;i<len;i+=1){comments.push(extendCommentRange(deepCopy(providedComments[i]),tokens))}cursor=0;traverse(tree,{enter:function(node){var comment;while(cursor<comments.length){comment=comments[cursor];if(comment.extendedRange[1]>node.range[0]){break}if(comment.extendedRange[1]===node.range[0]){if(!node.leadingComments){node.leadingComments=[]}node.leadingComments.push(comment);comments.splice(cursor,1)}else{cursor+=1}}if(cursor===comments.length){return VisitorOption.Break}if(comments[cursor].extendedRange[0]>node.range[1]){return VisitorOption.Skip}}});cursor=0;traverse(tree,{leave:function(node){var comment;while(cursor<comments.length){comment=comments[cursor];if(node.range[1]<comment.extendedRange[0]){break}if(node.range[1]===comment.extendedRange[0]){if(!node.trailingComments){node.trailingComments=[]}node.trailingComments.push(comment);comments.splice(cursor,1)}else{cursor+=1}}if(cursor===comments.length){return VisitorOption.Break}if(comments[cursor].extendedRange[0]>node.range[1]){return VisitorOption.Skip}}});return tree}exports.version="1.5.1-dev";exports.Syntax=Syntax;exports.traverse=traverse;exports.replace=replace;exports.attachComments=attachComments;exports.VisitorKeys=VisitorKeys;exports.VisitorOption=VisitorOption;exports.Controller=Controller})},{}],87:[function(require,module,exports){(function(){"use strict";function isExpression(node){if(node==null){return false}switch(node.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 true}return false}function isIterationStatement(node){if(node==null){return false}switch(node.type){case"DoWhileStatement":case"ForInStatement":case"ForStatement":case"WhileStatement":return true}return false}function isStatement(node){if(node==null){return false}switch(node.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 true}return false}function isSourceElement(node){return isStatement(node)||node!=null&&node.type==="FunctionDeclaration"}function trailingStatement(node){switch(node.type){case"IfStatement":if(node.alternate!=null){return node.alternate}return node.consequent;case"LabeledStatement":case"ForStatement":case"ForInStatement":case"WhileStatement":case"WithStatement":return node.body}return null}function isProblematicIfStatement(node){var current;if(node.type!=="IfStatement"){return false}if(node.alternate==null){return false}current=node.consequent;do{if(current.type==="IfStatement"){if(current.alternate==null){return true}}current=trailingStatement(current)}while(current);return false}module.exports={isExpression:isExpression,isStatement:isStatement,isIterationStatement:isIterationStatement,isSourceElement:isSourceElement,isProblematicIfStatement:isProblematicIfStatement,trailingStatement:trailingStatement}})()},{}],88:[function(require,module,exports){(function(){"use strict";var Regex;Regex={NonAsciiIdentifierStart:new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]"),NonAsciiIdentifierPart:new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮ̀-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁ҃-҇Ҋ-ԧԱ-Ֆՙա-և֑-ׇֽֿׁׂׅׄא-תװ-ײؐ-ؚؠ-٩ٮ-ۓە-ۜ۟-۪ۨ-ۼۿܐ-݊ݍ-ޱ߀-ߵߺࠀ-࠭ࡀ-࡛ࢠࢢ-ࢬࣤ-ࣾऀ-ॣ०-९ॱ-ॷॹ-ॿঁ-ঃঅ-ঌএঐও-নপ-রলশ-হ়-ৄেৈো-ৎৗড়ঢ়য়-ৣ০-ৱਁ-ਃਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹ਼ਾ-ੂੇੈੋ-੍ੑਖ਼-ੜਫ਼੦-ੵઁ-ઃઅ-ઍએ-ઑઓ-નપ-રલળવ-હ઼-ૅે-ૉો-્ૐૠ-ૣ૦-૯ଁ-ଃଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହ଼-ୄେୈୋ-୍ୖୗଡ଼ଢ଼ୟ-ୣ୦-୯ୱஂஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-்ௐௗ௦-௯ఁ-ఃఅ-ఌఎ-ఐఒ-నప-ళవ-హఽ-ౄె-ైొ-్ౕౖౘౙౠ-ౣ౦-౯ಂಃಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹ಼-ೄೆ-ೈೊ-್ೕೖೞೠ-ೣ೦-೯ೱೲംഃഅ-ഌഎ-ഐഒ-ഺഽ-ൄെ-ൈൊ-ൎൗൠ-ൣ൦-൯ൺ-ൿංඃඅ-ඖක-නඳ-රලව-ෆ්ා-ුූෘ-ෟෲෳก-ฺเ-๎๐-๙ກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆ່-ໍ໐-໙ໜ-ໟༀ༘༙༠-༩༹༵༷༾-ཇཉ-ཬཱ-྄྆-ྗྙ-ྼ࿆က-၉ၐ-ႝႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚ፝-፟ᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-᜔ᜠ-᜴ᝀ-ᝓᝠ-ᝬᝮ-ᝰᝲᝳក-៓ៗៜ៝០-៩᠋-᠍᠐-᠙ᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤜᤠ-ᤫᤰ-᤻᥆-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉ᧐-᧙ᨀ-ᨛᨠ-ᩞ᩠-᩿᩼-᪉᪐-᪙ᪧᬀ-ᭋ᭐-᭙᭫-᭳ᮀ-᯳ᰀ-᰷᱀-᱉ᱍ-ᱽ᳐-᳔᳒-ᳶᴀ-ᷦ᷼-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼ‿⁀⁔ⁱⁿₐ-ₜ⃐-⃥⃜⃡-⃰ℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯ⵿-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⷠ-ⷿⸯ々-〇〡-〯〱-〵〸-〼ぁ-ゖ゙゚ゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘫꙀ-꙯ꙴ-꙽ꙿ-ꚗꚟ-꛱ꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠧꡀ-ꡳꢀ-꣄꣐-꣙꣠-ꣷꣻ꤀-꤭ꤰ-꥓ꥠ-ꥼꦀ-꧀ꧏ-꧙ꨀ-ꨶꩀ-ꩍ꩐-꩙ꩠ-ꩶꩺꩻꪀ-ꫂꫛ-ꫝꫠ-ꫯꫲ-꫶ꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯪ꯬꯭꯰-꯹가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻ︀-️︠-︦︳︴﹍-﹏ﹰ-ﹴﹶ-ﻼ0-9A-Z_a-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]")};function isDecimalDigit(ch){return ch>=48&&ch<=57}function isHexDigit(ch){return isDecimalDigit(ch)||97<=ch&&ch<=102||65<=ch&&ch<=70}function isOctalDigit(ch){return ch>=48&&ch<=55}function isWhiteSpace(ch){return ch===32||ch===9||ch===11||ch===12||ch===160||ch>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(ch)>=0}function isLineTerminator(ch){return ch===10||ch===13||ch===8232||ch===8233}function isIdentifierStart(ch){return ch===36||ch===95||ch>=65&&ch<=90||ch>=97&&ch<=122||ch===92||ch>=128&&Regex.NonAsciiIdentifierStart.test(String.fromCharCode(ch))}function isIdentifierPart(ch){return ch===36||ch===95||ch>=65&&ch<=90||ch>=97&&ch<=122||ch>=48&&ch<=57||ch===92||ch>=128&&Regex.NonAsciiIdentifierPart.test(String.fromCharCode(ch))}module.exports={isDecimalDigit:isDecimalDigit,isHexDigit:isHexDigit,isOctalDigit:isOctalDigit,isWhiteSpace:isWhiteSpace,isLineTerminator:isLineTerminator,isIdentifierStart:isIdentifierStart,isIdentifierPart:isIdentifierPart}})()},{}],89:[function(require,module,exports){(function(){"use strict";var code=require("./code");function isStrictModeReservedWordES6(id){switch(id){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"let":return true;default:return false}}function isKeywordES5(id,strict){if(!strict&&id==="yield"){return false}return isKeywordES6(id,strict)}function isKeywordES6(id,strict){if(strict&&isStrictModeReservedWordES6(id)){return true}switch(id.length){case 2:return id==="if"||id==="in"||id==="do";case 3:return id==="var"||id==="for"||id==="new"||id==="try";case 4:return id==="this"||id==="else"||id==="case"||id==="void"||id==="with"||id==="enum";case 5:return id==="while"||id==="break"||id==="catch"||id==="throw"||id==="const"||id==="yield"||id==="class"||id==="super";case 6:return id==="return"||id==="typeof"||id==="delete"||id==="switch"||id==="export"||id==="import";case 7:return id==="default"||id==="finally"||id==="extends";case 8:return id==="function"||id==="continue"||id==="debugger";case 10:return id==="instanceof";default:return false}}function isReservedWordES5(id,strict){return id==="null"||id==="true"||id==="false"||isKeywordES5(id,strict)}function isReservedWordES6(id,strict){return id==="null"||id==="true"||id==="false"||isKeywordES6(id,strict)}function isRestrictedWord(id){return id==="eval"||id==="arguments"}function isIdentifierName(id){var i,iz,ch;if(id.length===0){return false}ch=id.charCodeAt(0);if(!code.isIdentifierStart(ch)||ch===92){return false}for(i=1,iz=id.length;i<iz;++i){ch=id.charCodeAt(i);if(!code.isIdentifierPart(ch)||ch===92){return false}}return true}function isIdentifierES5(id,strict){return isIdentifierName(id)&&!isReservedWordES5(id,strict)}function isIdentifierES6(id,strict){return isIdentifierName(id)&&!isReservedWordES6(id,strict)}module.exports={isKeywordES5:isKeywordES5,isKeywordES6:isKeywordES6,isReservedWordES5:isReservedWordES5,isReservedWordES6:isReservedWordES6,isRestrictedWord:isRestrictedWord,isIdentifierName:isIdentifierName,isIdentifierES5:isIdentifierES5,isIdentifierES6:isIdentifierES6}})()},{"./code":88}],90:[function(require,module,exports){(function(){"use strict";exports.ast=require("./ast");exports.code=require("./code");exports.keyword=require("./keyword")})()},{"./ast":87,"./code":88,"./keyword":89}],91:[function(require,module,exports){(function(global){(function(){var undefined;var arrayPool=[],objectPool=[];var idCounter=0;var keyPrefix=+new Date+"";var largeArraySize=75;var maxPoolSize=40;var whitespace=" \f "+"\n\r\u2028\u2029"+" ";var reEmptyStringLeading=/\b__p \+= '';/g,reEmptyStringMiddle=/\b(__p \+=) '' \+/g,reEmptyStringTrailing=/(__e\(.*?\)|\b__t\)) \+\n'';/g;var reEsTemplate=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;var reFlags=/\w*$/;var reFuncName=/^\s*function[ \n\r\t]+\w/;var reInterpolate=/<%=([\s\S]+?)%>/g;var reLeadingSpacesAndZeros=RegExp("^["+whitespace+"]*0+(?=.$)");var reNoMatch=/($^)/;var reThis=/\bthis\b/;var reUnescapedString=/['\n\r\t\u2028\u2029\\]/g;var contextProps=["Array","Boolean","Date","Function","Math","Number","Object","RegExp","String","_","attachEvent","clearTimeout","isFinite","isNaN","parseInt","setTimeout"];var templateCounter=0;var argsClass="[object Arguments]",arrayClass="[object Array]",boolClass="[object Boolean]",dateClass="[object Date]",funcClass="[object Function]",numberClass="[object Number]",objectClass="[object Object]",regexpClass="[object RegExp]",stringClass="[object String]";var cloneableClasses={};cloneableClasses[funcClass]=false;cloneableClasses[argsClass]=cloneableClasses[arrayClass]=cloneableClasses[boolClass]=cloneableClasses[dateClass]=cloneableClasses[numberClass]=cloneableClasses[objectClass]=cloneableClasses[regexpClass]=cloneableClasses[stringClass]=true;var debounceOptions={leading:false,maxWait:0,trailing:false};var descriptor={configurable:false,enumerable:false,value:null,writable:false};var objectTypes={"boolean":false,"function":true,object:true,number:false,string:false,undefined:false};var stringEscapes={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"};var root=objectTypes[typeof window]&&window||this;var freeExports=objectTypes[typeof exports]&&exports&&!exports.nodeType&&exports;var freeModule=objectTypes[typeof module]&&module&&!module.nodeType&&module;var moduleExports=freeModule&&freeModule.exports===freeExports&&freeExports;var freeGlobal=objectTypes[typeof global]&&global;if(freeGlobal&&(freeGlobal.global===freeGlobal||freeGlobal.window===freeGlobal)){root=freeGlobal}function baseIndexOf(array,value,fromIndex){var index=(fromIndex||0)-1,length=array?array.length:0;while(++index<length){if(array[index]===value){return index}}return-1}function cacheIndexOf(cache,value){var type=typeof value;cache=cache.cache;if(type=="boolean"||value==null){return cache[value]?0:-1}if(type!="number"&&type!="string"){type="object"}var key=type=="number"?value:keyPrefix+value;cache=(cache=cache[type])&&cache[key];return type=="object"?cache&&baseIndexOf(cache,value)>-1?0:-1:cache?0:-1}function cachePush(value){var cache=this.cache,type=typeof value;if(type=="boolean"||value==null){cache[value]=true}else{if(type!="number"&&type!="string"){type="object"}var key=type=="number"?value:keyPrefix+value,typeCache=cache[type]||(cache[type]={});if(type=="object"){(typeCache[key]||(typeCache[key]=[])).push(value)}else{typeCache[key]=true}}}function charAtCallback(value){return value.charCodeAt(0)}function compareAscending(a,b){var ac=a.criteria,bc=b.criteria,index=-1,length=ac.length;while(++index<length){var value=ac[index],other=bc[index];if(value!==other){if(value>other||typeof value=="undefined"){return 1}if(value<other||typeof other=="undefined"){return-1}}}return a.index-b.index}function createCache(array){var index=-1,length=array.length,first=array[0],mid=array[length/2|0],last=array[length-1];if(first&&typeof first=="object"&&mid&&typeof mid=="object"&&last&&typeof last=="object"){return false}var cache=getObject();cache["false"]=cache["null"]=cache["true"]=cache["undefined"]=false;var result=getObject();result.array=array;result.cache=cache;result.push=cachePush;while(++index<length){result.push(array[index])}return result}function escapeStringChar(match){return"\\"+stringEscapes[match]}function getArray(){return arrayPool.pop()||[]}function getObject(){return objectPool.pop()||{array:null,cache:null,criteria:null,"false":false,index:0,"null":false,number:null,object:null,push:null,string:null,"true":false,undefined:false,value:null}}function releaseArray(array){array.length=0;if(arrayPool.length<maxPoolSize){arrayPool.push(array)}}function releaseObject(object){var cache=object.cache;if(cache){releaseObject(cache)}object.array=object.cache=object.criteria=object.object=object.number=object.string=object.value=null;if(objectPool.length<maxPoolSize){objectPool.push(object)}}function slice(array,start,end){start||(start=0);if(typeof end=="undefined"){end=array?array.length:0}var index=-1,length=end-start||0,result=Array(length<0?0:length);while(++index<length){result[index]=array[start+index]}return result}function runInContext(context){context=context?_.defaults(root.Object(),context,_.pick(root,contextProps)):root;var Array=context.Array,Boolean=context.Boolean,Date=context.Date,Function=context.Function,Math=context.Math,Number=context.Number,Object=context.Object,RegExp=context.RegExp,String=context.String,TypeError=context.TypeError;var arrayRef=[];var objectProto=Object.prototype;var oldDash=context._;var toString=objectProto.toString;var reNative=RegExp("^"+String(toString).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$");var ceil=Math.ceil,clearTimeout=context.clearTimeout,floor=Math.floor,fnToString=Function.prototype.toString,getPrototypeOf=isNative(getPrototypeOf=Object.getPrototypeOf)&&getPrototypeOf,hasOwnProperty=objectProto.hasOwnProperty,push=arrayRef.push,setTimeout=context.setTimeout,splice=arrayRef.splice,unshift=arrayRef.unshift;var defineProperty=function(){try{var o={},func=isNative(func=Object.defineProperty)&&func,result=func(o,o,o)&&func}catch(e){}return result}();var nativeCreate=isNative(nativeCreate=Object.create)&&nativeCreate,nativeIsArray=isNative(nativeIsArray=Array.isArray)&&nativeIsArray,nativeIsFinite=context.isFinite,nativeIsNaN=context.isNaN,nativeKeys=isNative(nativeKeys=Object.keys)&&nativeKeys,nativeMax=Math.max,nativeMin=Math.min,nativeParseInt=context.parseInt,nativeRandom=Math.random;var ctorByClass={};ctorByClass[arrayClass]=Array;ctorByClass[boolClass]=Boolean;ctorByClass[dateClass]=Date;ctorByClass[funcClass]=Function;ctorByClass[objectClass]=Object;ctorByClass[numberClass]=Number;ctorByClass[regexpClass]=RegExp;ctorByClass[stringClass]=String;function lodash(value){return value&&typeof value=="object"&&!isArray(value)&&hasOwnProperty.call(value,"__wrapped__")?value:new lodashWrapper(value)}function lodashWrapper(value,chainAll){this.__chain__=!!chainAll;this.__wrapped__=value}lodashWrapper.prototype=lodash.prototype;var support=lodash.support={};support.funcDecomp=!isNative(context.WinRTError)&&reThis.test(runInContext);support.funcNames=typeof Function.name=="string";lodash.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:reInterpolate,variable:"",imports:{_:lodash}};function baseBind(bindData){var func=bindData[0],partialArgs=bindData[2],thisArg=bindData[4];function bound(){if(partialArgs){var args=slice(partialArgs);push.apply(args,arguments)}if(this instanceof bound){var thisBinding=baseCreate(func.prototype),result=func.apply(thisBinding,args||arguments);return isObject(result)?result:thisBinding}return func.apply(thisArg,args||arguments)}setBindData(bound,bindData);return bound}function baseClone(value,isDeep,callback,stackA,stackB){if(callback){var result=callback(value);if(typeof result!="undefined"){return result}}var isObj=isObject(value);if(isObj){var className=toString.call(value);if(!cloneableClasses[className]){return value}var ctor=ctorByClass[className];switch(className){case boolClass:case dateClass:return new ctor(+value);case numberClass:case stringClass:return new ctor(value);case regexpClass:result=ctor(value.source,reFlags.exec(value));result.lastIndex=value.lastIndex;return result}}else{return value}var isArr=isArray(value);if(isDeep){var initedStack=!stackA;stackA||(stackA=getArray());stackB||(stackB=getArray());var length=stackA.length;while(length--){if(stackA[length]==value){return stackB[length]}}result=isArr?ctor(value.length):{}}else{result=isArr?slice(value):assign({},value)}if(isArr){if(hasOwnProperty.call(value,"index")){result.index=value.index}if(hasOwnProperty.call(value,"input")){result.input=value.input}}if(!isDeep){return result}stackA.push(value);stackB.push(result);(isArr?forEach:forOwn)(value,function(objValue,key){result[key]=baseClone(objValue,isDeep,callback,stackA,stackB)});if(initedStack){releaseArray(stackA);releaseArray(stackB)}return result}function baseCreate(prototype,properties){return isObject(prototype)?nativeCreate(prototype):{}}if(!nativeCreate){baseCreate=function(){function Object(){}return function(prototype){if(isObject(prototype)){Object.prototype=prototype;var result=new Object;Object.prototype=null}return result||context.Object()}}()}function baseCreateCallback(func,thisArg,argCount){if(typeof func!="function"){return identity}if(typeof thisArg=="undefined"||!("prototype"in func)){return func}var bindData=func.__bindData__;if(typeof bindData=="undefined"){if(support.funcNames){bindData=!func.name}bindData=bindData||!support.funcDecomp;if(!bindData){var source=fnToString.call(func);if(!support.funcNames){bindData=!reFuncName.test(source)}if(!bindData){bindData=reThis.test(source);setBindData(func,bindData)}}}if(bindData===false||bindData!==true&&bindData[1]&1){return func}switch(argCount){case 1:return function(value){return func.call(thisArg,value)};case 2:return function(a,b){return func.call(thisArg,a,b)};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)}}return bind(func,thisArg)}function baseCreateWrapper(bindData){var func=bindData[0],bitmask=bindData[1],partialArgs=bindData[2],partialRightArgs=bindData[3],thisArg=bindData[4],arity=bindData[5];var isBind=bitmask&1,isBindKey=bitmask&2,isCurry=bitmask&4,isCurryBound=bitmask&8,key=func;function bound(){var thisBinding=isBind?thisArg:this;if(partialArgs){var args=slice(partialArgs);push.apply(args,arguments)}if(partialRightArgs||isCurry){args||(args=slice(arguments));if(partialRightArgs){push.apply(args,partialRightArgs)}if(isCurry&&args.length<arity){bitmask|=16&~32;return baseCreateWrapper([func,isCurryBound?bitmask:bitmask&~3,args,null,thisArg,arity])}}args||(args=arguments);if(isBindKey){func=thisBinding[key]}if(this instanceof bound){thisBinding=baseCreate(func.prototype);var result=func.apply(thisBinding,args);return isObject(result)?result:thisBinding}return func.apply(thisBinding,args)}setBindData(bound,bindData);return bound}function baseDifference(array,values){var index=-1,indexOf=getIndexOf(),length=array?array.length:0,isLarge=length>=largeArraySize&&indexOf===baseIndexOf,result=[];if(isLarge){var cache=createCache(values);if(cache){indexOf=cacheIndexOf;values=cache}else{isLarge=false}}while(++index<length){var value=array[index];if(indexOf(values,value)<0){result.push(value)}}if(isLarge){releaseObject(values)}return result}function baseFlatten(array,isShallow,isStrict,fromIndex){var index=(fromIndex||0)-1,length=array?array.length:0,result=[];while(++index<length){var value=array[index];if(value&&typeof value=="object"&&typeof value.length=="number"&&(isArray(value)||isArguments(value))){if(!isShallow){value=baseFlatten(value,isShallow,isStrict)}var valIndex=-1,valLength=value.length,resIndex=result.length;result.length+=valLength;while(++valIndex<valLength){result[resIndex++]=value[valIndex]}}else if(!isStrict){result.push(value)}}return result}function baseIsEqual(a,b,callback,isWhere,stackA,stackB){if(callback){var result=callback(a,b);if(typeof result!="undefined"){return!!result}}if(a===b){return a!==0||1/a==1/b}var type=typeof a,otherType=typeof b;if(a===a&&!(a&&objectTypes[type])&&!(b&&objectTypes[otherType])){return false}if(a==null||b==null){return a===b}var className=toString.call(a),otherClass=toString.call(b);if(className==argsClass){className=objectClass}if(otherClass==argsClass){otherClass=objectClass}if(className!=otherClass){return false}switch(className){case boolClass:case dateClass:return+a==+b;case numberClass:return a!=+a?b!=+b:a==0?1/a==1/b:a==+b;case regexpClass:case stringClass:return a==String(b)}var isArr=className==arrayClass;if(!isArr){var aWrapped=hasOwnProperty.call(a,"__wrapped__"),bWrapped=hasOwnProperty.call(b,"__wrapped__");if(aWrapped||bWrapped){return baseIsEqual(aWrapped?a.__wrapped__:a,bWrapped?b.__wrapped__:b,callback,isWhere,stackA,stackB)}if(className!=objectClass){return false}var ctorA=a.constructor,ctorB=b.constructor;if(ctorA!=ctorB&&!(isFunction(ctorA)&&ctorA instanceof ctorA&&isFunction(ctorB)&&ctorB instanceof ctorB)&&("constructor"in a&&"constructor"in b)){return false}}var initedStack=!stackA;stackA||(stackA=getArray());stackB||(stackB=getArray());var length=stackA.length;while(length--){if(stackA[length]==a){return stackB[length]==b}}var size=0;result=true;stackA.push(a);stackB.push(b);if(isArr){length=a.length;size=b.length;result=size==length;if(result||isWhere){while(size--){var index=length,value=b[size];if(isWhere){while(index--){if(result=baseIsEqual(a[index],value,callback,isWhere,stackA,stackB)){break}}}else if(!(result=baseIsEqual(a[size],value,callback,isWhere,stackA,stackB))){break}}}}else{forIn(b,function(value,key,b){if(hasOwnProperty.call(b,key)){size++;return result=hasOwnProperty.call(a,key)&&baseIsEqual(a[key],value,callback,isWhere,stackA,stackB)}});if(result&&!isWhere){forIn(a,function(value,key,a){if(hasOwnProperty.call(a,key)){return result=--size>-1
}})}}stackA.pop();stackB.pop();if(initedStack){releaseArray(stackA);releaseArray(stackB)}return result}function baseMerge(object,source,callback,stackA,stackB){(isArray(source)?forEach:forOwn)(source,function(source,key){var found,isArr,result=source,value=object[key];if(source&&((isArr=isArray(source))||isPlainObject(source))){var stackLength=stackA.length;while(stackLength--){if(found=stackA[stackLength]==source){value=stackB[stackLength];break}}if(!found){var isShallow;if(callback){result=callback(value,source);if(isShallow=typeof result!="undefined"){value=result}}if(!isShallow){value=isArr?isArray(value)?value:[]:isPlainObject(value)?value:{}}stackA.push(source);stackB.push(value);if(!isShallow){baseMerge(value,source,callback,stackA,stackB)}}}else{if(callback){result=callback(value,source);if(typeof result=="undefined"){result=source}}if(typeof result!="undefined"){value=result}}object[key]=value})}function baseRandom(min,max){return min+floor(nativeRandom()*(max-min+1))}function baseUniq(array,isSorted,callback){var index=-1,indexOf=getIndexOf(),length=array?array.length:0,result=[];var isLarge=!isSorted&&length>=largeArraySize&&indexOf===baseIndexOf,seen=callback||isLarge?getArray():result;if(isLarge){var cache=createCache(seen);indexOf=cacheIndexOf;seen=cache}while(++index<length){var value=array[index],computed=callback?callback(value,index,array):value;if(isSorted?!index||seen[seen.length-1]!==computed:indexOf(seen,computed)<0){if(callback||isLarge){seen.push(computed)}result.push(value)}}if(isLarge){releaseArray(seen.array);releaseObject(seen)}else if(callback){releaseArray(seen)}return result}function createAggregator(setter){return function(collection,callback,thisArg){var result={};callback=lodash.createCallback(callback,thisArg,3);var index=-1,length=collection?collection.length:0;if(typeof length=="number"){while(++index<length){var value=collection[index];setter(result,value,callback(value,index,collection),collection)}}else{forOwn(collection,function(value,key,collection){setter(result,value,callback(value,key,collection),collection)})}return result}}function createWrapper(func,bitmask,partialArgs,partialRightArgs,thisArg,arity){var isBind=bitmask&1,isBindKey=bitmask&2,isCurry=bitmask&4,isCurryBound=bitmask&8,isPartial=bitmask&16,isPartialRight=bitmask&32;if(!isBindKey&&!isFunction(func)){throw new TypeError}if(isPartial&&!partialArgs.length){bitmask&=~16;isPartial=partialArgs=false}if(isPartialRight&&!partialRightArgs.length){bitmask&=~32;isPartialRight=partialRightArgs=false}var bindData=func&&func.__bindData__;if(bindData&&bindData!==true){bindData=slice(bindData);if(bindData[2]){bindData[2]=slice(bindData[2])}if(bindData[3]){bindData[3]=slice(bindData[3])}if(isBind&&!(bindData[1]&1)){bindData[4]=thisArg}if(!isBind&&bindData[1]&1){bitmask|=8}if(isCurry&&!(bindData[1]&4)){bindData[5]=arity}if(isPartial){push.apply(bindData[2]||(bindData[2]=[]),partialArgs)}if(isPartialRight){unshift.apply(bindData[3]||(bindData[3]=[]),partialRightArgs)}bindData[1]|=bitmask;return createWrapper.apply(null,bindData)}var creater=bitmask==1||bitmask===17?baseBind:baseCreateWrapper;return creater([func,bitmask,partialArgs,partialRightArgs,thisArg,arity])}function escapeHtmlChar(match){return htmlEscapes[match]}function getIndexOf(){var result=(result=lodash.indexOf)===indexOf?baseIndexOf:result;return result}function isNative(value){return typeof value=="function"&&reNative.test(value)}var setBindData=!defineProperty?noop:function(func,value){descriptor.value=value;defineProperty(func,"__bindData__",descriptor)};function shimIsPlainObject(value){var ctor,result;if(!(value&&toString.call(value)==objectClass)||(ctor=value.constructor,isFunction(ctor)&&!(ctor instanceof ctor))){return false}forIn(value,function(value,key){result=key});return typeof result=="undefined"||hasOwnProperty.call(value,result)}function unescapeHtmlChar(match){return htmlUnescapes[match]}function isArguments(value){return value&&typeof value=="object"&&typeof value.length=="number"&&toString.call(value)==argsClass||false}var isArray=nativeIsArray||function(value){return value&&typeof value=="object"&&typeof value.length=="number"&&toString.call(value)==arrayClass||false};var shimKeys=function(object){var index,iterable=object,result=[];if(!iterable)return result;if(!objectTypes[typeof object])return result;for(index in iterable){if(hasOwnProperty.call(iterable,index)){result.push(index)}}return result};var keys=!nativeKeys?shimKeys:function(object){if(!isObject(object)){return[]}return nativeKeys(object)};var htmlEscapes={"&":"&","<":"<",">":">",'"':""","'":"'"};var htmlUnescapes=invert(htmlEscapes);var reEscapedHtml=RegExp("("+keys(htmlUnescapes).join("|")+")","g"),reUnescapedHtml=RegExp("["+keys(htmlEscapes).join("")+"]","g");var assign=function(object,source,guard){var index,iterable=object,result=iterable;if(!iterable)return result;var args=arguments,argsIndex=0,argsLength=typeof guard=="number"?2:args.length;if(argsLength>3&&typeof args[argsLength-2]=="function"){var callback=baseCreateCallback(args[--argsLength-1],args[argsLength--],2)}else if(argsLength>2&&typeof args[argsLength-1]=="function"){callback=args[--argsLength]}while(++argsIndex<argsLength){iterable=args[argsIndex];if(iterable&&objectTypes[typeof iterable]){var ownIndex=-1,ownProps=objectTypes[typeof iterable]&&keys(iterable),length=ownProps?ownProps.length:0;while(++ownIndex<length){index=ownProps[ownIndex];result[index]=callback?callback(result[index],iterable[index]):iterable[index]}}}return result};function clone(value,isDeep,callback,thisArg){if(typeof isDeep!="boolean"&&isDeep!=null){thisArg=callback;callback=isDeep;isDeep=false}return baseClone(value,isDeep,typeof callback=="function"&&baseCreateCallback(callback,thisArg,1))}function cloneDeep(value,callback,thisArg){return baseClone(value,true,typeof callback=="function"&&baseCreateCallback(callback,thisArg,1))}function create(prototype,properties){var result=baseCreate(prototype);return properties?assign(result,properties):result}var defaults=function(object,source,guard){var index,iterable=object,result=iterable;if(!iterable)return result;var args=arguments,argsIndex=0,argsLength=typeof guard=="number"?2:args.length;while(++argsIndex<argsLength){iterable=args[argsIndex];if(iterable&&objectTypes[typeof iterable]){var ownIndex=-1,ownProps=objectTypes[typeof iterable]&&keys(iterable),length=ownProps?ownProps.length:0;while(++ownIndex<length){index=ownProps[ownIndex];if(typeof result[index]=="undefined")result[index]=iterable[index]}}}return result};function findKey(object,callback,thisArg){var result;callback=lodash.createCallback(callback,thisArg,3);forOwn(object,function(value,key,object){if(callback(value,key,object)){result=key;return false}});return result}function findLastKey(object,callback,thisArg){var result;callback=lodash.createCallback(callback,thisArg,3);forOwnRight(object,function(value,key,object){if(callback(value,key,object)){result=key;return false}});return result}var forIn=function(collection,callback,thisArg){var index,iterable=collection,result=iterable;if(!iterable)return result;if(!objectTypes[typeof iterable])return result;callback=callback&&typeof thisArg=="undefined"?callback:baseCreateCallback(callback,thisArg,3);for(index in iterable){if(callback(iterable[index],index,collection)===false)return result}return result};function forInRight(object,callback,thisArg){var pairs=[];forIn(object,function(value,key){pairs.push(key,value)});var length=pairs.length;callback=baseCreateCallback(callback,thisArg,3);while(length--){if(callback(pairs[length--],pairs[length],object)===false){break}}return object}var forOwn=function(collection,callback,thisArg){var index,iterable=collection,result=iterable;if(!iterable)return result;if(!objectTypes[typeof iterable])return result;callback=callback&&typeof thisArg=="undefined"?callback:baseCreateCallback(callback,thisArg,3);var ownIndex=-1,ownProps=objectTypes[typeof iterable]&&keys(iterable),length=ownProps?ownProps.length:0;while(++ownIndex<length){index=ownProps[ownIndex];if(callback(iterable[index],index,collection)===false)return result}return result};function forOwnRight(object,callback,thisArg){var props=keys(object),length=props.length;callback=baseCreateCallback(callback,thisArg,3);while(length--){var key=props[length];if(callback(object[key],key,object)===false){break}}return object}function functions(object){var result=[];forIn(object,function(value,key){if(isFunction(value)){result.push(key)}});return result.sort()}function has(object,key){return object?hasOwnProperty.call(object,key):false}function invert(object){var index=-1,props=keys(object),length=props.length,result={};while(++index<length){var key=props[index];result[object[key]]=key}return result}function isBoolean(value){return value===true||value===false||value&&typeof value=="object"&&toString.call(value)==boolClass||false}function isDate(value){return value&&typeof value=="object"&&toString.call(value)==dateClass||false}function isElement(value){return value&&value.nodeType===1||false}function isEmpty(value){var result=true;if(!value){return result}var className=toString.call(value),length=value.length;if(className==arrayClass||className==stringClass||className==argsClass||className==objectClass&&typeof length=="number"&&isFunction(value.splice)){return!length}forOwn(value,function(){return result=false});return result}function isEqual(a,b,callback,thisArg){return baseIsEqual(a,b,typeof callback=="function"&&baseCreateCallback(callback,thisArg,2))}function isFinite(value){return nativeIsFinite(value)&&!nativeIsNaN(parseFloat(value))}function isFunction(value){return typeof value=="function"}function isObject(value){return!!(value&&objectTypes[typeof value])}function isNaN(value){return isNumber(value)&&value!=+value}function isNull(value){return value===null}function isNumber(value){return typeof value=="number"||value&&typeof value=="object"&&toString.call(value)==numberClass||false}var isPlainObject=!getPrototypeOf?shimIsPlainObject:function(value){if(!(value&&toString.call(value)==objectClass)){return false}var valueOf=value.valueOf,objProto=isNative(valueOf)&&(objProto=getPrototypeOf(valueOf))&&getPrototypeOf(objProto);return objProto?value==objProto||getPrototypeOf(value)==objProto:shimIsPlainObject(value)};function isRegExp(value){return value&&typeof value=="object"&&toString.call(value)==regexpClass||false}function isString(value){return typeof value=="string"||value&&typeof value=="object"&&toString.call(value)==stringClass||false}function isUndefined(value){return typeof value=="undefined"}function mapValues(object,callback,thisArg){var result={};callback=lodash.createCallback(callback,thisArg,3);forOwn(object,function(value,key,object){result[key]=callback(value,key,object)});return result}function merge(object){var args=arguments,length=2;if(!isObject(object)){return object}if(typeof args[2]!="number"){length=args.length}if(length>3&&typeof args[length-2]=="function"){var callback=baseCreateCallback(args[--length-1],args[length--],2)}else if(length>2&&typeof args[length-1]=="function"){callback=args[--length]}var sources=slice(arguments,1,length),index=-1,stackA=getArray(),stackB=getArray();while(++index<length){baseMerge(object,sources[index],callback,stackA,stackB)}releaseArray(stackA);releaseArray(stackB);return object}function omit(object,callback,thisArg){var result={};if(typeof callback!="function"){var props=[];forIn(object,function(value,key){props.push(key)});props=baseDifference(props,baseFlatten(arguments,true,false,1));var index=-1,length=props.length;while(++index<length){var key=props[index];result[key]=object[key]}}else{callback=lodash.createCallback(callback,thisArg,3);forIn(object,function(value,key,object){if(!callback(value,key,object)){result[key]=value}})}return result}function pairs(object){var index=-1,props=keys(object),length=props.length,result=Array(length);while(++index<length){var key=props[index];result[index]=[key,object[key]]}return result}function pick(object,callback,thisArg){var result={};if(typeof callback!="function"){var index=-1,props=baseFlatten(arguments,true,false,1),length=isObject(object)?props.length:0;while(++index<length){var key=props[index];if(key in object){result[key]=object[key]}}}else{callback=lodash.createCallback(callback,thisArg,3);forIn(object,function(value,key,object){if(callback(value,key,object)){result[key]=value}})}return result}function transform(object,callback,accumulator,thisArg){var isArr=isArray(object);if(accumulator==null){if(isArr){accumulator=[]}else{var ctor=object&&object.constructor,proto=ctor&&ctor.prototype;accumulator=baseCreate(proto)}}if(callback){callback=lodash.createCallback(callback,thisArg,4);(isArr?forEach:forOwn)(object,function(value,index,object){return callback(accumulator,value,index,object)})}return accumulator}function values(object){var index=-1,props=keys(object),length=props.length,result=Array(length);while(++index<length){result[index]=object[props[index]]}return result}function at(collection){var args=arguments,index=-1,props=baseFlatten(args,true,false,1),length=args[2]&&args[2][args[1]]===collection?1:props.length,result=Array(length);while(++index<length){result[index]=collection[props[index]]}return result}function contains(collection,target,fromIndex){var index=-1,indexOf=getIndexOf(),length=collection?collection.length:0,result=false;fromIndex=(fromIndex<0?nativeMax(0,length+fromIndex):fromIndex)||0;if(isArray(collection)){result=indexOf(collection,target,fromIndex)>-1}else if(typeof length=="number"){result=(isString(collection)?collection.indexOf(target,fromIndex):indexOf(collection,target,fromIndex))>-1}else{forOwn(collection,function(value){if(++index>=fromIndex){return!(result=value===target)}})}return result}var countBy=createAggregator(function(result,value,key){hasOwnProperty.call(result,key)?result[key]++:result[key]=1});function every(collection,callback,thisArg){var result=true;callback=lodash.createCallback(callback,thisArg,3);var index=-1,length=collection?collection.length:0;if(typeof length=="number"){while(++index<length){if(!(result=!!callback(collection[index],index,collection))){break}}}else{forOwn(collection,function(value,index,collection){return result=!!callback(value,index,collection)})}return result}function filter(collection,callback,thisArg){var result=[];callback=lodash.createCallback(callback,thisArg,3);var index=-1,length=collection?collection.length:0;if(typeof length=="number"){while(++index<length){var value=collection[index];if(callback(value,index,collection)){result.push(value)}}}else{forOwn(collection,function(value,index,collection){if(callback(value,index,collection)){result.push(value)}})}return result}function find(collection,callback,thisArg){callback=lodash.createCallback(callback,thisArg,3);var index=-1,length=collection?collection.length:0;if(typeof length=="number"){while(++index<length){var value=collection[index];if(callback(value,index,collection)){return value}}}else{var result;forOwn(collection,function(value,index,collection){if(callback(value,index,collection)){result=value;return false}});return result}}function findLast(collection,callback,thisArg){var result;callback=lodash.createCallback(callback,thisArg,3);forEachRight(collection,function(value,index,collection){if(callback(value,index,collection)){result=value;return false}});return result}function forEach(collection,callback,thisArg){var index=-1,length=collection?collection.length:0;callback=callback&&typeof thisArg=="undefined"?callback:baseCreateCallback(callback,thisArg,3);if(typeof length=="number"){while(++index<length){if(callback(collection[index],index,collection)===false){break}}}else{forOwn(collection,callback)}return collection}function forEachRight(collection,callback,thisArg){var length=collection?collection.length:0;callback=callback&&typeof thisArg=="undefined"?callback:baseCreateCallback(callback,thisArg,3);if(typeof length=="number"){while(length--){if(callback(collection[length],length,collection)===false){break}}}else{var props=keys(collection);length=props.length;forOwn(collection,function(value,key,collection){key=props?props[--length]:--length;return callback(collection[key],key,collection)})}return collection}var groupBy=createAggregator(function(result,value,key){(hasOwnProperty.call(result,key)?result[key]:result[key]=[]).push(value)});var indexBy=createAggregator(function(result,value,key){result[key]=value});function invoke(collection,methodName){var args=slice(arguments,2),index=-1,isFunc=typeof methodName=="function",length=collection?collection.length:0,result=Array(typeof length=="number"?length:0);forEach(collection,function(value){result[++index]=(isFunc?methodName:value[methodName]).apply(value,args)});return result}function map(collection,callback,thisArg){var index=-1,length=collection?collection.length:0;callback=lodash.createCallback(callback,thisArg,3);if(typeof length=="number"){var result=Array(length);while(++index<length){result[index]=callback(collection[index],index,collection)}}else{result=[];forOwn(collection,function(value,key,collection){result[++index]=callback(value,key,collection)})}return result}function max(collection,callback,thisArg){var computed=-Infinity,result=computed;if(typeof callback!="function"&&thisArg&&thisArg[callback]===collection){callback=null}if(callback==null&&isArray(collection)){var index=-1,length=collection.length;while(++index<length){var value=collection[index];if(value>result){result=value}}}else{callback=callback==null&&isString(collection)?charAtCallback:lodash.createCallback(callback,thisArg,3);forEach(collection,function(value,index,collection){var current=callback(value,index,collection);if(current>computed){computed=current;result=value}})}return result}function min(collection,callback,thisArg){var computed=Infinity,result=computed;if(typeof callback!="function"&&thisArg&&thisArg[callback]===collection){callback=null}if(callback==null&&isArray(collection)){var index=-1,length=collection.length;while(++index<length){var value=collection[index];if(value<result){result=value}}}else{callback=callback==null&&isString(collection)?charAtCallback:lodash.createCallback(callback,thisArg,3);forEach(collection,function(value,index,collection){var current=callback(value,index,collection);if(current<computed){computed=current;result=value}})}return result}var pluck=map;function reduce(collection,callback,accumulator,thisArg){if(!collection)return accumulator;var noaccum=arguments.length<3;callback=lodash.createCallback(callback,thisArg,4);var index=-1,length=collection.length;if(typeof length=="number"){if(noaccum){accumulator=collection[++index]}while(++index<length){accumulator=callback(accumulator,collection[index],index,collection)}}else{forOwn(collection,function(value,index,collection){accumulator=noaccum?(noaccum=false,value):callback(accumulator,value,index,collection)})}return accumulator}function reduceRight(collection,callback,accumulator,thisArg){var noaccum=arguments.length<3;callback=lodash.createCallback(callback,thisArg,4);forEachRight(collection,function(value,index,collection){accumulator=noaccum?(noaccum=false,value):callback(accumulator,value,index,collection)});return accumulator}function reject(collection,callback,thisArg){callback=lodash.createCallback(callback,thisArg,3);return filter(collection,function(value,index,collection){return!callback(value,index,collection)})}function sample(collection,n,guard){if(collection&&typeof collection.length!="number"){collection=values(collection)}if(n==null||guard){return collection?collection[baseRandom(0,collection.length-1)]:undefined}var result=shuffle(collection);result.length=nativeMin(nativeMax(0,n),result.length);return result}function shuffle(collection){var index=-1,length=collection?collection.length:0,result=Array(typeof length=="number"?length:0);forEach(collection,function(value){var rand=baseRandom(0,++index);result[index]=result[rand];result[rand]=value});return result}function size(collection){var length=collection?collection.length:0;return typeof length=="number"?length:keys(collection).length}function some(collection,callback,thisArg){var result;callback=lodash.createCallback(callback,thisArg,3);var index=-1,length=collection?collection.length:0;if(typeof length=="number"){while(++index<length){if(result=callback(collection[index],index,collection)){break}}}else{forOwn(collection,function(value,index,collection){return!(result=callback(value,index,collection))})}return!!result}function sortBy(collection,callback,thisArg){var index=-1,isArr=isArray(callback),length=collection?collection.length:0,result=Array(typeof length=="number"?length:0);if(!isArr){callback=lodash.createCallback(callback,thisArg,3)}forEach(collection,function(value,key,collection){var object=result[++index]=getObject();if(isArr){object.criteria=map(callback,function(key){return value[key]})}else{(object.criteria=getArray())[0]=callback(value,key,collection)}object.index=index;object.value=value});length=result.length;result.sort(compareAscending);while(length--){var object=result[length];result[length]=object.value;if(!isArr){releaseArray(object.criteria)}releaseObject(object)}return result}function toArray(collection){if(collection&&typeof collection.length=="number"){return slice(collection)}return values(collection)}var where=filter;function compact(array){var index=-1,length=array?array.length:0,result=[];while(++index<length){var value=array[index];if(value){result.push(value)}}return result}function difference(array){return baseDifference(array,baseFlatten(arguments,true,true,1))}function findIndex(array,callback,thisArg){var index=-1,length=array?array.length:0;callback=lodash.createCallback(callback,thisArg,3);while(++index<length){if(callback(array[index],index,array)){return index}}return-1}function findLastIndex(array,callback,thisArg){var length=array?array.length:0;callback=lodash.createCallback(callback,thisArg,3);while(length--){if(callback(array[length],length,array)){return length}}return-1}function first(array,callback,thisArg){var n=0,length=array?array.length:0;if(typeof callback!="number"&&callback!=null){var index=-1;callback=lodash.createCallback(callback,thisArg,3);while(++index<length&&callback(array[index],index,array)){n++}}else{n=callback;if(n==null||thisArg){return array?array[0]:undefined}}return slice(array,0,nativeMin(nativeMax(0,n),length))}function flatten(array,isShallow,callback,thisArg){if(typeof isShallow!="boolean"&&isShallow!=null){thisArg=callback;callback=typeof isShallow!="function"&&thisArg&&thisArg[isShallow]===array?null:isShallow;isShallow=false}if(callback!=null){array=map(array,callback,thisArg)}return baseFlatten(array,isShallow)}function indexOf(array,value,fromIndex){if(typeof fromIndex=="number"){var length=array?array.length:0;fromIndex=fromIndex<0?nativeMax(0,length+fromIndex):fromIndex||0}else if(fromIndex){var index=sortedIndex(array,value);return array[index]===value?index:-1}return baseIndexOf(array,value,fromIndex)}function initial(array,callback,thisArg){var n=0,length=array?array.length:0;if(typeof callback!="number"&&callback!=null){var index=length;callback=lodash.createCallback(callback,thisArg,3);while(index--&&callback(array[index],index,array)){n++}}else{n=callback==null||thisArg?1:callback||n}return slice(array,0,nativeMin(nativeMax(0,length-n),length))}function intersection(){var args=[],argsIndex=-1,argsLength=arguments.length,caches=getArray(),indexOf=getIndexOf(),trustIndexOf=indexOf===baseIndexOf,seen=getArray();while(++argsIndex<argsLength){var value=arguments[argsIndex];if(isArray(value)||isArguments(value)){args.push(value);caches.push(trustIndexOf&&value.length>=largeArraySize&&createCache(argsIndex?args[argsIndex]:seen))}}var array=args[0],index=-1,length=array?array.length:0,result=[];outer:while(++index<length){var cache=caches[0];value=array[index];if((cache?cacheIndexOf(cache,value):indexOf(seen,value))<0){argsIndex=argsLength;(cache||seen).push(value);while(--argsIndex){cache=caches[argsIndex];if((cache?cacheIndexOf(cache,value):indexOf(args[argsIndex],value))<0){continue outer}}result.push(value)}}while(argsLength--){cache=caches[argsLength];if(cache){releaseObject(cache)}}releaseArray(caches);releaseArray(seen);return result}function last(array,callback,thisArg){var n=0,length=array?array.length:0;if(typeof callback!="number"&&callback!=null){var index=length;callback=lodash.createCallback(callback,thisArg,3);while(index--&&callback(array[index],index,array)){n++}}else{n=callback;if(n==null||thisArg){return array?array[length-1]:undefined}}return slice(array,nativeMax(0,length-n))}function lastIndexOf(array,value,fromIndex){var index=array?array.length:0;if(typeof fromIndex=="number"){index=(fromIndex<0?nativeMax(0,index+fromIndex):nativeMin(fromIndex,index-1))+1}while(index--){if(array[index]===value){return index}}return-1}function pull(array){var args=arguments,argsIndex=0,argsLength=args.length,length=array?array.length:0;while(++argsIndex<argsLength){var index=-1,value=args[argsIndex];while(++index<length){if(array[index]===value){splice.call(array,index--,1);length--}}}return array}function range(start,end,step){start=+start||0;step=typeof step=="number"?step:+step||1;if(end==null){end=start;start=0}var index=-1,length=nativeMax(0,ceil((end-start)/(step||1))),result=Array(length);while(++index<length){result[index]=start;start+=step}return result}function remove(array,callback,thisArg){var index=-1,length=array?array.length:0,result=[];callback=lodash.createCallback(callback,thisArg,3);while(++index<length){var value=array[index];if(callback(value,index,array)){result.push(value);splice.call(array,index--,1);length--}}return result}function rest(array,callback,thisArg){if(typeof callback!="number"&&callback!=null){var n=0,index=-1,length=array?array.length:0;callback=lodash.createCallback(callback,thisArg,3);while(++index<length&&callback(array[index],index,array)){n++}}else{n=callback==null||thisArg?1:nativeMax(0,callback)}return slice(array,n)}function sortedIndex(array,value,callback,thisArg){var low=0,high=array?array.length:low;callback=callback?lodash.createCallback(callback,thisArg,1):identity;value=callback(value);while(low<high){var mid=low+high>>>1;callback(array[mid])<value?low=mid+1:high=mid}return low}function union(){return baseUniq(baseFlatten(arguments,true,true))}function uniq(array,isSorted,callback,thisArg){if(typeof isSorted!="boolean"&&isSorted!=null){thisArg=callback;callback=typeof isSorted!="function"&&thisArg&&thisArg[isSorted]===array?null:isSorted;isSorted=false}if(callback!=null){callback=lodash.createCallback(callback,thisArg,3)}return baseUniq(array,isSorted,callback)}function without(array){return baseDifference(array,slice(arguments,1))}function xor(){var index=-1,length=arguments.length;while(++index<length){var array=arguments[index];if(isArray(array)||isArguments(array)){var result=result?baseUniq(baseDifference(result,array).concat(baseDifference(array,result))):array}}return result||[]}function zip(){var array=arguments.length>1?arguments:arguments[0],index=-1,length=array?max(pluck(array,"length")):0,result=Array(length<0?0:length);while(++index<length){result[index]=pluck(array,index)}return result}function zipObject(keys,values){var index=-1,length=keys?keys.length:0,result={};if(!values&&length&&!isArray(keys[0])){values=[]}while(++index<length){var key=keys[index];if(values){result[key]=values[index]}else if(key){result[key[0]]=key[1]}}return result}function after(n,func){if(!isFunction(func)){throw new TypeError}return function(){if(--n<1){return func.apply(this,arguments)}}}function bind(func,thisArg){return arguments.length>2?createWrapper(func,17,slice(arguments,2),null,thisArg):createWrapper(func,1,null,null,thisArg)}function bindAll(object){var funcs=arguments.length>1?baseFlatten(arguments,true,false,1):functions(object),index=-1,length=funcs.length;while(++index<length){var key=funcs[index];object[key]=createWrapper(object[key],1,null,null,object)}return object}function bindKey(object,key){return arguments.length>2?createWrapper(key,19,slice(arguments,2),null,object):createWrapper(key,3,null,null,object)}function compose(){var funcs=arguments,length=funcs.length;while(length--){if(!isFunction(funcs[length])){throw new TypeError}}return function(){var args=arguments,length=funcs.length;while(length--){args=[funcs[length].apply(this,args)]}return args[0]}}function curry(func,arity){arity=typeof arity=="number"?arity:+arity||func.length;return createWrapper(func,4,null,null,null,arity)}function debounce(func,wait,options){var args,maxTimeoutId,result,stamp,thisArg,timeoutId,trailingCall,lastCalled=0,maxWait=false,trailing=true;if(!isFunction(func)){throw new TypeError}wait=nativeMax(0,wait)||0;if(options===true){var leading=true;trailing=false}else if(isObject(options)){leading=options.leading;maxWait="maxWait"in options&&(nativeMax(wait,options.maxWait)||0);trailing="trailing"in options?options.trailing:trailing}var delayed=function(){var remaining=wait-(now()-stamp);if(remaining<=0){if(maxTimeoutId){clearTimeout(maxTimeoutId)}var isCalled=trailingCall;maxTimeoutId=timeoutId=trailingCall=undefined;if(isCalled){lastCalled=now();result=func.apply(thisArg,args);if(!timeoutId&&!maxTimeoutId){args=thisArg=null}}}else{timeoutId=setTimeout(delayed,remaining)}};var maxDelayed=function(){if(timeoutId){clearTimeout(timeoutId)}maxTimeoutId=timeoutId=trailingCall=undefined;if(trailing||maxWait!==wait){lastCalled=now();result=func.apply(thisArg,args);if(!timeoutId&&!maxTimeoutId){args=thisArg=null}}};return function(){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;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=null}return result}}function defer(func){if(!isFunction(func)){throw new TypeError}var args=slice(arguments,1);return setTimeout(function(){func.apply(undefined,args)},1)}function delay(func,wait){if(!isFunction(func)){throw new TypeError}var args=slice(arguments,2);return setTimeout(function(){func.apply(undefined,args)},wait)}function memoize(func,resolver){if(!isFunction(func)){throw new TypeError}var memoized=function(){var cache=memoized.cache,key=resolver?resolver.apply(this,arguments):keyPrefix+arguments[0];return hasOwnProperty.call(cache,key)?cache[key]:cache[key]=func.apply(this,arguments)};memoized.cache={};return memoized}function once(func){var ran,result;if(!isFunction(func)){throw new TypeError}return function(){if(ran){return result}ran=true;result=func.apply(this,arguments);func=null;return result}}function partial(func){return createWrapper(func,16,slice(arguments,1))}function partialRight(func){return createWrapper(func,32,null,slice(arguments,1))}function throttle(func,wait,options){var leading=true,trailing=true;if(!isFunction(func)){throw new TypeError}if(options===false){leading=false}else if(isObject(options)){leading="leading"in options?options.leading:leading;trailing="trailing"in options?options.trailing:trailing}debounceOptions.leading=leading;debounceOptions.maxWait=wait;debounceOptions.trailing=trailing;return debounce(func,wait,debounceOptions)}function wrap(value,wrapper){return createWrapper(wrapper,16,[value])}function constant(value){return function(){return value}}function createCallback(func,thisArg,argCount){var type=typeof func;if(func==null||type=="function"){return baseCreateCallback(func,thisArg,argCount)
}if(type!="object"){return property(func)}var props=keys(func),key=props[0],a=func[key];if(props.length==1&&a===a&&!isObject(a)){return function(object){var b=object[key];return a===b&&(a!==0||1/a==1/b)}}return function(object){var length=props.length,result=false;while(length--){if(!(result=baseIsEqual(object[props[length]],func[props[length]],null,true))){break}}return result}}function escape(string){return string==null?"":String(string).replace(reUnescapedHtml,escapeHtmlChar)}function identity(value){return value}function mixin(object,source,options){var chain=true,methodNames=source&&functions(source);if(!source||!options&&!methodNames.length){if(options==null){options=source}ctor=lodashWrapper;source=object;object=lodash;methodNames=functions(source)}if(options===false){chain=false}else if(isObject(options)&&"chain"in options){chain=options.chain}var ctor=object,isFunc=isFunction(ctor);forEach(methodNames,function(methodName){var func=object[methodName]=source[methodName];if(isFunc){ctor.prototype[methodName]=function(){var chainAll=this.__chain__,value=this.__wrapped__,args=[value];push.apply(args,arguments);var result=func.apply(object,args);if(chain||chainAll){if(value===result&&isObject(result)){return this}result=new ctor(result);result.__chain__=chainAll}return result}}})}function noConflict(){context._=oldDash;return this}function noop(){}var now=isNative(now=Date.now)&&now||function(){return(new Date).getTime()};var parseInt=nativeParseInt(whitespace+"08")==8?nativeParseInt:function(value,radix){return nativeParseInt(isString(value)?value.replace(reLeadingSpacesAndZeros,""):value,radix||0)};function property(key){return function(object){return object[key]}}function random(min,max,floating){var noMin=min==null,noMax=max==null;if(floating==null){if(typeof min=="boolean"&&noMax){floating=min;min=1}else if(!noMax&&typeof max=="boolean"){floating=max;noMax=true}}if(noMin&&noMax){max=1}min=+min||0;if(noMax){max=min;min=0}else{max=+max||0}if(floating||min%1||max%1){var rand=nativeRandom();return nativeMin(min+rand*(max-min+parseFloat("1e-"+((rand+"").length-1))),max)}return baseRandom(min,max)}function result(object,key){if(object){var value=object[key];return isFunction(value)?object[key]():value}}function template(text,data,options){var settings=lodash.templateSettings;text=String(text||"");options=defaults({},options,settings);var imports=defaults({},options.imports,settings.imports),importsKeys=keys(imports),importsValues=values(imports);var isEvaluating,index=0,interpolate=options.interpolate||reNoMatch,source="__p += '";var reDelimiters=RegExp((options.escape||reNoMatch).source+"|"+interpolate.source+"|"+(interpolate===reInterpolate?reEsTemplate:reNoMatch).source+"|"+(options.evaluate||reNoMatch).source+"|$","g");text.replace(reDelimiters,function(match,escapeValue,interpolateValue,esTemplateValue,evaluateValue,offset){interpolateValue||(interpolateValue=esTemplateValue);source+=text.slice(index,offset).replace(reUnescapedString,escapeStringChar);if(escapeValue){source+="' +\n__e("+escapeValue+") +\n'"}if(evaluateValue){isEvaluating=true;source+="';\n"+evaluateValue+";\n__p += '"}if(interpolateValue){source+="' +\n((__t = ("+interpolateValue+")) == null ? '' : __t) +\n'"}index=offset+match.length;return match});source+="';\n";var variable=options.variable,hasVariable=variable;if(!hasVariable){variable="obj";source="with ("+variable+") {\n"+source+"\n}\n"}source=(isEvaluating?source.replace(reEmptyStringLeading,""):source).replace(reEmptyStringMiddle,"$1").replace(reEmptyStringTrailing,"$1;");source="function("+variable+") {\n"+(hasVariable?"":variable+" || ("+variable+" = {});\n")+"var __t, __p = '', __e = _.escape"+(isEvaluating?", __j = Array.prototype.join;\n"+"function print() { __p += __j.call(arguments, '') }\n":";\n")+source+"return __p\n}";var sourceURL="\n/*\n//# sourceURL="+(options.sourceURL||"/lodash/template/source["+templateCounter++ +"]")+"\n*/";try{var result=Function(importsKeys,"return "+source+sourceURL).apply(undefined,importsValues)}catch(e){e.source=source;throw e}if(data){return result(data)}result.source=source;return result}function times(n,callback,thisArg){n=(n=+n)>-1?n:0;var index=-1,result=Array(n);callback=baseCreateCallback(callback,thisArg,1);while(++index<n){result[index]=callback(index)}return result}function unescape(string){return string==null?"":String(string).replace(reEscapedHtml,unescapeHtmlChar)}function uniqueId(prefix){var id=++idCounter;return String(prefix==null?"":prefix)+id}function chain(value){value=new lodashWrapper(value);value.__chain__=true;return value}function tap(value,interceptor){interceptor(value);return value}function wrapperChain(){this.__chain__=true;return this}function wrapperToString(){return String(this.__wrapped__)}function wrapperValueOf(){return this.__wrapped__}lodash.after=after;lodash.assign=assign;lodash.at=at;lodash.bind=bind;lodash.bindAll=bindAll;lodash.bindKey=bindKey;lodash.chain=chain;lodash.compact=compact;lodash.compose=compose;lodash.constant=constant;lodash.countBy=countBy;lodash.create=create;lodash.createCallback=createCallback;lodash.curry=curry;lodash.debounce=debounce;lodash.defaults=defaults;lodash.defer=defer;lodash.delay=delay;lodash.difference=difference;lodash.filter=filter;lodash.flatten=flatten;lodash.forEach=forEach;lodash.forEachRight=forEachRight;lodash.forIn=forIn;lodash.forInRight=forInRight;lodash.forOwn=forOwn;lodash.forOwnRight=forOwnRight;lodash.functions=functions;lodash.groupBy=groupBy;lodash.indexBy=indexBy;lodash.initial=initial;lodash.intersection=intersection;lodash.invert=invert;lodash.invoke=invoke;lodash.keys=keys;lodash.map=map;lodash.mapValues=mapValues;lodash.max=max;lodash.memoize=memoize;lodash.merge=merge;lodash.min=min;lodash.omit=omit;lodash.once=once;lodash.pairs=pairs;lodash.partial=partial;lodash.partialRight=partialRight;lodash.pick=pick;lodash.pluck=pluck;lodash.property=property;lodash.pull=pull;lodash.range=range;lodash.reject=reject;lodash.remove=remove;lodash.rest=rest;lodash.shuffle=shuffle;lodash.sortBy=sortBy;lodash.tap=tap;lodash.throttle=throttle;lodash.times=times;lodash.toArray=toArray;lodash.transform=transform;lodash.union=union;lodash.uniq=uniq;lodash.values=values;lodash.where=where;lodash.without=without;lodash.wrap=wrap;lodash.xor=xor;lodash.zip=zip;lodash.zipObject=zipObject;lodash.collect=map;lodash.drop=rest;lodash.each=forEach;lodash.eachRight=forEachRight;lodash.extend=assign;lodash.methods=functions;lodash.object=zipObject;lodash.select=filter;lodash.tail=rest;lodash.unique=uniq;lodash.unzip=zip;mixin(lodash);lodash.clone=clone;lodash.cloneDeep=cloneDeep;lodash.contains=contains;lodash.escape=escape;lodash.every=every;lodash.find=find;lodash.findIndex=findIndex;lodash.findKey=findKey;lodash.findLast=findLast;lodash.findLastIndex=findLastIndex;lodash.findLastKey=findLastKey;lodash.has=has;lodash.identity=identity;lodash.indexOf=indexOf;lodash.isArguments=isArguments;lodash.isArray=isArray;lodash.isBoolean=isBoolean;lodash.isDate=isDate;lodash.isElement=isElement;lodash.isEmpty=isEmpty;lodash.isEqual=isEqual;lodash.isFinite=isFinite;lodash.isFunction=isFunction;lodash.isNaN=isNaN;lodash.isNull=isNull;lodash.isNumber=isNumber;lodash.isObject=isObject;lodash.isPlainObject=isPlainObject;lodash.isRegExp=isRegExp;lodash.isString=isString;lodash.isUndefined=isUndefined;lodash.lastIndexOf=lastIndexOf;lodash.mixin=mixin;lodash.noConflict=noConflict;lodash.noop=noop;lodash.now=now;lodash.parseInt=parseInt;lodash.random=random;lodash.reduce=reduce;lodash.reduceRight=reduceRight;lodash.result=result;lodash.runInContext=runInContext;lodash.size=size;lodash.some=some;lodash.sortedIndex=sortedIndex;lodash.template=template;lodash.unescape=unescape;lodash.uniqueId=uniqueId;lodash.all=every;lodash.any=some;lodash.detect=find;lodash.findWhere=find;lodash.foldl=reduce;lodash.foldr=reduceRight;lodash.include=contains;lodash.inject=reduce;mixin(function(){var source={};forOwn(lodash,function(func,methodName){if(!lodash.prototype[methodName]){source[methodName]=func}});return source}(),false);lodash.first=first;lodash.last=last;lodash.sample=sample;lodash.take=first;lodash.head=first;forOwn(lodash,function(func,methodName){var callbackable=methodName!=="sample";if(!lodash.prototype[methodName]){lodash.prototype[methodName]=function(n,guard){var chainAll=this.__chain__,result=func(this.__wrapped__,n,guard);return!chainAll&&(n==null||guard&&!(callbackable&&typeof n=="function"))?result:new lodashWrapper(result,chainAll)}}});lodash.VERSION="2.4.1";lodash.prototype.chain=wrapperChain;lodash.prototype.toString=wrapperToString;lodash.prototype.value=wrapperValueOf;lodash.prototype.valueOf=wrapperValueOf;forEach(["join","pop","shift"],function(methodName){var func=arrayRef[methodName];lodash.prototype[methodName]=function(){var chainAll=this.__chain__,result=func.apply(this.__wrapped__,arguments);return chainAll?new lodashWrapper(result,chainAll):result}});forEach(["push","reverse","sort","unshift"],function(methodName){var func=arrayRef[methodName];lodash.prototype[methodName]=function(){func.apply(this.__wrapped__,arguments);return this}});forEach(["concat","slice","splice"],function(methodName){var func=arrayRef[methodName];lodash.prototype[methodName]=function(){return new lodashWrapper(func.apply(this.__wrapped__,arguments),this.__chain__)}});return lodash}var _=runInContext();if(typeof define=="function"&&typeof define.amd=="object"&&define.amd){root._=_;define(function(){return _})}else if(freeExports&&freeModule){if(moduleExports){(freeModule.exports=_)._=_}else{freeExports._=_}}else{root._=_}}).call(this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],92:[function(require,module,exports){var assert=require("assert");var types=require("ast-types");var isArray=types.builtInTypes.array;var b=types.builders;var n=types.namedTypes;var leap=require("./leap");var meta=require("./meta");var runtimeProperty=require("./util").runtimeProperty;var runtimeKeysMethod=runtimeProperty("keys");var hasOwn=Object.prototype.hasOwnProperty;function Emitter(contextId){assert.ok(this instanceof Emitter);n.Identifier.assert(contextId);Object.defineProperties(this,{contextId:{value:contextId},listing:{value:[]},marked:{value:[true]},finalLoc:{value:loc()},tryEntries:{value:[]}});Object.defineProperties(this,{leapManager:{value:new leap.LeapManager(this)}})}var Ep=Emitter.prototype;exports.Emitter=Emitter;function loc(){return b.literal(-1)}Ep.mark=function(loc){n.Literal.assert(loc);var index=this.listing.length;if(loc.value===-1){loc.value=index}else{assert.strictEqual(loc.value,index)}this.marked[index]=true;return loc};Ep.emit=function(node){if(n.Expression.check(node))node=b.expressionStatement(node);n.Statement.assert(node);this.listing.push(node)};Ep.emitAssign=function(lhs,rhs){this.emit(this.assign(lhs,rhs));return lhs};Ep.assign=function(lhs,rhs){return b.expressionStatement(b.assignmentExpression("=",lhs,rhs))};Ep.contextProperty=function(name){return b.memberExpression(this.contextId,b.identifier(name),false)};var volatileContextPropertyNames={prev:true,next:true,sent:true,rval:true};Ep.isVolatileContextProperty=function(expr){if(n.MemberExpression.check(expr)){if(expr.computed){return true}if(n.Identifier.check(expr.object)&&n.Identifier.check(expr.property)&&expr.object.name===this.contextId.name&&hasOwn.call(volatileContextPropertyNames,expr.property.name)){return true}}return false};Ep.stop=function(rval){if(rval){this.setReturnValue(rval)}this.jump(this.finalLoc)};Ep.setReturnValue=function(valuePath){n.Expression.assert(valuePath.value);this.emitAssign(this.contextProperty("rval"),this.explodeExpression(valuePath))};Ep.clearPendingException=function(tryLoc,assignee){n.Literal.assert(tryLoc);var catchCall=b.callExpression(this.contextProperty("catch"),[tryLoc]);if(assignee){this.emitAssign(assignee,catchCall)}else{this.emit(catchCall)}};Ep.jump=function(toLoc){this.emitAssign(this.contextProperty("next"),toLoc);this.emit(b.breakStatement())};Ep.jumpIf=function(test,toLoc){n.Expression.assert(test);n.Literal.assert(toLoc);this.emit(b.ifStatement(test,b.blockStatement([this.assign(this.contextProperty("next"),toLoc),b.breakStatement()])))};Ep.jumpIfNot=function(test,toLoc){n.Expression.assert(test);n.Literal.assert(toLoc);var negatedTest;if(n.UnaryExpression.check(test)&&test.operator==="!"){negatedTest=test.argument}else{negatedTest=b.unaryExpression("!",test)}this.emit(b.ifStatement(negatedTest,b.blockStatement([this.assign(this.contextProperty("next"),toLoc),b.breakStatement()])))};var nextTempId=0;Ep.makeTempVar=function(){return this.contextProperty("t"+nextTempId++)};Ep.getContextFunction=function(id){return b.functionExpression(id||null,[this.contextId],b.blockStatement([this.getDispatchLoop()]),false,false)};Ep.getDispatchLoop=function(){var self=this;var cases=[];var current;var alreadyEnded=false;self.listing.forEach(function(stmt,i){if(self.marked.hasOwnProperty(i)){cases.push(b.switchCase(b.literal(i),current=[]));alreadyEnded=false}if(!alreadyEnded){current.push(stmt);if(isSwitchCaseEnder(stmt))alreadyEnded=true}});this.finalLoc.value=this.listing.length;cases.push(b.switchCase(this.finalLoc,[]),b.switchCase(b.literal("end"),[b.returnStatement(b.callExpression(this.contextProperty("stop"),[]))]));return b.whileStatement(b.literal(1),b.switchStatement(b.assignmentExpression("=",this.contextProperty("prev"),this.contextProperty("next")),cases))};function isSwitchCaseEnder(stmt){return n.BreakStatement.check(stmt)||n.ContinueStatement.check(stmt)||n.ReturnStatement.check(stmt)||n.ThrowStatement.check(stmt)}Ep.getTryEntryList=function(){if(this.tryEntries.length===0){return null}var lastLocValue=0;return b.arrayExpression(this.tryEntries.map(function(tryEntry){var thisLocValue=tryEntry.firstLoc.value;assert.ok(thisLocValue>=lastLocValue,"try entries out of order");lastLocValue=thisLocValue;var ce=tryEntry.catchEntry;var fe=tryEntry.finallyEntry;var triple=[tryEntry.firstLoc,ce?ce.firstLoc:null];if(fe){triple[2]=fe.firstLoc}return b.arrayExpression(triple)}))};Ep.explode=function(path,ignoreResult){assert.ok(path instanceof types.NodePath);var node=path.value;var self=this;n.Node.assert(node);if(n.Statement.check(node))return self.explodeStatement(path);if(n.Expression.check(node))return self.explodeExpression(path,ignoreResult);if(n.Declaration.check(node))throw getDeclError(node);switch(node.type){case"Program":return path.get("body").map(self.explodeStatement,self);case"VariableDeclarator":throw getDeclError(node);case"Property":case"SwitchCase":case"CatchClause":throw new Error(node.type+" nodes should be handled by their parents");default:throw new Error("unknown Node of type "+JSON.stringify(node.type))}};function getDeclError(node){return new Error("all declarations should have been transformed into "+"assignments before the Exploder began its work: "+JSON.stringify(node))}Ep.explodeStatement=function(path,labelId){assert.ok(path instanceof types.NodePath);var stmt=path.value;var self=this;n.Statement.assert(stmt);if(labelId){n.Identifier.assert(labelId)}else{labelId=null}if(n.BlockStatement.check(stmt)){return path.get("body").each(self.explodeStatement,self)}if(!meta.containsLeap(stmt)){self.emit(stmt);return}switch(stmt.type){case"ExpressionStatement":self.explodeExpression(path.get("expression"),true);break;case"LabeledStatement":self.explodeStatement(path.get("body"),stmt.label);break;case"WhileStatement":var before=loc();var after=loc();self.mark(before);self.jumpIfNot(self.explodeExpression(path.get("test")),after);self.leapManager.withEntry(new leap.LoopEntry(after,before,labelId),function(){self.explodeStatement(path.get("body"))});self.jump(before);self.mark(after);break;case"DoWhileStatement":var first=loc();var test=loc();var after=loc();self.mark(first);self.leapManager.withEntry(new leap.LoopEntry(after,test,labelId),function(){self.explode(path.get("body"))});self.mark(test);self.jumpIf(self.explodeExpression(path.get("test")),first);self.mark(after);break;case"ForStatement":var head=loc();var update=loc();var after=loc();if(stmt.init){self.explode(path.get("init"),true)}self.mark(head);if(stmt.test){self.jumpIfNot(self.explodeExpression(path.get("test")),after)}else{}self.leapManager.withEntry(new leap.LoopEntry(after,update,labelId),function(){self.explodeStatement(path.get("body"))});self.mark(update);if(stmt.update){self.explode(path.get("update"),true)}self.jump(head);self.mark(after);break;case"ForInStatement":n.Identifier.assert(stmt.left);var head=loc();var after=loc();var keyIterNextFn=self.makeTempVar();self.emitAssign(keyIterNextFn,b.callExpression(runtimeKeysMethod,[self.explodeExpression(path.get("right"))]));self.mark(head);var keyInfoTmpVar=self.makeTempVar();self.jumpIf(b.memberExpression(b.assignmentExpression("=",keyInfoTmpVar,b.callExpression(keyIterNextFn,[])),b.identifier("done"),false),after);self.emitAssign(stmt.left,b.memberExpression(keyInfoTmpVar,b.identifier("value"),false));self.leapManager.withEntry(new leap.LoopEntry(after,head,labelId),function(){self.explodeStatement(path.get("body"))});self.jump(head);self.mark(after);break;case"BreakStatement":self.emitAbruptCompletion({type:"break",target:self.leapManager.getBreakLoc(stmt.label)});break;case"ContinueStatement":self.emitAbruptCompletion({type:"continue",target:self.leapManager.getContinueLoc(stmt.label)});break;case"SwitchStatement":var disc=self.emitAssign(self.makeTempVar(),self.explodeExpression(path.get("discriminant")));var after=loc();var defaultLoc=loc();var condition=defaultLoc;var caseLocs=[];var cases=stmt.cases||[];for(var i=cases.length-1;i>=0;--i){var c=cases[i];n.SwitchCase.assert(c);if(c.test){condition=b.conditionalExpression(b.binaryExpression("===",disc,c.test),caseLocs[i]=loc(),condition)}else{caseLocs[i]=defaultLoc}}self.jump(self.explodeExpression(new types.NodePath(condition,path,"discriminant")));self.leapManager.withEntry(new leap.SwitchEntry(after),function(){path.get("cases").each(function(casePath){var c=casePath.value;var i=casePath.name;self.mark(caseLocs[i]);casePath.get("consequent").each(self.explodeStatement,self)})});self.mark(after);if(defaultLoc.value===-1){self.mark(defaultLoc);assert.strictEqual(after.value,defaultLoc.value)}break;case"IfStatement":var elseLoc=stmt.alternate&&loc();var after=loc();self.jumpIfNot(self.explodeExpression(path.get("test")),elseLoc||after);self.explodeStatement(path.get("consequent"));if(elseLoc){self.jump(after);self.mark(elseLoc);self.explodeStatement(path.get("alternate"))}self.mark(after);break;case"ReturnStatement":self.emitAbruptCompletion({type:"return",value:self.explodeExpression(path.get("argument"))});break;case"WithStatement":throw new Error(node.type+" not supported in generator functions.");case"TryStatement":var after=loc();var handler=stmt.handler;if(!handler&&stmt.handlers){handler=stmt.handlers[0]||null}var catchLoc=handler&&loc();var catchEntry=catchLoc&&new leap.CatchEntry(catchLoc,handler.param);var finallyLoc=stmt.finalizer&&loc();var finallyEntry=finallyLoc&&new leap.FinallyEntry(finallyLoc);var tryEntry=new leap.TryEntry(self.getUnmarkedCurrentLoc(),catchEntry,finallyEntry);self.tryEntries.push(tryEntry);self.updateContextPrevLoc(tryEntry.firstLoc);self.leapManager.withEntry(tryEntry,function(){self.explodeStatement(path.get("block"));if(catchLoc){if(finallyLoc){self.jump(finallyLoc)}else{self.jump(after)}self.updateContextPrevLoc(self.mark(catchLoc));var bodyPath=path.get("handler","body");var safeParam=self.makeTempVar();self.clearPendingException(tryEntry.firstLoc,safeParam);var catchScope=bodyPath.scope;var catchParamName=handler.param.name;n.CatchClause.assert(catchScope.node);assert.strictEqual(catchScope.lookup(catchParamName),catchScope);types.visit(bodyPath,{visitIdentifier:function(path){if(path.value.name===catchParamName&&path.scope.lookup(catchParamName)===catchScope){return safeParam}this.traverse(path)}});self.leapManager.withEntry(catchEntry,function(){self.explodeStatement(bodyPath)})}if(finallyLoc){self.updateContextPrevLoc(self.mark(finallyLoc));self.leapManager.withEntry(finallyEntry,function(){self.explodeStatement(path.get("finalizer"))});self.emit(b.callExpression(self.contextProperty("finish"),[finallyEntry.firstLoc]))}});self.mark(after);break;case"ThrowStatement":self.emit(b.throwStatement(self.explodeExpression(path.get("argument"))));break;default:throw new Error("unknown Statement of type "+JSON.stringify(stmt.type))}};Ep.emitAbruptCompletion=function(record){try{assert.ok(isValidCompletion(record))}catch(err){err.message="invalid completion record: "+JSON.stringify(record);throw err}assert.notStrictEqual(record.type,"normal","normal completions are not abrupt");var abruptArgs=[b.literal(record.type)];if(record.type==="break"||record.type==="continue"){n.Literal.assert(record.target);abruptArgs[1]=record.target}else if(record.type==="return"||record.type==="throw"){if(record.value){n.Expression.assert(record.value);abruptArgs[1]=record.value}}this.emit(b.returnStatement(b.callExpression(this.contextProperty("abrupt"),abruptArgs)))};function isValidCompletion(record){var type=record.type;if(type==="normal"){return!hasOwn.call(record,"target")}if(type==="break"||type==="continue"){return!hasOwn.call(record,"value")&&n.Literal.check(record.target)}if(type==="return"||type==="throw"){return hasOwn.call(record,"value")&&!hasOwn.call(record,"target")}return false}Ep.getUnmarkedCurrentLoc=function(){return b.literal(this.listing.length)};Ep.updateContextPrevLoc=function(loc){if(loc){n.Literal.assert(loc);if(loc.value===-1){loc.value=this.listing.length}else{assert.strictEqual(loc.value,this.listing.length)}}else{loc=this.getUnmarkedCurrentLoc()}this.emitAssign(this.contextProperty("prev"),loc)};Ep.explodeExpression=function(path,ignoreResult){assert.ok(path instanceof types.NodePath);var expr=path.value;if(expr){n.Expression.assert(expr)}else{return expr}var self=this;var result;function finish(expr){n.Expression.assert(expr);if(ignoreResult){self.emit(expr)}else{return expr}}if(!meta.containsLeap(expr)){return finish(expr)}var hasLeapingChildren=meta.containsLeap.onlyChildren(expr);function explodeViaTempVar(tempVar,childPath,ignoreChildResult){assert.ok(childPath instanceof types.NodePath);assert.ok(!ignoreChildResult||!tempVar,"Ignoring the result of a child expression but forcing it to "+"be assigned to a temporary variable?");var result=self.explodeExpression(childPath,ignoreChildResult);if(ignoreChildResult){}else if(tempVar||hasLeapingChildren&&(self.isVolatileContextProperty(result)||meta.hasSideEffects(result))){result=self.emitAssign(tempVar||self.makeTempVar(),result)}return result}switch(expr.type){case"ParenthesizedExpression":return finish(b.parenthesizedExpression(self.explodeExpression(path.get("expression"))));case"MemberExpression":return finish(b.memberExpression(self.explodeExpression(path.get("object")),expr.computed?explodeViaTempVar(null,path.get("property")):expr.property,expr.computed));case"CallExpression":var oldCalleePath=path.get("callee");var newCallee=self.explodeExpression(oldCalleePath);if(!n.MemberExpression.check(oldCalleePath.node)&&n.MemberExpression.check(newCallee)){newCallee=b.sequenceExpression([b.literal(0),newCallee])}return finish(b.callExpression(newCallee,path.get("arguments").map(function(argPath){return explodeViaTempVar(null,argPath)})));case"NewExpression":return finish(b.newExpression(explodeViaTempVar(null,path.get("callee")),path.get("arguments").map(function(argPath){return explodeViaTempVar(null,argPath)})));case"ObjectExpression":return finish(b.objectExpression(path.get("properties").map(function(propPath){return b.property(propPath.value.kind,propPath.value.key,explodeViaTempVar(null,propPath.get("value")))})));case"ArrayExpression":return finish(b.arrayExpression(path.get("elements").map(function(elemPath){return explodeViaTempVar(null,elemPath)})));case"SequenceExpression":var lastIndex=expr.expressions.length-1;path.get("expressions").each(function(exprPath){if(exprPath.name===lastIndex){result=self.explodeExpression(exprPath,ignoreResult)}else{self.explodeExpression(exprPath,true)}});return result;case"LogicalExpression":var after=loc();if(!ignoreResult){result=self.makeTempVar()}var left=explodeViaTempVar(result,path.get("left"));if(expr.operator==="&&"){self.jumpIfNot(left,after)}else{assert.strictEqual(expr.operator,"||");self.jumpIf(left,after)}explodeViaTempVar(result,path.get("right"),ignoreResult);self.mark(after);return result;case"ConditionalExpression":var elseLoc=loc();var after=loc();var test=self.explodeExpression(path.get("test"));self.jumpIfNot(test,elseLoc);if(!ignoreResult){result=self.makeTempVar()}explodeViaTempVar(result,path.get("consequent"),ignoreResult);self.jump(after);self.mark(elseLoc);explodeViaTempVar(result,path.get("alternate"),ignoreResult);self.mark(after);return result;case"UnaryExpression":return finish(b.unaryExpression(expr.operator,self.explodeExpression(path.get("argument")),!!expr.prefix));case"BinaryExpression":return finish(b.binaryExpression(expr.operator,explodeViaTempVar(null,path.get("left")),explodeViaTempVar(null,path.get("right"))));case"AssignmentExpression":return finish(b.assignmentExpression(expr.operator,self.explodeExpression(path.get("left")),self.explodeExpression(path.get("right"))));case"UpdateExpression":return finish(b.updateExpression(expr.operator,self.explodeExpression(path.get("argument")),expr.prefix));case"YieldExpression":var after=loc();var arg=expr.argument&&self.explodeExpression(path.get("argument"));if(arg&&expr.delegate){var result=self.makeTempVar();self.emit(b.returnStatement(b.callExpression(self.contextProperty("delegateYield"),[arg,b.literal(result.property.name),after])));self.mark(after);return result}self.emitAssign(self.contextProperty("next"),after);self.emit(b.returnStatement(arg||null));self.mark(after);return self.contextProperty("sent");default:throw new Error("unknown Expression of type "+JSON.stringify(expr.type))}}},{"./leap":94,"./meta":95,"./util":96,assert:76,"ast-types":74}],93:[function(require,module,exports){var assert=require("assert");var types=require("ast-types");var n=types.namedTypes;var b=types.builders;var hasOwn=Object.prototype.hasOwnProperty;exports.hoist=function(funPath){assert.ok(funPath instanceof types.NodePath);n.Function.assert(funPath.value);var vars={};function varDeclToExpr(vdec,includeIdentifiers){n.VariableDeclaration.assert(vdec);var exprs=[];vdec.declarations.forEach(function(dec){vars[dec.id.name]=dec.id;if(dec.init){exprs.push(b.assignmentExpression("=",dec.id,dec.init))}else if(includeIdentifiers){exprs.push(dec.id)}});if(exprs.length===0)return null;if(exprs.length===1)return exprs[0];return b.sequenceExpression(exprs)}types.visit(funPath.get("body"),{visitVariableDeclaration:function(path){var expr=varDeclToExpr(path.value,false);if(expr===null){path.replace()}else{return b.expressionStatement(expr)}return false},visitForStatement:function(path){var init=path.value.init;if(n.VariableDeclaration.check(init)){path.get("init").replace(varDeclToExpr(init,false))}this.traverse(path)},visitForInStatement:function(path){var left=path.value.left;if(n.VariableDeclaration.check(left)){path.get("left").replace(varDeclToExpr(left,true))}this.traverse(path)},visitFunctionDeclaration:function(path){var node=path.value;vars[node.id.name]=node.id;var parentNode=path.parent.node;var assignment=b.expressionStatement(b.assignmentExpression("=",node.id,b.functionExpression(node.id,node.params,node.body,node.generator,node.expression)));if(n.BlockStatement.check(path.parent.node)){path.parent.get("body").unshift(assignment);path.replace()}else{path.replace(assignment)}return false},visitFunctionExpression:function(path){return false}});var paramNames={};funPath.get("params").each(function(paramPath){var param=paramPath.value;if(n.Identifier.check(param)){paramNames[param.name]=param}else{}});var declarations=[];Object.keys(vars).forEach(function(name){if(!hasOwn.call(paramNames,name)){declarations.push(b.variableDeclarator(vars[name],null))}});if(declarations.length===0){return null}return b.variableDeclaration("var",declarations)}},{assert:76,"ast-types":74}],94:[function(require,module,exports){var assert=require("assert");var types=require("ast-types");var n=types.namedTypes;var b=types.builders;var inherits=require("util").inherits;var hasOwn=Object.prototype.hasOwnProperty;function Entry(){assert.ok(this instanceof Entry)}function FunctionEntry(returnLoc){Entry.call(this);n.Literal.assert(returnLoc);Object.defineProperties(this,{returnLoc:{value:returnLoc}})}inherits(FunctionEntry,Entry);exports.FunctionEntry=FunctionEntry;function LoopEntry(breakLoc,continueLoc,label){Entry.call(this);n.Literal.assert(breakLoc);n.Literal.assert(continueLoc);if(label){n.Identifier.assert(label)}else{label=null}Object.defineProperties(this,{breakLoc:{value:breakLoc},continueLoc:{value:continueLoc},label:{value:label}})}inherits(LoopEntry,Entry);exports.LoopEntry=LoopEntry;function SwitchEntry(breakLoc){Entry.call(this);n.Literal.assert(breakLoc);Object.defineProperties(this,{breakLoc:{value:breakLoc}})}inherits(SwitchEntry,Entry);exports.SwitchEntry=SwitchEntry;function TryEntry(firstLoc,catchEntry,finallyEntry){Entry.call(this);n.Literal.assert(firstLoc);if(catchEntry){assert.ok(catchEntry instanceof CatchEntry)}else{catchEntry=null}if(finallyEntry){assert.ok(finallyEntry instanceof FinallyEntry)}else{finallyEntry=null}assert.ok(catchEntry||finallyEntry);Object.defineProperties(this,{firstLoc:{value:firstLoc},catchEntry:{value:catchEntry},finallyEntry:{value:finallyEntry}})}inherits(TryEntry,Entry);exports.TryEntry=TryEntry;function CatchEntry(firstLoc,paramId){Entry.call(this);n.Literal.assert(firstLoc);n.Identifier.assert(paramId);Object.defineProperties(this,{firstLoc:{value:firstLoc},paramId:{value:paramId}})}inherits(CatchEntry,Entry);exports.CatchEntry=CatchEntry;function FinallyEntry(firstLoc){Entry.call(this);n.Literal.assert(firstLoc);Object.defineProperties(this,{firstLoc:{value:firstLoc}})}inherits(FinallyEntry,Entry);exports.FinallyEntry=FinallyEntry;function LeapManager(emitter){assert.ok(this instanceof LeapManager);var Emitter=require("./emit").Emitter;assert.ok(emitter instanceof Emitter);Object.defineProperties(this,{emitter:{value:emitter},entryStack:{value:[new FunctionEntry(emitter.finalLoc)]}})}var LMp=LeapManager.prototype;exports.LeapManager=LeapManager;LMp.withEntry=function(entry,callback){assert.ok(entry instanceof Entry);this.entryStack.push(entry);try{callback.call(this.emitter)}finally{var popped=this.entryStack.pop();assert.strictEqual(popped,entry)}};LMp._findLeapLocation=function(property,label){for(var i=this.entryStack.length-1;i>=0;--i){var entry=this.entryStack[i];var loc=entry[property];if(loc){if(label){if(entry.label&&entry.label.name===label.name){return loc}}else{return loc}}}return null};LMp.getBreakLoc=function(label){return this._findLeapLocation("breakLoc",label)};LMp.getContinueLoc=function(label){return this._findLeapLocation("continueLoc",label)}},{"./emit":92,assert:76,"ast-types":74,util:85}],95:[function(require,module,exports){var assert=require("assert");var m=require("private").makeAccessor();var types=require("ast-types");var isArray=types.builtInTypes.array;var n=types.namedTypes;var hasOwn=Object.prototype.hasOwnProperty;function makePredicate(propertyName,knownTypes){function onlyChildren(node){n.Node.assert(node);var result=false;function check(child){if(result){}else if(isArray.check(child)){child.some(check)}else if(n.Node.check(child)){assert.strictEqual(result,false);result=predicate(child)}return result}types.eachField(node,function(name,child){check(child)});return result}function predicate(node){n.Node.assert(node);var meta=m(node);if(hasOwn.call(meta,propertyName))return meta[propertyName];if(hasOwn.call(opaqueTypes,node.type))return meta[propertyName]=false;
if(hasOwn.call(knownTypes,node.type))return meta[propertyName]=true;return meta[propertyName]=onlyChildren(node)}predicate.onlyChildren=onlyChildren;return predicate}var opaqueTypes={FunctionExpression:true};var sideEffectTypes={CallExpression:true,ForInStatement:true,UnaryExpression:true,BinaryExpression:true,AssignmentExpression:true,UpdateExpression:true,NewExpression:true};var leapTypes={YieldExpression:true,BreakStatement:true,ContinueStatement:true,ReturnStatement:true,ThrowStatement:true};for(var type in leapTypes){if(hasOwn.call(leapTypes,type)){sideEffectTypes[type]=leapTypes[type]}}exports.hasSideEffects=makePredicate("hasSideEffects",sideEffectTypes);exports.containsLeap=makePredicate("containsLeap",leapTypes)},{assert:76,"ast-types":74,"private":99}],96:[function(require,module,exports){var b=require("ast-types").builders;var hasOwn=Object.prototype.hasOwnProperty;exports.defaults=function(obj){var len=arguments.length;var extension;for(var i=1;i<len;++i){if(extension=arguments[i]){for(var key in extension){if(hasOwn.call(extension,key)&&!hasOwn.call(obj,key)){obj[key]=extension[key]}}}}return obj};exports.runtimeProperty=function(name){return b.memberExpression(b.identifier("regeneratorRuntime"),b.identifier(name),false)}},{"ast-types":74}],97:[function(require,module,exports){var assert=require("assert");var fs=require("fs");var types=require("ast-types");var n=types.namedTypes;var b=types.builders;var isArray=types.builtInTypes.array;var isObject=types.builtInTypes.object;var NodePath=types.NodePath;var hoist=require("./hoist").hoist;var Emitter=require("./emit").Emitter;var runtimeProperty=require("./util").runtimeProperty;var runtimeWrapMethod=runtimeProperty("wrap");var runtimeMarkMethod=runtimeProperty("mark");var runtimeValuesMethod=runtimeProperty("values");var runtimeAsyncMethod=runtimeProperty("async");exports.transform=function transform(node,options){return types.visit(node,visitor)};var visitor=types.PathVisitor.fromMethodsObject({visitFunction:function(path){this.traverse(path);var node=path.value;if(!node.generator&&!node.async){return}node.generator=false;if(node.expression){node.expression=false;node.body=b.blockStatement([b.returnStatement(node.body)])}if(node.async){awaitVisitor.visit(path.get("body"))}var outerFnId=node.id||(node.id=path.scope.parent.declareTemporary("callee$"));var innerFnId=b.identifier(node.id.name+"$");var contextId=path.scope.declareTemporary("context$");var argsId=path.scope.declareTemporary("args$");var shouldAliasArguments=renameArguments(path,argsId);var vars=hoist(path);if(shouldAliasArguments){vars=vars||b.variableDeclaration("var",[]);vars.declarations.push(b.variableDeclarator(argsId,b.identifier("arguments")))}var emitter=new Emitter(contextId);emitter.explode(path.get("body"));var outerBody=[];if(vars&&vars.declarations.length>0){outerBody.push(vars)}var wrapArgs=[emitter.getContextFunction(innerFnId),node.async?b.literal(null):outerFnId,b.thisExpression()];var tryEntryList=emitter.getTryEntryList();if(tryEntryList){wrapArgs.push(tryEntryList)}var wrapCall=b.callExpression(node.async?runtimeAsyncMethod:runtimeWrapMethod,wrapArgs);outerBody.push(b.returnStatement(wrapCall));node.body=b.blockStatement(outerBody);if(node.async){node.async=false;return}if(n.FunctionDeclaration.check(node)){var pp=path.parent;while(pp&&!(n.BlockStatement.check(pp.value)||n.Program.check(pp.value))){pp=pp.parent}if(!pp){return}path.replace();node.type="FunctionExpression";var varDecl=b.variableDeclaration("var",[b.variableDeclarator(node.id,b.callExpression(runtimeMarkMethod,[node]))]);if(node.comments){varDecl.comments=node.comments;node.comments=null}var bodyPath=pp.get("body");var bodyLen=bodyPath.value.length;for(var i=0;i<bodyLen;++i){var firstStmtPath=bodyPath.get(i);if(!shouldNotHoistAbove(firstStmtPath)){firstStmtPath.insertBefore(varDecl);return}}bodyPath.push(varDecl)}else{n.FunctionExpression.assert(node);return b.callExpression(runtimeMarkMethod,[node])}}});function shouldNotHoistAbove(stmtPath){var value=stmtPath.value;n.Statement.assert(value);if(n.ExpressionStatement.check(value)&&n.Literal.check(value.expression)&&value.expression.value==="use strict"){return true}if(n.VariableDeclaration.check(value)){for(var i=0;i<value.declarations.length;++i){var decl=value.declarations[i];if(n.CallExpression.check(decl.init)&&types.astNodesAreEquivalent(decl.init.callee,runtimeMarkMethod)){return true}}}return false}function renameArguments(funcPath,argsId){assert.ok(funcPath instanceof types.NodePath);var func=funcPath.value;var didReplaceArguments=false;var hasImplicitArguments=false;types.visit(funcPath,{visitFunction:function(path){if(path.value===func){hasImplicitArguments=!path.scope.lookup("arguments");this.traverse(path)}else{return false}},visitIdentifier:function(path){if(path.value.name==="arguments"){var isMemberProperty=n.MemberExpression.check(path.parent.node)&&path.name==="property"&&!path.parent.node.computed;if(!isMemberProperty){path.replace(argsId);didReplaceArguments=true;return false}}this.traverse(path)}});return didReplaceArguments&&hasImplicitArguments}var awaitVisitor=types.PathVisitor.fromMethodsObject({visitFunction:function(path){return false},visitAwaitExpression:function(path){return b.yieldExpression(path.value.argument,false)}})},{"./emit":92,"./hoist":93,"./util":96,assert:76,"ast-types":74,fs:75}],98:[function(require,module,exports){(function(__dirname){var assert=require("assert");var path=require("path");var fs=require("fs");var transform=require("./lib/visit").transform;var utils=require("./lib/util");var types=require("ast-types");var genOrAsyncFunExp=/\bfunction\s*\*|\basync\b/;var blockBindingExp=/\b(let|const)\s+/;function runtime(){require("./runtime")}exports.runtime=runtime;runtime.path=path.join(__dirname,"runtime.js");exports.transform=transform}).call(this,"/node_modules/regenerator-6to5")},{"./lib/util":96,"./lib/visit":97,"./runtime":106,assert:76,"ast-types":74,fs:75,path:82}],99:[function(require,module,exports){"use strict";var originalObject=Object;var originalDefProp=Object.defineProperty;var originalCreate=Object.create;function defProp(obj,name,value){if(originalDefProp)try{originalDefProp.call(originalObject,obj,name,{value:value})}catch(definePropertyIsBrokenInIE8){obj[name]=value}else{obj[name]=value}}function makeSafeToCall(fun){if(fun){defProp(fun,"call",fun.call);defProp(fun,"apply",fun.apply)}return fun}makeSafeToCall(originalDefProp);makeSafeToCall(originalCreate);var hasOwn=makeSafeToCall(Object.prototype.hasOwnProperty);var numToStr=makeSafeToCall(Number.prototype.toString);var strSlice=makeSafeToCall(String.prototype.slice);var cloner=function(){};function create(prototype){if(originalCreate){return originalCreate.call(originalObject,prototype)}cloner.prototype=prototype||null;return new cloner}var rand=Math.random;var uniqueKeys=create(null);function makeUniqueKey(){do var uniqueKey=strSlice.call(numToStr.call(rand(),36),2);while(hasOwn.call(uniqueKeys,uniqueKey));return uniqueKeys[uniqueKey]=uniqueKey}defProp(exports,"makeUniqueKey",makeUniqueKey);var originalGetOPNs=Object.getOwnPropertyNames;Object.getOwnPropertyNames=function getOwnPropertyNames(object){for(var names=originalGetOPNs(object),src=0,dst=0,len=names.length;src<len;++src){if(!hasOwn.call(uniqueKeys,names[src])){if(src>dst){names[dst]=names[src]}++dst}}names.length=dst;return names};function defaultCreatorFn(object){return create(null)}function makeAccessor(secretCreatorFn){var brand=makeUniqueKey();var passkey=create(null);secretCreatorFn=secretCreatorFn||defaultCreatorFn;function register(object){var secret;function vault(key,forget){if(key===passkey){return forget?secret=null:secret||(secret=secretCreatorFn(object))}}defProp(object,brand,vault)}function accessor(object){if(!hasOwn.call(object,brand))register(object);return object[brand](passkey)}accessor.forget=function(object){if(hasOwn.call(object,brand))object[brand](passkey,true)};return accessor}defProp(exports,"makeAccessor",makeAccessor)},{}],100:[function(require,module,exports){"use strict";module.exports=require("./lib/core.js");require("./lib/done.js");require("./lib/es6-extensions.js");require("./lib/node-extensions.js")},{"./lib/core.js":101,"./lib/done.js":102,"./lib/es6-extensions.js":103,"./lib/node-extensions.js":104}],101:[function(require,module,exports){"use strict";var asap=require("asap");module.exports=Promise;function Promise(fn){if(typeof this!=="object")throw new TypeError("Promises must be constructed via new");if(typeof fn!=="function")throw new TypeError("not a function");var state=null;var value=null;var deferreds=[];var self=this;this.then=function(onFulfilled,onRejected){return new self.constructor(function(resolve,reject){handle(new Handler(onFulfilled,onRejected,resolve,reject))})};function handle(deferred){if(state===null){deferreds.push(deferred);return}asap(function(){var cb=state?deferred.onFulfilled:deferred.onRejected;if(cb===null){(state?deferred.resolve:deferred.reject)(value);return}var ret;try{ret=cb(value)}catch(e){deferred.reject(e);return}deferred.resolve(ret)})}function resolve(newValue){try{if(newValue===self)throw new TypeError("A promise cannot be resolved with itself.");if(newValue&&(typeof newValue==="object"||typeof newValue==="function")){var then=newValue.then;if(typeof then==="function"){doResolve(then.bind(newValue),resolve,reject);return}}state=true;value=newValue;finale()}catch(e){reject(e)}}function reject(newValue){state=false;value=newValue;finale()}function finale(){for(var i=0,len=deferreds.length;i<len;i++)handle(deferreds[i]);deferreds=null}doResolve(fn,resolve,reject)}function Handler(onFulfilled,onRejected,resolve,reject){this.onFulfilled=typeof onFulfilled==="function"?onFulfilled:null;this.onRejected=typeof onRejected==="function"?onRejected:null;this.resolve=resolve;this.reject=reject}function doResolve(fn,onFulfilled,onRejected){var done=false;try{fn(function(value){if(done)return;done=true;onFulfilled(value)},function(reason){if(done)return;done=true;onRejected(reason)})}catch(ex){if(done)return;done=true;onRejected(ex)}}},{asap:105}],102:[function(require,module,exports){"use strict";var Promise=require("./core.js");var asap=require("asap");module.exports=Promise;Promise.prototype.done=function(onFulfilled,onRejected){var self=arguments.length?this.then.apply(this,arguments):this;self.then(null,function(err){asap(function(){throw err})})}},{"./core.js":101,asap:105}],103:[function(require,module,exports){"use strict";var Promise=require("./core.js");var asap=require("asap");module.exports=Promise;function ValuePromise(value){this.then=function(onFulfilled){if(typeof onFulfilled!=="function")return this;return new Promise(function(resolve,reject){asap(function(){try{resolve(onFulfilled(value))}catch(ex){reject(ex)}})})}}ValuePromise.prototype=Promise.prototype;var TRUE=new ValuePromise(true);var FALSE=new ValuePromise(false);var NULL=new ValuePromise(null);var UNDEFINED=new ValuePromise(undefined);var ZERO=new ValuePromise(0);var EMPTYSTRING=new ValuePromise("");Promise.resolve=function(value){if(value instanceof Promise)return value;if(value===null)return NULL;if(value===undefined)return UNDEFINED;if(value===true)return TRUE;if(value===false)return FALSE;if(value===0)return ZERO;if(value==="")return EMPTYSTRING;if(typeof value==="object"||typeof value==="function"){try{var then=value.then;if(typeof then==="function"){return new Promise(then.bind(value))}}catch(ex){return new Promise(function(resolve,reject){reject(ex)})}}return new ValuePromise(value)};Promise.all=function(arr){var args=Array.prototype.slice.call(arr);return new Promise(function(resolve,reject){if(args.length===0)return resolve([]);var remaining=args.length;function res(i,val){try{if(val&&(typeof val==="object"||typeof val==="function")){var then=val.then;if(typeof then==="function"){then.call(val,function(val){res(i,val)},reject);return}}args[i]=val;if(--remaining===0){resolve(args)}}catch(ex){reject(ex)}}for(var i=0;i<args.length;i++){res(i,args[i])}})};Promise.reject=function(value){return new Promise(function(resolve,reject){reject(value)})};Promise.race=function(values){return new Promise(function(resolve,reject){values.forEach(function(value){Promise.resolve(value).then(resolve,reject)})})};Promise.prototype["catch"]=function(onRejected){return this.then(null,onRejected)}},{"./core.js":101,asap:105}],104:[function(require,module,exports){"use strict";var Promise=require("./core.js");var asap=require("asap");module.exports=Promise;Promise.denodeify=function(fn,argumentCount){argumentCount=argumentCount||Infinity;return function(){var self=this;var args=Array.prototype.slice.call(arguments);return new Promise(function(resolve,reject){while(args.length&&args.length>argumentCount){args.pop()}args.push(function(err,res){if(err)reject(err);else resolve(res)});fn.apply(self,args)})}};Promise.nodeify=function(fn){return function(){var args=Array.prototype.slice.call(arguments);var callback=typeof args[args.length-1]==="function"?args.pop():null;var ctx=this;try{return fn.apply(this,arguments).nodeify(callback,ctx)}catch(ex){if(callback===null||typeof callback=="undefined"){return new Promise(function(resolve,reject){reject(ex)})}else{asap(function(){callback.call(ctx,ex)})}}}};Promise.prototype.nodeify=function(callback,ctx){if(typeof callback!="function")return this;this.then(function(value){asap(function(){callback.call(ctx,null,value)})},function(err){asap(function(){callback.call(ctx,err)})})}},{"./core.js":101,asap:105}],105:[function(require,module,exports){(function(process){var head={task:void 0,next:null};var tail=head;var flushing=false;var requestFlush=void 0;var isNodeJS=false;function flush(){while(head.next){head=head.next;var task=head.task;head.task=void 0;var domain=head.domain;if(domain){head.domain=void 0;domain.enter()}try{task()}catch(e){if(isNodeJS){if(domain){domain.exit()}setTimeout(flush,0);if(domain){domain.enter()}throw e}else{setTimeout(function(){throw e},0)}}if(domain){domain.exit()}}flushing=false}if(typeof process!=="undefined"&&process.nextTick){isNodeJS=true;requestFlush=function(){process.nextTick(flush)}}else if(typeof setImmediate==="function"){if(typeof window!=="undefined"){requestFlush=setImmediate.bind(window,flush)}else{requestFlush=function(){setImmediate(flush)}}}else if(typeof MessageChannel!=="undefined"){var channel=new MessageChannel;channel.port1.onmessage=flush;requestFlush=function(){channel.port2.postMessage(0)}}else{requestFlush=function(){setTimeout(flush,0)}}function asap(task){tail=tail.next={task:task,domain:isNodeJS&&process.domain,next:null};if(!flushing){flushing=true;requestFlush()}}module.exports=asap}).call(this,require("_process"))},{_process:83}],106:[function(require,module,exports){!function(){var hasOwn=Object.prototype.hasOwnProperty;var undefined;var iteratorSymbol=typeof Symbol==="function"&&Symbol.iterator||"@@iterator";if(typeof Promise==="undefined")try{Promise=require("promise")}catch(ignored){}if(typeof regeneratorRuntime==="object"){return}var runtime=regeneratorRuntime=typeof exports==="undefined"?{}:exports;function wrap(innerFn,outerFn,self,tryList){return new Generator(innerFn,outerFn,self||null,tryList||[])}runtime.wrap=wrap;var GenStateSuspendedStart="suspendedStart";var GenStateSuspendedYield="suspendedYield";var GenStateExecuting="executing";var GenStateCompleted="completed";var ContinueSentinel={};function GeneratorFunction(){}var Gp=Generator.prototype;var GFp=GeneratorFunction.prototype=Object.create(Function.prototype);GFp.constructor=GeneratorFunction;GFp.prototype=Gp;Gp.constructor=GFp;if(GeneratorFunction.name!=="GeneratorFunction"){GeneratorFunction.name="GeneratorFunction"}if(GeneratorFunction.name!=="GeneratorFunction"){throw new Error("GeneratorFunction renamed?")}runtime.isGeneratorFunction=function(genFun){var ctor=genFun&&genFun.constructor;return ctor?GeneratorFunction.name===ctor.name:false};runtime.mark=function(genFun){genFun.__proto__=GFp;genFun.prototype=Object.create(Gp);return genFun};runtime.async=function(innerFn,outerFn,self,tryList){return new Promise(function(resolve,reject){var generator=wrap(innerFn,outerFn,self,tryList);var callNext=step.bind(generator.next);var callThrow=step.bind(generator.throw);function step(arg){try{var info=this(arg);var value=info.value}catch(error){return reject(error)}if(info.done){resolve(value)}else{Promise.resolve(value).then(callNext,callThrow)}}callNext()})};function Generator(innerFn,outerFn,self,tryList){var generator=outerFn?Object.create(outerFn.prototype):this;var context=new Context(tryList);var state=GenStateSuspendedStart;function invoke(method,arg){if(state===GenStateExecuting){throw new Error("Generator is already running")}if(state===GenStateCompleted){throw new Error("Generator has already finished")}while(true){var delegate=context.delegate;if(delegate){try{var info=delegate.iterator[method](arg);method="next";arg=undefined}catch(uncaught){context.delegate=null;method="throw";arg=uncaught;continue}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===GenStateSuspendedStart&&typeof arg!=="undefined"){throw new TypeError("attempt to send "+JSON.stringify(arg)+" to newborn generator")}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)){method="next";arg=undefined}}else if(method==="return"){context.abrupt("return",arg)}state=GenStateExecuting;try{var value=innerFn.call(self,context);state=context.done?GenStateCompleted:GenStateSuspendedYield;var info={value:value,done:context.done};if(value===ContinueSentinel){if(context.delegate&&method==="next"){arg=undefined}}else{return info}}catch(thrown){state=GenStateCompleted;if(method==="next"){context.dispatchException(thrown)}else{arg=thrown}}}}generator.next=invoke.bind(generator,"next");generator.throw=invoke.bind(generator,"throw");generator.return=invoke.bind(generator,"return");return generator}Gp[iteratorSymbol]=function(){return this};Gp.toString=function(){return"[object Generator]"};function pushTryEntry(triple){var entry={tryLoc:triple[0]};if(1 in triple){entry.catchLoc=triple[1]}if(2 in triple){entry.finallyLoc=triple[2]}this.tryEntries.push(entry)}function resetTryEntry(entry,i){var record=entry.completion||{};record.type=i===0?"normal":"return";delete record.arg;entry.completion=record}function Context(tryList){this.tryEntries=[{tryLoc:"root"}];tryList.forEach(pushTryEntry,this);this.reset()}runtime.keys=function(object){var keys=[];for(var key in object){keys.push(key)}keys.reverse();return function next(){while(keys.length){var key=keys.pop();if(key in object){next.value=key;next.done=false;return next}}next.done=true;return next}};function values(iterable){var iterator=iterable;if(iteratorSymbol in iterable){iterator=iterable[iteratorSymbol]()}else if(!isNaN(iterable.length)){var i=-1;iterator=function next(){while(++i<iterable.length){if(i in iterable){next.value=iterable[i];next.done=false;return next}}next.done=true;return next};iterator.next=iterator}return iterator}runtime.values=values;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);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"){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")}}}},_findFinallyEntry:function(finallyLoc){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc<=this.prev&&hasOwn.call(entry,"finallyLoc")&&(entry.finallyLoc===finallyLoc||this.prev<entry.finallyLoc)){return entry}}},abrupt:function(type,arg){var entry=this._findFinallyEntry();var record=entry?entry.completion:{};record.type=type;record.arg=arg;if(entry){this.next=entry.finallyLoc}else{this.complete(record)}return ContinueSentinel},complete:function(record){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"}return ContinueSentinel},finish:function(finallyLoc){var entry=this._findFinallyEntry(finallyLoc);return this.complete(entry.completion)},"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,i)}return thrown}}throw new Error("illegal catch attempt")},delegateYield:function(iterable,resultName,nextLoc){this.delegate={iterator:values(iterable),resultName:resultName,nextLoc:nextLoc};return ContinueSentinel}}}()},{promise:100}],107:[function(require,module,exports){var regenerate=require("regenerate");exports.REGULAR={d:regenerate().addRange(48,57),D:regenerate().addRange(0,47).addRange(58,65535),s:regenerate(32,160,5760,6158,8239,8287,12288,65279).addRange(9,13).addRange(8192,8202).addRange(8232,8233),S:regenerate().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:regenerate(95).addRange(48,57).addRange(65,90).addRange(97,122),W:regenerate(96).addRange(0,47).addRange(58,64).addRange(91,94).addRange(123,65535)};exports.UNICODE={d:regenerate().addRange(48,57),D:regenerate().addRange(0,47).addRange(58,1114111),s:regenerate(32,160,5760,6158,8239,8287,12288,65279).addRange(9,13).addRange(8192,8202).addRange(8232,8233),S:regenerate().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:regenerate(95).addRange(48,57).addRange(65,90).addRange(97,122),W:regenerate(96).addRange(0,47).addRange(58,64).addRange(91,94).addRange(123,1114111)};exports.UNICODE_IGNORE_CASE={d:regenerate().addRange(48,57),D:regenerate().addRange(0,47).addRange(58,1114111),s:regenerate(32,160,5760,6158,8239,8287,12288,65279).addRange(9,13).addRange(8192,8202).addRange(8232,8233),S:regenerate().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:regenerate(95,383,8490).addRange(48,57).addRange(65,90).addRange(97,122),W:regenerate(75,83,96).addRange(0,47).addRange(58,64).addRange(91,94).addRange(123,1114111)}},{regenerate:109}],108:[function(require,module,exports){module.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}},{}],109:[function(require,module,exports){(function(global){(function(root){var freeExports=typeof exports=="object"&&exports;var freeModule=typeof module=="object"&&module&&module.exports==freeExports&&module;var freeGlobal=typeof global=="object"&&global;if(freeGlobal.global===freeGlobal||freeGlobal.window===freeGlobal){root=freeGlobal}var ERRORS={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."};var HIGH_SURROGATE_MIN=55296;var HIGH_SURROGATE_MAX=56319;var LOW_SURROGATE_MIN=56320;var LOW_SURROGATE_MAX=57343;var regexNull=/\\x00([^0123456789]|$)/g;var object={};var hasOwnProperty=object.hasOwnProperty;var extend=function(destination,source){var key;for(key in source){if(hasOwnProperty.call(source,key)){destination[key]=source[key]}}return destination};var forEach=function(array,callback){var index=-1;var length=array.length;while(++index<length){callback(array[index],index)}};var toString=object.toString;var isArray=function(value){return toString.call(value)=="[object Array]"};var isNumber=function(value){return typeof value=="number"||toString.call(value)=="[object Number]"};var zeroes="0000";var pad=function(number,totalCharacters){var string=String(number);return string.length<totalCharacters?(zeroes+string).slice(-totalCharacters):string};var hex=function(number){return Number(number).toString(16).toUpperCase()};var slice=[].slice;var dataFromCodePoints=function(codePoints){var index=-1;var length=codePoints.length;var max=length-1;var result=[];var isStart=true;var tmp;var previous=0;while(++index<length){tmp=codePoints[index];if(isStart){result.push(tmp);previous=tmp;isStart=false}else{if(tmp==previous+1){if(index!=max){previous=tmp;continue}else{isStart=true;result.push(tmp+1)}}else{result.push(previous+1,tmp);previous=tmp}}}if(!isStart){result.push(tmp+1)}return result};var dataRemove=function(data,codePoint){var index=0;var start;var end;var length=data.length;while(index<length){start=data[index];end=data[index+1];if(codePoint>=start&&codePoint<end){if(codePoint==start){if(end==start+1){data.splice(index,2);return data}else{data[index]=codePoint+1;return data}}else if(codePoint==end-1){data[index+1]=codePoint;return data}else{data.splice(index,2,start,codePoint,codePoint+1,end);return data}}index+=2}return data};var dataRemoveRange=function(data,rangeStart,rangeEnd){if(rangeEnd<rangeStart){throw Error(ERRORS.rangeOrder)}var index=0;var start;var end;while(index<data.length){start=data[index];end=data[index+1]-1;if(start>rangeEnd){return data}if(rangeStart<=start&&rangeEnd>=end){data.splice(index,2);continue}if(rangeStart>=start&&rangeEnd<end){if(rangeStart==start){data[index]=rangeEnd+1;data[index+1]=end+1;return data}data.splice(index,2,start,rangeStart,rangeEnd+1,end+1);return data}if(rangeStart>=start&&rangeStart<=end){data[index+1]=rangeStart}else if(rangeEnd>=start&&rangeEnd<=end){data[index]=rangeEnd+1;return data}index+=2}return data};var dataAdd=function(data,codePoint){var index=0;var start;var end;var lastIndex=null;var length=data.length;if(codePoint<0||codePoint>1114111){throw RangeError(ERRORS.codePointRange)}while(index<length){start=data[index];end=data[index+1];if(codePoint>=start&&codePoint<end){return data}if(codePoint==start-1){data[index]=codePoint;return data}if(start>codePoint){data.splice(lastIndex!=null?lastIndex+2:0,0,codePoint,codePoint+1);return data}if(codePoint==end){if(codePoint+1==data[index+2]){data.splice(index,4,start,data[index+3]);return data}data[index+1]=codePoint+1;return data}lastIndex=index;index+=2}data.push(codePoint,codePoint+1);return data};var dataAddData=function(dataA,dataB){var index=0;var start;var end;var data=dataA.slice();var length=dataB.length;while(index<length){start=dataB[index];end=dataB[index+1]-1;if(start==end){data=dataAdd(data,start)}else{data=dataAddRange(data,start,end)}index+=2}return data};var dataRemoveData=function(dataA,dataB){var index=0;var start;var end;var data=dataA.slice();var length=dataB.length;while(index<length){start=dataB[index];end=dataB[index+1]-1;if(start==end){data=dataRemove(data,start)}else{data=dataRemoveRange(data,start,end)}index+=2}return data};var dataAddRange=function(data,rangeStart,rangeEnd){if(rangeEnd<rangeStart){throw Error(ERRORS.rangeOrder)}if(rangeStart<0||rangeStart>1114111||rangeEnd<0||rangeEnd>1114111){throw RangeError(ERRORS.codePointRange)}var index=0;var start;var end;var added=false;var length=data.length;while(index<length){start=data[index];end=data[index+1];if(added){if(start==rangeEnd+1){data.splice(index-1,2);return data}if(start>rangeEnd){return data}if(start>=rangeStart&&start<=rangeEnd){if(end>rangeStart&&end-1<=rangeEnd){data.splice(index,2);index-=2}else{data.splice(index-1,2);index-=2}}}else if(start==rangeEnd+1){data[index]=rangeStart;return data}else if(start>rangeEnd){data.splice(index,0,rangeStart,rangeEnd+1);return data}else if(rangeStart>=start&&rangeStart<end&&rangeEnd+1<=end){return data}else if(rangeStart>=start&&rangeStart<end||end==rangeStart){data[index+1]=rangeEnd+1;added=true}else if(rangeStart<=start&&rangeEnd+1>=end){data[index]=rangeStart;data[index+1]=rangeEnd+1;added=true}index+=2}if(!added){data.push(rangeStart,rangeEnd+1)}return data};var dataContains=function(data,codePoint){var index=0;var start;var end;var length=data.length;while(index<length){start=data[index];end=data[index+1];if(codePoint>=start&&codePoint<end){return true}index+=2}return false};var dataIntersection=function(data,codePoints){var index=0;var length=codePoints.length;var codePoint;var result=[];while(index<length){codePoint=codePoints[index];if(dataContains(data,codePoint)){result.push(codePoint)}++index}return dataFromCodePoints(result)};var dataIsEmpty=function(data){return!data.length};var dataIsSingleton=function(data){return data.length==2&&data[0]+1==data[1]};var dataToArray=function(data){var index=0;var start;var end;var result=[];
var length=data.length;while(index<length){start=data[index];end=data[index+1];while(start<end){result.push(start);++start}index+=2}return result};var floor=Math.floor;var highSurrogate=function(codePoint){return parseInt(floor((codePoint-65536)/1024)+HIGH_SURROGATE_MIN,10)};var lowSurrogate=function(codePoint){return parseInt((codePoint-65536)%1024+LOW_SURROGATE_MIN,10)};var stringFromCharCode=String.fromCharCode;var codePointToString=function(codePoint){var string;if(codePoint==9){string="\\t"}else if(codePoint==10){string="\\n"}else if(codePoint==12){string="\\f"}else if(codePoint==13){string="\\r"}else if(codePoint==92){string="\\\\"}else if(codePoint==36||codePoint>=40&&codePoint<=43||codePoint==45||codePoint==46||codePoint==63||codePoint>=91&&codePoint<=94||codePoint>=123&&codePoint<=125){string="\\"+stringFromCharCode(codePoint)}else if(codePoint>=32&&codePoint<=126){string=stringFromCharCode(codePoint)}else if(codePoint<=255){string="\\x"+pad(hex(codePoint),2)}else{string="\\u"+pad(hex(codePoint),4)}return string};var symbolToCodePoint=function(symbol){var length=symbol.length;var first=symbol.charCodeAt(0);var second;if(first>=HIGH_SURROGATE_MIN&&first<=HIGH_SURROGATE_MAX&&length>1){second=symbol.charCodeAt(1);return(first-HIGH_SURROGATE_MIN)*1024+second-LOW_SURROGATE_MIN+65536}return first};var createBMPCharacterClasses=function(data){var result="";var index=0;var start;var end;var length=data.length;if(dataIsSingleton(data)){return codePointToString(data[0])}while(index<length){start=data[index];end=data[index+1]-1;if(start==end){result+=codePointToString(start)}else if(start+1==end){result+=codePointToString(start)+codePointToString(end)}else{result+=codePointToString(start)+"-"+codePointToString(end)}index+=2}return"["+result+"]"};var splitAtBMP=function(data){var loneHighSurrogates=[];var bmp=[];var astral=[];var index=0;var start;var end;var length=data.length;while(index<length){start=data[index];end=data[index+1]-1;if(start<=65535&&end<=65535){if(start>=HIGH_SURROGATE_MIN&&start<=HIGH_SURROGATE_MAX){if(end<=HIGH_SURROGATE_MAX){loneHighSurrogates.push(start,end+1)}else{loneHighSurrogates.push(start,HIGH_SURROGATE_MAX+1);bmp.push(HIGH_SURROGATE_MAX+1,end+1)}}else if(end>=HIGH_SURROGATE_MIN&&end<=HIGH_SURROGATE_MAX){bmp.push(start,HIGH_SURROGATE_MIN);loneHighSurrogates.push(HIGH_SURROGATE_MIN,end+1)}else if(start<HIGH_SURROGATE_MIN&&end>HIGH_SURROGATE_MAX){bmp.push(start,HIGH_SURROGATE_MIN,HIGH_SURROGATE_MAX+1,end+1);loneHighSurrogates.push(HIGH_SURROGATE_MIN,HIGH_SURROGATE_MAX+1)}else{bmp.push(start,end+1)}}else if(start<=65535&&end>65535){if(start>=HIGH_SURROGATE_MIN&&start<=HIGH_SURROGATE_MAX){loneHighSurrogates.push(start,HIGH_SURROGATE_MAX+1);bmp.push(HIGH_SURROGATE_MAX+1,65535+1)}else if(start<HIGH_SURROGATE_MIN){bmp.push(start,HIGH_SURROGATE_MIN,HIGH_SURROGATE_MAX+1,65535+1);loneHighSurrogates.push(HIGH_SURROGATE_MIN,HIGH_SURROGATE_MAX+1)}else{bmp.push(start,65535+1)}astral.push(65535+1,end+1)}else{astral.push(start,end+1)}index+=2}return{loneHighSurrogates:loneHighSurrogates,bmp:bmp,astral:astral}};var optimizeSurrogateMappings=function(surrogateMappings){var result=[];var tmpLow=[];var addLow=false;var mapping;var nextMapping;var highSurrogates;var lowSurrogates;var nextHighSurrogates;var nextLowSurrogates;var index=-1;var length=surrogateMappings.length;while(++index<length){mapping=surrogateMappings[index];nextMapping=surrogateMappings[index+1];if(!nextMapping){result.push(mapping);continue}highSurrogates=mapping[0];lowSurrogates=mapping[1];nextHighSurrogates=nextMapping[0];nextLowSurrogates=nextMapping[1];tmpLow=lowSurrogates;while(nextHighSurrogates&&highSurrogates[0]==nextHighSurrogates[0]&&highSurrogates[1]==nextHighSurrogates[1]){if(dataIsSingleton(nextLowSurrogates)){tmpLow=dataAdd(tmpLow,nextLowSurrogates[0])}else{tmpLow=dataAddRange(tmpLow,nextLowSurrogates[0],nextLowSurrogates[1]-1)}++index;mapping=surrogateMappings[index];highSurrogates=mapping[0];lowSurrogates=mapping[1];nextMapping=surrogateMappings[index+1];nextHighSurrogates=nextMapping&&nextMapping[0];nextLowSurrogates=nextMapping&&nextMapping[1];addLow=true}result.push([highSurrogates,addLow?tmpLow:lowSurrogates]);addLow=false}return optimizeByLowSurrogates(result)};var optimizeByLowSurrogates=function(surrogateMappings){if(surrogateMappings.length==1){return surrogateMappings}var index=-1;var innerIndex=-1;while(++index<surrogateMappings.length){var mapping=surrogateMappings[index];var lowSurrogates=mapping[1];var lowSurrogateStart=lowSurrogates[0];var lowSurrogateEnd=lowSurrogates[1];innerIndex=index;while(++innerIndex<surrogateMappings.length){var otherMapping=surrogateMappings[innerIndex];var otherLowSurrogates=otherMapping[1];var otherLowSurrogateStart=otherLowSurrogates[0];var otherLowSurrogateEnd=otherLowSurrogates[1];if(lowSurrogateStart==otherLowSurrogateStart&&lowSurrogateEnd==otherLowSurrogateEnd){if(dataIsSingleton(otherMapping[0])){mapping[0]=dataAdd(mapping[0],otherMapping[0][0])}else{mapping[0]=dataAddRange(mapping[0],otherMapping[0][0],otherMapping[0][1]-1)}surrogateMappings.splice(innerIndex,1);--innerIndex}}}return surrogateMappings};var surrogateSet=function(data){if(!data.length){return[]}var index=0;var start;var end;var startHigh;var startLow;var prevStartHigh=0;var prevEndHigh=0;var tmpLow=[];var endHigh;var endLow;var surrogateMappings=[];var length=data.length;var dataHigh=[];while(index<length){start=data[index];end=data[index+1]-1;startHigh=highSurrogate(start);startLow=lowSurrogate(start);endHigh=highSurrogate(end);endLow=lowSurrogate(end);var startsWithLowestLowSurrogate=startLow==LOW_SURROGATE_MIN;var endsWithHighestLowSurrogate=endLow==LOW_SURROGATE_MAX;var complete=false;if(startHigh==endHigh||startsWithLowestLowSurrogate&&endsWithHighestLowSurrogate){surrogateMappings.push([[startHigh,endHigh+1],[startLow,endLow+1]]);complete=true}else{surrogateMappings.push([[startHigh,startHigh+1],[startLow,LOW_SURROGATE_MAX+1]])}if(!complete&&startHigh+1<endHigh){if(endsWithHighestLowSurrogate){surrogateMappings.push([[startHigh+1,endHigh+1],[LOW_SURROGATE_MIN,endLow+1]]);complete=true}else{surrogateMappings.push([[startHigh+1,endHigh],[LOW_SURROGATE_MIN,LOW_SURROGATE_MAX+1]])}}if(!complete){surrogateMappings.push([[endHigh,endHigh+1],[LOW_SURROGATE_MIN,endLow+1]])}prevStartHigh=startHigh;prevEndHigh=endHigh;index+=2}return optimizeSurrogateMappings(surrogateMappings)};var createSurrogateCharacterClasses=function(surrogateMappings){var result=[];forEach(surrogateMappings,function(surrogateMapping){var highSurrogates=surrogateMapping[0];var lowSurrogates=surrogateMapping[1];result.push(createBMPCharacterClasses(highSurrogates)+createBMPCharacterClasses(lowSurrogates))});return result.join("|")};var createCharacterClassesFromData=function(data){var result=[];var parts=splitAtBMP(data);var loneHighSurrogates=parts.loneHighSurrogates;var bmp=parts.bmp;var astral=parts.astral;var hasAstral=!dataIsEmpty(parts.astral);var hasLoneSurrogates=!dataIsEmpty(loneHighSurrogates);var surrogateMappings=surrogateSet(astral);if(!hasAstral&&hasLoneSurrogates){bmp=dataAddData(bmp,loneHighSurrogates)}if(!dataIsEmpty(bmp)){result.push(createBMPCharacterClasses(bmp))}if(surrogateMappings.length){result.push(createSurrogateCharacterClasses(surrogateMappings))}if(hasAstral&&hasLoneSurrogates){result.push(createBMPCharacterClasses(loneHighSurrogates))}return result.join("|")};var regenerate=function(value){if(arguments.length>1){value=slice.call(arguments)}if(this instanceof regenerate){this.data=[];return value?this.add(value):this}return(new regenerate).add(value)};regenerate.version="1.0.1";var proto=regenerate.prototype;extend(proto,{add:function(value){var $this=this;if(value==null){return $this}if(value instanceof regenerate){$this.data=dataAddData($this.data,value.data);return $this}if(arguments.length>1){value=slice.call(arguments)}if(isArray(value)){forEach(value,function(item){$this.add(item)});return $this}$this.data=dataAdd($this.data,isNumber(value)?value:symbolToCodePoint(value));return $this},remove:function(value){var $this=this;if(value==null){return $this}if(value instanceof regenerate){$this.data=dataRemoveData($this.data,value.data);return $this}if(arguments.length>1){value=slice.call(arguments)}if(isArray(value)){forEach(value,function(item){$this.remove(item)});return $this}$this.data=dataRemove($this.data,isNumber(value)?value:symbolToCodePoint(value));return $this},addRange:function(start,end){var $this=this;$this.data=dataAddRange($this.data,isNumber(start)?start:symbolToCodePoint(start),isNumber(end)?end:symbolToCodePoint(end));return $this},removeRange:function(start,end){var $this=this;var startCodePoint=isNumber(start)?start:symbolToCodePoint(start);var endCodePoint=isNumber(end)?end:symbolToCodePoint(end);$this.data=dataRemoveRange($this.data,startCodePoint,endCodePoint);return $this},intersection:function(argument){var $this=this;var array=argument instanceof regenerate?dataToArray(argument.data):argument;$this.data=dataIntersection($this.data,array);return $this},contains:function(codePoint){return dataContains(this.data,isNumber(codePoint)?codePoint:symbolToCodePoint(codePoint))},clone:function(){var set=new regenerate;set.data=this.data.slice(0);return set},toString:function(){var result=createCharacterClassesFromData(this.data);return result.replace(regexNull,"\\0$1")},toRegExp:function(flags){return RegExp(this.toString(),flags||"")},valueOf:function(){return dataToArray(this.data)}});proto.toArray=proto.valueOf;if(typeof define=="function"&&typeof define.amd=="object"&&define.amd){define(function(){return regenerate})}else if(freeExports&&!freeExports.nodeType){if(freeModule){freeModule.exports=regenerate}else{freeExports.regenerate=regenerate}}else{root.regenerate=regenerate}})(this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],110:[function(require,module,exports){(function(global){(function(){"use strict";var objectTypes={"function":true,object:true};var root=objectTypes[typeof window]&&window||this;var oldRoot=root;var freeExports=objectTypes[typeof exports]&&exports;var freeModule=objectTypes[typeof module]&&module&&!module.nodeType&&module;var freeGlobal=freeExports&&freeModule&&typeof global=="object"&&global;if(freeGlobal&&(freeGlobal.global===freeGlobal||freeGlobal.window===freeGlobal||freeGlobal.self===freeGlobal)){root=freeGlobal}var stringFromCharCode=String.fromCharCode;var floor=Math.floor;function fromCodePoint(){var MAX_SIZE=16384;var codeUnits=[];var highSurrogate;var lowSurrogate;var index=-1;var length=arguments.length;if(!length){return""}var result="";while(++index<length){var codePoint=Number(arguments[index]);if(!isFinite(codePoint)||codePoint<0||codePoint>1114111||floor(codePoint)!=codePoint){throw RangeError("Invalid code point: "+codePoint)}if(codePoint<=65535){codeUnits.push(codePoint)}else{codePoint-=65536;highSurrogate=(codePoint>>10)+55296;lowSurrogate=codePoint%1024+56320;codeUnits.push(highSurrogate,lowSurrogate)}if(index+1==length||codeUnits.length>MAX_SIZE){result+=stringFromCharCode.apply(null,codeUnits);codeUnits.length=0}}return result}function assertType(type,expected){if(expected.indexOf("|")==-1){if(type==expected){return}throw Error("Invalid node type: "+type)}expected=assertType.hasOwnProperty(expected)?assertType[expected]:assertType[expected]=RegExp("^(?:"+expected+")$");if(expected.test(type)){return}throw Error("Invalid node type: "+type)}function generate(node){var type=node.type;if(generate.hasOwnProperty(type)&&typeof generate[type]=="function"){return generate[type](node)}throw Error("Invalid node type: "+type)}function generateAlternative(node){assertType(node.type,"alternative");var terms=node.body,length=terms?terms.length:0;if(length==1){return generateTerm(terms[0])}else{var i=-1,result="";while(++i<length){result+=generateTerm(terms[i])}return result}}function generateAnchor(node){assertType(node.type,"anchor");switch(node.kind){case"start":return"^";case"end":return"$";case"boundary":return"\\b";case"not-boundary":return"\\B";default:throw Error("Invalid assertion")}}function generateAtom(node){assertType(node.type,"anchor|characterClass|characterClassEscape|dot|group|reference|value");return generate(node)}function generateCharacterClass(node){assertType(node.type,"characterClass");var classRanges=node.body,length=classRanges?classRanges.length:0;var i=-1,result="[";if(node.negative){result+="^"}while(++i<length){result+=generateClassAtom(classRanges[i])}result+="]";return result}function generateCharacterClassEscape(node){assertType(node.type,"characterClassEscape");return"\\"+node.value}function generateCharacterClassRange(node){assertType(node.type,"characterClassRange");var min=node.min,max=node.max;if(min.type=="characterClassRange"||max.type=="characterClassRange"){throw Error("Invalid character class range")}return generateClassAtom(min)+"-"+generateClassAtom(max)}function generateClassAtom(node){assertType(node.type,"anchor|characterClassEscape|characterClassRange|dot|value");return generate(node)}function generateDisjunction(node){assertType(node.type,"disjunction");var body=node.body,length=body?body.length:0;if(length==0){throw Error("No body")}else if(length==1){return generate(body[0])}else{var i=-1,result="";while(++i<length){if(i!=0){result+="|"}result+=generate(body[i])}return result}}function generateDot(node){assertType(node.type,"dot");return"."}function generateGroup(node){assertType(node.type,"group");var result="(";switch(node.behavior){case"normal":break;case"ignore":result+="?:";break;case"lookahead":result+="?=";break;case"negativeLookahead":result+="?!";break;default:throw Error("Invalid behaviour: "+node.behaviour)}var body=node.body,length=body?body.length:0;if(length==1){result+=generate(body[0])}else{var i=-1;while(++i<length){result+=generate(body[i])}}result+=")";return result}function generateQuantifier(node){assertType(node.type,"quantifier");var quantifier="",min=node.min,max=node.max;switch(max){case undefined:case null:switch(min){case 0:quantifier="*";break;case 1:quantifier="+";break;default:quantifier="{"+min+",}";break}break;default:if(min==max){quantifier="{"+min+"}"}else if(min==0&&max==1){quantifier="?"}else{quantifier="{"+min+","+max+"}"}break}if(!node.greedy){quantifier+="?"}return generateAtom(node.body[0])+quantifier}function generateReference(node){assertType(node.type,"reference");return"\\"+node.matchIndex}function generateTerm(node){assertType(node.type,"anchor|characterClass|characterClassEscape|empty|group|quantifier|reference|value");return generate(node)}function generateValue(node){assertType(node.type,"value");var kind=node.kind,codePoint=node.codePoint;switch(kind){case"controlLetter":return"\\c"+fromCodePoint(codePoint+64);case"hexadecimalEscape":return"\\x"+("00"+codePoint.toString(16).toUpperCase()).slice(-2);case"identifier":return"\\"+fromCodePoint(codePoint);case"null":return"\\"+codePoint;case"octal":return"\\"+codePoint.toString(8);case"singleEscape":switch(codePoint){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: "+codePoint)}case"symbol":return fromCodePoint(codePoint);case"unicodeEscape":return"\\u"+("0000"+codePoint.toString(16).toUpperCase()).slice(-4);case"unicodeCodePointEscape":return"\\u{"+codePoint.toString(16).toUpperCase()+"}";default:throw Error("Unsupported node kind: "+kind)}}generate.alternative=generateAlternative;generate.anchor=generateAnchor;generate.characterClass=generateCharacterClass;generate.characterClassEscape=generateCharacterClassEscape;generate.characterClassRange=generateCharacterClassRange;generate.disjunction=generateDisjunction;generate.dot=generateDot;generate.group=generateGroup;generate.quantifier=generateQuantifier;generate.reference=generateReference;generate.value=generateValue;if(typeof define=="function"&&typeof define.amd=="object"&&define.amd){define(function(){return{generate:generate}})}else if(freeExports&&freeModule){freeExports.generate=generate}else{root.regjsgen={generate:generate}}}).call(this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],111:[function(require,module,exports){(function(){function parse(str,flags){var hasUnicodeFlag=(flags||"").indexOf("u")!==-1;var pos=0;var closedCaptureCounter=0;function addRaw(node){node.raw=str.substring(node.range[0],node.range[1]);return node}function updateRawStart(node,start){node.range[0]=start;return addRaw(node)}function createAnchor(kind,rawLength){return addRaw({type:"anchor",kind:kind,range:[pos-rawLength,pos]})}function createValue(kind,codePoint,from,to){return addRaw({type:"value",kind:kind,codePoint:codePoint,range:[from,to]})}function createEscaped(kind,codePoint,value,fromOffset){fromOffset=fromOffset||0;return createValue(kind,codePoint,pos-(value.length+fromOffset),pos)}function createCharacter(matches){var _char=matches[0];var first=_char.charCodeAt(0);if(hasUnicodeFlag){var second;if(_char.length===1&&first>=55296&&first<=56319){second=lookahead().charCodeAt(0);if(second>=56320&&second<=57343){pos++;return createValue("symbol",(first-55296)*1024+second-56320+65536,pos-2,pos)}}}return createValue("symbol",first,pos-1,pos)}function createDisjunction(alternatives,from,to){return addRaw({type:"disjunction",body:alternatives,range:[from,to]})}function createDot(){return addRaw({type:"dot",range:[pos-1,pos]})}function createCharacterClassEscape(value){return addRaw({type:"characterClassEscape",value:value,range:[pos-2,pos]})}function createReference(matchIndex){return addRaw({type:"reference",matchIndex:parseInt(matchIndex,10),range:[pos-1-matchIndex.length,pos]})}function createGroup(behavior,disjunction,from,to){return addRaw({type:"group",behavior:behavior,body:disjunction,range:[from,to]})}function createQuantifier(min,max,from,to){if(to==null){from=pos-1;to=pos}return addRaw({type:"quantifier",min:min,max:max,greedy:true,body:null,range:[from,to]})}function createAlternative(terms,from,to){return addRaw({type:"alternative",body:terms,range:[from,to]})}function createCharacterClass(classRanges,negative,from,to){return addRaw({type:"characterClass",body:classRanges,negative:negative,range:[from,to]})}function createClassRange(min,max,from,to){if(min.codePoint>max.codePoint){throw SyntaxError("invalid range in character class")}return addRaw({type:"characterClassRange",min:min,max:max,range:[from,to]})}function flattenBody(body){if(body.type==="alternative"){return body.body}else{return[body]}}function isEmpty(obj){return obj.type==="empty"}function incr(amount){amount=amount||1;var res=str.substring(pos,pos+amount);pos+=amount||1;return res}function skip(value){if(!match(value)){throw SyntaxError("character: "+value)}}function match(value){if(str.indexOf(value,pos)===pos){return incr(value.length)}}function lookahead(){return str[pos]}function current(value){return str.indexOf(value,pos)===pos}function next(value){return str[pos+1]===value}function matchReg(regExp){var subStr=str.substring(pos);var res=subStr.match(regExp);if(res){res.range=[];res.range[0]=pos;incr(res[0].length);res.range[1]=pos}return res}function parseDisjunction(){var res=[],from=pos;res.push(parseAlternative());while(match("|")){res.push(parseAlternative())}if(res.length===1){return res[0]}return createDisjunction(res,from,pos)}function parseAlternative(){var res=[],from=pos;var term;while(term=parseTerm()){res.push(term)}if(res.length===1){return res[0]}return createAlternative(res,from,pos)}function parseTerm(){if(pos>=str.length||current("|")||current(")")){return null}var anchor=parseAnchor();if(anchor){return anchor}var atom=parseAtom();if(!atom){throw SyntaxError("Expected atom")}var quantifier=parseQuantifier()||false;if(quantifier){quantifier.body=flattenBody(atom);updateRawStart(quantifier,atom.range[0]);return quantifier}return atom}function parseGroup(matchA,typeA,matchB,typeB){var type=null,from=pos;if(match(matchA)){type=typeA}else if(match(matchB)){type=typeB}else{return false}var body=parseDisjunction();if(!body){throw SyntaxError("Expected disjunction")}skip(")");var group=createGroup(type,flattenBody(body),from,pos);if(type=="normal"){closedCaptureCounter++}return group}function parseAnchor(){var res,from=pos;if(match("^")){return createAnchor("start",1)}else if(match("$")){return createAnchor("end",1)}else if(match("\\b")){return createAnchor("boundary",2)}else if(match("\\B")){return createAnchor("not-boundary",2)}else{return parseGroup("(?=","lookahead","(?!","negativeLookahead")}}function parseQuantifier(){var res;var quantifier;var min,max;if(match("*")){quantifier=createQuantifier(0)}else if(match("+")){quantifier=createQuantifier(1)}else if(match("?")){quantifier=createQuantifier(0,1)}else if(res=matchReg(/^\{([0-9]+)\}/)){min=parseInt(res[1],10);quantifier=createQuantifier(min,min,res.range[0],res.range[1])}else if(res=matchReg(/^\{([0-9]+),\}/)){min=parseInt(res[1],10);quantifier=createQuantifier(min,undefined,res.range[0],res.range[1])}else if(res=matchReg(/^\{([0-9]+),([0-9]+)\}/)){min=parseInt(res[1],10);max=parseInt(res[2],10);if(min>max){throw SyntaxError("numbers out of order in {} quantifier")}quantifier=createQuantifier(min,max,res.range[0],res.range[1])}if(quantifier){if(match("?")){quantifier.greedy=false;quantifier.range[1]+=1}}return quantifier}function parseAtom(){var res;if(res=matchReg(/^[^^$\\.*+?(){[|]/)){return createCharacter(res)}else if(match(".")){return createDot()}else if(match("\\")){res=parseAtomEscape();if(!res){throw SyntaxError("atomEscape")}return res}else if(res=parseCharacterClass()){return res}else{return parseGroup("(?:","ignore","(","normal")}}function parseUnicodeSurrogatePairEscape(firstEscape){if(hasUnicodeFlag){var first,second;if(firstEscape.kind=="unicodeEscape"&&(first=firstEscape.codePoint)>=55296&&first<=56319&¤t("\\")&&next("u")){var prevPos=pos;pos++;var secondEscape=parseClassEscape();if(secondEscape.kind=="unicodeEscape"&&(second=secondEscape.codePoint)>=56320&&second<=57343){firstEscape.range[1]=secondEscape.range[1];firstEscape.codePoint=(first-55296)*1024+second-56320+65536;firstEscape.type="value";firstEscape.kind="unicodeCodePointEscape";addRaw(firstEscape)}else{pos=prevPos}}}return firstEscape}function parseClassEscape(){return parseAtomEscape(true)}function parseAtomEscape(insideCharacterClass){var res;res=parseDecimalEscape();if(res){return res}if(insideCharacterClass){if(match("b")){return createEscaped("singleEscape",8,"\\b")}else if(match("B")){throw SyntaxError("\\B not possible inside of CharacterClass")}}res=parseCharacterEscape();return res}function parseDecimalEscape(){var res,match;if(res=matchReg(/^(?!0)\d+/)){match=res[0];var refIdx=parseInt(res[0],10);if(refIdx<=closedCaptureCounter){return createReference(res[0])}else{incr(-res[0].length);if(res=matchReg(/^[0-7]{1,3}/)){return createEscaped("octal",parseInt(res[0],8),res[0],1)}else{res=createCharacter(matchReg(/^[89]/));return updateRawStart(res,res.range[0]-1)}}}else if(res=matchReg(/^[0-7]{1,3}/)){match=res[0];if(/^0{1,3}$/.test(match)){return createEscaped("null",0,"0",match.length+1)}else{return createEscaped("octal",parseInt(match,8),match,1)}}else if(res=matchReg(/^[dDsSwW]/)){return createCharacterClassEscape(res[0])}return false}function parseCharacterEscape(){var res;if(res=matchReg(/^[fnrtv]/)){var codePoint=0;switch(res[0]){case"t":codePoint=9;break;case"n":codePoint=10;break;case"v":codePoint=11;break;case"f":codePoint=12;break;case"r":codePoint=13;break}return createEscaped("singleEscape",codePoint,"\\"+res[0])}else if(res=matchReg(/^c([a-zA-Z])/)){return createEscaped("controlLetter",res[1].charCodeAt(0)%32,res[1],2)}else if(res=matchReg(/^x([0-9a-fA-F]{2})/)){return createEscaped("hexadecimalEscape",parseInt(res[1],16),res[1],2)}else if(res=matchReg(/^u([0-9a-fA-F]{4})/)){return parseUnicodeSurrogatePairEscape(createEscaped("unicodeEscape",parseInt(res[1],16),res[1],2))}else if(hasUnicodeFlag&&(res=matchReg(/^u\{([0-9a-fA-F]{1,6})\}/))){return createEscaped("unicodeCodePointEscape",parseInt(res[1],16),res[1],4)}else{return parseIdentityEscape()}}function isIdentifierPart(ch){var NonAsciiIdentifierPart=new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮ̀-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁ҃-҇Ҋ-ԯԱ-Ֆՙա-և֑-ׇֽֿׁׂׅׄא-תװ-ײؐ-ؚؠ-٩ٮ-ۓە-ۜ۟-۪ۨ-ۼۿܐ-݊ݍ-ޱ߀-ߵߺࠀ-࠭ࡀ-࡛ࢠ-ࢲࣤ-ॣ०-९ॱ-ঃঅ-ঌএঐও-নপ-রলশ-হ়-ৄেৈো-ৎৗড়ঢ়য়-ৣ০-ৱਁ-ਃਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹ਼ਾ-ੂੇੈੋ-੍ੑਖ਼-ੜਫ਼੦-ੵઁ-ઃઅ-ઍએ-ઑઓ-નપ-રલળવ-હ઼-ૅે-ૉો-્ૐૠ-ૣ૦-૯ଁ-ଃଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହ଼-ୄେୈୋ-୍ୖୗଡ଼ଢ଼ୟ-ୣ୦-୯ୱஂஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-்ௐௗ௦-௯ఀ-ఃఅ-ఌఎ-ఐఒ-నప-హఽ-ౄె-ైొ-్ౕౖౘౙౠ-ౣ౦-౯ಁ-ಃಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹ಼-ೄೆ-ೈೊ-್ೕೖೞೠ-ೣ೦-೯ೱೲഁ-ഃഅ-ഌഎ-ഐഒ-ഺഽ-ൄെ-ൈൊ-ൎൗൠ-ൣ൦-൯ൺ-ൿංඃඅ-ඖක-නඳ-රලව-ෆ්ා-ුූෘ-ෟ෦-෯ෲෳก-ฺเ-๎๐-๙ກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆ່-ໍ໐-໙ໜ-ໟༀ༘༙༠-༩༹༵༷༾-ཇཉ-ཬཱ-྄྆-ྗྙ-ྼ࿆က-၉ၐ-ႝႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚ፝-፟ᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-᜔ᜠ-᜴ᝀ-ᝓᝠ-ᝬᝮ-ᝰᝲᝳក-៓ៗៜ៝០-៩᠋-᠍᠐-᠙ᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-᤻᥆-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉ᧐-᧙ᨀ-ᨛᨠ-ᩞ᩠-᩿᩼-᪉᪐-᪙ᪧ᪰-᪽ᬀ-ᭋ᭐-᭙᭫-᭳ᮀ-᯳ᰀ-᰷᱀-᱉ᱍ-ᱽ᳐-᳔᳒-ᳶ᳸᳹ᴀ-᷵᷼-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼ‿⁀⁔ⁱⁿₐ-ₜ⃐-⃥⃜⃡-⃰ℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯ⵿-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⷠ-ⷿⸯ々-〇〡-〯〱-〵〸-〼ぁ-ゖ゙゚ゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘫꙀ-꙯ꙴ-꙽ꙿ-ꚝꚟ-꛱ꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞭꞰꞱꟷ-ꠧꡀ-ꡳꢀ-꣄꣐-꣙꣠-ꣷꣻ꤀-꤭ꤰ-꥓ꥠ-ꥼꦀ-꧀ꧏ-꧙ꧠ-ꧾꨀ-ꨶꩀ-ꩍ꩐-꩙ꩠ-ꩶꩺ-ꫂꫛ-ꫝꫠ-ꫯꫲ-꫶ꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭟꭤꭥꯀ-ꯪ꯬꯭꯰-꯹가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻ︀-️︠-︭︳︴﹍-﹏ﹰ-ﹴﹶ-ﻼ0-9A-Z_a-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]");return ch===36||ch===95||ch>=65&&ch<=90||ch>=97&&ch<=122||ch>=48&&ch<=57||ch===92||ch>=128&&NonAsciiIdentifierPart.test(String.fromCharCode(ch))}function parseIdentityEscape(){var ZWJ="";var ZWNJ="";var res;var tmp;if(!isIdentifierPart(lookahead())){tmp=incr();return createEscaped("identifier",tmp.charCodeAt(0),tmp,1)}if(match(ZWJ)){return createEscaped("identifier",8204,ZWJ)}else if(match(ZWNJ)){return createEscaped("identifier",8205,ZWNJ)}return null}function parseCharacterClass(){var res,from=pos;if(res=matchReg(/^\[\^/)){res=parseClassRanges();skip("]");return createCharacterClass(res,true,from,pos)}else if(match("[")){res=parseClassRanges();skip("]");return createCharacterClass(res,false,from,pos)}return null}function parseClassRanges(){var res;if(current("]")){return[]}else{res=parseNonemptyClassRanges();if(!res){throw SyntaxError("nonEmptyClassRanges")}return res}}function parseHelperClassRanges(atom){var from,to,res;if(current("-")&&!next("]")){skip("-");res=parseClassAtom();if(!res){throw SyntaxError("classAtom")}to=pos;var classRanges=parseClassRanges();if(!classRanges){throw SyntaxError("classRanges")}from=atom.range[0];if(classRanges.type==="empty"){return[createClassRange(atom,res,from,to)]}return[createClassRange(atom,res,from,to)].concat(classRanges)}res=parseNonemptyClassRangesNoDash();if(!res){throw SyntaxError("nonEmptyClassRangesNoDash")}return[atom].concat(res)}function parseNonemptyClassRanges(){var atom=parseClassAtom();if(!atom){throw SyntaxError("classAtom")}if(current("]")){return[atom]}return parseHelperClassRanges(atom)}function parseNonemptyClassRangesNoDash(){var res=parseClassAtom();if(!res){throw SyntaxError("classAtom")}if(current("]")){return res}return parseHelperClassRanges(res)}function parseClassAtom(){if(match("-")){return createCharacter("-")}else{return parseClassAtomNoDash()}}function parseClassAtomNoDash(){var res;if(res=matchReg(/^[^\\\]-]/)){return createCharacter(res[0])}else if(match("\\")){res=parseClassEscape();if(!res){throw SyntaxError("classEscape")}return parseUnicodeSurrogatePairEscape(res)}}str=String(str);if(str===""){str="(?:)"}var result=parseDisjunction();if(result.range[1]!==str.length){throw SyntaxError("Could not parse entire input - got stuck: "+str)}return result}var regjsparser={parse:parse};if(typeof module!=="undefined"&&module.exports){module.exports=regjsparser}else{window.regjsparser=regjsparser}})()},{}],112:[function(require,module,exports){var generate=require("regjsgen").generate;var parse=require("regjsparser").parse;var regenerate=require("regenerate");var iuMappings=require("./data/iu-mappings.json");var ESCAPE_SETS=require("./data/character-class-escape-sets.js");function getCharacterClassEscapeSet(character){if(unicode){if(ignoreCase){return ESCAPE_SETS.UNICODE_IGNORE_CASE[character]}return ESCAPE_SETS.UNICODE[character]}return ESCAPE_SETS.REGULAR[character]}var object={};var hasOwnProperty=object.hasOwnProperty;function has(object,property){return hasOwnProperty.call(object,property)}var UNICODE_SET=regenerate().addRange(0,1114111);var BMP_SET=regenerate().addRange(0,65535);var DOT_SET_UNICODE=UNICODE_SET.clone().remove(10,13,8232,8233);var DOT_SET=DOT_SET_UNICODE.clone().intersection(BMP_SET);regenerate.prototype.iuAddRange=function(min,max){var $this=this;do{var folded=caseFold(min);if(folded){$this.add(folded)}}while(++min<=max);return $this};function assign(target,source){for(var key in source){target[key]=source[key]}}function update(item,pattern){var tree=parse(pattern,"");switch(tree.type){case"characterClass":case"group":case"value":break;default:tree=wrap(tree,pattern)}assign(item,tree)}function wrap(tree,pattern){return{type:"group",behavior:"ignore",body:[tree],raw:"(?:"+pattern+")"}}function caseFold(codePoint){return has(iuMappings,codePoint)?iuMappings[codePoint]:false}var ignoreCase=false;var unicode=false;function processCharacterClass(characterClassItem){var set=regenerate();var body=characterClassItem.body.forEach(function(item){switch(item.type){case"value":set.add(item.codePoint);if(ignoreCase&&unicode){var folded=caseFold(item.codePoint);if(folded){set.add(folded)}}break;case"characterClassRange":var min=item.min.codePoint;var max=item.max.codePoint;set.addRange(min,max);if(ignoreCase&&unicode){set.iuAddRange(min,max)}break;case"characterClassEscape":set.add(getCharacterClassEscapeSet(item.value));break;default:throw Error("Unknown term type: "+item.type)}});if(characterClassItem.negative){set=(unicode?UNICODE_SET:BMP_SET).clone().remove(set)}update(characterClassItem,set.toString());return characterClassItem}function processTerm(item){switch(item.type){case"dot":update(item,(unicode?DOT_SET_UNICODE:DOT_SET).toString());break;case"characterClass":item=processCharacterClass(item);break;case"characterClassEscape":update(item,getCharacterClassEscapeSet(item.value).toString());break;case"alternative":case"disjunction":case"group":case"quantifier":item.body=item.body.map(processTerm);break;case"value":var codePoint=item.codePoint;var set=regenerate(codePoint);if(ignoreCase&&unicode){var folded=caseFold(codePoint);if(folded){set.add(folded)}}update(item,set.toString());break;case"anchor":case"empty":case"group":case"reference":break;default:throw Error("Unknown term type: "+item.type)}return item}module.exports=function(pattern,flags){var tree=parse(pattern,flags);ignoreCase=flags?flags.indexOf("i")>-1:false;unicode=flags?flags.indexOf("u")>-1:false;assign(tree,processTerm(tree));return generate(tree)}},{"./data/character-class-escape-sets.js":107,"./data/iu-mappings.json":108,regenerate:109,regjsgen:110,regjsparser:111}],113:[function(require,module,exports){exports.SourceMapGenerator=require("./source-map/source-map-generator").SourceMapGenerator;exports.SourceMapConsumer=require("./source-map/source-map-consumer").SourceMapConsumer;exports.SourceNode=require("./source-map/source-node").SourceNode},{"./source-map/source-map-consumer":118,"./source-map/source-map-generator":119,"./source-map/source-node":120}],114:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){var util=require("./util");function ArraySet(){this._array=[];this._set={}}ArraySet.fromArray=function ArraySet_fromArray(aArray,aAllowDuplicates){var set=new ArraySet;for(var i=0,len=aArray.length;i<len;i++){set.add(aArray[i],aAllowDuplicates)}return set};ArraySet.prototype.add=function ArraySet_add(aStr,aAllowDuplicates){var isDuplicate=this.has(aStr);var idx=this._array.length;
if(!isDuplicate||aAllowDuplicates){this._array.push(aStr)}if(!isDuplicate){this._set[util.toSetString(aStr)]=idx}};ArraySet.prototype.has=function ArraySet_has(aStr){return Object.prototype.hasOwnProperty.call(this._set,util.toSetString(aStr))};ArraySet.prototype.indexOf=function ArraySet_indexOf(aStr){if(this.has(aStr)){return this._set[util.toSetString(aStr)]}throw new Error('"'+aStr+'" is not in the set.')};ArraySet.prototype.at=function ArraySet_at(aIdx){if(aIdx>=0&&aIdx<this._array.length){return this._array[aIdx]}throw new Error("No element indexed by "+aIdx)};ArraySet.prototype.toArray=function ArraySet_toArray(){return this._array.slice()};exports.ArraySet=ArraySet})},{"./util":121,amdefine:122}],115:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){var base64=require("./base64");var VLQ_BASE_SHIFT=5;var VLQ_BASE=1<<VLQ_BASE_SHIFT;var VLQ_BASE_MASK=VLQ_BASE-1;var VLQ_CONTINUATION_BIT=VLQ_BASE;function toVLQSigned(aValue){return aValue<0?(-aValue<<1)+1:(aValue<<1)+0}function fromVLQSigned(aValue){var isNegative=(aValue&1)===1;var shifted=aValue>>1;return isNegative?-shifted:shifted}exports.encode=function base64VLQ_encode(aValue){var encoded="";var digit;var vlq=toVLQSigned(aValue);do{digit=vlq&VLQ_BASE_MASK;vlq>>>=VLQ_BASE_SHIFT;if(vlq>0){digit|=VLQ_CONTINUATION_BIT}encoded+=base64.encode(digit)}while(vlq>0);return encoded};exports.decode=function base64VLQ_decode(aStr,aOutParam){var i=0;var strLen=aStr.length;var result=0;var shift=0;var continuation,digit;do{if(i>=strLen){throw new Error("Expected more digits in base 64 VLQ value.")}digit=base64.decode(aStr.charAt(i++));continuation=!!(digit&VLQ_CONTINUATION_BIT);digit&=VLQ_BASE_MASK;result=result+(digit<<shift);shift+=VLQ_BASE_SHIFT}while(continuation);aOutParam.value=fromVLQSigned(result);aOutParam.rest=aStr.slice(i)}})},{"./base64":116,amdefine:122}],116:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){var charToIntMap={};var intToCharMap={};"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("").forEach(function(ch,index){charToIntMap[ch]=index;intToCharMap[index]=ch});exports.encode=function base64_encode(aNumber){if(aNumber in intToCharMap){return intToCharMap[aNumber]}throw new TypeError("Must be between 0 and 63: "+aNumber)};exports.decode=function base64_decode(aChar){if(aChar in charToIntMap){return charToIntMap[aChar]}throw new TypeError("Not a valid base 64 digit: "+aChar)}})},{amdefine:122}],117:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){function recursiveSearch(aLow,aHigh,aNeedle,aHaystack,aCompare){var mid=Math.floor((aHigh-aLow)/2)+aLow;var cmp=aCompare(aNeedle,aHaystack[mid],true);if(cmp===0){return aHaystack[mid]}else if(cmp>0){if(aHigh-mid>1){return recursiveSearch(mid,aHigh,aNeedle,aHaystack,aCompare)}return aHaystack[mid]}else{if(mid-aLow>1){return recursiveSearch(aLow,mid,aNeedle,aHaystack,aCompare)}return aLow<0?null:aHaystack[aLow]}}exports.search=function search(aNeedle,aHaystack,aCompare){return aHaystack.length>0?recursiveSearch(-1,aHaystack.length,aNeedle,aHaystack,aCompare):null}})},{amdefine:122}],118:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){var util=require("./util");var binarySearch=require("./binary-search");var ArraySet=require("./array-set").ArraySet;var base64VLQ=require("./base64-vlq");function SourceMapConsumer(aSourceMap){var sourceMap=aSourceMap;if(typeof aSourceMap==="string"){sourceMap=JSON.parse(aSourceMap.replace(/^\)\]\}'/,""))}var version=util.getArg(sourceMap,"version");var sources=util.getArg(sourceMap,"sources");var names=util.getArg(sourceMap,"names",[]);var sourceRoot=util.getArg(sourceMap,"sourceRoot",null);var sourcesContent=util.getArg(sourceMap,"sourcesContent",null);var mappings=util.getArg(sourceMap,"mappings");var file=util.getArg(sourceMap,"file",null);if(version!=this._version){throw new Error("Unsupported version: "+version)}this._names=ArraySet.fromArray(names,true);this._sources=ArraySet.fromArray(sources,true);this.sourceRoot=sourceRoot;this.sourcesContent=sourcesContent;this._mappings=mappings;this.file=file}SourceMapConsumer.fromSourceMap=function SourceMapConsumer_fromSourceMap(aSourceMap){var smc=Object.create(SourceMapConsumer.prototype);smc._names=ArraySet.fromArray(aSourceMap._names.toArray(),true);smc._sources=ArraySet.fromArray(aSourceMap._sources.toArray(),true);smc.sourceRoot=aSourceMap._sourceRoot;smc.sourcesContent=aSourceMap._generateSourcesContent(smc._sources.toArray(),smc.sourceRoot);smc.file=aSourceMap._file;smc.__generatedMappings=aSourceMap._mappings.slice().sort(util.compareByGeneratedPositions);smc.__originalMappings=aSourceMap._mappings.slice().sort(util.compareByOriginalPositions);return smc};SourceMapConsumer.prototype._version=3;Object.defineProperty(SourceMapConsumer.prototype,"sources",{get:function(){return this._sources.toArray().map(function(s){return this.sourceRoot!=null?util.join(this.sourceRoot,s):s},this)}});SourceMapConsumer.prototype.__generatedMappings=null;Object.defineProperty(SourceMapConsumer.prototype,"_generatedMappings",{get:function(){if(!this.__generatedMappings){this.__generatedMappings=[];this.__originalMappings=[];this._parseMappings(this._mappings,this.sourceRoot)}return this.__generatedMappings}});SourceMapConsumer.prototype.__originalMappings=null;Object.defineProperty(SourceMapConsumer.prototype,"_originalMappings",{get:function(){if(!this.__originalMappings){this.__generatedMappings=[];this.__originalMappings=[];this._parseMappings(this._mappings,this.sourceRoot)}return this.__originalMappings}});SourceMapConsumer.prototype._nextCharIsMappingSeparator=function SourceMapConsumer_nextCharIsMappingSeparator(aStr){var c=aStr.charAt(0);return c===";"||c===","};SourceMapConsumer.prototype._parseMappings=function SourceMapConsumer_parseMappings(aStr,aSourceRoot){var generatedLine=1;var previousGeneratedColumn=0;var previousOriginalLine=0;var previousOriginalColumn=0;var previousSource=0;var previousName=0;var str=aStr;var temp={};var mapping;while(str.length>0){if(str.charAt(0)===";"){generatedLine++;str=str.slice(1);previousGeneratedColumn=0}else if(str.charAt(0)===","){str=str.slice(1)}else{mapping={};mapping.generatedLine=generatedLine;base64VLQ.decode(str,temp);mapping.generatedColumn=previousGeneratedColumn+temp.value;previousGeneratedColumn=mapping.generatedColumn;str=temp.rest;if(str.length>0&&!this._nextCharIsMappingSeparator(str)){base64VLQ.decode(str,temp);mapping.source=this._sources.at(previousSource+temp.value);previousSource+=temp.value;str=temp.rest;if(str.length===0||this._nextCharIsMappingSeparator(str)){throw new Error("Found a source, but no line and column")}base64VLQ.decode(str,temp);mapping.originalLine=previousOriginalLine+temp.value;previousOriginalLine=mapping.originalLine;mapping.originalLine+=1;str=temp.rest;if(str.length===0||this._nextCharIsMappingSeparator(str)){throw new Error("Found a source and line, but no column")}base64VLQ.decode(str,temp);mapping.originalColumn=previousOriginalColumn+temp.value;previousOriginalColumn=mapping.originalColumn;str=temp.rest;if(str.length>0&&!this._nextCharIsMappingSeparator(str)){base64VLQ.decode(str,temp);mapping.name=this._names.at(previousName+temp.value);previousName+=temp.value;str=temp.rest}}this.__generatedMappings.push(mapping);if(typeof mapping.originalLine==="number"){this.__originalMappings.push(mapping)}}}this.__generatedMappings.sort(util.compareByGeneratedPositions);this.__originalMappings.sort(util.compareByOriginalPositions)};SourceMapConsumer.prototype._findMapping=function SourceMapConsumer_findMapping(aNeedle,aMappings,aLineName,aColumnName,aComparator){if(aNeedle[aLineName]<=0){throw new TypeError("Line must be greater than or equal to 1, got "+aNeedle[aLineName])}if(aNeedle[aColumnName]<0){throw new TypeError("Column must be greater than or equal to 0, got "+aNeedle[aColumnName])}return binarySearch.search(aNeedle,aMappings,aComparator)};SourceMapConsumer.prototype.originalPositionFor=function SourceMapConsumer_originalPositionFor(aArgs){var needle={generatedLine:util.getArg(aArgs,"line"),generatedColumn:util.getArg(aArgs,"column")};var mapping=this._findMapping(needle,this._generatedMappings,"generatedLine","generatedColumn",util.compareByGeneratedPositions);if(mapping&&mapping.generatedLine===needle.generatedLine){var source=util.getArg(mapping,"source",null);if(source!=null&&this.sourceRoot!=null){source=util.join(this.sourceRoot,source)}return{source:source,line:util.getArg(mapping,"originalLine",null),column:util.getArg(mapping,"originalColumn",null),name:util.getArg(mapping,"name",null)}}return{source:null,line:null,column:null,name:null}};SourceMapConsumer.prototype.sourceContentFor=function SourceMapConsumer_sourceContentFor(aSource){if(!this.sourcesContent){return null}if(this.sourceRoot!=null){aSource=util.relative(this.sourceRoot,aSource)}if(this._sources.has(aSource)){return this.sourcesContent[this._sources.indexOf(aSource)]}var url;if(this.sourceRoot!=null&&(url=util.urlParse(this.sourceRoot))){var fileUriAbsPath=aSource.replace(/^file:\/\//,"");if(url.scheme=="file"&&this._sources.has(fileUriAbsPath)){return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)]}if((!url.path||url.path=="/")&&this._sources.has("/"+aSource)){return this.sourcesContent[this._sources.indexOf("/"+aSource)]}}throw new Error('"'+aSource+'" is not in the SourceMap.')};SourceMapConsumer.prototype.generatedPositionFor=function SourceMapConsumer_generatedPositionFor(aArgs){var needle={source:util.getArg(aArgs,"source"),originalLine:util.getArg(aArgs,"line"),originalColumn:util.getArg(aArgs,"column")};if(this.sourceRoot!=null){needle.source=util.relative(this.sourceRoot,needle.source)}var mapping=this._findMapping(needle,this._originalMappings,"originalLine","originalColumn",util.compareByOriginalPositions);if(mapping){return{line:util.getArg(mapping,"generatedLine",null),column:util.getArg(mapping,"generatedColumn",null)}}return{line:null,column:null}};SourceMapConsumer.GENERATED_ORDER=1;SourceMapConsumer.ORIGINAL_ORDER=2;SourceMapConsumer.prototype.eachMapping=function SourceMapConsumer_eachMapping(aCallback,aContext,aOrder){var context=aContext||null;var order=aOrder||SourceMapConsumer.GENERATED_ORDER;var mappings;switch(order){case SourceMapConsumer.GENERATED_ORDER:mappings=this._generatedMappings;break;case SourceMapConsumer.ORIGINAL_ORDER:mappings=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}var sourceRoot=this.sourceRoot;mappings.map(function(mapping){var source=mapping.source;if(source!=null&&sourceRoot!=null){source=util.join(sourceRoot,source)}return{source:source,generatedLine:mapping.generatedLine,generatedColumn:mapping.generatedColumn,originalLine:mapping.originalLine,originalColumn:mapping.originalColumn,name:mapping.name}}).forEach(aCallback,context)};exports.SourceMapConsumer=SourceMapConsumer})},{"./array-set":114,"./base64-vlq":115,"./binary-search":117,"./util":121,amdefine:122}],119:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){var base64VLQ=require("./base64-vlq");var util=require("./util");var ArraySet=require("./array-set").ArraySet;function SourceMapGenerator(aArgs){if(!aArgs){aArgs={}}this._file=util.getArg(aArgs,"file",null);this._sourceRoot=util.getArg(aArgs,"sourceRoot",null);this._sources=new ArraySet;this._names=new ArraySet;this._mappings=[];this._sourcesContents=null}SourceMapGenerator.prototype._version=3;SourceMapGenerator.fromSourceMap=function SourceMapGenerator_fromSourceMap(aSourceMapConsumer){var sourceRoot=aSourceMapConsumer.sourceRoot;var generator=new SourceMapGenerator({file:aSourceMapConsumer.file,sourceRoot:sourceRoot});aSourceMapConsumer.eachMapping(function(mapping){var newMapping={generated:{line:mapping.generatedLine,column:mapping.generatedColumn}};if(mapping.source!=null){newMapping.source=mapping.source;if(sourceRoot!=null){newMapping.source=util.relative(sourceRoot,newMapping.source)}newMapping.original={line:mapping.originalLine,column:mapping.originalColumn};if(mapping.name!=null){newMapping.name=mapping.name}}generator.addMapping(newMapping)});aSourceMapConsumer.sources.forEach(function(sourceFile){var content=aSourceMapConsumer.sourceContentFor(sourceFile);if(content!=null){generator.setSourceContent(sourceFile,content)}});return generator};SourceMapGenerator.prototype.addMapping=function SourceMapGenerator_addMapping(aArgs){var generated=util.getArg(aArgs,"generated");var original=util.getArg(aArgs,"original",null);var source=util.getArg(aArgs,"source",null);var name=util.getArg(aArgs,"name",null);this._validateMapping(generated,original,source,name);if(source!=null&&!this._sources.has(source)){this._sources.add(source)}if(name!=null&&!this._names.has(name)){this._names.add(name)}this._mappings.push({generatedLine:generated.line,generatedColumn:generated.column,originalLine:original!=null&&original.line,originalColumn:original!=null&&original.column,source:source,name:name})};SourceMapGenerator.prototype.setSourceContent=function SourceMapGenerator_setSourceContent(aSourceFile,aSourceContent){var source=aSourceFile;if(this._sourceRoot!=null){source=util.relative(this._sourceRoot,source)}if(aSourceContent!=null){if(!this._sourcesContents){this._sourcesContents={}}this._sourcesContents[util.toSetString(source)]=aSourceContent}else if(this._sourcesContents){delete this._sourcesContents[util.toSetString(source)];if(Object.keys(this._sourcesContents).length===0){this._sourcesContents=null}}};SourceMapGenerator.prototype.applySourceMap=function SourceMapGenerator_applySourceMap(aSourceMapConsumer,aSourceFile,aSourceMapPath){var sourceFile=aSourceFile;if(aSourceFile==null){if(aSourceMapConsumer.file==null){throw new Error("SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, "+'or the source map\'s "file" property. Both were omitted.')}sourceFile=aSourceMapConsumer.file}var sourceRoot=this._sourceRoot;if(sourceRoot!=null){sourceFile=util.relative(sourceRoot,sourceFile)}var newSources=new ArraySet;var newNames=new ArraySet;this._mappings.forEach(function(mapping){if(mapping.source===sourceFile&&mapping.originalLine!=null){var original=aSourceMapConsumer.originalPositionFor({line:mapping.originalLine,column:mapping.originalColumn});if(original.source!=null){mapping.source=original.source;if(aSourceMapPath!=null){mapping.source=util.join(aSourceMapPath,mapping.source)}if(sourceRoot!=null){mapping.source=util.relative(sourceRoot,mapping.source)}mapping.originalLine=original.line;mapping.originalColumn=original.column;if(original.name!=null){mapping.name=original.name}}}var source=mapping.source;if(source!=null&&!newSources.has(source)){newSources.add(source)}var name=mapping.name;if(name!=null&&!newNames.has(name)){newNames.add(name)}},this);this._sources=newSources;this._names=newNames;aSourceMapConsumer.sources.forEach(function(sourceFile){var content=aSourceMapConsumer.sourceContentFor(sourceFile);if(content!=null){if(aSourceMapPath!=null){sourceFile=util.join(aSourceMapPath,sourceFile)}if(sourceRoot!=null){sourceFile=util.relative(sourceRoot,sourceFile)}this.setSourceContent(sourceFile,content)}},this)};SourceMapGenerator.prototype._validateMapping=function SourceMapGenerator_validateMapping(aGenerated,aOriginal,aSource,aName){if(aGenerated&&"line"in aGenerated&&"column"in aGenerated&&aGenerated.line>0&&aGenerated.column>=0&&!aOriginal&&!aSource&&!aName){return}else if(aGenerated&&"line"in aGenerated&&"column"in aGenerated&&aOriginal&&"line"in aOriginal&&"column"in aOriginal&&aGenerated.line>0&&aGenerated.column>=0&&aOriginal.line>0&&aOriginal.column>=0&&aSource){return}else{throw new Error("Invalid mapping: "+JSON.stringify({generated:aGenerated,source:aSource,original:aOriginal,name:aName}))}};SourceMapGenerator.prototype._serializeMappings=function SourceMapGenerator_serializeMappings(){var previousGeneratedColumn=0;var previousGeneratedLine=1;var previousOriginalColumn=0;var previousOriginalLine=0;var previousName=0;var previousSource=0;var result="";var mapping;this._mappings.sort(util.compareByGeneratedPositions);for(var i=0,len=this._mappings.length;i<len;i++){mapping=this._mappings[i];if(mapping.generatedLine!==previousGeneratedLine){previousGeneratedColumn=0;while(mapping.generatedLine!==previousGeneratedLine){result+=";";previousGeneratedLine++}}else{if(i>0){if(!util.compareByGeneratedPositions(mapping,this._mappings[i-1])){continue}result+=","}}result+=base64VLQ.encode(mapping.generatedColumn-previousGeneratedColumn);previousGeneratedColumn=mapping.generatedColumn;if(mapping.source!=null){result+=base64VLQ.encode(this._sources.indexOf(mapping.source)-previousSource);previousSource=this._sources.indexOf(mapping.source);result+=base64VLQ.encode(mapping.originalLine-1-previousOriginalLine);previousOriginalLine=mapping.originalLine-1;result+=base64VLQ.encode(mapping.originalColumn-previousOriginalColumn);previousOriginalColumn=mapping.originalColumn;if(mapping.name!=null){result+=base64VLQ.encode(this._names.indexOf(mapping.name)-previousName);previousName=this._names.indexOf(mapping.name)}}}return result};SourceMapGenerator.prototype._generateSourcesContent=function SourceMapGenerator_generateSourcesContent(aSources,aSourceRoot){return aSources.map(function(source){if(!this._sourcesContents){return null}if(aSourceRoot!=null){source=util.relative(aSourceRoot,source)}var key=util.toSetString(source);return Object.prototype.hasOwnProperty.call(this._sourcesContents,key)?this._sourcesContents[key]:null},this)};SourceMapGenerator.prototype.toJSON=function SourceMapGenerator_toJSON(){var map={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};if(this._file!=null){map.file=this._file}if(this._sourceRoot!=null){map.sourceRoot=this._sourceRoot}if(this._sourcesContents){map.sourcesContent=this._generateSourcesContent(map.sources,map.sourceRoot)}return map};SourceMapGenerator.prototype.toString=function SourceMapGenerator_toString(){return JSON.stringify(this)};exports.SourceMapGenerator=SourceMapGenerator})},{"./array-set":114,"./base64-vlq":115,"./util":121,amdefine:122}],120:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){var SourceMapGenerator=require("./source-map-generator").SourceMapGenerator;var util=require("./util");var REGEX_NEWLINE=/(\r?\n)/;var REGEX_CHARACTER=/\r\n|[\s\S]/g;function SourceNode(aLine,aColumn,aSource,aChunks,aName){this.children=[];this.sourceContents={};this.line=aLine==null?null:aLine;this.column=aColumn==null?null:aColumn;this.source=aSource==null?null:aSource;this.name=aName==null?null:aName;if(aChunks!=null)this.add(aChunks)}SourceNode.fromStringWithSourceMap=function SourceNode_fromStringWithSourceMap(aGeneratedCode,aSourceMapConsumer,aRelativePath){var node=new SourceNode;var remainingLines=aGeneratedCode.split(REGEX_NEWLINE);var shiftNextLine=function(){var lineContents=remainingLines.shift();var newLine=remainingLines.shift()||"";return lineContents+newLine};var lastGeneratedLine=1,lastGeneratedColumn=0;var lastMapping=null;aSourceMapConsumer.eachMapping(function(mapping){if(lastMapping!==null){if(lastGeneratedLine<mapping.generatedLine){var code="";addMappingWithCode(lastMapping,shiftNextLine());lastGeneratedLine++;lastGeneratedColumn=0}else{var nextLine=remainingLines[0];var code=nextLine.substr(0,mapping.generatedColumn-lastGeneratedColumn);remainingLines[0]=nextLine.substr(mapping.generatedColumn-lastGeneratedColumn);lastGeneratedColumn=mapping.generatedColumn;addMappingWithCode(lastMapping,code);lastMapping=mapping;return}}while(lastGeneratedLine<mapping.generatedLine){node.add(shiftNextLine());lastGeneratedLine++}if(lastGeneratedColumn<mapping.generatedColumn){var nextLine=remainingLines[0];node.add(nextLine.substr(0,mapping.generatedColumn));remainingLines[0]=nextLine.substr(mapping.generatedColumn);lastGeneratedColumn=mapping.generatedColumn}lastMapping=mapping},this);if(remainingLines.length>0){if(lastMapping){addMappingWithCode(lastMapping,shiftNextLine())}node.add(remainingLines.join(""))}aSourceMapConsumer.sources.forEach(function(sourceFile){var content=aSourceMapConsumer.sourceContentFor(sourceFile);if(content!=null){if(aRelativePath!=null){sourceFile=util.join(aRelativePath,sourceFile)}node.setSourceContent(sourceFile,content)}});return node;function addMappingWithCode(mapping,code){if(mapping===null||mapping.source===undefined){node.add(code)}else{var source=aRelativePath?util.join(aRelativePath,mapping.source):mapping.source;node.add(new SourceNode(mapping.originalLine,mapping.originalColumn,source,code,mapping.name))}}};SourceNode.prototype.add=function SourceNode_add(aChunk){if(Array.isArray(aChunk)){aChunk.forEach(function(chunk){this.add(chunk)},this)}else if(aChunk instanceof SourceNode||typeof aChunk==="string"){if(aChunk){this.children.push(aChunk)}}else{throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+aChunk)}return this};SourceNode.prototype.prepend=function SourceNode_prepend(aChunk){if(Array.isArray(aChunk)){for(var i=aChunk.length-1;i>=0;i--){this.prepend(aChunk[i])}}else if(aChunk instanceof SourceNode||typeof aChunk==="string"){this.children.unshift(aChunk)}else{throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+aChunk)}return this};SourceNode.prototype.walk=function SourceNode_walk(aFn){var chunk;for(var i=0,len=this.children.length;i<len;i++){chunk=this.children[i];if(chunk instanceof SourceNode){chunk.walk(aFn)}else{if(chunk!==""){aFn(chunk,{source:this.source,line:this.line,column:this.column,name:this.name})}}}};SourceNode.prototype.join=function SourceNode_join(aSep){var newChildren;var i;var len=this.children.length;if(len>0){newChildren=[];for(i=0;i<len-1;i++){newChildren.push(this.children[i]);newChildren.push(aSep)}newChildren.push(this.children[i]);this.children=newChildren}return this};SourceNode.prototype.replaceRight=function SourceNode_replaceRight(aPattern,aReplacement){var lastChild=this.children[this.children.length-1];if(lastChild instanceof SourceNode){lastChild.replaceRight(aPattern,aReplacement)}else if(typeof lastChild==="string"){this.children[this.children.length-1]=lastChild.replace(aPattern,aReplacement)}else{this.children.push("".replace(aPattern,aReplacement))}return this};SourceNode.prototype.setSourceContent=function SourceNode_setSourceContent(aSourceFile,aSourceContent){this.sourceContents[util.toSetString(aSourceFile)]=aSourceContent};SourceNode.prototype.walkSourceContents=function SourceNode_walkSourceContents(aFn){for(var i=0,len=this.children.length;i<len;i++){if(this.children[i]instanceof SourceNode){this.children[i].walkSourceContents(aFn)}}var sources=Object.keys(this.sourceContents);for(var i=0,len=sources.length;i<len;i++){aFn(util.fromSetString(sources[i]),this.sourceContents[sources[i]])}};SourceNode.prototype.toString=function SourceNode_toString(){var str="";this.walk(function(chunk){str+=chunk});return str};SourceNode.prototype.toStringWithSourceMap=function SourceNode_toStringWithSourceMap(aArgs){var generated={code:"",line:1,column:0};var map=new SourceMapGenerator(aArgs);var sourceMappingActive=false;var lastOriginalSource=null;var lastOriginalLine=null;var lastOriginalColumn=null;var lastOriginalName=null;this.walk(function(chunk,original){generated.code+=chunk;if(original.source!==null&&original.line!==null&&original.column!==null){if(lastOriginalSource!==original.source||lastOriginalLine!==original.line||lastOriginalColumn!==original.column||lastOriginalName!==original.name){map.addMapping({source:original.source,original:{line:original.line,column:original.column},generated:{line:generated.line,column:generated.column},name:original.name})}lastOriginalSource=original.source;lastOriginalLine=original.line;lastOriginalColumn=original.column;lastOriginalName=original.name;sourceMappingActive=true}else if(sourceMappingActive){map.addMapping({generated:{line:generated.line,column:generated.column}});lastOriginalSource=null;sourceMappingActive=false}chunk.match(REGEX_CHARACTER).forEach(function(ch,idx,array){if(REGEX_NEWLINE.test(ch)){generated.line++;generated.column=0;if(idx+1===array.length){lastOriginalSource=null;sourceMappingActive=false}else if(sourceMappingActive){map.addMapping({source:original.source,original:{line:original.line,column:original.column},generated:{line:generated.line,column:generated.column},name:original.name})}}else{generated.column+=ch.length}})});this.walkSourceContents(function(sourceFile,sourceContent){map.setSourceContent(sourceFile,sourceContent)});return{code:generated.code,map:map}};exports.SourceNode=SourceNode})},{"./source-map-generator":119,"./util":121,amdefine:122}],121:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){function getArg(aArgs,aName,aDefaultValue){if(aName in aArgs){return aArgs[aName]}else if(arguments.length===3){return aDefaultValue}else{throw new Error('"'+aName+'" is a required argument.')}}exports.getArg=getArg;var urlRegexp=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/;var dataUrlRegexp=/^data:.+\,.+$/;function urlParse(aUrl){var match=aUrl.match(urlRegexp);if(!match){return null}return{scheme:match[1],auth:match[2],host:match[3],port:match[4],path:match[5]}}exports.urlParse=urlParse;function urlGenerate(aParsedUrl){var url="";if(aParsedUrl.scheme){url+=aParsedUrl.scheme+":"}url+="//";if(aParsedUrl.auth){url+=aParsedUrl.auth+"@"}if(aParsedUrl.host){url+=aParsedUrl.host}if(aParsedUrl.port){url+=":"+aParsedUrl.port}if(aParsedUrl.path){url+=aParsedUrl.path}return url}exports.urlGenerate=urlGenerate;function normalize(aPath){var path=aPath;var url=urlParse(aPath);if(url){if(!url.path){return aPath}path=url.path}var isAbsolute=path.charAt(0)==="/";var parts=path.split(/\/+/);for(var part,up=0,i=parts.length-1;i>=0;i--){part=parts[i];if(part==="."){parts.splice(i,1)}else if(part===".."){up++}else if(up>0){if(part===""){parts.splice(i+1,up);up=0}else{parts.splice(i,2);up--}}}path=parts.join("/");if(path===""){path=isAbsolute?"/":"."}if(url){url.path=path;return urlGenerate(url)}return path}exports.normalize=normalize;function join(aRoot,aPath){if(aRoot===""){aRoot="."}if(aPath===""){aPath="."}var aPathUrl=urlParse(aPath);var aRootUrl=urlParse(aRoot);if(aRootUrl){aRoot=aRootUrl.path||"/"}if(aPathUrl&&!aPathUrl.scheme){if(aRootUrl){aPathUrl.scheme=aRootUrl.scheme}return urlGenerate(aPathUrl)}if(aPathUrl||aPath.match(dataUrlRegexp)){return aPath}if(aRootUrl&&!aRootUrl.host&&!aRootUrl.path){aRootUrl.host=aPath;return urlGenerate(aRootUrl)}var joined=aPath.charAt(0)==="/"?aPath:normalize(aRoot.replace(/\/+$/,"")+"/"+aPath);if(aRootUrl){aRootUrl.path=joined;return urlGenerate(aRootUrl)}return joined}exports.join=join;function relative(aRoot,aPath){if(aRoot===""){aRoot="."}aRoot=aRoot.replace(/\/$/,"");var url=urlParse(aRoot);if(aPath.charAt(0)=="/"&&url&&url.path=="/"){return aPath.slice(1)}return aPath.indexOf(aRoot+"/")===0?aPath.substr(aRoot.length+1):aPath}exports.relative=relative;function toSetString(aStr){return"$"+aStr}exports.toSetString=toSetString;function fromSetString(aStr){return aStr.substr(1)}exports.fromSetString=fromSetString;function strcmp(aStr1,aStr2){var s1=aStr1||"";var s2=aStr2||"";return(s1>s2)-(s1<s2)}function compareByOriginalPositions(mappingA,mappingB,onlyCompareOriginal){var cmp;cmp=strcmp(mappingA.source,mappingB.source);if(cmp){return cmp}cmp=mappingA.originalLine-mappingB.originalLine;if(cmp){return cmp}cmp=mappingA.originalColumn-mappingB.originalColumn;if(cmp||onlyCompareOriginal){return cmp}cmp=strcmp(mappingA.name,mappingB.name);if(cmp){return cmp}cmp=mappingA.generatedLine-mappingB.generatedLine;if(cmp){return cmp}return mappingA.generatedColumn-mappingB.generatedColumn}exports.compareByOriginalPositions=compareByOriginalPositions;function compareByGeneratedPositions(mappingA,mappingB,onlyCompareGenerated){var cmp;cmp=mappingA.generatedLine-mappingB.generatedLine;if(cmp){return cmp}cmp=mappingA.generatedColumn-mappingB.generatedColumn;if(cmp||onlyCompareGenerated){return cmp}cmp=strcmp(mappingA.source,mappingB.source);if(cmp){return cmp}cmp=mappingA.originalLine-mappingB.originalLine;if(cmp){return cmp}cmp=mappingA.originalColumn-mappingB.originalColumn;if(cmp){return cmp}return strcmp(mappingA.name,mappingB.name)}exports.compareByGeneratedPositions=compareByGeneratedPositions})},{amdefine:122}],122:[function(require,module,exports){(function(process,__filename){"use strict";function amdefine(module,requireFn){"use strict";var defineCache={},loaderCache={},alreadyCalled=false,path=require("path"),makeRequire,stringRequire;function trimDots(ary){var i,part;for(i=0;ary[i];i+=1){part=ary[i];if(part==="."){ary.splice(i,1);i-=1}else if(part===".."){if(i===1&&(ary[2]===".."||ary[0]==="..")){break}else if(i>0){ary.splice(i-1,2);i-=2}}}}function normalize(name,baseName){var baseParts;if(name&&name.charAt(0)==="."){if(baseName){baseParts=baseName.split("/");baseParts=baseParts.slice(0,baseParts.length-1);baseParts=baseParts.concat(name.split("/"));trimDots(baseParts);name=baseParts.join("/")}}return name}function makeNormalize(relName){return function(name){return normalize(name,relName)}}function makeLoad(id){function load(value){loaderCache[id]=value}load.fromText=function(id,text){throw new Error("amdefine does not implement load.fromText")};return load}makeRequire=function(systemRequire,exports,module,relId){function amdRequire(deps,callback){if(typeof deps==="string"){return stringRequire(systemRequire,exports,module,deps,relId)}else{deps=deps.map(function(depName){return stringRequire(systemRequire,exports,module,depName,relId)});process.nextTick(function(){callback.apply(null,deps)})}}amdRequire.toUrl=function(filePath){if(filePath.indexOf(".")===0){return normalize(filePath,path.dirname(module.filename))}else{return filePath}};return amdRequire};requireFn=requireFn||function req(){return module.require.apply(module,arguments)};function runFactory(id,deps,factory){var r,e,m,result;if(id){e=loaderCache[id]={};m={id:id,uri:__filename,exports:e};r=makeRequire(requireFn,e,m,id)}else{if(alreadyCalled){throw new Error("amdefine with no module ID cannot be called more than once per file.")}alreadyCalled=true;e=module.exports;m=module;r=makeRequire(requireFn,e,m,module.id)}if(deps){deps=deps.map(function(depName){return r(depName)})}if(typeof factory==="function"){result=factory.apply(m.exports,deps)}else{result=factory}if(result!==undefined){m.exports=result;if(id){loaderCache[id]=m.exports}}}stringRequire=function(systemRequire,exports,module,id,relId){var index=id.indexOf("!"),originalId=id,prefix,plugin;if(index===-1){id=normalize(id,relId);if(id==="require"){return makeRequire(systemRequire,exports,module,relId)}else if(id==="exports"){return exports}else if(id==="module"){return module}else if(loaderCache.hasOwnProperty(id)){return loaderCache[id]}else if(defineCache[id]){runFactory.apply(null,defineCache[id]);return loaderCache[id]}else{if(systemRequire){return systemRequire(originalId)}else{throw new Error("No module with ID: "+id)}}}else{prefix=id.substring(0,index);id=id.substring(index+1,id.length);plugin=stringRequire(systemRequire,exports,module,prefix,relId);if(plugin.normalize){id=plugin.normalize(id,makeNormalize(relId))}else{id=normalize(id,relId)}if(loaderCache[id]){return loaderCache[id]
}else{plugin.load(id,makeRequire(systemRequire,exports,module,relId),makeLoad(id),{});return loaderCache[id]}}};function define(id,deps,factory){if(Array.isArray(id)){factory=deps;deps=id;id=undefined}else if(typeof id!=="string"){factory=id;id=deps=undefined}if(deps&&!Array.isArray(deps)){factory=deps;deps=undefined}if(!deps){deps=["require","exports","module"]}if(id){defineCache[id]=[id,deps,factory]}else{runFactory(id,deps,factory)}}define.require=function(id){if(loaderCache[id]){return loaderCache[id]}if(defineCache[id]){runFactory.apply(null,defineCache[id]);return loaderCache[id]}};define.amd={};return define}module.exports=amdefine}).call(this,require("_process"),"/node_modules/source-map/node_modules/amdefine/amdefine.js")},{_process:83,path:82}],123:[function(require,module,exports){module.exports={"apply-constructor":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"ParenthesizedExpression",expression:{type:"FunctionExpression",id:null,params:[{type:"Identifier",name:"Constructor"},{type:"Identifier",name:"args"}],defaults:[],rest:null,generator:false,async:false,body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"bindArgs"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"ArrayExpression",elements:[{type:"Literal",value:null}]},property:{type:"Identifier",name:"concat"},computed:false},arguments:[{type:"Identifier",name:"args"}]}}],kind:"var"},{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"Factory"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"MemberExpression",object:{type:"Identifier",name:"Constructor"},property:{type:"Identifier",name:"bind"},computed:false},property:{type:"Identifier",name:"apply"},computed:false},arguments:[{type:"Identifier",name:"Constructor"},{type:"Identifier",name:"bindArgs"}]}}],kind:"var"},{type:"ReturnStatement",argument:{type:"NewExpression",callee:{type:"Identifier",name:"Factory"},arguments:[]}}]},expression:false}}}]},"arguments-slice-assign-arg":{type:"Program",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"VARIABLE_NAME"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"SLICE_KEY"},property:{type:"Identifier",name:"call"},computed:false},arguments:[{type:"Identifier",name:"arguments"},{type:"Identifier",name:"SLICE_ARG"}]}}],kind:"var"}]},"arguments-slice-assign":{type:"Program",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"VARIABLE_NAME"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"SLICE_KEY"},property:{type:"Identifier",name:"call"},computed:false},arguments:[{type:"Identifier",name:"arguments"}]}}],kind:"var"}]},"arguments-slice":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"SLICE_KEY"},property:{type:"Identifier",name:"call"},computed:false},arguments:[{type:"Identifier",name:"arguments"}]}}]},"array-comprehension-container":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"ParenthesizedExpression",expression:{type:"FunctionExpression",id:null,params:[],defaults:[],rest:null,generator:false,async:false,body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"KEY"},init:{type:"ArrayExpression",elements:[]}}],kind:"var"},{type:"ReturnStatement",argument:{type:"Identifier",name:"KEY"}}]},expression:false}},arguments:[]}}]},"array-comprehension-for-each":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"ARRAY"},property:{type:"Identifier",name:"forEach"},computed:false},arguments:[{type:"FunctionExpression",id:null,params:[{type:"Identifier",name:"KEY"}],defaults:[],rest:null,generator:false,async:false,body:{type:"BlockStatement",body:[]},expression:false}]}}]},"array-expression-comprehension-filter":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"ARRAY"},property:{type:"Identifier",name:"filter"},computed:false},arguments:[{type:"FunctionExpression",id:null,params:[{type:"Identifier",name:"KEY"}],defaults:[],rest:null,generator:false,async:false,body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"Identifier",name:"FILTER"}}]},expression:false}]},property:{type:"Identifier",name:"map"},computed:false},arguments:[{type:"FunctionExpression",id:null,params:[{type:"Identifier",name:"KEY"}],defaults:[],rest:null,generator:false,async:false,body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"Identifier",name:"STATEMENT"}}]},expression:false}]}}]},"array-expression-comprehension-map":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"ARRAY"},property:{type:"Identifier",name:"map"},computed:false},arguments:[{type:"FunctionExpression",id:null,params:[{type:"Identifier",name:"KEY"}],defaults:[],rest:null,generator:false,async:false,body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"Identifier",name:"STATEMENT"}}]},expression:false}]}}]},"array-push":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"KEY"},property:{type:"Identifier",name:"push"},computed:false},arguments:[{type:"Identifier",name:"STATEMENT"}]}}]},call:{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"OBJECT"},property:{type:"Identifier",name:"call"},computed:false},arguments:[{type:"Identifier",name:"CONTEXT"}]}}]},"class-props":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"ParenthesizedExpression",expression:{type:"FunctionExpression",id:null,params:[{type:"Identifier",name:"child"},{type:"Identifier",name:"staticProps"},{type:"Identifier",name:"instanceProps"}],defaults:[],rest:null,generator:false,async:false,body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"Identifier",name:"staticProps"},consequent:{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"defineProperties"},computed:false},arguments:[{type:"Identifier",name:"child"},{type:"Identifier",name:"staticProps"}]}},alternate:null},{type:"IfStatement",test:{type:"Identifier",name:"instanceProps"},consequent:{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"defineProperties"},computed:false},arguments:[{type:"MemberExpression",object:{type:"Identifier",name:"child"},property:{type:"Identifier",name:"prototype"},computed:false},{type:"Identifier",name:"instanceProps"}]}},alternate:null}]},expression:false}}}]},"class-super-constructor-call":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"SUPER_NAME"},property:{type:"Identifier",name:"apply"},computed:false},arguments:[{type:"ThisExpression"},{type:"Identifier",name:"arguments"}]}}]},"class":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"ParenthesizedExpression",expression:{type:"FunctionExpression",id:null,params:[],defaults:[],rest:null,generator:false,async:false,body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"CLASS_NAME"},init:{type:"FunctionExpression",id:null,params:[],defaults:[],rest:null,generator:false,async:false,body:{type:"BlockStatement",body:[]},expression:false}}],kind:"var"},{type:"ReturnStatement",argument:{type:"Identifier",name:"CLASS_NAME"}}]},expression:false}},arguments:[]}}]},"exports-assign-key":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"exports"},property:{type:"Identifier",name:"VARIABLE_NAME"},computed:false},right:{type:"MemberExpression",object:{type:"Identifier",name:"OBJECT"},property:{type:"Identifier",name:"KEY"},computed:false}}}]},"exports-assign":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"exports"},property:{type:"Identifier",name:"KEY"},computed:false},right:{type:"Identifier",name:"VALUE"}}}]},"exports-default":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"exports"},property:{type:"Identifier",name:"default"},computed:false},right:{type:"Identifier",name:"VALUE"}}}]},"exports-wildcard":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"ParenthesizedExpression",expression:{type:"FunctionExpression",id:null,params:[{type:"Identifier",name:"obj"}],defaults:[],rest:null,generator:false,async:false,body:{type:"BlockStatement",body:[{type:"ForInStatement",left:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"i"},init:null}],kind:"var"},right:{type:"Identifier",name:"obj"},body:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"exports"},property:{type:"Identifier",name:"i"},computed:true},right:{type:"MemberExpression",object:{type:"Identifier",name:"obj"},property:{type:"Identifier",name:"i"},computed:true}}}]}}]},expression:false}},arguments:[{type:"Identifier",name:"OBJECT"}]}}]},"extends":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"ParenthesizedExpression",expression:{type:"FunctionExpression",id:null,params:[{type:"Identifier",name:"child"},{type:"Identifier",name:"parent"}],defaults:[],rest:null,generator:false,async:false,body:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"child"},property:{type:"Identifier",name:"prototype"},computed:false},right:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"create"},computed:false},arguments:[{type:"MemberExpression",object:{type:"Identifier",name:"parent"},property:{type:"Identifier",name:"prototype"},computed:false},{type:"ObjectExpression",properties:[{type:"Property",method:false,shorthand:false,computed:false,key:{type:"Identifier",name:"constructor"},value:{type:"ObjectExpression",properties:[{type:"Property",method:false,shorthand:false,computed:false,key:{type:"Identifier",name:"value"},value:{type:"Identifier",name:"child"},kind:"init"},{type:"Property",method:false,shorthand:false,computed:false,key:{type:"Identifier",name:"enumerable"},value:{type:"Literal",value:false},kind:"init"},{type:"Property",method:false,shorthand:false,computed:false,key:{type:"Identifier",name:"writable"},value:{type:"Literal",value:true},kind:"init"},{type:"Property",method:false,shorthand:false,computed:false,key:{type:"Identifier",name:"configurable"},value:{type:"Literal",value:true},kind:"init"}]},kind:"init"}]}]}}},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"child"},property:{type:"Identifier",name:"__proto__"},computed:false},right:{type:"Identifier",name:"parent"}}}]},expression:false}}}]},"for-of":{type:"Program",body:[{type:"ForStatement",init:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"ITERATOR_KEY"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"OBJECT"},property:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Identifier",name:"iterator"},computed:false},computed:true},arguments:[]}},{type:"VariableDeclarator",id:{type:"Identifier",name:"STEP_KEY"},init:null}],kind:"var"},test:{type:"UnaryExpression",operator:"!",prefix:true,argument:{type:"MemberExpression",object:{type:"ParenthesizedExpression",expression:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"STEP_KEY"},right:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"ITERATOR_KEY"},property:{type:"Identifier",name:"next"},computed:false},arguments:[]}}},property:{type:"Identifier",name:"done"},computed:false}},update:null,body:{type:"BlockStatement",body:[]}}]},"function-return-obj":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"ParenthesizedExpression",expression:{type:"FunctionExpression",id:null,params:[{type:"Identifier",name:"KEY"}],defaults:[],rest:null,generator:false,async:false,body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"Identifier",name:"KEY"}}]},expression:false}},arguments:[{type:"Identifier",name:"OBJECT"}]}}]},"if-undefined-set-to":{type:"Program",body:[{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Identifier",name:"VARIABLE"},operator:"===",right:{type:"Identifier",name:"undefined"}},consequent:{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"VARIABLE"},right:{type:"Identifier",name:"DEFAULT"}}},alternate:null}]},"let-scoping-return":{type:"Program",body:[{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:true,argument:{type:"Identifier",name:"RETURN"}},operator:"===",right:{type:"Literal",value:"object"}},consequent:{type:"ReturnStatement",argument:{type:"MemberExpression",object:{type:"Identifier",name:"RETURN"},property:{type:"Identifier",name:"v"},computed:false}},alternate:null}]},"object-define-properties-closure":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"ParenthesizedExpression",expression:{type:"FunctionExpression",id:null,params:[{type:"Identifier",name:"KEY"}],defaults:[],rest:null,generator:false,async:false,body:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"Identifier",name:"CONTENT"}},{type:"ReturnStatement",argument:{type:"Identifier",name:"KEY"}}]},expression:false}},arguments:[{type:"Identifier",name:"OBJECT"}]}}]},"object-define-properties":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"defineProperties"},computed:false},arguments:[{type:"Identifier",name:"OBJECT"},{type:"Identifier",name:"PROPS"}]}}]},"prototype-identifier":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"MemberExpression",object:{type:"Identifier",name:"CLASS_NAME"},property:{type:"Identifier",name:"prototype"},computed:false}}]},"require-assign-key":{type:"Program",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"VARIABLE_NAME"},init:{type:"MemberExpression",object:{type:"CallExpression",callee:{type:"Identifier",name:"require"},arguments:[{type:"Identifier",name:"MODULE_NAME"}]},property:{type:"Identifier",name:"KEY"},computed:false}}],kind:"var"}]},"require-assign":{type:"Program",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"VARIABLE_NAME"},init:{type:"CallExpression",callee:{type:"Identifier",name:"require"},arguments:[{type:"Identifier",name:"MODULE_NAME"}]}}],kind:"var"}]},require:{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"require"},arguments:[{type:"Identifier",name:"MODULE_NAME"}]}}]},"self-global":{type:"Program",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"self"},init:{type:"ConditionalExpression",test:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:true,argument:{type:"Identifier",name:"global"}},operator:"===",right:{type:"Literal",value:"undefined"}},consequent:{type:"Identifier",name:"window"},alternate:{type:"Identifier",name:"global"}}}],kind:"var"}]},slice:{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"MemberExpression",object:{type:"MemberExpression",object:{type:"Identifier",name:"Array"},property:{type:"Identifier",name:"prototype"},computed:false},property:{type:"Identifier",name:"slice"},computed:false}}]},"umd-runner-body":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"ParenthesizedExpression",expression:{type:"FunctionExpression",id:null,params:[{type:"Identifier",name:"factory"}],defaults:[],rest:null,generator:false,async:false,body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"LogicalExpression",left:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:true,argument:{type:"Identifier",name:"define"}},operator:"===",right:{type:"Literal",value:"function"}},operator:"&&",right:{type:"MemberExpression",object:{type:"Identifier",name:"define"},property:{type:"Identifier",name:"amd"},computed:false}},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"define"},arguments:[{type:"Identifier",name:"AMD_ARGUMENTS"},{type:"Identifier",name:"factory"}]}}]},alternate:{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:true,argument:{type:"Identifier",name:"exports"}},operator:"!==",right:{type:"Literal",value:"undefined"}},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"factory"},arguments:[{type:"Identifier",name:"exports"},{type:"Identifier",name:"COMMON_ARGUMENTS"}]}}]},alternate:null}}]},expression:false}}}]}}},{}]},{},[2])(2)}); |
ui/src/plugins/epl-dashboard/components/Dashboard.js | mkacper/erlangpl | // @flow
import React, { Component } from 'react';
import { Grid } from 'react-bootstrap';
import { Link, Route, Redirect } from 'react-router-dom';
import SystemInfo from './SystemInfo';
import SystemOverview from './SystemOverview';
import './Dashboard.css';
class Dashboard extends Component {
state: { tab: number };
constructor() {
super();
this.state = { tab: 0 };
}
render() {
const active = (index: number) => {
return this.state.tab === index ? 'Dashboard-active' : '';
};
const navItems = [
{ text: 'System overview', to: '/dashboard/overview' },
{ text: 'Basic system info', to: '/dashboard/system' }
];
return (
<div className="Dashboard">
<ul className="Dashboard-navigation nav nav-tabs">
{navItems.map((link, i) => (
<li
key={i}
className={`nav-item ${active(i)}`}
onClick={() => this.setState({ tab: i })}
>
<Link to={link.to}>
{link.text}
</Link>
</li>
))}
</ul>
<Grid className="Dashboard-grid" fluid>
<Route path="/dashboard/system" component={SystemInfo} />
<Route path="/dashboard/overview" component={SystemOverview} />
<Route
exact={true}
path="/dashboard"
render={() => <Redirect to={navItems[0].to} />}
/>
</Grid>
</div>
);
}
}
export default Dashboard;
|
test/es6-module-exports-spec.js | tomrosier/material-ui | import React from 'react';
import TestUtils from 'react-addons-test-utils';
const Divider = require('divider');
const ActionAccessibility = require('svg-icons').ActionAccessibility;
import ImportGetMuiTheme from 'styles/getMuiTheme';
const RequireGetMuiTheme = require('styles/getMuiTheme');
import ImportColorManipulator from 'utils/color-manipulator';
const RequireColorManipulator = require('utils/color-manipulator');
describe('require() style import of ', () => {
it(`Divider component should not fail when rendering`, () => {
expect(() => {
TestUtils.renderIntoDocument(<Divider />);
}).to.not.throw(Error);
});
it(`ActionAccessibility component should not fail when rendering`, () => {
expect(() => {
TestUtils.renderIntoDocument(<ActionAccessibility />);
}).to.not.throw(Error);
});
it(`getMuiTheme should have same result as ES6 style import`, () => {
expect(RequireGetMuiTheme).to.eql(ImportGetMuiTheme);
});
it(`ColorManipulator should have same result as ES6 style import`, () => {
expect(RequireColorManipulator).to.eql(ImportColorManipulator);
});
});
|
packages/material-ui-icons/src/Spa.js | kybarg/material-ui | import React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<React.Fragment><path fill="none" d="M0 0h24v24H0V0zm13.97 21.49c-.63.23-1.29.4-1.97.51.68-.12 1.33-.29 1.97-.51zM12 22z" /><path fill="#607D8B" d="M8.55 12c-1.07-.71-2.25-1.27-3.53-1.61 1.28.34 2.46.9 3.53 1.61zm10.43-1.61c-1.29.34-2.49.91-3.57 1.64 1.08-.73 2.28-1.3 3.57-1.64z" /><path d="M15.49 9.63c-.18-2.79-1.31-5.51-3.43-7.63-2.14 2.14-3.32 4.86-3.55 7.63 1.28.68 2.46 1.56 3.49 2.63 1.03-1.06 2.21-1.94 3.49-2.63zm-6.5 2.65c-.14-.1-.3-.19-.45-.29.15.11.31.19.45.29zm6.42-.25c-.13.09-.27.16-.4.26.13-.1.27-.17.4-.26zM12 15.45C9.85 12.17 6.18 10 2 10c0 5.32 3.36 9.82 8.03 11.49.63.23 1.29.4 1.97.51.68-.12 1.33-.29 1.97-.51C18.64 19.82 22 15.32 22 10c-4.18 0-7.85 2.17-10 5.45z" /></React.Fragment>
, 'Spa');
|
node_modules/material-ui/Stepper/StepLabel.js | andrycodestuffs/atom-sync-packages | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties');
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
var _typeof2 = require('babel-runtime/helpers/typeof');
var _typeof3 = _interopRequireDefault(_typeof2);
var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = require('babel-runtime/helpers/inherits');
var _inherits3 = _interopRequireDefault(_inherits2);
var _simpleAssign = require('simple-assign');
var _simpleAssign2 = _interopRequireDefault(_simpleAssign);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _checkCircle = require('../svg-icons/action/check-circle');
var _checkCircle2 = _interopRequireDefault(_checkCircle);
var _SvgIcon = require('../SvgIcon');
var _SvgIcon2 = _interopRequireDefault(_SvgIcon);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var getStyles = function getStyles(_ref, _ref2) {
var active = _ref.active,
completed = _ref.completed,
disabled = _ref.disabled;
var muiTheme = _ref2.muiTheme,
stepper = _ref2.stepper;
var _muiTheme$stepper = muiTheme.stepper,
textColor = _muiTheme$stepper.textColor,
disabledTextColor = _muiTheme$stepper.disabledTextColor,
iconColor = _muiTheme$stepper.iconColor,
inactiveIconColor = _muiTheme$stepper.inactiveIconColor;
var orientation = stepper.orientation;
var styles = {
root: {
height: orientation === 'horizontal' ? 72 : 64,
color: textColor,
display: 'flex',
alignItems: 'center',
fontSize: 14,
paddingLeft: 14,
paddingRight: 14
},
icon: {
color: iconColor,
display: 'block',
fontSize: 24,
width: 24,
height: 24
},
iconContainer: {
display: 'flex',
alignItems: 'center',
paddingRight: 8,
width: 24
}
};
if (active) {
styles.root.fontWeight = 500;
}
if (!completed && !active) {
styles.icon.color = inactiveIconColor;
}
if (disabled) {
styles.icon.color = inactiveIconColor;
styles.root.color = disabledTextColor;
styles.root.cursor = 'not-allowed';
}
return styles;
};
var StepLabel = function (_Component) {
(0, _inherits3.default)(StepLabel, _Component);
function StepLabel() {
(0, _classCallCheck3.default)(this, StepLabel);
return (0, _possibleConstructorReturn3.default)(this, (StepLabel.__proto__ || (0, _getPrototypeOf2.default)(StepLabel)).apply(this, arguments));
}
(0, _createClass3.default)(StepLabel, [{
key: 'renderIcon',
value: function renderIcon(completed, icon, styles) {
var iconType = typeof icon === 'undefined' ? 'undefined' : (0, _typeof3.default)(icon);
if (iconType === 'number' || iconType === 'string') {
if (completed) {
return _react2.default.createElement(_checkCircle2.default, {
color: styles.icon.color,
style: styles.icon
});
}
return _react2.default.createElement(
_SvgIcon2.default,
{ color: styles.icon.color, style: styles.icon },
_react2.default.createElement('circle', { cx: '12', cy: '12', r: '10' }),
_react2.default.createElement(
'text',
{
x: '12',
y: '16',
textAnchor: 'middle',
fontSize: '12',
fill: '#fff'
},
icon
)
);
}
return icon;
}
}, {
key: 'render',
value: function render() {
var _props = this.props,
active = _props.active,
children = _props.children,
completed = _props.completed,
userIcon = _props.icon,
iconContainerStyle = _props.iconContainerStyle,
last = _props.last,
style = _props.style,
other = (0, _objectWithoutProperties3.default)(_props, ['active', 'children', 'completed', 'icon', 'iconContainerStyle', 'last', 'style']);
var prepareStyles = this.context.muiTheme.prepareStyles;
var styles = getStyles(this.props, this.context);
var icon = this.renderIcon(completed, userIcon, styles);
return _react2.default.createElement(
'span',
(0, _extends3.default)({ style: prepareStyles((0, _simpleAssign2.default)(styles.root, style)) }, other),
icon && _react2.default.createElement(
'span',
{ style: prepareStyles((0, _simpleAssign2.default)(styles.iconContainer, iconContainerStyle)) },
icon
),
children
);
}
}]);
return StepLabel;
}(_react.Component);
StepLabel.muiName = 'StepLabel';
StepLabel.contextTypes = {
muiTheme: _react.PropTypes.object.isRequired,
stepper: _react.PropTypes.object
};
process.env.NODE_ENV !== "production" ? StepLabel.propTypes = {
/**
* Sets active styling. Overrides disabled coloring.
*/
active: _react.PropTypes.bool,
/**
* The label text node
*/
children: _react.PropTypes.node,
/**
* Sets completed styling. Overrides disabled coloring.
*/
completed: _react.PropTypes.bool,
/**
* Sets disabled styling.
*/
disabled: _react.PropTypes.bool,
/**
* The icon displayed by the step label.
*/
icon: _react.PropTypes.oneOfType([_react.PropTypes.element, _react.PropTypes.string, _react.PropTypes.number]),
/**
* Override the inline-styles of the icon container element.
*/
iconContainerStyle: _react.PropTypes.object,
/**
* @ignore
*/
last: _react.PropTypes.bool,
/**
* Override the inline-style of the root element.
*/
style: _react.PropTypes.object
} : void 0;
exports.default = StepLabel; |
src/App.js | leonpapazianis/react-boilerplate | import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import { TodoForm } from './components/todo/TodoForm';
import { TodoList } from './components/todo/TodoList';
import { addTodo, generateId, findById, toggleTodo, updateTodo } from './lib/TodoHelpers';
class App extends Component {
state = {
todos: [],
currentTodo: '',
};
handleToggle = id => {
const todo = findById(this.state.todos, id);
const toggled = toggleTodo(todo);
const updatedTodos = updateTodo(this.state.todos, toggled);
this.setState({todos: updatedTodos});
}
handleSubmit = event => {
event.preventDefault();
const newTodo = { id: generateId(), name: this.state.currentTodo, isComplete: false };
const updateTodos = addTodo(this.state.todos, newTodo);
this.setState({ todos: updateTodos, currentTodo: '', errorMessage: '' });
}
handleEmptySubmit = event => {
event.preventDefault();
this.setState({ errorMessage: 'Please suply a todo name!' });
}
handleInputChange = event => {
this.setState({ currentTodo: event.target.value });
}
render = () => {
const submitHandler = this.state.currentTodo ? this.handleSubmit : this.handleEmptySubmit;
return (
<div className="App">
<div className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<h2>React Todos</h2>
</div>
<div className="Todo-App">
{this.state.errorMessage && <span className='error'>{this.state.errorMessage}</span>}
<TodoForm
handleInputChange={this.handleInputChange}
handleSubmit={submitHandler}
currentTodo={this.state.currentTodo}/>
<TodoList handleToggle={this.handleToggle} todos={this.state.todos}/>
</div>
</div >
);
}
}
export default App;
|
build/umd/ReactRouter.js | elpete/react-router | (function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("react"));
else if(typeof define === 'function' && define.amd)
define(["react"], factory);
else if(typeof exports === 'object')
exports["ReactRouter"] = factory(require("react"));
else
root["ReactRouter"] = factory(root["React"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_21__) {
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.DefaultRoute = __webpack_require__(1);
exports.Link = __webpack_require__(2);
exports.NotFoundRoute = __webpack_require__(3);
exports.Redirect = __webpack_require__(4);
exports.Route = __webpack_require__(5);
exports.ActiveHandler = __webpack_require__(6);
exports.RouteHandler = exports.ActiveHandler;
exports.HashLocation = __webpack_require__(7);
exports.HistoryLocation = __webpack_require__(8);
exports.RefreshLocation = __webpack_require__(9);
exports.StaticLocation = __webpack_require__(10);
exports.TestLocation = __webpack_require__(11);
exports.ImitateBrowserBehavior = __webpack_require__(12);
exports.ScrollToTopBehavior = __webpack_require__(13);
exports.History = __webpack_require__(14);
exports.Navigation = __webpack_require__(15);
exports.State = __webpack_require__(16);
exports.createRoute = __webpack_require__(17).createRoute;
exports.createDefaultRoute = __webpack_require__(17).createDefaultRoute;
exports.createNotFoundRoute = __webpack_require__(17).createNotFoundRoute;
exports.createRedirect = __webpack_require__(17).createRedirect;
exports.createRoutesFromReactChildren = __webpack_require__(18);
exports.create = __webpack_require__(19);
exports.run = __webpack_require__(20);
/***/ },
/* 1 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
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 PropTypes = __webpack_require__(22);
var RouteHandler = __webpack_require__(6);
var Route = __webpack_require__(5);
/**
* A <DefaultRoute> component is a special kind of <Route> that
* renders when its parent matches but none of its siblings do.
* Only one such route may be used at any given level in the
* route hierarchy.
*/
var DefaultRoute = (function (_Route) {
function DefaultRoute() {
_classCallCheck(this, DefaultRoute);
if (_Route != null) {
_Route.apply(this, arguments);
}
}
_inherits(DefaultRoute, _Route);
return DefaultRoute;
})(Route);
// TODO: Include these in the above class definition
// once we can use ES7 property initializers.
// https://github.com/babel/babel/issues/619
DefaultRoute.propTypes = {
name: PropTypes.string,
path: PropTypes.falsy,
children: PropTypes.falsy,
handler: PropTypes.func.isRequired
};
DefaultRoute.defaultProps = {
handler: RouteHandler
};
module.exports = DefaultRoute;
/***/ },
/* 2 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
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 React = __webpack_require__(21);
var assign = __webpack_require__(33);
var PropTypes = __webpack_require__(22);
function isLeftClickEvent(event) {
return event.button === 0;
}
function isModifiedEvent(event) {
return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
}
/**
* <Link> components are used to create an <a> element that links to a route.
* When that route is active, the link gets an "active" class name (or the
* value of its `activeClassName` prop).
*
* For example, assuming you have the following route:
*
* <Route name="showPost" path="/posts/:postID" handler={Post}/>
*
* You could use the following component to link to that route:
*
* <Link to="showPost" params={{ postID: "123" }} />
*
* In addition to params, links may pass along query string parameters
* using the `query` prop.
*
* <Link to="showPost" params={{ postID: "123" }} query={{ show:true }}/>
*/
var Link = (function (_React$Component) {
function Link() {
_classCallCheck(this, Link);
if (_React$Component != null) {
_React$Component.apply(this, arguments);
}
}
_inherits(Link, _React$Component);
_createClass(Link, [{
key: 'handleClick',
value: function handleClick(event) {
var allowTransition = true;
var clickResult;
if (this.props.onClick) clickResult = this.props.onClick(event);
if (isModifiedEvent(event) || !isLeftClickEvent(event)) {
return;
}if (clickResult === false || event.defaultPrevented === true) allowTransition = false;
event.preventDefault();
if (allowTransition) this.context.router.transitionTo(this.props.to, this.props.params, this.props.query);
}
}, {
key: 'getHref',
/**
* Returns the value of the "href" attribute to use on the DOM element.
*/
value: function getHref() {
return this.context.router.makeHref(this.props.to, this.props.params, this.props.query);
}
}, {
key: 'getClassName',
/**
* Returns the value of the "class" attribute to use on the DOM element, which contains
* the value of the activeClassName property when this <Link> is active.
*/
value: function getClassName() {
var className = this.props.className;
if (this.getActiveState()) className += ' ' + this.props.activeClassName;
return className;
}
}, {
key: 'getActiveState',
value: function getActiveState() {
return this.context.router.isActive(this.props.to, this.props.params, this.props.query);
}
}, {
key: 'render',
value: function render() {
var props = assign({}, this.props, {
href: this.getHref(),
className: this.getClassName(),
onClick: this.handleClick.bind(this)
});
if (props.activeStyle && this.getActiveState()) props.style = props.activeStyle;
return React.DOM.a(props, this.props.children);
}
}]);
return Link;
})(React.Component);
// TODO: Include these in the above class definition
// once we can use ES7 property initializers.
// https://github.com/babel/babel/issues/619
Link.contextTypes = {
router: PropTypes.router.isRequired
};
Link.propTypes = {
activeClassName: PropTypes.string.isRequired,
to: PropTypes.oneOfType([PropTypes.string, PropTypes.route]).isRequired,
params: PropTypes.object,
query: PropTypes.object,
activeStyle: PropTypes.object,
onClick: PropTypes.func
};
Link.defaultProps = {
activeClassName: 'active',
className: ''
};
module.exports = Link;
/***/ },
/* 3 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
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 PropTypes = __webpack_require__(22);
var RouteHandler = __webpack_require__(6);
var Route = __webpack_require__(5);
/**
* A <NotFoundRoute> is a special kind of <Route> that
* renders when the beginning of its parent's path matches
* but none of its siblings do, including any <DefaultRoute>.
* Only one such route may be used at any given level in the
* route hierarchy.
*/
var NotFoundRoute = (function (_Route) {
function NotFoundRoute() {
_classCallCheck(this, NotFoundRoute);
if (_Route != null) {
_Route.apply(this, arguments);
}
}
_inherits(NotFoundRoute, _Route);
return NotFoundRoute;
})(Route);
// TODO: Include these in the above class definition
// once we can use ES7 property initializers.
// https://github.com/babel/babel/issues/619
NotFoundRoute.propTypes = {
name: PropTypes.string,
path: PropTypes.falsy,
children: PropTypes.falsy,
handler: PropTypes.func.isRequired
};
NotFoundRoute.defaultProps = {
handler: RouteHandler
};
module.exports = NotFoundRoute;
/***/ },
/* 4 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
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 PropTypes = __webpack_require__(22);
var Route = __webpack_require__(5);
/**
* A <Redirect> component is a special kind of <Route> that always
* redirects to another route when it matches.
*/
var Redirect = (function (_Route) {
function Redirect() {
_classCallCheck(this, Redirect);
if (_Route != null) {
_Route.apply(this, arguments);
}
}
_inherits(Redirect, _Route);
return Redirect;
})(Route);
// TODO: Include these in the above class definition
// once we can use ES7 property initializers.
// https://github.com/babel/babel/issues/619
Redirect.propTypes = {
path: PropTypes.string,
from: PropTypes.string, // Alias for path.
to: PropTypes.string,
handler: PropTypes.falsy
};
// Redirects should not have a default handler
Redirect.defaultProps = {};
module.exports = Redirect;
/***/ },
/* 5 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
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 React = __webpack_require__(21);
var invariant = __webpack_require__(34);
var PropTypes = __webpack_require__(22);
var RouteHandler = __webpack_require__(6);
/**
* <Route> components specify components that are rendered to the page when the
* URL matches a given pattern.
*
* Routes are arranged in a nested tree structure. When a new URL is requested,
* the tree is searched depth-first to find a route whose path matches the URL.
* When one is found, all routes in the tree that lead to it are considered
* "active" and their components are rendered into the DOM, nested in the same
* order as they are in the tree.
*
* The preferred way to configure a router is using JSX. The XML-like syntax is
* a great way to visualize how routes are laid out in an application.
*
* var routes = [
* <Route handler={App}>
* <Route name="login" handler={Login}/>
* <Route name="logout" handler={Logout}/>
* <Route name="about" handler={About}/>
* </Route>
* ];
*
* Router.run(routes, function (Handler) {
* React.render(<Handler/>, document.body);
* });
*
* Handlers for Route components that contain children can render their active
* child route using a <RouteHandler> element.
*
* var App = React.createClass({
* render: function () {
* return (
* <div class="application">
* <RouteHandler/>
* </div>
* );
* }
* });
*
* If no handler is provided for the route, it will render a matched child route.
*/
var Route = (function (_React$Component) {
function Route() {
_classCallCheck(this, Route);
if (_React$Component != null) {
_React$Component.apply(this, arguments);
}
}
_inherits(Route, _React$Component);
_createClass(Route, [{
key: 'render',
value: function render() {
invariant(false, '%s elements are for router configuration only and should not be rendered', this.constructor.name);
}
}]);
return Route;
})(React.Component);
// TODO: Include these in the above class definition
// once we can use ES7 property initializers.
// https://github.com/babel/babel/issues/619
Route.propTypes = {
name: PropTypes.string,
path: PropTypes.string,
handler: PropTypes.func,
ignoreScrollBehavior: PropTypes.bool
};
Route.defaultProps = {
handler: RouteHandler
};
module.exports = Route;
/***/ },
/* 6 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
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 React = __webpack_require__(21);
var ContextWrapper = __webpack_require__(23);
var assign = __webpack_require__(33);
var PropTypes = __webpack_require__(22);
var REF_NAME = '__routeHandler__';
/**
* A <RouteHandler> component renders the active child route handler
* when routes are nested.
*/
var RouteHandler = (function (_React$Component) {
function RouteHandler() {
_classCallCheck(this, RouteHandler);
if (_React$Component != null) {
_React$Component.apply(this, arguments);
}
}
_inherits(RouteHandler, _React$Component);
_createClass(RouteHandler, [{
key: 'getChildContext',
value: function getChildContext() {
return {
routeDepth: this.context.routeDepth + 1
};
}
}, {
key: 'componentDidMount',
value: function componentDidMount() {
this._updateRouteComponent(this.refs[REF_NAME]);
}
}, {
key: 'componentDidUpdate',
value: function componentDidUpdate() {
this._updateRouteComponent(this.refs[REF_NAME]);
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
this._updateRouteComponent(null);
}
}, {
key: '_updateRouteComponent',
value: function _updateRouteComponent(component) {
this.context.router.setRouteComponentAtDepth(this.getRouteDepth(), component);
}
}, {
key: 'getRouteDepth',
value: function getRouteDepth() {
return this.context.routeDepth;
}
}, {
key: 'createChildRouteHandler',
value: function createChildRouteHandler(props) {
var route = this.context.router.getRouteAtDepth(this.getRouteDepth());
if (route == null) {
return null;
}var childProps = assign({}, props || this.props, {
ref: REF_NAME,
params: this.context.router.getCurrentParams(),
query: this.context.router.getCurrentQuery()
});
return React.createElement(route.handler, childProps);
}
}, {
key: 'render',
value: function render() {
var handler = this.createChildRouteHandler();
// <script/> for things like <CSSTransitionGroup/> that don't like null
return handler ? React.createElement(
ContextWrapper,
null,
handler
) : React.createElement('script', null);
}
}]);
return RouteHandler;
})(React.Component);
// TODO: Include these in the above class definition
// once we can use ES7 property initializers.
// https://github.com/babel/babel/issues/619
RouteHandler.contextTypes = {
routeDepth: PropTypes.number.isRequired,
router: PropTypes.router.isRequired
};
RouteHandler.childContextTypes = {
routeDepth: PropTypes.number.isRequired
};
module.exports = RouteHandler;
/***/ },
/* 7 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var LocationActions = __webpack_require__(24);
var History = __webpack_require__(14);
var _listeners = [];
var _isListening = false;
var _actionType;
function notifyChange(type) {
if (type === LocationActions.PUSH) History.length += 1;
var change = {
path: HashLocation.getCurrentPath(),
type: type
};
_listeners.forEach(function (listener) {
listener.call(HashLocation, change);
});
}
function ensureSlash() {
var path = HashLocation.getCurrentPath();
if (path.charAt(0) === '/') {
return true;
}HashLocation.replace('/' + path);
return false;
}
function onHashChange() {
if (ensureSlash()) {
// If we don't have an _actionType then all we know is the hash
// changed. It was probably caused by the user clicking the Back
// button, but may have also been the Forward button or manual
// manipulation. So just guess 'pop'.
var curActionType = _actionType;
_actionType = null;
notifyChange(curActionType || LocationActions.POP);
}
}
/**
* A Location that uses `window.location.hash`.
*/
var HashLocation = {
addChangeListener: function addChangeListener(listener) {
_listeners.push(listener);
// Do this BEFORE listening for hashchange.
ensureSlash();
if (!_isListening) {
if (window.addEventListener) {
window.addEventListener('hashchange', onHashChange, false);
} else {
window.attachEvent('onhashchange', onHashChange);
}
_isListening = true;
}
},
removeChangeListener: function removeChangeListener(listener) {
_listeners = _listeners.filter(function (l) {
return l !== listener;
});
if (_listeners.length === 0) {
if (window.removeEventListener) {
window.removeEventListener('hashchange', onHashChange, false);
} else {
window.removeEvent('onhashchange', onHashChange);
}
_isListening = false;
}
},
push: function push(path) {
_actionType = LocationActions.PUSH;
window.location.hash = path;
},
replace: function replace(path) {
_actionType = LocationActions.REPLACE;
window.location.replace(window.location.pathname + window.location.search + '#' + path);
},
pop: function pop() {
_actionType = LocationActions.POP;
History.back();
},
getCurrentPath: function getCurrentPath() {
return decodeURI(
// We can't use window.location.hash here because it's not
// consistent across browsers - Firefox will pre-decode it!
window.location.href.split('#')[1] || '');
},
toString: function toString() {
return '<HashLocation>';
}
};
module.exports = HashLocation;
/***/ },
/* 8 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var LocationActions = __webpack_require__(24);
var History = __webpack_require__(14);
var _listeners = [];
var _isListening = false;
function notifyChange(type) {
var change = {
path: HistoryLocation.getCurrentPath(),
type: type
};
_listeners.forEach(function (listener) {
listener.call(HistoryLocation, change);
});
}
function onPopState(event) {
if (event.state === undefined) {
return;
} // Ignore extraneous popstate events in WebKit.
notifyChange(LocationActions.POP);
}
/**
* A Location that uses HTML5 history.
*/
var HistoryLocation = {
addChangeListener: function addChangeListener(listener) {
_listeners.push(listener);
if (!_isListening) {
if (window.addEventListener) {
window.addEventListener('popstate', onPopState, false);
} else {
window.attachEvent('onpopstate', onPopState);
}
_isListening = true;
}
},
removeChangeListener: function removeChangeListener(listener) {
_listeners = _listeners.filter(function (l) {
return l !== listener;
});
if (_listeners.length === 0) {
if (window.addEventListener) {
window.removeEventListener('popstate', onPopState, false);
} else {
window.removeEvent('onpopstate', onPopState);
}
_isListening = false;
}
},
push: function push(path) {
window.history.pushState({ path: path }, '', path);
History.length += 1;
notifyChange(LocationActions.PUSH);
},
replace: function replace(path) {
window.history.replaceState({ path: path }, '', path);
notifyChange(LocationActions.REPLACE);
},
pop: History.back,
getCurrentPath: function getCurrentPath() {
return decodeURI(window.location.pathname + window.location.search);
},
toString: function toString() {
return '<HistoryLocation>';
}
};
module.exports = HistoryLocation;
/***/ },
/* 9 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var HistoryLocation = __webpack_require__(8);
var History = __webpack_require__(14);
/**
* A Location that uses full page refreshes. This is used as
* the fallback for HistoryLocation in browsers that do not
* support the HTML5 history API.
*/
var RefreshLocation = {
push: function push(path) {
window.location = path;
},
replace: function replace(path) {
window.location.replace(path);
},
pop: History.back,
getCurrentPath: HistoryLocation.getCurrentPath,
toString: function toString() {
return '<RefreshLocation>';
}
};
module.exports = RefreshLocation;
/***/ },
/* 10 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var invariant = __webpack_require__(34);
function throwCannotModify() {
invariant(false, 'You cannot modify a static location');
}
/**
* A location that only ever contains a single path. Useful in
* stateless environments like servers where there is no path history,
* only the path that was used in the request.
*/
var StaticLocation = (function () {
function StaticLocation(path) {
_classCallCheck(this, StaticLocation);
this.path = path;
}
_createClass(StaticLocation, [{
key: 'getCurrentPath',
value: function getCurrentPath() {
return this.path;
}
}, {
key: 'toString',
value: function toString() {
return '<StaticLocation path="' + this.path + '">';
}
}]);
return StaticLocation;
})();
// TODO: Include these in the above class definition
// once we can use ES7 property initializers.
// https://github.com/babel/babel/issues/619
StaticLocation.prototype.push = throwCannotModify;
StaticLocation.prototype.replace = throwCannotModify;
StaticLocation.prototype.pop = throwCannotModify;
module.exports = StaticLocation;
/***/ },
/* 11 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var invariant = __webpack_require__(34);
var LocationActions = __webpack_require__(24);
var History = __webpack_require__(14);
/**
* A location that is convenient for testing and does not require a DOM.
*/
var TestLocation = (function () {
function TestLocation(history) {
_classCallCheck(this, TestLocation);
this.history = history || [];
this.listeners = [];
this._updateHistoryLength();
}
_createClass(TestLocation, [{
key: 'needsDOM',
get: function () {
return false;
}
}, {
key: '_updateHistoryLength',
value: function _updateHistoryLength() {
History.length = this.history.length;
}
}, {
key: '_notifyChange',
value: function _notifyChange(type) {
var change = {
path: this.getCurrentPath(),
type: type
};
for (var i = 0, len = this.listeners.length; i < len; ++i) this.listeners[i].call(this, change);
}
}, {
key: 'addChangeListener',
value: function addChangeListener(listener) {
this.listeners.push(listener);
}
}, {
key: 'removeChangeListener',
value: function removeChangeListener(listener) {
this.listeners = this.listeners.filter(function (l) {
return l !== listener;
});
}
}, {
key: 'push',
value: function push(path) {
this.history.push(path);
this._updateHistoryLength();
this._notifyChange(LocationActions.PUSH);
}
}, {
key: 'replace',
value: function replace(path) {
invariant(this.history.length, 'You cannot replace the current path with no history');
this.history[this.history.length - 1] = path;
this._notifyChange(LocationActions.REPLACE);
}
}, {
key: 'pop',
value: function pop() {
this.history.pop();
this._updateHistoryLength();
this._notifyChange(LocationActions.POP);
}
}, {
key: 'getCurrentPath',
value: function getCurrentPath() {
return this.history[this.history.length - 1];
}
}, {
key: 'toString',
value: function toString() {
return '<TestLocation>';
}
}]);
return TestLocation;
})();
module.exports = TestLocation;
/***/ },
/* 12 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var LocationActions = __webpack_require__(24);
/**
* A scroll behavior that attempts to imitate the default behavior
* of modern browsers.
*/
var ImitateBrowserBehavior = {
updateScrollPosition: function updateScrollPosition(position, actionType) {
switch (actionType) {
case LocationActions.PUSH:
case LocationActions.REPLACE:
window.scrollTo(0, 0);
break;
case LocationActions.POP:
if (position) {
window.scrollTo(position.x, position.y);
} else {
window.scrollTo(0, 0);
}
break;
}
}
};
module.exports = ImitateBrowserBehavior;
/***/ },
/* 13 */
/***/ function(module, exports, __webpack_require__) {
/**
* A scroll behavior that always scrolls to the top of the page
* after a transition.
*/
"use strict";
var ScrollToTopBehavior = {
updateScrollPosition: function updateScrollPosition() {
window.scrollTo(0, 0);
}
};
module.exports = ScrollToTopBehavior;
/***/ },
/* 14 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var invariant = __webpack_require__(34);
var canUseDOM = __webpack_require__(35).canUseDOM;
var History = {
/**
* The current number of entries in the history.
*
* Note: This property is read-only.
*/
length: 1,
/**
* Sends the browser back one entry in the history.
*/
back: function back() {
invariant(canUseDOM, 'Cannot use History.back without a DOM');
// Do this first so that History.length will
// be accurate in location change listeners.
History.length -= 1;
window.history.back();
}
};
module.exports = History;
/***/ },
/* 15 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var PropTypes = __webpack_require__(22);
/**
* A mixin for components that modify the URL.
*
* Example:
*
* var MyLink = React.createClass({
* mixins: [ Router.Navigation ],
* handleClick(event) {
* event.preventDefault();
* this.transitionTo('aRoute', { the: 'params' }, { the: 'query' });
* },
* render() {
* return (
* <a onClick={this.handleClick}>Click me!</a>
* );
* }
* });
*/
var Navigation = {
contextTypes: {
router: PropTypes.router.isRequired
},
/**
* Returns an absolute URL path created from the given route
* name, URL parameters, and query values.
*/
makePath: function makePath(to, params, query) {
return this.context.router.makePath(to, params, query);
},
/**
* Returns a string that may safely be used as the href of a
* link to the route with the given name.
*/
makeHref: function makeHref(to, params, query) {
return this.context.router.makeHref(to, params, query);
},
/**
* Transitions to the URL specified in the arguments by pushing
* a new URL onto the history stack.
*/
transitionTo: function transitionTo(to, params, query) {
this.context.router.transitionTo(to, params, query);
},
/**
* Transitions to the URL specified in the arguments by replacing
* the current URL in the history stack.
*/
replaceWith: function replaceWith(to, params, query) {
this.context.router.replaceWith(to, params, query);
},
/**
* Transitions to the previous URL.
*/
goBack: function goBack() {
return this.context.router.goBack();
}
};
module.exports = Navigation;
/***/ },
/* 16 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var PropTypes = __webpack_require__(22);
/**
* A mixin for components that need to know the path, routes, URL
* params and query that are currently active.
*
* Example:
*
* var AboutLink = React.createClass({
* mixins: [ Router.State ],
* render() {
* var className = this.props.className;
*
* if (this.isActive('about'))
* className += ' is-active';
*
* return React.DOM.a({ className: className }, this.props.children);
* }
* });
*/
var State = {
contextTypes: {
router: PropTypes.router.isRequired
},
/**
* Returns the current URL path.
*/
getPath: function getPath() {
return this.context.router.getCurrentPath();
},
/**
* Returns the current URL path without the query string.
*/
getPathname: function getPathname() {
return this.context.router.getCurrentPathname();
},
/**
* Returns an object of the URL params that are currently active.
*/
getParams: function getParams() {
return this.context.router.getCurrentParams();
},
/**
* Returns an object of the query params that are currently active.
*/
getQuery: function getQuery() {
return this.context.router.getCurrentQuery();
},
/**
* Returns an array of the routes that are currently active.
*/
getRoutes: function getRoutes() {
return this.context.router.getCurrentRoutes();
},
/**
* A helper method to determine if a given route, params, and query
* are active.
*/
isActive: function isActive(to, params, query) {
return this.context.router.isActive(to, params, query);
}
};
module.exports = State;
/***/ },
/* 17 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var assign = __webpack_require__(33);
var invariant = __webpack_require__(34);
var warning = __webpack_require__(36);
var PathUtils = __webpack_require__(25);
var _currentRoute;
var Route = (function () {
function Route(name, path, ignoreScrollBehavior, isDefault, isNotFound, onEnter, onLeave, handler) {
_classCallCheck(this, Route);
this.name = name;
this.path = path;
this.paramNames = PathUtils.extractParamNames(this.path);
this.ignoreScrollBehavior = !!ignoreScrollBehavior;
this.isDefault = !!isDefault;
this.isNotFound = !!isNotFound;
this.onEnter = onEnter;
this.onLeave = onLeave;
this.handler = handler;
}
_createClass(Route, [{
key: 'appendChild',
/**
* Appends the given route to this route's child routes.
*/
value: function appendChild(route) {
invariant(route instanceof Route, 'route.appendChild must use a valid Route');
if (!this.childRoutes) this.childRoutes = [];
this.childRoutes.push(route);
}
}, {
key: 'toString',
value: function toString() {
var string = '<Route';
if (this.name) string += ' name="' + this.name + '"';
string += ' path="' + this.path + '">';
return string;
}
}], [{
key: 'createRoute',
/**
* Creates and returns a new route. Options may be a URL pathname string
* with placeholders for named params or an object with any of the following
* properties:
*
* - name The name of the route. This is used to lookup a
* route relative to its parent route and should be
* unique among all child routes of the same parent
* - path A URL pathname string with optional placeholders
* that specify the names of params to extract from
* the URL when the path matches. Defaults to `/${name}`
* when there is a name given, or the path of the parent
* route, or /
* - ignoreScrollBehavior True to make this route (and all descendants) ignore
* the scroll behavior of the router
* - isDefault True to make this route the default route among all
* its siblings
* - isNotFound True to make this route the "not found" route among
* all its siblings
* - onEnter A transition hook that will be called when the
* router is going to enter this route
* - onLeave A transition hook that will be called when the
* router is going to leave this route
* - handler A React component that will be rendered when
* this route is active
* - parentRoute The parent route to use for this route. This option
* is automatically supplied when creating routes inside
* the callback to another invocation of createRoute. You
* only ever need to use this when declaring routes
* independently of one another to manually piece together
* the route hierarchy
*
* The callback may be used to structure your route hierarchy. Any call to
* createRoute, createDefaultRoute, createNotFoundRoute, or createRedirect
* inside the callback automatically uses this route as its parent.
*/
value: function createRoute(options, callback) {
options = options || {};
if (typeof options === 'string') options = { path: options };
var parentRoute = _currentRoute;
if (parentRoute) {
warning(options.parentRoute == null || options.parentRoute === parentRoute, 'You should not use parentRoute with createRoute inside another route\'s child callback; it is ignored');
} else {
parentRoute = options.parentRoute;
}
var name = options.name;
var path = options.path || name;
if (path && !(options.isDefault || options.isNotFound)) {
if (PathUtils.isAbsolute(path)) {
if (parentRoute) {
invariant(path === parentRoute.path || parentRoute.paramNames.length === 0, 'You cannot nest path "%s" inside "%s"; the parent requires URL parameters', path, parentRoute.path);
}
} else if (parentRoute) {
// Relative paths extend their parent.
path = PathUtils.join(parentRoute.path, path);
} else {
path = '/' + path;
}
} else {
path = parentRoute ? parentRoute.path : '/';
}
if (options.isNotFound && !/\*$/.test(path)) path += '*'; // Auto-append * to the path of not found routes.
var route = new Route(name, path, options.ignoreScrollBehavior, options.isDefault, options.isNotFound, options.onEnter, options.onLeave, options.handler);
if (parentRoute) {
if (route.isDefault) {
invariant(parentRoute.defaultRoute == null, '%s may not have more than one default route', parentRoute);
parentRoute.defaultRoute = route;
} else if (route.isNotFound) {
invariant(parentRoute.notFoundRoute == null, '%s may not have more than one not found route', parentRoute);
parentRoute.notFoundRoute = route;
}
parentRoute.appendChild(route);
}
// Any routes created in the callback
// use this route as their parent.
if (typeof callback === 'function') {
var currentRoute = _currentRoute;
_currentRoute = route;
callback.call(route, route);
_currentRoute = currentRoute;
}
return route;
}
}, {
key: 'createDefaultRoute',
/**
* Creates and returns a route that is rendered when its parent matches
* the current URL.
*/
value: function createDefaultRoute(options) {
return Route.createRoute(assign({}, options, { isDefault: true }));
}
}, {
key: 'createNotFoundRoute',
/**
* Creates and returns a route that is rendered when its parent matches
* the current URL but none of its siblings do.
*/
value: function createNotFoundRoute(options) {
return Route.createRoute(assign({}, options, { isNotFound: true }));
}
}, {
key: 'createRedirect',
/**
* Creates and returns a route that automatically redirects the transition
* to another route. In addition to the normal options to createRoute, this
* function accepts the following options:
*
* - from An alias for the `path` option. Defaults to *
* - to The path/route/route name to redirect to
* - params The params to use in the redirect URL. Defaults
* to using the current params
* - query The query to use in the redirect URL. Defaults
* to using the current query
*/
value: function createRedirect(options) {
return Route.createRoute(assign({}, options, {
path: options.path || options.from || '*',
onEnter: function onEnter(transition, params, query) {
transition.redirect(options.to, options.params || params, options.query || query);
}
}));
}
}]);
return Route;
})();
module.exports = Route;
/***/ },
/* 18 */
/***/ function(module, exports, __webpack_require__) {
/* jshint -W084 */
'use strict';
var React = __webpack_require__(21);
var assign = __webpack_require__(33);
var warning = __webpack_require__(36);
var DefaultRoute = __webpack_require__(1);
var NotFoundRoute = __webpack_require__(3);
var Redirect = __webpack_require__(4);
var Route = __webpack_require__(17);
function checkPropTypes(componentName, propTypes, props) {
componentName = componentName || 'UnknownComponent';
for (var propName in propTypes) {
if (propTypes.hasOwnProperty(propName)) {
var error = propTypes[propName](props, propName, componentName);
if (error instanceof Error) warning(false, error.message);
}
}
}
function createRouteOptions(props) {
var options = assign({}, props);
var handler = options.handler;
if (handler) {
options.onEnter = handler.willTransitionTo;
options.onLeave = handler.willTransitionFrom;
}
return options;
}
function createRouteFromReactElement(element) {
if (!React.isValidElement(element)) {
return;
}var type = element.type;
var props = assign({}, type.defaultProps, element.props);
if (type.propTypes) checkPropTypes(type.displayName, type.propTypes, props);
if (type === DefaultRoute) {
return Route.createDefaultRoute(createRouteOptions(props));
}if (type === NotFoundRoute) {
return Route.createNotFoundRoute(createRouteOptions(props));
}if (type === Redirect) {
return Route.createRedirect(createRouteOptions(props));
}return Route.createRoute(createRouteOptions(props), function () {
if (props.children) createRoutesFromReactChildren(props.children);
});
}
/**
* Creates and returns an array of routes created from the given
* ReactChildren, all of which should be one of <Route>, <DefaultRoute>,
* <NotFoundRoute>, or <Redirect>, e.g.:
*
* var { createRoutesFromReactChildren, Route, Redirect } = require('react-router');
*
* var routes = createRoutesFromReactChildren(
* <Route path="/" handler={App}>
* <Route name="user" path="/user/:userId" handler={User}>
* <Route name="task" path="tasks/:taskId" handler={Task}/>
* <Redirect from="todos/:taskId" to="task"/>
* </Route>
* </Route>
* );
*/
function createRoutesFromReactChildren(children) {
var routes = [];
React.Children.forEach(children, function (child) {
if (child = createRouteFromReactElement(child)) routes.push(child);
});
return routes;
}
module.exports = createRoutesFromReactChildren;
/***/ },
/* 19 */
/***/ function(module, exports, __webpack_require__) {
/* jshint -W058 */
'use strict';
var React = __webpack_require__(21);
var warning = __webpack_require__(36);
var invariant = __webpack_require__(34);
var canUseDOM = __webpack_require__(35).canUseDOM;
var LocationActions = __webpack_require__(24);
var ImitateBrowserBehavior = __webpack_require__(12);
var HashLocation = __webpack_require__(7);
var HistoryLocation = __webpack_require__(8);
var RefreshLocation = __webpack_require__(9);
var StaticLocation = __webpack_require__(10);
var ScrollHistory = __webpack_require__(26);
var createRoutesFromReactChildren = __webpack_require__(18);
var isReactChildren = __webpack_require__(27);
var Transition = __webpack_require__(28);
var PropTypes = __webpack_require__(22);
var Redirect = __webpack_require__(29);
var History = __webpack_require__(14);
var Cancellation = __webpack_require__(30);
var Match = __webpack_require__(31);
var Route = __webpack_require__(17);
var supportsHistory = __webpack_require__(32);
var PathUtils = __webpack_require__(25);
/**
* The default location for new routers.
*/
var DEFAULT_LOCATION = canUseDOM ? HashLocation : '/';
/**
* The default scroll behavior for new routers.
*/
var DEFAULT_SCROLL_BEHAVIOR = canUseDOM ? ImitateBrowserBehavior : null;
function hasProperties(object, properties) {
for (var propertyName in properties) if (properties.hasOwnProperty(propertyName) && object[propertyName] !== properties[propertyName]) {
return false;
}return true;
}
function hasMatch(routes, route, prevParams, nextParams, prevQuery, nextQuery) {
return routes.some(function (r) {
if (r !== route) return false;
var paramNames = route.paramNames;
var paramName;
// Ensure that all params the route cares about did not change.
for (var i = 0, len = paramNames.length; i < len; ++i) {
paramName = paramNames[i];
if (nextParams[paramName] !== prevParams[paramName]) return false;
}
// Ensure the query hasn't changed.
return hasProperties(prevQuery, nextQuery) && hasProperties(nextQuery, prevQuery);
});
}
function addRoutesToNamedRoutes(routes, namedRoutes) {
var route;
for (var i = 0, len = routes.length; i < len; ++i) {
route = routes[i];
if (route.name) {
invariant(namedRoutes[route.name] == null, 'You may not have more than one route named "%s"', route.name);
namedRoutes[route.name] = route;
}
if (route.childRoutes) addRoutesToNamedRoutes(route.childRoutes, namedRoutes);
}
}
function routeIsActive(activeRoutes, routeName) {
return activeRoutes.some(function (route) {
return route.name === routeName;
});
}
function paramsAreActive(activeParams, params) {
for (var property in params) if (String(activeParams[property]) !== String(params[property])) {
return false;
}return true;
}
function queryIsActive(activeQuery, query) {
for (var property in query) if (String(activeQuery[property]) !== String(query[property])) {
return false;
}return true;
}
/**
* Creates and returns a new router using the given options. A router
* is a ReactComponent class that knows how to react to changes in the
* URL and keep the contents of the page in sync.
*
* Options may be any of the following:
*
* - routes (required) The route config
* - location The location to use. Defaults to HashLocation when
* the DOM is available, "/" otherwise
* - scrollBehavior The scroll behavior to use. Defaults to ImitateBrowserBehavior
* when the DOM is available, null otherwise
* - onError A function that is used to handle errors
* - onAbort A function that is used to handle aborted transitions
*
* When rendering in a server-side environment, the location should simply
* be the URL path that was used in the request, including the query string.
*/
function createRouter(options) {
options = options || {};
if (isReactChildren(options)) options = { routes: options };
var mountedComponents = [];
var location = options.location || DEFAULT_LOCATION;
var scrollBehavior = options.scrollBehavior || DEFAULT_SCROLL_BEHAVIOR;
var state = {};
var nextState = {};
var pendingTransition = null;
var dispatchHandler = null;
if (typeof location === 'string') location = new StaticLocation(location);
if (location instanceof StaticLocation) {
warning(!canUseDOM || ("production") === 'test', 'You should not use a static location in a DOM environment because ' + 'the router will not be kept in sync with the current URL');
} else {
invariant(canUseDOM || location.needsDOM === false, 'You cannot use %s without a DOM', location);
}
// Automatically fall back to full page refreshes in
// browsers that don't support the HTML history API.
if (location === HistoryLocation && !supportsHistory()) location = RefreshLocation;
var Router = React.createClass({
displayName: 'Router',
statics: {
isRunning: false,
cancelPendingTransition: function cancelPendingTransition() {
if (pendingTransition) {
pendingTransition.cancel();
pendingTransition = null;
}
},
clearAllRoutes: function clearAllRoutes() {
Router.cancelPendingTransition();
Router.namedRoutes = {};
Router.routes = [];
},
/**
* Adds routes to this router from the given children object (see ReactChildren).
*/
addRoutes: function addRoutes(routes) {
if (isReactChildren(routes)) routes = createRoutesFromReactChildren(routes);
addRoutesToNamedRoutes(routes, Router.namedRoutes);
Router.routes.push.apply(Router.routes, routes);
},
/**
* Replaces routes of this router from the given children object (see ReactChildren).
*/
replaceRoutes: function replaceRoutes(routes) {
Router.clearAllRoutes();
Router.addRoutes(routes);
Router.refresh();
},
/**
* Performs a match of the given path against this router and returns an object
* with the { routes, params, pathname, query } that match. Returns null if no
* match can be made.
*/
match: function match(path) {
return Match.findMatch(Router.routes, path);
},
/**
* Returns an absolute URL path created from the given route
* name, URL parameters, and query.
*/
makePath: function makePath(to, params, query) {
var path;
if (PathUtils.isAbsolute(to)) {
path = to;
} else {
var route = to instanceof Route ? to : Router.namedRoutes[to];
invariant(route instanceof Route, 'Cannot find a route named "%s"', to);
path = route.path;
}
return PathUtils.withQuery(PathUtils.injectParams(path, params), query);
},
/**
* Returns a string that may safely be used as the href of a link
* to the route with the given name, URL parameters, and query.
*/
makeHref: function makeHref(to, params, query) {
var path = Router.makePath(to, params, query);
return location === HashLocation ? '#' + path : path;
},
/**
* Transitions to the URL specified in the arguments by pushing
* a new URL onto the history stack.
*/
transitionTo: function transitionTo(to, params, query) {
var path = Router.makePath(to, params, query);
if (pendingTransition) {
// Replace so pending location does not stay in history.
location.replace(path);
} else {
location.push(path);
}
},
/**
* Transitions to the URL specified in the arguments by replacing
* the current URL in the history stack.
*/
replaceWith: function replaceWith(to, params, query) {
location.replace(Router.makePath(to, params, query));
},
/**
* Transitions to the previous URL if one is available. Returns true if the
* router was able to go back, false otherwise.
*
* Note: The router only tracks history entries in your application, not the
* current browser session, so you can safely call this function without guarding
* against sending the user back to some other site. However, when using
* RefreshLocation (which is the fallback for HistoryLocation in browsers that
* don't support HTML5 history) this method will *always* send the client back
* because we cannot reliably track history length.
*/
goBack: function goBack() {
if (History.length > 1 || location === RefreshLocation) {
location.pop();
return true;
}
warning(false, 'goBack() was ignored because there is no router history');
return false;
},
handleAbort: options.onAbort || function (abortReason) {
if (location instanceof StaticLocation) throw new Error('Unhandled aborted transition! Reason: ' + abortReason);
if (abortReason instanceof Cancellation) {
return;
} else if (abortReason instanceof Redirect) {
location.replace(Router.makePath(abortReason.to, abortReason.params, abortReason.query));
} else {
location.pop();
}
},
handleError: options.onError || function (error) {
// Throw so we don't silently swallow async errors.
throw error; // This error probably originated in a transition hook.
},
handleLocationChange: function handleLocationChange(change) {
Router.dispatch(change.path, change.type);
},
/**
* Performs a transition to the given path and calls callback(error, abortReason)
* when the transition is finished. If both arguments are null the router's state
* was updated. Otherwise the transition did not complete.
*
* In a transition, a router first determines which routes are involved by beginning
* with the current route, up the route tree to the first parent route that is shared
* with the destination route, and back down the tree to the destination route. The
* willTransitionFrom hook is invoked on all route handlers we're transitioning away
* from, in reverse nesting order. Likewise, the willTransitionTo hook is invoked on
* all route handlers we're transitioning to.
*
* Both willTransitionFrom and willTransitionTo hooks may either abort or redirect the
* transition. To resolve asynchronously, they may use the callback argument. If no
* hooks wait, the transition is fully synchronous.
*/
dispatch: function dispatch(path, action) {
Router.cancelPendingTransition();
var prevPath = state.path;
var isRefreshing = action == null;
if (prevPath === path && !isRefreshing) {
return;
} // Nothing to do!
// Record the scroll position as early as possible to
// get it before browsers try update it automatically.
if (prevPath && action === LocationActions.PUSH) Router.recordScrollPosition(prevPath);
var match = Router.match(path);
warning(match != null, 'No route matches path "%s". Make sure you have <Route path="%s"> somewhere in your routes', path, path);
if (match == null) match = {};
var prevRoutes = state.routes || [];
var prevParams = state.params || {};
var prevQuery = state.query || {};
var nextRoutes = match.routes || [];
var nextParams = match.params || {};
var nextQuery = match.query || {};
var fromRoutes, toRoutes;
if (prevRoutes.length) {
fromRoutes = prevRoutes.filter(function (route) {
return !hasMatch(nextRoutes, route, prevParams, nextParams, prevQuery, nextQuery);
});
toRoutes = nextRoutes.filter(function (route) {
return !hasMatch(prevRoutes, route, prevParams, nextParams, prevQuery, nextQuery);
});
} else {
fromRoutes = [];
toRoutes = nextRoutes;
}
var transition = new Transition(path, Router.replaceWith.bind(Router, path));
pendingTransition = transition;
var fromComponents = mountedComponents.slice(prevRoutes.length - fromRoutes.length);
Transition.from(transition, fromRoutes, fromComponents, function (error) {
if (error || transition.abortReason) return dispatchHandler.call(Router, error, transition); // No need to continue.
Transition.to(transition, toRoutes, nextParams, nextQuery, function (error) {
dispatchHandler.call(Router, error, transition, {
path: path,
action: action,
pathname: match.pathname,
routes: nextRoutes,
params: nextParams,
query: nextQuery
});
});
});
},
/**
* Starts this router and calls callback(router, state) when the route changes.
*
* If the router's location is static (i.e. a URL path in a server environment)
* the callback is called only once. Otherwise, the location should be one of the
* Router.*Location objects (e.g. Router.HashLocation or Router.HistoryLocation).
*/
run: function run(callback) {
invariant(!Router.isRunning, 'Router is already running');
dispatchHandler = function (error, transition, newState) {
if (error) Router.handleError(error);
if (pendingTransition !== transition) return;
pendingTransition = null;
if (transition.abortReason) {
Router.handleAbort(transition.abortReason);
} else {
callback.call(Router, Router, nextState = newState);
}
};
if (!(location instanceof StaticLocation)) {
if (location.addChangeListener) location.addChangeListener(Router.handleLocationChange);
Router.isRunning = true;
}
// Bootstrap using the current path.
Router.refresh();
},
refresh: function refresh() {
Router.dispatch(location.getCurrentPath(), null);
},
stop: function stop() {
Router.cancelPendingTransition();
if (location.removeChangeListener) location.removeChangeListener(Router.handleLocationChange);
Router.isRunning = false;
},
getLocation: function getLocation() {
return location;
},
getScrollBehavior: function getScrollBehavior() {
return scrollBehavior;
},
getRouteAtDepth: function getRouteAtDepth(routeDepth) {
var routes = state.routes;
return routes && routes[routeDepth];
},
setRouteComponentAtDepth: function setRouteComponentAtDepth(routeDepth, component) {
mountedComponents[routeDepth] = component;
},
/**
* Returns the current URL path + query string.
*/
getCurrentPath: function getCurrentPath() {
return state.path;
},
/**
* Returns the current URL path without the query string.
*/
getCurrentPathname: function getCurrentPathname() {
return state.pathname;
},
/**
* Returns an object of the currently active URL parameters.
*/
getCurrentParams: function getCurrentParams() {
return state.params;
},
/**
* Returns an object of the currently active query parameters.
*/
getCurrentQuery: function getCurrentQuery() {
return state.query;
},
/**
* Returns an array of the currently active routes.
*/
getCurrentRoutes: function getCurrentRoutes() {
return state.routes;
},
/**
* Returns true if the given route, params, and query are active.
*/
isActive: function isActive(to, params, query) {
if (PathUtils.isAbsolute(to)) {
return to === state.path;
}return routeIsActive(state.routes, to) && paramsAreActive(state.params, params) && (query == null || queryIsActive(state.query, query));
}
},
mixins: [ScrollHistory],
propTypes: {
children: PropTypes.falsy
},
childContextTypes: {
routeDepth: PropTypes.number.isRequired,
router: PropTypes.router.isRequired
},
getChildContext: function getChildContext() {
return {
routeDepth: 1,
router: Router
};
},
getInitialState: function getInitialState() {
return state = nextState;
},
componentWillReceiveProps: function componentWillReceiveProps() {
this.setState(state = nextState);
},
componentWillUnmount: function componentWillUnmount() {
Router.stop();
},
render: function render() {
var route = Router.getRouteAtDepth(0);
return route ? React.createElement(route.handler, this.props) : null;
}
});
Router.clearAllRoutes();
if (options.routes) Router.addRoutes(options.routes);
return Router;
}
module.exports = createRouter;
/***/ },
/* 20 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var createRouter = __webpack_require__(19);
/**
* A high-level convenience method that creates, configures, and
* runs a router in one shot. The method signature is:
*
* Router.run(routes[, location ], callback);
*
* Using `window.location.hash` to manage the URL, you could do:
*
* Router.run(routes, function (Handler) {
* React.render(<Handler/>, document.body);
* });
*
* Using HTML5 history and a custom "cursor" prop:
*
* Router.run(routes, Router.HistoryLocation, function (Handler) {
* React.render(<Handler cursor={cursor}/>, document.body);
* });
*
* Returns the newly created router.
*
* Note: If you need to specify further options for your router such
* as error/abort handling or custom scroll behavior, use Router.create
* instead.
*
* var router = Router.create(options);
* router.run(function (Handler) {
* // ...
* });
*/
function runRouter(routes, location, callback) {
if (typeof location === 'function') {
callback = location;
location = null;
}
var router = createRouter({
routes: routes,
location: location
});
router.run(callback);
return router;
}
module.exports = runRouter;
/***/ },
/* 21 */
/***/ function(module, exports, __webpack_require__) {
module.exports = __WEBPACK_EXTERNAL_MODULE_21__;
/***/ },
/* 22 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var assign = __webpack_require__(33);
var ReactPropTypes = __webpack_require__(21).PropTypes;
var Route = __webpack_require__(17);
var PropTypes = assign({}, ReactPropTypes, {
/**
* Indicates that a prop should be falsy.
*/
falsy: function falsy(props, propName, componentName) {
if (props[propName]) {
return new Error('<' + componentName + '> should not have a "' + propName + '" prop');
}
},
/**
* Indicates that a prop should be a Route object.
*/
route: ReactPropTypes.instanceOf(Route),
/**
* Indicates that a prop should be a Router object.
*/
//router: ReactPropTypes.instanceOf(Router) // TODO
router: ReactPropTypes.func
});
module.exports = PropTypes;
/***/ },
/* 23 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
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; };
/**
* This component is necessary to get around a context warning
* present in React 0.13.0. It sovles this by providing a separation
* between the "owner" and "parent" contexts.
*/
var React = __webpack_require__(21);
var ContextWrapper = (function (_React$Component) {
function ContextWrapper() {
_classCallCheck(this, ContextWrapper);
if (_React$Component != null) {
_React$Component.apply(this, arguments);
}
}
_inherits(ContextWrapper, _React$Component);
_createClass(ContextWrapper, [{
key: 'render',
value: function render() {
return this.props.children;
}
}]);
return ContextWrapper;
})(React.Component);
module.exports = ContextWrapper;
/***/ },
/* 24 */
/***/ function(module, exports, __webpack_require__) {
/**
* Actions that modify the URL.
*/
'use strict';
var LocationActions = {
/**
* Indicates a new location is being pushed to the history stack.
*/
PUSH: 'push',
/**
* Indicates the current location should be replaced.
*/
REPLACE: 'replace',
/**
* Indicates the most recent entry should be removed from the history stack.
*/
POP: 'pop'
};
module.exports = LocationActions;
/***/ },
/* 25 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var invariant = __webpack_require__(34);
var assign = __webpack_require__(38);
var qs = __webpack_require__(39);
var paramCompileMatcher = /:([a-zA-Z_$][a-zA-Z0-9_$]*)|[*.()\[\]\\+|{}^$]/g;
var paramInjectMatcher = /:([a-zA-Z_$][a-zA-Z0-9_$?]*[?]?)|[*]/g;
var paramInjectTrailingSlashMatcher = /\/\/\?|\/\?\/|\/\?/g;
var queryMatcher = /\?(.*)$/;
var _compiledPatterns = {};
function compilePattern(pattern) {
if (!(pattern in _compiledPatterns)) {
var paramNames = [];
var source = pattern.replace(paramCompileMatcher, function (match, paramName) {
if (paramName) {
paramNames.push(paramName);
return '([^/?#]+)';
} else if (match === '*') {
paramNames.push('splat');
return '(.*?)';
} else {
return '\\' + match;
}
});
_compiledPatterns[pattern] = {
matcher: new RegExp('^' + source + '$', 'i'),
paramNames: paramNames
};
}
return _compiledPatterns[pattern];
}
var PathUtils = {
/**
* Returns true if the given path is absolute.
*/
isAbsolute: function isAbsolute(path) {
return path.charAt(0) === '/';
},
/**
* Joins two URL paths together.
*/
join: function join(a, b) {
return a.replace(/\/*$/, '/') + b;
},
/**
* Returns an array of the names of all parameters in the given pattern.
*/
extractParamNames: function extractParamNames(pattern) {
return compilePattern(pattern).paramNames;
},
/**
* Extracts the portions of the given URL path that match the given pattern
* and returns an object of param name => value pairs. Returns null if the
* pattern does not match the given path.
*/
extractParams: function extractParams(pattern, path) {
var _compilePattern = compilePattern(pattern);
var matcher = _compilePattern.matcher;
var paramNames = _compilePattern.paramNames;
var match = path.match(matcher);
if (!match) {
return null;
}var params = {};
paramNames.forEach(function (paramName, index) {
params[paramName] = match[index + 1];
});
return params;
},
/**
* Returns a version of the given route path with params interpolated. Throws
* if there is a dynamic segment of the route path for which there is no param.
*/
injectParams: function injectParams(pattern, params) {
params = params || {};
var splatIndex = 0;
return pattern.replace(paramInjectMatcher, function (match, paramName) {
paramName = paramName || 'splat';
// If param is optional don't check for existence
if (paramName.slice(-1) === '?') {
paramName = paramName.slice(0, -1);
if (params[paramName] == null) return '';
} else {
invariant(params[paramName] != null, 'Missing "%s" parameter for path "%s"', paramName, pattern);
}
var segment;
if (paramName === 'splat' && Array.isArray(params[paramName])) {
segment = params[paramName][splatIndex++];
invariant(segment != null, 'Missing splat # %s for path "%s"', splatIndex, pattern);
} else {
segment = params[paramName];
}
return segment;
}).replace(paramInjectTrailingSlashMatcher, '/');
},
/**
* Returns an object that is the result of parsing any query string contained
* in the given path, null if the path contains no query string.
*/
extractQuery: function extractQuery(path) {
var match = path.match(queryMatcher);
return match && qs.parse(match[1]);
},
/**
* Returns a version of the given path without the query string.
*/
withoutQuery: function withoutQuery(path) {
return path.replace(queryMatcher, '');
},
/**
* Returns a version of the given path with the parameters in the given
* query merged into the query string.
*/
withQuery: function withQuery(path, query) {
var existingQuery = PathUtils.extractQuery(path);
if (existingQuery) query = query ? assign(existingQuery, query) : existingQuery;
var queryString = qs.stringify(query, { arrayFormat: 'brackets' });
if (queryString) {
return PathUtils.withoutQuery(path) + '?' + queryString;
}return PathUtils.withoutQuery(path);
}
};
module.exports = PathUtils;
/***/ },
/* 26 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var invariant = __webpack_require__(34);
var canUseDOM = __webpack_require__(35).canUseDOM;
var getWindowScrollPosition = __webpack_require__(37);
function shouldUpdateScroll(state, prevState) {
if (!prevState) {
return true;
} // Don't update scroll position when only the query has changed.
if (state.pathname === prevState.pathname) {
return false;
}var routes = state.routes;
var prevRoutes = prevState.routes;
var sharedAncestorRoutes = routes.filter(function (route) {
return prevRoutes.indexOf(route) !== -1;
});
return !sharedAncestorRoutes.some(function (route) {
return route.ignoreScrollBehavior;
});
}
/**
* Provides the router with the ability to manage window scroll position
* according to its scroll behavior.
*/
var ScrollHistory = {
statics: {
/**
* Records curent scroll position as the last known position for the given URL path.
*/
recordScrollPosition: function recordScrollPosition(path) {
if (!this.scrollHistory) this.scrollHistory = {};
this.scrollHistory[path] = getWindowScrollPosition();
},
/**
* Returns the last known scroll position for the given URL path.
*/
getScrollPosition: function getScrollPosition(path) {
if (!this.scrollHistory) this.scrollHistory = {};
return this.scrollHistory[path] || null;
}
},
componentWillMount: function componentWillMount() {
invariant(this.constructor.getScrollBehavior() == null || canUseDOM, 'Cannot use scroll behavior without a DOM');
},
componentDidMount: function componentDidMount() {
this._updateScroll();
},
componentDidUpdate: function componentDidUpdate(prevProps, prevState) {
this._updateScroll(prevState);
},
_updateScroll: function _updateScroll(prevState) {
if (!shouldUpdateScroll(this.state, prevState)) {
return;
}var scrollBehavior = this.constructor.getScrollBehavior();
if (scrollBehavior) scrollBehavior.updateScrollPosition(this.constructor.getScrollPosition(this.state.path), this.state.action);
}
};
module.exports = ScrollHistory;
/***/ },
/* 27 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var React = __webpack_require__(21);
function isValidChild(object) {
return object == null || React.isValidElement(object);
}
function isReactChildren(object) {
return isValidChild(object) || Array.isArray(object) && object.every(isValidChild);
}
module.exports = isReactChildren;
/***/ },
/* 28 */
/***/ function(module, exports, __webpack_require__) {
/* jshint -W058 */
'use strict';
var Cancellation = __webpack_require__(30);
var Redirect = __webpack_require__(29);
/**
* Encapsulates a transition to a given path.
*
* The willTransitionTo and willTransitionFrom handlers receive
* an instance of this class as their first argument.
*/
function Transition(path, retry) {
this.path = path;
this.abortReason = null;
// TODO: Change this to router.retryTransition(transition)
this.retry = retry.bind(this);
}
Transition.prototype.abort = function (reason) {
if (this.abortReason == null) this.abortReason = reason || 'ABORT';
};
Transition.prototype.redirect = function (to, params, query) {
this.abort(new Redirect(to, params, query));
};
Transition.prototype.cancel = function () {
this.abort(new Cancellation());
};
Transition.from = function (transition, routes, components, callback) {
routes.reduce(function (callback, route, index) {
return function (error) {
if (error || transition.abortReason) {
callback(error);
} else if (route.onLeave) {
try {
route.onLeave(transition, components[index], callback);
// If there is no callback in the argument list, call it automatically.
if (route.onLeave.length < 3) callback();
} catch (e) {
callback(e);
}
} else {
callback();
}
};
}, callback)();
};
Transition.to = function (transition, routes, params, query, callback) {
routes.reduceRight(function (callback, route) {
return function (error) {
if (error || transition.abortReason) {
callback(error);
} else if (route.onEnter) {
try {
route.onEnter(transition, params, query, callback);
// If there is no callback in the argument list, call it automatically.
if (route.onEnter.length < 4) callback();
} catch (e) {
callback(e);
}
} else {
callback();
}
};
}, callback)();
};
module.exports = Transition;
/***/ },
/* 29 */
/***/ function(module, exports, __webpack_require__) {
/**
* Encapsulates a redirect to the given route.
*/
"use strict";
function Redirect(to, params, query) {
this.to = to;
this.params = params;
this.query = query;
}
module.exports = Redirect;
/***/ },
/* 30 */
/***/ function(module, exports, __webpack_require__) {
/**
* Represents a cancellation caused by navigating away
* before the previous transition has fully resolved.
*/
"use strict";
function Cancellation() {}
module.exports = Cancellation;
/***/ },
/* 31 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
/* jshint -W084 */
var PathUtils = __webpack_require__(25);
function deepSearch(route, pathname, query) {
// Check the subtree first to find the most deeply-nested match.
var childRoutes = route.childRoutes;
if (childRoutes) {
var match, childRoute;
for (var i = 0, len = childRoutes.length; i < len; ++i) {
childRoute = childRoutes[i];
if (childRoute.isDefault || childRoute.isNotFound) continue; // Check these in order later.
if (match = deepSearch(childRoute, pathname, query)) {
// A route in the subtree matched! Add this route and we're done.
match.routes.unshift(route);
return match;
}
}
}
// No child routes matched; try the default route.
var defaultRoute = route.defaultRoute;
if (defaultRoute && (params = PathUtils.extractParams(defaultRoute.path, pathname))) {
return new Match(pathname, params, query, [route, defaultRoute]);
} // Does the "not found" route match?
var notFoundRoute = route.notFoundRoute;
if (notFoundRoute && (params = PathUtils.extractParams(notFoundRoute.path, pathname))) {
return new Match(pathname, params, query, [route, notFoundRoute]);
} // Last attempt: check this route.
var params = PathUtils.extractParams(route.path, pathname);
if (params) {
return new Match(pathname, params, query, [route]);
}return null;
}
var Match = (function () {
function Match(pathname, params, query, routes) {
_classCallCheck(this, Match);
this.pathname = pathname;
this.params = params;
this.query = query;
this.routes = routes;
}
_createClass(Match, null, [{
key: 'findMatch',
/**
* Attempts to match depth-first a route in the given route's
* subtree against the given path and returns the match if it
* succeeds, null if no match can be made.
*/
value: function findMatch(routes, path) {
var pathname = PathUtils.withoutQuery(path);
var query = PathUtils.extractQuery(path);
var match = null;
for (var i = 0, len = routes.length; match == null && i < len; ++i) match = deepSearch(routes[i], pathname, query);
return match;
}
}]);
return Match;
})();
module.exports = Match;
/***/ },
/* 32 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
function supportsHistory() {
/*! taken from modernizr
* https://github.com/Modernizr/Modernizr/blob/master/LICENSE
* https://github.com/Modernizr/Modernizr/blob/master/feature-detects/history.js
* changed to avoid false negatives for Windows Phones: https://github.com/rackt/react-router/issues/586
*/
var ua = navigator.userAgent;
if ((ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) && ua.indexOf('Mobile Safari') !== -1 && ua.indexOf('Chrome') === -1 && ua.indexOf('Windows Phone') === -1) {
return false;
}
return window.history && 'pushState' in window.history;
}
module.exports = supportsHistory;
/***/ },
/* 33 */
/***/ function(module, exports, __webpack_require__) {
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule Object.assign
*/
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign
'use strict';
function assign(target, sources) {
if (target == null) {
throw new TypeError('Object.assign target cannot be null or undefined');
}
var to = Object(target);
var hasOwnProperty = Object.prototype.hasOwnProperty;
for (var nextIndex = 1; nextIndex < arguments.length; nextIndex++) {
var nextSource = arguments[nextIndex];
if (nextSource == null) {
continue;
}
var from = Object(nextSource);
// We don't currently support accessors nor proxies. Therefore this
// copy cannot throw. If we ever supported this then we must handle
// exceptions and side-effects. We don't support symbols so they won't
// be transferred.
for (var key in from) {
if (hasOwnProperty.call(from, key)) {
to[key] = from[key];
}
}
}
return to;
}
module.exports = assign;
/***/ },
/* 34 */
/***/ 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 invariant(condition, format, a, b, c, d, e, f) {
if (false) {
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;
/***/ },
/* 35 */
/***/ 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;
/***/ },
/* 36 */
/***/ function(module, exports, __webpack_require__) {
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule warning
*/
"use strict";
var emptyFunction = __webpack_require__(40);
/**
* Similar to invariant but only logs a warning if the condition is not met.
* This can be used to log issues in development environments in critical
* paths. Removing the logging code for production environments will keep the
* same logic and follow the same code paths.
*/
var warning = emptyFunction;
if (false) {
warning = function (condition, format) {
for (var args = [], $__0 = 2, $__1 = arguments.length; $__0 < $__1; $__0++) args.push(arguments[$__0]);
if (format === undefined) {
throw new Error("`warning(condition, format, ...args)` requires a warning " + "message argument");
}
if (format.length < 10 || /^[s\W]*$/.test(format)) {
throw new Error("The warning format should be able to uniquely identify this " + "warning. Please, use a more descriptive format than: " + format);
}
if (format.indexOf("Failed Composite propType: ") === 0) {
return; // Ignore CompositeComponent proptype check.
}
if (!condition) {
var argIndex = 0;
var message = "Warning: " + format.replace(/%s/g, function () {
return args[argIndex++];
});
console.warn(message);
try {
// --- Welcome to debugging React ---
// This error was thrown as a convenience so that you can use this stack
// to find the callsite that caused this warning to fire.
throw new Error(message);
} catch (x) {}
}
};
}
module.exports = warning;
/***/ },
/* 37 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var invariant = __webpack_require__(34);
var canUseDOM = __webpack_require__(35).canUseDOM;
/**
* Returns the current scroll position of the window as { x, y }.
*/
function getWindowScrollPosition() {
invariant(canUseDOM, 'Cannot get current scroll position without a DOM');
return {
x: window.pageXOffset || document.documentElement.scrollLeft,
y: window.pageYOffset || document.documentElement.scrollTop
};
}
module.exports = getWindowScrollPosition;
/***/ },
/* 38 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
function ToObject(val) {
if (val == null) {
throw new TypeError('Object.assign cannot be called with null or undefined');
}
return Object(val);
}
module.exports = Object.assign || function (target, source) {
var from;
var keys;
var to = ToObject(target);
for (var s = 1; s < arguments.length; s++) {
from = arguments[s];
keys = Object.keys(Object(from));
for (var i = 0; i < keys.length; i++) {
to[keys[i]] = from[keys[i]];
}
}
return to;
};
/***/ },
/* 39 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
module.exports = __webpack_require__(41);
/***/ },
/* 40 */
/***/ 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 emptyFunction
*/
"use strict";
function makeEmptyFunction(arg) {
return function () {
return arg;
};
}
/**
* This function accepts and discards inputs; it has no side effects. This is
* primarily useful idiomatically for overridable function endpoints which
* always need to be callable, since JS lacks a null-call idiom ala Cocoa.
*/
function emptyFunction() {}
emptyFunction.thatReturns = makeEmptyFunction;
emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
emptyFunction.thatReturnsNull = makeEmptyFunction(null);
emptyFunction.thatReturnsThis = function () {
return this;
};
emptyFunction.thatReturnsArgument = function (arg) {
return arg;
};
module.exports = emptyFunction;
/***/ },
/* 41 */
/***/ function(module, exports, __webpack_require__) {
// Load modules
'use strict';
var Stringify = __webpack_require__(42);
var Parse = __webpack_require__(43);
// Declare internals
var internals = {};
module.exports = {
stringify: Stringify,
parse: Parse
};
/***/ },
/* 42 */
/***/ function(module, exports, __webpack_require__) {
// Load modules
'use strict';
var Utils = __webpack_require__(44);
// Declare internals
var internals = {
delimiter: '&',
arrayPrefixGenerators: {
brackets: function brackets(prefix, key) {
return prefix + '[]';
},
indices: function indices(prefix, key) {
return prefix + '[' + key + ']';
},
repeat: function repeat(prefix, key) {
return prefix;
}
}
};
internals.stringify = function (obj, prefix, generateArrayPrefix) {
if (Utils.isBuffer(obj)) {
obj = obj.toString();
} else if (obj instanceof Date) {
obj = obj.toISOString();
} else if (obj === null) {
obj = '';
}
if (typeof obj === 'string' || typeof obj === 'number' || typeof obj === 'boolean') {
return [encodeURIComponent(prefix) + '=' + encodeURIComponent(obj)];
}
var values = [];
if (typeof obj === 'undefined') {
return values;
}
var objKeys = Object.keys(obj);
for (var i = 0, il = objKeys.length; i < il; ++i) {
var key = objKeys[i];
if (Array.isArray(obj)) {
values = values.concat(internals.stringify(obj[key], generateArrayPrefix(prefix, key), generateArrayPrefix));
} else {
values = values.concat(internals.stringify(obj[key], prefix + '[' + key + ']', generateArrayPrefix));
}
}
return values;
};
module.exports = function (obj, options) {
options = options || {};
var delimiter = typeof options.delimiter === 'undefined' ? internals.delimiter : options.delimiter;
var keys = [];
if (typeof obj !== 'object' || obj === null) {
return '';
}
var arrayFormat;
if (options.arrayFormat in internals.arrayPrefixGenerators) {
arrayFormat = options.arrayFormat;
} else if ('indices' in options) {
arrayFormat = options.indices ? 'indices' : 'repeat';
} else {
arrayFormat = 'indices';
}
var generateArrayPrefix = internals.arrayPrefixGenerators[arrayFormat];
var objKeys = Object.keys(obj);
for (var i = 0, il = objKeys.length; i < il; ++i) {
var key = objKeys[i];
keys = keys.concat(internals.stringify(obj[key], key, generateArrayPrefix));
}
return keys.join(delimiter);
};
/***/ },
/* 43 */
/***/ function(module, exports, __webpack_require__) {
// Load modules
'use strict';
var Utils = __webpack_require__(44);
// Declare internals
var internals = {
delimiter: '&',
depth: 5,
arrayLimit: 20,
parameterLimit: 1000
};
internals.parseValues = function (str, options) {
var obj = {};
var parts = str.split(options.delimiter, options.parameterLimit === Infinity ? undefined : options.parameterLimit);
for (var i = 0, il = parts.length; i < il; ++i) {
var part = parts[i];
var pos = part.indexOf(']=') === -1 ? part.indexOf('=') : part.indexOf(']=') + 1;
if (pos === -1) {
obj[Utils.decode(part)] = '';
} else {
var key = Utils.decode(part.slice(0, pos));
var val = Utils.decode(part.slice(pos + 1));
if (Object.prototype.hasOwnProperty(key)) {
continue;
}
if (!obj.hasOwnProperty(key)) {
obj[key] = val;
} else {
obj[key] = [].concat(obj[key]).concat(val);
}
}
}
return obj;
};
internals.parseObject = function (chain, val, options) {
if (!chain.length) {
return val;
}
var root = chain.shift();
var obj = {};
if (root === '[]') {
obj = [];
obj = obj.concat(internals.parseObject(chain, val, options));
} else {
var cleanRoot = root[0] === '[' && root[root.length - 1] === ']' ? root.slice(1, root.length - 1) : root;
var index = parseInt(cleanRoot, 10);
var indexString = '' + index;
if (!isNaN(index) && root !== cleanRoot && indexString === cleanRoot && index >= 0 && index <= options.arrayLimit) {
obj = [];
obj[index] = internals.parseObject(chain, val, options);
} else {
obj[cleanRoot] = internals.parseObject(chain, val, options);
}
}
return obj;
};
internals.parseKeys = function (key, val, options) {
if (!key) {
return;
}
// The regex chunks
var parent = /^([^\[\]]*)/;
var child = /(\[[^\[\]]*\])/g;
// Get the parent
var segment = parent.exec(key);
// Don't allow them to overwrite object prototype properties
if (Object.prototype.hasOwnProperty(segment[1])) {
return;
}
// Stash the parent if it exists
var keys = [];
if (segment[1]) {
keys.push(segment[1]);
}
// Loop through children appending to the array until we hit depth
var i = 0;
while ((segment = child.exec(key)) !== null && i < options.depth) {
++i;
if (!Object.prototype.hasOwnProperty(segment[1].replace(/\[|\]/g, ''))) {
keys.push(segment[1]);
}
}
// If there's a remainder, just add whatever is left
if (segment) {
keys.push('[' + key.slice(segment.index) + ']');
}
return internals.parseObject(keys, val, options);
};
module.exports = function (str, options) {
if (str === '' || str === null || typeof str === 'undefined') {
return {};
}
options = options || {};
options.delimiter = typeof options.delimiter === 'string' || Utils.isRegExp(options.delimiter) ? options.delimiter : internals.delimiter;
options.depth = typeof options.depth === 'number' ? options.depth : internals.depth;
options.arrayLimit = typeof options.arrayLimit === 'number' ? options.arrayLimit : internals.arrayLimit;
options.parameterLimit = typeof options.parameterLimit === 'number' ? options.parameterLimit : internals.parameterLimit;
var tempObj = typeof str === 'string' ? internals.parseValues(str, options) : str;
var obj = {};
// Iterate over the keys and setup the new object
var keys = Object.keys(tempObj);
for (var i = 0, il = keys.length; i < il; ++i) {
var key = keys[i];
var newObj = internals.parseKeys(key, tempObj[key], options);
obj = Utils.merge(obj, newObj);
}
return Utils.compact(obj);
};
/***/ },
/* 44 */
/***/ function(module, exports, __webpack_require__) {
// Load modules
// Declare internals
'use strict';
var internals = {};
exports.arrayToObject = function (source) {
var obj = {};
for (var i = 0, il = source.length; i < il; ++i) {
if (typeof source[i] !== 'undefined') {
obj[i] = source[i];
}
}
return obj;
};
exports.merge = function (target, source) {
if (!source) {
return target;
}
if (typeof source !== 'object') {
if (Array.isArray(target)) {
target.push(source);
} else {
target[source] = true;
}
return target;
}
if (typeof target !== 'object') {
target = [target].concat(source);
return target;
}
if (Array.isArray(target) && !Array.isArray(source)) {
target = exports.arrayToObject(target);
}
var keys = Object.keys(source);
for (var k = 0, kl = keys.length; k < kl; ++k) {
var key = keys[k];
var value = source[key];
if (!target[key]) {
target[key] = value;
} else {
target[key] = exports.merge(target[key], value);
}
}
return target;
};
exports.decode = function (str) {
try {
return decodeURIComponent(str.replace(/\+/g, ' '));
} catch (e) {
return str;
}
};
exports.compact = function (obj, refs) {
if (typeof obj !== 'object' || obj === null) {
return obj;
}
refs = refs || [];
var lookup = refs.indexOf(obj);
if (lookup !== -1) {
return refs[lookup];
}
refs.push(obj);
if (Array.isArray(obj)) {
var compacted = [];
for (var i = 0, il = obj.length; i < il; ++i) {
if (typeof obj[i] !== 'undefined') {
compacted.push(obj[i]);
}
}
return compacted;
}
var keys = Object.keys(obj);
for (i = 0, il = keys.length; i < il; ++i) {
var key = keys[i];
obj[key] = exports.compact(obj[key], refs);
}
return obj;
};
exports.isRegExp = function (obj) {
return Object.prototype.toString.call(obj) === '[object RegExp]';
};
exports.isBuffer = function (obj) {
if (obj === null || typeof obj === 'undefined') {
return false;
}
return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
};
/***/ }
/******/ ])
});
|
ajax/libs/jquery/1.4.3/jquery.min.js | yahyaKacem/cdnjs | /*!
* jQuery JavaScript Library v1.4.3
* http://jquery.com/
*
* Copyright 2010, John Resig
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* Includes Sizzle.js
* http://sizzlejs.com/
* Copyright 2010, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
*
* Date: Thu Oct 14 23:10:06 2010 -0400
*/
(function(E,A){function U(){return false}function ba(){return true}function ja(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function Ga(a){var b,d,e=[],f=[],h,k,l,n,s,v,B,D;k=c.data(this,this.nodeType?"events":"__events__");if(typeof k==="function")k=k.events;if(!(a.liveFired===this||!k||!k.live||a.button&&a.type==="click")){if(a.namespace)D=RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)");a.liveFired=this;var H=k.live.slice(0);for(n=0;n<H.length;n++){k=H[n];k.origType.replace(X,
"")===a.type?f.push(k.selector):H.splice(n--,1)}f=c(a.target).closest(f,a.currentTarget);s=0;for(v=f.length;s<v;s++){B=f[s];for(n=0;n<H.length;n++){k=H[n];if(B.selector===k.selector&&(!D||D.test(k.namespace))){l=B.elem;h=null;if(k.preType==="mouseenter"||k.preType==="mouseleave"){a.type=k.preType;h=c(a.relatedTarget).closest(k.selector)[0]}if(!h||h!==l)e.push({elem:l,handleObj:k,level:B.level})}}}s=0;for(v=e.length;s<v;s++){f=e[s];if(d&&f.level>d)break;a.currentTarget=f.elem;a.data=f.handleObj.data;
a.handleObj=f.handleObj;D=f.handleObj.origHandler.apply(f.elem,arguments);if(D===false||a.isPropagationStopped()){d=f.level;if(D===false)b=false}}return b}}function Y(a,b){return(a&&a!=="*"?a+".":"")+b.replace(Ha,"`").replace(Ia,"&")}function ka(a,b,d){if(c.isFunction(b))return c.grep(a,function(f,h){return!!b.call(f,h,f)===d});else if(b.nodeType)return c.grep(a,function(f){return f===b===d});else if(typeof b==="string"){var e=c.grep(a,function(f){return f.nodeType===1});if(Ja.test(b))return c.filter(b,
e,!d);else b=c.filter(b,e)}return c.grep(a,function(f){return c.inArray(f,b)>=0===d})}function la(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var e=c.data(a[d++]),f=c.data(this,e);if(e=e&&e.events){delete f.handle;f.events={};for(var h in e)for(var k in e[h])c.event.add(this,h,e[h][k],e[h][k].data)}}})}function Ka(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}
function ma(a,b,d){var e=b==="width"?a.offsetWidth:a.offsetHeight;if(d==="border")return e;c.each(b==="width"?La:Ma,function(){d||(e-=parseFloat(c.css(a,"padding"+this))||0);if(d==="margin")e+=parseFloat(c.css(a,"margin"+this))||0;else e-=parseFloat(c.css(a,"border"+this+"Width"))||0});return e}function ca(a,b,d,e){if(c.isArray(b)&&b.length)c.each(b,function(f,h){d||Na.test(a)?e(a,h):ca(a+"["+(typeof h==="object"||c.isArray(h)?f:"")+"]",h,d,e)});else if(!d&&b!=null&&typeof b==="object")c.isEmptyObject(b)?
e(a,""):c.each(b,function(f,h){ca(a+"["+f+"]",h,d,e)});else e(a,b)}function S(a,b){var d={};c.each(na.concat.apply([],na.slice(0,b)),function(){d[this]=a});return d}function oa(a){if(!da[a]){var b=c("<"+a+">").appendTo("body"),d=b.css("display");b.remove();if(d==="none"||d==="")d="block";da[a]=d}return da[a]}function ea(a){return c.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var u=E.document,c=function(){function a(){if(!b.isReady){try{u.documentElement.doScroll("left")}catch(i){setTimeout(a,
1);return}b.ready()}}var b=function(i,r){return new b.fn.init(i,r)},d=E.jQuery,e=E.$,f,h=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,k=/\S/,l=/^\s+/,n=/\s+$/,s=/\W/,v=/\d/,B=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,D=/^[\],:{}\s]*$/,H=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,w=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,G=/(?:^|:|,)(?:\s*\[)+/g,M=/(webkit)[ \/]([\w.]+)/,g=/(opera)(?:.*version)?[ \/]([\w.]+)/,j=/(msie) ([\w.]+)/,o=/(mozilla)(?:.*? rv:([\w.]+))?/,m=navigator.userAgent,p=false,
q=[],t,x=Object.prototype.toString,C=Object.prototype.hasOwnProperty,P=Array.prototype.push,N=Array.prototype.slice,R=String.prototype.trim,Q=Array.prototype.indexOf,L={};b.fn=b.prototype={init:function(i,r){var y,z,F;if(!i)return this;if(i.nodeType){this.context=this[0]=i;this.length=1;return this}if(i==="body"&&!r&&u.body){this.context=u;this[0]=u.body;this.selector="body";this.length=1;return this}if(typeof i==="string")if((y=h.exec(i))&&(y[1]||!r))if(y[1]){F=r?r.ownerDocument||r:u;if(z=B.exec(i))if(b.isPlainObject(r)){i=
[u.createElement(z[1])];b.fn.attr.call(i,r,true)}else i=[F.createElement(z[1])];else{z=b.buildFragment([y[1]],[F]);i=(z.cacheable?z.fragment.cloneNode(true):z.fragment).childNodes}return b.merge(this,i)}else{if((z=u.getElementById(y[2]))&&z.parentNode){if(z.id!==y[2])return f.find(i);this.length=1;this[0]=z}this.context=u;this.selector=i;return this}else if(!r&&!s.test(i)){this.selector=i;this.context=u;i=u.getElementsByTagName(i);return b.merge(this,i)}else return!r||r.jquery?(r||f).find(i):b(r).find(i);
else if(b.isFunction(i))return f.ready(i);if(i.selector!==A){this.selector=i.selector;this.context=i.context}return b.makeArray(i,this)},selector:"",jquery:"1.4.3",length:0,size:function(){return this.length},toArray:function(){return N.call(this,0)},get:function(i){return i==null?this.toArray():i<0?this.slice(i)[0]:this[i]},pushStack:function(i,r,y){var z=b();b.isArray(i)?P.apply(z,i):b.merge(z,i);z.prevObject=this;z.context=this.context;if(r==="find")z.selector=this.selector+(this.selector?" ":
"")+y;else if(r)z.selector=this.selector+"."+r+"("+y+")";return z},each:function(i,r){return b.each(this,i,r)},ready:function(i){b.bindReady();if(b.isReady)i.call(u,b);else q&&q.push(i);return this},eq:function(i){return i===-1?this.slice(i):this.slice(i,+i+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(N.apply(this,arguments),"slice",N.call(arguments).join(","))},map:function(i){return this.pushStack(b.map(this,function(r,y){return i.call(r,
y,r)}))},end:function(){return this.prevObject||b(null)},push:P,sort:[].sort,splice:[].splice};b.fn.init.prototype=b.fn;b.extend=b.fn.extend=function(){var i=arguments[0]||{},r=1,y=arguments.length,z=false,F,I,K,J,fa;if(typeof i==="boolean"){z=i;i=arguments[1]||{};r=2}if(typeof i!=="object"&&!b.isFunction(i))i={};if(y===r){i=this;--r}for(;r<y;r++)if((F=arguments[r])!=null)for(I in F){K=i[I];J=F[I];if(i!==J)if(z&&J&&(b.isPlainObject(J)||(fa=b.isArray(J)))){if(fa){fa=false;clone=K&&b.isArray(K)?K:[]}else clone=
K&&b.isPlainObject(K)?K:{};i[I]=b.extend(z,clone,J)}else if(J!==A)i[I]=J}return i};b.extend({noConflict:function(i){E.$=e;if(i)E.jQuery=d;return b},isReady:false,readyWait:1,ready:function(i){i===true&&b.readyWait--;if(!b.readyWait||i!==true&&!b.isReady){if(!u.body)return setTimeout(b.ready,1);b.isReady=true;if(!(i!==true&&--b.readyWait>0)){if(q){for(var r=0;i=q[r++];)i.call(u,b);q=null}b.fn.triggerHandler&&b(u).triggerHandler("ready")}}},bindReady:function(){if(!p){p=true;if(u.readyState==="complete")return setTimeout(b.ready,
1);if(u.addEventListener){u.addEventListener("DOMContentLoaded",t,false);E.addEventListener("load",b.ready,false)}else if(u.attachEvent){u.attachEvent("onreadystatechange",t);E.attachEvent("onload",b.ready);var i=false;try{i=E.frameElement==null}catch(r){}u.documentElement.doScroll&&i&&a()}}},isFunction:function(i){return b.type(i)==="function"},isArray:Array.isArray||function(i){return b.type(i)==="array"},isWindow:function(i){return i&&typeof i==="object"&&"setInterval"in i},isNaN:function(i){return i==
null||!v.test(i)||isNaN(i)},type:function(i){return i==null?String(i):L[x.call(i)]||"object"},isPlainObject:function(i){if(!i||b.type(i)!=="object"||i.nodeType||b.isWindow(i))return false;if(i.constructor&&!C.call(i,"constructor")&&!C.call(i.constructor.prototype,"isPrototypeOf"))return false;for(var r in i);return r===A||C.call(i,r)},isEmptyObject:function(i){for(var r in i)return false;return true},error:function(i){throw i;},parseJSON:function(i){if(typeof i!=="string"||!i)return null;i=b.trim(i);
if(D.test(i.replace(H,"@").replace(w,"]").replace(G,"")))return E.JSON&&E.JSON.parse?E.JSON.parse(i):(new Function("return "+i))();else b.error("Invalid JSON: "+i)},noop:function(){},globalEval:function(i){if(i&&k.test(i)){var r=u.getElementsByTagName("head")[0]||u.documentElement,y=u.createElement("script");y.type="text/javascript";if(b.support.scriptEval)y.appendChild(u.createTextNode(i));else y.text=i;r.insertBefore(y,r.firstChild);r.removeChild(y)}},nodeName:function(i,r){return i.nodeName&&i.nodeName.toUpperCase()===
r.toUpperCase()},each:function(i,r,y){var z,F=0,I=i.length,K=I===A||b.isFunction(i);if(y)if(K)for(z in i){if(r.apply(i[z],y)===false)break}else for(;F<I;){if(r.apply(i[F++],y)===false)break}else if(K)for(z in i){if(r.call(i[z],z,i[z])===false)break}else for(y=i[0];F<I&&r.call(y,F,y)!==false;y=i[++F]);return i},trim:R?function(i){return i==null?"":R.call(i)}:function(i){return i==null?"":i.toString().replace(l,"").replace(n,"")},makeArray:function(i,r){var y=r||[];if(i!=null){var z=b.type(i);i.length==
null||z==="string"||z==="function"||z==="regexp"||b.isWindow(i)?P.call(y,i):b.merge(y,i)}return y},inArray:function(i,r){if(r.indexOf)return r.indexOf(i);for(var y=0,z=r.length;y<z;y++)if(r[y]===i)return y;return-1},merge:function(i,r){var y=i.length,z=0;if(typeof r.length==="number")for(var F=r.length;z<F;z++)i[y++]=r[z];else for(;r[z]!==A;)i[y++]=r[z++];i.length=y;return i},grep:function(i,r,y){var z=[],F;y=!!y;for(var I=0,K=i.length;I<K;I++){F=!!r(i[I],I);y!==F&&z.push(i[I])}return z},map:function(i,
r,y){for(var z=[],F,I=0,K=i.length;I<K;I++){F=r(i[I],I,y);if(F!=null)z[z.length]=F}return z.concat.apply([],z)},guid:1,proxy:function(i,r,y){if(arguments.length===2)if(typeof r==="string"){y=i;i=y[r];r=A}else if(r&&!b.isFunction(r)){y=r;r=A}if(!r&&i)r=function(){return i.apply(y||this,arguments)};if(i)r.guid=i.guid=i.guid||r.guid||b.guid++;return r},access:function(i,r,y,z,F,I){var K=i.length;if(typeof r==="object"){for(var J in r)b.access(i,J,r[J],z,F,y);return i}if(y!==A){z=!I&&z&&b.isFunction(y);
for(J=0;J<K;J++)F(i[J],r,z?y.call(i[J],J,F(i[J],r)):y,I);return i}return K?F(i[0],r):A},now:function(){return(new Date).getTime()},uaMatch:function(i){i=i.toLowerCase();i=M.exec(i)||g.exec(i)||j.exec(i)||i.indexOf("compatible")<0&&o.exec(i)||[];return{browser:i[1]||"",version:i[2]||"0"}},browser:{}});b.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(i,r){L["[object "+r+"]"]=r.toLowerCase()});m=b.uaMatch(m);if(m.browser){b.browser[m.browser]=true;b.browser.version=
m.version}if(b.browser.webkit)b.browser.safari=true;if(Q)b.inArray=function(i,r){return Q.call(r,i)};if(!/\s/.test("\u00a0")){l=/^[\s\xA0]+/;n=/[\s\xA0]+$/}f=b(u);if(u.addEventListener)t=function(){u.removeEventListener("DOMContentLoaded",t,false);b.ready()};else if(u.attachEvent)t=function(){if(u.readyState==="complete"){u.detachEvent("onreadystatechange",t);b.ready()}};return E.jQuery=E.$=b}();(function(){c.support={};var a=u.documentElement,b=u.createElement("script"),d=u.createElement("div"),
e="script"+c.now();d.style.display="none";d.innerHTML=" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";var f=d.getElementsByTagName("*"),h=d.getElementsByTagName("a")[0],k=u.createElement("select"),l=k.appendChild(u.createElement("option"));if(!(!f||!f.length||!h)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(h.getAttribute("style")),
hrefNormalized:h.getAttribute("href")==="/a",opacity:/^0.55$/.test(h.style.opacity),cssFloat:!!h.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:l.selected,optDisabled:false,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableHiddenOffsets:true};k.disabled=true;c.support.optDisabled=!l.disabled;b.type="text/javascript";try{b.appendChild(u.createTextNode("window."+e+"=1;"))}catch(n){}a.insertBefore(b,
a.firstChild);if(E[e]){c.support.scriptEval=true;delete E[e]}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function s(){c.support.noCloneEvent=false;d.detachEvent("onclick",s)});d.cloneNode(true).fireEvent("onclick")}d=u.createElement("div");d.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";a=u.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var s=u.createElement("div");
s.style.width=s.style.paddingLeft="1px";u.body.appendChild(s);c.boxModel=c.support.boxModel=s.offsetWidth===2;if("zoom"in s.style){s.style.display="inline";s.style.zoom=1;c.support.inlineBlockNeedsLayout=s.offsetWidth===2;s.style.display="";s.innerHTML="<div style='width:4px;'></div>";c.support.shrinkWrapBlocks=s.offsetWidth!==2}s.innerHTML="<table><tr><td style='padding:0;display:none'></td><td>t</td></tr></table>";var v=s.getElementsByTagName("td");c.support.reliableHiddenOffsets=v[0].offsetHeight===
0;v[0].style.display="";v[1].style.display="none";c.support.reliableHiddenOffsets=c.support.reliableHiddenOffsets&&v[0].offsetHeight===0;s.innerHTML="";u.body.removeChild(s).style.display="none"});a=function(s){var v=u.createElement("div");s="on"+s;var B=s in v;if(!B){v.setAttribute(s,"return;");B=typeof v[s]==="function"}return B};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=f=h=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",
cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var pa={},Oa=/^(?:\{.*\}|\[.*\])$/;c.extend({cache:{},uuid:0,expando:"jQuery"+c.now(),noData:{embed:true,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:true},data:function(a,b,d){if(c.acceptData(a)){a=a==E?pa:a;var e=a.nodeType,f=e?a[c.expando]:null,h=c.cache;if(!(e&&!f&&typeof b==="string"&&d===A)){if(e)f||(a[c.expando]=f=++c.uuid);else h=a;if(typeof b==="object")if(e)h[f]=
c.extend(h[f],b);else c.extend(h,b);else if(e&&!h[f])h[f]={};a=e?h[f]:h;if(d!==A)a[b]=d;return typeof b==="string"?a[b]:a}}},removeData:function(a,b){if(c.acceptData(a)){a=a==E?pa:a;var d=a.nodeType,e=d?a[c.expando]:a,f=c.cache,h=d?f[e]:e;if(b){if(h){delete h[b];d&&c.isEmptyObject(h)&&c.removeData(a)}}else if(d&&c.support.deleteExpando)delete a[c.expando];else if(a.removeAttribute)a.removeAttribute(c.expando);else if(d)delete f[e];else for(var k in a)delete a[k]}},acceptData:function(a){if(a.nodeName){var b=
c.noData[a.nodeName.toLowerCase()];if(b)return!(b===true||a.getAttribute("classid")!==b)}return true}});c.fn.extend({data:function(a,b){if(typeof a==="undefined")return this.length?c.data(this[0]):null;else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===A){var e=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(e===A&&this.length){e=c.data(this[0],a);if(e===A&&this[0].nodeType===1){e=this[0].getAttribute("data-"+a);if(typeof e===
"string")try{e=e==="true"?true:e==="false"?false:e==="null"?null:!c.isNaN(e)?parseFloat(e):Oa.test(e)?c.parseJSON(e):e}catch(f){}else e=A}}return e===A&&d[1]?this.data(d[0]):e}else return this.each(function(){var h=c(this),k=[d[0],b];h.triggerHandler("setData"+d[1]+"!",k);c.data(this,a,b);h.triggerHandler("changeData"+d[1]+"!",k)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var e=c.data(a,b);if(!d)return e||
[];if(!e||c.isArray(d))e=c.data(a,b,c.makeArray(d));else e.push(d);return e}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),e=d.shift();if(e==="inprogress")e=d.shift();if(e){b==="fx"&&d.unshift("inprogress");e.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b===A)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,
a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var qa=/[\n\t]/g,ga=/\s+/,Pa=/\r/g,Qa=/^(?:href|src|style)$/,Ra=/^(?:button|input)$/i,Sa=/^(?:button|input|object|select|textarea)$/i,Ta=/^a(?:rea)?$/i,ra=/^(?:radio|checkbox)$/i;c.fn.extend({attr:function(a,b){return c.access(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,
a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(s){var v=c(this);v.addClass(a.call(this,s,v.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ga),d=0,e=this.length;d<e;d++){var f=this[d];if(f.nodeType===1)if(f.className){for(var h=" "+f.className+" ",k=f.className,l=0,n=b.length;l<n;l++)if(h.indexOf(" "+b[l]+" ")<0)k+=" "+b[l];f.className=c.trim(k)}else f.className=a}return this},removeClass:function(a){if(c.isFunction(a))return this.each(function(n){var s=
c(this);s.removeClass(a.call(this,n,s.attr("class")))});if(a&&typeof a==="string"||a===A)for(var b=(a||"").split(ga),d=0,e=this.length;d<e;d++){var f=this[d];if(f.nodeType===1&&f.className)if(a){for(var h=(" "+f.className+" ").replace(qa," "),k=0,l=b.length;k<l;k++)h=h.replace(" "+b[k]+" "," ");f.className=c.trim(h)}else f.className=""}return this},toggleClass:function(a,b){var d=typeof a,e=typeof b==="boolean";if(c.isFunction(a))return this.each(function(f){var h=c(this);h.toggleClass(a.call(this,
f,h.attr("class"),b),b)});return this.each(function(){if(d==="string")for(var f,h=0,k=c(this),l=b,n=a.split(ga);f=n[h++];){l=e?l:!k.hasClass(f);k[l?"addClass":"removeClass"](f)}else if(d==="undefined"||d==="boolean"){this.className&&c.data(this,"__className__",this.className);this.className=this.className||a===false?"":c.data(this,"__className__")||""}})},hasClass:function(a){a=" "+a+" ";for(var b=0,d=this.length;b<d;b++)if((" "+this[b].className+" ").replace(qa," ").indexOf(a)>-1)return true;return false},
val:function(a){if(!arguments.length){var b=this[0];if(b){if(c.nodeName(b,"option")){var d=b.attributes.value;return!d||d.specified?b.value:b.text}if(c.nodeName(b,"select")){var e=b.selectedIndex;d=[];var f=b.options;b=b.type==="select-one";if(e<0)return null;var h=b?e:0;for(e=b?e+1:f.length;h<e;h++){var k=f[h];if(k.selected&&(c.support.optDisabled?!k.disabled:k.getAttribute("disabled")===null)&&(!k.parentNode.disabled||!c.nodeName(k.parentNode,"optgroup"))){a=c(k).val();if(b)return a;d.push(a)}}return d}if(ra.test(b.type)&&
!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Pa,"")}return A}var l=c.isFunction(a);return this.each(function(n){var s=c(this),v=a;if(this.nodeType===1){if(l)v=a.call(this,n,s.val());if(v==null)v="";else if(typeof v==="number")v+="";else if(c.isArray(v))v=c.map(v,function(D){return D==null?"":D+""});if(c.isArray(v)&&ra.test(this.type))this.checked=c.inArray(s.val(),v)>=0;else if(c.nodeName(this,"select")){var B=c.makeArray(v);c("option",this).each(function(){this.selected=
c.inArray(c(this).val(),B)>=0});if(!B.length)this.selectedIndex=-1}else this.value=v}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,e){if(!a||a.nodeType===3||a.nodeType===8)return A;if(e&&b in c.attrFn)return c(a)[b](d);e=a.nodeType!==1||!c.isXMLDoc(a);var f=d!==A;b=e&&c.props[b]||b;if(a.nodeType===1){var h=Qa.test(b);if((b in a||a[b]!==A)&&e&&!h){if(f){b==="type"&&Ra.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");
if(d===null)a.nodeType===1&&a.removeAttribute(b);else a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:Sa.test(a.nodeName)||Ta.test(a.nodeName)&&a.href?0:A;return a[b]}if(!c.support.style&&e&&b==="style"){if(f)a.style.cssText=""+d;return a.style.cssText}f&&a.setAttribute(b,""+d);if(!a.attributes[b]&&a.hasAttribute&&!a.hasAttribute(b))return A;a=!c.support.hrefNormalized&&e&&
h?a.getAttribute(b,2):a.getAttribute(b);return a===null?A:a}}});var X=/\.(.*)$/,ha=/^(?:textarea|input|select)$/i,Ha=/\./g,Ia=/ /g,Ua=/[^\w\s.|`]/g,Va=function(a){return a.replace(Ua,"\\$&")},sa={focusin:0,focusout:0};c.event={add:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(c.isWindow(a)&&a!==E&&!a.frameElement)a=E;if(d===false)d=U;var f,h;if(d.handler){f=d;d=f.handler}if(!d.guid)d.guid=c.guid++;if(h=c.data(a)){var k=a.nodeType?"events":"__events__",l=h[k],n=h.handle;if(typeof l===
"function"){n=l.handle;l=l.events}else if(!l){a.nodeType||(h[k]=h=function(){});h.events=l={}}if(!n)h.handle=n=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(n.elem,arguments):A};n.elem=a;b=b.split(" ");for(var s=0,v;k=b[s++];){h=f?c.extend({},f):{handler:d,data:e};if(k.indexOf(".")>-1){v=k.split(".");k=v.shift();h.namespace=v.slice(0).sort().join(".")}else{v=[];h.namespace=""}h.type=k;if(!h.guid)h.guid=d.guid;var B=l[k],D=c.event.special[k]||{};if(!B){B=l[k]=[];
if(!D.setup||D.setup.call(a,e,v,n)===false)if(a.addEventListener)a.addEventListener(k,n,false);else a.attachEvent&&a.attachEvent("on"+k,n)}if(D.add){D.add.call(a,h);if(!h.handler.guid)h.handler.guid=d.guid}B.push(h);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(d===false)d=U;var f,h,k=0,l,n,s,v,B,D,H=a.nodeType?"events":"__events__",w=c.data(a),G=w&&w[H];if(w&&G){if(typeof G==="function"){w=G;G=G.events}if(b&&b.type){d=b.handler;b=b.type}if(!b||
typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(f in G)c.event.remove(a,f+b)}else{for(b=b.split(" ");f=b[k++];){v=f;l=f.indexOf(".")<0;n=[];if(!l){n=f.split(".");f=n.shift();s=RegExp("(^|\\.)"+c.map(n.slice(0).sort(),Va).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(B=G[f])if(d){v=c.event.special[f]||{};for(h=e||0;h<B.length;h++){D=B[h];if(d.guid===D.guid){if(l||s.test(D.namespace)){e==null&&B.splice(h--,1);v.remove&&v.remove.call(a,D)}if(e!=null)break}}if(B.length===0||e!=null&&B.length===1){if(!v.teardown||
v.teardown.call(a,n)===false)c.removeEvent(a,f,w.handle);delete G[f]}}else for(h=0;h<B.length;h++){D=B[h];if(l||s.test(D.namespace)){c.event.remove(a,v,D.handler,h);B.splice(h--,1)}}}if(c.isEmptyObject(G)){if(b=w.handle)b.elem=null;delete w.events;delete w.handle;if(typeof w==="function")c.removeData(a,H);else c.isEmptyObject(w)&&c.removeData(a)}}}}},trigger:function(a,b,d,e){var f=a.type||a;if(!e){a=typeof a==="object"?a[c.expando]?a:c.extend(c.Event(f),a):c.Event(f);if(f.indexOf("!")>=0){a.type=
f=f.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[f]&&c.each(c.cache,function(){this.events&&this.events[f]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return A;a.result=A;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(e=d.nodeType?c.data(d,"handle"):(c.data(d,"__events__")||{}).handle)&&e.apply(d,b);e=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+f]&&d["on"+f].apply(d,b)===
false){a.result=false;a.preventDefault()}}catch(h){}if(!a.isPropagationStopped()&&e)c.event.trigger(a,b,e,true);else if(!a.isDefaultPrevented()){e=a.target;var k,l=f.replace(X,""),n=c.nodeName(e,"a")&&l==="click",s=c.event.special[l]||{};if((!s._default||s._default.call(d,a)===false)&&!n&&!(e&&e.nodeName&&c.noData[e.nodeName.toLowerCase()])){try{if(e[l]){if(k=e["on"+l])e["on"+l]=null;c.event.triggered=true;e[l]()}}catch(v){}if(k)e["on"+l]=k;c.event.triggered=false}}},handle:function(a){var b,d,e;
d=[];var f,h=c.makeArray(arguments);a=h[0]=c.event.fix(a||E.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;if(!b){e=a.type.split(".");a.type=e.shift();d=e.slice(0).sort();e=RegExp("(^|\\.)"+d.join("\\.(?:.*\\.)?")+"(\\.|$)")}a.namespace=a.namespace||d.join(".");f=c.data(this,this.nodeType?"events":"__events__");if(typeof f==="function")f=f.events;d=(f||{})[a.type];if(f&&d){d=d.slice(0);f=0;for(var k=d.length;f<k;f++){var l=d[f];if(b||e.test(l.namespace)){a.handler=l.handler;a.data=
l.data;a.handleObj=l;l=l.handler.apply(this,h);if(l!==A){a.result=l;if(l===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}}return a.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
fix:function(a){if(a[c.expando])return a;var b=a;a=c.Event(b);for(var d=this.props.length,e;d;){e=this.props[--d];a[e]=b[e]}if(!a.target)a.target=a.srcElement||u;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=u.documentElement;d=u.body;a.pageX=a.clientX+(b&&b.scrollLeft||d&&d.scrollLeft||0)-(b&&b.clientLeft||d&&d.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop||
d&&d.scrollTop||0)-(b&&b.clientTop||d&&d.clientTop||0)}if(a.which==null&&(a.charCode!=null||a.keyCode!=null))a.which=a.charCode!=null?a.charCode:a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==A)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:c.proxy,special:{ready:{setup:c.bindReady,teardown:c.noop},live:{add:function(a){c.event.add(this,Y(a.origType,a.selector),c.extend({},a,{handler:Ga,guid:a.handler.guid}))},remove:function(a){c.event.remove(this,
Y(a.origType,a.selector),a)}},beforeunload:{setup:function(a,b,d){if(c.isWindow(this))this.onbeforeunload=d},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};c.removeEvent=u.removeEventListener?function(a,b,d){a.removeEventListener&&a.removeEventListener(b,d,false)}:function(a,b,d){a.detachEvent&&a.detachEvent("on"+b,d)};c.Event=function(a){if(!this.preventDefault)return new c.Event(a);if(a&&a.type){this.originalEvent=a;this.type=a.type}else this.type=a;this.timeStamp=
c.now();this[c.expando]=true};c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=ba;var a=this.originalEvent;if(a)if(a.preventDefault)a.preventDefault();else a.returnValue=false},stopPropagation:function(){this.isPropagationStopped=ba;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=ba;this.stopPropagation()},isDefaultPrevented:U,isPropagationStopped:U,isImmediatePropagationStopped:U};
var ta=function(a){var b=a.relatedTarget;try{for(;b&&b!==this;)b=b.parentNode;if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}}catch(d){}},ua=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(d){c.event.add(this,b,d&&d.selector?ua:ta,a)},teardown:function(d){c.event.remove(this,b,d&&d.selector?ua:ta)}}});if(!c.support.submitBubbles)c.event.special.submit={setup:function(){if(this.nodeName.toLowerCase()!==
"form"){c.event.add(this,"click.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="submit"||d==="image")&&c(b).closest("form").length){a.liveFired=A;return ja("submit",this,arguments)}});c.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="text"||d==="password")&&c(b).closest("form").length&&a.keyCode===13){a.liveFired=A;return ja("submit",this,arguments)}})}else return false},teardown:function(){c.event.remove(this,".specialSubmit")}};if(!c.support.changeBubbles){var V,
va=function(a){var b=a.type,d=a.value;if(b==="radio"||b==="checkbox")d=a.checked;else if(b==="select-multiple")d=a.selectedIndex>-1?c.map(a.options,function(e){return e.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},Z=function(a,b){var d=a.target,e,f;if(!(!ha.test(d.nodeName)||d.readOnly)){e=c.data(d,"_change_data");f=va(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",f);if(!(e===A||f===e))if(e!=null||f){a.type="change";a.liveFired=
A;return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:Z,beforedeactivate:Z,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return Z.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return Z.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a,"_change_data",va(a))}},setup:function(){if(this.type===
"file")return false;for(var a in V)c.event.add(this,a+".specialChange",V[a]);return ha.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return ha.test(this.nodeName)}};V=c.event.special.change.filters;V.focus=V.beforeactivate}u.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(e){e=c.event.fix(e);e.type=b;return c.event.trigger(e,null,e.target)}c.event.special[b]={setup:function(){sa[b]++===0&&u.addEventListener(a,d,true)},teardown:function(){--sa[b]===
0&&u.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,e,f){if(typeof d==="object"){for(var h in d)this[b](h,e,d[h],f);return this}if(c.isFunction(e)||e===false){f=e;e=A}var k=b==="one"?c.proxy(f,function(n){c(this).unbind(n,k);return f.apply(this,arguments)}):f;if(d==="unload"&&b!=="one")this.one(d,e,f);else{h=0;for(var l=this.length;h<l;h++)c.event.add(this[h],d,k,e)}return this}});c.fn.extend({unbind:function(a,b){if(typeof a==="object"&&!a.preventDefault)for(var d in a)this.unbind(d,
a[d]);else{d=0;for(var e=this.length;d<e;d++)c.event.remove(this[d],a,b)}return this},delegate:function(a,b,d,e){return this.live(b,d,e,a)},undelegate:function(a,b,d){return arguments.length===0?this.unbind("live"):this.die(b,null,d,a)},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){var d=c.Event(a);d.preventDefault();d.stopPropagation();c.event.trigger(d,b,this[0]);return d.result}},toggle:function(a){for(var b=arguments,d=
1;d<b.length;)c.proxy(a,b[d++]);return this.click(c.proxy(a,function(e){var f=(c.data(this,"lastToggle"+a.guid)||0)%d;c.data(this,"lastToggle"+a.guid,f+1);e.preventDefault();return b[f].apply(this,arguments)||false}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var wa={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};c.each(["live","die"],function(a,b){c.fn[b]=function(d,e,f,h){var k,l=0,n,s,v=h||this.selector;h=h?this:c(this.context);if(typeof d===
"object"&&!d.preventDefault){for(k in d)h[b](k,e,d[k],v);return this}if(c.isFunction(e)){f=e;e=A}for(d=(d||"").split(" ");(k=d[l++])!=null;){n=X.exec(k);s="";if(n){s=n[0];k=k.replace(X,"")}if(k==="hover")d.push("mouseenter"+s,"mouseleave"+s);else{n=k;if(k==="focus"||k==="blur"){d.push(wa[k]+s);k+=s}else k=(wa[k]||k)+s;if(b==="live"){s=0;for(var B=h.length;s<B;s++)c.event.add(h[s],"live."+Y(k,v),{data:e,selector:v,handler:f,origType:k,origHandler:f,preType:n})}else h.unbind("live."+Y(k,v),f)}}return this}});
c.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){c.fn[b]=function(d,e){if(e==null){e=d;d=null}return arguments.length>0?this.bind(b,d,e):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});E.attachEvent&&!E.addEventListener&&c(E).bind("unload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}});
(function(){function a(g,j,o,m,p,q){p=0;for(var t=m.length;p<t;p++){var x=m[p];if(x){x=x[g];for(var C=false;x;){if(x.sizcache===o){C=m[x.sizset];break}if(x.nodeType===1&&!q){x.sizcache=o;x.sizset=p}if(x.nodeName.toLowerCase()===j){C=x;break}x=x[g]}m[p]=C}}}function b(g,j,o,m,p,q){p=0;for(var t=m.length;p<t;p++){var x=m[p];if(x){x=x[g];for(var C=false;x;){if(x.sizcache===o){C=m[x.sizset];break}if(x.nodeType===1){if(!q){x.sizcache=o;x.sizset=p}if(typeof j!=="string"){if(x===j){C=true;break}}else if(l.filter(j,
[x]).length>0){C=x;break}}x=x[g]}m[p]=C}}}var d=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,f=Object.prototype.toString,h=false,k=true;[0,0].sort(function(){k=false;return 0});var l=function(g,j,o,m){o=o||[];var p=j=j||u;if(j.nodeType!==1&&j.nodeType!==9)return[];if(!g||typeof g!=="string")return o;var q=[],t,x,C,P,N=true,R=l.isXML(j),Q=g,L;do{d.exec("");if(t=d.exec(Q)){Q=t[3];q.push(t[1]);if(t[2]){P=t[3];
break}}}while(t);if(q.length>1&&s.exec(g))if(q.length===2&&n.relative[q[0]])x=M(q[0]+q[1],j);else for(x=n.relative[q[0]]?[j]:l(q.shift(),j);q.length;){g=q.shift();if(n.relative[g])g+=q.shift();x=M(g,x)}else{if(!m&&q.length>1&&j.nodeType===9&&!R&&n.match.ID.test(q[0])&&!n.match.ID.test(q[q.length-1])){t=l.find(q.shift(),j,R);j=t.expr?l.filter(t.expr,t.set)[0]:t.set[0]}if(j){t=m?{expr:q.pop(),set:D(m)}:l.find(q.pop(),q.length===1&&(q[0]==="~"||q[0]==="+")&&j.parentNode?j.parentNode:j,R);x=t.expr?l.filter(t.expr,
t.set):t.set;if(q.length>0)C=D(x);else N=false;for(;q.length;){t=L=q.pop();if(n.relative[L])t=q.pop();else L="";if(t==null)t=j;n.relative[L](C,t,R)}}else C=[]}C||(C=x);C||l.error(L||g);if(f.call(C)==="[object Array]")if(N)if(j&&j.nodeType===1)for(g=0;C[g]!=null;g++){if(C[g]&&(C[g]===true||C[g].nodeType===1&&l.contains(j,C[g])))o.push(x[g])}else for(g=0;C[g]!=null;g++)C[g]&&C[g].nodeType===1&&o.push(x[g]);else o.push.apply(o,C);else D(C,o);if(P){l(P,p,o,m);l.uniqueSort(o)}return o};l.uniqueSort=function(g){if(w){h=
k;g.sort(w);if(h)for(var j=1;j<g.length;j++)g[j]===g[j-1]&&g.splice(j--,1)}return g};l.matches=function(g,j){return l(g,null,null,j)};l.matchesSelector=function(g,j){return l(j,null,null,[g]).length>0};l.find=function(g,j,o){var m;if(!g)return[];for(var p=0,q=n.order.length;p<q;p++){var t=n.order[p],x;if(x=n.leftMatch[t].exec(g)){var C=x[1];x.splice(1,1);if(C.substr(C.length-1)!=="\\"){x[1]=(x[1]||"").replace(/\\/g,"");m=n.find[t](x,j,o);if(m!=null){g=g.replace(n.match[t],"");break}}}}m||(m=j.getElementsByTagName("*"));
return{set:m,expr:g}};l.filter=function(g,j,o,m){for(var p=g,q=[],t=j,x,C,P=j&&j[0]&&l.isXML(j[0]);g&&j.length;){for(var N in n.filter)if((x=n.leftMatch[N].exec(g))!=null&&x[2]){var R=n.filter[N],Q,L;L=x[1];C=false;x.splice(1,1);if(L.substr(L.length-1)!=="\\"){if(t===q)q=[];if(n.preFilter[N])if(x=n.preFilter[N](x,t,o,q,m,P)){if(x===true)continue}else C=Q=true;if(x)for(var i=0;(L=t[i])!=null;i++)if(L){Q=R(L,x,i,t);var r=m^!!Q;if(o&&Q!=null)if(r)C=true;else t[i]=false;else if(r){q.push(L);C=true}}if(Q!==
A){o||(t=q);g=g.replace(n.match[N],"");if(!C)return[];break}}}if(g===p)if(C==null)l.error(g);else break;p=g}return t};l.error=function(g){throw"Syntax error, unrecognized expression: "+g;};var n=l.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+\-]*)\))?/,
POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(g){return g.getAttribute("href")}},relative:{"+":function(g,j){var o=typeof j==="string",m=o&&!/\W/.test(j);o=o&&!m;if(m)j=j.toLowerCase();m=0;for(var p=g.length,q;m<p;m++)if(q=g[m]){for(;(q=q.previousSibling)&&q.nodeType!==1;);g[m]=o||q&&q.nodeName.toLowerCase()===
j?q||false:q===j}o&&l.filter(j,g,true)},">":function(g,j){var o=typeof j==="string",m,p=0,q=g.length;if(o&&!/\W/.test(j))for(j=j.toLowerCase();p<q;p++){if(m=g[p]){o=m.parentNode;g[p]=o.nodeName.toLowerCase()===j?o:false}}else{for(;p<q;p++)if(m=g[p])g[p]=o?m.parentNode:m.parentNode===j;o&&l.filter(j,g,true)}},"":function(g,j,o){var m=e++,p=b,q;if(typeof j==="string"&&!/\W/.test(j)){q=j=j.toLowerCase();p=a}p("parentNode",j,m,g,q,o)},"~":function(g,j,o){var m=e++,p=b,q;if(typeof j==="string"&&!/\W/.test(j)){q=
j=j.toLowerCase();p=a}p("previousSibling",j,m,g,q,o)}},find:{ID:function(g,j,o){if(typeof j.getElementById!=="undefined"&&!o)return(g=j.getElementById(g[1]))&&g.parentNode?[g]:[]},NAME:function(g,j){if(typeof j.getElementsByName!=="undefined"){for(var o=[],m=j.getElementsByName(g[1]),p=0,q=m.length;p<q;p++)m[p].getAttribute("name")===g[1]&&o.push(m[p]);return o.length===0?null:o}},TAG:function(g,j){return j.getElementsByTagName(g[1])}},preFilter:{CLASS:function(g,j,o,m,p,q){g=" "+g[1].replace(/\\/g,
"")+" ";if(q)return g;q=0;for(var t;(t=j[q])!=null;q++)if(t)if(p^(t.className&&(" "+t.className+" ").replace(/[\t\n]/g," ").indexOf(g)>=0))o||m.push(t);else if(o)j[q]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},CHILD:function(g){if(g[1]==="nth"){var j=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=j[1]+(j[2]||1)-0;g[3]=j[3]-0}g[0]=e++;return g},ATTR:function(g,j,o,
m,p,q){j=g[1].replace(/\\/g,"");if(!q&&n.attrMap[j])g[1]=n.attrMap[j];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,j,o,m,p){if(g[1]==="not")if((d.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=l(g[3],null,null,j);else{g=l.filter(g[3],j,o,true^p);o||m.push.apply(m,g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===
true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,j,o){return!!l(o[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===
g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},setFilters:{first:function(g,j){return j===0},last:function(g,j,o,m){return j===m.length-1},even:function(g,j){return j%2===0},odd:function(g,j){return j%2===1},lt:function(g,j,o){return j<o[3]-0},gt:function(g,j,o){return j>o[3]-0},nth:function(g,j,o){return o[3]-
0===j},eq:function(g,j,o){return o[3]-0===j}},filter:{PSEUDO:function(g,j,o,m){var p=j[1],q=n.filters[p];if(q)return q(g,o,j,m);else if(p==="contains")return(g.textContent||g.innerText||l.getText([g])||"").indexOf(j[3])>=0;else if(p==="not"){j=j[3];o=0;for(m=j.length;o<m;o++)if(j[o]===g)return false;return true}else l.error("Syntax error, unrecognized expression: "+p)},CHILD:function(g,j){var o=j[1],m=g;switch(o){case "only":case "first":for(;m=m.previousSibling;)if(m.nodeType===1)return false;if(o===
"first")return true;m=g;case "last":for(;m=m.nextSibling;)if(m.nodeType===1)return false;return true;case "nth":o=j[2];var p=j[3];if(o===1&&p===0)return true;var q=j[0],t=g.parentNode;if(t&&(t.sizcache!==q||!g.nodeIndex)){var x=0;for(m=t.firstChild;m;m=m.nextSibling)if(m.nodeType===1)m.nodeIndex=++x;t.sizcache=q}m=g.nodeIndex-p;return o===0?m===0:m%o===0&&m/o>=0}},ID:function(g,j){return g.nodeType===1&&g.getAttribute("id")===j},TAG:function(g,j){return j==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===
j},CLASS:function(g,j){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(j)>-1},ATTR:function(g,j){var o=j[1];o=n.attrHandle[o]?n.attrHandle[o](g):g[o]!=null?g[o]:g.getAttribute(o);var m=o+"",p=j[2],q=j[4];return o==null?p==="!=":p==="="?m===q:p==="*="?m.indexOf(q)>=0:p==="~="?(" "+m+" ").indexOf(q)>=0:!q?m&&o!==false:p==="!="?m!==q:p==="^="?m.indexOf(q)===0:p==="$="?m.substr(m.length-q.length)===q:p==="|="?m===q||m.substr(0,q.length+1)===q+"-":false},POS:function(g,j,o,m){var p=n.setFilters[j[2]];
if(p)return p(g,o,j,m)}}},s=n.match.POS,v=function(g,j){return"\\"+(j-0+1)},B;for(B in n.match){n.match[B]=RegExp(n.match[B].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[B]=RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[B].source.replace(/\\(\d+)/g,v))}var D=function(g,j){g=Array.prototype.slice.call(g,0);if(j){j.push.apply(j,g);return j}return g};try{Array.prototype.slice.call(u.documentElement.childNodes,0)}catch(H){D=function(g,j){var o=j||[],m=0;if(f.call(g)==="[object Array]")Array.prototype.push.apply(o,
g);else if(typeof g.length==="number")for(var p=g.length;m<p;m++)o.push(g[m]);else for(;g[m];m++)o.push(g[m]);return o}}var w,G;if(u.documentElement.compareDocumentPosition)w=function(g,j){if(g===j){h=true;return 0}if(!g.compareDocumentPosition||!j.compareDocumentPosition)return g.compareDocumentPosition?-1:1;return g.compareDocumentPosition(j)&4?-1:1};else{w=function(g,j){var o=[],m=[],p=g.parentNode,q=j.parentNode,t=p;if(g===j){h=true;return 0}else if(p===q)return G(g,j);else if(p){if(!q)return 1}else return-1;
for(;t;){o.unshift(t);t=t.parentNode}for(t=q;t;){m.unshift(t);t=t.parentNode}p=o.length;q=m.length;for(t=0;t<p&&t<q;t++)if(o[t]!==m[t])return G(o[t],m[t]);return t===p?G(g,m[t],-1):G(o[t],j,1)};G=function(g,j,o){if(g===j)return o;for(g=g.nextSibling;g;){if(g===j)return-1;g=g.nextSibling}return 1}}l.getText=function(g){for(var j="",o,m=0;g[m];m++){o=g[m];if(o.nodeType===3||o.nodeType===4)j+=o.nodeValue;else if(o.nodeType!==8)j+=l.getText(o.childNodes)}return j};(function(){var g=u.createElement("div"),
j="script"+(new Date).getTime();g.innerHTML="<a name='"+j+"'/>";var o=u.documentElement;o.insertBefore(g,o.firstChild);if(u.getElementById(j)){n.find.ID=function(m,p,q){if(typeof p.getElementById!=="undefined"&&!q)return(p=p.getElementById(m[1]))?p.id===m[1]||typeof p.getAttributeNode!=="undefined"&&p.getAttributeNode("id").nodeValue===m[1]?[p]:A:[]};n.filter.ID=function(m,p){var q=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&q&&q.nodeValue===p}}o.removeChild(g);
o=g=null})();(function(){var g=u.createElement("div");g.appendChild(u.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(j,o){var m=o.getElementsByTagName(j[1]);if(j[1]==="*"){for(var p=[],q=0;m[q];q++)m[q].nodeType===1&&p.push(m[q]);m=p}return m};g.innerHTML="<a href='#'></a>";if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(j){return j.getAttribute("href",2)};g=null})();u.querySelectorAll&&
function(){var g=l,j=u.createElement("div");j.innerHTML="<p class='TEST'></p>";if(!(j.querySelectorAll&&j.querySelectorAll(".TEST").length===0)){l=function(m,p,q,t){p=p||u;if(!t&&!l.isXML(p))if(p.nodeType===9)try{return D(p.querySelectorAll(m),q)}catch(x){}else if(p.nodeType===1&&p.nodeName.toLowerCase()!=="object"){var C=p.id,P=p.id="__sizzle__";try{return D(p.querySelectorAll("#"+P+" "+m),q)}catch(N){}finally{if(C)p.id=C;else p.removeAttribute("id")}}return g(m,p,q,t)};for(var o in g)l[o]=g[o];
j=null}}();(function(){var g=u.documentElement,j=g.matchesSelector||g.mozMatchesSelector||g.webkitMatchesSelector||g.msMatchesSelector,o=false;try{j.call(u.documentElement,":sizzle")}catch(m){o=true}if(j)l.matchesSelector=function(p,q){try{if(o||!n.match.PSEUDO.test(q))return j.call(p,q)}catch(t){}return l(q,null,null,[p]).length>0}})();(function(){var g=u.createElement("div");g.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===
0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(j,o,m){if(typeof o.getElementsByClassName!=="undefined"&&!m)return o.getElementsByClassName(j[1])};g=null}}})();l.contains=u.documentElement.contains?function(g,j){return g!==j&&(g.contains?g.contains(j):true)}:function(g,j){return!!(g.compareDocumentPosition(j)&16)};l.isXML=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false};var M=function(g,
j){for(var o=[],m="",p,q=j.nodeType?[j]:j;p=n.match.PSEUDO.exec(g);){m+=p[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;p=0;for(var t=q.length;p<t;p++)l(g,q[p],o);return l.filter(m,o)};c.find=l;c.expr=l.selectors;c.expr[":"]=c.expr.filters;c.unique=l.uniqueSort;c.text=l.getText;c.isXMLDoc=l.isXML;c.contains=l.contains})();var Wa=/Until$/,Xa=/^(?:parents|prevUntil|prevAll)/,Ya=/,/,Ja=/^.[^:#\[\.,]*$/,Za=Array.prototype.slice,$a=c.expr.match.POS;c.fn.extend({find:function(a){for(var b=this.pushStack("",
"find",a),d=0,e=0,f=this.length;e<f;e++){d=b.length;c.find(a,this[e],b);if(e>0)for(var h=d;h<b.length;h++)for(var k=0;k<d;k++)if(b[k]===b[h]){b.splice(h--,1);break}}return b},has:function(a){var b=c(a);return this.filter(function(){for(var d=0,e=b.length;d<e;d++)if(c.contains(this,b[d]))return true})},not:function(a){return this.pushStack(ka(this,a,false),"not",a)},filter:function(a){return this.pushStack(ka(this,a,true),"filter",a)},is:function(a){return!!a&&c.filter(a,this).length>0},closest:function(a,
b){var d=[],e,f,h=this[0];if(c.isArray(a)){var k={},l,n=1;if(h&&a.length){e=0;for(f=a.length;e<f;e++){l=a[e];k[l]||(k[l]=c.expr.match.POS.test(l)?c(l,b||this.context):l)}for(;h&&h.ownerDocument&&h!==b;){for(l in k){e=k[l];if(e.jquery?e.index(h)>-1:c(h).is(e))d.push({selector:l,elem:h,level:n})}h=h.parentNode;n++}}return d}k=$a.test(a)?c(a,b||this.context):null;e=0;for(f=this.length;e<f;e++)for(h=this[e];h;)if(k?k.index(h)>-1:c.find.matchesSelector(h,a)){d.push(h);break}else{h=h.parentNode;if(!h||
!h.ownerDocument||h===b)break}d=d.length>1?c.unique(d):d;return this.pushStack(d,"closest",a)},index:function(a){if(!a||typeof a==="string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var d=typeof a==="string"?c(a,b||this.context):c.makeArray(a),e=c.merge(this.get(),d);return this.pushStack(!d[0]||!d[0].parentNode||d[0].parentNode.nodeType===11||!e[0]||!e[0].parentNode||e[0].parentNode.nodeType===11?e:c.unique(e))},andSelf:function(){return this.add(this.prevObject)}});
c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",
d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,e){var f=c.map(this,b,d);Wa.test(a)||(e=d);if(e&&typeof e==="string")f=c.filter(e,f);f=this.length>1?c.unique(f):f;if((this.length>1||Ya.test(e))&&Xa.test(a))f=f.reverse();return this.pushStack(f,a,Za.call(arguments).join(","))}});
c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return b.length===1?c.find.matchesSelector(b[0],a)?[b[0]]:[]:c.find.matches(a,b)},dir:function(a,b,d){var e=[];for(a=a[b];a&&a.nodeType!==9&&(d===A||a.nodeType!==1||!c(a).is(d));){a.nodeType===1&&e.push(a);a=a[b]}return e},nth:function(a,b,d){b=b||1;for(var e=0;a;a=a[d])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var xa=/ jQuery\d+="(?:\d+|null)"/g,
$=/^\s+/,ya=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,za=/<([\w:]+)/,ab=/<tbody/i,bb=/<|&#?\w+;/,Aa=/<(?:script|object|embed|option|style)/i,Ba=/checked\s*(?:[^=]|=\s*.checked.)/i,cb=/\=([^="'>\s]+\/)>/g,O={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,"",""]};O.optgroup=O.option;O.tbody=O.tfoot=O.colgroup=O.caption=O.thead;O.th=O.td;if(!c.support.htmlSerialize)O._default=[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==A)return this.empty().append((this[0]&&this[0].ownerDocument||u).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,
d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this},wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},
unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=
c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,e;(e=this[d])!=null;d++)if(!a||c.filter(a,[e]).length){if(!b&&e.nodeType===1){c.cleanData(e.getElementsByTagName("*"));
c.cleanData([e])}e.parentNode&&e.parentNode.removeChild(e)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild);return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,e=this.ownerDocument;if(!d){d=e.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(xa,"").replace(cb,'="$1">').replace($,
"")],e)[0]}else return this.cloneNode(true)});if(a===true){la(this,b);la(this.find("*"),b.find("*"))}return b},html:function(a){if(a===A)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(xa,""):null;else if(typeof a==="string"&&!Aa.test(a)&&(c.support.leadingWhitespace||!$.test(a))&&!O[(za.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(ya,"<$1></$2>");try{for(var b=0,d=this.length;b<d;b++)if(this[b].nodeType===1){c.cleanData(this[b].getElementsByTagName("*"));this[b].innerHTML=a}}catch(e){this.empty().append(a)}}else c.isFunction(a)?
this.each(function(f){var h=c(this);h.html(a.call(this,f,h.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(c.isFunction(a))return this.each(function(b){var d=c(this),e=d.html();d.replaceWith(a.call(this,b,e))});if(typeof a!=="string")a=c(a).detach();return this.each(function(){var b=this.nextSibling,d=this.parentNode;c(this).remove();b?c(b).before(a):c(d).append(a)})}else return this.pushStack(c(c.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,
true)},domManip:function(a,b,d){var e,f,h=a[0],k=[],l;if(!c.support.checkClone&&arguments.length===3&&typeof h==="string"&&Ba.test(h))return this.each(function(){c(this).domManip(a,b,d,true)});if(c.isFunction(h))return this.each(function(s){var v=c(this);a[0]=h.call(this,s,b?v.html():A);v.domManip(a,b,d)});if(this[0]){e=h&&h.parentNode;e=c.support.parentNode&&e&&e.nodeType===11&&e.childNodes.length===this.length?{fragment:e}:c.buildFragment(a,this,k);l=e.fragment;if(f=l.childNodes.length===1?l=l.firstChild:
l.firstChild){b=b&&c.nodeName(f,"tr");f=0;for(var n=this.length;f<n;f++)d.call(b?c.nodeName(this[f],"table")?this[f].getElementsByTagName("tbody")[0]||this[f].appendChild(this[f].ownerDocument.createElement("tbody")):this[f]:this[f],f>0||e.cacheable||this.length>1?l.cloneNode(true):l)}k.length&&c.each(k,Ka)}return this}});c.buildFragment=function(a,b,d){var e,f,h;b=b&&b[0]?b[0].ownerDocument||b[0]:u;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===u&&!Aa.test(a[0])&&(c.support.checkClone||
!Ba.test(a[0]))){f=true;if(h=c.fragments[a[0]])if(h!==1)e=h}if(!e){e=b.createDocumentFragment();c.clean(a,b,e,d)}if(f)c.fragments[a[0]]=h?e:1;return{fragment:e,cacheable:f}};c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var e=[];d=c(d);var f=this.length===1&&this[0].parentNode;if(f&&f.nodeType===11&&f.childNodes.length===1&&d.length===1){d[b](this[0]);return this}else{f=0;for(var h=
d.length;f<h;f++){var k=(f>0?this.clone(true):this).get();c(d[f])[b](k);e=e.concat(k)}return this.pushStack(e,a,d.selector)}}});c.extend({clean:function(a,b,d,e){b=b||u;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||u;for(var f=[],h=0,k;(k=a[h])!=null;h++){if(typeof k==="number")k+="";if(k){if(typeof k==="string"&&!bb.test(k))k=b.createTextNode(k);else if(typeof k==="string"){k=k.replace(ya,"<$1></$2>");var l=(za.exec(k)||["",""])[1].toLowerCase(),n=O[l]||O._default,
s=n[0],v=b.createElement("div");for(v.innerHTML=n[1]+k+n[2];s--;)v=v.lastChild;if(!c.support.tbody){s=ab.test(k);l=l==="table"&&!s?v.firstChild&&v.firstChild.childNodes:n[1]==="<table>"&&!s?v.childNodes:[];for(n=l.length-1;n>=0;--n)c.nodeName(l[n],"tbody")&&!l[n].childNodes.length&&l[n].parentNode.removeChild(l[n])}!c.support.leadingWhitespace&&$.test(k)&&v.insertBefore(b.createTextNode($.exec(k)[0]),v.firstChild);k=v.childNodes}if(k.nodeType)f.push(k);else f=c.merge(f,k)}}if(d)for(h=0;f[h];h++)if(e&&
c.nodeName(f[h],"script")&&(!f[h].type||f[h].type.toLowerCase()==="text/javascript"))e.push(f[h].parentNode?f[h].parentNode.removeChild(f[h]):f[h]);else{f[h].nodeType===1&&f.splice.apply(f,[h+1,0].concat(c.makeArray(f[h].getElementsByTagName("script"))));d.appendChild(f[h])}return f},cleanData:function(a){for(var b,d,e=c.cache,f=c.event.special,h=c.support.deleteExpando,k=0,l;(l=a[k])!=null;k++)if(!(l.nodeName&&c.noData[l.nodeName.toLowerCase()]))if(d=l[c.expando]){if((b=e[d])&&b.events)for(var n in b.events)f[n]?
c.event.remove(l,n):c.removeEvent(l,n,b.handle);if(h)delete l[c.expando];else l.removeAttribute&&l.removeAttribute(c.expando);delete e[d]}}});var Ca=/alpha\([^)]*\)/i,db=/opacity=([^)]*)/,eb=/-([a-z])/ig,fb=/([A-Z])/g,Da=/^-?\d+(?:px)?$/i,gb=/^-?\d/,hb={position:"absolute",visibility:"hidden",display:"block"},La=["Left","Right"],Ma=["Top","Bottom"],W,ib=u.defaultView&&u.defaultView.getComputedStyle,jb=function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){if(arguments.length===2&&b===A)return this;
return c.access(this,a,b,true,function(d,e,f){return f!==A?c.style(d,e,f):c.css(d,e)})};c.extend({cssHooks:{opacity:{get:function(a,b){if(b){var d=W(a,"opacity","opacity");return d===""?"1":d}else return a.style.opacity}}},cssNumber:{zIndex:true,fontWeight:true,opacity:true,zoom:true,lineHeight:true},cssProps:{"float":c.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,d,e){if(!(!a||a.nodeType===3||a.nodeType===8||!a.style)){var f,h=c.camelCase(b),k=a.style,l=c.cssHooks[h];b=c.cssProps[h]||
h;if(d!==A){if(!(typeof d==="number"&&isNaN(d)||d==null)){if(typeof d==="number"&&!c.cssNumber[h])d+="px";if(!l||!("set"in l)||(d=l.set(a,d))!==A)try{k[b]=d}catch(n){}}}else{if(l&&"get"in l&&(f=l.get(a,false,e))!==A)return f;return k[b]}}},css:function(a,b,d){var e,f=c.camelCase(b),h=c.cssHooks[f];b=c.cssProps[f]||f;if(h&&"get"in h&&(e=h.get(a,true,d))!==A)return e;else if(W)return W(a,b,f)},swap:function(a,b,d){var e={},f;for(f in b){e[f]=a.style[f];a.style[f]=b[f]}d.call(a);for(f in b)a.style[f]=
e[f]},camelCase:function(a){return a.replace(eb,jb)}});c.curCSS=c.css;c.each(["height","width"],function(a,b){c.cssHooks[b]={get:function(d,e,f){var h;if(e){if(d.offsetWidth!==0)h=ma(d,b,f);else c.swap(d,hb,function(){h=ma(d,b,f)});return h+"px"}},set:function(d,e){if(Da.test(e)){e=parseFloat(e);if(e>=0)return e+"px"}else return e}}});if(!c.support.opacity)c.cssHooks.opacity={get:function(a,b){return db.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":
b?"1":""},set:function(a,b){var d=a.style;d.zoom=1;var e=c.isNaN(b)?"":"alpha(opacity="+b*100+")",f=d.filter||"";d.filter=Ca.test(f)?f.replace(Ca,e):d.filter+" "+e}};if(ib)W=function(a,b,d){var e;d=d.replace(fb,"-$1").toLowerCase();if(!(b=a.ownerDocument.defaultView))return A;if(b=b.getComputedStyle(a,null)){e=b.getPropertyValue(d);if(e===""&&!c.contains(a.ownerDocument.documentElement,a))e=c.style(a,d)}return e};else if(u.documentElement.currentStyle)W=function(a,b){var d,e,f=a.currentStyle&&a.currentStyle[b],
h=a.style;if(!Da.test(f)&&gb.test(f)){d=h.left;e=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;h.left=b==="fontSize"?"1em":f||0;f=h.pixelLeft+"px";h.left=d;a.runtimeStyle.left=e}return f};if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=a.offsetHeight;return a.offsetWidth===0&&b===0||!c.support.reliableHiddenOffsets&&(a.style.display||c.css(a,"display"))==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var kb=c.now(),lb=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
mb=/^(?:select|textarea)/i,nb=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,ob=/^(?:GET|HEAD|DELETE)$/,Na=/\[\]$/,T=/\=\?(&|$)/,ia=/\?/,pb=/([?&])_=[^&]*/,qb=/^(\w+:)?\/\/([^\/?#]+)/,rb=/%20/g,sb=/#.*$/,Ea=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!=="string"&&Ea)return Ea.apply(this,arguments);else if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var f=a.slice(e,a.length);a=a.slice(0,e)}e="GET";if(b)if(c.isFunction(b)){d=
b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);e="POST"}var h=this;c.ajax({url:a,type:e,dataType:"html",data:b,complete:function(k,l){if(l==="success"||l==="notmodified")h.html(f?c("<div>").append(k.responseText.replace(lb,"")).find(f):k.responseText);d&&h.each(d,[k.responseText,l,k])}});return this},serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&
!this.disabled&&(this.checked||mb.test(this.nodeName)||nb.test(this.type))}).map(function(a,b){var d=c(this).val();return d==null?null:c.isArray(d)?c.map(d,function(e){return{name:b.name,value:e}}):{name:b.name,value:d}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,e){if(c.isFunction(b)){e=e||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:e})},
getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,e){if(c.isFunction(b)){e=e||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:e})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return new E.XMLHttpRequest},accepts:{xml:"application/xml, text/xml",html:"text/html",
script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},ajax:function(a){var b=c.extend(true,{},c.ajaxSettings,a),d,e,f,h=b.type.toUpperCase(),k=ob.test(h);b.url=b.url.replace(sb,"");b.context=a&&a.context!=null?a.context:b;if(b.data&&b.processData&&typeof b.data!=="string")b.data=c.param(b.data,b.traditional);if(b.dataType==="jsonp"){if(h==="GET")T.test(b.url)||(b.url+=(ia.test(b.url)?"&":"?")+(b.jsonp||"callback")+"=?");else if(!b.data||
!T.test(b.data))b.data=(b.data?b.data+"&":"")+(b.jsonp||"callback")+"=?";b.dataType="json"}if(b.dataType==="json"&&(b.data&&T.test(b.data)||T.test(b.url))){d=b.jsonpCallback||"jsonp"+kb++;if(b.data)b.data=(b.data+"").replace(T,"="+d+"$1");b.url=b.url.replace(T,"="+d+"$1");b.dataType="script";var l=E[d];E[d]=function(m){f=m;c.handleSuccess(b,w,e,f);c.handleComplete(b,w,e,f);if(c.isFunction(l))l(m);else{E[d]=A;try{delete E[d]}catch(p){}}v&&v.removeChild(B)}}if(b.dataType==="script"&&b.cache===null)b.cache=
false;if(b.cache===false&&h==="GET"){var n=c.now(),s=b.url.replace(pb,"$1_="+n);b.url=s+(s===b.url?(ia.test(b.url)?"&":"?")+"_="+n:"")}if(b.data&&h==="GET")b.url+=(ia.test(b.url)?"&":"?")+b.data;b.global&&c.active++===0&&c.event.trigger("ajaxStart");n=(n=qb.exec(b.url))&&(n[1]&&n[1]!==location.protocol||n[2]!==location.host);if(b.dataType==="script"&&h==="GET"&&n){var v=u.getElementsByTagName("head")[0]||u.documentElement,B=u.createElement("script");if(b.scriptCharset)B.charset=b.scriptCharset;B.src=
b.url;if(!d){var D=false;B.onload=B.onreadystatechange=function(){if(!D&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){D=true;c.handleSuccess(b,w,e,f);c.handleComplete(b,w,e,f);B.onload=B.onreadystatechange=null;v&&B.parentNode&&v.removeChild(B)}}}v.insertBefore(B,v.firstChild);return A}var H=false,w=b.xhr();if(w){b.username?w.open(h,b.url,b.async,b.username,b.password):w.open(h,b.url,b.async);try{if(b.data!=null&&!k||a&&a.contentType)w.setRequestHeader("Content-Type",
b.contentType);if(b.ifModified){c.lastModified[b.url]&&w.setRequestHeader("If-Modified-Since",c.lastModified[b.url]);c.etag[b.url]&&w.setRequestHeader("If-None-Match",c.etag[b.url])}n||w.setRequestHeader("X-Requested-With","XMLHttpRequest");w.setRequestHeader("Accept",b.dataType&&b.accepts[b.dataType]?b.accepts[b.dataType]+", */*; q=0.01":b.accepts._default)}catch(G){}if(b.beforeSend&&b.beforeSend.call(b.context,w,b)===false){b.global&&c.active--===1&&c.event.trigger("ajaxStop");w.abort();return false}b.global&&
c.triggerGlobal(b,"ajaxSend",[w,b]);var M=w.onreadystatechange=function(m){if(!w||w.readyState===0||m==="abort"){H||c.handleComplete(b,w,e,f);H=true;if(w)w.onreadystatechange=c.noop}else if(!H&&w&&(w.readyState===4||m==="timeout")){H=true;w.onreadystatechange=c.noop;e=m==="timeout"?"timeout":!c.httpSuccess(w)?"error":b.ifModified&&c.httpNotModified(w,b.url)?"notmodified":"success";var p;if(e==="success")try{f=c.httpData(w,b.dataType,b)}catch(q){e="parsererror";p=q}if(e==="success"||e==="notmodified")d||
c.handleSuccess(b,w,e,f);else c.handleError(b,w,e,p);d||c.handleComplete(b,w,e,f);m==="timeout"&&w.abort();if(b.async)w=null}};try{var g=w.abort;w.abort=function(){w&&g.call&&g.call(w);M("abort")}}catch(j){}b.async&&b.timeout>0&&setTimeout(function(){w&&!H&&M("timeout")},b.timeout);try{w.send(k||b.data==null?null:b.data)}catch(o){c.handleError(b,w,null,o);c.handleComplete(b,w,e,f)}b.async||M();return w}},param:function(a,b){var d=[],e=function(h,k){k=c.isFunction(k)?k():k;d[d.length]=encodeURIComponent(h)+
"="+encodeURIComponent(k)};if(b===A)b=c.ajaxSettings.traditional;if(c.isArray(a)||a.jquery)c.each(a,function(){e(this.name,this.value)});else for(var f in a)ca(f,a[f],b,e);return d.join("&").replace(rb,"+")}});c.extend({active:0,lastModified:{},etag:{},handleError:function(a,b,d,e){a.error&&a.error.call(a.context,b,d,e);a.global&&c.triggerGlobal(a,"ajaxError",[b,a,e])},handleSuccess:function(a,b,d,e){a.success&&a.success.call(a.context,e,d,b);a.global&&c.triggerGlobal(a,"ajaxSuccess",[b,a])},handleComplete:function(a,
b,d){a.complete&&a.complete.call(a.context,b,d);a.global&&c.triggerGlobal(a,"ajaxComplete",[b,a]);a.global&&c.active--===1&&c.event.trigger("ajaxStop")},triggerGlobal:function(a,b,d){(a.context&&a.context.url==null?c(a.context):c.event).trigger(b,d)},httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===1223}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),e=a.getResponseHeader("Etag");
if(d)c.lastModified[b]=d;if(e)c.etag[b]=e;return a.status===304},httpData:function(a,b,d){var e=a.getResponseHeader("content-type")||"",f=b==="xml"||!b&&e.indexOf("xml")>=0;a=f?a.responseXML:a.responseText;f&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b==="json"||!b&&e.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&e.indexOf("javascript")>=0)c.globalEval(a);return a}});if(E.ActiveXObject)c.ajaxSettings.xhr=
function(){if(E.location.protocol!=="file:")try{return new E.XMLHttpRequest}catch(a){}try{return new E.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}};c.support.ajax=!!c.ajaxSettings.xhr();var da={},tb=/^(?:toggle|show|hide)$/,ub=/^([+\-]=)?([\d+.\-]+)(.*)$/,aa,na=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b,d){if(a||a===0)return this.animate(S("show",3),a,b,d);else{a=
0;for(b=this.length;a<b;a++){if(!c.data(this[a],"olddisplay")&&this[a].style.display==="none")this[a].style.display="";this[a].style.display===""&&c.css(this[a],"display")==="none"&&c.data(this[a],"olddisplay",oa(this[a].nodeName))}for(a=0;a<b;a++)this[a].style.display=c.data(this[a],"olddisplay")||"";return this}},hide:function(a,b,d){if(a||a===0)return this.animate(S("hide",3),a,b,d);else{a=0;for(b=this.length;a<b;a++){d=c.css(this[a],"display");d!=="none"&&c.data(this[a],"olddisplay",d)}for(a=
0;a<b;a++)this[a].style.display="none";return this}},_toggle:c.fn.toggle,toggle:function(a,b,d){var e=typeof a==="boolean";if(c.isFunction(a)&&c.isFunction(b))this._toggle.apply(this,arguments);else a==null||e?this.each(function(){var f=e?a:c(this).is(":hidden");c(this)[f?"show":"hide"]()}):this.animate(S("toggle",3),a,b,d);return this},fadeTo:function(a,b,d,e){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,d,e)},animate:function(a,b,d,e){var f=c.speed(b,d,e);if(c.isEmptyObject(a))return this.each(f.complete);
return this[f.queue===false?"each":"queue"](function(){var h=c.extend({},f),k,l=this.nodeType===1,n=l&&c(this).is(":hidden"),s=this;for(k in a){var v=c.camelCase(k);if(k!==v){a[v]=a[k];delete a[k];k=v}if(a[k]==="hide"&&n||a[k]==="show"&&!n)return h.complete.call(this);if(l&&(k==="height"||k==="width")){h.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY];if(c.css(this,"display")==="inline"&&c.css(this,"float")==="none")if(c.support.inlineBlockNeedsLayout)if(oa(this.nodeName)===
"inline")this.style.display="inline-block";else{this.style.display="inline";this.style.zoom=1}else this.style.display="inline-block"}if(c.isArray(a[k])){(h.specialEasing=h.specialEasing||{})[k]=a[k][1];a[k]=a[k][0]}}if(h.overflow!=null)this.style.overflow="hidden";h.curAnim=c.extend({},a);c.each(a,function(B,D){var H=new c.fx(s,h,B);if(tb.test(D))H[D==="toggle"?n?"show":"hide":D](a);else{var w=ub.exec(D),G=H.cur(true)||0;if(w){var M=parseFloat(w[2]),g=w[3]||"px";if(g!=="px"){c.style(s,B,(M||1)+g);
G=(M||1)/H.cur(true)*G;c.style(s,B,G+g)}if(w[1])M=(w[1]==="-="?-1:1)*M+G;H.custom(G,M,g)}else H.custom(G,D,"")}});return true})},stop:function(a,b){var d=c.timers;a&&this.queue([]);this.each(function(){for(var e=d.length-1;e>=0;e--)if(d[e].elem===this){b&&d[e](true);d.splice(e,1)}});b||this.dequeue();return this}});c.each({slideDown:S("show",1),slideUp:S("hide",1),slideToggle:S("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,e,f){return this.animate(b,
d,e,f)}});c.extend({speed:function(a,b,d){var e=a&&typeof a==="object"?c.extend({},a):{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};e.duration=c.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in c.fx.speeds?c.fx.speeds[e.duration]:c.fx.speeds._default;e.old=e.complete;e.complete=function(){e.queue!==false&&c(this).dequeue();c.isFunction(e.old)&&e.old.call(this)};return e},easing:{linear:function(a,b,d,e){return d+e*a},swing:function(a,b,d,e){return(-Math.cos(a*
Math.PI)/2+0.5)*e+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||c.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a=parseFloat(c.css(this.elem,this.prop));return a&&a>-1E4?a:0},custom:function(a,b,d){function e(h){return f.step(h)}
this.startTime=c.now();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;this.pos=this.state=0;var f=this;a=c.fx;e.elem=this.elem;if(e()&&c.timers.push(e)&&!aa)aa=setInterval(a.tick,a.interval)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;
this.custom(this.cur(),0)},step:function(a){var b=c.now(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var e in this.options.curAnim)if(this.options.curAnim[e]!==true)d=false;if(d){if(this.options.overflow!=null&&!c.support.shrinkWrapBlocks){var f=this.elem,h=this.options;c.each(["","X","Y"],function(l,n){f.style["overflow"+n]=h.overflow[l]})}this.options.hide&&c(this.elem).hide();if(this.options.hide||
this.options.show)for(var k in this.options.curAnim)c.style(this.elem,k,this.options.orig[k]);this.options.complete.call(this.elem)}return false}else{a=b-this.startTime;this.state=a/this.options.duration;b=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||b](this.state,a,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=
c.timers,b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||c.fx.stop()},interval:13,stop:function(){clearInterval(aa);aa=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){c.style(a.elem,"opacity",a.now)},_default:function(a){if(a.elem.style&&a.elem.style[a.prop]!=null)a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit;else a.elem[a.prop]=a.now}}});if(c.expr&&c.expr.filters)c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===
b.elem}).length};var vb=/^t(?:able|d|h)$/i,Fa=/^(?:body|html)$/i;c.fn.offset="getBoundingClientRect"in u.documentElement?function(a){var b=this[0],d;if(a)return this.each(function(k){c.offset.setOffset(this,a,k)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);try{d=b.getBoundingClientRect()}catch(e){}var f=b.ownerDocument,h=f.documentElement;if(!d||!c.contains(h,b))return d||{top:0,left:0};b=f.body;f=ea(f);return{top:d.top+(f.pageYOffset||c.support.boxModel&&
h.scrollTop||b.scrollTop)-(h.clientTop||b.clientTop||0),left:d.left+(f.pageXOffset||c.support.boxModel&&h.scrollLeft||b.scrollLeft)-(h.clientLeft||b.clientLeft||0)}}:function(a){var b=this[0];if(a)return this.each(function(s){c.offset.setOffset(this,a,s)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);c.offset.initialize();var d=b.offsetParent,e=b.ownerDocument,f,h=e.documentElement,k=e.body;f=(e=e.defaultView)?e.getComputedStyle(b,null):b.currentStyle;
for(var l=b.offsetTop,n=b.offsetLeft;(b=b.parentNode)&&b!==k&&b!==h;){if(c.offset.supportsFixedPosition&&f.position==="fixed")break;f=e?e.getComputedStyle(b,null):b.currentStyle;l-=b.scrollTop;n-=b.scrollLeft;if(b===d){l+=b.offsetTop;n+=b.offsetLeft;if(c.offset.doesNotAddBorder&&!(c.offset.doesAddBorderForTableAndCells&&vb.test(b.nodeName))){l+=parseFloat(f.borderTopWidth)||0;n+=parseFloat(f.borderLeftWidth)||0}d=b.offsetParent}if(c.offset.subtractsBorderForOverflowNotVisible&&f.overflow!=="visible"){l+=
parseFloat(f.borderTopWidth)||0;n+=parseFloat(f.borderLeftWidth)||0}f=f}if(f.position==="relative"||f.position==="static"){l+=k.offsetTop;n+=k.offsetLeft}if(c.offset.supportsFixedPosition&&f.position==="fixed"){l+=Math.max(h.scrollTop,k.scrollTop);n+=Math.max(h.scrollLeft,k.scrollLeft)}return{top:l,left:n}};c.offset={initialize:function(){var a=u.body,b=u.createElement("div"),d,e,f,h=parseFloat(c.css(a,"marginTop"))||0;c.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",
height:"1px",visibility:"hidden"});b.innerHTML="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";a.insertBefore(b,a.firstChild);d=b.firstChild;e=d.firstChild;f=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=e.offsetTop!==5;this.doesAddBorderForTableAndCells=
f.offsetTop===5;e.style.position="fixed";e.style.top="20px";this.supportsFixedPosition=e.offsetTop===20||e.offsetTop===15;e.style.position=e.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=e.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==h;a.removeChild(b);c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.css(a,
"marginTop"))||0;d+=parseFloat(c.css(a,"marginLeft"))||0}return{top:b,left:d}},setOffset:function(a,b,d){var e=c.css(a,"position");if(e==="static")a.style.position="relative";var f=c(a),h=f.offset(),k=c.css(a,"top"),l=c.css(a,"left"),n=e==="absolute"&&c.inArray("auto",[k,l])>-1;e={};var s={};if(n)s=f.position();k=n?s.top:parseInt(k,10)||0;l=n?s.left:parseInt(l,10)||0;if(c.isFunction(b))b=b.call(a,d,h);if(b.top!=null)e.top=b.top-h.top+k;if(b.left!=null)e.left=b.left-h.left+l;"using"in b?b.using.call(a,
e):f.css(e)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),e=Fa.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.css(a,"marginTop"))||0;d.left-=parseFloat(c.css(a,"marginLeft"))||0;e.top+=parseFloat(c.css(b[0],"borderTopWidth"))||0;e.left+=parseFloat(c.css(b[0],"borderLeftWidth"))||0;return{top:d.top-e.top,left:d.left-e.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||u.body;a&&!Fa.test(a.nodeName)&&
c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(e){var f=this[0],h;if(!f)return null;if(e!==A)return this.each(function(){if(h=ea(this))h.scrollTo(!a?e:c(h).scrollLeft(),a?e:c(h).scrollTop());else this[d]=e});else return(h=ea(f))?"pageXOffset"in h?h[a?"pageYOffset":"pageXOffset"]:c.support.boxModel&&h.document.documentElement[d]||h.document.body[d]:f[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();
c.fn["inner"+b]=function(){return this[0]?parseFloat(c.css(this[0],d,"padding")):null};c.fn["outer"+b]=function(e){return this[0]?parseFloat(c.css(this[0],d,e?"margin":"border")):null};c.fn[d]=function(e){var f=this[0];if(!f)return e==null?null:this;if(c.isFunction(e))return this.each(function(h){var k=c(this);k[d](e.call(this,h,k[d]()))});return c.isWindow(f)?f.document.compatMode==="CSS1Compat"&&f.document.documentElement["client"+b]||f.document.body["client"+b]:f.nodeType===9?Math.max(f.documentElement["client"+
b],f.body["scroll"+b],f.documentElement["scroll"+b],f.body["offset"+b],f.documentElement["offset"+b]):e===A?parseFloat(c.css(f,d)):this.css(d,typeof e==="string"?e:e+"px")}})})(window);
|
ajax/libs/material-ui/5.0.0-alpha.12/internal/svg-icons/CheckBox.min.js | cdnjs/cdnjs | "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault"),_interopRequireWildcard=require("@babel/runtime/helpers/interopRequireWildcard");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var React=_interopRequireWildcard(require("react")),_createSvgIcon=_interopRequireDefault(require("../../utils/createSvgIcon")),_default=(0,_createSvgIcon.default)(React.createElement("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"}),"CheckBox");exports.default=_default; |
src/app/common/UserInterface/components/Swipeable.js | toxzilla/app | import React from 'react';
import ReactDOM from 'react-dom';
import {classNames, combine as combineStyle, compose as composeStyle, ease} from 'react-dom-stylesheet';
import Control from './Control';
export default class Swipeable extends Control {
static displayName = 'Swipeable'
static props = {
...Control.defaultProps,
swipePoint: React.PropTypes.number,
className: React.PropTypes.string,
style: React.PropTypes.oneOfType([
React.PropTypes.array,
React.PropTypes.object,
React.PropTypes.string
]),
onStart: React.PropTypes.func,
onStop: React.PropTypes.func,
onSwipe: React.PropTypes.func
}
static defaultProps = {
...Control.defaultProps,
swipePoint: 70
}
static transformTransitionDuration = 150
constructor (props) {
super(props);
this.state = {
...this.state,
isDragging: false,
isSwiped: false,
initialX: null,
currentX: 0,
offBound: 0,
touchIdentifier: null
};
}
componentDidUpdate (prevProps, prevState) {
super.componentDidUpdate(prevProps);
if (this.state.isSwiped && this.state.isSwiped !== prevState.isSwiped) {
document.removeEventListener('mousemove', this._handleDrag);
document.removeEventListener('mouseup', this._handleDragStop);
}
}
componentWillUnmount () {
document.removeEventListener('mousemove', this._handleDrag);
document.removeEventListener('mouseup', this._handleDragStop);
}
render () {
const { disabled, tabIndex, className, style } = this.props;
const { isDragging, isSwiped, isKeyboardFocused, currentX, offBound } = this.state;
const rootStyle = composeStyle({
transition: combineStyle(
!isDragging ? ease('linear', 'transform', Swipeable.transformTransitionDuration) : null,
ease(isDragging ? 'easeOutSine' : 'easeInSine', 'opacity', isDragging ? 0 : Swipeable.transformTransitionDuration / 2, isDragging ? 0 : 150)
),
opacity: isDragging || isSwiped ? 1 - (offBound / 100) : null,
transform: isDragging || isSwiped ? `translateX(${currentX}px)` : null
}, style);
const rootClasses = classNames('swipeable', {
active: isDragging,
focused: isKeyboardFocused
}, className);
return (
<div className={rootClasses}
style={rootStyle}
tabIndex={tabIndex}
onFocus={!disabled ? (event) => this._handleFocus(event) : null}
onBlur={!disabled ? (event) => this._handleBlur(event) : null}
onKeyDown={!disabled ? (event) => this._handleKeyDown(event) : null}
onKeyUp={!disabled ? (event) => this._handleKeyUp(event) : null}
onMouseDown={!disabled && !isSwiped ? (event) => this._handleMouseDown(event) : null}
onMouseUp={!disabled && !isSwiped ? (event) => this._handleMouseUp(event) : null}
onTouchStart={!disabled && !isSwiped ? (event) => this._handleTouchStart(event) : null}
onTouchEnd={!disabled && !isSwiped ? (event) => this._handleTouchEnd(event) : null}
onTransitionEnd={!disabled && isSwiped ? (event) => this._handleTransitionEnd(event) : null}>
{this.props.children}
</div>
);
}
_handleBlur (event) {
super._handleBlur(event);
this._handleDragStop();
}
_handleMouseDown (event) {
super._handleMouseDown(event);
// Track only left button mouse downs and skip button nodes
if (event.button === 0 && (
event.target.nodeName !== 'BUTTON' &&
event.target.parentElement.nodeName !== 'BUTTON')
) {
this._handleDragStart(event);
}
}
_handleMouseUp (event) {
super._handleMouseUp(event);
// Track only left button mouse ups
if (event.button === 0) {
this._handleDragStop(event);
}
}
_handleTouchStart (event) {
this._handleDragStart(event);
}
_handleTouchEnd (event) {
this._handleDragStop(event);
}
_handleDragStart = (event) => {
if (this.props.onStart) this.props.onStart();
const touchIdentifier = getTouchIdentifier(event);
this.setState({ touchIdentifier });
const currentX = getXPosition(event, touchIdentifier, this);
if (currentX === null) return;
this.setState({
isDragging: true,
initialX: currentX
});
document.addEventListener('mousemove', this._handleDrag);
document.addEventListener('mouseup', this._handleDragStop);
}
_handleDrag = (event) => {
if (this.state.isSwiped) return;
const currentX = getXPosition(event, this.state.touchIdentifier, this);
if (currentX === null) return;
const rootNode = ReactDOM.findDOMNode(this);
const width = rootNode.clientWidth;
const offBound = ((currentX - this.state.initialX) / width) * 100;
if (this.props.swipePoint < Math.abs(offBound)) {
this.setState({
isSwiped: true,
isDragging: false,
currentX: offBound > 0 ? width : -width,
offBound: 100
});
} else {
this.setState({
currentX: currentX - this.state.initialX,
offBound: Math.abs(offBound)
});
}
}
_handleDragStop = () => {
if (!this.state.isDragging || this.state.isSwiped) return;
this.setState({
isDragging: false,
initialX: null,
currentX: 0,
offBound: 0
});
if (this.props.onStop) this.props.onStop();
document.removeEventListener('mousemove', this._handleDrag);
document.removeEventListener('mouseup', this._handleDragStop);
}
_handleTransitionEnd (event) {
if (event.propertyName === 'transform') this.props.onSwipe();
}
}
function getTouch (event:MouseEvent, identifier:number):?{clientX: number} {
return (event.targetTouches && event.targetTouches.find((touch) => identifier === touch.identifier) ||
(event.changedTouches && event.changedTouches.find((touch) => identifier === touch.identifier)));
}
function getTouchIdentifier (event:MouseEvent):?number {
if (event.targetTouches && event.targetTouches[ 0 ]) return event.targetTouches[ 0 ].identifier;
if (event.changedTouches && event.changedTouches[ 0 ]) return event.changedTouches[ 0 ].identifier;
}
function offsetXFromParentOf (evt:{clientX: number}, node:HTMLElement & {offsetParent: HTMLElement}):number {
const offsetParent = node.offsetParent || document.body;
const offsetParentRect = node.offsetParent === document.body ? {
left: 0,
top: 0
} : offsetParent.getBoundingClientRect();
return evt.clientX + offsetParent.scrollLeft - offsetParentRect.left;
}
function getXPosition (event:MouseEvent, touchIdentifier:?number, component:Swipeable):?number {
const touchObj = typeof touchIdentifier === 'number' ? getTouch(event, touchIdentifier).clientX : null;
if (typeof touchIdentifier === 'number' && !touchObj) return null;
return offsetXFromParentOf(touchObj || event, ReactDOM.findDOMNode(component));
}
|
app/javascript/mastodon/features/direct_timeline/index.js | TheInventrix/mastodon | import React from 'react';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import Column from '../../components/column';
import ColumnHeader from '../../components/column_header';
import { mountConversations, unmountConversations, expandConversations } from '../../actions/conversations';
import { addColumn, removeColumn, moveColumn } from '../../actions/columns';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import { connectDirectStream } from '../../actions/streaming';
import ConversationsListContainer from './containers/conversations_list_container';
const messages = defineMessages({
title: { id: 'column.direct', defaultMessage: 'Direct messages' },
});
export default @connect()
@injectIntl
class DirectTimeline extends React.PureComponent {
static propTypes = {
dispatch: PropTypes.func.isRequired,
shouldUpdateScroll: PropTypes.func,
columnId: PropTypes.string,
intl: PropTypes.object.isRequired,
hasUnread: PropTypes.bool,
multiColumn: PropTypes.bool,
};
handlePin = () => {
const { columnId, dispatch } = this.props;
if (columnId) {
dispatch(removeColumn(columnId));
} else {
dispatch(addColumn('DIRECT', {}));
}
}
handleMove = (dir) => {
const { columnId, dispatch } = this.props;
dispatch(moveColumn(columnId, dir));
}
handleHeaderClick = () => {
this.column.scrollTop();
}
componentDidMount () {
const { dispatch } = this.props;
dispatch(mountConversations());
dispatch(expandConversations());
this.disconnect = dispatch(connectDirectStream());
}
componentWillUnmount () {
this.props.dispatch(unmountConversations());
if (this.disconnect) {
this.disconnect();
this.disconnect = null;
}
}
setRef = c => {
this.column = c;
}
handleLoadMore = maxId => {
this.props.dispatch(expandConversations({ maxId }));
}
render () {
const { intl, hasUnread, columnId, multiColumn, shouldUpdateScroll } = this.props;
const pinned = !!columnId;
return (
<Column ref={this.setRef} label={intl.formatMessage(messages.title)}>
<ColumnHeader
icon='envelope'
active={hasUnread}
title={intl.formatMessage(messages.title)}
onPin={this.handlePin}
onMove={this.handleMove}
onClick={this.handleHeaderClick}
pinned={pinned}
multiColumn={multiColumn}
/>
<ConversationsListContainer
trackScroll={!pinned}
scrollKey={`direct_timeline-${columnId}`}
timelineId='direct'
onLoadMore={this.handleLoadMore}
emptyMessage={<FormattedMessage id='empty_column.direct' defaultMessage="You don't have any direct messages yet. When you send or receive one, it will show up here." />}
shouldUpdateScroll={shouldUpdateScroll}
/>
</Column>
);
}
}
|
frontend/component/Login.js | wangmuming/node-forum | import React from 'react';
import jQuery from 'jquery';
import {Link} from 'react-router';
import {login} from '../lib/client';
import {redirectURL} from '../lib/utils';
export default class Login extends React.Component{
constructor(pros){
super(pros);
this.state = {};
}
// 输入‘用户名’‘密码’检测
handleChange(name, e){
// console.log(name, e.target.value);
this.state[name] = e.target.value;
}
// 点击‘登录’
handleLogin(e){
const $btn = jQuery(e.target);
$btn.button('loading');
login(this.state.name, this.state.password)
.then(ret => {
$btn.button('reset');
// console.log(ret);
alert('登录成功!');
redirectURL('/');
})
.catch(err => {
$btn.button('reset');
alert(err);
});
}
render(){
// console.log(this.props.location.query);
const isBind = this.props.location.query.bind === '1' ? true : false;
return(
<div style={{width: 400, margin: 'auto'}}>
<div className="panel panel-primary">
<div className="panel-heading">登录</div>
<div className="panel-body">
<form>
<div className="form-group">
<label htmlFor="ipt-name">用户名</label>
<input type="text" className="form-control" id="ipt-name" onChange={this.handleChange.bind(this, 'name')} placeholder="" />
</div>
<div className="form-group">
<label htmlFor="password">密码</label>
<input type="password" className="form-control" id="password" onChange={this.handleChange.bind(this, 'password')} placeholder="" />
</div>
<button type="button" className="btn btn-primary" onClick={this.handleLogin.bind(this)}>{isBind ? '绑定' : '登录'}</button>
{isBind ? null : <a href="/auth/github" className="btn btn-info">使用GutHub账号登录</a>}
<span className="pull-right">
<Link to="/reset_password">重置密码</Link>
</span>
</form>
</div>
</div>
</div>
);
}
}
|
internals/templates/containers/HomePage/index.js | likesalmon/likesalmon-react-boilerplate | /*
* HomePage
*
* This is the first thing users see of our App, at the '/' route
*
* NOTE: while this component should technically be a stateless functional
* component (SFC), hot reloading does not currently support SFCs. If hot
* reloading is not a necessity for you then you can refactor it and remove
* the linting exception.
*/
import React from 'react';
import { FormattedMessage } from 'react-intl';
import messages from './messages';
export default class HomePage extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function
render() {
return (
<h1>
<FormattedMessage {...messages.header} />
</h1>
);
}
}
|
ajax/libs/graphiql/0.11.3/graphiql.min.js | tholu/cdnjs | !function(f){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=f();else if("function"==typeof define&&define.amd)define([],f);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).GraphiQL=f()}}(function(){return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);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||e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(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 _inherits(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(exports,"__esModule",{value:!0}),exports.DocExplorer=void 0;var _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e},_createClass=function(){function e(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,a,r){return a&&e(t.prototype,a),r&&e(t,r),t}}(),_react2=_interopRequireDefault("undefined"!=typeof window?window.React:void 0!==global?global.React:null),_propTypes2=_interopRequireDefault(require("prop-types")),_graphql=require("graphql"),_FieldDoc2=_interopRequireDefault(require("./DocExplorer/FieldDoc")),_SchemaDoc2=_interopRequireDefault(require("./DocExplorer/SchemaDoc")),_SearchBox2=_interopRequireDefault(require("./DocExplorer/SearchBox")),_SearchResults2=_interopRequireDefault(require("./DocExplorer/SearchResults")),_TypeDoc2=_interopRequireDefault(require("./DocExplorer/TypeDoc")),initialNav={name:"Schema",title:"Documentation Explorer"};(exports.DocExplorer=function(e){function t(){_classCallCheck(this,t);var e=_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.handleNavBackClick=function(){e.state.navStack.length>1&&e.setState({navStack:e.state.navStack.slice(0,-1)})},e.handleClickTypeOrField=function(t){e.showDoc(t)},e.handleSearch=function(t){e.showSearch(t)},e.state={navStack:[initialNav]},e}return _inherits(t,e),_createClass(t,[{key:"shouldComponentUpdate",value:function(e,t){return this.props.schema!==e.schema||this.state.navStack!==t.navStack}},{key:"render",value:function(){var e=this.props.schema,t=this.state.navStack,a=t[t.length-1],r=void 0;r=void 0===e?_react2.default.createElement("div",{className:"spinner-container"},_react2.default.createElement("div",{className:"spinner"})):e?a.search?_react2.default.createElement(_SearchResults2.default,{searchValue:a.search,withinType:a.def,schema:e,onClickType:this.handleClickTypeOrField,onClickField:this.handleClickTypeOrField}):1===t.length?_react2.default.createElement(_SchemaDoc2.default,{schema:e,onClickType:this.handleClickTypeOrField}):(0,_graphql.isType)(a.def)?_react2.default.createElement(_TypeDoc2.default,{schema:e,type:a.def,onClickType:this.handleClickTypeOrField,onClickField:this.handleClickTypeOrField}):_react2.default.createElement(_FieldDoc2.default,{field:a.def,onClickType:this.handleClickTypeOrField}):_react2.default.createElement("div",{className:"error-container"},"No Schema Available");var c=1===t.length||(0,_graphql.isType)(a.def)&&a.def.getFields,l=void 0;return t.length>1&&(l=t[t.length-2].name),_react2.default.createElement("div",{className:"doc-explorer",key:a.name},_react2.default.createElement("div",{className:"doc-explorer-title-bar"},l&&_react2.default.createElement("div",{className:"doc-explorer-back",onClick:this.handleNavBackClick},l),_react2.default.createElement("div",{className:"doc-explorer-title"},a.title||a.name),_react2.default.createElement("div",{className:"doc-explorer-rhs"},this.props.children)),_react2.default.createElement("div",{className:"doc-explorer-contents"},c&&_react2.default.createElement(_SearchBox2.default,{value:a.search,placeholder:"Search "+a.name+"...",onSearch:this.handleSearch}),r))}},{key:"showDoc",value:function(e){var t=this.state.navStack;t[t.length-1].def!==e&&this.setState({navStack:t.concat([{name:e.name,def:e}])})}},{key:"showDocForReference",value:function(e){"Type"===e.kind?this.showDoc(e.type):"Field"===e.kind?this.showDoc(e.field):"Argument"===e.kind&&e.field?this.showDoc(e.field):"EnumValue"===e.kind&&e.type&&this.showDoc(e.type)}},{key:"showSearch",value:function(e){var t=this.state.navStack.slice(),a=t[t.length-1];t[t.length-1]=_extends({},a,{search:e}),this.setState({navStack:t})}},{key:"reset",value:function(){this.setState({navStack:[initialNav]})}}]),t}(_react2.default.Component)).propTypes={schema:_propTypes2.default.instanceOf(_graphql.GraphQLSchema)}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./DocExplorer/FieldDoc":3,"./DocExplorer/SchemaDoc":5,"./DocExplorer/SearchBox":6,"./DocExplorer/SearchResults":7,"./DocExplorer/TypeDoc":8,graphql:92,"prop-types":172}],2:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function Argument(e){var a=e.arg,r=e.onClickType,t=e.showDefaultValue;return _react2.default.createElement("span",{className:"arg"},_react2.default.createElement("span",{className:"arg-name"},a.name),": ",_react2.default.createElement(_TypeLink2.default,{type:a.type,onClick:r}),void 0!==a.defaultValue&&!1!==t&&_react2.default.createElement("span",null," = ",_react2.default.createElement("span",{className:"arg-default-value"},(0,_graphql.print)((0,_graphql.astFromValue)(a.defaultValue,a.type)))))}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=Argument;var _react2=_interopRequireDefault("undefined"!=typeof window?window.React:void 0!==global?global.React:null),_propTypes2=_interopRequireDefault(require("prop-types")),_graphql=require("graphql"),_TypeLink2=_interopRequireDefault(require("./TypeLink"));Argument.propTypes={arg:_propTypes2.default.object.isRequired,onClickType:_propTypes2.default.func.isRequired,showDefaultValue:_propTypes2.default.bool}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./TypeLink":9,graphql:92,"prop-types":172}],3:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(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 _inherits(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(exports,"__esModule",{value:!0});var _createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),_react2=_interopRequireDefault("undefined"!=typeof window?window.React:void 0!==global?global.React:null),_propTypes2=_interopRequireDefault(require("prop-types")),_Argument2=_interopRequireDefault(require("./Argument")),_MarkdownContent2=_interopRequireDefault(require("./MarkdownContent")),_TypeLink2=_interopRequireDefault(require("./TypeLink")),FieldDoc=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return _inherits(t,e),_createClass(t,[{key:"shouldComponentUpdate",value:function(e){return this.props.field!==e.field}},{key:"render",value:function(){var e=this,t=this.props.field,r=void 0;return t.args&&t.args.length>0&&(r=_react2.default.createElement("div",{className:"doc-category"},_react2.default.createElement("div",{className:"doc-category-title"},"arguments"),t.args.map(function(t){return _react2.default.createElement("div",{key:t.name,className:"doc-category-item"},_react2.default.createElement("div",null,_react2.default.createElement(_Argument2.default,{arg:t,onClickType:e.props.onClickType})),_react2.default.createElement(_MarkdownContent2.default,{className:"doc-value-description",markdown:t.description}))}))),_react2.default.createElement("div",null,_react2.default.createElement(_MarkdownContent2.default,{className:"doc-type-description",markdown:t.description||"No Description"}),t.deprecationReason&&_react2.default.createElement(_MarkdownContent2.default,{className:"doc-deprecation",markdown:t.deprecationReason}),_react2.default.createElement("div",{className:"doc-category"},_react2.default.createElement("div",{className:"doc-category-title"},"type"),_react2.default.createElement(_TypeLink2.default,{type:t.type,onClick:this.props.onClickType})),r)}}]),t}(_react2.default.Component);FieldDoc.propTypes={field:_propTypes2.default.object,onClickType:_propTypes2.default.func},exports.default=FieldDoc}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./Argument":2,"./MarkdownContent":4,"./TypeLink":9,"prop-types":172}],4:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(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 _inherits(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(exports,"__esModule",{value:!0});var _createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),_react2=_interopRequireDefault("undefined"!=typeof window?window.React:void 0!==global?global.React:null),_propTypes2=_interopRequireDefault(require("prop-types")),_marked2=_interopRequireDefault(require("marked")),MarkdownContent=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return _inherits(t,e),_createClass(t,[{key:"shouldComponentUpdate",value:function(e){return this.props.markdown!==e.markdown}},{key:"render",value:function(){var e=this.props.markdown;if(!e)return _react2.default.createElement("div",null);var t=(0,_marked2.default)(e,{sanitize:!0});return _react2.default.createElement("div",{className:this.props.className,dangerouslySetInnerHTML:{__html:t}})}}]),t}(_react2.default.Component);MarkdownContent.propTypes={markdown:_propTypes2.default.string,className:_propTypes2.default.string},exports.default=MarkdownContent}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{marked:167,"prop-types":172}],5:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(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 _inherits(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(exports,"__esModule",{value:!0});var _createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),_react2=_interopRequireDefault("undefined"!=typeof window?window.React:void 0!==global?global.React:null),_propTypes2=_interopRequireDefault(require("prop-types")),_TypeLink2=_interopRequireDefault(require("./TypeLink")),_MarkdownContent2=_interopRequireDefault(require("./MarkdownContent")),SchemaDoc=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return _inherits(t,e),_createClass(t,[{key:"shouldComponentUpdate",value:function(e){return this.props.schema!==e.schema}},{key:"render",value:function(){var e=this.props.schema,t=e.getQueryType(),r=e.getMutationType&&e.getMutationType(),a=e.getSubscriptionType&&e.getSubscriptionType();return _react2.default.createElement("div",null,_react2.default.createElement(_MarkdownContent2.default,{className:"doc-type-description",markdown:"A GraphQL schema provides a root type for each kind of operation."}),_react2.default.createElement("div",{className:"doc-category"},_react2.default.createElement("div",{className:"doc-category-title"},"root types"),_react2.default.createElement("div",{className:"doc-category-item"},_react2.default.createElement("span",{className:"keyword"},"query"),": ",_react2.default.createElement(_TypeLink2.default,{type:t,onClick:this.props.onClickType})),r&&_react2.default.createElement("div",{className:"doc-category-item"},_react2.default.createElement("span",{className:"keyword"},"mutation"),": ",_react2.default.createElement(_TypeLink2.default,{type:r,onClick:this.props.onClickType})),a&&_react2.default.createElement("div",{className:"doc-category-item"},_react2.default.createElement("span",{className:"keyword"},"subscription"),": ",_react2.default.createElement(_TypeLink2.default,{type:a,onClick:this.props.onClickType}))))}}]),t}(_react2.default.Component);SchemaDoc.propTypes={schema:_propTypes2.default.object,onClickType:_propTypes2.default.func},exports.default=SchemaDoc}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./MarkdownContent":4,"./TypeLink":9,"prop-types":172}],6:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(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 _inherits(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(exports,"__esModule",{value:!0});var _createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),_react2=_interopRequireDefault("undefined"!=typeof window?window.React:void 0!==global?global.React:null),_propTypes2=_interopRequireDefault(require("prop-types")),_debounce2=_interopRequireDefault(require("../../utility/debounce")),SearchBox=function(e){function t(e){_classCallCheck(this,t);var r=_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.handleChange=function(e){var t=e.target.value;r.setState({value:t}),r.debouncedOnSearch(t)},r.handleClear=function(){r.setState({value:""}),r.props.onSearch("")},r.state={value:e.value||""},r.debouncedOnSearch=(0,_debounce2.default)(200,r.props.onSearch),r}return _inherits(t,e),_createClass(t,[{key:"render",value:function(){return _react2.default.createElement("label",{className:"search-box"},_react2.default.createElement("input",{value:this.state.value,onChange:this.handleChange,type:"text",placeholder:this.props.placeholder}),this.state.value&&_react2.default.createElement("div",{className:"search-box-clear",onClick:this.handleClear},"✕"))}}]),t}(_react2.default.Component);SearchBox.propTypes={value:_propTypes2.default.string,placeholder:_propTypes2.default.string,onSearch:_propTypes2.default.func},exports.default=SearchBox}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utility/debounce":25,"prop-types":172}],7:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(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 _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function isMatch(e,t){try{var r=t.replace(/[^_0-9A-Za-z]/g,function(e){return"\\"+e});return-1!==e.search(new RegExp(r,"i"))}catch(r){return-1!==e.toLowerCase().indexOf(t.toLowerCase())}}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),_react2=_interopRequireDefault("undefined"!=typeof window?window.React:void 0!==global?global.React:null),_propTypes2=_interopRequireDefault(require("prop-types")),_Argument2=_interopRequireDefault(require("./Argument")),_TypeLink2=_interopRequireDefault(require("./TypeLink")),SearchResults=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return _inherits(t,e),_createClass(t,[{key:"shouldComponentUpdate",value:function(e){return this.props.schema!==e.schema||this.props.searchValue!==e.searchValue}},{key:"render",value:function(){var e=this.props.searchValue,t=this.props.withinType,r=this.props.schema,n=this.props.onClickType,a=this.props.onClickField,o=[],l=[],u=[],c=r.getTypeMap(),i=Object.keys(c);t&&(i=i.filter(function(e){return e!==t.name})).unshift(t.name);var s=!0,p=!1,f=void 0;try{for(var h,_=i[Symbol.iterator]();!(s=(h=_.next()).done)&&"break"!==function(){var r=h.value;if(o.length+l.length+u.length>=100)return"break";var i=c[r];if(t!==i&&isMatch(r,e)&&l.push(_react2.default.createElement("div",{className:"doc-category-item",key:r},_react2.default.createElement(_TypeLink2.default,{type:i,onClick:n}))),i.getFields){var s=i.getFields();Object.keys(s).forEach(function(l){var c=s[l],p=void 0;if(!isMatch(l,e)){if(!c.args||!c.args.length)return;if(0===(p=c.args.filter(function(t){return isMatch(t.name,e)})).length)return}var f=_react2.default.createElement("div",{className:"doc-category-item",key:r+"."+l},t!==i&&[_react2.default.createElement(_TypeLink2.default,{key:"type",type:i,onClick:n}),"."],_react2.default.createElement("a",{className:"field-name",onClick:function(e){return a(c,i,e)}},c.name),p&&["(",_react2.default.createElement("span",{key:"args"},p.map(function(e){return _react2.default.createElement(_Argument2.default,{key:e.name,arg:e,onClickType:n,showDefaultValue:!1})})),")"]);t===i?o.push(f):u.push(f)})}}();s=!0);}catch(e){p=!0,f=e}finally{try{!s&&_.return&&_.return()}finally{if(p)throw f}}return o.length+l.length+u.length===0?_react2.default.createElement("span",{className:"doc-alert-text"},"No results found."):t&&l.length+u.length>0?_react2.default.createElement("div",null,o,_react2.default.createElement("div",{className:"doc-category"},_react2.default.createElement("div",{className:"doc-category-title"},"other results"),l,u)):_react2.default.createElement("div",null,o,l,u)}}]),t}(_react2.default.Component);SearchResults.propTypes={schema:_propTypes2.default.object,withinType:_propTypes2.default.object,searchValue:_propTypes2.default.string,onClickType:_propTypes2.default.func,onClickField:_propTypes2.default.func},exports.default=SearchResults}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./Argument":2,"./TypeLink":9,"prop-types":172}],8:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(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 _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function Field(e){var t=e.type,a=e.field,r=e.onClickType,n=e.onClickField;return _react2.default.createElement("div",{className:"doc-category-item"},_react2.default.createElement("a",{className:"field-name",onClick:function(e){return n(a,t,e)}},a.name),a.args&&a.args.length>0&&["(",_react2.default.createElement("span",{key:"args"},a.args.map(function(e){return _react2.default.createElement(_Argument2.default,{key:e.name,arg:e,onClickType:r})})),")"],": ",_react2.default.createElement(_TypeLink2.default,{type:a.type,onClick:r}),a.description&&_react2.default.createElement("p",{className:"field-short-description"},a.description),a.deprecationReason&&_react2.default.createElement(_MarkdownContent2.default,{className:"doc-deprecation",markdown:a.deprecationReason}))}function EnumValue(e){var t=e.value;return _react2.default.createElement("div",{className:"doc-category-item"},_react2.default.createElement("div",{className:"enum-value"},t.name),_react2.default.createElement(_MarkdownContent2.default,{className:"doc-value-description",markdown:t.description}),t.deprecationReason&&_react2.default.createElement(_MarkdownContent2.default,{className:"doc-deprecation",markdown:t.deprecationReason}))}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function e(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,a,r){return a&&e(t.prototype,a),r&&e(t,r),t}}(),_react2=_interopRequireDefault("undefined"!=typeof window?window.React:void 0!==global?global.React:null),_propTypes2=_interopRequireDefault(require("prop-types")),_graphql=require("graphql"),_Argument2=_interopRequireDefault(require("./Argument")),_MarkdownContent2=_interopRequireDefault(require("./MarkdownContent")),_TypeLink2=_interopRequireDefault(require("./TypeLink")),TypeDoc=function(e){function t(e){_classCallCheck(this,t);var a=_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return a.handleShowDeprecated=function(){return a.setState({showDeprecated:!0})},a.state={showDeprecated:!1},a}return _inherits(t,e),_createClass(t,[{key:"shouldComponentUpdate",value:function(e,t){return this.props.type!==e.type||this.props.schema!==e.schema||this.state.showDeprecated!==t.showDeprecated}},{key:"render",value:function(){var e=this.props.schema,t=this.props.type,a=this.props.onClickType,r=this.props.onClickField,n=void 0,c=void 0;t instanceof _graphql.GraphQLUnionType?(n="possible types",c=e.getPossibleTypes(t)):t instanceof _graphql.GraphQLInterfaceType?(n="implementations",c=e.getPossibleTypes(t)):t instanceof _graphql.GraphQLObjectType&&(n="implements",c=t.getInterfaces());var o=void 0;c&&c.length>0&&(o=_react2.default.createElement("div",{className:"doc-category"},_react2.default.createElement("div",{className:"doc-category-title"},n),c.map(function(e){return _react2.default.createElement("div",{key:e.name,className:"doc-category-item"},_react2.default.createElement(_TypeLink2.default,{type:e,onClick:a}))})));var l=void 0,i=void 0;if(t.getFields){var p=t.getFields(),s=Object.keys(p).map(function(e){return p[e]});l=_react2.default.createElement("div",{className:"doc-category"},_react2.default.createElement("div",{className:"doc-category-title"},"fields"),s.filter(function(e){return!e.isDeprecated}).map(function(e){return _react2.default.createElement(Field,{key:e.name,type:t,field:e,onClickType:a,onClickField:r})}));var u=s.filter(function(e){return e.isDeprecated});u.length>0&&(i=_react2.default.createElement("div",{className:"doc-category"},_react2.default.createElement("div",{className:"doc-category-title"},"deprecated fields"),this.state.showDeprecated?u.map(function(e){return _react2.default.createElement(Field,{key:e.name,type:t,field:e,onClickType:a,onClickField:r})}):_react2.default.createElement("button",{className:"show-btn",onClick:this.handleShowDeprecated},"Show deprecated fields...")))}var d=void 0,f=void 0;if(t instanceof _graphql.GraphQLEnumType){var m=t.getValues();d=_react2.default.createElement("div",{className:"doc-category"},_react2.default.createElement("div",{className:"doc-category-title"},"values"),m.filter(function(e){return!e.isDeprecated}).map(function(e){return _react2.default.createElement(EnumValue,{key:e.name,value:e})}));var _=m.filter(function(e){return e.isDeprecated});_.length>0&&(f=_react2.default.createElement("div",{className:"doc-category"},_react2.default.createElement("div",{className:"doc-category-title"},"deprecated values"),this.state.showDeprecated?_.map(function(e){return _react2.default.createElement(EnumValue,{key:e.name,value:e})}):_react2.default.createElement("button",{className:"show-btn",onClick:this.handleShowDeprecated},"Show deprecated values...")))}return _react2.default.createElement("div",null,_react2.default.createElement(_MarkdownContent2.default,{className:"doc-type-description",markdown:t.description||"No Description"}),t instanceof _graphql.GraphQLObjectType&&o,l,i,d,f,!(t instanceof _graphql.GraphQLObjectType)&&o)}}]),t}(_react2.default.Component);TypeDoc.propTypes={schema:_propTypes2.default.instanceOf(_graphql.GraphQLSchema),type:_propTypes2.default.object,onClickType:_propTypes2.default.func,onClickField:_propTypes2.default.func},exports.default=TypeDoc,Field.propTypes={type:_propTypes2.default.object,field:_propTypes2.default.object,onClickType:_propTypes2.default.func,onClickField:_propTypes2.default.func},EnumValue.propTypes={value:_propTypes2.default.object}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./Argument":2,"./MarkdownContent":4,"./TypeLink":9,graphql:92,"prop-types":172}],9:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(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 _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function renderType(e,t){return e instanceof _graphql.GraphQLNonNull?_react2.default.createElement("span",null,renderType(e.ofType,t),"!"):e instanceof _graphql.GraphQLList?_react2.default.createElement("span",null,"[",renderType(e.ofType,t),"]"):_react2.default.createElement("a",{className:"type-name",onClick:function(r){return t(e,r)}},e.name)}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),_react2=_interopRequireDefault("undefined"!=typeof window?window.React:void 0!==global?global.React:null),_propTypes2=_interopRequireDefault(require("prop-types")),_graphql=require("graphql"),TypeLink=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return _inherits(t,e),_createClass(t,[{key:"shouldComponentUpdate",value:function(e){return this.props.type!==e.type}},{key:"render",value:function(){return renderType(this.props.type,this.props.onClick)}}]),t}(_react2.default.Component);TypeLink.propTypes={type:_propTypes2.default.object,onClick:_propTypes2.default.func},exports.default=TypeLink}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{graphql:92,"prop-types":172}],10:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(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 _inherits(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(exports,"__esModule",{value:!0}),exports.ExecuteButton=void 0;var _createClass=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),_react2=_interopRequireDefault("undefined"!=typeof window?window.React:void 0!==global?global.React:null),_propTypes2=_interopRequireDefault(require("prop-types"));(exports.ExecuteButton=function(e){function t(e){_classCallCheck(this,t);var n=_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n._onClick=function(){n.props.isRunning?n.props.onStop():n.props.onRun()},n._onOptionSelected=function(e){n.setState({optionsOpen:!1}),n.props.onRun(e.name&&e.name.value)},n._onOptionsOpen=function(e){var t=!0,o=e.target;n.setState({highlight:null,optionsOpen:!0});var r=function(e){t&&e.target===o?t=!1:(document.removeEventListener("mouseup",r),r=null,o.parentNode.compareDocumentPosition(e.target)&Node.DOCUMENT_POSITION_CONTAINED_BY||n.setState({optionsOpen:!1}))};document.addEventListener("mouseup",r)},n.state={optionsOpen:!1,highlight:null},n}return _inherits(t,e),_createClass(t,[{key:"render",value:function(){var e=this,t=this.props.operations,n=this.state.optionsOpen,o=t&&t.length>1,r=null;if(o&&n){var u=this.state.highlight;r=_react2.default.createElement("ul",{className:"execute-options"},t.map(function(t){return _react2.default.createElement("li",{key:t.name?t.name.value:"*",className:t===u&&"selected",onMouseOver:function(){return e.setState({highlight:t})},onMouseOut:function(){return e.setState({highlight:null})},onMouseUp:function(){return e._onOptionSelected(t)}},t.name?t.name.value:"<Unnamed>")}))}var a=void 0;!this.props.isRunning&&o||(a=this._onClick);var i=void 0;this.props.isRunning||!o||n||(i=this._onOptionsOpen);var s=this.props.isRunning?_react2.default.createElement("path",{d:"M 10 10 L 23 10 L 23 23 L 10 23 z"}):_react2.default.createElement("path",{d:"M 11 9 L 24 16 L 11 23 z"});return _react2.default.createElement("div",{className:"execute-button-wrap"},_react2.default.createElement("button",{type:"button",className:"execute-button",onMouseDown:i,onClick:a,title:"Execute Query (Ctrl-Enter)"},_react2.default.createElement("svg",{width:"34",height:"34"},s)),r)}}]),t}(_react2.default.Component)).propTypes={onRun:_propTypes2.default.func,onStop:_propTypes2.default.func,isRunning:_propTypes2.default.bool,operations:_propTypes2.default.array}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"prop-types":172}],11:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(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 _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function isPromise(e){return"object"===(void 0===e?"undefined":_typeof(e))&&"function"==typeof e.then}function observableToPromise(e){return isObservable(e)?new Promise(function(t,r){var o=e.subscribe(function(e){t(e),o.unsubscribe()},r,function(){r(new Error("no value resolved"))})}):e}function isObservable(e){return"object"===(void 0===e?"undefined":_typeof(e))&&"function"==typeof e.subscribe}Object.defineProperty(exports,"__esModule",{value:!0}),exports.GraphiQL=void 0;var _typeof="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},_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},_createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),_react2=_interopRequireDefault("undefined"!=typeof window?window.React:void 0!==global?global.React:null),_propTypes2=_interopRequireDefault(require("prop-types")),_reactDom2=_interopRequireDefault("undefined"!=typeof window?window.ReactDOM:void 0!==global?global.ReactDOM:null),_graphql=require("graphql"),_ExecuteButton=require("./ExecuteButton"),_ToolbarButton=require("./ToolbarButton"),_ToolbarGroup=require("./ToolbarGroup"),_ToolbarMenu=require("./ToolbarMenu"),_ToolbarSelect=require("./ToolbarSelect"),_QueryEditor=require("./QueryEditor"),_VariableEditor=require("./VariableEditor"),_ResultViewer=require("./ResultViewer"),_DocExplorer=require("./DocExplorer"),_QueryHistory=require("./QueryHistory"),_CodeMirrorSizer2=_interopRequireDefault(require("../utility/CodeMirrorSizer")),_StorageAPI2=_interopRequireDefault(require("../utility/StorageAPI")),_getQueryFacts2=_interopRequireDefault(require("../utility/getQueryFacts")),_getSelectedOperationName2=_interopRequireDefault(require("../utility/getSelectedOperationName")),_debounce2=_interopRequireDefault(require("../utility/debounce")),_find2=_interopRequireDefault(require("../utility/find")),_fillLeafs2=require("../utility/fillLeafs"),_elementPosition=require("../utility/elementPosition"),_introspectionQueries=require("../utility/introspectionQueries"),GraphiQL=exports.GraphiQL=function(e){function t(e){_classCallCheck(this,t);var r=_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));if(_initialiseProps.call(r),"function"!=typeof e.fetcher)throw new TypeError("GraphiQL requires a fetcher function.");r._storage=new _StorageAPI2.default(e.storage);var o=void 0!==e.query?e.query:null!==r._storage.get("query")?r._storage.get("query"):void 0!==e.defaultQuery?e.defaultQuery:defaultQuery,n=(0,_getQueryFacts2.default)(e.schema,o),i=void 0!==e.variables?e.variables:r._storage.get("variables"),a=void 0!==e.operationName?e.operationName:(0,_getSelectedOperationName2.default)(null,r._storage.get("operationName"),n&&n.operations);return r.state=_extends({schema:e.schema,query:o,variables:i,operationName:a,response:e.response,editorFlex:Number(r._storage.get("editorFlex"))||1,variableEditorOpen:Boolean(i),variableEditorHeight:Number(r._storage.get("variableEditorHeight"))||200,docExplorerOpen:"true"===r._storage.get("docExplorerOpen")||!1,historyPaneOpen:"true"===r._storage.get("historyPaneOpen")||!1,docExplorerWidth:Number(r._storage.get("docExplorerWidth"))||350,isWaitingForResponse:!1,subscription:null},n),r._editorQueryID=0,"object"===("undefined"==typeof window?"undefined":_typeof(window))&&window.addEventListener("beforeunload",function(){return r.componentWillUnmount()}),r}return _inherits(t,e),_createClass(t,[{key:"componentDidMount",value:function(){void 0===this.state.schema&&this._fetchSchema(),this.codeMirrorSizer=new _CodeMirrorSizer2.default,global.g=this}},{key:"componentWillReceiveProps",value:function(e){var t=this,r=this.state.schema,o=this.state.query,n=this.state.variables,i=this.state.operationName,a=this.state.response;if(void 0!==e.schema&&(r=e.schema),void 0!==e.query&&(o=e.query),void 0!==e.variables&&(n=e.variables),void 0!==e.operationName&&(i=e.operationName),void 0!==e.response&&(a=e.response),r!==this.state.schema||o!==this.state.query||i!==this.state.operationName){var s=this._updateQueryFacts(o,i,this.state.operations,r);void 0!==s&&(i=s.operationName,this.setState(s))}void 0===e.schema&&e.fetcher!==this.props.fetcher&&(r=void 0),this.setState({schema:r,query:o,variables:n,operationName:i,response:a},function(){void 0===t.state.schema&&(t.docExplorerComponent.reset(),t._fetchSchema())})}},{key:"componentDidUpdate",value:function(){this.codeMirrorSizer.updateSizes([this.queryEditorComponent,this.variableEditorComponent,this.resultComponent])}},{key:"componentWillUnmount",value:function(){this._storage.set("query",this.state.query),this._storage.set("variables",this.state.variables),this._storage.set("operationName",this.state.operationName),this._storage.set("editorFlex",this.state.editorFlex),this._storage.set("variableEditorHeight",this.state.variableEditorHeight),this._storage.set("docExplorerWidth",this.state.docExplorerWidth),this._storage.set("docExplorerOpen",this.state.docExplorerOpen),this._storage.set("historyPaneOpen",this.state.historyPaneOpen)}},{key:"render",value:function(){var e=this,r=_react2.default.Children.toArray(this.props.children),o=(0,_find2.default)(r,function(e){return e.type===t.Logo})||_react2.default.createElement(t.Logo,null),n=(0,_find2.default)(r,function(e){return e.type===t.Toolbar})||_react2.default.createElement(t.Toolbar,null,_react2.default.createElement(_ToolbarButton.ToolbarButton,{onClick:this.handlePrettifyQuery,title:"Prettify Query",label:"Prettify"}),_react2.default.createElement(_ToolbarButton.ToolbarButton,{onClick:this.handleToggleHistory,title:"Show History",label:"History"})),i=(0,_find2.default)(r,function(e){return e.type===t.Footer}),a={WebkitFlex:this.state.editorFlex,flex:this.state.editorFlex},s={display:this.state.docExplorerOpen?"block":"none",width:this.state.docExplorerWidth},l="docExplorerWrap"+(this.state.docExplorerWidth<200?" doc-explorer-narrow":""),u={display:this.state.historyPaneOpen?"block":"none",width:"230px",zIndex:"7"},c=this.state.variableEditorOpen,d={height:c?this.state.variableEditorHeight:null};return _react2.default.createElement("div",{className:"graphiql-container"},_react2.default.createElement("div",{className:"historyPaneWrap",style:u},_react2.default.createElement(_QueryHistory.QueryHistory,{operationName:this.state.operationName,query:this.state.query,variables:this.state.variables,onSelectQuery:this.handleSelectHistoryQuery,storage:this._storage,queryID:this._editorQueryID},_react2.default.createElement("div",{className:"docExplorerHide",onClick:this.handleToggleHistory},"✕"))),_react2.default.createElement("div",{className:"editorWrap"},_react2.default.createElement("div",{className:"topBarWrap"},_react2.default.createElement("div",{className:"topBar"},o,_react2.default.createElement(_ExecuteButton.ExecuteButton,{isRunning:Boolean(this.state.subscription),onRun:this.handleRunQuery,onStop:this.handleStopQuery,operations:this.state.operations}),n),!this.state.docExplorerOpen&&_react2.default.createElement("button",{className:"docExplorerShow",onClick:this.handleToggleDocs},"Docs")),_react2.default.createElement("div",{ref:function(t){e.editorBarComponent=t},className:"editorBar",onMouseDown:this.handleResizeStart},_react2.default.createElement("div",{className:"queryWrap",style:a},_react2.default.createElement(_QueryEditor.QueryEditor,{ref:function(t){e.queryEditorComponent=t},schema:this.state.schema,value:this.state.query,onEdit:this.handleEditQuery,onHintInformationRender:this.handleHintInformationRender,onClickReference:this.handleClickReference,onRunQuery:this.handleEditorRunQuery,editorTheme:this.props.editorTheme}),_react2.default.createElement("div",{className:"variable-editor",style:d},_react2.default.createElement("div",{className:"variable-editor-title",style:{cursor:c?"row-resize":"n-resize"},onMouseDown:this.handleVariableResizeStart},"Query Variables"),_react2.default.createElement(_VariableEditor.VariableEditor,{ref:function(t){e.variableEditorComponent=t},value:this.state.variables,variableToType:this.state.variableToType,onEdit:this.handleEditVariables,onHintInformationRender:this.handleHintInformationRender,onRunQuery:this.handleEditorRunQuery,editorTheme:this.props.editorTheme}))),_react2.default.createElement("div",{className:"resultWrap"},this.state.isWaitingForResponse&&_react2.default.createElement("div",{className:"spinner-container"},_react2.default.createElement("div",{className:"spinner"})),_react2.default.createElement(_ResultViewer.ResultViewer,{ref:function(t){e.resultComponent=t},value:this.state.response,editorTheme:this.props.editorTheme}),i))),_react2.default.createElement("div",{className:l,style:s},_react2.default.createElement("div",{className:"docExplorerResizer",onMouseDown:this.handleDocsResizeStart}),_react2.default.createElement(_DocExplorer.DocExplorer,{ref:function(t){e.docExplorerComponent=t},schema:this.state.schema},_react2.default.createElement("div",{className:"docExplorerHide",onClick:this.handleToggleDocs},"✕"))))}},{key:"getQueryEditor",value:function(){return this.queryEditorComponent.getCodeMirror()}},{key:"getVariableEditor",value:function(){return this.variableEditorComponent.getCodeMirror()}},{key:"refresh",value:function(){this.queryEditorComponent.getCodeMirror().refresh(),this.variableEditorComponent.getCodeMirror().refresh(),this.resultComponent.getCodeMirror().refresh()}},{key:"autoCompleteLeafs",value:function(){var e=(0,_fillLeafs2.fillLeafs)(this.state.schema,this.state.query,this.props.getDefaultFieldNames),t=e.insertions,r=e.result;if(t&&t.length>0){var o=this.getQueryEditor();o.operation(function(){var e=o.getCursor(),n=o.indexFromPos(e);o.setValue(r);var i=0,a=t.map(function(e){var t=e.index,r=e.string;return o.markText(o.posFromIndex(t+i),o.posFromIndex(t+(i+=r.length)),{className:"autoInsertedLeaf",clearOnEnter:!0,title:"Automatically added leaf fields"})});setTimeout(function(){return a.forEach(function(e){return e.clear()})},7e3);var s=n;t.forEach(function(e){var t=e.index,r=e.string;t<n&&(s+=r.length)}),o.setCursor(o.posFromIndex(s))})}return r}},{key:"_fetchSchema",value:function(){var e=this,t=this.props.fetcher,r=observableToPromise(t({query:_introspectionQueries.introspectionQuery}));isPromise(r)?r.then(function(e){if(e.data)return e;var o=observableToPromise(t({query:_introspectionQueries.introspectionQuerySansSubscriptions}));if(!isPromise(r))throw new Error("Fetcher did not return a Promise for introspection.");return o}).then(function(t){if(void 0===e.state.schema)if(t&&t.data){var r=(0,_graphql.buildClientSchema)(t.data),o=(0,_getQueryFacts2.default)(r,e.state.query);e.setState(_extends({schema:r},o))}else{var n="string"==typeof t?t:JSON.stringify(t,null,2);e.setState({schema:null,response:n})}}).catch(function(t){e.setState({schema:null,response:t&&String(t.stack||t)})}):this.setState({response:"Fetcher did not return a Promise for introspection."})}},{key:"_fetchQuery",value:function(e,t,r,o){var n=this,i=this.props.fetcher,a=null;try{a=t&&""!==t.trim()?JSON.parse(t):null}catch(e){throw new Error("Variables are invalid JSON: "+e.message+".")}if("object"!==(void 0===a?"undefined":_typeof(a)))throw new Error("Variables are not a JSON object.");var s=i({query:e,variables:a,operationName:r});if(!isPromise(s)){if(isObservable(s))return s.subscribe({next:o,error:function(e){n.setState({isWaitingForResponse:!1,response:e&&String(e.stack||e),subscription:null})},complete:function(){n.setState({isWaitingForResponse:!1,subscription:null})}});throw new Error("Fetcher did not return Promise or Observable.")}s.then(o).catch(function(e){n.setState({isWaitingForResponse:!1,response:e&&String(e.stack||e)})})}},{key:"_runQueryAtCursor",value:function(){if(this.state.subscription)this.handleStopQuery();else{var e=void 0,t=this.state.operations;if(t){var r=this.getQueryEditor();if(r.hasFocus())for(var o=r.getCursor(),n=r.indexFromPos(o),i=0;i<t.length;i++){var a=t[i];if(a.loc.start<=n&&a.loc.end>=n){e=a.name&&a.name.value;break}}}this.handleRunQuery(e)}}},{key:"_didClickDragBar",value:function(e){if(0!==e.button||e.ctrlKey)return!1;var t=e.target;if(0!==t.className.indexOf("CodeMirror-gutter"))return!1;for(var r=_reactDom2.default.findDOMNode(this.resultComponent);t;){if(t===r)return!0;t=t.parentNode}return!1}}]),t}(_react2.default.Component);GraphiQL.propTypes={fetcher:_propTypes2.default.func.isRequired,schema:_propTypes2.default.instanceOf(_graphql.GraphQLSchema),query:_propTypes2.default.string,variables:_propTypes2.default.string,operationName:_propTypes2.default.string,response:_propTypes2.default.string,storage:_propTypes2.default.shape({getItem:_propTypes2.default.func,setItem:_propTypes2.default.func,removeItem:_propTypes2.default.func}),defaultQuery:_propTypes2.default.string,onEditQuery:_propTypes2.default.func,onEditVariables:_propTypes2.default.func,onEditOperationName:_propTypes2.default.func,onToggleDocs:_propTypes2.default.func,getDefaultFieldNames:_propTypes2.default.func,editorTheme:_propTypes2.default.string,onToggleHistory:_propTypes2.default.func};var _initialiseProps=function(){var e=this;this.handleClickReference=function(t){e.setState({docExplorerOpen:!0},function(){e.docExplorerComponent.showDocForReference(t)})},this.handleRunQuery=function(t){var r=++e._editorQueryID,o=e.autoCompleteLeafs()||e.state.query,n=e.state.variables,i=e.state.operationName;t&&t!==i&&(i=t,e.handleEditOperationName(i));try{e.setState({isWaitingForResponse:!0,response:null,operationName:i});var a=e._fetchQuery(o,n,i,function(t){r===e._editorQueryID&&e.setState({isWaitingForResponse:!1,response:JSON.stringify(t,null,2)})});e.setState({subscription:a})}catch(t){e.setState({isWaitingForResponse:!1,response:t.message})}},this.handleStopQuery=function(){var t=e.state.subscription;e.setState({isWaitingForResponse:!1,subscription:null}),t&&t.unsubscribe()},this.handlePrettifyQuery=function(){var t=e.getQueryEditor();t.setValue((0,_graphql.print)((0,_graphql.parse)(t.getValue())))},this.handleEditQuery=(0,_debounce2.default)(100,function(t){var r=e._updateQueryFacts(t,e.state.operationName,e.state.operations,e.state.schema);if(e.setState(_extends({query:t},r)),e.props.onEditQuery)return e.props.onEditQuery(t)}),this._updateQueryFacts=function(t,r,o,n){var i=(0,_getQueryFacts2.default)(n,t);if(i){var a=(0,_getSelectedOperationName2.default)(o,r,i.operations),s=e.props.onEditOperationName;return s&&r!==a&&s(a),_extends({operationName:a},i)}},this.handleEditVariables=function(t){e.setState({variables:t}),e.props.onEditVariables&&e.props.onEditVariables(t)},this.handleEditOperationName=function(t){var r=e.props.onEditOperationName;r&&r(t)},this.handleHintInformationRender=function(t){t.addEventListener("click",e._onClickHintInformation);var r=void 0;t.addEventListener("DOMNodeRemoved",r=function(){t.removeEventListener("DOMNodeRemoved",r),t.removeEventListener("click",e._onClickHintInformation)})},this.handleEditorRunQuery=function(){e._runQueryAtCursor()},this._onClickHintInformation=function(t){if("typeName"===t.target.className){var r=t.target.innerHTML,o=e.state.schema;if(o){var n=o.getType(r);n&&e.setState({docExplorerOpen:!0},function(){e.docExplorerComponent.showDoc(n)})}}},this.handleToggleDocs=function(){"function"==typeof e.props.onToggleDocs&&e.props.onToggleDocs(!e.state.docExplorerOpen),e.setState({docExplorerOpen:!e.state.docExplorerOpen})},this.handleToggleHistory=function(){"function"==typeof e.props.onToggleHistory&&e.props.onToggleHistory(!e.state.historyPaneOpen),e.setState({historyPaneOpen:!e.state.historyPaneOpen})},this.handleSelectHistoryQuery=function(t,r,o){e.handleEditQuery(t),e.handleEditVariables(r),e.handleEditOperationName(o)},this.handleResizeStart=function(t){if(e._didClickDragBar(t)){t.preventDefault();var r=t.clientX-(0,_elementPosition.getLeft)(t.target),o=function(t){if(0===t.buttons)return n();var o=_reactDom2.default.findDOMNode(e.editorBarComponent),i=t.clientX-(0,_elementPosition.getLeft)(o)-r,a=o.clientWidth-i;e.setState({editorFlex:i/a})},n=function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(){document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",n),o=null,n=null});document.addEventListener("mousemove",o),document.addEventListener("mouseup",n)}},this.handleDocsResizeStart=function(t){t.preventDefault();var r=e.state.docExplorerWidth,o=t.clientX-(0,_elementPosition.getLeft)(t.target),n=function(t){if(0===t.buttons)return i();var r=_reactDom2.default.findDOMNode(e),n=t.clientX-(0,_elementPosition.getLeft)(r)-o,a=r.clientWidth-n;a<100?e.setState({docExplorerOpen:!1}):e.setState({docExplorerOpen:!0,docExplorerWidth:Math.min(a,650)})},i=function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(){e.state.docExplorerOpen||e.setState({docExplorerWidth:r}),document.removeEventListener("mousemove",n),document.removeEventListener("mouseup",i),n=null,i=null});document.addEventListener("mousemove",n),document.addEventListener("mouseup",i)},this.handleVariableResizeStart=function(t){t.preventDefault();var r=!1,o=e.state.variableEditorOpen,n=e.state.variableEditorHeight,i=t.clientY-(0,_elementPosition.getTop)(t.target),a=function(t){if(0===t.buttons)return s();r=!0;var o=_reactDom2.default.findDOMNode(e.editorBarComponent),a=t.clientY-(0,_elementPosition.getTop)(o)-i,l=o.clientHeight-a;l<60?e.setState({variableEditorOpen:!1,variableEditorHeight:n}):e.setState({variableEditorOpen:!0,variableEditorHeight:l})},s=function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(){r||e.setState({variableEditorOpen:!o}),document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",s),a=null,s=null});document.addEventListener("mousemove",a),document.addEventListener("mouseup",s)}};GraphiQL.Logo=function(e){return _react2.default.createElement("div",{className:"title"},e.children||_react2.default.createElement("span",null,"Graph",_react2.default.createElement("em",null,"i"),"QL"))},GraphiQL.Toolbar=function(e){return _react2.default.createElement("div",{className:"toolbar"},e.children)},GraphiQL.Button=_ToolbarButton.ToolbarButton,GraphiQL.ToolbarButton=_ToolbarButton.ToolbarButton,GraphiQL.Group=_ToolbarGroup.ToolbarGroup,GraphiQL.Menu=_ToolbarMenu.ToolbarMenu,GraphiQL.MenuItem=_ToolbarMenu.ToolbarMenuItem,GraphiQL.Select=_ToolbarSelect.ToolbarSelect,GraphiQL.SelectOption=_ToolbarSelect.ToolbarSelectOption,GraphiQL.Footer=function(e){return _react2.default.createElement("div",{className:"footer"},e.children)};var defaultQuery='# Welcome to GraphiQL\n#\n# GraphiQL is an in-browser tool for writing, validating, and\n# testing GraphQL queries.\n#\n# Type queries into this side of the screen, and you will see intelligent\n# typeaheads aware of the current GraphQL type schema and live syntax and\n# validation errors highlighted within the text.\n#\n# GraphQL queries typically start with a "{" character. Lines that starts\n# with a # are ignored.\n#\n# An example GraphQL query might look like:\n#\n# {\n# field(arg: "value") {\n# subField\n# }\n# }\n#\n# Keyboard shortcuts:\n#\n# Run Query: Ctrl-Enter (or press the play button above)\n#\n# Auto Complete: Ctrl-Space (or just start typing)\n#\n\n'}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utility/CodeMirrorSizer":22,"../utility/StorageAPI":24,"../utility/debounce":25,"../utility/elementPosition":26,"../utility/fillLeafs":27,"../utility/find":28,"../utility/getQueryFacts":29,"../utility/getSelectedOperationName":30,"../utility/introspectionQueries":31,"./DocExplorer":1,"./ExecuteButton":10,"./QueryEditor":13,"./QueryHistory":14,"./ResultViewer":15,"./ToolbarButton":16,"./ToolbarGroup":17,"./ToolbarMenu":18,"./ToolbarSelect":19,"./VariableEditor":20,graphql:92,"prop-types":172}],12:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(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 _inherits(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(exports,"__esModule",{value:!0});var _createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),_react2=_interopRequireDefault("undefined"!=typeof window?window.React:void 0!==global?global.React:null),_propTypes2=_interopRequireDefault(require("prop-types")),HistoryQuery=function(e){function t(e){_classCallCheck(this,t);var r=_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e)),i=r.props.favorite?"visible":"hidden";return r.state={starVisibility:i},r}return _inherits(t,e),_createClass(t,[{key:"render",value:function(){this.props.favorite&&"hidden"===this.state.starVisibility&&this.setState({starVisibility:"visible"});var e={float:"right",visibility:this.state.starVisibility},t=this.props.operationName||this.props.query.split("\n").filter(function(e){return 0!==e.indexOf("#")}).join(""),r=this.props.favorite?"★":"☆";return _react2.default.createElement("p",{onClick:this.handleClick.bind(this),onMouseEnter:this.handleMouseEnter.bind(this),onMouseLeave:this.handleMouseLeave.bind(this)},_react2.default.createElement("span",null,t),_react2.default.createElement("span",{onClick:this.handleStarClick.bind(this),style:e},r))}},{key:"handleMouseEnter",value:function(){this.props.favorite||this.setState({starVisibility:"visible"})}},{key:"handleMouseLeave",value:function(){this.props.favorite||this.setState({starVisibility:"hidden"})}},{key:"handleClick",value:function(){this.props.onSelect(this.props.query,this.props.variables,this.props.operationName)}},{key:"handleStarClick",value:function(e){e.stopPropagation(),this.props.handleToggleFavorite(this.props.query,this.props.variables,this.props.operationName,this.props.favorite)}}]),t}(_react2.default.Component);HistoryQuery.propTypes={favorite:_propTypes2.default.bool,favoriteSize:_propTypes2.default.number,handleToggleFavorite:_propTypes2.default.func,operationName:_propTypes2.default.string,onSelect:_propTypes2.default.func,query:_propTypes2.default.string,variables:_propTypes2.default.string},exports.default=HistoryQuery}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"prop-types":172}],13:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,r){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!r||"object"!=typeof r&&"function"!=typeof r?e:r}function _inherits(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(e,r):e.__proto__=r)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.QueryEditor=void 0;var _createClass=function(){function e(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(r,t,o){return t&&e(r.prototype,t),o&&e(r,o),r}}(),_react2=_interopRequireDefault("undefined"!=typeof window?window.React:void 0!==global?global.React:null),_propTypes2=_interopRequireDefault(require("prop-types")),_graphql=require("graphql"),_marked2=_interopRequireDefault(require("marked")),_normalizeWhitespace=require("../utility/normalizeWhitespace"),_onHasCompletion2=_interopRequireDefault(require("../utility/onHasCompletion")),AUTO_COMPLETE_AFTER_KEY=/^[a-zA-Z0-9_@(]$/;(exports.QueryEditor=function(e){function r(e){_classCallCheck(this,r);var t=_possibleConstructorReturn(this,(r.__proto__||Object.getPrototypeOf(r)).call(this));return t._onKeyUp=function(e,r){AUTO_COMPLETE_AFTER_KEY.test(r.key)&&t.editor.execCommand("autocomplete")},t._onEdit=function(){t.ignoreChangeEvent||(t.cachedValue=t.editor.getValue(),t.props.onEdit&&t.props.onEdit(t.cachedValue))},t._onHasCompletion=function(e,r){(0,_onHasCompletion2.default)(e,r,t.props.onHintInformationRender)},t.cachedValue=e.value||"",t}return _inherits(r,e),_createClass(r,[{key:"componentDidMount",value:function(){var e=this,r=require("codemirror");require("codemirror/addon/hint/show-hint"),require("codemirror/addon/comment/comment"),require("codemirror/addon/edit/matchbrackets"),require("codemirror/addon/edit/closebrackets"),require("codemirror/addon/fold/foldgutter"),require("codemirror/addon/fold/brace-fold"),require("codemirror/addon/lint/lint"),require("codemirror/keymap/sublime"),require("codemirror-graphql/hint"),require("codemirror-graphql/lint"),require("codemirror-graphql/info"),require("codemirror-graphql/jump"),require("codemirror-graphql/mode"),this.editor=r(this._node,{value:this.props.value||"",lineNumbers:!0,tabSize:2,mode:"graphql",theme:this.props.editorTheme||"graphiql",keyMap:"sublime",autoCloseBrackets:!0,matchBrackets:!0,showCursorWhenSelecting:!0,foldGutter:{minFoldSize:4},lint:{schema:this.props.schema},hintOptions:{schema:this.props.schema,closeOnUnfocus:!1,completeSingle:!1},info:{schema:this.props.schema,renderDescription:function(e){return(0,_marked2.default)(e,{sanitize:!0})},onClick:function(r){return e.props.onClickReference(r)}},jump:{schema:this.props.schema,onClick:function(r){return e.props.onClickReference(r)}},gutters:["CodeMirror-linenumbers","CodeMirror-foldgutter"],extraKeys:{"Cmd-Space":function(){return e.editor.showHint({completeSingle:!0})},"Ctrl-Space":function(){return e.editor.showHint({completeSingle:!0})},"Alt-Space":function(){return e.editor.showHint({completeSingle:!0})},"Shift-Space":function(){return e.editor.showHint({completeSingle:!0})},"Cmd-Enter":function(){e.props.onRunQuery&&e.props.onRunQuery()},"Ctrl-Enter":function(){e.props.onRunQuery&&e.props.onRunQuery()},"Ctrl-Left":"goSubwordLeft","Ctrl-Right":"goSubwordRight","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight"}}),this.editor.on("change",this._onEdit),this.editor.on("keyup",this._onKeyUp),this.editor.on("hasCompletion",this._onHasCompletion),this.editor.on("beforeChange",this._onBeforeChange)}},{key:"componentDidUpdate",value:function(e){var r=require("codemirror");this.ignoreChangeEvent=!0,this.props.schema!==e.schema&&(this.editor.options.lint.schema=this.props.schema,this.editor.options.hintOptions.schema=this.props.schema,this.editor.options.info.schema=this.props.schema,this.editor.options.jump.schema=this.props.schema,r.signal(this.editor,"change",this.editor)),this.props.value!==e.value&&this.props.value!==this.cachedValue&&(this.cachedValue=this.props.value,this.editor.setValue(this.props.value)),this.ignoreChangeEvent=!1}},{key:"componentWillUnmount",value:function(){this.editor.off("change",this._onEdit),this.editor.off("keyup",this._onKeyUp),this.editor.off("hasCompletion",this._onHasCompletion),this.editor=null}},{key:"render",value:function(){var e=this;return _react2.default.createElement("div",{className:"query-editor",ref:function(r){e._node=r}})}},{key:"getCodeMirror",value:function(){return this.editor}},{key:"getClientHeight",value:function(){return this._node&&this._node.clientHeight}},{key:"_onBeforeChange",value:function(e,r){if("paste"===r.origin){var t=r.text.map(_normalizeWhitespace.normalizeWhitespace);r.update(r.from,r.to,t)}}}]),r}(_react2.default.Component)).propTypes={schema:_propTypes2.default.instanceOf(_graphql.GraphQLSchema),value:_propTypes2.default.string,onEdit:_propTypes2.default.func,onHintInformationRender:_propTypes2.default.func,onClickReference:_propTypes2.default.func,onRunQuery:_propTypes2.default.func,editorTheme:_propTypes2.default.string}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utility/normalizeWhitespace":32,"../utility/onHasCompletion":33,codemirror:63,"codemirror-graphql/hint":35,"codemirror-graphql/info":36,"codemirror-graphql/jump":37,"codemirror-graphql/lint":38,"codemirror-graphql/mode":39,"codemirror/addon/comment/comment":51,"codemirror/addon/edit/closebrackets":53,"codemirror/addon/edit/matchbrackets":54,"codemirror/addon/fold/brace-fold":55,"codemirror/addon/fold/foldgutter":57,"codemirror/addon/hint/show-hint":58,"codemirror/addon/lint/lint":59,"codemirror/keymap/sublime":62,graphql:92,marked:167,"prop-types":172}],14:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(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 _inherits(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(exports,"__esModule",{value:!0}),exports.QueryHistory=void 0;var _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},_createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),_graphql=require("graphql"),_react2=_interopRequireDefault("undefined"!=typeof window?window.React:void 0!==global?global.React:null),_propTypes2=_interopRequireDefault(require("prop-types")),_QueryStore2=_interopRequireDefault(require("../utility/QueryStore")),_HistoryQuery2=_interopRequireDefault(require("./HistoryQuery")),shouldSaveQuery=function(e,t,r){if(e.queryID===t.queryID)return!1;try{(0,_graphql.parse)(e.query)}catch(e){return!1}if(!r)return!0;if(JSON.stringify(e.query)===JSON.stringify(r.query)){if(JSON.stringify(e.variables)===JSON.stringify(r.variables))return!1;if(!e.variables&&!r.variables)return!1}return!0};(exports.QueryHistory=function(e){function t(e){_classCallCheck(this,t);var r=_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));_initialiseProps.call(r),r.historyStore=new _QueryStore2.default("queries",e.storage),r.favoriteStore=new _QueryStore2.default("favorites",e.storage);var o=r.historyStore.fetchAll(),i=r.favoriteStore.fetchAll(),a=o.concat(i);return r.state={queries:a},r}return _inherits(t,e),_createClass(t,[{key:"componentWillReceiveProps",value:function(e){if(shouldSaveQuery(e,this.props,this.historyStore.fetchRecent())){var t={query:e.query,variables:e.variables,operationName:e.operationName};this.historyStore.push(t),this.historyStore.length>20&&this.historyStore.shift();var r=this.historyStore.items,o=this.favoriteStore.items,i=r.concat(o);this.setState({queries:i})}}},{key:"render",value:function(){var e=this,t=this.state.queries.slice().reverse().map(function(t,r){return _react2.default.createElement(_HistoryQuery2.default,_extends({handleToggleFavorite:e.toggleFavorite,key:r,onSelect:e.props.onSelectQuery},t))});return _react2.default.createElement("div",null,_react2.default.createElement("div",{className:"history-title-bar"},_react2.default.createElement("div",{className:"history-title"},"History"),_react2.default.createElement("div",{className:"doc-explorer-rhs"},this.props.children)),_react2.default.createElement("div",{className:"history-contents"},t))}}]),t}(_react2.default.Component)).propTypes={query:_propTypes2.default.string,variables:_propTypes2.default.string,operationName:_propTypes2.default.string,queryID:_propTypes2.default.number,onSelectQuery:_propTypes2.default.func,storage:_propTypes2.default.object};var _initialiseProps=function(){var e=this;this.toggleFavorite=function(t,r,o,i){var a={query:t,variables:r,operationName:o};e.favoriteStore.contains(a)?i&&(a.favorite=!1,e.favoriteStore.delete(a)):(a.favorite=!0,e.favoriteStore.push(a));var s=e.historyStore.items,n=e.favoriteStore.items,u=s.concat(n);e.setState({queries:u})}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utility/QueryStore":23,"./HistoryQuery":12,graphql:92,"prop-types":172}],15:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,r){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!r||"object"!=typeof r&&"function"!=typeof r?e:r}function _inherits(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(e,r):e.__proto__=r)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.ResultViewer=void 0;var _createClass=function(){function e(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(r,t,o){return t&&e(r.prototype,t),o&&e(r,o),r}}(),_react2=_interopRequireDefault("undefined"!=typeof window?window.React:void 0!==global?global.React:null),_propTypes2=_interopRequireDefault(require("prop-types"));(exports.ResultViewer=function(e){function r(){return _classCallCheck(this,r),_possibleConstructorReturn(this,(r.__proto__||Object.getPrototypeOf(r)).apply(this,arguments))}return _inherits(r,e),_createClass(r,[{key:"componentDidMount",value:function(){var e=require("codemirror");require("codemirror/addon/fold/foldgutter"),require("codemirror/addon/fold/brace-fold"),require("codemirror/addon/dialog/dialog"),require("codemirror/addon/search/search"),require("codemirror/keymap/sublime"),require("codemirror-graphql/results/mode"),this.viewer=e(this._node,{lineWrapping:!0,value:this.props.value||"",readOnly:!0,theme:this.props.editorTheme||"graphiql",mode:"graphql-results",keyMap:"sublime",foldGutter:{minFoldSize:4},gutters:["CodeMirror-foldgutter"],extraKeys:{"Ctrl-Left":"goSubwordLeft","Ctrl-Right":"goSubwordRight","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight"}})}},{key:"shouldComponentUpdate",value:function(e){return this.props.value!==e.value}},{key:"componentDidUpdate",value:function(){this.viewer.setValue(this.props.value||"")}},{key:"componentWillUnmount",value:function(){this.viewer=null}},{key:"render",value:function(){var e=this;return _react2.default.createElement("div",{className:"result-window",ref:function(r){e._node=r}})}},{key:"getCodeMirror",value:function(){return this.viewer}},{key:"getClientHeight",value:function(){return this._node&&this._node.clientHeight}}]),r}(_react2.default.Component)).propTypes={value:_propTypes2.default.string,editorTheme:_propTypes2.default.string}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{codemirror:63,"codemirror-graphql/results/mode":40,"codemirror/addon/dialog/dialog":52,"codemirror/addon/fold/brace-fold":55,"codemirror/addon/fold/foldgutter":57,"codemirror/addon/search/search":60,"codemirror/keymap/sublime":62,"prop-types":172}],16:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(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 _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function preventDefault(e){e.preventDefault()}Object.defineProperty(exports,"__esModule",{value:!0}),exports.ToolbarButton=void 0;var _createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),_react2=_interopRequireDefault("undefined"!=typeof window?window.React:void 0!==global?global.React:null),_propTypes2=_interopRequireDefault(require("prop-types"));(exports.ToolbarButton=function(e){function t(e){_classCallCheck(this,t);var r=_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.handleClick=function(e){e.preventDefault();try{r.props.onClick(),r.setState({error:null})}catch(e){r.setState({error:e})}},r.state={error:null},r}return _inherits(t,e),_createClass(t,[{key:"render",value:function(){var e=this.state.error;return _react2.default.createElement("a",{className:"toolbar-button"+(e?" error":""),onMouseDown:preventDefault,onClick:this.handleClick,title:e?e.message:this.props.title},this.props.label)}}]),t}(_react2.default.Component)).propTypes={onClick:_propTypes2.default.func,title:_propTypes2.default.string,label:_propTypes2.default.string}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"prop-types":172}],17:[function(require,module,exports){(function(global){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ToolbarGroup=function(e){var r=e.children;return _react2.default.createElement("div",{className:"toolbar-button-group"},r)};var _react2=function(e){return e&&e.__esModule?e:{default:e}}("undefined"!=typeof window?window.React:void 0!==global?global.React:null)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],18:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(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 _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function ToolbarMenuItem(e){var t=e.onSelect,n=e.title,r=e.label;return _react2.default.createElement("li",{onMouseOver:function(e){e.target.className="hover"},onMouseOut:function(e){e.target.className=null},onMouseDown:preventDefault,onMouseUp:t,title:n},r)}function preventDefault(e){e.preventDefault()}Object.defineProperty(exports,"__esModule",{value:!0}),exports.ToolbarMenu=void 0;var _createClass=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}}();exports.ToolbarMenuItem=ToolbarMenuItem;var _react2=_interopRequireDefault("undefined"!=typeof window?window.React:void 0!==global?global.React:null),_propTypes2=_interopRequireDefault(require("prop-types"));(exports.ToolbarMenu=function(e){function t(e){_classCallCheck(this,t);var n=_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.handleOpen=function(e){preventDefault(e),n.setState({visible:!0}),n._subscribe()},n.state={visible:!1},n}return _inherits(t,e),_createClass(t,[{key:"componentWillUnmount",value:function(){this._release()}},{key:"render",value:function(){var e=this,t=this.state.visible;return _react2.default.createElement("a",{className:"toolbar-menu toolbar-button",onClick:this.handleOpen.bind(this),onMouseDown:preventDefault,ref:function(t){e._node=t},title:this.props.title},this.props.label,_react2.default.createElement("svg",{width:"14",height:"8"},_react2.default.createElement("path",{fill:"#666",d:"M 5 1.5 L 14 1.5 L 9.5 7 z"})),_react2.default.createElement("ul",{className:"toolbar-menu-items"+(t?" open":"")},this.props.children))}},{key:"_subscribe",value:function(){this._listener||(this._listener=this.handleClick.bind(this),document.addEventListener("click",this._listener))}},{key:"_release",value:function(){this._listener&&(document.removeEventListener("click",this._listener),this._listener=null)}},{key:"handleClick",value:function(e){this._node!==e.target&&(preventDefault(e),this.setState({visible:!1}),this._release())}}]),t}(_react2.default.Component)).propTypes={title:_propTypes2.default.string,label:_propTypes2.default.string},ToolbarMenuItem.propTypes={onSelect:_propTypes2.default.func,title:_propTypes2.default.string,label:_propTypes2.default.string}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"prop-types":172}],19:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(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 _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function ToolbarSelectOption(e){var t=e.onSelect,r=e.label,n=e.selected;return _react2.default.createElement("li",{onMouseOver:function(e){e.target.className="hover"},onMouseOut:function(e){e.target.className=null},onMouseDown:preventDefault,onMouseUp:t},r,n&&_react2.default.createElement("svg",{width:"13",height:"13"},_react2.default.createElement("polygon",{points:"4.851,10.462 0,5.611 2.314,3.297 4.851,5.835 10.686,0 13,2.314 4.851,10.462"})))}function preventDefault(e){e.preventDefault()}Object.defineProperty(exports,"__esModule",{value:!0}),exports.ToolbarSelect=void 0;var _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},_createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();exports.ToolbarSelectOption=ToolbarSelectOption;var _react2=_interopRequireDefault("undefined"!=typeof window?window.React:void 0!==global?global.React:null),_propTypes2=_interopRequireDefault(require("prop-types"));(exports.ToolbarSelect=function(e){function t(e){_classCallCheck(this,t);var r=_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.handleOpen=function(e){preventDefault(e),r.setState({visible:!0}),r._subscribe()},r.state={visible:!1},r}return _inherits(t,e),_createClass(t,[{key:"componentWillUnmount",value:function(){this._release()}},{key:"render",value:function(){var e=this,t=void 0,r=this.state.visible,n=_react2.default.Children.map(this.props.children,function(r,n){t&&!r.props.selected||(t=r);var o=r.props.onSelect||e.props.onSelect&&e.props.onSelect.bind(null,r.props.value,n);return _react2.default.createElement(ToolbarSelectOption,_extends({},r.props,{onSelect:o}))});return _react2.default.createElement("a",{className:"toolbar-select toolbar-button",onClick:this.handleOpen.bind(this),onMouseDown:preventDefault,ref:function(t){e._node=t},title:this.props.title},t.props.label,_react2.default.createElement("svg",{width:"13",height:"10"},_react2.default.createElement("path",{fill:"#666",d:"M 5 5 L 13 5 L 9 1 z"}),_react2.default.createElement("path",{fill:"#666",d:"M 5 6 L 13 6 L 9 10 z"})),_react2.default.createElement("ul",{className:"toolbar-select-options"+(r?" open":"")},n))}},{key:"_subscribe",value:function(){this._listener||(this._listener=this.handleClick.bind(this),document.addEventListener("click",this._listener))}},{key:"_release",value:function(){this._listener&&(document.removeEventListener("click",this._listener),this._listener=null)}},{key:"handleClick",value:function(e){this._node!==e.target&&(preventDefault(e),this.setState({visible:!1}),this._release())}}]),t}(_react2.default.Component)).propTypes={title:_propTypes2.default.string,label:_propTypes2.default.string,onSelect:_propTypes2.default.func},ToolbarSelectOption.propTypes={onSelect:_propTypes2.default.func,selected:_propTypes2.default.bool,label:_propTypes2.default.string,value:_propTypes2.default.any}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"prop-types":172}],20:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(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 _inherits(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(exports,"__esModule",{value:!0}),exports.VariableEditor=void 0;var _createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),_react2=_interopRequireDefault("undefined"!=typeof window?window.React:void 0!==global?global.React:null),_propTypes2=_interopRequireDefault(require("prop-types")),_onHasCompletion2=_interopRequireDefault(require("../utility/onHasCompletion"));(exports.VariableEditor=function(e){function t(e){_classCallCheck(this,t);var r=_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return r._onKeyUp=function(e,t){var o=t.keyCode;(o>=65&&o<=90||!t.shiftKey&&o>=48&&o<=57||t.shiftKey&&189===o||t.shiftKey&&222===o)&&r.editor.execCommand("autocomplete")},r._onEdit=function(){r.ignoreChangeEvent||(r.cachedValue=r.editor.getValue(),r.props.onEdit&&r.props.onEdit(r.cachedValue))},r._onHasCompletion=function(e,t){(0,_onHasCompletion2.default)(e,t,r.props.onHintInformationRender)},r.cachedValue=e.value||"",r}return _inherits(t,e),_createClass(t,[{key:"componentDidMount",value:function(){var e=this,t=require("codemirror");require("codemirror/addon/hint/show-hint"),require("codemirror/addon/edit/matchbrackets"),require("codemirror/addon/edit/closebrackets"),require("codemirror/addon/fold/brace-fold"),require("codemirror/addon/fold/foldgutter"),require("codemirror/addon/lint/lint"),require("codemirror/keymap/sublime"),require("codemirror-graphql/variables/hint"),require("codemirror-graphql/variables/lint"),require("codemirror-graphql/variables/mode"),this.editor=t(this._node,{value:this.props.value||"",lineNumbers:!0,tabSize:2,mode:"graphql-variables",theme:this.props.editorTheme||"graphiql",keyMap:"sublime",autoCloseBrackets:!0,matchBrackets:!0,showCursorWhenSelecting:!0,foldGutter:{minFoldSize:4},lint:{variableToType:this.props.variableToType},hintOptions:{variableToType:this.props.variableToType},gutters:["CodeMirror-linenumbers","CodeMirror-foldgutter"],extraKeys:{"Cmd-Space":function(){return e.editor.showHint({completeSingle:!1})},"Ctrl-Space":function(){return e.editor.showHint({completeSingle:!1})},"Alt-Space":function(){return e.editor.showHint({completeSingle:!1})},"Shift-Space":function(){return e.editor.showHint({completeSingle:!1})},"Cmd-Enter":function(){e.props.onRunQuery&&e.props.onRunQuery()},"Ctrl-Enter":function(){e.props.onRunQuery&&e.props.onRunQuery()},"Ctrl-Left":"goSubwordLeft","Ctrl-Right":"goSubwordRight","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight"}}),this.editor.on("change",this._onEdit),this.editor.on("keyup",this._onKeyUp),this.editor.on("hasCompletion",this._onHasCompletion)}},{key:"componentDidUpdate",value:function(e){var t=require("codemirror");this.ignoreChangeEvent=!0,this.props.variableToType!==e.variableToType&&(this.editor.options.lint.variableToType=this.props.variableToType,this.editor.options.hintOptions.variableToType=this.props.variableToType,t.signal(this.editor,"change",this.editor)),this.props.value!==e.value&&this.props.value!==this.cachedValue&&(this.cachedValue=this.props.value,this.editor.setValue(this.props.value)),this.ignoreChangeEvent=!1}},{key:"componentWillUnmount",value:function(){this.editor.off("change",this._onEdit),this.editor.off("keyup",this._onKeyUp),this.editor.off("hasCompletion",this._onHasCompletion),this.editor=null}},{key:"render",value:function(){var e=this;return _react2.default.createElement("div",{className:"codemirrorWrap",ref:function(t){e._node=t}})}},{key:"getCodeMirror",value:function(){return this.editor}},{key:"getClientHeight",value:function(){return this._node&&this._node.clientHeight}}]),t}(_react2.default.Component)).propTypes={variableToType:_propTypes2.default.object,value:_propTypes2.default.string,onEdit:_propTypes2.default.func,onHintInformationRender:_propTypes2.default.func,onRunQuery:_propTypes2.default.func,editorTheme:_propTypes2.default.string}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utility/onHasCompletion":33,codemirror:63,"codemirror-graphql/variables/hint":48,"codemirror-graphql/variables/lint":49,"codemirror-graphql/variables/mode":50,"codemirror/addon/edit/closebrackets":53,"codemirror/addon/edit/matchbrackets":54,"codemirror/addon/fold/brace-fold":55,"codemirror/addon/fold/foldgutter":57,"codemirror/addon/hint/show-hint":58,"codemirror/addon/lint/lint":59,"codemirror/keymap/sublime":62,"prop-types":172}],21:[function(require,module,exports){"use strict";module.exports=require("./components/GraphiQL").GraphiQL},{"./components/GraphiQL":11}],22:[function(require,module,exports){"use strict";function _classCallCheck(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),CodeMirrorSizer=function(){function e(){_classCallCheck(this,e),this.sizes=[]}return _createClass(e,[{key:"updateSizes",value:function(e){var r=this;e.forEach(function(e,t){var n=e.getClientHeight();t<=r.sizes.length&&n!==r.sizes[t]&&e.getCodeMirror().setSize(),r.sizes[t]=n})}}]),e}();exports.default=CodeMirrorSizer},{}],23:[function(require,module,exports){"use strict";function _defineProperty(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),QueryStore=function(){function e(t,i){_classCallCheck(this,e),this.key=t,this.storage=i,this.items=this.fetchAll()}return _createClass(e,[{key:"contains",value:function(e){return this.items.some(function(t){return t.query===e.query&&t.variables===e.variables&&t.operationName===e.operationName})}},{key:"delete",value:function(e){var t=this.items.findIndex(function(t){return t.query===e.query&&t.variables===e.variables&&t.operationName===e.operationName});-1!==t&&(this.items.splice(t,1),this.save())}},{key:"fetchRecent",value:function(){return this.items[this.items.length-1]}},{key:"fetchAll",value:function(){var e=this.storage.get(this.key);return e?JSON.parse(e)[this.key]:[]}},{key:"push",value:function(e){this.items.push(e),this.save()}},{key:"shift",value:function(){this.items.shift(),this.save()}},{key:"save",value:function(){this.storage.set(this.key,JSON.stringify(_defineProperty({},this.key,this.items)))}},{key:"length",get:function(){return this.items.length}}]),e}();exports.default=QueryStore},{}],24:[function(require,module,exports){"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function isStorageAvailable(e,t,r){try{return e.setItem(t,r),!0}catch(t){return t instanceof DOMException&&(22===t.code||1014===t.code||"QuotaExceededError"===t.name||"NS_ERROR_DOM_QUOTA_REACHED"===t.name)&&0!==e.length}}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),StorageAPI=function(){function e(t){_classCallCheck(this,e),this.storage=t||window.localStorage}return _createClass(e,[{key:"get",value:function(e){if(this.storage){var t=this.storage.getItem("graphiql:"+e);if("null"!==t&&"undefined"!==t)return t;this.storage.removeItem("graphiql:"+e)}}},{key:"set",value:function(e,t){if(this.storage){var r="graphiql:"+e;t?isStorageAvailable(this.storage,r,t)&&this.storage.setItem(r,t):this.storage.removeItem(r)}}}]),e}();exports.default=StorageAPI},{}],25:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(e,t){var u=void 0;return function(){var o=this,n=arguments;clearTimeout(u),u=setTimeout(function(){u=null,t.apply(o,n)},e)}}},{}],26:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getLeft=function(e){for(var t=0,f=e;f.offsetParent;)t+=f.offsetLeft,f=f.offsetParent;return t},exports.getTop=function(e){for(var t=0,f=e;f.offsetParent;)t+=f.offsetTop,f=f.offsetParent;return t}},{}],27:[function(require,module,exports){"use strict";function defaultGetDefaultFieldNames(e){if(!e.getFields)return[];var t=e.getFields();if(t.id)return["id"];if(t.edges)return["edges"];if(t.node)return["node"];var r=[];return Object.keys(t).forEach(function(e){(0,_graphql.isLeafType)(t[e].type)&&r.push(e)}),r}function buildSelectionSet(e,t){var r=(0,_graphql.getNamedType)(e);if(e&&!(0,_graphql.isLeafType)(e)){var n=t(r);if(Array.isArray(n)&&0!==n.length)return{kind:"SelectionSet",selections:n.map(function(e){var n=r.getFields()[e];return{kind:"Field",name:{kind:"Name",value:e},selectionSet:buildSelectionSet(n?n.type:null,t)}})}}}function withInsertions(e,t){if(0===t.length)return e;var r="",n=0;return t.forEach(function(t){var i=t.index,a=t.string;r+=e.slice(n,i)+a,n=i}),r+=e.slice(n)}function getIndentation(e,t){for(var r=t,n=t;r;){var i=e.charCodeAt(r-1);if(10===i||13===i||8232===i||8233===i)break;r--,9!==i&&11!==i&&12!==i&&32!==i&&160!==i&&(n=r)}return e.substring(r,n)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.fillLeafs=function(e,t,r){var n=[];if(!e)return{insertions:n,result:t};var i=void 0;try{i=(0,_graphql.parse)(t)}catch(e){return{insertions:n,result:t}}var a=r||defaultGetDefaultFieldNames,l=new _graphql.TypeInfo(e);return(0,_graphql.visit)(i,{leave:function(e){l.leave(e)},enter:function(e){if(l.enter(e),"Field"===e.kind&&!e.selectionSet){var r=buildSelectionSet(l.getType(),a);if(r){var i=getIndentation(t,e.loc.start);n.push({index:e.loc.end,string:" "+(0,_graphql.print)(r).replace(/\n/g,"\n"+i)})}}}}),{insertions:n,result:withInsertions(t,n)}};var _graphql=require("graphql")},{graphql:92}],28:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(e,t){for(var r=0;r<e.length;r++)if(t(e[r]))return e[r]}},{}],29:[function(require,module,exports){"use strict";function collectVariables(e,r){var a=Object.create(null);return r.definitions.forEach(function(r){if("OperationDefinition"===r.kind){var i=r.variableDefinitions;i&&i.forEach(function(r){var i=r.variable,t=r.type,n=(0,_graphql.typeFromAST)(e,t);n&&(a[i.name.value]=n)})}}),a}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(e,r){if(r){var a=void 0;try{a=(0,_graphql.parse)(r)}catch(e){return}var i=e?collectVariables(e,a):null,t=[];return a.definitions.forEach(function(e){"OperationDefinition"===e.kind&&t.push(e)}),{variableToType:i,operations:t}}},exports.collectVariables=collectVariables;var _graphql=require("graphql")},{graphql:92}],30:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(e,t,n){if(n&&!(n.length<1)){var r=n.map(function(e){return e.name&&e.name.value});if(t&&-1!==r.indexOf(t))return t;if(t&&e){var a=e.map(function(e){return e.name&&e.name.value}).indexOf(t);if(-1!==a&&a<r.length)return r[a]}return r[0]}}},{}],31:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _graphql=require("graphql");Object.defineProperty(exports,"introspectionQuery",{enumerable:!0,get:function(){return _graphql.introspectionQuery}});exports.introspectionQuerySansSubscriptions="\n query IntrospectionQuery {\n __schema {\n queryType { name }\n mutationType { name }\n types {\n ...FullType\n }\n directives {\n name\n description\n locations\n args {\n ...InputValue\n }\n }\n }\n }\n\n fragment FullType on __Type {\n kind\n name\n description\n fields(includeDeprecated: true) {\n name\n description\n args {\n ...InputValue\n }\n type {\n ...TypeRef\n }\n isDeprecated\n deprecationReason\n }\n inputFields {\n ...InputValue\n }\n interfaces {\n ...TypeRef\n }\n enumValues(includeDeprecated: true) {\n name\n description\n isDeprecated\n deprecationReason\n }\n possibleTypes {\n ...TypeRef\n }\n }\n\n fragment InputValue on __InputValue {\n name\n description\n type { ...TypeRef }\n defaultValue\n }\n\n fragment TypeRef on __Type {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n }\n }\n }\n }\n }\n }\n }\n }\n"},{graphql:92}],32:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.normalizeWhitespace=function(e){return e.replace(sanitizeRegex," ")};var invalidCharacters=exports.invalidCharacters=Array.from({length:11},function(e,r){return String.fromCharCode(8192+r)}).concat(["\u2028","\u2029"," "]),sanitizeRegex=new RegExp("["+invalidCharacters.join("|")+"]","g")},{}],33:[function(require,module,exports){"use strict";function renderType(e){return e instanceof _graphql.GraphQLNonNull?renderType(e.ofType)+"!":e instanceof _graphql.GraphQLList?"["+renderType(e.ofType)+"]":'<a class="typeName">'+e.name+"</a>"}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(e,r,n){var a=void 0,i=void 0;require("codemirror").on(r,"select",function(e,r){if(!a){var t=r.parentNode;(a=document.createElement("div")).className="CodeMirror-hint-information",t.appendChild(a),(i=document.createElement("div")).className="CodeMirror-hint-deprecation",t.appendChild(i);var o=void 0;t.addEventListener("DOMNodeRemoved",o=function(e){e.target===t&&(t.removeEventListener("DOMNodeRemoved",o),a=null,i=null,o=null)})}var d=e.description?(0,_marked2.default)(e.description,{sanitize:!0}):"Self descriptive.",l=e.type?'<span class="infoType">'+renderType(e.type)+"</span>":"";if(a.innerHTML='<div class="content">'+("<p>"===d.slice(0,3)?"<p>"+l+d.slice(3):l+d)+"</div>",e.isDeprecated){var p=e.deprecationReason?(0,_marked2.default)(e.deprecationReason,{sanitize:!0}):"";i.innerHTML='<span class="deprecation-label">Deprecated</span>'+p,i.style.display="block"}else i.style.display="none";n&&n(a)})};var _graphql=require("graphql"),_marked2=function(e){return e&&e.__esModule?e:{default:e}}(require("marked"))},{codemirror:63,graphql:92,marked:167}],34:[function(require,module,exports){(function(global){"use strict";function compare(a,b){if(a===b)return 0;for(var x=a.length,y=b.length,i=0,len=Math.min(x,y);i<len;++i)if(a[i]!==b[i]){x=a[i],y=b[i];break}return x<y?-1:y<x?1:0}function isBuffer(b){return global.Buffer&&"function"==typeof global.Buffer.isBuffer?global.Buffer.isBuffer(b):!(null==b||!b._isBuffer)}function pToString(obj){return Object.prototype.toString.call(obj)}function isView(arrbuf){return!isBuffer(arrbuf)&&("function"==typeof global.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(arrbuf):!!arrbuf&&(arrbuf instanceof DataView||!!(arrbuf.buffer&&arrbuf.buffer instanceof ArrayBuffer))))}function getName(func){if(util.isFunction(func)){if(functionsHaveNames)return func.name;var match=func.toString().match(regex);return match&&match[1]}}function truncate(s,n){return"string"==typeof s?s.length<n?s:s.slice(0,n):s}function inspect(something){if(functionsHaveNames||!util.isFunction(something))return util.inspect(something);var rawname=getName(something);return"[Function"+(rawname?": "+rawname:"")+"]"}function getMessage(self){return truncate(inspect(self.actual),128)+" "+self.operator+" "+truncate(inspect(self.expected),128)}function fail(actual,expected,message,operator,stackStartFunction){throw new assert.AssertionError({message:message,actual:actual,expected:expected,operator:operator,stackStartFunction:stackStartFunction})}function ok(value,message){value||fail(value,!0,message,"==",assert.ok)}function _deepEqual(actual,expected,strict,memos){if(actual===expected)return!0;if(isBuffer(actual)&&isBuffer(expected))return 0===compare(actual,expected);if(util.isDate(actual)&&util.isDate(expected))return actual.getTime()===expected.getTime();if(util.isRegExp(actual)&&util.isRegExp(expected))return actual.source===expected.source&&actual.global===expected.global&&actual.multiline===expected.multiline&&actual.lastIndex===expected.lastIndex&&actual.ignoreCase===expected.ignoreCase;if(null!==actual&&"object"==typeof actual||null!==expected&&"object"==typeof expected){if(isView(actual)&&isView(expected)&&pToString(actual)===pToString(expected)&&!(actual instanceof Float32Array||actual instanceof Float64Array))return 0===compare(new Uint8Array(actual.buffer),new Uint8Array(expected.buffer));if(isBuffer(actual)!==isBuffer(expected))return!1;var actualIndex=(memos=memos||{actual:[],expected:[]}).actual.indexOf(actual);return-1!==actualIndex&&actualIndex===memos.expected.indexOf(expected)||(memos.actual.push(actual),memos.expected.push(expected),objEquiv(actual,expected,strict,memos))}return strict?actual===expected:actual==expected}function isArguments(object){return"[object Arguments]"==Object.prototype.toString.call(object)}function objEquiv(a,b,strict,actualVisitedObjects){if(null===a||void 0===a||null===b||void 0===b)return!1;if(util.isPrimitive(a)||util.isPrimitive(b))return a===b;if(strict&&Object.getPrototypeOf(a)!==Object.getPrototypeOf(b))return!1;var aIsArgs=isArguments(a),bIsArgs=isArguments(b);if(aIsArgs&&!bIsArgs||!aIsArgs&&bIsArgs)return!1;if(aIsArgs)return a=pSlice.call(a),b=pSlice.call(b),_deepEqual(a,b,strict);var key,i,ka=objectKeys(a),kb=objectKeys(b);if(ka.length!==kb.length)return!1;for(ka.sort(),kb.sort(),i=ka.length-1;i>=0;i--)if(ka[i]!==kb[i])return!1;for(i=ka.length-1;i>=0;i--)if(key=ka[i],!_deepEqual(a[key],b[key],strict,actualVisitedObjects))return!1;return!0}function notDeepStrictEqual(actual,expected,message){_deepEqual(actual,expected,!0)&&fail(actual,expected,message,"notDeepStrictEqual",notDeepStrictEqual)}function expectedException(actual,expected){if(!actual||!expected)return!1;if("[object RegExp]"==Object.prototype.toString.call(expected))return expected.test(actual);try{if(actual instanceof expected)return!0}catch(e){}return!Error.isPrototypeOf(expected)&&!0===expected.call({},actual)}function _tryBlock(block){var error;try{block()}catch(e){error=e}return error}function _throws(shouldThrow,block,expected,message){var actual;if("function"!=typeof block)throw new TypeError('"block" argument must be a function');"string"==typeof expected&&(message=expected,expected=null),actual=_tryBlock(block),message=(expected&&expected.name?" ("+expected.name+").":".")+(message?" "+message:"."),shouldThrow&&!actual&&fail(actual,expected,"Missing expected exception"+message);var userProvidedMessage="string"==typeof message,isUnwantedException=!shouldThrow&&util.isError(actual),isUnexpectedException=!shouldThrow&&actual&&!expected;if((isUnwantedException&&userProvidedMessage&&expectedException(actual,expected)||isUnexpectedException)&&fail(actual,expected,"Got unwanted exception"+message),shouldThrow&&actual&&expected&&!expectedException(actual,expected)||!shouldThrow&&actual)throw actual}var util=require("util/"),hasOwn=Object.prototype.hasOwnProperty,pSlice=Array.prototype.slice,functionsHaveNames="foo"===function(){}.name,assert=module.exports=ok,regex=/\s*function\s+([^\(\s]*)\s*/;assert.AssertionError=function(options){this.name="AssertionError",this.actual=options.actual,this.expected=options.expected,this.operator=options.operator,options.message?(this.message=options.message,this.generatedMessage=!1):(this.message=getMessage(this),this.generatedMessage=!0);var stackStartFunction=options.stackStartFunction||fail;if(Error.captureStackTrace)Error.captureStackTrace(this,stackStartFunction);else{var err=new Error;if(err.stack){var out=err.stack,fn_name=getName(stackStartFunction),idx=out.indexOf("\n"+fn_name);if(idx>=0){var next_line=out.indexOf("\n",idx+1);out=out.substring(next_line+1)}this.stack=out}}},util.inherits(assert.AssertionError,Error),assert.fail=fail,assert.ok=ok,assert.equal=function(actual,expected,message){actual!=expected&&fail(actual,expected,message,"==",assert.equal)},assert.notEqual=function(actual,expected,message){actual==expected&&fail(actual,expected,message,"!=",assert.notEqual)},assert.deepEqual=function(actual,expected,message){_deepEqual(actual,expected,!1)||fail(actual,expected,message,"deepEqual",assert.deepEqual)},assert.deepStrictEqual=function(actual,expected,message){_deepEqual(actual,expected,!0)||fail(actual,expected,message,"deepStrictEqual",assert.deepStrictEqual)},assert.notDeepEqual=function(actual,expected,message){_deepEqual(actual,expected,!1)&&fail(actual,expected,message,"notDeepEqual",assert.notDeepEqual)},assert.notDeepStrictEqual=notDeepStrictEqual,assert.strictEqual=function(actual,expected,message){actual!==expected&&fail(actual,expected,message,"===",assert.strictEqual)},assert.notStrictEqual=function(actual,expected,message){actual===expected&&fail(actual,expected,message,"!==",assert.notStrictEqual)},assert.throws=function(block,error,message){_throws(!0,block,error,message)},assert.doesNotThrow=function(block,error,message){_throws(!1,block,error,message)},assert.ifError=function(err){if(err)throw err};var objectKeys=Object.keys||function(obj){var keys=[];for(var key in obj)hasOwn.call(obj,key)&&keys.push(key);return keys}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"util/":176}],35:[function(require,module,exports){"use strict";var _codemirror2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(require("codemirror")),_graphqlLanguageServiceInterface=require("graphql-language-service-interface");_codemirror2.default.registerHelper("hint","graphql",function(editor,options){var schema=options.schema;if(schema){var cur=editor.getCursor(),token=editor.getTokenAt(cur),rawResults=(0,_graphqlLanguageServiceInterface.getAutocompleteSuggestions)(schema,editor.getValue(),cur,token),tokenStart=null!==token.type&&/"|\w/.test(token.string[0])?token.start:token.end,results={list:rawResults.map(function(item){return{text:item.label,type:schema.getType(item.detail),description:item.documentation,isDeprecated:item.isDeprecated,deprecationReason:item.deprecationReason}}),from:{line:cur.line,column:tokenStart},to:{line:cur.line,column:token.end}};return results&&results.list&&results.list.length>0&&(results.from=_codemirror2.default.Pos(results.from.line,results.from.column),results.to=_codemirror2.default.Pos(results.to.line,results.to.column),_codemirror2.default.signal(editor,"hasCompletion",editor,results,token)),results}})},{codemirror:63,"graphql-language-service-interface":73}],36:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function renderField(into,typeInfo,options){renderQualifiedField(into,typeInfo,options),renderTypeAnnotation(into,typeInfo,options,typeInfo.type)}function renderQualifiedField(into,typeInfo,options){var fieldName=typeInfo.fieldDef.name;"__"!==fieldName.slice(0,2)&&(renderType(into,typeInfo,options,typeInfo.parentType),text(into,".")),text(into,fieldName,"field-name",options,(0,_SchemaReference.getFieldReference)(typeInfo))}function renderDirective(into,typeInfo,options){text(into,"@"+typeInfo.directiveDef.name,"directive-name",options,(0,_SchemaReference.getDirectiveReference)(typeInfo))}function renderArg(into,typeInfo,options){typeInfo.directiveDef?renderDirective(into,typeInfo,options):typeInfo.fieldDef&&renderQualifiedField(into,typeInfo,options);var name=typeInfo.argDef.name;text(into,"("),text(into,name,"arg-name",options,(0,_SchemaReference.getArgumentReference)(typeInfo)),renderTypeAnnotation(into,typeInfo,options,typeInfo.inputType),text(into,")")}function renderTypeAnnotation(into,typeInfo,options,t){text(into,": "),renderType(into,typeInfo,options,t)}function renderEnumValue(into,typeInfo,options){var name=typeInfo.enumValue.name;renderType(into,typeInfo,options,typeInfo.inputType),text(into,"."),text(into,name,"enum-value",options,(0,_SchemaReference.getEnumValueReference)(typeInfo))}function renderType(into,typeInfo,options,t){t instanceof _graphql.GraphQLNonNull?(renderType(into,typeInfo,options,t.ofType),text(into,"!")):t instanceof _graphql.GraphQLList?(text(into,"["),renderType(into,typeInfo,options,t.ofType),text(into,"]")):text(into,t.name,"type-name",options,(0,_SchemaReference.getTypeReference)(typeInfo,t))}function renderDescription(into,options,def){var description=def.description;if(description){var descriptionDiv=document.createElement("div");descriptionDiv.className="info-description",options.renderDescription?descriptionDiv.innerHTML=options.renderDescription(description):descriptionDiv.appendChild(document.createTextNode(description)),into.appendChild(descriptionDiv)}renderDeprecation(into,options,def)}function renderDeprecation(into,options,def){var reason=def.deprecationReason;if(reason){var deprecationDiv=document.createElement("div");deprecationDiv.className="info-deprecation",options.renderDescription?deprecationDiv.innerHTML=options.renderDescription(reason):deprecationDiv.appendChild(document.createTextNode(reason));var label=document.createElement("span");label.className="info-deprecation-label",label.appendChild(document.createTextNode("Deprecated: ")),deprecationDiv.insertBefore(label,deprecationDiv.firstChild),into.appendChild(deprecationDiv)}}function text(into,content,className,options,ref){if(className){var onClick=options.onClick,node=document.createElement(onClick?"a":"span");onClick&&(node.href="javascript:void 0",node.addEventListener("click",function(e){onClick(ref,e)})),node.className=className,node.appendChild(document.createTextNode(content)),into.appendChild(node)}else into.appendChild(document.createTextNode(content))}var _graphql=require("graphql"),_codemirror2=_interopRequireDefault(require("codemirror")),_getTypeInfo2=_interopRequireDefault(require("./utils/getTypeInfo")),_SchemaReference=require("./utils/SchemaReference");require("./utils/info-addon"),_codemirror2.default.registerHelper("info","graphql",function(token,options){if(options.schema&&token.state){var state=token.state,kind=state.kind,step=state.step,typeInfo=(0,_getTypeInfo2.default)(options.schema,token.state);if("Field"===kind&&0===step&&typeInfo.fieldDef||"AliasedField"===kind&&2===step&&typeInfo.fieldDef){var into=document.createElement("div");return renderField(into,typeInfo,options),renderDescription(into,options,typeInfo.fieldDef),into}if("Directive"===kind&&1===step&&typeInfo.directiveDef){var _into=document.createElement("div");return renderDirective(_into,typeInfo,options),renderDescription(_into,options,typeInfo.directiveDef),_into}if("Argument"===kind&&0===step&&typeInfo.argDef){var _into2=document.createElement("div");return renderArg(_into2,typeInfo,options),renderDescription(_into2,options,typeInfo.argDef),_into2}if("EnumValue"===kind&&typeInfo.enumValue&&typeInfo.enumValue.description){var _into3=document.createElement("div");return renderEnumValue(_into3,typeInfo,options),renderDescription(_into3,options,typeInfo.enumValue),_into3}if("NamedType"===kind&&typeInfo.type&&typeInfo.type.description){var _into4=document.createElement("div");return renderType(_into4,typeInfo,options,typeInfo.type),renderDescription(_into4,options,typeInfo.type),_into4}}})},{"./utils/SchemaReference":41,"./utils/getTypeInfo":43,"./utils/info-addon":45,codemirror:63,graphql:92}],37:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var _codemirror2=_interopRequireDefault(require("codemirror")),_getTypeInfo2=_interopRequireDefault(require("./utils/getTypeInfo")),_SchemaReference=require("./utils/SchemaReference");require("./utils/jump-addon"),_codemirror2.default.registerHelper("jump","graphql",function(token,options){if(options.schema&&options.onClick&&token.state){var state=token.state,kind=state.kind,step=state.step,typeInfo=(0,_getTypeInfo2.default)(options.schema,state);return"Field"===kind&&0===step&&typeInfo.fieldDef||"AliasedField"===kind&&2===step&&typeInfo.fieldDef?(0,_SchemaReference.getFieldReference)(typeInfo):"Directive"===kind&&1===step&&typeInfo.directiveDef?(0,_SchemaReference.getDirectiveReference)(typeInfo):"Argument"===kind&&0===step&&typeInfo.argDef?(0,_SchemaReference.getArgumentReference)(typeInfo):"EnumValue"===kind&&typeInfo.enumValue?(0,_SchemaReference.getEnumValueReference)(typeInfo):"NamedType"===kind&&typeInfo.type?(0,_SchemaReference.getTypeReference)(typeInfo):void 0}})},{"./utils/SchemaReference":41,"./utils/getTypeInfo":43,"./utils/jump-addon":47,codemirror:63}],38:[function(require,module,exports){"use strict";var _codemirror2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(require("codemirror")),_graphqlLanguageServiceInterface=require("graphql-language-service-interface"),SEVERITY=["error","warning","information","hint"],TYPE={"GraphQL: Validation":"validation","GraphQL: Deprecation":"deprecation","GraphQL: Syntax":"syntax"};_codemirror2.default.registerHelper("lint","graphql",function(text,options){var schema=options.schema;return(0,_graphqlLanguageServiceInterface.getDiagnostics)(text,schema).map(function(error){return{message:error.message,severity:SEVERITY[error.severity-1],type:TYPE[error.source],from:_codemirror2.default.Pos(error.range.start.line,error.range.start.character),to:_codemirror2.default.Pos(error.range.end.line,error.range.end.character)}})})},{codemirror:63,"graphql-language-service-interface":73}],39:[function(require,module,exports){"use strict";function indent(state,textAfter){var levels=state.levels;return(levels&&0!==levels.length?levels[levels.length-1]-(this.electricInput.test(textAfter)?1:0):state.indentLevel)*this.config.indentUnit}var _codemirror2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(require("codemirror")),_graphqlLanguageServiceParser=require("graphql-language-service-parser");_codemirror2.default.defineMode("graphql",function(config){var parser=(0,_graphqlLanguageServiceParser.onlineParser)({eatWhitespace:function(stream){return stream.eatWhile(_graphqlLanguageServiceParser.isIgnored)},lexRules:_graphqlLanguageServiceParser.LexRules,parseRules:_graphqlLanguageServiceParser.ParseRules,editorConfig:{tabSize:config.tabSize}});return{config:config,startState:parser.startState,token:parser.token,indent:indent,electricInput:/^\s*[})\]]/,fold:"brace",lineComment:"#",closeBrackets:{pairs:'()[]{}""',explode:"()[]{}"}}})},{codemirror:63,"graphql-language-service-parser":77}],40:[function(require,module,exports){"use strict";function indent(state,textAfter){var levels=state.levels;return(levels&&0!==levels.length?levels[levels.length-1]-(this.electricInput.test(textAfter)?1:0):state.indentLevel)*this.config.indentUnit}var _codemirror2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(require("codemirror")),_graphqlLanguageServiceParser=require("graphql-language-service-parser");_codemirror2.default.defineMode("graphql-results",function(config){var parser=(0,_graphqlLanguageServiceParser.onlineParser)({eatWhitespace:function(stream){return stream.eatSpace()},lexRules:LexRules,parseRules:ParseRules,editorConfig:{tabSize:config.tabSize}});return{config:config,startState:parser.startState,token:parser.token,indent:indent,electricInput:/^\s*[}\]]/,fold:"brace",closeBrackets:{pairs:'[]{}""',explode:"[]{}"}}});var LexRules={Punctuation:/^\[|]|\{|\}|:|,/,Number:/^-?(?:0|(?:[1-9][0-9]*))(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?/,String:/^"(?:[^"\\]|\\(?:"|\/|\\|b|f|n|r|t|u[0-9a-fA-F]{4}))*"?/,Keyword:/^true|false|null/},ParseRules={Document:[(0,_graphqlLanguageServiceParser.p)("{"),(0,_graphqlLanguageServiceParser.list)("Entry",(0,_graphqlLanguageServiceParser.p)(",")),(0,_graphqlLanguageServiceParser.p)("}")],Entry:[(0,_graphqlLanguageServiceParser.t)("String","def"),(0,_graphqlLanguageServiceParser.p)(":"),"Value"],Value:function(token){switch(token.kind){case"Number":return"NumberValue";case"String":return"StringValue";case"Punctuation":switch(token.value){case"[":return"ListValue";case"{":return"ObjectValue"}return null;case"Keyword":switch(token.value){case"true":case"false":return"BooleanValue";case"null":return"NullValue"}return null}},NumberValue:[(0,_graphqlLanguageServiceParser.t)("Number","number")],StringValue:[(0,_graphqlLanguageServiceParser.t)("String","string")],BooleanValue:[(0,_graphqlLanguageServiceParser.t)("Keyword","builtin")],NullValue:[(0,_graphqlLanguageServiceParser.t)("Keyword","keyword")],ListValue:[(0,_graphqlLanguageServiceParser.p)("["),(0,_graphqlLanguageServiceParser.list)("Value",(0,_graphqlLanguageServiceParser.p)(",")),(0,_graphqlLanguageServiceParser.p)("]")],ObjectValue:[(0,_graphqlLanguageServiceParser.p)("{"),(0,_graphqlLanguageServiceParser.list)("ObjectField",(0,_graphqlLanguageServiceParser.p)(",")),(0,_graphqlLanguageServiceParser.p)("}")],ObjectField:[(0,_graphqlLanguageServiceParser.t)("String","property"),(0,_graphqlLanguageServiceParser.p)(":"),"Value"]}},{codemirror:63,"graphql-language-service-parser":77}],41:[function(require,module,exports){"use strict";function isMetaField(fieldDef){return"__"===fieldDef.name.slice(0,2)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.getFieldReference=function(typeInfo){return{kind:"Field",schema:typeInfo.schema,field:typeInfo.fieldDef,type:isMetaField(typeInfo.fieldDef)?null:typeInfo.parentType}},exports.getDirectiveReference=function(typeInfo){return{kind:"Directive",schema:typeInfo.schema,directive:typeInfo.directiveDef}},exports.getArgumentReference=function(typeInfo){return typeInfo.directiveDef?{kind:"Argument",schema:typeInfo.schema,argument:typeInfo.argDef,directive:typeInfo.directiveDef}:{kind:"Argument",schema:typeInfo.schema,argument:typeInfo.argDef,field:typeInfo.fieldDef,type:isMetaField(typeInfo.fieldDef)?null:typeInfo.parentType}},exports.getEnumValueReference=function(typeInfo){return{kind:"EnumValue",value:typeInfo.enumValue,type:(0,_graphql.getNamedType)(typeInfo.inputType)}},exports.getTypeReference=function(typeInfo,type){return{kind:"Type",schema:typeInfo.schema,type:type||typeInfo.type}};var _graphql=require("graphql")},{graphql:92}],42:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(stack,fn){for(var reverseStateStack=[],state=stack;state&&state.kind;)reverseStateStack.push(state),state=state.prevState;for(var i=reverseStateStack.length-1;i>=0;i--)fn(reverseStateStack[i])}},{}],43:[function(require,module,exports){"use strict";function getFieldDef(schema,type,fieldName){return fieldName===_introspection.SchemaMetaFieldDef.name&&schema.getQueryType()===type?_introspection.SchemaMetaFieldDef:fieldName===_introspection.TypeMetaFieldDef.name&&schema.getQueryType()===type?_introspection.TypeMetaFieldDef:fieldName===_introspection.TypeNameMetaFieldDef.name&&(0,_graphql.isCompositeType)(type)?_introspection.TypeNameMetaFieldDef:type.getFields?type.getFields()[fieldName]:void 0}function find(array,predicate){for(var i=0;i<array.length;i++)if(predicate(array[i]))return array[i]}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(schema,tokenState){var info={schema:schema,type:null,parentType:null,inputType:null,directiveDef:null,fieldDef:null,argDef:null,argDefs:null,objectFieldDefs:null};return(0,_forEachState2.default)(tokenState,function(state){switch(state.kind){case"Query":case"ShortQuery":info.type=schema.getQueryType();break;case"Mutation":info.type=schema.getMutationType();break;case"Subscription":info.type=schema.getSubscriptionType();break;case"InlineFragment":case"FragmentDefinition":state.type&&(info.type=schema.getType(state.type));break;case"Field":case"AliasedField":info.fieldDef=info.type&&state.name?getFieldDef(schema,info.parentType,state.name):null,info.type=info.fieldDef&&info.fieldDef.type;break;case"SelectionSet":info.parentType=(0,_graphql.getNamedType)(info.type);break;case"Directive":info.directiveDef=state.name&&schema.getDirective(state.name);break;case"Arguments":var parentDef="Field"===state.prevState.kind?info.fieldDef:"Directive"===state.prevState.kind?info.directiveDef:"AliasedField"===state.prevState.kind?state.prevState.name&&getFieldDef(schema,info.parentType,state.prevState.name):null;info.argDefs=parentDef&&parentDef.args;break;case"Argument":if(info.argDef=null,info.argDefs)for(var i=0;i<info.argDefs.length;i++)if(info.argDefs[i].name===state.name){info.argDef=info.argDefs[i];break}info.inputType=info.argDef&&info.argDef.type;break;case"EnumValue":var enumType=(0,_graphql.getNamedType)(info.inputType);info.enumValue=enumType instanceof _graphql.GraphQLEnumType?find(enumType.getValues(),function(val){return val.value===state.name}):null;break;case"ListValue":var nullableType=(0,_graphql.getNullableType)(info.inputType);info.inputType=nullableType instanceof _graphql.GraphQLList?nullableType.ofType:null;break;case"ObjectValue":var objectType=(0,_graphql.getNamedType)(info.inputType);info.objectFieldDefs=objectType instanceof _graphql.GraphQLInputObjectType?objectType.getFields():null;break;case"ObjectField":var objectField=state.name&&info.objectFieldDefs?info.objectFieldDefs[state.name]:null;info.inputType=objectField&&objectField.type;break;case"NamedType":info.type=schema.getType(state.name)}}),info};var _graphql=require("graphql"),_introspection=require("graphql/type/introspection"),_forEachState2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(require("./forEachState"))},{"./forEachState":42,graphql:92,"graphql/type/introspection":115}],44:[function(require,module,exports){"use strict";function filterAndSortList(list,text){return text?filterNonEmpty(filterNonEmpty(list.map(function(entry){return{proximity:getProximity(normalizeText(entry.text),text),entry:entry}}),function(pair){return pair.proximity<=2}),function(pair){return!pair.entry.isDeprecated}).sort(function(a,b){return(a.entry.isDeprecated?1:0)-(b.entry.isDeprecated?1:0)||a.proximity-b.proximity||a.entry.text.length-b.entry.text.length}).map(function(pair){return pair.entry}):filterNonEmpty(list,function(entry){return!entry.isDeprecated})}function filterNonEmpty(array,predicate){var filtered=array.filter(predicate);return 0===filtered.length?array:filtered}function normalizeText(text){return text.toLowerCase().replace(/\W/g,"")}function getProximity(suggestion,text){var proximity=lexicalDistance(text,suggestion);return suggestion.length>text.length&&(proximity-=suggestion.length-text.length-1,proximity+=0===suggestion.indexOf(text)?0:.5),proximity}function lexicalDistance(a,b){var i=void 0,j=void 0,d=[],aLength=a.length,bLength=b.length;for(i=0;i<=aLength;i++)d[i]=[i];for(j=1;j<=bLength;j++)d[0][j]=j;for(i=1;i<=aLength;i++)for(j=1;j<=bLength;j++){var cost=a[i-1]===b[j-1]?0:1;d[i][j]=Math.min(d[i-1][j]+1,d[i][j-1]+1,d[i-1][j-1]+cost),i>1&&j>1&&a[i-1]===b[j-2]&&a[i-2]===b[j-1]&&(d[i][j]=Math.min(d[i][j],d[i-2][j-2]+cost))}return d[aLength][bLength]}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(cursor,token,list){var hints=filterAndSortList(list,normalizeText(token.string));if(hints){var tokenStart=null!==token.type&&/"|\w/.test(token.string[0])?token.start:token.end;return{list:hints,from:{line:cursor.line,column:tokenStart},to:{line:cursor.line,column:token.end}}}}},{}],45:[function(require,module,exports){"use strict";function createState(options){return{options:options instanceof Function?{render:options}:!0===options?{}:options}}function getHoverTime(cm){var options=cm.state.info.options;return options&&options.hoverTime||500}function onMouseOver(cm,e){var state=cm.state.info,target=e.target||e.srcElement;if("SPAN"===target.nodeName&&void 0===state.hoverTimeout){var box=target.getBoundingClientRect(),hoverTime=getHoverTime(cm);state.hoverTimeout=setTimeout(onHover,hoverTime);var onMouseMove=function(){clearTimeout(state.hoverTimeout),state.hoverTimeout=setTimeout(onHover,hoverTime)},onMouseOut=function onMouseOut(){_codemirror2.default.off(document,"mousemove",onMouseMove),_codemirror2.default.off(cm.getWrapperElement(),"mouseout",onMouseOut),clearTimeout(state.hoverTimeout),state.hoverTimeout=void 0},onHover=function(){_codemirror2.default.off(document,"mousemove",onMouseMove),_codemirror2.default.off(cm.getWrapperElement(),"mouseout",onMouseOut),state.hoverTimeout=void 0,onMouseHover(cm,box)};_codemirror2.default.on(document,"mousemove",onMouseMove),_codemirror2.default.on(cm.getWrapperElement(),"mouseout",onMouseOut)}}function onMouseHover(cm,box){var pos=cm.coordsChar({left:(box.left+box.right)/2,top:(box.top+box.bottom)/2}),options=cm.state.info.options,render=options.render||cm.getHelper(pos,"info");if(render){var token=cm.getTokenAt(pos,!0);if(token){var info=render(token,options,cm);info&&showPopup(cm,box,info)}}}function showPopup(cm,box,info){var popup=document.createElement("div");popup.className="CodeMirror-info",popup.appendChild(info),document.body.appendChild(popup);var popupBox=popup.getBoundingClientRect(),popupStyle=popup.currentStyle||window.getComputedStyle(popup),popupWidth=popupBox.right-popupBox.left+parseFloat(popupStyle.marginLeft)+parseFloat(popupStyle.marginRight),popupHeight=popupBox.bottom-popupBox.top+parseFloat(popupStyle.marginTop)+parseFloat(popupStyle.marginBottom),topPos=box.bottom;popupHeight>window.innerHeight-box.bottom-15&&box.top>window.innerHeight-box.bottom&&(topPos=box.top-popupHeight),topPos<0&&(topPos=box.bottom);var leftPos=Math.max(0,window.innerWidth-popupWidth-15);leftPos>box.left&&(leftPos=box.left),popup.style.opacity=1,popup.style.top=topPos+"px",popup.style.left=leftPos+"px";var popupTimeout=void 0,onMouseOverPopup=function(){clearTimeout(popupTimeout)},onMouseOut=function(){clearTimeout(popupTimeout),popupTimeout=setTimeout(hidePopup,200)},hidePopup=function(){_codemirror2.default.off(popup,"mouseover",onMouseOverPopup),_codemirror2.default.off(popup,"mouseout",onMouseOut),_codemirror2.default.off(cm.getWrapperElement(),"mouseout",onMouseOut),popup.style.opacity?(popup.style.opacity=0,setTimeout(function(){popup.parentNode&&popup.parentNode.removeChild(popup)},600)):popup.parentNode&&popup.parentNode.removeChild(popup)};_codemirror2.default.on(popup,"mouseover",onMouseOverPopup),_codemirror2.default.on(popup,"mouseout",onMouseOut),_codemirror2.default.on(cm.getWrapperElement(),"mouseout",onMouseOut)}var _codemirror2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(require("codemirror"));_codemirror2.default.defineOption("info",!1,function(cm,options,old){if(old&&old!==_codemirror2.default.Init){var oldOnMouseOver=cm.state.info.onMouseOver;_codemirror2.default.off(cm.getWrapperElement(),"mouseover",oldOnMouseOver),clearTimeout(cm.state.info.hoverTimeout),delete cm.state.info}if(options){var state=cm.state.info=createState(options);state.onMouseOver=onMouseOver.bind(null,cm),_codemirror2.default.on(cm.getWrapperElement(),"mouseover",state.onMouseOver)}})},{codemirror:63}],46:[function(require,module,exports){"use strict";function parseObj(){var nodeStart=start,members=[];if(expect("{"),!skip("}")){do{members.push(parseMember())}while(skip(","));expect("}")}return{kind:"Object",start:nodeStart,end:lastEnd,members:members}}function parseMember(){var nodeStart=start,key="String"===kind?curToken():null;expect("String"),expect(":");var value=parseVal();return{kind:"Member",start:nodeStart,end:lastEnd,key:key,value:value}}function parseArr(){var nodeStart=start,values=[];if(expect("["),!skip("]")){do{values.push(parseVal())}while(skip(","));expect("]")}return{kind:"Array",start:nodeStart,end:lastEnd,values:values}}function parseVal(){switch(kind){case"[":return parseArr();case"{":return parseObj();case"String":case"Number":case"Boolean":case"Null":var token=curToken();return lex(),token}return expect("Value")}function curToken(){return{kind:kind,start:start,end:end,value:JSON.parse(string.slice(start,end))}}function expect(str){if(kind!==str){var found=void 0;if("EOF"===kind)found="[end of file]";else if(end-start>1)found="`"+string.slice(start,end)+"`";else{var match=string.slice(start).match(/^.+?\b/);found="`"+(match?match[0]:string[start])+"`"}throw syntaxError("Expected "+str+" but found "+found+".")}lex()}function syntaxError(message){return{message:message,start:start,end:end}}function skip(k){if(kind===k)return lex(),!0}function ch(){end<strLen&&(code=++end===strLen?0:string.charCodeAt(end))}function lex(){for(lastEnd=end;9===code||10===code||13===code||32===code;)ch();if(0!==code){switch(start=end,code){case 34:return kind="String",readString();case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return kind="Number",readNumber();case 102:if("false"!==string.slice(start,start+5))break;return end+=4,ch(),void(kind="Boolean");case 110:if("null"!==string.slice(start,start+4))break;return end+=3,ch(),void(kind="Null");case 116:if("true"!==string.slice(start,start+4))break;return end+=3,ch(),void(kind="Boolean")}kind=string[start],ch()}else kind="EOF"}function readString(){for(ch();34!==code&&code>31;)if(92===code)switch(ch(),code){case 34:case 47:case 92:case 98:case 102:case 110:case 114:case 116:ch();break;case 117:ch(),readHex(),readHex(),readHex(),readHex();break;default:throw syntaxError("Bad character escape sequence.")}else{if(end===strLen)throw syntaxError("Unterminated string.");ch()}if(34!==code)throw syntaxError("Unterminated string.");ch()}function readHex(){if(code>=48&&code<=57||code>=65&&code<=70||code>=97&&code<=102)return ch();throw syntaxError("Expected hexadecimal digit.")}function readNumber(){45===code&&ch(),48===code?ch():readDigits(),46===code&&(ch(),readDigits()),69!==code&&101!==code||(ch(),43!==code&&45!==code||ch(),readDigits())}function readDigits(){if(code<48||code>57)throw syntaxError("Expected decimal digit.");do{ch()}while(code>=48&&code<=57)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(str){string=str,strLen=str.length,start=end=lastEnd=-1,ch(),lex();var ast=parseObj();return expect("EOF"),ast};var string=void 0,strLen=void 0,start=void 0,end=void 0,lastEnd=void 0,code=void 0,kind=void 0},{}],47:[function(require,module,exports){"use strict";function onMouseOver(cm,event){var target=event.target||event.srcElement;if("SPAN"===target.nodeName){var box=target.getBoundingClientRect(),cursor={left:(box.left+box.right)/2,top:(box.top+box.bottom)/2};cm.state.jump.cursor=cursor,cm.state.jump.isHoldingModifier&&enableJumpMode(cm)}}function onMouseOut(cm){cm.state.jump.isHoldingModifier||!cm.state.jump.cursor?cm.state.jump.isHoldingModifier&&cm.state.jump.marker&&disableJumpMode(cm):cm.state.jump.cursor=null}function onKeyDown(cm,event){if(!cm.state.jump.isHoldingModifier&&isJumpModifier(event.key)){cm.state.jump.isHoldingModifier=!0,cm.state.jump.cursor&&enableJumpMode(cm);var onClick=function(clickEvent){var destination=cm.state.jump.destination;destination&&cm.state.jump.options.onClick(destination,clickEvent)},onMouseDown=function(_,downEvent){cm.state.jump.destination&&(downEvent.codemirrorIgnore=!0)};_codemirror2.default.on(document,"keyup",function onKeyUp(upEvent){upEvent.code===event.code&&(cm.state.jump.isHoldingModifier=!1,cm.state.jump.marker&&disableJumpMode(cm),_codemirror2.default.off(document,"keyup",onKeyUp),_codemirror2.default.off(document,"click",onClick),cm.off("mousedown",onMouseDown))}),_codemirror2.default.on(document,"click",onClick),cm.on("mousedown",onMouseDown)}}function isJumpModifier(key){return key===(isMac?"Meta":"Control")}function enableJumpMode(cm){if(!cm.state.jump.marker){var cursor=cm.state.jump.cursor,pos=cm.coordsChar(cursor),token=cm.getTokenAt(pos,!0),options=cm.state.jump.options,getDestination=options.getDestination||cm.getHelper(pos,"jump");if(getDestination){var destination=getDestination(token,options,cm);if(destination){var marker=cm.markText({line:pos.line,ch:token.start},{line:pos.line,ch:token.end},{className:"CodeMirror-jump-token"});cm.state.jump.marker=marker,cm.state.jump.destination=destination}}}}function disableJumpMode(cm){var marker=cm.state.jump.marker;cm.state.jump.marker=null,cm.state.jump.destination=null,marker.clear()}var _codemirror2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(require("codemirror"));_codemirror2.default.defineOption("jump",!1,function(cm,options,old){if(old&&old!==_codemirror2.default.Init){var oldOnMouseOver=cm.state.jump.onMouseOver;_codemirror2.default.off(cm.getWrapperElement(),"mouseover",oldOnMouseOver);var oldOnMouseOut=cm.state.jump.onMouseOut;_codemirror2.default.off(cm.getWrapperElement(),"mouseout",oldOnMouseOut),_codemirror2.default.off(document,"keydown",cm.state.jump.onKeyDown),delete cm.state.jump}if(options){var state=cm.state.jump={options:options,onMouseOver:onMouseOver.bind(null,cm),onMouseOut:onMouseOut.bind(null,cm),onKeyDown:onKeyDown.bind(null,cm)};_codemirror2.default.on(cm.getWrapperElement(),"mouseover",state.onMouseOver),_codemirror2.default.on(cm.getWrapperElement(),"mouseout",state.onMouseOut),_codemirror2.default.on(document,"keydown",state.onKeyDown)}});var isMac=navigator&&-1!==navigator.appVersion.indexOf("Mac")},{codemirror:63}],48:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function getVariablesHint(cur,token,options){var state="Invalid"===token.state.kind?token.state.prevState:token.state,kind=state.kind,step=state.step;if("Document"===kind&&0===step)return(0,_hintList2.default)(cur,token,[{text:"{"}]);var variableToType=options.variableToType;if(variableToType){var typeInfo=getTypeInfo(variableToType,token.state);if("Document"===kind||"Variable"===kind&&0===step){var variableNames=Object.keys(variableToType);return(0,_hintList2.default)(cur,token,variableNames.map(function(name){return{text:'"'+name+'": ',type:variableToType[name]}}))}if(("ObjectValue"===kind||"ObjectField"===kind&&0===step)&&typeInfo.fields){var inputFields=Object.keys(typeInfo.fields).map(function(fieldName){return typeInfo.fields[fieldName]});return(0,_hintList2.default)(cur,token,inputFields.map(function(field){return{text:'"'+field.name+'": ',type:field.type,description:field.description}}))}if("StringValue"===kind||"NumberValue"===kind||"BooleanValue"===kind||"NullValue"===kind||"ListValue"===kind&&1===step||"ObjectField"===kind&&2===step||"Variable"===kind&&2===step){var namedInputType=(0,_graphql.getNamedType)(typeInfo.type);if(namedInputType instanceof _graphql.GraphQLInputObjectType)return(0,_hintList2.default)(cur,token,[{text:"{"}]);if(namedInputType instanceof _graphql.GraphQLEnumType){var valueMap=namedInputType.getValues(),values=Object.keys(valueMap).map(function(name){return valueMap[name]});return(0,_hintList2.default)(cur,token,values.map(function(value){return{text:'"'+value.name+'"',type:namedInputType,description:value.description}}))}if(namedInputType===_graphql.GraphQLBoolean)return(0,_hintList2.default)(cur,token,[{text:"true",type:_graphql.GraphQLBoolean,description:"Not false."},{text:"false",type:_graphql.GraphQLBoolean,description:"Not true."}])}}}function getTypeInfo(variableToType,tokenState){var info={type:null,fields:null};return(0,_forEachState2.default)(tokenState,function(state){if("Variable"===state.kind)info.type=variableToType[state.name];else if("ListValue"===state.kind){var nullableType=(0,_graphql.getNullableType)(info.type);info.type=nullableType instanceof _graphql.GraphQLList?nullableType.ofType:null}else if("ObjectValue"===state.kind){var objectType=(0,_graphql.getNamedType)(info.type);info.fields=objectType instanceof _graphql.GraphQLInputObjectType?objectType.getFields():null}else if("ObjectField"===state.kind){var objectField=state.name&&info.fields?info.fields[state.name]:null;info.type=objectField&&objectField.type}}),info}var _codemirror2=_interopRequireDefault(require("codemirror")),_graphql=require("graphql"),_forEachState2=_interopRequireDefault(require("../utils/forEachState")),_hintList2=_interopRequireDefault(require("../utils/hintList"));_codemirror2.default.registerHelper("hint","graphql-variables",function(editor,options){var cur=editor.getCursor(),token=editor.getTokenAt(cur),results=getVariablesHint(cur,token,options);return results&&results.list&&results.list.length>0&&(results.from=_codemirror2.default.Pos(results.from.line,results.from.column),results.to=_codemirror2.default.Pos(results.to.line,results.to.column),_codemirror2.default.signal(editor,"hasCompletion",editor,results,token)),results})},{"../utils/forEachState":42,"../utils/hintList":44,codemirror:63,graphql:92}],49:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function validateVariables(editor,variableToType,variablesAST){var errors=[];return variablesAST.members.forEach(function(member){var variableName=member.key.value,type=variableToType[variableName];type?validateValue(type,member.value).forEach(function(_ref){var node=_ref[0],message=_ref[1];errors.push(lintError(editor,node,message))}):errors.push(lintError(editor,member.key,'Variable "$'+variableName+'" does not appear in any GraphQL query.'))}),errors}function validateValue(type,valueAST){if(type instanceof _graphql.GraphQLNonNull)return"Null"===valueAST.kind?[[valueAST,'Type "'+type+'" is non-nullable and cannot be null.']]:validateValue(type.ofType,valueAST);if("Null"===valueAST.kind)return[];if(type instanceof _graphql.GraphQLList){var itemType=type.ofType;return"Array"===valueAST.kind?mapCat(valueAST.values,function(item){return validateValue(itemType,item)}):validateValue(itemType,valueAST)}if(type instanceof _graphql.GraphQLInputObjectType){if("Object"!==valueAST.kind)return[[valueAST,'Type "'+type+'" must be an Object.']];var providedFields=Object.create(null),fieldErrors=mapCat(valueAST.members,function(member){var fieldName=member.key.value;providedFields[fieldName]=!0;var inputField=type.getFields()[fieldName];return inputField?validateValue(inputField?inputField.type:void 0,member.value):[[member.key,'Type "'+type+'" does not have a field "'+fieldName+'".']]});return Object.keys(type.getFields()).forEach(function(fieldName){providedFields[fieldName]||type.getFields()[fieldName].type instanceof _graphql.GraphQLNonNull&&fieldErrors.push([valueAST,'Object of type "'+type+'" is missing required field "'+fieldName+'".'])}),fieldErrors}return"Boolean"===type.name&&"Boolean"!==valueAST.kind||"String"===type.name&&"String"!==valueAST.kind||"ID"===type.name&&"Number"!==valueAST.kind&&"String"!==valueAST.kind||"Float"===type.name&&"Number"!==valueAST.kind||"Int"===type.name&&("Number"!==valueAST.kind||(0|valueAST.value)!==valueAST.value)?[[valueAST,'Expected value of type "'+type+'".']]:(type instanceof _graphql.GraphQLEnumType||type instanceof _graphql.GraphQLScalarType)&&("String"!==valueAST.kind&&"Number"!==valueAST.kind&&"Boolean"!==valueAST.kind&&"Null"!==valueAST.kind||isNullish(type.parseValue(valueAST.value)))?[[valueAST,'Expected value of type "'+type+'".']]:[]}function lintError(editor,node,message){return{message:message,severity:"error",type:"validation",from:editor.posFromIndex(node.start),to:editor.posFromIndex(node.end)}}function isNullish(value){return null===value||void 0===value||value!==value}function mapCat(array,mapper){return Array.prototype.concat.apply([],array.map(mapper))}var _codemirror2=_interopRequireDefault(require("codemirror")),_graphql=require("graphql"),_jsonParse2=_interopRequireDefault(require("../utils/jsonParse"));_codemirror2.default.registerHelper("lint","graphql-variables",function(text,options,editor){if(!text)return[];var ast=void 0;try{ast=(0,_jsonParse2.default)(text)}catch(syntaxError){if(syntaxError.stack)throw syntaxError;return[lintError(editor,syntaxError,syntaxError.message)]}var variableToType=options.variableToType;return variableToType?validateVariables(editor,variableToType,ast):[]})},{"../utils/jsonParse":46,codemirror:63,graphql:92}],50:[function(require,module,exports){"use strict";function indent(state,textAfter){var levels=state.levels;return(levels&&0!==levels.length?levels[levels.length-1]-(this.electricInput.test(textAfter)?1:0):state.indentLevel)*this.config.indentUnit}function namedKey(style){return{style:style,match:function(token){return"String"===token.kind},update:function(state,token){state.name=token.value.slice(1,-1)}}}var _codemirror2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(require("codemirror")),_graphqlLanguageServiceParser=require("graphql-language-service-parser");_codemirror2.default.defineMode("graphql-variables",function(config){var parser=(0,_graphqlLanguageServiceParser.onlineParser)({eatWhitespace:function(stream){return stream.eatSpace()},lexRules:LexRules,parseRules:ParseRules,editorConfig:{tabSize:config.tabSize}});return{config:config,startState:parser.startState,token:parser.token,indent:indent,electricInput:/^\s*[}\]]/,fold:"brace",closeBrackets:{pairs:'[]{}""',explode:"[]{}"}}});var LexRules={Punctuation:/^\[|]|\{|\}|:|,/,Number:/^-?(?:0|(?:[1-9][0-9]*))(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?/,String:/^"(?:[^"\\]|\\(?:"|\/|\\|b|f|n|r|t|u[0-9a-fA-F]{4}))*"?/,Keyword:/^true|false|null/},ParseRules={Document:[(0,_graphqlLanguageServiceParser.p)("{"),(0,_graphqlLanguageServiceParser.list)("Variable",(0,_graphqlLanguageServiceParser.opt)((0,_graphqlLanguageServiceParser.p)(","))),(0,_graphqlLanguageServiceParser.p)("}")],Variable:[namedKey("variable"),(0,_graphqlLanguageServiceParser.p)(":"),"Value"],Value:function(token){switch(token.kind){case"Number":return"NumberValue";case"String":return"StringValue";case"Punctuation":switch(token.value){case"[":return"ListValue";case"{":return"ObjectValue"}return null;case"Keyword":switch(token.value){case"true":case"false":return"BooleanValue";case"null":return"NullValue"}return null}},NumberValue:[(0,_graphqlLanguageServiceParser.t)("Number","number")],StringValue:[(0,_graphqlLanguageServiceParser.t)("String","string")],BooleanValue:[(0,_graphqlLanguageServiceParser.t)("Keyword","builtin")],NullValue:[(0,_graphqlLanguageServiceParser.t)("Keyword","keyword")],ListValue:[(0,_graphqlLanguageServiceParser.p)("["),(0,_graphqlLanguageServiceParser.list)("Value",(0,_graphqlLanguageServiceParser.opt)((0,_graphqlLanguageServiceParser.p)(","))),(0,_graphqlLanguageServiceParser.p)("]")],ObjectValue:[(0,_graphqlLanguageServiceParser.p)("{"),(0,_graphqlLanguageServiceParser.list)("ObjectField",(0,_graphqlLanguageServiceParser.opt)((0,_graphqlLanguageServiceParser.p)(","))),(0,_graphqlLanguageServiceParser.p)("}")],ObjectField:[namedKey("attribute"),(0,_graphqlLanguageServiceParser.p)(":"),"Value"]}},{codemirror:63,"graphql-language-service-parser":77}],51:[function(require,module,exports){!function(mod){mod("object"==typeof exports&&"object"==typeof module?require("../../lib/codemirror"):CodeMirror)}(function(CodeMirror){"use strict";function firstNonWS(str){var found=str.search(nonWS);return-1==found?0:found}function probablyInsideString(cm,pos,line){return/\bstring\b/.test(cm.getTokenTypeAt(Pos(pos.line,0)))&&!/^[\'\"\`]/.test(line)}function getMode(cm,pos){var mode=cm.getMode();return!1!==mode.useInnerComments&&mode.innerMode?cm.getModeAt(pos):mode}var noOptions={},nonWS=/[^\s\u00a0]/,Pos=CodeMirror.Pos;CodeMirror.commands.toggleComment=function(cm){cm.toggleComment()},CodeMirror.defineExtension("toggleComment",function(options){options||(options=noOptions);for(var cm=this,minLine=1/0,ranges=this.listSelections(),mode=null,i=ranges.length-1;i>=0;i--){var from=ranges[i].from(),to=ranges[i].to();from.line>=minLine||(to.line>=minLine&&(to=Pos(minLine,0)),minLine=from.line,null==mode?cm.uncomment(from,to,options)?mode="un":(cm.lineComment(from,to,options),mode="line"):"un"==mode?cm.uncomment(from,to,options):cm.lineComment(from,to,options))}}),CodeMirror.defineExtension("lineComment",function(from,to,options){options||(options=noOptions);var self=this,mode=getMode(self,from),firstLine=self.getLine(from.line);if(null!=firstLine&&!probablyInsideString(self,from,firstLine)){var commentString=options.lineComment||mode.lineComment;if(commentString){var end=Math.min(0!=to.ch||to.line==from.line?to.line+1:to.line,self.lastLine()+1),pad=null==options.padding?" ":options.padding,blankLines=options.commentBlankLines||from.line==to.line;self.operation(function(){if(options.indent){for(var baseString=null,i=from.line;i<end;++i){var whitespace=(line=self.getLine(i)).slice(0,firstNonWS(line));(null==baseString||baseString.length>whitespace.length)&&(baseString=whitespace)}for(i=from.line;i<end;++i){var line=self.getLine(i),cut=baseString.length;(blankLines||nonWS.test(line))&&(line.slice(0,cut)!=baseString&&(cut=firstNonWS(line)),self.replaceRange(baseString+commentString+pad,Pos(i,0),Pos(i,cut)))}}else for(i=from.line;i<end;++i)(blankLines||nonWS.test(self.getLine(i)))&&self.replaceRange(commentString+pad,Pos(i,0))})}else(options.blockCommentStart||mode.blockCommentStart)&&(options.fullLines=!0,self.blockComment(from,to,options))}}),CodeMirror.defineExtension("blockComment",function(from,to,options){options||(options=noOptions);var self=this,mode=getMode(self,from),startString=options.blockCommentStart||mode.blockCommentStart,endString=options.blockCommentEnd||mode.blockCommentEnd;if(startString&&endString){if(!/\bcomment\b/.test(self.getTokenTypeAt(Pos(from.line,0)))){var end=Math.min(to.line,self.lastLine());end!=from.line&&0==to.ch&&nonWS.test(self.getLine(end))&&--end;var pad=null==options.padding?" ":options.padding;from.line>end||self.operation(function(){if(0!=options.fullLines){var lastLineHasText=nonWS.test(self.getLine(end));self.replaceRange(pad+endString,Pos(end)),self.replaceRange(startString+pad,Pos(from.line,0));var lead=options.blockCommentLead||mode.blockCommentLead;if(null!=lead)for(var i=from.line+1;i<=end;++i)(i!=end||lastLineHasText)&&self.replaceRange(lead+pad,Pos(i,0))}else self.replaceRange(endString,to),self.replaceRange(startString,from)})}}else(options.lineComment||mode.lineComment)&&0!=options.fullLines&&self.lineComment(from,to,options)}),CodeMirror.defineExtension("uncomment",function(from,to,options){options||(options=noOptions);var didSomething,self=this,mode=getMode(self,from),end=Math.min(0!=to.ch||to.line==from.line?to.line:to.line-1,self.lastLine()),start=Math.min(from.line,end),lineString=options.lineComment||mode.lineComment,lines=[],pad=null==options.padding?" ":options.padding;lineComment:if(lineString){for(var i=start;i<=end;++i){var line=self.getLine(i),found=line.indexOf(lineString);if(found>-1&&!/comment/.test(self.getTokenTypeAt(Pos(i,found+1)))&&(found=-1),-1==found&&nonWS.test(line))break lineComment;if(found>-1&&nonWS.test(line.slice(0,found)))break lineComment;lines.push(line)}if(self.operation(function(){for(var i=start;i<=end;++i){var line=lines[i-start],pos=line.indexOf(lineString),endPos=pos+lineString.length;pos<0||(line.slice(endPos,endPos+pad.length)==pad&&(endPos+=pad.length),didSomething=!0,self.replaceRange("",Pos(i,pos),Pos(i,endPos)))}}),didSomething)return!0}var startString=options.blockCommentStart||mode.blockCommentStart,endString=options.blockCommentEnd||mode.blockCommentEnd;if(!startString||!endString)return!1;var lead=options.blockCommentLead||mode.blockCommentLead,startLine=self.getLine(start),open=startLine.indexOf(startString);if(-1==open)return!1;var endLine=end==start?startLine:self.getLine(end),close=endLine.indexOf(endString,end==start?open+startString.length:0);-1==close&&start!=end&&(endLine=self.getLine(--end),close=endLine.indexOf(endString));var insideStart=Pos(start,open+1),insideEnd=Pos(end,close+1);if(-1==close||!/comment/.test(self.getTokenTypeAt(insideStart))||!/comment/.test(self.getTokenTypeAt(insideEnd))||self.getRange(insideStart,insideEnd,"\n").indexOf(endString)>-1)return!1;var lastStart=startLine.lastIndexOf(startString,from.ch),firstEnd=-1==lastStart?-1:startLine.slice(0,from.ch).indexOf(endString,lastStart+startString.length);if(-1!=lastStart&&-1!=firstEnd&&firstEnd+endString.length!=from.ch)return!1;firstEnd=endLine.indexOf(endString,to.ch);var almostLastStart=endLine.slice(to.ch).lastIndexOf(startString,firstEnd-to.ch);return lastStart=-1==firstEnd||-1==almostLastStart?-1:to.ch+almostLastStart,(-1==firstEnd||-1==lastStart||lastStart==to.ch)&&(self.operation(function(){self.replaceRange("",Pos(end,close-(pad&&endLine.slice(close-pad.length,close)==pad?pad.length:0)),Pos(end,close+endString.length));var openEnd=open+startString.length;if(pad&&startLine.slice(openEnd,openEnd+pad.length)==pad&&(openEnd+=pad.length),self.replaceRange("",Pos(start,open),Pos(start,openEnd)),lead)for(var i=start+1;i<=end;++i){var line=self.getLine(i),found=line.indexOf(lead);if(-1!=found&&!nonWS.test(line.slice(0,found))){var foundEnd=found+lead.length;pad&&line.slice(foundEnd,foundEnd+pad.length)==pad&&(foundEnd+=pad.length),self.replaceRange("",Pos(i,found),Pos(i,foundEnd))}}}),!0)})})},{"../../lib/codemirror":63}],52:[function(require,module,exports){!function(mod){mod("object"==typeof exports&&"object"==typeof module?require("../../lib/codemirror"):CodeMirror)}(function(CodeMirror){function dialogDiv(cm,template,bottom){var dialog;return dialog=cm.getWrapperElement().appendChild(document.createElement("div")),dialog.className=bottom?"CodeMirror-dialog CodeMirror-dialog-bottom":"CodeMirror-dialog CodeMirror-dialog-top","string"==typeof template?dialog.innerHTML=template:dialog.appendChild(template),dialog}function closeNotification(cm,newVal){cm.state.currentNotificationClose&&cm.state.currentNotificationClose(),cm.state.currentNotificationClose=newVal}CodeMirror.defineExtension("openDialog",function(template,callback,options){function close(newVal){if("string"==typeof newVal)inp.value=newVal;else{if(closed)return;closed=!0,dialog.parentNode.removeChild(dialog),me.focus(),options.onClose&&options.onClose(dialog)}}options||(options={}),closeNotification(this,null);var button,dialog=dialogDiv(this,template,options.bottom),closed=!1,me=this,inp=dialog.getElementsByTagName("input")[0];return inp?(inp.focus(),options.value&&(inp.value=options.value,!1!==options.selectValueOnOpen&&inp.select()),options.onInput&&CodeMirror.on(inp,"input",function(e){options.onInput(e,inp.value,close)}),options.onKeyUp&&CodeMirror.on(inp,"keyup",function(e){options.onKeyUp(e,inp.value,close)}),CodeMirror.on(inp,"keydown",function(e){options&&options.onKeyDown&&options.onKeyDown(e,inp.value,close)||((27==e.keyCode||!1!==options.closeOnEnter&&13==e.keyCode)&&(inp.blur(),CodeMirror.e_stop(e),close()),13==e.keyCode&&callback(inp.value,e))}),!1!==options.closeOnBlur&&CodeMirror.on(inp,"blur",close)):(button=dialog.getElementsByTagName("button")[0])&&(CodeMirror.on(button,"click",function(){close(),me.focus()}),!1!==options.closeOnBlur&&CodeMirror.on(button,"blur",close),button.focus()),close}),CodeMirror.defineExtension("openConfirm",function(template,callbacks,options){function close(){closed||(closed=!0,dialog.parentNode.removeChild(dialog),me.focus())}closeNotification(this,null);var dialog=dialogDiv(this,template,options&&options.bottom),buttons=dialog.getElementsByTagName("button"),closed=!1,me=this,blurring=1;buttons[0].focus();for(var i=0;i<buttons.length;++i){var b=buttons[i];!function(callback){CodeMirror.on(b,"click",function(e){CodeMirror.e_preventDefault(e),close(),callback&&callback(me)})}(callbacks[i]),CodeMirror.on(b,"blur",function(){--blurring,setTimeout(function(){blurring<=0&&close()},200)}),CodeMirror.on(b,"focus",function(){++blurring})}}),CodeMirror.defineExtension("openNotification",function(template,options){function close(){closed||(closed=!0,clearTimeout(doneTimer),dialog.parentNode.removeChild(dialog))}closeNotification(this,close);var doneTimer,dialog=dialogDiv(this,template,options&&options.bottom),closed=!1,duration=options&&void 0!==options.duration?options.duration:5e3;return CodeMirror.on(dialog,"click",function(e){CodeMirror.e_preventDefault(e),close()}),duration&&(doneTimer=setTimeout(close,duration)),close})})},{"../../lib/codemirror":63}],53:[function(require,module,exports){!function(mod){mod("object"==typeof exports&&"object"==typeof module?require("../../lib/codemirror"):CodeMirror)}(function(CodeMirror){function getOption(conf,name){return"pairs"==name&&"string"==typeof conf?conf:"object"==typeof conf&&null!=conf[name]?conf[name]:defaults[name]}function getConfig(cm){var deflt=cm.state.closeBrackets;return!deflt||deflt.override?deflt:cm.getModeAt(cm.getCursor()).closeBrackets||deflt}function contractSelection(sel){var inverted=CodeMirror.cmpPos(sel.anchor,sel.head)>0;return{anchor:new Pos(sel.anchor.line,sel.anchor.ch+(inverted?-1:1)),head:new Pos(sel.head.line,sel.head.ch+(inverted?1:-1))}}function handleChar(cm,ch){var conf=getConfig(cm);if(!conf||cm.getOption("disableInput"))return CodeMirror.Pass;var pairs=getOption(conf,"pairs"),pos=pairs.indexOf(ch);if(-1==pos)return CodeMirror.Pass;for(var type,triples=getOption(conf,"triples"),identical=pairs.charAt(pos+1)==ch,ranges=cm.listSelections(),opening=pos%2==0,i=0;i<ranges.length;i++){var curType,range=ranges[i],cur=range.head,next=cm.getRange(cur,Pos(cur.line,cur.ch+1));if(opening&&!range.empty())curType="surround";else if(!identical&&opening||next!=ch)if(identical&&cur.ch>1&&triples.indexOf(ch)>=0&&cm.getRange(Pos(cur.line,cur.ch-2),cur)==ch+ch&&(cur.ch<=2||cm.getRange(Pos(cur.line,cur.ch-3),Pos(cur.line,cur.ch-2))!=ch))curType="addFour";else if(identical){if(CodeMirror.isWordChar(next)||!enteringString(cm,cur,ch))return CodeMirror.Pass;curType="both"}else{if(!opening||cm.getLine(cur.line).length!=cur.ch&&!isClosingBracket(next,pairs)&&!/\s/.test(next))return CodeMirror.Pass;curType="both"}else curType=identical&&stringStartsAfter(cm,cur)?"both":triples.indexOf(ch)>=0&&cm.getRange(cur,Pos(cur.line,cur.ch+3))==ch+ch+ch?"skipThree":"skip";if(type){if(type!=curType)return CodeMirror.Pass}else type=curType}var left=pos%2?pairs.charAt(pos-1):ch,right=pos%2?ch:pairs.charAt(pos+1);cm.operation(function(){if("skip"==type)cm.execCommand("goCharRight");else if("skipThree"==type)for(i=0;i<3;i++)cm.execCommand("goCharRight");else if("surround"==type){for(var sels=cm.getSelections(),i=0;i<sels.length;i++)sels[i]=left+sels[i]+right;cm.replaceSelections(sels,"around"),sels=cm.listSelections().slice();for(i=0;i<sels.length;i++)sels[i]=contractSelection(sels[i]);cm.setSelections(sels)}else"both"==type?(cm.replaceSelection(left+right,null),cm.triggerElectric(left+right),cm.execCommand("goCharLeft")):"addFour"==type&&(cm.replaceSelection(left+left+left+left,"before"),cm.execCommand("goCharRight"))})}function isClosingBracket(ch,pairs){var pos=pairs.lastIndexOf(ch);return pos>-1&&pos%2==1}function charsAround(cm,pos){var str=cm.getRange(Pos(pos.line,pos.ch-1),Pos(pos.line,pos.ch+1));return 2==str.length?str:null}function enteringString(cm,pos,ch){var line=cm.getLine(pos.line),token=cm.getTokenAt(pos);if(/\bstring2?\b/.test(token.type)||stringStartsAfter(cm,pos))return!1;var stream=new CodeMirror.StringStream(line.slice(0,pos.ch)+ch+line.slice(pos.ch),4);for(stream.pos=stream.start=token.start;;){var type1=cm.getMode().token(stream,token.state);if(stream.pos>=pos.ch+1)return/\bstring2?\b/.test(type1);stream.start=stream.pos}}function stringStartsAfter(cm,pos){var token=cm.getTokenAt(Pos(pos.line,pos.ch+1));return/\bstring/.test(token.type)&&token.start==pos.ch}var defaults={pairs:"()[]{}''\"\"",triples:"",explode:"[]{}"},Pos=CodeMirror.Pos;CodeMirror.defineOption("autoCloseBrackets",!1,function(cm,val,old){old&&old!=CodeMirror.Init&&(cm.removeKeyMap(keyMap),cm.state.closeBrackets=null),val&&(cm.state.closeBrackets=val,cm.addKeyMap(keyMap))});for(var bind=defaults.pairs+"`",keyMap={Backspace:function(cm){var conf=getConfig(cm);if(!conf||cm.getOption("disableInput"))return CodeMirror.Pass;for(var pairs=getOption(conf,"pairs"),ranges=cm.listSelections(),i=0;i<ranges.length;i++){if(!ranges[i].empty())return CodeMirror.Pass;var around=charsAround(cm,ranges[i].head);if(!around||pairs.indexOf(around)%2!=0)return CodeMirror.Pass}for(i=ranges.length-1;i>=0;i--){var cur=ranges[i].head;cm.replaceRange("",Pos(cur.line,cur.ch-1),Pos(cur.line,cur.ch+1),"+delete")}},Enter:function(cm){var conf=getConfig(cm),explode=conf&&getOption(conf,"explode");if(!explode||cm.getOption("disableInput"))return CodeMirror.Pass;for(var ranges=cm.listSelections(),i=0;i<ranges.length;i++){if(!ranges[i].empty())return CodeMirror.Pass;var around=charsAround(cm,ranges[i].head);if(!around||explode.indexOf(around)%2!=0)return CodeMirror.Pass}cm.operation(function(){cm.replaceSelection("\n\n",null),cm.execCommand("goCharLeft"),ranges=cm.listSelections();for(var i=0;i<ranges.length;i++){var line=ranges[i].head.line;cm.indentLine(line,null,!0),cm.indentLine(line+1,null,!0)}})}},i=0;i<bind.length;i++)keyMap["'"+bind.charAt(i)+"'"]=function(ch){return function(cm){return handleChar(cm,ch)}}(bind.charAt(i))})},{"../../lib/codemirror":63}],54:[function(require,module,exports){!function(mod){mod("object"==typeof exports&&"object"==typeof module?require("../../lib/codemirror"):CodeMirror)}(function(CodeMirror){function findMatchingBracket(cm,where,config){var line=cm.getLineHandle(where.line),pos=where.ch-1,afterCursor=config&&config.afterCursor;null==afterCursor&&(afterCursor=/(^| )cm-fat-cursor($| )/.test(cm.getWrapperElement().className));var match=!afterCursor&&pos>=0&&matching[line.text.charAt(pos)]||matching[line.text.charAt(++pos)];if(!match)return null;var dir=">"==match.charAt(1)?1:-1;if(config&&config.strict&&dir>0!=(pos==where.ch))return null;var style=cm.getTokenTypeAt(Pos(where.line,pos+1)),found=scanForBracket(cm,Pos(where.line,pos+(dir>0?1:0)),dir,style||null,config);return null==found?null:{from:Pos(where.line,pos),to:found&&found.pos,match:found&&found.ch==match.charAt(0),forward:dir>0}}function scanForBracket(cm,where,dir,style,config){for(var maxScanLen=config&&config.maxScanLineLength||1e4,maxScanLines=config&&config.maxScanLines||1e3,stack=[],re=config&&config.bracketRegex?config.bracketRegex:/[(){}[\]]/,lineEnd=dir>0?Math.min(where.line+maxScanLines,cm.lastLine()+1):Math.max(cm.firstLine()-1,where.line-maxScanLines),lineNo=where.line;lineNo!=lineEnd;lineNo+=dir){var line=cm.getLine(lineNo);if(line){var pos=dir>0?0:line.length-1,end=dir>0?line.length:-1;if(!(line.length>maxScanLen))for(lineNo==where.line&&(pos=where.ch-(dir<0?1:0));pos!=end;pos+=dir){var ch=line.charAt(pos);if(re.test(ch)&&(void 0===style||cm.getTokenTypeAt(Pos(lineNo,pos+1))==style))if(">"==matching[ch].charAt(1)==dir>0)stack.push(ch);else{if(!stack.length)return{pos:Pos(lineNo,pos),ch:ch};stack.pop()}}}}return lineNo-dir!=(dir>0?cm.lastLine():cm.firstLine())&&null}function matchBrackets(cm,autoclear,config){for(var maxHighlightLen=cm.state.matchBrackets.maxHighlightLineLength||1e3,marks=[],ranges=cm.listSelections(),i=0;i<ranges.length;i++){var match=ranges[i].empty()&&findMatchingBracket(cm,ranges[i].head,config);if(match&&cm.getLine(match.from.line).length<=maxHighlightLen){var style=match.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";marks.push(cm.markText(match.from,Pos(match.from.line,match.from.ch+1),{className:style})),match.to&&cm.getLine(match.to.line).length<=maxHighlightLen&&marks.push(cm.markText(match.to,Pos(match.to.line,match.to.ch+1),{className:style}))}}if(marks.length){ie_lt8&&cm.state.focused&&cm.focus();var clear=function(){cm.operation(function(){for(var i=0;i<marks.length;i++)marks[i].clear()})};if(!autoclear)return clear;setTimeout(clear,800)}}function doMatchBrackets(cm){cm.operation(function(){currentlyHighlighted&&(currentlyHighlighted(),currentlyHighlighted=null),currentlyHighlighted=matchBrackets(cm,!1,cm.state.matchBrackets)})}var ie_lt8=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),Pos=CodeMirror.Pos,matching={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},currentlyHighlighted=null;CodeMirror.defineOption("matchBrackets",!1,function(cm,val,old){old&&old!=CodeMirror.Init&&(cm.off("cursorActivity",doMatchBrackets),currentlyHighlighted&&(currentlyHighlighted(),currentlyHighlighted=null)),val&&(cm.state.matchBrackets="object"==typeof val?val:{},cm.on("cursorActivity",doMatchBrackets))}),CodeMirror.defineExtension("matchBrackets",function(){matchBrackets(this,!0)}),CodeMirror.defineExtension("findMatchingBracket",function(pos,config,oldConfig){return(oldConfig||"boolean"==typeof config)&&(oldConfig?(oldConfig.strict=config,config=oldConfig):config=config?{strict:!0}:null),findMatchingBracket(this,pos,config)}),CodeMirror.defineExtension("scanForBracket",function(pos,dir,style,config){return scanForBracket(this,pos,dir,style,config)})})},{"../../lib/codemirror":63}],55:[function(require,module,exports){!function(mod){mod("object"==typeof exports&&"object"==typeof module?require("../../lib/codemirror"):CodeMirror)}(function(CodeMirror){"use strict";CodeMirror.registerHelper("fold","brace",function(cm,start){function findOpening(openCh){for(var at=start.ch,pass=0;;){var found=at<=0?-1:lineText.lastIndexOf(openCh,at-1);if(-1!=found){if(1==pass&&found<start.ch)break;if(tokenType=cm.getTokenTypeAt(CodeMirror.Pos(line,found+1)),!/^(comment|string)/.test(tokenType))return found+1;at=found-1}else{if(1==pass)break;pass=1,at=lineText.length}}}var tokenType,line=start.line,lineText=cm.getLine(line),startToken="{",endToken="}",startCh=findOpening("{");if(null==startCh&&(startToken="[",endToken="]",startCh=findOpening("[")),null!=startCh){var end,endCh,count=1,lastLine=cm.lastLine();outer:for(var i=line;i<=lastLine;++i)for(var text=cm.getLine(i),pos=i==line?startCh:0;;){var nextOpen=text.indexOf(startToken,pos),nextClose=text.indexOf(endToken,pos);if(nextOpen<0&&(nextOpen=text.length),nextClose<0&&(nextClose=text.length),(pos=Math.min(nextOpen,nextClose))==text.length)break;if(cm.getTokenTypeAt(CodeMirror.Pos(i,pos+1))==tokenType)if(pos==nextOpen)++count;else if(!--count){end=i,endCh=pos;break outer}++pos}if(null!=end&&(line!=end||endCh!=startCh))return{from:CodeMirror.Pos(line,startCh),to:CodeMirror.Pos(end,endCh)}}}),CodeMirror.registerHelper("fold","import",function(cm,start){function hasImport(line){if(line<cm.firstLine()||line>cm.lastLine())return null;var start=cm.getTokenAt(CodeMirror.Pos(line,1));if(/\S/.test(start.string)||(start=cm.getTokenAt(CodeMirror.Pos(line,start.end+1))),"keyword"!=start.type||"import"!=start.string)return null;for(var i=line,e=Math.min(cm.lastLine(),line+10);i<=e;++i){var semi=cm.getLine(i).indexOf(";");if(-1!=semi)return{startCh:start.end,end:CodeMirror.Pos(i,semi)}}}var prev,startLine=start.line,has=hasImport(startLine);if(!has||hasImport(startLine-1)||(prev=hasImport(startLine-2))&&prev.end.line==startLine-1)return null;for(var end=has.end;;){var next=hasImport(end.line+1);if(null==next)break;end=next.end}return{from:cm.clipPos(CodeMirror.Pos(startLine,has.startCh+1)),to:end}}),CodeMirror.registerHelper("fold","include",function(cm,start){function hasInclude(line){if(line<cm.firstLine()||line>cm.lastLine())return null;var start=cm.getTokenAt(CodeMirror.Pos(line,1));return/\S/.test(start.string)||(start=cm.getTokenAt(CodeMirror.Pos(line,start.end+1))),"meta"==start.type&&"#include"==start.string.slice(0,8)?start.start+8:void 0}var startLine=start.line,has=hasInclude(startLine);if(null==has||null!=hasInclude(startLine-1))return null;for(var end=startLine;null!=hasInclude(end+1);)++end;return{from:CodeMirror.Pos(startLine,has+1),to:cm.clipPos(CodeMirror.Pos(end))}})})},{"../../lib/codemirror":63}],56:[function(require,module,exports){!function(mod){mod("object"==typeof exports&&"object"==typeof module?require("../../lib/codemirror"):CodeMirror)}(function(CodeMirror){"use strict";function doFold(cm,pos,options,force){function getRange(allowFolded){var range=finder(cm,pos);if(!range||range.to.line-range.from.line<minSize)return null;for(var marks=cm.findMarksAt(range.from),i=0;i<marks.length;++i)if(marks[i].__isFold&&"fold"!==force){if(!allowFolded)return null;range.cleared=!0,marks[i].clear()}return range}if(options&&options.call){finder=options;options=null}else var finder=getOption(cm,options,"rangeFinder");"number"==typeof pos&&(pos=CodeMirror.Pos(pos,0));var minSize=getOption(cm,options,"minFoldSize"),range=getRange(!0);if(getOption(cm,options,"scanUp"))for(;!range&&pos.line>cm.firstLine();)pos=CodeMirror.Pos(pos.line-1,0),range=getRange(!1);if(range&&!range.cleared&&"unfold"!==force){var myWidget=makeWidget(cm,options);CodeMirror.on(myWidget,"mousedown",function(e){myRange.clear(),CodeMirror.e_preventDefault(e)});var myRange=cm.markText(range.from,range.to,{replacedWith:myWidget,clearOnEnter:getOption(cm,options,"clearOnEnter"),__isFold:!0});myRange.on("clear",function(from,to){CodeMirror.signal(cm,"unfold",cm,from,to)}),CodeMirror.signal(cm,"fold",cm,range.from,range.to)}}function makeWidget(cm,options){var widget=getOption(cm,options,"widget");if("string"==typeof widget){var text=document.createTextNode(widget);(widget=document.createElement("span")).appendChild(text),widget.className="CodeMirror-foldmarker"}return widget}function getOption(cm,options,name){if(options&&void 0!==options[name])return options[name];var editorOptions=cm.options.foldOptions;return editorOptions&&void 0!==editorOptions[name]?editorOptions[name]:defaultOptions[name]}CodeMirror.newFoldFunction=function(rangeFinder,widget){return function(cm,pos){doFold(cm,pos,{rangeFinder:rangeFinder,widget:widget})}},CodeMirror.defineExtension("foldCode",function(pos,options,force){doFold(this,pos,options,force)}),CodeMirror.defineExtension("isFolded",function(pos){for(var marks=this.findMarksAt(pos),i=0;i<marks.length;++i)if(marks[i].__isFold)return!0}),CodeMirror.commands.toggleFold=function(cm){cm.foldCode(cm.getCursor())},CodeMirror.commands.fold=function(cm){cm.foldCode(cm.getCursor(),null,"fold")},CodeMirror.commands.unfold=function(cm){cm.foldCode(cm.getCursor(),null,"unfold")},CodeMirror.commands.foldAll=function(cm){cm.operation(function(){for(var i=cm.firstLine(),e=cm.lastLine();i<=e;i++)cm.foldCode(CodeMirror.Pos(i,0),null,"fold")})},CodeMirror.commands.unfoldAll=function(cm){cm.operation(function(){for(var i=cm.firstLine(),e=cm.lastLine();i<=e;i++)cm.foldCode(CodeMirror.Pos(i,0),null,"unfold")})},CodeMirror.registerHelper("fold","combine",function(){var funcs=Array.prototype.slice.call(arguments,0);return function(cm,start){for(var i=0;i<funcs.length;++i){var found=funcs[i](cm,start);if(found)return found}}}),CodeMirror.registerHelper("fold","auto",function(cm,start){for(var helpers=cm.getHelpers(start,"fold"),i=0;i<helpers.length;i++){var cur=helpers[i](cm,start);if(cur)return cur}});var defaultOptions={rangeFinder:CodeMirror.fold.auto,widget:"↔",minFoldSize:0,scanUp:!1,clearOnEnter:!0};CodeMirror.defineOption("foldOptions",null),CodeMirror.defineExtension("foldOption",function(options,name){return getOption(this,options,name)})})},{"../../lib/codemirror":63}],57:[function(require,module,exports){!function(mod){"object"==typeof exports&&"object"==typeof module?mod(require("../../lib/codemirror"),require("./foldcode")):mod(CodeMirror)}(function(CodeMirror){"use strict";function State(options){this.options=options,this.from=this.to=0}function parseOptions(opts){return!0===opts&&(opts={}),null==opts.gutter&&(opts.gutter="CodeMirror-foldgutter"),null==opts.indicatorOpen&&(opts.indicatorOpen="CodeMirror-foldgutter-open"),null==opts.indicatorFolded&&(opts.indicatorFolded="CodeMirror-foldgutter-folded"),opts}function isFolded(cm,line){for(var marks=cm.findMarks(Pos(line,0),Pos(line+1,0)),i=0;i<marks.length;++i)if(marks[i].__isFold&&marks[i].find().from.line==line)return marks[i]}function marker(spec){if("string"==typeof spec){var elt=document.createElement("div");return elt.className=spec+" CodeMirror-guttermarker-subtle",elt}return spec.cloneNode(!0)}function updateFoldInfo(cm,from,to){var opts=cm.state.foldGutter.options,cur=from,minSize=cm.foldOption(opts,"minFoldSize"),func=cm.foldOption(opts,"rangeFinder");cm.eachLine(from,to,function(line){var mark=null;if(isFolded(cm,cur))mark=marker(opts.indicatorFolded);else{var pos=Pos(cur,0),range=func&&func(cm,pos);range&&range.to.line-range.from.line>=minSize&&(mark=marker(opts.indicatorOpen))}cm.setGutterMarker(line,opts.gutter,mark),++cur})}function updateInViewport(cm){var vp=cm.getViewport(),state=cm.state.foldGutter;state&&(cm.operation(function(){updateFoldInfo(cm,vp.from,vp.to)}),state.from=vp.from,state.to=vp.to)}function onGutterClick(cm,line,gutter){var state=cm.state.foldGutter;if(state){var opts=state.options;if(gutter==opts.gutter){var folded=isFolded(cm,line);folded?folded.clear():cm.foldCode(Pos(line,0),opts.rangeFinder)}}}function onChange(cm){var state=cm.state.foldGutter;if(state){var opts=state.options;state.from=state.to=0,clearTimeout(state.changeUpdate),state.changeUpdate=setTimeout(function(){updateInViewport(cm)},opts.foldOnChangeTimeSpan||600)}}function onViewportChange(cm){var state=cm.state.foldGutter;if(state){var opts=state.options;clearTimeout(state.changeUpdate),state.changeUpdate=setTimeout(function(){var vp=cm.getViewport();state.from==state.to||vp.from-state.to>20||state.from-vp.to>20?updateInViewport(cm):cm.operation(function(){vp.from<state.from&&(updateFoldInfo(cm,vp.from,state.from),state.from=vp.from),vp.to>state.to&&(updateFoldInfo(cm,state.to,vp.to),state.to=vp.to)})},opts.updateViewportTimeSpan||400)}}function onFold(cm,from){var state=cm.state.foldGutter;if(state){var line=from.line;line>=state.from&&line<state.to&&updateFoldInfo(cm,line,line+1)}}CodeMirror.defineOption("foldGutter",!1,function(cm,val,old){old&&old!=CodeMirror.Init&&(cm.clearGutter(cm.state.foldGutter.options.gutter),cm.state.foldGutter=null,cm.off("gutterClick",onGutterClick),cm.off("change",onChange),cm.off("viewportChange",onViewportChange),cm.off("fold",onFold),cm.off("unfold",onFold),cm.off("swapDoc",onChange)),val&&(cm.state.foldGutter=new State(parseOptions(val)),updateInViewport(cm),cm.on("gutterClick",onGutterClick),cm.on("change",onChange),cm.on("viewportChange",onViewportChange),cm.on("fold",onFold),cm.on("unfold",onFold),cm.on("swapDoc",onChange))});var Pos=CodeMirror.Pos})},{"../../lib/codemirror":63,"./foldcode":56}],58:[function(require,module,exports){!function(mod){mod("object"==typeof exports&&"object"==typeof module?require("../../lib/codemirror"):CodeMirror)}(function(CodeMirror){"use strict";function Completion(cm,options){this.cm=cm,this.options=options,this.widget=null,this.debounce=0,this.tick=0,this.startPos=this.cm.getCursor("start"),this.startLen=this.cm.getLine(this.startPos.line).length-this.cm.getSelection().length;var self=this;cm.on("cursorActivity",this.activityFunc=function(){self.cursorActivity()})}function isNewCompletion(old,nw){return CodeMirror.cmpPos(nw.from,old.from)>0&&old.to.ch-old.from.ch!=nw.to.ch-nw.from.ch}function parseOptions(cm,pos,options){var editor=cm.options.hintOptions,out={};for(var prop in defaultOptions)out[prop]=defaultOptions[prop];if(editor)for(var prop in editor)void 0!==editor[prop]&&(out[prop]=editor[prop]);if(options)for(var prop in options)void 0!==options[prop]&&(out[prop]=options[prop]);return out.hint.resolve&&(out.hint=out.hint.resolve(cm,pos)),out}function getText(completion){return"string"==typeof completion?completion:completion.text}function buildKeyMap(completion,handle){function addBinding(key,val){var bound;bound="string"!=typeof val?function(cm){return val(cm,handle)}:baseMap.hasOwnProperty(val)?baseMap[val]:val,ourMap[key]=bound}var baseMap={Up:function(){handle.moveFocus(-1)},Down:function(){handle.moveFocus(1)},PageUp:function(){handle.moveFocus(1-handle.menuSize(),!0)},PageDown:function(){handle.moveFocus(handle.menuSize()-1,!0)},Home:function(){handle.setFocus(0)},End:function(){handle.setFocus(handle.length-1)},Enter:handle.pick,Tab:handle.pick,Esc:handle.close},custom=completion.options.customKeys,ourMap=custom?{}:baseMap;if(custom)for(var key in custom)custom.hasOwnProperty(key)&&addBinding(key,custom[key]);var extra=completion.options.extraKeys;if(extra)for(var key in extra)extra.hasOwnProperty(key)&&addBinding(key,extra[key]);return ourMap}function getHintElement(hintsElement,el){for(;el&&el!=hintsElement;){if("LI"===el.nodeName.toUpperCase()&&el.parentNode==hintsElement)return el;el=el.parentNode}}function Widget(completion,data){this.completion=completion,this.data=data,this.picked=!1;var widget=this,cm=completion.cm,hints=this.hints=document.createElement("ul");hints.className="CodeMirror-hints",this.selectedHint=data.selectedHint||0;for(var completions=data.list,i=0;i<completions.length;++i){var elt=hints.appendChild(document.createElement("li")),cur=completions[i],className=HINT_ELEMENT_CLASS+(i!=this.selectedHint?"":" "+ACTIVE_HINT_ELEMENT_CLASS);null!=cur.className&&(className=cur.className+" "+className),elt.className=className,cur.render?cur.render(elt,data,cur):elt.appendChild(document.createTextNode(cur.displayText||getText(cur))),elt.hintId=i}var pos=cm.cursorCoords(completion.options.alignWithWord?data.from:null),left=pos.left,top=pos.bottom,below=!0;hints.style.left=left+"px",hints.style.top=top+"px";var winW=window.innerWidth||Math.max(document.body.offsetWidth,document.documentElement.offsetWidth),winH=window.innerHeight||Math.max(document.body.offsetHeight,document.documentElement.offsetHeight);(completion.options.container||document.body).appendChild(hints);var box=hints.getBoundingClientRect(),overlapY=box.bottom-winH,scrolls=hints.scrollHeight>hints.clientHeight+1,startScroll=cm.getScrollInfo();if(overlapY>0){var height=box.bottom-box.top;if(pos.top-(pos.bottom-box.top)-height>0)hints.style.top=(top=pos.top-height)+"px",below=!1;else if(height>winH){hints.style.height=winH-5+"px",hints.style.top=(top=pos.bottom-box.top)+"px";var cursor=cm.getCursor();data.from.ch!=cursor.ch&&(pos=cm.cursorCoords(cursor),hints.style.left=(left=pos.left)+"px",box=hints.getBoundingClientRect())}}var overlapX=box.right-winW;if(overlapX>0&&(box.right-box.left>winW&&(hints.style.width=winW-5+"px",overlapX-=box.right-box.left-winW),hints.style.left=(left=pos.left-overlapX)+"px"),scrolls)for(var node=hints.firstChild;node;node=node.nextSibling)node.style.paddingRight=cm.display.nativeBarWidth+"px";if(cm.addKeyMap(this.keyMap=buildKeyMap(completion,{moveFocus:function(n,avoidWrap){widget.changeActive(widget.selectedHint+n,avoidWrap)},setFocus:function(n){widget.changeActive(n)},menuSize:function(){return widget.screenAmount()},length:completions.length,close:function(){completion.close()},pick:function(){widget.pick()},data:data})),completion.options.closeOnUnfocus){var closingOnBlur;cm.on("blur",this.onBlur=function(){closingOnBlur=setTimeout(function(){completion.close()},100)}),cm.on("focus",this.onFocus=function(){clearTimeout(closingOnBlur)})}return cm.on("scroll",this.onScroll=function(){var curScroll=cm.getScrollInfo(),editor=cm.getWrapperElement().getBoundingClientRect(),newTop=top+startScroll.top-curScroll.top,point=newTop-(window.pageYOffset||(document.documentElement||document.body).scrollTop);if(below||(point+=hints.offsetHeight),point<=editor.top||point>=editor.bottom)return completion.close();hints.style.top=newTop+"px",hints.style.left=left+startScroll.left-curScroll.left+"px"}),CodeMirror.on(hints,"dblclick",function(e){var t=getHintElement(hints,e.target||e.srcElement);t&&null!=t.hintId&&(widget.changeActive(t.hintId),widget.pick())}),CodeMirror.on(hints,"click",function(e){var t=getHintElement(hints,e.target||e.srcElement);t&&null!=t.hintId&&(widget.changeActive(t.hintId),completion.options.completeOnSingleClick&&widget.pick())}),CodeMirror.on(hints,"mousedown",function(){setTimeout(function(){cm.focus()},20)}),CodeMirror.signal(data,"select",completions[0],hints.firstChild),!0}function applicableHelpers(cm,helpers){if(!cm.somethingSelected())return helpers;for(var result=[],i=0;i<helpers.length;i++)helpers[i].supportsSelection&&result.push(helpers[i]);return result}function fetchHints(hint,cm,options,callback){if(hint.async)hint(cm,callback,options);else{var result=hint(cm,options);result&&result.then?result.then(callback):callback(result)}}var HINT_ELEMENT_CLASS="CodeMirror-hint",ACTIVE_HINT_ELEMENT_CLASS="CodeMirror-hint-active";CodeMirror.showHint=function(cm,getHints,options){if(!getHints)return cm.showHint(options);options&&options.async&&(getHints.async=!0);var newOpts={hint:getHints};if(options)for(var prop in options)newOpts[prop]=options[prop];return cm.showHint(newOpts)},CodeMirror.defineExtension("showHint",function(options){options=parseOptions(this,this.getCursor("start"),options);var selections=this.listSelections();if(!(selections.length>1)){if(this.somethingSelected()){if(!options.hint.supportsSelection)return;for(var i=0;i<selections.length;i++)if(selections[i].head.line!=selections[i].anchor.line)return}this.state.completionActive&&this.state.completionActive.close();var completion=this.state.completionActive=new Completion(this,options);completion.options.hint&&(CodeMirror.signal(this,"startCompletion",this),completion.update(!0))}});var requestAnimationFrame=window.requestAnimationFrame||function(fn){return setTimeout(fn,1e3/60)},cancelAnimationFrame=window.cancelAnimationFrame||clearTimeout;Completion.prototype={close:function(){this.active()&&(this.cm.state.completionActive=null,this.tick=null,this.cm.off("cursorActivity",this.activityFunc),this.widget&&this.data&&CodeMirror.signal(this.data,"close"),this.widget&&this.widget.close(),CodeMirror.signal(this.cm,"endCompletion",this.cm))},active:function(){return this.cm.state.completionActive==this},pick:function(data,i){var completion=data.list[i];completion.hint?completion.hint(this.cm,data,completion):this.cm.replaceRange(getText(completion),completion.from||data.from,completion.to||data.to,"complete"),CodeMirror.signal(data,"pick",completion),this.close()},cursorActivity:function(){this.debounce&&(cancelAnimationFrame(this.debounce),this.debounce=0);var pos=this.cm.getCursor(),line=this.cm.getLine(pos.line);if(pos.line!=this.startPos.line||line.length-pos.ch!=this.startLen-this.startPos.ch||pos.ch<this.startPos.ch||this.cm.somethingSelected()||pos.ch&&this.options.closeCharacters.test(line.charAt(pos.ch-1)))this.close();else{var self=this;this.debounce=requestAnimationFrame(function(){self.update()}),this.widget&&this.widget.disable()}},update:function(first){if(null!=this.tick){var self=this,myTick=++this.tick;fetchHints(this.options.hint,this.cm,this.options,function(data){self.tick==myTick&&self.finishUpdate(data,first)})}},finishUpdate:function(data,first){this.data&&CodeMirror.signal(this.data,"update");var picked=this.widget&&this.widget.picked||first&&this.options.completeSingle;this.widget&&this.widget.close(),data&&this.data&&isNewCompletion(this.data,data)||(this.data=data,data&&data.list.length&&(picked&&1==data.list.length?this.pick(data,0):(this.widget=new Widget(this,data),CodeMirror.signal(data,"shown"))))}},Widget.prototype={close:function(){if(this.completion.widget==this){this.completion.widget=null,this.hints.parentNode.removeChild(this.hints),this.completion.cm.removeKeyMap(this.keyMap);var cm=this.completion.cm;this.completion.options.closeOnUnfocus&&(cm.off("blur",this.onBlur),cm.off("focus",this.onFocus)),cm.off("scroll",this.onScroll)}},disable:function(){this.completion.cm.removeKeyMap(this.keyMap);var widget=this;this.keyMap={Enter:function(){widget.picked=!0}},this.completion.cm.addKeyMap(this.keyMap)},pick:function(){this.completion.pick(this.data,this.selectedHint)},changeActive:function(i,avoidWrap){if(i>=this.data.list.length?i=avoidWrap?this.data.list.length-1:0:i<0&&(i=avoidWrap?0:this.data.list.length-1),this.selectedHint!=i){var node=this.hints.childNodes[this.selectedHint];node.className=node.className.replace(" "+ACTIVE_HINT_ELEMENT_CLASS,""),(node=this.hints.childNodes[this.selectedHint=i]).className+=" "+ACTIVE_HINT_ELEMENT_CLASS,node.offsetTop<this.hints.scrollTop?this.hints.scrollTop=node.offsetTop-3:node.offsetTop+node.offsetHeight>this.hints.scrollTop+this.hints.clientHeight&&(this.hints.scrollTop=node.offsetTop+node.offsetHeight-this.hints.clientHeight+3),CodeMirror.signal(this.data,"select",this.data.list[this.selectedHint],node)}},screenAmount:function(){return Math.floor(this.hints.clientHeight/this.hints.firstChild.offsetHeight)||1}},CodeMirror.registerHelper("hint","auto",{resolve:function(cm,pos){var words,helpers=cm.getHelpers(pos,"hint");if(helpers.length){var resolved=function(cm,callback,options){function run(i){if(i==app.length)return callback(null);fetchHints(app[i],cm,options,function(result){result&&result.list.length>0?callback(result):run(i+1)})}var app=applicableHelpers(cm,helpers);run(0)};return resolved.async=!0,resolved.supportsSelection=!0,resolved}return(words=cm.getHelper(cm.getCursor(),"hintWords"))?function(cm){return CodeMirror.hint.fromList(cm,{words:words})}:CodeMirror.hint.anyword?function(cm,options){return CodeMirror.hint.anyword(cm,options)}:function(){}}}),CodeMirror.registerHelper("hint","fromList",function(cm,options){var cur=cm.getCursor(),token=cm.getTokenAt(cur),to=CodeMirror.Pos(cur.line,token.end);if(token.string&&/\w/.test(token.string[token.string.length-1]))var term=token.string,from=CodeMirror.Pos(cur.line,token.start);else var term="",from=to;for(var found=[],i=0;i<options.words.length;i++){var word=options.words[i];word.slice(0,term.length)==term&&found.push(word)}if(found.length)return{list:found,from:from,to:to}}),CodeMirror.commands.autocomplete=CodeMirror.showHint;var defaultOptions={hint:CodeMirror.hint.auto,completeSingle:!0,alignWithWord:!0,closeCharacters:/[\s()\[\]{};:>,]/,closeOnUnfocus:!0,completeOnSingleClick:!0,container:null,customKeys:null,extraKeys:null};CodeMirror.defineOption("hintOptions",null)})},{"../../lib/codemirror":63}],59:[function(require,module,exports){!function(mod){mod("object"==typeof exports&&"object"==typeof module?require("../../lib/codemirror"):CodeMirror)}(function(CodeMirror){"use strict";function showTooltip(e,content){function position(e){if(!tt.parentNode)return CodeMirror.off(document,"mousemove",position);tt.style.top=Math.max(0,e.clientY-tt.offsetHeight-5)+"px",tt.style.left=e.clientX+5+"px"}var tt=document.createElement("div");return tt.className="CodeMirror-lint-tooltip",tt.appendChild(content.cloneNode(!0)),document.body.appendChild(tt),CodeMirror.on(document,"mousemove",position),position(e),null!=tt.style.opacity&&(tt.style.opacity=1),tt}function rm(elt){elt.parentNode&&elt.parentNode.removeChild(elt)}function hideTooltip(tt){tt.parentNode&&(null==tt.style.opacity&&rm(tt),tt.style.opacity=0,setTimeout(function(){rm(tt)},600))}function showTooltipFor(e,content,node){function hide(){CodeMirror.off(node,"mouseout",hide),tooltip&&(hideTooltip(tooltip),tooltip=null)}var tooltip=showTooltip(e,content),poll=setInterval(function(){if(tooltip)for(var n=node;;n=n.parentNode){if(n&&11==n.nodeType&&(n=n.host),n==document.body)return;if(!n){hide();break}}if(!tooltip)return clearInterval(poll)},400);CodeMirror.on(node,"mouseout",hide)}function LintState(cm,options,hasGutter){this.marked=[],this.options=options,this.timeout=null,this.hasGutter=hasGutter,this.onMouseOver=function(e){onMouseOver(cm,e)},this.waitingFor=0}function parseOptions(_cm,options){return options instanceof Function?{getAnnotations:options}:(options&&!0!==options||(options={}),options)}function clearMarks(cm){var state=cm.state.lint;state.hasGutter&&cm.clearGutter(GUTTER_ID);for(var i=0;i<state.marked.length;++i)state.marked[i].clear();state.marked.length=0}function makeMarker(labels,severity,multiple,tooltips){var marker=document.createElement("div"),inner=marker;return marker.className="CodeMirror-lint-marker-"+severity,multiple&&((inner=marker.appendChild(document.createElement("div"))).className="CodeMirror-lint-marker-multiple"),0!=tooltips&&CodeMirror.on(inner,"mouseover",function(e){showTooltipFor(e,labels,inner)}),marker}function getMaxSeverity(a,b){return"error"==a?a:b}function groupByLine(annotations){for(var lines=[],i=0;i<annotations.length;++i){var ann=annotations[i],line=ann.from.line;(lines[line]||(lines[line]=[])).push(ann)}return lines}function annotationTooltip(ann){var severity=ann.severity;severity||(severity="error");var tip=document.createElement("div");return tip.className="CodeMirror-lint-message-"+severity,tip.appendChild(document.createTextNode(ann.message)),tip}function lintAsync(cm,getAnnotations,passOptions){function abort(){id=-1,cm.off("change",abort)}var state=cm.state.lint,id=++state.waitingFor;cm.on("change",abort),getAnnotations(cm.getValue(),function(annotations,arg2){cm.off("change",abort),state.waitingFor==id&&(arg2&&annotations instanceof CodeMirror&&(annotations=arg2),updateLinting(cm,annotations))},passOptions,cm)}function startLinting(cm){var options=cm.state.lint.options,passOptions=options.options||options,getAnnotations=options.getAnnotations||cm.getHelper(CodeMirror.Pos(0,0),"lint");if(getAnnotations)if(options.async||getAnnotations.async)lintAsync(cm,getAnnotations,passOptions);else{var annotations=getAnnotations(cm.getValue(),passOptions,cm);if(!annotations)return;annotations.then?annotations.then(function(issues){updateLinting(cm,issues)}):updateLinting(cm,annotations)}}function updateLinting(cm,annotationsNotSorted){clearMarks(cm);for(var state=cm.state.lint,options=state.options,annotations=groupByLine(annotationsNotSorted),line=0;line<annotations.length;++line){var anns=annotations[line];if(anns){for(var maxSeverity=null,tipLabel=state.hasGutter&&document.createDocumentFragment(),i=0;i<anns.length;++i){var ann=anns[i],severity=ann.severity;severity||(severity="error"),maxSeverity=getMaxSeverity(maxSeverity,severity),options.formatAnnotation&&(ann=options.formatAnnotation(ann)),state.hasGutter&&tipLabel.appendChild(annotationTooltip(ann)),ann.to&&state.marked.push(cm.markText(ann.from,ann.to,{className:"CodeMirror-lint-mark-"+severity,__annotation:ann}))}state.hasGutter&&cm.setGutterMarker(line,GUTTER_ID,makeMarker(tipLabel,maxSeverity,anns.length>1,state.options.tooltips))}}options.onUpdateLinting&&options.onUpdateLinting(annotationsNotSorted,annotations,cm)}function onChange(cm){var state=cm.state.lint;state&&(clearTimeout(state.timeout),state.timeout=setTimeout(function(){startLinting(cm)},state.options.delay||500))}function popupTooltips(annotations,e){for(var target=e.target||e.srcElement,tooltip=document.createDocumentFragment(),i=0;i<annotations.length;i++){var ann=annotations[i];tooltip.appendChild(annotationTooltip(ann))}showTooltipFor(e,tooltip,target)}function onMouseOver(cm,e){var target=e.target||e.srcElement;if(/\bCodeMirror-lint-mark-/.test(target.className)){for(var box=target.getBoundingClientRect(),x=(box.left+box.right)/2,y=(box.top+box.bottom)/2,spans=cm.findMarksAt(cm.coordsChar({left:x,top:y},"client")),annotations=[],i=0;i<spans.length;++i){var ann=spans[i].__annotation;ann&&annotations.push(ann)}annotations.length&&popupTooltips(annotations,e)}}var GUTTER_ID="CodeMirror-lint-markers";CodeMirror.defineOption("lint",!1,function(cm,val,old){if(old&&old!=CodeMirror.Init&&(clearMarks(cm),!1!==cm.state.lint.options.lintOnChange&&cm.off("change",onChange),CodeMirror.off(cm.getWrapperElement(),"mouseover",cm.state.lint.onMouseOver),clearTimeout(cm.state.lint.timeout),delete cm.state.lint),val){for(var gutters=cm.getOption("gutters"),hasLintGutter=!1,i=0;i<gutters.length;++i)gutters[i]==GUTTER_ID&&(hasLintGutter=!0);var state=cm.state.lint=new LintState(cm,parseOptions(0,val),hasLintGutter);!1!==state.options.lintOnChange&&cm.on("change",onChange),0!=state.options.tooltips&&"gutter"!=state.options.tooltips&&CodeMirror.on(cm.getWrapperElement(),"mouseover",state.onMouseOver),startLinting(cm)}}),CodeMirror.defineExtension("performLint",function(){this.state.lint&&startLinting(this)})})},{"../../lib/codemirror":63}],60:[function(require,module,exports){!function(mod){"object"==typeof exports&&"object"==typeof module?mod(require("../../lib/codemirror"),require("./searchcursor"),require("../dialog/dialog")):mod(CodeMirror)}(function(CodeMirror){"use strict";function searchOverlay(query,caseInsensitive){return"string"==typeof query?query=new RegExp(query.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),caseInsensitive?"gi":"g"):query.global||(query=new RegExp(query.source,query.ignoreCase?"gi":"g")),{token:function(stream){query.lastIndex=stream.pos;var match=query.exec(stream.string);if(match&&match.index==stream.pos)return stream.pos+=match[0].length||1,"searching";match?stream.pos=match.index:stream.skipToEnd()}}}function SearchState(){this.posFrom=this.posTo=this.lastQuery=this.query=null,this.overlay=null}function getSearchState(cm){return cm.state.search||(cm.state.search=new SearchState)}function queryCaseInsensitive(query){return"string"==typeof query&&query==query.toLowerCase()}function getSearchCursor(cm,query,pos){return cm.getSearchCursor(query,pos,{caseFold:queryCaseInsensitive(query),multiline:!0})}function persistentDialog(cm,text,deflt,onEnter,onKeyDown){cm.openDialog(text,onEnter,{value:deflt,selectValueOnOpen:!0,closeOnEnter:!1,onClose:function(){clearSearch(cm)},onKeyDown:onKeyDown})}function dialog(cm,text,shortText,deflt,f){cm.openDialog?cm.openDialog(text,f,{value:deflt,selectValueOnOpen:!0}):f(prompt(shortText,deflt))}function confirmDialog(cm,text,shortText,fs){cm.openConfirm?cm.openConfirm(text,fs):confirm(shortText)&&fs[0]()}function parseString(string){return string.replace(/\\(.)/g,function(_,ch){return"n"==ch?"\n":"r"==ch?"\r":ch})}function parseQuery(query){var isRE=query.match(/^\/(.*)\/([a-z]*)$/);if(isRE)try{query=new RegExp(isRE[1],-1==isRE[2].indexOf("i")?"":"i")}catch(e){}else query=parseString(query);return("string"==typeof query?""==query:query.test(""))&&(query=/x^/),query}function startSearch(cm,state,query){state.queryText=query,state.query=parseQuery(query),cm.removeOverlay(state.overlay,queryCaseInsensitive(state.query)),state.overlay=searchOverlay(state.query,queryCaseInsensitive(state.query)),cm.addOverlay(state.overlay),cm.showMatchesOnScrollbar&&(state.annotate&&(state.annotate.clear(),state.annotate=null),state.annotate=cm.showMatchesOnScrollbar(state.query,queryCaseInsensitive(state.query)))}function doSearch(cm,rev,persistent,immediate){var state=getSearchState(cm);if(state.query)return findNext(cm,rev);var q=cm.getSelection()||state.lastQuery;if(persistent&&cm.openDialog){var hiding=null,searchNext=function(query,event){CodeMirror.e_stop(event),query&&(query!=state.queryText&&(startSearch(cm,state,query),state.posFrom=state.posTo=cm.getCursor()),hiding&&(hiding.style.opacity=1),findNext(cm,event.shiftKey,function(_,to){var dialog;to.line<3&&document.querySelector&&(dialog=cm.display.wrapper.querySelector(".CodeMirror-dialog"))&&dialog.getBoundingClientRect().bottom-4>cm.cursorCoords(to,"window").top&&((hiding=dialog).style.opacity=.4)}))};persistentDialog(cm,queryDialog,q,searchNext,function(event,query){var keyName=CodeMirror.keyName(event),cmd=CodeMirror.keyMap[cm.getOption("keyMap")][keyName];cmd||(cmd=cm.getOption("extraKeys")[keyName]),"findNext"==cmd||"findPrev"==cmd||"findPersistentNext"==cmd||"findPersistentPrev"==cmd?(CodeMirror.e_stop(event),startSearch(cm,getSearchState(cm),query),cm.execCommand(cmd)):"find"!=cmd&&"findPersistent"!=cmd||(CodeMirror.e_stop(event),searchNext(query,event))}),immediate&&q&&(startSearch(cm,state,q),findNext(cm,rev))}else dialog(cm,queryDialog,"Search for:",q,function(query){query&&!state.query&&cm.operation(function(){startSearch(cm,state,query),state.posFrom=state.posTo=cm.getCursor(),findNext(cm,rev)})})}function findNext(cm,rev,callback){cm.operation(function(){var state=getSearchState(cm),cursor=getSearchCursor(cm,state.query,rev?state.posFrom:state.posTo);(cursor.find(rev)||(cursor=getSearchCursor(cm,state.query,rev?CodeMirror.Pos(cm.lastLine()):CodeMirror.Pos(cm.firstLine(),0))).find(rev))&&(cm.setSelection(cursor.from(),cursor.to()),cm.scrollIntoView({from:cursor.from(),to:cursor.to()},20),state.posFrom=cursor.from(),state.posTo=cursor.to(),callback&&callback(cursor.from(),cursor.to()))})}function clearSearch(cm){cm.operation(function(){var state=getSearchState(cm);state.lastQuery=state.query,state.query&&(state.query=state.queryText=null,cm.removeOverlay(state.overlay),state.annotate&&(state.annotate.clear(),state.annotate=null))})}function replaceAll(cm,query,text){cm.operation(function(){for(var cursor=getSearchCursor(cm,query);cursor.findNext();)if("string"!=typeof query){var match=cm.getRange(cursor.from(),cursor.to()).match(query);cursor.replace(text.replace(/\$(\d)/g,function(_,i){return match[i]}))}else cursor.replace(text)})}function replace(cm,all){if(!cm.getOption("readOnly")){var query=cm.getSelection()||getSearchState(cm).lastQuery,dialogText='<span class="CodeMirror-search-label">'+(all?"Replace all:":"Replace:")+"</span>";dialog(cm,dialogText+replaceQueryDialog,dialogText,query,function(query){query&&(query=parseQuery(query),dialog(cm,replacementQueryDialog,"Replace with:","",function(text){if(text=parseString(text),all)replaceAll(cm,query,text);else{clearSearch(cm);var cursor=getSearchCursor(cm,query,cm.getCursor("from")),advance=function(){var match,start=cursor.from();!(match=cursor.findNext())&&(cursor=getSearchCursor(cm,query),!(match=cursor.findNext())||start&&cursor.from().line==start.line&&cursor.from().ch==start.ch)||(cm.setSelection(cursor.from(),cursor.to()),cm.scrollIntoView({from:cursor.from(),to:cursor.to()}),confirmDialog(cm,doReplaceConfirm,"Replace?",[function(){doReplace(match)},advance,function(){replaceAll(cm,query,text)}]))},doReplace=function(match){cursor.replace("string"==typeof query?text:text.replace(/\$(\d)/g,function(_,i){return match[i]})),advance()};advance()}}))})}}var queryDialog='<span class="CodeMirror-search-label">Search:</span> <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">(Use /re/ syntax for regexp search)</span>',replaceQueryDialog=' <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">(Use /re/ syntax for regexp search)</span>',replacementQueryDialog='<span class="CodeMirror-search-label">With:</span> <input type="text" style="width: 10em" class="CodeMirror-search-field"/>',doReplaceConfirm='<span class="CodeMirror-search-label">Replace?</span> <button>Yes</button> <button>No</button> <button>All</button> <button>Stop</button>';CodeMirror.commands.find=function(cm){clearSearch(cm),doSearch(cm)},CodeMirror.commands.findPersistent=function(cm){clearSearch(cm),doSearch(cm,!1,!0)},CodeMirror.commands.findPersistentNext=function(cm){doSearch(cm,!1,!0,!0)},CodeMirror.commands.findPersistentPrev=function(cm){doSearch(cm,!0,!0,!0)},CodeMirror.commands.findNext=doSearch,CodeMirror.commands.findPrev=function(cm){doSearch(cm,!0)},CodeMirror.commands.clearSearch=clearSearch,CodeMirror.commands.replace=replace,CodeMirror.commands.replaceAll=function(cm){replace(cm,!0)}})},{"../../lib/codemirror":63,"../dialog/dialog":52,"./searchcursor":61}],61:[function(require,module,exports){!function(mod){mod("object"==typeof exports&&"object"==typeof module?require("../../lib/codemirror"):CodeMirror)}(function(CodeMirror){"use strict";function regexpFlags(regexp){var flags=regexp.flags;return null!=flags?flags:(regexp.ignoreCase?"i":"")+(regexp.global?"g":"")+(regexp.multiline?"m":"")}function ensureGlobal(regexp){return regexp.global?regexp:new RegExp(regexp.source,regexpFlags(regexp)+"g")}function maybeMultiline(regexp){return/\\s|\\n|\n|\\W|\\D|\[\^/.test(regexp.source)}function searchRegexpForward(doc,regexp,start){regexp=ensureGlobal(regexp);for(var line=start.line,ch=start.ch,last=doc.lastLine();line<=last;line++,ch=0){regexp.lastIndex=ch;var string=doc.getLine(line),match=regexp.exec(string);if(match)return{from:Pos(line,match.index),to:Pos(line,match.index+match[0].length),match:match}}}function searchRegexpForwardMultiline(doc,regexp,start){if(!maybeMultiline(regexp))return searchRegexpForward(doc,regexp,start);regexp=ensureGlobal(regexp);for(var string,chunk=1,line=start.line,last=doc.lastLine();line<=last;){for(var i=0;i<chunk;i++){var curLine=doc.getLine(line++);string=null==string?curLine:string+"\n"+curLine}chunk*=2,regexp.lastIndex=start.ch;var match=regexp.exec(string);if(match){var before=string.slice(0,match.index).split("\n"),inside=match[0].split("\n"),startLine=start.line+before.length-1,startCh=before[before.length-1].length;return{from:Pos(startLine,startCh),to:Pos(startLine+inside.length-1,1==inside.length?startCh+inside[0].length:inside[inside.length-1].length),match:match}}}}function lastMatchIn(string,regexp){for(var match,cutOff=0;;){regexp.lastIndex=cutOff;var newMatch=regexp.exec(string);if(!newMatch)return match;if(match=newMatch,(cutOff=match.index+(match[0].length||1))==string.length)return match}}function searchRegexpBackward(doc,regexp,start){regexp=ensureGlobal(regexp);for(var line=start.line,ch=start.ch,first=doc.firstLine();line>=first;line--,ch=-1){var string=doc.getLine(line);ch>-1&&(string=string.slice(0,ch));var match=lastMatchIn(string,regexp);if(match)return{from:Pos(line,match.index),to:Pos(line,match.index+match[0].length),match:match}}}function searchRegexpBackwardMultiline(doc,regexp,start){regexp=ensureGlobal(regexp);for(var string,chunk=1,line=start.line,first=doc.firstLine();line>=first;){for(var i=0;i<chunk;i++){var curLine=doc.getLine(line--);string=null==string?curLine.slice(0,start.ch):curLine+"\n"+string}chunk*=2;var match=lastMatchIn(string,regexp);if(match){var before=string.slice(0,match.index).split("\n"),inside=match[0].split("\n"),startLine=line+before.length,startCh=before[before.length-1].length;return{from:Pos(startLine,startCh),to:Pos(startLine+inside.length-1,1==inside.length?startCh+inside[0].length:inside[inside.length-1].length),match:match}}}}function adjustPos(orig,folded,pos){if(orig.length==folded.length)return pos;for(var pos1=Math.min(pos,orig.length);;){var len1=orig.slice(0,pos1).toLowerCase().length;if(len1<pos)++pos1;else{if(!(len1>pos))return pos1;--pos1}}}function searchStringForward(doc,query,start,caseFold){if(!query.length)return null;var fold=caseFold?doFold:noFold,lines=fold(query).split(/\r|\n\r?/);search:for(var line=start.line,ch=start.ch,last=doc.lastLine()+1-lines.length;line<=last;line++,ch=0){var orig=doc.getLine(line).slice(ch),string=fold(orig);if(1==lines.length){var found=string.indexOf(lines[0]);if(-1==found)continue search;var start=adjustPos(orig,string,found)+ch;return{from:Pos(line,adjustPos(orig,string,found)+ch),to:Pos(line,adjustPos(orig,string,found+lines[0].length)+ch)}}var cutFrom=string.length-lines[0].length;if(string.slice(cutFrom)==lines[0]){for(var i=1;i<lines.length-1;i++)if(fold(doc.getLine(line+i))!=lines[i])continue search;var end=doc.getLine(line+lines.length-1),endString=fold(end),lastLine=lines[lines.length-1];if(end.slice(0,lastLine.length)==lastLine)return{from:Pos(line,adjustPos(orig,string,cutFrom)+ch),to:Pos(line+lines.length-1,adjustPos(end,endString,lastLine.length))}}}}function searchStringBackward(doc,query,start,caseFold){if(!query.length)return null;var fold=caseFold?doFold:noFold,lines=fold(query).split(/\r|\n\r?/);search:for(var line=start.line,ch=start.ch,first=doc.firstLine()-1+lines.length;line>=first;line--,ch=-1){var orig=doc.getLine(line);ch>-1&&(orig=orig.slice(0,ch));var string=fold(orig);if(1==lines.length){var found=string.lastIndexOf(lines[0]);if(-1==found)continue search;return{from:Pos(line,adjustPos(orig,string,found)),to:Pos(line,adjustPos(orig,string,found+lines[0].length))}}var lastLine=lines[lines.length-1];if(string.slice(0,lastLine.length)==lastLine){for(var i=1,start=line-lines.length+1;i<lines.length-1;i++)if(fold(doc.getLine(start+i))!=lines[i])continue search;var top=doc.getLine(line+1-lines.length),topString=fold(top);if(topString.slice(topString.length-lines[0].length)==lines[0])return{from:Pos(line+1-lines.length,adjustPos(top,topString,top.length-lines[0].length)),to:Pos(line,adjustPos(orig,string,lastLine.length))}}}}function SearchCursor(doc,query,pos,options){this.atOccurrence=!1,this.doc=doc,pos=pos?doc.clipPos(pos):Pos(0,0),this.pos={from:pos,to:pos};var caseFold;"object"==typeof options?caseFold=options.caseFold:(caseFold=options,options=null),"string"==typeof query?(null==caseFold&&(caseFold=!1),this.matches=function(reverse,pos){return(reverse?searchStringBackward:searchStringForward)(doc,query,pos,caseFold)}):(query=ensureGlobal(query),options&&!1===options.multiline?this.matches=function(reverse,pos){return(reverse?searchRegexpBackward:searchRegexpForward)(doc,query,pos)}:this.matches=function(reverse,pos){return(reverse?searchRegexpBackwardMultiline:searchRegexpForwardMultiline)(doc,query,pos)})}var doFold,noFold,Pos=CodeMirror.Pos;String.prototype.normalize?(doFold=function(str){return str.normalize("NFD").toLowerCase()},noFold=function(str){return str.normalize("NFD")}):(doFold=function(str){return str.toLowerCase()},noFold=function(str){return str}),SearchCursor.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(reverse){for(var result=this.matches(reverse,this.doc.clipPos(reverse?this.pos.from:this.pos.to));result&&0==CodeMirror.cmpPos(result.from,result.to);)reverse?result.from.ch?result.from=Pos(result.from.line,result.from.ch-1):result=result.from.line==this.doc.firstLine()?null:this.matches(reverse,this.doc.clipPos(Pos(result.from.line-1))):result.to.ch<this.doc.getLine(result.to.line).length?result.to=Pos(result.to.line,result.to.ch+1):result=result.to.line==this.doc.lastLine()?null:this.matches(reverse,Pos(result.to.line+1,0));if(result)return this.pos=result,this.atOccurrence=!0,this.pos.match||!0;var end=Pos(reverse?this.doc.firstLine():this.doc.lastLine()+1,0);return this.pos={from:end,to:end},this.atOccurrence=!1},from:function(){if(this.atOccurrence)return this.pos.from},to:function(){if(this.atOccurrence)return this.pos.to},replace:function(newText,origin){if(this.atOccurrence){var lines=CodeMirror.splitLines(newText);this.doc.replaceRange(lines,this.pos.from,this.pos.to,origin),this.pos.to=Pos(this.pos.from.line+lines.length-1,lines[lines.length-1].length+(1==lines.length?this.pos.from.ch:0))}}},CodeMirror.defineExtension("getSearchCursor",function(query,pos,caseFold){return new SearchCursor(this.doc,query,pos,caseFold)}),CodeMirror.defineDocExtension("getSearchCursor",function(query,pos,caseFold){return new SearchCursor(this,query,pos,caseFold)}),CodeMirror.defineExtension("selectMatches",function(query,caseFold){for(var ranges=[],cur=this.getSearchCursor(query,this.getCursor("from"),caseFold);cur.findNext()&&!(CodeMirror.cmpPos(cur.to(),this.getCursor("to"))>0);)ranges.push({anchor:cur.from(),head:cur.to()});ranges.length&&this.setSelections(ranges,0)})})},{"../../lib/codemirror":63}],62:[function(require,module,exports){!function(mod){"object"==typeof exports&&"object"==typeof module?mod(require("../lib/codemirror"),require("../addon/search/searchcursor"),require("../addon/edit/matchbrackets")):mod(CodeMirror)}(function(CodeMirror){"use strict";function findPosSubword(doc,start,dir){if(dir<0&&0==start.ch)return doc.clipPos(Pos(start.line-1));var line=doc.getLine(start.line);if(dir>0&&start.ch>=line.length)return doc.clipPos(Pos(start.line+1,0));for(var type,state="start",pos=start.ch,e=dir<0?0:line.length,i=0;pos!=e;pos+=dir,i++){var next=line.charAt(dir<0?pos-1:pos),cat="_"!=next&&CodeMirror.isWordChar(next)?"w":"o";if("w"==cat&&next.toUpperCase()==next&&(cat="W"),"start"==state)"o"!=cat&&(state="in",type=cat);else if("in"==state&&type!=cat){if("w"==type&&"W"==cat&&dir<0&&pos--,"W"==type&&"w"==cat&&dir>0){type="w";continue}break}}return Pos(start.line,pos)}function moveSubword(cm,dir){cm.extendSelectionsBy(function(range){return cm.display.shift||cm.doc.extend||range.empty()?findPosSubword(cm.doc,range.head,dir):dir<0?range.from():range.to()})}function insertLine(cm,above){if(cm.isReadOnly())return CodeMirror.Pass;cm.operation(function(){for(var len=cm.listSelections().length,newSelection=[],last=-1,i=0;i<len;i++){var head=cm.listSelections()[i].head;if(!(head.line<=last)){var at=Pos(head.line+(above?0:1),0);cm.replaceRange("\n",at,null,"+insertLine"),cm.indentLine(at.line,null,!0),newSelection.push({head:at,anchor:at}),last=head.line+1}}cm.setSelections(newSelection)}),cm.execCommand("indentAuto")}function wordAt(cm,pos){for(var start=pos.ch,end=start,line=cm.getLine(pos.line);start&&CodeMirror.isWordChar(line.charAt(start-1));)--start;for(;end<line.length&&CodeMirror.isWordChar(line.charAt(end));)++end;return{from:Pos(pos.line,start),to:Pos(pos.line,end),word:line.slice(start,end)}}function isSelectedRange(ranges,from,to){for(var i=0;i<ranges.length;i++)if(ranges[i].from()==from&&ranges[i].to()==to)return!0;return!1}function selectBetweenBrackets(cm){for(var ranges=cm.listSelections(),newRanges=[],i=0;i<ranges.length;i++){var pos=ranges[i].head,opening=cm.scanForBracket(pos,-1);if(!opening)return!1;for(;;){var closing=cm.scanForBracket(pos,1);if(!closing)return!1;if(closing.ch==mirror.charAt(mirror.indexOf(opening.ch)+1)){newRanges.push({anchor:Pos(opening.pos.line,opening.pos.ch+1),head:closing.pos});break}pos=Pos(closing.pos.line,closing.pos.ch+1)}}return cm.setSelections(newRanges),!0}function sortLines(cm,caseSensitive){if(cm.isReadOnly())return CodeMirror.Pass;for(var selected,ranges=cm.listSelections(),toSort=[],i=0;i<ranges.length;i++){var range=ranges[i];if(!range.empty()){for(var from=range.from().line,to=range.to().line;i<ranges.length-1&&ranges[i+1].from().line==to;)to=ranges[++i].to().line;ranges[i].to().ch||to--,toSort.push(from,to)}}toSort.length?selected=!0:toSort.push(cm.firstLine(),cm.lastLine()),cm.operation(function(){for(var ranges=[],i=0;i<toSort.length;i+=2){var from=toSort[i],to=toSort[i+1],start=Pos(from,0),end=Pos(to),lines=cm.getRange(start,end,!1);caseSensitive?lines.sort():lines.sort(function(a,b){var au=a.toUpperCase(),bu=b.toUpperCase();return au!=bu&&(a=au,b=bu),a<b?-1:a==b?0:1}),cm.replaceRange(lines,start,end),selected&&ranges.push({anchor:start,head:Pos(to+1,0)})}selected&&cm.setSelections(ranges,0)})}function modifyWordOrSelection(cm,mod){cm.operation(function(){for(var ranges=cm.listSelections(),indices=[],replacements=[],i=0;i<ranges.length;i++)(range=ranges[i]).empty()?(indices.push(i),replacements.push("")):replacements.push(mod(cm.getRange(range.from(),range.to())));cm.replaceSelections(replacements,"around","case");for(var at,i=indices.length-1;i>=0;i--){var range=ranges[indices[i]];if(!(at&&CodeMirror.cmpPos(range.head,at)>0)){var word=wordAt(cm,range.head);at=word.from,cm.replaceRange(mod(word.word),word.from,word.to)}}})}function getTarget(cm){var from=cm.getCursor("from"),to=cm.getCursor("to");if(0==CodeMirror.cmpPos(from,to)){var word=wordAt(cm,from);if(!word.word)return;from=word.from,to=word.to}return{from:from,to:to,query:cm.getRange(from,to),word:word}}function findAndGoTo(cm,forward){var target=getTarget(cm);if(target){var query=target.query,cur=cm.getSearchCursor(query,forward?target.to:target.from);(forward?cur.findNext():cur.findPrevious())?cm.setSelection(cur.from(),cur.to()):(cur=cm.getSearchCursor(query,forward?Pos(cm.firstLine(),0):cm.clipPos(Pos(cm.lastLine()))),(forward?cur.findNext():cur.findPrevious())?cm.setSelection(cur.from(),cur.to()):target.word&&cm.setSelection(target.from,target.to))}}var map=CodeMirror.keyMap.sublime={fallthrough:"default"},cmds=CodeMirror.commands,Pos=CodeMirror.Pos,mac=CodeMirror.keyMap.default==CodeMirror.keyMap.macDefault,ctrl=mac?"Cmd-":"Ctrl-",goSubwordCombo=mac?"Ctrl-":"Alt-";cmds[map[goSubwordCombo+"Left"]="goSubwordLeft"]=function(cm){moveSubword(cm,-1)},cmds[map[goSubwordCombo+"Right"]="goSubwordRight"]=function(cm){moveSubword(cm,1)},mac&&(map["Cmd-Left"]="goLineStartSmart");var scrollLineCombo=mac?"Ctrl-Alt-":"Ctrl-";cmds[map[scrollLineCombo+"Up"]="scrollLineUp"]=function(cm){var info=cm.getScrollInfo();if(!cm.somethingSelected()){var visibleBottomLine=cm.lineAtHeight(info.top+info.clientHeight,"local");cm.getCursor().line>=visibleBottomLine&&cm.execCommand("goLineUp")}cm.scrollTo(null,info.top-cm.defaultTextHeight())},cmds[map[scrollLineCombo+"Down"]="scrollLineDown"]=function(cm){var info=cm.getScrollInfo();if(!cm.somethingSelected()){var visibleTopLine=cm.lineAtHeight(info.top,"local")+1;cm.getCursor().line<=visibleTopLine&&cm.execCommand("goLineDown")}cm.scrollTo(null,info.top+cm.defaultTextHeight())},cmds[map["Shift-"+ctrl+"L"]="splitSelectionByLine"]=function(cm){for(var ranges=cm.listSelections(),lineRanges=[],i=0;i<ranges.length;i++)for(var from=ranges[i].from(),to=ranges[i].to(),line=from.line;line<=to.line;++line)to.line>from.line&&line==to.line&&0==to.ch||lineRanges.push({anchor:line==from.line?from:Pos(line,0),head:line==to.line?to:Pos(line)});cm.setSelections(lineRanges,0)},map["Shift-Tab"]="indentLess",cmds[map.Esc="singleSelectionTop"]=function(cm){var range=cm.listSelections()[0];cm.setSelection(range.anchor,range.head,{scroll:!1})},cmds[map[ctrl+"L"]="selectLine"]=function(cm){for(var ranges=cm.listSelections(),extended=[],i=0;i<ranges.length;i++){var range=ranges[i];extended.push({anchor:Pos(range.from().line,0),head:Pos(range.to().line+1,0)})}cm.setSelections(extended)},map["Shift-Ctrl-K"]="deleteLine",cmds[map[ctrl+"Enter"]="insertLineAfter"]=function(cm){return insertLine(cm,!1)},cmds[map["Shift-"+ctrl+"Enter"]="insertLineBefore"]=function(cm){return insertLine(cm,!0)},cmds[map[ctrl+"D"]="selectNextOccurrence"]=function(cm){var from=cm.getCursor("from"),to=cm.getCursor("to"),fullWord=cm.state.sublimeFindFullWord==cm.doc.sel;if(0==CodeMirror.cmpPos(from,to)){var word=wordAt(cm,from);if(!word.word)return;cm.setSelection(word.from,word.to),fullWord=!0}else{var text=cm.getRange(from,to),query=fullWord?new RegExp("\\b"+text+"\\b"):text,cur=cm.getSearchCursor(query,to),found=cur.findNext();if(found||(found=(cur=cm.getSearchCursor(query,Pos(cm.firstLine(),0))).findNext()),!found||isSelectedRange(cm.listSelections(),cur.from(),cur.to()))return CodeMirror.Pass;cm.addSelection(cur.from(),cur.to())}fullWord&&(cm.state.sublimeFindFullWord=cm.doc.sel)};var mirror="(){}[]";cmds[map["Shift-"+ctrl+"Space"]="selectScope"]=function(cm){selectBetweenBrackets(cm)||cm.execCommand("selectAll")},cmds[map["Shift-"+ctrl+"M"]="selectBetweenBrackets"]=function(cm){if(!selectBetweenBrackets(cm))return CodeMirror.Pass},cmds[map[ctrl+"M"]="goToBracket"]=function(cm){cm.extendSelectionsBy(function(range){var next=cm.scanForBracket(range.head,1);if(next&&0!=CodeMirror.cmpPos(next.pos,range.head))return next.pos;var prev=cm.scanForBracket(range.head,-1);return prev&&Pos(prev.pos.line,prev.pos.ch+1)||range.head})};var swapLineCombo=mac?"Cmd-Ctrl-":"Shift-Ctrl-";cmds[map[swapLineCombo+"Up"]="swapLineUp"]=function(cm){if(cm.isReadOnly())return CodeMirror.Pass;for(var ranges=cm.listSelections(),linesToMove=[],at=cm.firstLine()-1,newSels=[],i=0;i<ranges.length;i++){var range=ranges[i],from=range.from().line-1,to=range.to().line;newSels.push({anchor:Pos(range.anchor.line-1,range.anchor.ch),head:Pos(range.head.line-1,range.head.ch)}),0!=range.to().ch||range.empty()||--to,from>at?linesToMove.push(from,to):linesToMove.length&&(linesToMove[linesToMove.length-1]=to),at=to}cm.operation(function(){for(var i=0;i<linesToMove.length;i+=2){var from=linesToMove[i],to=linesToMove[i+1],line=cm.getLine(from);cm.replaceRange("",Pos(from,0),Pos(from+1,0),"+swapLine"),to>cm.lastLine()?cm.replaceRange("\n"+line,Pos(cm.lastLine()),null,"+swapLine"):cm.replaceRange(line+"\n",Pos(to,0),null,"+swapLine")}cm.setSelections(newSels),cm.scrollIntoView()})},cmds[map[swapLineCombo+"Down"]="swapLineDown"]=function(cm){if(cm.isReadOnly())return CodeMirror.Pass;for(var ranges=cm.listSelections(),linesToMove=[],at=cm.lastLine()+1,i=ranges.length-1;i>=0;i--){var range=ranges[i],from=range.to().line+1,to=range.from().line;0!=range.to().ch||range.empty()||from--,from<at?linesToMove.push(from,to):linesToMove.length&&(linesToMove[linesToMove.length-1]=to),at=to}cm.operation(function(){for(var i=linesToMove.length-2;i>=0;i-=2){var from=linesToMove[i],to=linesToMove[i+1],line=cm.getLine(from);from==cm.lastLine()?cm.replaceRange("",Pos(from-1),Pos(from),"+swapLine"):cm.replaceRange("",Pos(from,0),Pos(from+1,0),"+swapLine"),cm.replaceRange(line+"\n",Pos(to,0),null,"+swapLine")}cm.scrollIntoView()})},cmds[map[ctrl+"/"]="toggleCommentIndented"]=function(cm){cm.toggleComment({indent:!0})},cmds[map[ctrl+"J"]="joinLines"]=function(cm){for(var ranges=cm.listSelections(),joined=[],i=0;i<ranges.length;i++){for(var range=ranges[i],from=range.from(),start=from.line,end=range.to().line;i<ranges.length-1&&ranges[i+1].from().line==end;)end=ranges[++i].to().line;joined.push({start:start,end:end,anchor:!range.empty()&&from})}cm.operation(function(){for(var offset=0,ranges=[],i=0;i<joined.length;i++){for(var head,obj=joined[i],anchor=obj.anchor&&Pos(obj.anchor.line-offset,obj.anchor.ch),line=obj.start;line<=obj.end;line++){var actual=line-offset;line==obj.end&&(head=Pos(actual,cm.getLine(actual).length+1)),actual<cm.lastLine()&&(cm.replaceRange(" ",Pos(actual),Pos(actual+1,/^\s*/.exec(cm.getLine(actual+1))[0].length)),++offset)}ranges.push({anchor:anchor||head,head:head})}cm.setSelections(ranges,0)})},cmds[map["Shift-"+ctrl+"D"]="duplicateLine"]=function(cm){cm.operation(function(){for(var rangeCount=cm.listSelections().length,i=0;i<rangeCount;i++){var range=cm.listSelections()[i];range.empty()?cm.replaceRange(cm.getLine(range.head.line)+"\n",Pos(range.head.line,0)):cm.replaceRange(cm.getRange(range.from(),range.to()),range.from())}cm.scrollIntoView()})},mac||(map[ctrl+"T"]="transposeChars"),cmds[map.F9="sortLines"]=function(cm){sortLines(cm,!0)},cmds[map[ctrl+"F9"]="sortLinesInsensitive"]=function(cm){sortLines(cm,!1)},cmds[map.F2="nextBookmark"]=function(cm){var marks=cm.state.sublimeBookmarks;if(marks)for(;marks.length;){var current=marks.shift(),found=current.find();if(found)return marks.push(current),cm.setSelection(found.from,found.to)}},cmds[map["Shift-F2"]="prevBookmark"]=function(cm){var marks=cm.state.sublimeBookmarks;if(marks)for(;marks.length;){marks.unshift(marks.pop());var found=marks[marks.length-1].find();if(found)return cm.setSelection(found.from,found.to);marks.pop()}},cmds[map[ctrl+"F2"]="toggleBookmark"]=function(cm){for(var ranges=cm.listSelections(),marks=cm.state.sublimeBookmarks||(cm.state.sublimeBookmarks=[]),i=0;i<ranges.length;i++){for(var from=ranges[i].from(),to=ranges[i].to(),found=cm.findMarks(from,to),j=0;j<found.length;j++)if(found[j].sublimeBookmark){found[j].clear();for(var k=0;k<marks.length;k++)marks[k]==found[j]&&marks.splice(k--,1);break}j==found.length&&marks.push(cm.markText(from,to,{sublimeBookmark:!0,clearWhenEmpty:!1}))}},cmds[map["Shift-"+ctrl+"F2"]="clearBookmarks"]=function(cm){var marks=cm.state.sublimeBookmarks;if(marks)for(var i=0;i<marks.length;i++)marks[i].clear();marks.length=0},cmds[map["Alt-F2"]="selectBookmarks"]=function(cm){var marks=cm.state.sublimeBookmarks,ranges=[];if(marks)for(var i=0;i<marks.length;i++){var found=marks[i].find();found?ranges.push({anchor:found.from,head:found.to}):marks.splice(i--,0)}ranges.length&&cm.setSelections(ranges,0)},map["Alt-Q"]="wrapLines";var cK=ctrl+"K ";map[cK+ctrl+"Backspace"]="delLineLeft",cmds[map.Backspace="smartBackspace"]=function(cm){if(cm.somethingSelected())return CodeMirror.Pass;cm.operation(function(){for(var cursors=cm.listSelections(),indentUnit=cm.getOption("indentUnit"),i=cursors.length-1;i>=0;i--){var cursor=cursors[i].head,toStartOfLine=cm.getRange({line:cursor.line,ch:0},cursor),column=CodeMirror.countColumn(toStartOfLine,null,cm.getOption("tabSize")),deletePos=cm.findPosH(cursor,-1,"char",!1);if(toStartOfLine&&!/\S/.test(toStartOfLine)&&column%indentUnit==0){var prevIndent=new Pos(cursor.line,CodeMirror.findColumn(toStartOfLine,column-indentUnit,indentUnit));prevIndent.ch!=cursor.ch&&(deletePos=prevIndent)}cm.replaceRange("",deletePos,cursor,"+delete")}})},cmds[map[cK+ctrl+"K"]="delLineRight"]=function(cm){cm.operation(function(){for(var ranges=cm.listSelections(),i=ranges.length-1;i>=0;i--)cm.replaceRange("",ranges[i].anchor,Pos(ranges[i].to().line),"+delete");cm.scrollIntoView()})},cmds[map[cK+ctrl+"U"]="upcaseAtCursor"]=function(cm){modifyWordOrSelection(cm,function(str){return str.toUpperCase()})},cmds[map[cK+ctrl+"L"]="downcaseAtCursor"]=function(cm){modifyWordOrSelection(cm,function(str){return str.toLowerCase()})},cmds[map[cK+ctrl+"Space"]="setSublimeMark"]=function(cm){cm.state.sublimeMark&&cm.state.sublimeMark.clear(),cm.state.sublimeMark=cm.setBookmark(cm.getCursor())},cmds[map[cK+ctrl+"A"]="selectToSublimeMark"]=function(cm){var found=cm.state.sublimeMark&&cm.state.sublimeMark.find();found&&cm.setSelection(cm.getCursor(),found)},cmds[map[cK+ctrl+"W"]="deleteToSublimeMark"]=function(cm){var found=cm.state.sublimeMark&&cm.state.sublimeMark.find();if(found){var from=cm.getCursor(),to=found;if(CodeMirror.cmpPos(from,to)>0){var tmp=to;to=from,from=tmp}cm.state.sublimeKilled=cm.getRange(from,to),cm.replaceRange("",from,to)}},cmds[map[cK+ctrl+"X"]="swapWithSublimeMark"]=function(cm){var found=cm.state.sublimeMark&&cm.state.sublimeMark.find();found&&(cm.state.sublimeMark.clear(),cm.state.sublimeMark=cm.setBookmark(cm.getCursor()),cm.setCursor(found))},cmds[map[cK+ctrl+"Y"]="sublimeYank"]=function(cm){null!=cm.state.sublimeKilled&&cm.replaceSelection(cm.state.sublimeKilled,null,"paste")},map[cK+ctrl+"G"]="clearBookmarks",cmds[map[cK+ctrl+"C"]="showInCenter"]=function(cm){var pos=cm.cursorCoords(null,"local");cm.scrollTo(null,(pos.top+pos.bottom)/2-cm.getScrollInfo().clientHeight/2)};var selectLinesCombo=mac?"Ctrl-Shift-":"Ctrl-Alt-";cmds[map[selectLinesCombo+"Up"]="selectLinesUpward"]=function(cm){cm.operation(function(){for(var ranges=cm.listSelections(),i=0;i<ranges.length;i++){var range=ranges[i];range.head.line>cm.firstLine()&&cm.addSelection(Pos(range.head.line-1,range.head.ch))}})},cmds[map[selectLinesCombo+"Down"]="selectLinesDownward"]=function(cm){cm.operation(function(){for(var ranges=cm.listSelections(),i=0;i<ranges.length;i++){var range=ranges[i];range.head.line<cm.lastLine()&&cm.addSelection(Pos(range.head.line+1,range.head.ch))}})},cmds[map[ctrl+"F3"]="findUnder"]=function(cm){findAndGoTo(cm,!0)},cmds[map["Shift-"+ctrl+"F3"]="findUnderPrevious"]=function(cm){findAndGoTo(cm,!1)},cmds[map["Alt-F3"]="findAllUnder"]=function(cm){var target=getTarget(cm);if(target){for(var cur=cm.getSearchCursor(target.query),matches=[],primaryIndex=-1;cur.findNext();)matches.push({anchor:cur.from(),head:cur.to()}),cur.from().line<=target.from.line&&cur.from().ch<=target.from.ch&&primaryIndex++;cm.setSelections(matches,primaryIndex)}},map["Shift-"+ctrl+"["]="fold",map["Shift-"+ctrl+"]"]="unfold",map[cK+ctrl+"0"]=map[cK+ctrl+"J"]="unfoldAll",map[ctrl+"I"]="findIncremental",map["Shift-"+ctrl+"I"]="findIncrementalReverse",map[ctrl+"H"]="replace",map.F3="findNext",map["Shift-F3"]="findPrev",CodeMirror.normalizeKeyMap(map)})},{"../addon/edit/matchbrackets":54,"../addon/search/searchcursor":61,"../lib/codemirror":63}],63:[function(require,module,exports){!function(global,factory){"object"==typeof exports&&void 0!==module?module.exports=factory():global.CodeMirror=factory()}(this,function(){"use strict";function classTest(cls){return new RegExp("(^|\\s)"+cls+"(?:$|\\s)\\s*")}function removeChildren(e){for(var count=e.childNodes.length;count>0;--count)e.removeChild(e.firstChild);return e}function removeChildrenAndAdd(parent,e){return removeChildren(parent).appendChild(e)}function elt(tag,content,className,style){var e=document.createElement(tag);if(className&&(e.className=className),style&&(e.style.cssText=style),"string"==typeof content)e.appendChild(document.createTextNode(content));else if(content)for(var i=0;i<content.length;++i)e.appendChild(content[i]);return e}function eltP(tag,content,className,style){var e=elt(tag,content,className,style);return e.setAttribute("role","presentation"),e}function contains(parent,child){if(3==child.nodeType&&(child=child.parentNode),parent.contains)return parent.contains(child);do{if(11==child.nodeType&&(child=child.host),child==parent)return!0}while(child=child.parentNode)}function activeElt(){var activeElement;try{activeElement=document.activeElement}catch(e){activeElement=document.body||null}for(;activeElement&&activeElement.shadowRoot&&activeElement.shadowRoot.activeElement;)activeElement=activeElement.shadowRoot.activeElement;return activeElement}function addClass(node,cls){var current=node.className;classTest(cls).test(current)||(node.className+=(current?" ":"")+cls)}function joinClasses(a,b){for(var as=a.split(" "),i=0;i<as.length;i++)as[i]&&!classTest(as[i]).test(b)&&(b+=" "+as[i]);return b}function bind(f){var args=Array.prototype.slice.call(arguments,1);return function(){return f.apply(null,args)}}function copyObj(obj,target,overwrite){target||(target={});for(var prop in obj)!obj.hasOwnProperty(prop)||!1===overwrite&&target.hasOwnProperty(prop)||(target[prop]=obj[prop]);return target}function countColumn(string,end,tabSize,startIndex,startValue){null==end&&-1==(end=string.search(/[^\s\u00a0]/))&&(end=string.length);for(var i=startIndex||0,n=startValue||0;;){var nextTab=string.indexOf("\t",i);if(nextTab<0||nextTab>=end)return n+(end-i);n+=nextTab-i,n+=tabSize-n%tabSize,i=nextTab+1}}function indexOf(array,elt){for(var i=0;i<array.length;++i)if(array[i]==elt)return i;return-1}function findColumn(string,goal,tabSize){for(var pos=0,col=0;;){var nextTab=string.indexOf("\t",pos);-1==nextTab&&(nextTab=string.length);var skipped=nextTab-pos;if(nextTab==string.length||col+skipped>=goal)return pos+Math.min(skipped,goal-col);if(col+=nextTab-pos,col+=tabSize-col%tabSize,pos=nextTab+1,col>=goal)return pos}}function spaceStr(n){for(;spaceStrs.length<=n;)spaceStrs.push(lst(spaceStrs)+" ");return spaceStrs[n]}function lst(arr){return arr[arr.length-1]}function map(array,f){for(var out=[],i=0;i<array.length;i++)out[i]=f(array[i],i);return out}function insertSorted(array,value,score){for(var pos=0,priority=score(value);pos<array.length&&score(array[pos])<=priority;)pos++;array.splice(pos,0,value)}function nothing(){}function createObj(base,props){var inst;return Object.create?inst=Object.create(base):(nothing.prototype=base,inst=new nothing),props&©Obj(props,inst),inst}function isWordCharBasic(ch){return/\w/.test(ch)||ch>""&&(ch.toUpperCase()!=ch.toLowerCase()||nonASCIISingleCaseWordChar.test(ch))}function isWordChar(ch,helper){return helper?!!(helper.source.indexOf("\\w")>-1&&isWordCharBasic(ch))||helper.test(ch):isWordCharBasic(ch)}function isEmpty(obj){for(var n in obj)if(obj.hasOwnProperty(n)&&obj[n])return!1;return!0}function isExtendingChar(ch){return ch.charCodeAt(0)>=768&&extendingChars.test(ch)}function skipExtendingChars(str,pos,dir){for(;(dir<0?pos>0:pos<str.length)&&isExtendingChar(str.charAt(pos));)pos+=dir;return pos}function findFirst(pred,from,to){for(;;){if(Math.abs(from-to)<=1)return pred(from)?from:to;var mid=Math.floor((from+to)/2);pred(mid)?to=mid:from=mid}}function Display(place,doc,input){var d=this;this.input=input,d.scrollbarFiller=elt("div",null,"CodeMirror-scrollbar-filler"),d.scrollbarFiller.setAttribute("cm-not-content","true"),d.gutterFiller=elt("div",null,"CodeMirror-gutter-filler"),d.gutterFiller.setAttribute("cm-not-content","true"),d.lineDiv=eltP("div",null,"CodeMirror-code"),d.selectionDiv=elt("div",null,null,"position: relative; z-index: 1"),d.cursorDiv=elt("div",null,"CodeMirror-cursors"),d.measure=elt("div",null,"CodeMirror-measure"),d.lineMeasure=elt("div",null,"CodeMirror-measure"),d.lineSpace=eltP("div",[d.measure,d.lineMeasure,d.selectionDiv,d.cursorDiv,d.lineDiv],null,"position: relative; outline: none");var lines=eltP("div",[d.lineSpace],"CodeMirror-lines");d.mover=elt("div",[lines],null,"position: relative"),d.sizer=elt("div",[d.mover],"CodeMirror-sizer"),d.sizerWidth=null,d.heightForcer=elt("div",null,null,"position: absolute; height: "+scrollerGap+"px; width: 1px;"),d.gutters=elt("div",null,"CodeMirror-gutters"),d.lineGutter=null,d.scroller=elt("div",[d.sizer,d.heightForcer,d.gutters],"CodeMirror-scroll"),d.scroller.setAttribute("tabIndex","-1"),d.wrapper=elt("div",[d.scrollbarFiller,d.gutterFiller,d.scroller],"CodeMirror"),ie&&ie_version<8&&(d.gutters.style.zIndex=-1,d.scroller.style.paddingRight=0),webkit||gecko&&mobile||(d.scroller.draggable=!0),place&&(place.appendChild?place.appendChild(d.wrapper):place(d.wrapper)),d.viewFrom=d.viewTo=doc.first,d.reportedViewFrom=d.reportedViewTo=doc.first,d.view=[],d.renderedView=null,d.externalMeasured=null,d.viewOffset=0,d.lastWrapHeight=d.lastWrapWidth=0,d.updateLineNumbers=null,d.nativeBarWidth=d.barHeight=d.barWidth=0,d.scrollbarsClipped=!1,d.lineNumWidth=d.lineNumInnerWidth=d.lineNumChars=null,d.alignWidgets=!1,d.cachedCharWidth=d.cachedTextHeight=d.cachedPaddingH=null,d.maxLine=null,d.maxLineLength=0,d.maxLineChanged=!1,d.wheelDX=d.wheelDY=d.wheelStartX=d.wheelStartY=null,d.shift=!1,d.selForContextMenu=null,d.activeTouch=null,input.init(d)}function getLine(doc,n){if((n-=doc.first)<0||n>=doc.size)throw new Error("There is no line "+(n+doc.first)+" in the document.");for(var chunk=doc;!chunk.lines;)for(var i=0;;++i){var child=chunk.children[i],sz=child.chunkSize();if(n<sz){chunk=child;break}n-=sz}return chunk.lines[n]}function getBetween(doc,start,end){var out=[],n=start.line;return doc.iter(start.line,end.line+1,function(line){var text=line.text;n==end.line&&(text=text.slice(0,end.ch)),n==start.line&&(text=text.slice(start.ch)),out.push(text),++n}),out}function getLines(doc,from,to){var out=[];return doc.iter(from,to,function(line){out.push(line.text)}),out}function updateLineHeight(line,height){var diff=height-line.height;if(diff)for(var n=line;n;n=n.parent)n.height+=diff}function lineNo(line){if(null==line.parent)return null;for(var cur=line.parent,no=indexOf(cur.lines,line),chunk=cur.parent;chunk;cur=chunk,chunk=chunk.parent)for(var i=0;chunk.children[i]!=cur;++i)no+=chunk.children[i].chunkSize();return no+cur.first}function lineAtHeight(chunk,h){var n=chunk.first;outer:do{for(var i$1=0;i$1<chunk.children.length;++i$1){var child=chunk.children[i$1],ch=child.height;if(h<ch){chunk=child;continue outer}h-=ch,n+=child.chunkSize()}return n}while(!chunk.lines);for(var i=0;i<chunk.lines.length;++i){var lh=chunk.lines[i].height;if(h<lh)break;h-=lh}return n+i}function isLine(doc,l){return l>=doc.first&&l<doc.first+doc.size}function lineNumberFor(options,i){return String(options.lineNumberFormatter(i+options.firstLineNumber))}function Pos(line,ch,sticky){if(void 0===sticky&&(sticky=null),!(this instanceof Pos))return new Pos(line,ch,sticky);this.line=line,this.ch=ch,this.sticky=sticky}function cmp(a,b){return a.line-b.line||a.ch-b.ch}function equalCursorPos(a,b){return a.sticky==b.sticky&&0==cmp(a,b)}function copyPos(x){return Pos(x.line,x.ch)}function maxPos(a,b){return cmp(a,b)<0?b:a}function minPos(a,b){return cmp(a,b)<0?a:b}function clipLine(doc,n){return Math.max(doc.first,Math.min(n,doc.first+doc.size-1))}function clipPos(doc,pos){if(pos.line<doc.first)return Pos(doc.first,0);var last=doc.first+doc.size-1;return pos.line>last?Pos(last,getLine(doc,last).text.length):clipToLen(pos,getLine(doc,pos.line).text.length)}function clipToLen(pos,linelen){var ch=pos.ch;return null==ch||ch>linelen?Pos(pos.line,linelen):ch<0?Pos(pos.line,0):pos}function clipPosArray(doc,array){for(var out=[],i=0;i<array.length;i++)out[i]=clipPos(doc,array[i]);return out}function seeReadOnlySpans(){sawReadOnlySpans=!0}function seeCollapsedSpans(){sawCollapsedSpans=!0}function MarkedSpan(marker,from,to){this.marker=marker,this.from=from,this.to=to}function getMarkedSpanFor(spans,marker){if(spans)for(var i=0;i<spans.length;++i){var span=spans[i];if(span.marker==marker)return span}}function removeMarkedSpan(spans,span){for(var r,i=0;i<spans.length;++i)spans[i]!=span&&(r||(r=[])).push(spans[i]);return r}function addMarkedSpan(line,span){line.markedSpans=line.markedSpans?line.markedSpans.concat([span]):[span],span.marker.attachLine(line)}function markedSpansBefore(old,startCh,isInsert){var nw;if(old)for(var i=0;i<old.length;++i){var span=old[i],marker=span.marker;if(null==span.from||(marker.inclusiveLeft?span.from<=startCh:span.from<startCh)||span.from==startCh&&"bookmark"==marker.type&&(!isInsert||!span.marker.insertLeft)){var endsAfter=null==span.to||(marker.inclusiveRight?span.to>=startCh:span.to>startCh);(nw||(nw=[])).push(new MarkedSpan(marker,span.from,endsAfter?null:span.to))}}return nw}function markedSpansAfter(old,endCh,isInsert){var nw;if(old)for(var i=0;i<old.length;++i){var span=old[i],marker=span.marker;if(null==span.to||(marker.inclusiveRight?span.to>=endCh:span.to>endCh)||span.from==endCh&&"bookmark"==marker.type&&(!isInsert||span.marker.insertLeft)){var startsBefore=null==span.from||(marker.inclusiveLeft?span.from<=endCh:span.from<endCh);(nw||(nw=[])).push(new MarkedSpan(marker,startsBefore?null:span.from-endCh,null==span.to?null:span.to-endCh))}}return nw}function stretchSpansOverChange(doc,change){if(change.full)return null;var oldFirst=isLine(doc,change.from.line)&&getLine(doc,change.from.line).markedSpans,oldLast=isLine(doc,change.to.line)&&getLine(doc,change.to.line).markedSpans;if(!oldFirst&&!oldLast)return null;var startCh=change.from.ch,endCh=change.to.ch,isInsert=0==cmp(change.from,change.to),first=markedSpansBefore(oldFirst,startCh,isInsert),last=markedSpansAfter(oldLast,endCh,isInsert),sameLine=1==change.text.length,offset=lst(change.text).length+(sameLine?startCh:0);if(first)for(var i=0;i<first.length;++i){var span=first[i];if(null==span.to){var found=getMarkedSpanFor(last,span.marker);found?sameLine&&(span.to=null==found.to?null:found.to+offset):span.to=startCh}}if(last)for(var i$1=0;i$1<last.length;++i$1){var span$1=last[i$1];null!=span$1.to&&(span$1.to+=offset),null==span$1.from?getMarkedSpanFor(first,span$1.marker)||(span$1.from=offset,sameLine&&(first||(first=[])).push(span$1)):(span$1.from+=offset,sameLine&&(first||(first=[])).push(span$1))}first&&(first=clearEmptySpans(first)),last&&last!=first&&(last=clearEmptySpans(last));var newMarkers=[first];if(!sameLine){var gapMarkers,gap=change.text.length-2;if(gap>0&&first)for(var i$2=0;i$2<first.length;++i$2)null==first[i$2].to&&(gapMarkers||(gapMarkers=[])).push(new MarkedSpan(first[i$2].marker,null,null));for(var i$3=0;i$3<gap;++i$3)newMarkers.push(gapMarkers);newMarkers.push(last)}return newMarkers}function clearEmptySpans(spans){for(var i=0;i<spans.length;++i){var span=spans[i];null!=span.from&&span.from==span.to&&!1!==span.marker.clearWhenEmpty&&spans.splice(i--,1)}return spans.length?spans:null}function removeReadOnlyRanges(doc,from,to){var markers=null;if(doc.iter(from.line,to.line+1,function(line){if(line.markedSpans)for(var i=0;i<line.markedSpans.length;++i){var mark=line.markedSpans[i].marker;!mark.readOnly||markers&&-1!=indexOf(markers,mark)||(markers||(markers=[])).push(mark)}}),!markers)return null;for(var parts=[{from:from,to:to}],i=0;i<markers.length;++i)for(var mk=markers[i],m=mk.find(0),j=0;j<parts.length;++j){var p=parts[j];if(!(cmp(p.to,m.from)<0||cmp(p.from,m.to)>0)){var newParts=[j,1],dfrom=cmp(p.from,m.from),dto=cmp(p.to,m.to);(dfrom<0||!mk.inclusiveLeft&&!dfrom)&&newParts.push({from:p.from,to:m.from}),(dto>0||!mk.inclusiveRight&&!dto)&&newParts.push({from:m.to,to:p.to}),parts.splice.apply(parts,newParts),j+=newParts.length-3}}return parts}function detachMarkedSpans(line){var spans=line.markedSpans;if(spans){for(var i=0;i<spans.length;++i)spans[i].marker.detachLine(line);line.markedSpans=null}}function attachMarkedSpans(line,spans){if(spans){for(var i=0;i<spans.length;++i)spans[i].marker.attachLine(line);line.markedSpans=spans}}function extraLeft(marker){return marker.inclusiveLeft?-1:0}function extraRight(marker){return marker.inclusiveRight?1:0}function compareCollapsedMarkers(a,b){var lenDiff=a.lines.length-b.lines.length;if(0!=lenDiff)return lenDiff;var aPos=a.find(),bPos=b.find(),fromCmp=cmp(aPos.from,bPos.from)||extraLeft(a)-extraLeft(b);if(fromCmp)return-fromCmp;var toCmp=cmp(aPos.to,bPos.to)||extraRight(a)-extraRight(b);return toCmp||b.id-a.id}function collapsedSpanAtSide(line,start){var found,sps=sawCollapsedSpans&&line.markedSpans;if(sps)for(var sp=void 0,i=0;i<sps.length;++i)(sp=sps[i]).marker.collapsed&&null==(start?sp.from:sp.to)&&(!found||compareCollapsedMarkers(found,sp.marker)<0)&&(found=sp.marker);return found}function collapsedSpanAtStart(line){return collapsedSpanAtSide(line,!0)}function collapsedSpanAtEnd(line){return collapsedSpanAtSide(line,!1)}function conflictingCollapsedRange(doc,lineNo$$1,from,to,marker){var line=getLine(doc,lineNo$$1),sps=sawCollapsedSpans&&line.markedSpans;if(sps)for(var i=0;i<sps.length;++i){var sp=sps[i];if(sp.marker.collapsed){var found=sp.marker.find(0),fromCmp=cmp(found.from,from)||extraLeft(sp.marker)-extraLeft(marker),toCmp=cmp(found.to,to)||extraRight(sp.marker)-extraRight(marker);if(!(fromCmp>=0&&toCmp<=0||fromCmp<=0&&toCmp>=0)&&(fromCmp<=0&&(sp.marker.inclusiveRight&&marker.inclusiveLeft?cmp(found.to,from)>=0:cmp(found.to,from)>0)||fromCmp>=0&&(sp.marker.inclusiveRight&&marker.inclusiveLeft?cmp(found.from,to)<=0:cmp(found.from,to)<0)))return!0}}}function visualLine(line){for(var merged;merged=collapsedSpanAtStart(line);)line=merged.find(-1,!0).line;return line}function visualLineEnd(line){for(var merged;merged=collapsedSpanAtEnd(line);)line=merged.find(1,!0).line;return line}function visualLineContinued(line){for(var merged,lines;merged=collapsedSpanAtEnd(line);)line=merged.find(1,!0).line,(lines||(lines=[])).push(line);return lines}function visualLineNo(doc,lineN){var line=getLine(doc,lineN),vis=visualLine(line);return line==vis?lineN:lineNo(vis)}function visualLineEndNo(doc,lineN){if(lineN>doc.lastLine())return lineN;var merged,line=getLine(doc,lineN);if(!lineIsHidden(doc,line))return lineN;for(;merged=collapsedSpanAtEnd(line);)line=merged.find(1,!0).line;return lineNo(line)+1}function lineIsHidden(doc,line){var sps=sawCollapsedSpans&&line.markedSpans;if(sps)for(var sp=void 0,i=0;i<sps.length;++i)if((sp=sps[i]).marker.collapsed){if(null==sp.from)return!0;if(!sp.marker.widgetNode&&0==sp.from&&sp.marker.inclusiveLeft&&lineIsHiddenInner(doc,line,sp))return!0}}function lineIsHiddenInner(doc,line,span){if(null==span.to){var end=span.marker.find(1,!0);return lineIsHiddenInner(doc,end.line,getMarkedSpanFor(end.line.markedSpans,span.marker))}if(span.marker.inclusiveRight&&span.to==line.text.length)return!0;for(var sp=void 0,i=0;i<line.markedSpans.length;++i)if((sp=line.markedSpans[i]).marker.collapsed&&!sp.marker.widgetNode&&sp.from==span.to&&(null==sp.to||sp.to!=span.from)&&(sp.marker.inclusiveLeft||span.marker.inclusiveRight)&&lineIsHiddenInner(doc,line,sp))return!0}function heightAtLine(lineObj){for(var h=0,chunk=(lineObj=visualLine(lineObj)).parent,i=0;i<chunk.lines.length;++i){var line=chunk.lines[i];if(line==lineObj)break;h+=line.height}for(var p=chunk.parent;p;chunk=p,p=chunk.parent)for(var i$1=0;i$1<p.children.length;++i$1){var cur=p.children[i$1];if(cur==chunk)break;h+=cur.height}return h}function lineLength(line){if(0==line.height)return 0;for(var merged,len=line.text.length,cur=line;merged=collapsedSpanAtStart(cur);){var found=merged.find(0,!0);cur=found.from.line,len+=found.from.ch-found.to.ch}for(cur=line;merged=collapsedSpanAtEnd(cur);){var found$1=merged.find(0,!0);len-=cur.text.length-found$1.from.ch,len+=(cur=found$1.to.line).text.length-found$1.to.ch}return len}function findMaxLine(cm){var d=cm.display,doc=cm.doc;d.maxLine=getLine(doc,doc.first),d.maxLineLength=lineLength(d.maxLine),d.maxLineChanged=!0,doc.iter(function(line){var len=lineLength(line);len>d.maxLineLength&&(d.maxLineLength=len,d.maxLine=line)})}function iterateBidiSections(order,from,to,f){if(!order)return f(from,to,"ltr");for(var found=!1,i=0;i<order.length;++i){var part=order[i];(part.from<to&&part.to>from||from==to&&part.to==from)&&(f(Math.max(part.from,from),Math.min(part.to,to),1==part.level?"rtl":"ltr"),found=!0)}found||f(from,to,"ltr")}function getBidiPartAt(order,ch,sticky){var found;bidiOther=null;for(var i=0;i<order.length;++i){var cur=order[i];if(cur.from<ch&&cur.to>ch)return i;cur.to==ch&&(cur.from!=cur.to&&"before"==sticky?found=i:bidiOther=i),cur.from==ch&&(cur.from!=cur.to&&"before"!=sticky?found=i:bidiOther=i)}return null!=found?found:bidiOther}function getOrder(line,direction){var order=line.order;return null==order&&(order=line.order=bidiOrdering(line.text,direction)),order}function moveCharLogically(line,ch,dir){var target=skipExtendingChars(line.text,ch+dir,dir);return target<0||target>line.text.length?null:target}function moveLogically(line,start,dir){var ch=moveCharLogically(line,start.ch,dir);return null==ch?null:new Pos(start.line,ch,dir<0?"after":"before")}function endOfLine(visually,cm,lineObj,lineNo,dir){if(visually){var order=getOrder(lineObj,cm.doc.direction);if(order){var ch,part=dir<0?lst(order):order[0],sticky=dir<0==(1==part.level)?"after":"before";if(part.level>0){var prep=prepareMeasureForLine(cm,lineObj);ch=dir<0?lineObj.text.length-1:0;var targetTop=measureCharPrepared(cm,prep,ch).top;ch=findFirst(function(ch){return measureCharPrepared(cm,prep,ch).top==targetTop},dir<0==(1==part.level)?part.from:part.to-1,ch),"before"==sticky&&(ch=moveCharLogically(lineObj,ch,1))}else ch=dir<0?part.to:part.from;return new Pos(lineNo,ch,sticky)}}return new Pos(lineNo,dir<0?lineObj.text.length:0,dir<0?"before":"after")}function moveVisually(cm,line,start,dir){var bidi=getOrder(line,cm.doc.direction);if(!bidi)return moveLogically(line,start,dir);start.ch>=line.text.length?(start.ch=line.text.length,start.sticky="before"):start.ch<=0&&(start.ch=0,start.sticky="after");var partPos=getBidiPartAt(bidi,start.ch,start.sticky),part=bidi[partPos];if("ltr"==cm.doc.direction&&part.level%2==0&&(dir>0?part.to>start.ch:part.from<start.ch))return moveLogically(line,start,dir);var prep,mv=function(pos,dir){return moveCharLogically(line,pos instanceof Pos?pos.ch:pos,dir)},getWrappedLineExtent=function(ch){return cm.options.lineWrapping?(prep=prep||prepareMeasureForLine(cm,line),wrappedLineExtentChar(cm,line,prep,ch)):{begin:0,end:line.text.length}},wrappedLineExtent=getWrappedLineExtent("before"==start.sticky?mv(start,-1):start.ch);if("rtl"==cm.doc.direction||1==part.level){var moveInStorageOrder=1==part.level==dir<0,ch=mv(start,moveInStorageOrder?1:-1);if(null!=ch&&(moveInStorageOrder?ch<=part.to&&ch<=wrappedLineExtent.end:ch>=part.from&&ch>=wrappedLineExtent.begin)){var sticky=moveInStorageOrder?"before":"after";return new Pos(start.line,ch,sticky)}}var searchInVisualLine=function(partPos,dir,wrappedLineExtent){for(var getRes=function(ch,moveInStorageOrder){return moveInStorageOrder?new Pos(start.line,mv(ch,1),"before"):new Pos(start.line,ch,"after")};partPos>=0&&partPos<bidi.length;partPos+=dir){var part=bidi[partPos],moveInStorageOrder=dir>0==(1!=part.level),ch=moveInStorageOrder?wrappedLineExtent.begin:mv(wrappedLineExtent.end,-1);if(part.from<=ch&&ch<part.to)return getRes(ch,moveInStorageOrder);if(ch=moveInStorageOrder?part.from:mv(part.to,-1),wrappedLineExtent.begin<=ch&&ch<wrappedLineExtent.end)return getRes(ch,moveInStorageOrder)}},res=searchInVisualLine(partPos+dir,dir,wrappedLineExtent);if(res)return res;var nextCh=dir>0?wrappedLineExtent.end:mv(wrappedLineExtent.begin,-1);return null==nextCh||dir>0&&nextCh==line.text.length||!(res=searchInVisualLine(dir>0?0:bidi.length-1,dir,getWrappedLineExtent(nextCh)))?null:res}function getHandlers(emitter,type){return emitter._handlers&&emitter._handlers[type]||noHandlers}function off(emitter,type,f){if(emitter.removeEventListener)emitter.removeEventListener(type,f,!1);else if(emitter.detachEvent)emitter.detachEvent("on"+type,f);else{var map$$1=emitter._handlers,arr=map$$1&&map$$1[type];if(arr){var index=indexOf(arr,f);index>-1&&(map$$1[type]=arr.slice(0,index).concat(arr.slice(index+1)))}}}function signal(emitter,type){var handlers=getHandlers(emitter,type);if(handlers.length)for(var args=Array.prototype.slice.call(arguments,2),i=0;i<handlers.length;++i)handlers[i].apply(null,args)}function signalDOMEvent(cm,e,override){return"string"==typeof e&&(e={type:e,preventDefault:function(){this.defaultPrevented=!0}}),signal(cm,override||e.type,cm,e),e_defaultPrevented(e)||e.codemirrorIgnore}function signalCursorActivity(cm){var arr=cm._handlers&&cm._handlers.cursorActivity;if(arr)for(var set=cm.curOp.cursorActivityHandlers||(cm.curOp.cursorActivityHandlers=[]),i=0;i<arr.length;++i)-1==indexOf(set,arr[i])&&set.push(arr[i])}function hasHandler(emitter,type){return getHandlers(emitter,type).length>0}function eventMixin(ctor){ctor.prototype.on=function(type,f){on(this,type,f)},ctor.prototype.off=function(type,f){off(this,type,f)}}function e_preventDefault(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function e_stopPropagation(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function e_defaultPrevented(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function e_stop(e){e_preventDefault(e),e_stopPropagation(e)}function e_target(e){return e.target||e.srcElement}function e_button(e){var b=e.which;return null==b&&(1&e.button?b=1:2&e.button?b=3:4&e.button&&(b=2)),mac&&e.ctrlKey&&1==b&&(b=3),b}function zeroWidthElement(measure){if(null==zwspSupported){var test=elt("span","");removeChildrenAndAdd(measure,elt("span",[test,document.createTextNode("x")])),0!=measure.firstChild.offsetHeight&&(zwspSupported=test.offsetWidth<=1&&test.offsetHeight>2&&!(ie&&ie_version<8))}var node=zwspSupported?elt("span",""):elt("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return node.setAttribute("cm-text",""),node}function hasBadBidiRects(measure){if(null!=badBidiRects)return badBidiRects;var txt=removeChildrenAndAdd(measure,document.createTextNode("AخA")),r0=range(txt,0,1).getBoundingClientRect(),r1=range(txt,1,2).getBoundingClientRect();return removeChildren(measure),!(!r0||r0.left==r0.right)&&(badBidiRects=r1.right-r0.right<3)}function hasBadZoomedRects(measure){if(null!=badZoomedRects)return badZoomedRects;var node=removeChildrenAndAdd(measure,elt("span","x")),normal=node.getBoundingClientRect(),fromRange=range(node,0,1).getBoundingClientRect();return badZoomedRects=Math.abs(normal.left-fromRange.left)>1}function defineMode(name,mode){arguments.length>2&&(mode.dependencies=Array.prototype.slice.call(arguments,2)),modes[name]=mode}function resolveMode(spec){if("string"==typeof spec&&mimeModes.hasOwnProperty(spec))spec=mimeModes[spec];else if(spec&&"string"==typeof spec.name&&mimeModes.hasOwnProperty(spec.name)){var found=mimeModes[spec.name];"string"==typeof found&&(found={name:found}),(spec=createObj(found,spec)).name=found.name}else{if("string"==typeof spec&&/^[\w\-]+\/[\w\-]+\+xml$/.test(spec))return resolveMode("application/xml");if("string"==typeof spec&&/^[\w\-]+\/[\w\-]+\+json$/.test(spec))return resolveMode("application/json")}return"string"==typeof spec?{name:spec}:spec||{name:"null"}}function getMode(options,spec){spec=resolveMode(spec);var mfactory=modes[spec.name];if(!mfactory)return getMode(options,"text/plain");var modeObj=mfactory(options,spec);if(modeExtensions.hasOwnProperty(spec.name)){var exts=modeExtensions[spec.name];for(var prop in exts)exts.hasOwnProperty(prop)&&(modeObj.hasOwnProperty(prop)&&(modeObj["_"+prop]=modeObj[prop]),modeObj[prop]=exts[prop])}if(modeObj.name=spec.name,spec.helperType&&(modeObj.helperType=spec.helperType),spec.modeProps)for(var prop$1 in spec.modeProps)modeObj[prop$1]=spec.modeProps[prop$1];return modeObj}function extendMode(mode,properties){copyObj(properties,modeExtensions.hasOwnProperty(mode)?modeExtensions[mode]:modeExtensions[mode]={})}function copyState(mode,state){if(!0===state)return state;if(mode.copyState)return mode.copyState(state);var nstate={};for(var n in state){var val=state[n];val instanceof Array&&(val=val.concat([])),nstate[n]=val}return nstate}function innerMode(mode,state){for(var info;mode.innerMode&&(info=mode.innerMode(state))&&info.mode!=mode;)state=info.state,mode=info.mode;return info||{mode:mode,state:state}}function startState(mode,a1,a2){return!mode.startState||mode.startState(a1,a2)}function highlightLine(cm,line,context,forceToEnd){var st=[cm.state.modeGen],lineClasses={};runMode(cm,line.text,cm.doc.mode,context,function(end,style){return st.push(end,style)},lineClasses,forceToEnd);for(var state=context.state,o=0;o<cm.state.overlays.length;++o)!function(o){var overlay=cm.state.overlays[o],i=1,at=0;context.state=!0,runMode(cm,line.text,overlay.mode,context,function(end,style){for(var start=i;at<end;){var i_end=st[i];i_end>end&&st.splice(i,1,end,st[i+1],i_end),i+=2,at=Math.min(end,i_end)}if(style)if(overlay.opaque)st.splice(start,i-start,end,"overlay "+style),i=start+2;else for(;start<i;start+=2){var cur=st[start+1];st[start+1]=(cur?cur+" ":"")+"overlay "+style}},lineClasses)}(o);return context.state=state,{styles:st,classes:lineClasses.bgClass||lineClasses.textClass?lineClasses:null}}function getLineStyles(cm,line,updateFrontier){if(!line.styles||line.styles[0]!=cm.state.modeGen){var context=getContextBefore(cm,lineNo(line)),resetState=line.text.length>cm.options.maxHighlightLength&©State(cm.doc.mode,context.state),result=highlightLine(cm,line,context);resetState&&(context.state=resetState),line.stateAfter=context.save(!resetState),line.styles=result.styles,result.classes?line.styleClasses=result.classes:line.styleClasses&&(line.styleClasses=null),updateFrontier===cm.doc.highlightFrontier&&(cm.doc.modeFrontier=Math.max(cm.doc.modeFrontier,++cm.doc.highlightFrontier))}return line.styles}function getContextBefore(cm,n,precise){var doc=cm.doc,display=cm.display;if(!doc.mode.startState)return new Context(doc,!0,n);var start=findStartLine(cm,n,precise),saved=start>doc.first&&getLine(doc,start-1).stateAfter,context=saved?Context.fromSaved(doc,saved,start):new Context(doc,startState(doc.mode),start);return doc.iter(start,n,function(line){processLine(cm,line.text,context);var pos=context.line;line.stateAfter=pos==n-1||pos%5==0||pos>=display.viewFrom&&pos<display.viewTo?context.save():null,context.nextLine()}),precise&&(doc.modeFrontier=context.line),context}function processLine(cm,text,context,startAt){var mode=cm.doc.mode,stream=new StringStream(text,cm.options.tabSize,context);for(stream.start=stream.pos=startAt||0,""==text&&callBlankLine(mode,context.state);!stream.eol();)readToken(mode,stream,context.state),stream.start=stream.pos}function callBlankLine(mode,state){if(mode.blankLine)return mode.blankLine(state);if(mode.innerMode){var inner=innerMode(mode,state);return inner.mode.blankLine?inner.mode.blankLine(inner.state):void 0}}function readToken(mode,stream,state,inner){for(var i=0;i<10;i++){inner&&(inner[0]=innerMode(mode,state).mode);var style=mode.token(stream,state);if(stream.pos>stream.start)return style}throw new Error("Mode "+mode.name+" failed to advance stream.")}function takeToken(cm,pos,precise,asArray){var style,tokens,doc=cm.doc,mode=doc.mode,line=getLine(doc,(pos=clipPos(doc,pos)).line),context=getContextBefore(cm,pos.line,precise),stream=new StringStream(line.text,cm.options.tabSize,context);for(asArray&&(tokens=[]);(asArray||stream.pos<pos.ch)&&!stream.eol();)stream.start=stream.pos,style=readToken(mode,stream,context.state),asArray&&tokens.push(new Token(stream,style,copyState(doc.mode,context.state)));return asArray?tokens:new Token(stream,style,context.state)}function extractLineClasses(type,output){if(type)for(;;){var lineClass=type.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!lineClass)break;type=type.slice(0,lineClass.index)+type.slice(lineClass.index+lineClass[0].length);var prop=lineClass[1]?"bgClass":"textClass";null==output[prop]?output[prop]=lineClass[2]:new RegExp("(?:^|s)"+lineClass[2]+"(?:$|s)").test(output[prop])||(output[prop]+=" "+lineClass[2])}return type}function runMode(cm,text,mode,context,f,lineClasses,forceToEnd){var flattenSpans=mode.flattenSpans;null==flattenSpans&&(flattenSpans=cm.options.flattenSpans);var style,curStart=0,curStyle=null,stream=new StringStream(text,cm.options.tabSize,context),inner=cm.options.addModeClass&&[null];for(""==text&&extractLineClasses(callBlankLine(mode,context.state),lineClasses);!stream.eol();){if(stream.pos>cm.options.maxHighlightLength?(flattenSpans=!1,forceToEnd&&processLine(cm,text,context,stream.pos),stream.pos=text.length,style=null):style=extractLineClasses(readToken(mode,stream,context.state,inner),lineClasses),inner){var mName=inner[0].name;mName&&(style="m-"+(style?mName+" "+style:mName))}if(!flattenSpans||curStyle!=style){for(;curStart<stream.start;)f(curStart=Math.min(stream.start,curStart+5e3),curStyle);curStyle=style}stream.start=stream.pos}for(;curStart<stream.pos;){var pos=Math.min(stream.pos,curStart+5e3);f(pos,curStyle),curStart=pos}}function findStartLine(cm,n,precise){for(var minindent,minline,doc=cm.doc,lim=precise?-1:n-(cm.doc.mode.innerMode?1e3:100),search=n;search>lim;--search){if(search<=doc.first)return doc.first;var line=getLine(doc,search-1),after=line.stateAfter;if(after&&(!precise||search+(after instanceof SavedContext?after.lookAhead:0)<=doc.modeFrontier))return search;var indented=countColumn(line.text,null,cm.options.tabSize);(null==minline||minindent>indented)&&(minline=search-1,minindent=indented)}return minline}function retreatFrontier(doc,n){if(doc.modeFrontier=Math.min(doc.modeFrontier,n),!(doc.highlightFrontier<n-10)){for(var start=doc.first,line=n-1;line>start;line--){var saved=getLine(doc,line).stateAfter;if(saved&&(!(saved instanceof SavedContext)||line+saved.lookAhead<n)){start=line+1;break}}doc.highlightFrontier=Math.min(doc.highlightFrontier,start)}}function updateLine(line,text,markedSpans,estimateHeight){line.text=text,line.stateAfter&&(line.stateAfter=null),line.styles&&(line.styles=null),null!=line.order&&(line.order=null),detachMarkedSpans(line),attachMarkedSpans(line,markedSpans);var estHeight=estimateHeight?estimateHeight(line):1;estHeight!=line.height&&updateLineHeight(line,estHeight)}function cleanUpLine(line){line.parent=null,detachMarkedSpans(line)}function interpretTokenStyle(style,options){if(!style||/^\s*$/.test(style))return null;var cache=options.addModeClass?styleToClassCacheWithMode:styleToClassCache;return cache[style]||(cache[style]=style.replace(/\S+/g,"cm-$&"))}function buildLineContent(cm,lineView){var content=eltP("span",null,null,webkit?"padding-right: .1px":null),builder={pre:eltP("pre",[content],"CodeMirror-line"),content:content,col:0,pos:0,cm:cm,trailingSpace:!1,splitSpaces:(ie||webkit)&&cm.getOption("lineWrapping")};lineView.measure={};for(var i=0;i<=(lineView.rest?lineView.rest.length:0);i++){var line=i?lineView.rest[i-1]:lineView.line,order=void 0;builder.pos=0,builder.addToken=buildToken,hasBadBidiRects(cm.display.measure)&&(order=getOrder(line,cm.doc.direction))&&(builder.addToken=buildTokenBadBidi(builder.addToken,order)),builder.map=[],insertLineContent(line,builder,getLineStyles(cm,line,lineView!=cm.display.externalMeasured&&lineNo(line))),line.styleClasses&&(line.styleClasses.bgClass&&(builder.bgClass=joinClasses(line.styleClasses.bgClass,builder.bgClass||"")),line.styleClasses.textClass&&(builder.textClass=joinClasses(line.styleClasses.textClass,builder.textClass||""))),0==builder.map.length&&builder.map.push(0,0,builder.content.appendChild(zeroWidthElement(cm.display.measure))),0==i?(lineView.measure.map=builder.map,lineView.measure.cache={}):((lineView.measure.maps||(lineView.measure.maps=[])).push(builder.map),(lineView.measure.caches||(lineView.measure.caches=[])).push({}))}if(webkit){var last=builder.content.lastChild;(/\bcm-tab\b/.test(last.className)||last.querySelector&&last.querySelector(".cm-tab"))&&(builder.content.className="cm-tab-wrap-hack")}return signal(cm,"renderLine",cm,lineView.line,builder.pre),builder.pre.className&&(builder.textClass=joinClasses(builder.pre.className,builder.textClass||"")),builder}function defaultSpecialCharPlaceholder(ch){var token=elt("span","•","cm-invalidchar");return token.title="\\u"+ch.charCodeAt(0).toString(16),token.setAttribute("aria-label",token.title),token}function buildToken(builder,text,style,startStyle,endStyle,title,css){if(text){var content,displayText=builder.splitSpaces?splitSpaces(text,builder.trailingSpace):text,special=builder.cm.state.specialChars,mustWrap=!1;if(special.test(text)){content=document.createDocumentFragment();for(var pos=0;;){special.lastIndex=pos;var m=special.exec(text),skipped=m?m.index-pos:text.length-pos;if(skipped){var txt=document.createTextNode(displayText.slice(pos,pos+skipped));ie&&ie_version<9?content.appendChild(elt("span",[txt])):content.appendChild(txt),builder.map.push(builder.pos,builder.pos+skipped,txt),builder.col+=skipped,builder.pos+=skipped}if(!m)break;pos+=skipped+1;var txt$1=void 0;if("\t"==m[0]){var tabSize=builder.cm.options.tabSize,tabWidth=tabSize-builder.col%tabSize;(txt$1=content.appendChild(elt("span",spaceStr(tabWidth),"cm-tab"))).setAttribute("role","presentation"),txt$1.setAttribute("cm-text","\t"),builder.col+=tabWidth}else"\r"==m[0]||"\n"==m[0]?((txt$1=content.appendChild(elt("span","\r"==m[0]?"␍":"","cm-invalidchar"))).setAttribute("cm-text",m[0]),builder.col+=1):((txt$1=builder.cm.options.specialCharPlaceholder(m[0])).setAttribute("cm-text",m[0]),ie&&ie_version<9?content.appendChild(elt("span",[txt$1])):content.appendChild(txt$1),builder.col+=1);builder.map.push(builder.pos,builder.pos+1,txt$1),builder.pos++}}else builder.col+=text.length,content=document.createTextNode(displayText),builder.map.push(builder.pos,builder.pos+text.length,content),ie&&ie_version<9&&(mustWrap=!0),builder.pos+=text.length;if(builder.trailingSpace=32==displayText.charCodeAt(text.length-1),style||startStyle||endStyle||mustWrap||css){var fullStyle=style||"";startStyle&&(fullStyle+=startStyle),endStyle&&(fullStyle+=endStyle);var token=elt("span",[content],fullStyle,css);return title&&(token.title=title),builder.content.appendChild(token)}builder.content.appendChild(content)}}function splitSpaces(text,trailingBefore){if(text.length>1&&!/ /.test(text))return text;for(var spaceBefore=trailingBefore,result="",i=0;i<text.length;i++){var ch=text.charAt(i);" "!=ch||!spaceBefore||i!=text.length-1&&32!=text.charCodeAt(i+1)||(ch=" "),result+=ch,spaceBefore=" "==ch}return result}function buildTokenBadBidi(inner,order){return function(builder,text,style,startStyle,endStyle,title,css){style=style?style+" cm-force-border":"cm-force-border";for(var start=builder.pos,end=start+text.length;;){for(var part=void 0,i=0;i<order.length&&!((part=order[i]).to>start&&part.from<=start);i++);if(part.to>=end)return inner(builder,text,style,startStyle,endStyle,title,css);inner(builder,text.slice(0,part.to-start),style,startStyle,null,title,css),startStyle=null,text=text.slice(part.to-start),start=part.to}}}function buildCollapsedSpan(builder,size,marker,ignoreWidget){var widget=!ignoreWidget&&marker.widgetNode;widget&&builder.map.push(builder.pos,builder.pos+size,widget),!ignoreWidget&&builder.cm.display.input.needsContentAttribute&&(widget||(widget=builder.content.appendChild(document.createElement("span"))),widget.setAttribute("cm-marker",marker.id)),widget&&(builder.cm.display.input.setUneditable(widget),builder.content.appendChild(widget)),builder.pos+=size,builder.trailingSpace=!1}function insertLineContent(line,builder,styles){var spans=line.markedSpans,allText=line.text,at=0;if(spans)for(var style,css,spanStyle,spanEndStyle,spanStartStyle,title,collapsed,len=allText.length,pos=0,i=1,text="",nextChange=0;;){if(nextChange==pos){spanStyle=spanEndStyle=spanStartStyle=title=css="",collapsed=null,nextChange=1/0;for(var foundBookmarks=[],endStyles=void 0,j=0;j<spans.length;++j){var sp=spans[j],m=sp.marker;"bookmark"==m.type&&sp.from==pos&&m.widgetNode?foundBookmarks.push(m):sp.from<=pos&&(null==sp.to||sp.to>pos||m.collapsed&&sp.to==pos&&sp.from==pos)?(null!=sp.to&&sp.to!=pos&&nextChange>sp.to&&(nextChange=sp.to,spanEndStyle=""),m.className&&(spanStyle+=" "+m.className),m.css&&(css=(css?css+";":"")+m.css),m.startStyle&&sp.from==pos&&(spanStartStyle+=" "+m.startStyle),m.endStyle&&sp.to==nextChange&&(endStyles||(endStyles=[])).push(m.endStyle,sp.to),m.title&&!title&&(title=m.title),m.collapsed&&(!collapsed||compareCollapsedMarkers(collapsed.marker,m)<0)&&(collapsed=sp)):sp.from>pos&&nextChange>sp.from&&(nextChange=sp.from)}if(endStyles)for(var j$1=0;j$1<endStyles.length;j$1+=2)endStyles[j$1+1]==nextChange&&(spanEndStyle+=" "+endStyles[j$1]);if(!collapsed||collapsed.from==pos)for(var j$2=0;j$2<foundBookmarks.length;++j$2)buildCollapsedSpan(builder,0,foundBookmarks[j$2]);if(collapsed&&(collapsed.from||0)==pos){if(buildCollapsedSpan(builder,(null==collapsed.to?len+1:collapsed.to)-pos,collapsed.marker,null==collapsed.from),null==collapsed.to)return;collapsed.to==pos&&(collapsed=!1)}}if(pos>=len)break;for(var upto=Math.min(len,nextChange);;){if(text){var end=pos+text.length;if(!collapsed){var tokenText=end>upto?text.slice(0,upto-pos):text;builder.addToken(builder,tokenText,style?style+spanStyle:spanStyle,spanStartStyle,pos+tokenText.length==nextChange?spanEndStyle:"",title,css)}if(end>=upto){text=text.slice(upto-pos),pos=upto;break}pos=end,spanStartStyle=""}text=allText.slice(at,at=styles[i++]),style=interpretTokenStyle(styles[i++],builder.cm.options)}}else for(var i$1=1;i$1<styles.length;i$1+=2)builder.addToken(builder,allText.slice(at,at=styles[i$1]),interpretTokenStyle(styles[i$1+1],builder.cm.options))}function LineView(doc,line,lineN){this.line=line,this.rest=visualLineContinued(line),this.size=this.rest?lineNo(lst(this.rest))-lineN+1:1,this.node=this.text=null,this.hidden=lineIsHidden(doc,line)}function buildViewArray(cm,from,to){for(var nextPos,array=[],pos=from;pos<to;pos=nextPos){var view=new LineView(cm.doc,getLine(cm.doc,pos),pos);nextPos=pos+view.size,array.push(view)}return array}function pushOperation(op){operationGroup?operationGroup.ops.push(op):op.ownsGroup=operationGroup={ops:[op],delayedCallbacks:[]}}function fireCallbacksForOps(group){var callbacks=group.delayedCallbacks,i=0;do{for(;i<callbacks.length;i++)callbacks[i].call(null);for(var j=0;j<group.ops.length;j++){var op=group.ops[j];if(op.cursorActivityHandlers)for(;op.cursorActivityCalled<op.cursorActivityHandlers.length;)op.cursorActivityHandlers[op.cursorActivityCalled++].call(null,op.cm)}}while(i<callbacks.length)}function finishOperation(op,endCb){var group=op.ownsGroup;if(group)try{fireCallbacksForOps(group)}finally{operationGroup=null,endCb(group)}}function signalLater(emitter,type){var arr=getHandlers(emitter,type);if(arr.length){var list,args=Array.prototype.slice.call(arguments,2);operationGroup?list=operationGroup.delayedCallbacks:orphanDelayedCallbacks?list=orphanDelayedCallbacks:(list=orphanDelayedCallbacks=[],setTimeout(fireOrphanDelayed,0));for(var i=0;i<arr.length;++i)!function(i){list.push(function(){return arr[i].apply(null,args)})}(i)}}function fireOrphanDelayed(){var delayed=orphanDelayedCallbacks;orphanDelayedCallbacks=null;for(var i=0;i<delayed.length;++i)delayed[i]()}function updateLineForChanges(cm,lineView,lineN,dims){for(var j=0;j<lineView.changes.length;j++){var type=lineView.changes[j];"text"==type?updateLineText(cm,lineView):"gutter"==type?updateLineGutter(cm,lineView,lineN,dims):"class"==type?updateLineClasses(cm,lineView):"widget"==type&&updateLineWidgets(cm,lineView,dims)}lineView.changes=null}function ensureLineWrapped(lineView){return lineView.node==lineView.text&&(lineView.node=elt("div",null,null,"position: relative"),lineView.text.parentNode&&lineView.text.parentNode.replaceChild(lineView.node,lineView.text),lineView.node.appendChild(lineView.text),ie&&ie_version<8&&(lineView.node.style.zIndex=2)),lineView.node}function updateLineBackground(cm,lineView){var cls=lineView.bgClass?lineView.bgClass+" "+(lineView.line.bgClass||""):lineView.line.bgClass;if(cls&&(cls+=" CodeMirror-linebackground"),lineView.background)cls?lineView.background.className=cls:(lineView.background.parentNode.removeChild(lineView.background),lineView.background=null);else if(cls){var wrap=ensureLineWrapped(lineView);lineView.background=wrap.insertBefore(elt("div",null,cls),wrap.firstChild),cm.display.input.setUneditable(lineView.background)}}function getLineContent(cm,lineView){var ext=cm.display.externalMeasured;return ext&&ext.line==lineView.line?(cm.display.externalMeasured=null,lineView.measure=ext.measure,ext.built):buildLineContent(cm,lineView)}function updateLineText(cm,lineView){var cls=lineView.text.className,built=getLineContent(cm,lineView);lineView.text==lineView.node&&(lineView.node=built.pre),lineView.text.parentNode.replaceChild(built.pre,lineView.text),lineView.text=built.pre,built.bgClass!=lineView.bgClass||built.textClass!=lineView.textClass?(lineView.bgClass=built.bgClass,lineView.textClass=built.textClass,updateLineClasses(cm,lineView)):cls&&(lineView.text.className=cls)}function updateLineClasses(cm,lineView){updateLineBackground(cm,lineView),lineView.line.wrapClass?ensureLineWrapped(lineView).className=lineView.line.wrapClass:lineView.node!=lineView.text&&(lineView.node.className="");var textClass=lineView.textClass?lineView.textClass+" "+(lineView.line.textClass||""):lineView.line.textClass;lineView.text.className=textClass||""}function updateLineGutter(cm,lineView,lineN,dims){if(lineView.gutter&&(lineView.node.removeChild(lineView.gutter),lineView.gutter=null),lineView.gutterBackground&&(lineView.node.removeChild(lineView.gutterBackground),lineView.gutterBackground=null),lineView.line.gutterClass){var wrap=ensureLineWrapped(lineView);lineView.gutterBackground=elt("div",null,"CodeMirror-gutter-background "+lineView.line.gutterClass,"left: "+(cm.options.fixedGutter?dims.fixedPos:-dims.gutterTotalWidth)+"px; width: "+dims.gutterTotalWidth+"px"),cm.display.input.setUneditable(lineView.gutterBackground),wrap.insertBefore(lineView.gutterBackground,lineView.text)}var markers=lineView.line.gutterMarkers;if(cm.options.lineNumbers||markers){var wrap$1=ensureLineWrapped(lineView),gutterWrap=lineView.gutter=elt("div",null,"CodeMirror-gutter-wrapper","left: "+(cm.options.fixedGutter?dims.fixedPos:-dims.gutterTotalWidth)+"px");if(cm.display.input.setUneditable(gutterWrap),wrap$1.insertBefore(gutterWrap,lineView.text),lineView.line.gutterClass&&(gutterWrap.className+=" "+lineView.line.gutterClass),!cm.options.lineNumbers||markers&&markers["CodeMirror-linenumbers"]||(lineView.lineNumber=gutterWrap.appendChild(elt("div",lineNumberFor(cm.options,lineN),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+dims.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+cm.display.lineNumInnerWidth+"px"))),markers)for(var k=0;k<cm.options.gutters.length;++k){var id=cm.options.gutters[k],found=markers.hasOwnProperty(id)&&markers[id];found&&gutterWrap.appendChild(elt("div",[found],"CodeMirror-gutter-elt","left: "+dims.gutterLeft[id]+"px; width: "+dims.gutterWidth[id]+"px"))}}}function updateLineWidgets(cm,lineView,dims){lineView.alignable&&(lineView.alignable=null);for(var node=lineView.node.firstChild,next=void 0;node;node=next)next=node.nextSibling,"CodeMirror-linewidget"==node.className&&lineView.node.removeChild(node);insertLineWidgets(cm,lineView,dims)}function buildLineElement(cm,lineView,lineN,dims){var built=getLineContent(cm,lineView);return lineView.text=lineView.node=built.pre,built.bgClass&&(lineView.bgClass=built.bgClass),built.textClass&&(lineView.textClass=built.textClass),updateLineClasses(cm,lineView),updateLineGutter(cm,lineView,lineN,dims),insertLineWidgets(cm,lineView,dims),lineView.node}function insertLineWidgets(cm,lineView,dims){if(insertLineWidgetsFor(cm,lineView.line,lineView,dims,!0),lineView.rest)for(var i=0;i<lineView.rest.length;i++)insertLineWidgetsFor(cm,lineView.rest[i],lineView,dims,!1)}function insertLineWidgetsFor(cm,line,lineView,dims,allowAbove){if(line.widgets)for(var wrap=ensureLineWrapped(lineView),i=0,ws=line.widgets;i<ws.length;++i){var widget=ws[i],node=elt("div",[widget.node],"CodeMirror-linewidget");widget.handleMouseEvents||node.setAttribute("cm-ignore-events","true"),positionLineWidget(widget,node,lineView,dims),cm.display.input.setUneditable(node),allowAbove&&widget.above?wrap.insertBefore(node,lineView.gutter||lineView.text):wrap.appendChild(node),signalLater(widget,"redraw")}}function positionLineWidget(widget,node,lineView,dims){if(widget.noHScroll){(lineView.alignable||(lineView.alignable=[])).push(node);var width=dims.wrapperWidth;node.style.left=dims.fixedPos+"px",widget.coverGutter||(width-=dims.gutterTotalWidth,node.style.paddingLeft=dims.gutterTotalWidth+"px"),node.style.width=width+"px"}widget.coverGutter&&(node.style.zIndex=5,node.style.position="relative",widget.noHScroll||(node.style.marginLeft=-dims.gutterTotalWidth+"px"))}function widgetHeight(widget){if(null!=widget.height)return widget.height;var cm=widget.doc.cm;if(!cm)return 0;if(!contains(document.body,widget.node)){var parentStyle="position: relative;";widget.coverGutter&&(parentStyle+="margin-left: -"+cm.display.gutters.offsetWidth+"px;"),widget.noHScroll&&(parentStyle+="width: "+cm.display.wrapper.clientWidth+"px;"),removeChildrenAndAdd(cm.display.measure,elt("div",[widget.node],null,parentStyle))}return widget.height=widget.node.parentNode.offsetHeight}function eventInWidget(display,e){for(var n=e_target(e);n!=display.wrapper;n=n.parentNode)if(!n||1==n.nodeType&&"true"==n.getAttribute("cm-ignore-events")||n.parentNode==display.sizer&&n!=display.mover)return!0}function paddingTop(display){return display.lineSpace.offsetTop}function paddingVert(display){return display.mover.offsetHeight-display.lineSpace.offsetHeight}function paddingH(display){if(display.cachedPaddingH)return display.cachedPaddingH;var e=removeChildrenAndAdd(display.measure,elt("pre","x")),style=window.getComputedStyle?window.getComputedStyle(e):e.currentStyle,data={left:parseInt(style.paddingLeft),right:parseInt(style.paddingRight)};return isNaN(data.left)||isNaN(data.right)||(display.cachedPaddingH=data),data}function scrollGap(cm){return scrollerGap-cm.display.nativeBarWidth}function displayWidth(cm){return cm.display.scroller.clientWidth-scrollGap(cm)-cm.display.barWidth}function displayHeight(cm){return cm.display.scroller.clientHeight-scrollGap(cm)-cm.display.barHeight}function ensureLineHeights(cm,lineView,rect){var wrapping=cm.options.lineWrapping,curWidth=wrapping&&displayWidth(cm);if(!lineView.measure.heights||wrapping&&lineView.measure.width!=curWidth){var heights=lineView.measure.heights=[];if(wrapping){lineView.measure.width=curWidth;for(var rects=lineView.text.firstChild.getClientRects(),i=0;i<rects.length-1;i++){var cur=rects[i],next=rects[i+1];Math.abs(cur.bottom-next.bottom)>2&&heights.push((cur.bottom+next.top)/2-rect.top)}}heights.push(rect.bottom-rect.top)}}function mapFromLineView(lineView,line,lineN){if(lineView.line==line)return{map:lineView.measure.map,cache:lineView.measure.cache};for(var i=0;i<lineView.rest.length;i++)if(lineView.rest[i]==line)return{map:lineView.measure.maps[i],cache:lineView.measure.caches[i]};for(var i$1=0;i$1<lineView.rest.length;i$1++)if(lineNo(lineView.rest[i$1])>lineN)return{map:lineView.measure.maps[i$1],cache:lineView.measure.caches[i$1],before:!0}}function updateExternalMeasurement(cm,line){var lineN=lineNo(line=visualLine(line)),view=cm.display.externalMeasured=new LineView(cm.doc,line,lineN);view.lineN=lineN;var built=view.built=buildLineContent(cm,view);return view.text=built.pre,removeChildrenAndAdd(cm.display.lineMeasure,built.pre),view}function measureChar(cm,line,ch,bias){return measureCharPrepared(cm,prepareMeasureForLine(cm,line),ch,bias)}function findViewForLine(cm,lineN){if(lineN>=cm.display.viewFrom&&lineN<cm.display.viewTo)return cm.display.view[findViewIndex(cm,lineN)];var ext=cm.display.externalMeasured;return ext&&lineN>=ext.lineN&&lineN<ext.lineN+ext.size?ext:void 0}function prepareMeasureForLine(cm,line){var lineN=lineNo(line),view=findViewForLine(cm,lineN);view&&!view.text?view=null:view&&view.changes&&(updateLineForChanges(cm,view,lineN,getDimensions(cm)),cm.curOp.forceUpdate=!0),view||(view=updateExternalMeasurement(cm,line));var info=mapFromLineView(view,line,lineN);return{line:line,view:view,rect:null,map:info.map,cache:info.cache,before:info.before,hasHeights:!1}}function measureCharPrepared(cm,prepared,ch,bias,varHeight){prepared.before&&(ch=-1);var found,key=ch+(bias||"");return prepared.cache.hasOwnProperty(key)?found=prepared.cache[key]:(prepared.rect||(prepared.rect=prepared.view.text.getBoundingClientRect()),prepared.hasHeights||(ensureLineHeights(cm,prepared.view,prepared.rect),prepared.hasHeights=!0),(found=measureCharInner(cm,prepared,ch,bias)).bogus||(prepared.cache[key]=found)),{left:found.left,right:found.right,top:varHeight?found.rtop:found.top,bottom:varHeight?found.rbottom:found.bottom}}function nodeAndOffsetInLineMap(map$$1,ch,bias){for(var node,start,end,collapse,mStart,mEnd,i=0;i<map$$1.length;i+=3)if(mStart=map$$1[i],mEnd=map$$1[i+1],ch<mStart?(start=0,end=1,collapse="left"):ch<mEnd?end=(start=ch-mStart)+1:(i==map$$1.length-3||ch==mEnd&&map$$1[i+3]>ch)&&(start=(end=mEnd-mStart)-1,ch>=mEnd&&(collapse="right")),null!=start){if(node=map$$1[i+2],mStart==mEnd&&bias==(node.insertLeft?"left":"right")&&(collapse=bias),"left"==bias&&0==start)for(;i&&map$$1[i-2]==map$$1[i-3]&&map$$1[i-1].insertLeft;)node=map$$1[2+(i-=3)],collapse="left";if("right"==bias&&start==mEnd-mStart)for(;i<map$$1.length-3&&map$$1[i+3]==map$$1[i+4]&&!map$$1[i+5].insertLeft;)node=map$$1[(i+=3)+2],collapse="right";break}return{node:node,start:start,end:end,collapse:collapse,coverStart:mStart,coverEnd:mEnd}}function getUsefulRect(rects,bias){var rect=nullRect;if("left"==bias)for(var i=0;i<rects.length&&(rect=rects[i]).left==rect.right;i++);else for(var i$1=rects.length-1;i$1>=0&&(rect=rects[i$1]).left==rect.right;i$1--);return rect}function measureCharInner(cm,prepared,ch,bias){var rect,place=nodeAndOffsetInLineMap(prepared.map,ch,bias),node=place.node,start=place.start,end=place.end,collapse=place.collapse;if(3==node.nodeType){for(var i$1=0;i$1<4;i$1++){for(;start&&isExtendingChar(prepared.line.text.charAt(place.coverStart+start));)--start;for(;place.coverStart+end<place.coverEnd&&isExtendingChar(prepared.line.text.charAt(place.coverStart+end));)++end;if((rect=ie&&ie_version<9&&0==start&&end==place.coverEnd-place.coverStart?node.parentNode.getBoundingClientRect():getUsefulRect(range(node,start,end).getClientRects(),bias)).left||rect.right||0==start)break;end=start,start-=1,collapse="right"}ie&&ie_version<11&&(rect=maybeUpdateRectForZooming(cm.display.measure,rect))}else{start>0&&(collapse=bias="right");var rects;rect=cm.options.lineWrapping&&(rects=node.getClientRects()).length>1?rects["right"==bias?rects.length-1:0]:node.getBoundingClientRect()}if(ie&&ie_version<9&&!start&&(!rect||!rect.left&&!rect.right)){var rSpan=node.parentNode.getClientRects()[0];rect=rSpan?{left:rSpan.left,right:rSpan.left+charWidth(cm.display),top:rSpan.top,bottom:rSpan.bottom}:nullRect}for(var rtop=rect.top-prepared.rect.top,rbot=rect.bottom-prepared.rect.top,mid=(rtop+rbot)/2,heights=prepared.view.measure.heights,i=0;i<heights.length-1&&!(mid<heights[i]);i++);var top=i?heights[i-1]:0,bot=heights[i],result={left:("right"==collapse?rect.right:rect.left)-prepared.rect.left,right:("left"==collapse?rect.left:rect.right)-prepared.rect.left,top:top,bottom:bot};return rect.left||rect.right||(result.bogus=!0),cm.options.singleCursorHeightPerLine||(result.rtop=rtop,result.rbottom=rbot),result}function maybeUpdateRectForZooming(measure,rect){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!hasBadZoomedRects(measure))return rect;var scaleX=screen.logicalXDPI/screen.deviceXDPI,scaleY=screen.logicalYDPI/screen.deviceYDPI;return{left:rect.left*scaleX,right:rect.right*scaleX,top:rect.top*scaleY,bottom:rect.bottom*scaleY}}function clearLineMeasurementCacheFor(lineView){if(lineView.measure&&(lineView.measure.cache={},lineView.measure.heights=null,lineView.rest))for(var i=0;i<lineView.rest.length;i++)lineView.measure.caches[i]={}}function clearLineMeasurementCache(cm){cm.display.externalMeasure=null,removeChildren(cm.display.lineMeasure);for(var i=0;i<cm.display.view.length;i++)clearLineMeasurementCacheFor(cm.display.view[i])}function clearCaches(cm){clearLineMeasurementCache(cm),cm.display.cachedCharWidth=cm.display.cachedTextHeight=cm.display.cachedPaddingH=null,cm.options.lineWrapping||(cm.display.maxLineChanged=!0),cm.display.lineNumChars=null}function pageScrollX(){return chrome&&android?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function pageScrollY(){return chrome&&android?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function intoCoordSystem(cm,lineObj,rect,context,includeWidgets){if(!includeWidgets&&lineObj.widgets)for(var i=0;i<lineObj.widgets.length;++i)if(lineObj.widgets[i].above){var size=widgetHeight(lineObj.widgets[i]);rect.top+=size,rect.bottom+=size}if("line"==context)return rect;context||(context="local");var yOff=heightAtLine(lineObj);if("local"==context?yOff+=paddingTop(cm.display):yOff-=cm.display.viewOffset,"page"==context||"window"==context){var lOff=cm.display.lineSpace.getBoundingClientRect();yOff+=lOff.top+("window"==context?0:pageScrollY());var xOff=lOff.left+("window"==context?0:pageScrollX());rect.left+=xOff,rect.right+=xOff}return rect.top+=yOff,rect.bottom+=yOff,rect}function fromCoordSystem(cm,coords,context){if("div"==context)return coords;var left=coords.left,top=coords.top;if("page"==context)left-=pageScrollX(),top-=pageScrollY();else if("local"==context||!context){var localBox=cm.display.sizer.getBoundingClientRect();left+=localBox.left,top+=localBox.top}var lineSpaceBox=cm.display.lineSpace.getBoundingClientRect();return{left:left-lineSpaceBox.left,top:top-lineSpaceBox.top}}function charCoords(cm,pos,context,lineObj,bias){return lineObj||(lineObj=getLine(cm.doc,pos.line)),intoCoordSystem(cm,lineObj,measureChar(cm,lineObj,pos.ch,bias),context)}function cursorCoords(cm,pos,context,lineObj,preparedMeasure,varHeight){function get(ch,right){var m=measureCharPrepared(cm,preparedMeasure,ch,right?"right":"left",varHeight);return right?m.left=m.right:m.right=m.left,intoCoordSystem(cm,lineObj,m,context)}function getBidi(ch,partPos,invert){var right=order[partPos].level%2!=0;return get(invert?ch-1:ch,right!=invert)}lineObj=lineObj||getLine(cm.doc,pos.line),preparedMeasure||(preparedMeasure=prepareMeasureForLine(cm,lineObj));var order=getOrder(lineObj,cm.doc.direction),ch=pos.ch,sticky=pos.sticky;if(ch>=lineObj.text.length?(ch=lineObj.text.length,sticky="before"):ch<=0&&(ch=0,sticky="after"),!order)return get("before"==sticky?ch-1:ch,"before"==sticky);var partPos=getBidiPartAt(order,ch,sticky),other=bidiOther,val=getBidi(ch,partPos,"before"==sticky);return null!=other&&(val.other=getBidi(ch,other,"before"!=sticky)),val}function estimateCoords(cm,pos){var left=0;pos=clipPos(cm.doc,pos),cm.options.lineWrapping||(left=charWidth(cm.display)*pos.ch);var lineObj=getLine(cm.doc,pos.line),top=heightAtLine(lineObj)+paddingTop(cm.display);return{left:left,right:left,top:top,bottom:top+lineObj.height}}function PosWithInfo(line,ch,sticky,outside,xRel){var pos=Pos(line,ch,sticky);return pos.xRel=xRel,outside&&(pos.outside=!0),pos}function coordsChar(cm,x,y){var doc=cm.doc;if((y+=cm.display.viewOffset)<0)return PosWithInfo(doc.first,0,null,!0,-1);var lineN=lineAtHeight(doc,y),last=doc.first+doc.size-1;if(lineN>last)return PosWithInfo(doc.first+doc.size-1,getLine(doc,last).text.length,null,!0,1);x<0&&(x=0);for(var lineObj=getLine(doc,lineN);;){var found=coordsCharInner(cm,lineObj,lineN,x,y),merged=collapsedSpanAtEnd(lineObj),mergedPos=merged&&merged.find(0,!0);if(!merged||!(found.ch>mergedPos.from.ch||found.ch==mergedPos.from.ch&&found.xRel>0))return found;lineN=lineNo(lineObj=mergedPos.to.line)}}function wrappedLineExtent(cm,lineObj,preparedMeasure,y){var measure=function(ch){return intoCoordSystem(cm,lineObj,measureCharPrepared(cm,preparedMeasure,ch),"line")},end=lineObj.text.length,begin=findFirst(function(ch){return measure(ch-1).bottom<=y},end,0);return end=findFirst(function(ch){return measure(ch).top>y},begin,end),{begin:begin,end:end}}function wrappedLineExtentChar(cm,lineObj,preparedMeasure,target){return wrappedLineExtent(cm,lineObj,preparedMeasure,intoCoordSystem(cm,lineObj,measureCharPrepared(cm,preparedMeasure,target),"line").top)}function coordsCharInner(cm,lineObj,lineNo$$1,x,y){y-=heightAtLine(lineObj);var pos,begin=0,end=lineObj.text.length,preparedMeasure=prepareMeasureForLine(cm,lineObj);if(getOrder(lineObj,cm.doc.direction)){if(cm.options.lineWrapping){var assign;begin=(assign=wrappedLineExtent(cm,lineObj,preparedMeasure,y)).begin,end=assign.end}pos=new Pos(lineNo$$1,Math.floor(begin+(end-begin)/2));var prevDiff,prevPos,beginLeft=cursorCoords(cm,pos,"line",lineObj,preparedMeasure).left,dir=beginLeft<x?1:-1,diff=beginLeft-x,steps=Math.ceil((end-begin)/4);outer:do{prevDiff=diff,prevPos=pos;for(var i=0;i<steps;++i){var prevPos$1=pos;if(null==(pos=moveVisually(cm,lineObj,pos,dir))||pos.ch<begin||end<=("before"==pos.sticky?pos.ch-1:pos.ch)){pos=prevPos$1;break outer}}if(diff=cursorCoords(cm,pos,"line",lineObj,preparedMeasure).left-x,steps>1){var diff_change_per_step=Math.abs(diff-prevDiff)/steps;steps=Math.min(steps,Math.ceil(Math.abs(diff)/diff_change_per_step)),dir=diff<0?1:-1}}while(0!=diff&&(steps>1||dir<0!=diff<0&&Math.abs(diff)<=Math.abs(prevDiff)));if(Math.abs(diff)>Math.abs(prevDiff)){if(diff<0==prevDiff<0)throw new Error("Broke out of infinite loop in coordsCharInner");pos=prevPos}}else{var ch=findFirst(function(ch){var box=intoCoordSystem(cm,lineObj,measureCharPrepared(cm,preparedMeasure,ch),"line");return box.top>y?(end=Math.min(ch,end),!0):!(box.bottom<=y)&&(box.left>x||!(box.right<x)&&x-box.left<box.right-x)},begin,end);pos=new Pos(lineNo$$1,ch=skipExtendingChars(lineObj.text,ch,1),ch==end?"before":"after")}var coords=cursorCoords(cm,pos,"line",lineObj,preparedMeasure);return(y<coords.top||coords.bottom<y)&&(pos.outside=!0),pos.xRel=x<coords.left?-1:x>coords.right?1:0,pos}function textHeight(display){if(null!=display.cachedTextHeight)return display.cachedTextHeight;if(null==measureText){measureText=elt("pre");for(var i=0;i<49;++i)measureText.appendChild(document.createTextNode("x")),measureText.appendChild(elt("br"));measureText.appendChild(document.createTextNode("x"))}removeChildrenAndAdd(display.measure,measureText);var height=measureText.offsetHeight/50;return height>3&&(display.cachedTextHeight=height),removeChildren(display.measure),height||1}function charWidth(display){if(null!=display.cachedCharWidth)return display.cachedCharWidth;var anchor=elt("span","xxxxxxxxxx"),pre=elt("pre",[anchor]);removeChildrenAndAdd(display.measure,pre);var rect=anchor.getBoundingClientRect(),width=(rect.right-rect.left)/10;return width>2&&(display.cachedCharWidth=width),width||10}function getDimensions(cm){for(var d=cm.display,left={},width={},gutterLeft=d.gutters.clientLeft,n=d.gutters.firstChild,i=0;n;n=n.nextSibling,++i)left[cm.options.gutters[i]]=n.offsetLeft+n.clientLeft+gutterLeft,width[cm.options.gutters[i]]=n.clientWidth;return{fixedPos:compensateForHScroll(d),gutterTotalWidth:d.gutters.offsetWidth,gutterLeft:left,gutterWidth:width,wrapperWidth:d.wrapper.clientWidth}}function compensateForHScroll(display){return display.scroller.getBoundingClientRect().left-display.sizer.getBoundingClientRect().left}function estimateHeight(cm){var th=textHeight(cm.display),wrapping=cm.options.lineWrapping,perLine=wrapping&&Math.max(5,cm.display.scroller.clientWidth/charWidth(cm.display)-3);return function(line){if(lineIsHidden(cm.doc,line))return 0;var widgetsHeight=0;if(line.widgets)for(var i=0;i<line.widgets.length;i++)line.widgets[i].height&&(widgetsHeight+=line.widgets[i].height);return wrapping?widgetsHeight+(Math.ceil(line.text.length/perLine)||1)*th:widgetsHeight+th}}function estimateLineHeights(cm){var doc=cm.doc,est=estimateHeight(cm);doc.iter(function(line){var estHeight=est(line);estHeight!=line.height&&updateLineHeight(line,estHeight)})}function posFromMouse(cm,e,liberal,forRect){var display=cm.display;if(!liberal&&"true"==e_target(e).getAttribute("cm-not-content"))return null;var x,y,space=display.lineSpace.getBoundingClientRect();try{x=e.clientX-space.left,y=e.clientY-space.top}catch(e){return null}var line,coords=coordsChar(cm,x,y);if(forRect&&1==coords.xRel&&(line=getLine(cm.doc,coords.line).text).length==coords.ch){var colDiff=countColumn(line,line.length,cm.options.tabSize)-line.length;coords=Pos(coords.line,Math.max(0,Math.round((x-paddingH(cm.display).left)/charWidth(cm.display))-colDiff))}return coords}function findViewIndex(cm,n){if(n>=cm.display.viewTo)return null;if((n-=cm.display.viewFrom)<0)return null;for(var view=cm.display.view,i=0;i<view.length;i++)if((n-=view[i].size)<0)return i}function updateSelection(cm){cm.display.input.showSelection(cm.display.input.prepareSelection())}function prepareSelection(cm,primary){for(var doc=cm.doc,result={},curFragment=result.cursors=document.createDocumentFragment(),selFragment=result.selection=document.createDocumentFragment(),i=0;i<doc.sel.ranges.length;i++)if(!1!==primary||i!=doc.sel.primIndex){var range$$1=doc.sel.ranges[i];if(!(range$$1.from().line>=cm.display.viewTo||range$$1.to().line<cm.display.viewFrom)){var collapsed=range$$1.empty();(collapsed||cm.options.showCursorWhenSelecting)&&drawSelectionCursor(cm,range$$1.head,curFragment),collapsed||drawSelectionRange(cm,range$$1,selFragment)}}return result}function drawSelectionCursor(cm,head,output){var pos=cursorCoords(cm,head,"div",null,null,!cm.options.singleCursorHeightPerLine),cursor=output.appendChild(elt("div"," ","CodeMirror-cursor"));if(cursor.style.left=pos.left+"px",cursor.style.top=pos.top+"px",cursor.style.height=Math.max(0,pos.bottom-pos.top)*cm.options.cursorHeight+"px",pos.other){var otherCursor=output.appendChild(elt("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));otherCursor.style.display="",otherCursor.style.left=pos.other.left+"px",otherCursor.style.top=pos.other.top+"px",otherCursor.style.height=.85*(pos.other.bottom-pos.other.top)+"px"}}function drawSelectionRange(cm,range$$1,output){function add(left,top,width,bottom){top<0&&(top=0),top=Math.round(top),bottom=Math.round(bottom),fragment.appendChild(elt("div",null,"CodeMirror-selected","position: absolute; left: "+left+"px;\n top: "+top+"px; width: "+(null==width?rightSide-left:width)+"px;\n height: "+(bottom-top)+"px"))}function drawForLine(line,fromArg,toArg){function coords(ch,bias){return charCoords(cm,Pos(line,ch),"div",lineObj,bias)}var start,end,lineObj=getLine(doc,line),lineLen=lineObj.text.length;return iterateBidiSections(getOrder(lineObj,doc.direction),fromArg||0,null==toArg?lineLen:toArg,function(from,to,dir){var rightPos,left,right,leftPos=coords(from,"left");if(from==to)rightPos=leftPos,left=right=leftPos.left;else{if(rightPos=coords(to-1,"right"),"rtl"==dir){var tmp=leftPos;leftPos=rightPos,rightPos=tmp}left=leftPos.left,right=rightPos.right}null==fromArg&&0==from&&(left=leftSide),rightPos.top-leftPos.top>3&&(add(left,leftPos.top,null,leftPos.bottom),left=leftSide,leftPos.bottom<rightPos.top&&add(left,leftPos.bottom,null,rightPos.top)),null==toArg&&to==lineLen&&(right=rightSide),(!start||leftPos.top<start.top||leftPos.top==start.top&&leftPos.left<start.left)&&(start=leftPos),(!end||rightPos.bottom>end.bottom||rightPos.bottom==end.bottom&&rightPos.right>end.right)&&(end=rightPos),left<leftSide+1&&(left=leftSide),add(left,rightPos.top,right-left,rightPos.bottom)}),{start:start,end:end}}var display=cm.display,doc=cm.doc,fragment=document.createDocumentFragment(),padding=paddingH(cm.display),leftSide=padding.left,rightSide=Math.max(display.sizerWidth,displayWidth(cm)-display.sizer.offsetLeft)-padding.right,sFrom=range$$1.from(),sTo=range$$1.to();if(sFrom.line==sTo.line)drawForLine(sFrom.line,sFrom.ch,sTo.ch);else{var fromLine=getLine(doc,sFrom.line),toLine=getLine(doc,sTo.line),singleVLine=visualLine(fromLine)==visualLine(toLine),leftEnd=drawForLine(sFrom.line,sFrom.ch,singleVLine?fromLine.text.length+1:null).end,rightStart=drawForLine(sTo.line,singleVLine?0:null,sTo.ch).start;singleVLine&&(leftEnd.top<rightStart.top-2?(add(leftEnd.right,leftEnd.top,null,leftEnd.bottom),add(leftSide,rightStart.top,rightStart.left,rightStart.bottom)):add(leftEnd.right,leftEnd.top,rightStart.left-leftEnd.right,leftEnd.bottom)),leftEnd.bottom<rightStart.top&&add(leftSide,leftEnd.bottom,null,rightStart.top)}output.appendChild(fragment)}function restartBlink(cm){if(cm.state.focused){var display=cm.display;clearInterval(display.blinker);var on=!0;display.cursorDiv.style.visibility="",cm.options.cursorBlinkRate>0?display.blinker=setInterval(function(){return display.cursorDiv.style.visibility=(on=!on)?"":"hidden"},cm.options.cursorBlinkRate):cm.options.cursorBlinkRate<0&&(display.cursorDiv.style.visibility="hidden")}}function ensureFocus(cm){cm.state.focused||(cm.display.input.focus(),onFocus(cm))}function delayBlurEvent(cm){cm.state.delayingBlurEvent=!0,setTimeout(function(){cm.state.delayingBlurEvent&&(cm.state.delayingBlurEvent=!1,onBlur(cm))},100)}function onFocus(cm,e){cm.state.delayingBlurEvent&&(cm.state.delayingBlurEvent=!1),"nocursor"!=cm.options.readOnly&&(cm.state.focused||(signal(cm,"focus",cm,e),cm.state.focused=!0,addClass(cm.display.wrapper,"CodeMirror-focused"),cm.curOp||cm.display.selForContextMenu==cm.doc.sel||(cm.display.input.reset(),webkit&&setTimeout(function(){return cm.display.input.reset(!0)},20)),cm.display.input.receivedFocus()),restartBlink(cm))}function onBlur(cm,e){cm.state.delayingBlurEvent||(cm.state.focused&&(signal(cm,"blur",cm,e),cm.state.focused=!1,rmClass(cm.display.wrapper,"CodeMirror-focused")),clearInterval(cm.display.blinker),setTimeout(function(){cm.state.focused||(cm.display.shift=!1)},150))}function updateHeightsInViewport(cm){for(var display=cm.display,prevBottom=display.lineDiv.offsetTop,i=0;i<display.view.length;i++){var cur=display.view[i],height=void 0;if(!cur.hidden){if(ie&&ie_version<8){var bot=cur.node.offsetTop+cur.node.offsetHeight;height=bot-prevBottom,prevBottom=bot}else{var box=cur.node.getBoundingClientRect();height=box.bottom-box.top}var diff=cur.line.height-height;if(height<2&&(height=textHeight(display)),(diff>.001||diff<-.001)&&(updateLineHeight(cur.line,height),updateWidgetHeight(cur.line),cur.rest))for(var j=0;j<cur.rest.length;j++)updateWidgetHeight(cur.rest[j])}}}function updateWidgetHeight(line){if(line.widgets)for(var i=0;i<line.widgets.length;++i)line.widgets[i].height=line.widgets[i].node.parentNode.offsetHeight}function visibleLines(display,doc,viewport){var top=viewport&&null!=viewport.top?Math.max(0,viewport.top):display.scroller.scrollTop;top=Math.floor(top-paddingTop(display));var bottom=viewport&&null!=viewport.bottom?viewport.bottom:top+display.wrapper.clientHeight,from=lineAtHeight(doc,top),to=lineAtHeight(doc,bottom);if(viewport&&viewport.ensure){var ensureFrom=viewport.ensure.from.line,ensureTo=viewport.ensure.to.line;ensureFrom<from?(from=ensureFrom,to=lineAtHeight(doc,heightAtLine(getLine(doc,ensureFrom))+display.wrapper.clientHeight)):Math.min(ensureTo,doc.lastLine())>=to&&(from=lineAtHeight(doc,heightAtLine(getLine(doc,ensureTo))-display.wrapper.clientHeight),to=ensureTo)}return{from:from,to:Math.max(to,from+1)}}function alignHorizontally(cm){var display=cm.display,view=display.view;if(display.alignWidgets||display.gutters.firstChild&&cm.options.fixedGutter){for(var comp=compensateForHScroll(display)-display.scroller.scrollLeft+cm.doc.scrollLeft,gutterW=display.gutters.offsetWidth,left=comp+"px",i=0;i<view.length;i++)if(!view[i].hidden){cm.options.fixedGutter&&(view[i].gutter&&(view[i].gutter.style.left=left),view[i].gutterBackground&&(view[i].gutterBackground.style.left=left));var align=view[i].alignable;if(align)for(var j=0;j<align.length;j++)align[j].style.left=left}cm.options.fixedGutter&&(display.gutters.style.left=comp+gutterW+"px")}}function maybeUpdateLineNumberWidth(cm){if(!cm.options.lineNumbers)return!1;var doc=cm.doc,last=lineNumberFor(cm.options,doc.first+doc.size-1),display=cm.display;if(last.length!=display.lineNumChars){var test=display.measure.appendChild(elt("div",[elt("div",last)],"CodeMirror-linenumber CodeMirror-gutter-elt")),innerW=test.firstChild.offsetWidth,padding=test.offsetWidth-innerW;return display.lineGutter.style.width="",display.lineNumInnerWidth=Math.max(innerW,display.lineGutter.offsetWidth-padding)+1,display.lineNumWidth=display.lineNumInnerWidth+padding,display.lineNumChars=display.lineNumInnerWidth?last.length:-1,display.lineGutter.style.width=display.lineNumWidth+"px",updateGutterSpace(cm),!0}return!1}function maybeScrollWindow(cm,rect){if(!signalDOMEvent(cm,"scrollCursorIntoView")){var display=cm.display,box=display.sizer.getBoundingClientRect(),doScroll=null;if(rect.top+box.top<0?doScroll=!0:rect.bottom+box.top>(window.innerHeight||document.documentElement.clientHeight)&&(doScroll=!1),null!=doScroll&&!phantom){var scrollNode=elt("div","",null,"position: absolute;\n top: "+(rect.top-display.viewOffset-paddingTop(cm.display))+"px;\n height: "+(rect.bottom-rect.top+scrollGap(cm)+display.barHeight)+"px;\n left: "+rect.left+"px; width: "+Math.max(2,rect.right-rect.left)+"px;");cm.display.lineSpace.appendChild(scrollNode),scrollNode.scrollIntoView(doScroll),cm.display.lineSpace.removeChild(scrollNode)}}}function scrollPosIntoView(cm,pos,end,margin){null==margin&&(margin=0);for(var rect,limit=0;limit<5;limit++){var changed=!1,coords=cursorCoords(cm,pos),endCoords=end&&end!=pos?cursorCoords(cm,end):coords,scrollPos=calculateScrollPos(cm,rect={left:Math.min(coords.left,endCoords.left),top:Math.min(coords.top,endCoords.top)-margin,right:Math.max(coords.left,endCoords.left),bottom:Math.max(coords.bottom,endCoords.bottom)+margin}),startTop=cm.doc.scrollTop,startLeft=cm.doc.scrollLeft;if(null!=scrollPos.scrollTop&&(updateScrollTop(cm,scrollPos.scrollTop),Math.abs(cm.doc.scrollTop-startTop)>1&&(changed=!0)),null!=scrollPos.scrollLeft&&(setScrollLeft(cm,scrollPos.scrollLeft),Math.abs(cm.doc.scrollLeft-startLeft)>1&&(changed=!0)),!changed)break}return rect}function scrollIntoView(cm,rect){var scrollPos=calculateScrollPos(cm,rect);null!=scrollPos.scrollTop&&updateScrollTop(cm,scrollPos.scrollTop),null!=scrollPos.scrollLeft&&setScrollLeft(cm,scrollPos.scrollLeft)}function calculateScrollPos(cm,rect){var display=cm.display,snapMargin=textHeight(cm.display);rect.top<0&&(rect.top=0);var screentop=cm.curOp&&null!=cm.curOp.scrollTop?cm.curOp.scrollTop:display.scroller.scrollTop,screen=displayHeight(cm),result={};rect.bottom-rect.top>screen&&(rect.bottom=rect.top+screen);var docBottom=cm.doc.height+paddingVert(display),atTop=rect.top<snapMargin,atBottom=rect.bottom>docBottom-snapMargin;if(rect.top<screentop)result.scrollTop=atTop?0:rect.top;else if(rect.bottom>screentop+screen){var newTop=Math.min(rect.top,(atBottom?docBottom:rect.bottom)-screen);newTop!=screentop&&(result.scrollTop=newTop)}var screenleft=cm.curOp&&null!=cm.curOp.scrollLeft?cm.curOp.scrollLeft:display.scroller.scrollLeft,screenw=displayWidth(cm)-(cm.options.fixedGutter?display.gutters.offsetWidth:0),tooWide=rect.right-rect.left>screenw;return tooWide&&(rect.right=rect.left+screenw),rect.left<10?result.scrollLeft=0:rect.left<screenleft?result.scrollLeft=Math.max(0,rect.left-(tooWide?0:10)):rect.right>screenw+screenleft-3&&(result.scrollLeft=rect.right+(tooWide?0:10)-screenw),result}function addToScrollTop(cm,top){null!=top&&(resolveScrollToPos(cm),cm.curOp.scrollTop=(null==cm.curOp.scrollTop?cm.doc.scrollTop:cm.curOp.scrollTop)+top)}function ensureCursorVisible(cm){resolveScrollToPos(cm);var cur=cm.getCursor(),from=cur,to=cur;cm.options.lineWrapping||(from=cur.ch?Pos(cur.line,cur.ch-1):cur,to=Pos(cur.line,cur.ch+1)),cm.curOp.scrollToPos={from:from,to:to,margin:cm.options.cursorScrollMargin}}function scrollToCoords(cm,x,y){null==x&&null==y||resolveScrollToPos(cm),null!=x&&(cm.curOp.scrollLeft=x),null!=y&&(cm.curOp.scrollTop=y)}function scrollToRange(cm,range$$1){resolveScrollToPos(cm),cm.curOp.scrollToPos=range$$1}function resolveScrollToPos(cm){var range$$1=cm.curOp.scrollToPos;range$$1&&(cm.curOp.scrollToPos=null,scrollToCoordsRange(cm,estimateCoords(cm,range$$1.from),estimateCoords(cm,range$$1.to),range$$1.margin))}function scrollToCoordsRange(cm,from,to,margin){var sPos=calculateScrollPos(cm,{left:Math.min(from.left,to.left),top:Math.min(from.top,to.top)-margin,right:Math.max(from.right,to.right),bottom:Math.max(from.bottom,to.bottom)+margin});scrollToCoords(cm,sPos.scrollLeft,sPos.scrollTop)}function updateScrollTop(cm,val){Math.abs(cm.doc.scrollTop-val)<2||(gecko||updateDisplaySimple(cm,{top:val}),setScrollTop(cm,val,!0),gecko&&updateDisplaySimple(cm),startWorker(cm,100))}function setScrollTop(cm,val,forceScroll){val=Math.min(cm.display.scroller.scrollHeight-cm.display.scroller.clientHeight,val),(cm.display.scroller.scrollTop!=val||forceScroll)&&(cm.doc.scrollTop=val,cm.display.scrollbars.setScrollTop(val),cm.display.scroller.scrollTop!=val&&(cm.display.scroller.scrollTop=val))}function setScrollLeft(cm,val,isScroller,forceScroll){val=Math.min(val,cm.display.scroller.scrollWidth-cm.display.scroller.clientWidth),(isScroller?val==cm.doc.scrollLeft:Math.abs(cm.doc.scrollLeft-val)<2)&&!forceScroll||(cm.doc.scrollLeft=val,alignHorizontally(cm),cm.display.scroller.scrollLeft!=val&&(cm.display.scroller.scrollLeft=val),cm.display.scrollbars.setScrollLeft(val))}function measureForScrollbars(cm){var d=cm.display,gutterW=d.gutters.offsetWidth,docH=Math.round(cm.doc.height+paddingVert(cm.display));return{clientHeight:d.scroller.clientHeight,viewHeight:d.wrapper.clientHeight,scrollWidth:d.scroller.scrollWidth,clientWidth:d.scroller.clientWidth,viewWidth:d.wrapper.clientWidth,barLeft:cm.options.fixedGutter?gutterW:0,docHeight:docH,scrollHeight:docH+scrollGap(cm)+d.barHeight,nativeBarWidth:d.nativeBarWidth,gutterWidth:gutterW}}function updateScrollbars(cm,measure){measure||(measure=measureForScrollbars(cm));var startWidth=cm.display.barWidth,startHeight=cm.display.barHeight;updateScrollbarsInner(cm,measure);for(var i=0;i<4&&startWidth!=cm.display.barWidth||startHeight!=cm.display.barHeight;i++)startWidth!=cm.display.barWidth&&cm.options.lineWrapping&&updateHeightsInViewport(cm),updateScrollbarsInner(cm,measureForScrollbars(cm)),startWidth=cm.display.barWidth,startHeight=cm.display.barHeight}function updateScrollbarsInner(cm,measure){var d=cm.display,sizes=d.scrollbars.update(measure);d.sizer.style.paddingRight=(d.barWidth=sizes.right)+"px",d.sizer.style.paddingBottom=(d.barHeight=sizes.bottom)+"px",d.heightForcer.style.borderBottom=sizes.bottom+"px solid transparent",sizes.right&&sizes.bottom?(d.scrollbarFiller.style.display="block",d.scrollbarFiller.style.height=sizes.bottom+"px",d.scrollbarFiller.style.width=sizes.right+"px"):d.scrollbarFiller.style.display="",sizes.bottom&&cm.options.coverGutterNextToScrollbar&&cm.options.fixedGutter?(d.gutterFiller.style.display="block",d.gutterFiller.style.height=sizes.bottom+"px",d.gutterFiller.style.width=measure.gutterWidth+"px"):d.gutterFiller.style.display=""}function initScrollbars(cm){cm.display.scrollbars&&(cm.display.scrollbars.clear(),cm.display.scrollbars.addClass&&rmClass(cm.display.wrapper,cm.display.scrollbars.addClass)),cm.display.scrollbars=new scrollbarModel[cm.options.scrollbarStyle](function(node){cm.display.wrapper.insertBefore(node,cm.display.scrollbarFiller),on(node,"mousedown",function(){cm.state.focused&&setTimeout(function(){return cm.display.input.focus()},0)}),node.setAttribute("cm-not-content","true")},function(pos,axis){"horizontal"==axis?setScrollLeft(cm,pos):updateScrollTop(cm,pos)},cm),cm.display.scrollbars.addClass&&addClass(cm.display.wrapper,cm.display.scrollbars.addClass)}function startOperation(cm){cm.curOp={cm:cm,viewChanged:!1,startHeight:cm.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++nextOpId},pushOperation(cm.curOp)}function endOperation(cm){finishOperation(cm.curOp,function(group){for(var i=0;i<group.ops.length;i++)group.ops[i].cm.curOp=null;endOperations(group)})}function endOperations(group){for(var ops=group.ops,i=0;i<ops.length;i++)endOperation_R1(ops[i]);for(var i$1=0;i$1<ops.length;i$1++)endOperation_W1(ops[i$1]);for(var i$2=0;i$2<ops.length;i$2++)endOperation_R2(ops[i$2]);for(var i$3=0;i$3<ops.length;i$3++)endOperation_W2(ops[i$3]);for(var i$4=0;i$4<ops.length;i$4++)endOperation_finish(ops[i$4])}function endOperation_R1(op){var cm=op.cm,display=cm.display;maybeClipScrollbars(cm),op.updateMaxLine&&findMaxLine(cm),op.mustUpdate=op.viewChanged||op.forceUpdate||null!=op.scrollTop||op.scrollToPos&&(op.scrollToPos.from.line<display.viewFrom||op.scrollToPos.to.line>=display.viewTo)||display.maxLineChanged&&cm.options.lineWrapping,op.update=op.mustUpdate&&new DisplayUpdate(cm,op.mustUpdate&&{top:op.scrollTop,ensure:op.scrollToPos},op.forceUpdate)}function endOperation_W1(op){op.updatedDisplay=op.mustUpdate&&updateDisplayIfNeeded(op.cm,op.update)}function endOperation_R2(op){var cm=op.cm,display=cm.display;op.updatedDisplay&&updateHeightsInViewport(cm),op.barMeasure=measureForScrollbars(cm),display.maxLineChanged&&!cm.options.lineWrapping&&(op.adjustWidthTo=measureChar(cm,display.maxLine,display.maxLine.text.length).left+3,cm.display.sizerWidth=op.adjustWidthTo,op.barMeasure.scrollWidth=Math.max(display.scroller.clientWidth,display.sizer.offsetLeft+op.adjustWidthTo+scrollGap(cm)+cm.display.barWidth),op.maxScrollLeft=Math.max(0,display.sizer.offsetLeft+op.adjustWidthTo-displayWidth(cm))),(op.updatedDisplay||op.selectionChanged)&&(op.preparedSelection=display.input.prepareSelection(op.focus))}function endOperation_W2(op){var cm=op.cm;null!=op.adjustWidthTo&&(cm.display.sizer.style.minWidth=op.adjustWidthTo+"px",op.maxScrollLeft<cm.doc.scrollLeft&&setScrollLeft(cm,Math.min(cm.display.scroller.scrollLeft,op.maxScrollLeft),!0),cm.display.maxLineChanged=!1);var takeFocus=op.focus&&op.focus==activeElt()&&(!document.hasFocus||document.hasFocus());op.preparedSelection&&cm.display.input.showSelection(op.preparedSelection,takeFocus),(op.updatedDisplay||op.startHeight!=cm.doc.height)&&updateScrollbars(cm,op.barMeasure),op.updatedDisplay&&setDocumentHeight(cm,op.barMeasure),op.selectionChanged&&restartBlink(cm),cm.state.focused&&op.updateInput&&cm.display.input.reset(op.typing),takeFocus&&ensureFocus(op.cm)}function endOperation_finish(op){var cm=op.cm,display=cm.display,doc=cm.doc;op.updatedDisplay&&postUpdateDisplay(cm,op.update),null==display.wheelStartX||null==op.scrollTop&&null==op.scrollLeft&&!op.scrollToPos||(display.wheelStartX=display.wheelStartY=null),null!=op.scrollTop&&setScrollTop(cm,op.scrollTop,op.forceScroll),null!=op.scrollLeft&&setScrollLeft(cm,op.scrollLeft,!0,!0),op.scrollToPos&&maybeScrollWindow(cm,scrollPosIntoView(cm,clipPos(doc,op.scrollToPos.from),clipPos(doc,op.scrollToPos.to),op.scrollToPos.margin));var hidden=op.maybeHiddenMarkers,unhidden=op.maybeUnhiddenMarkers;if(hidden)for(var i=0;i<hidden.length;++i)hidden[i].lines.length||signal(hidden[i],"hide");if(unhidden)for(var i$1=0;i$1<unhidden.length;++i$1)unhidden[i$1].lines.length&&signal(unhidden[i$1],"unhide");display.wrapper.offsetHeight&&(doc.scrollTop=cm.display.scroller.scrollTop),op.changeObjs&&signal(cm,"changes",cm,op.changeObjs),op.update&&op.update.finish()}function runInOp(cm,f){if(cm.curOp)return f();startOperation(cm);try{return f()}finally{endOperation(cm)}}function operation(cm,f){return function(){if(cm.curOp)return f.apply(cm,arguments);startOperation(cm);try{return f.apply(cm,arguments)}finally{endOperation(cm)}}}function methodOp(f){return function(){if(this.curOp)return f.apply(this,arguments);startOperation(this);try{return f.apply(this,arguments)}finally{endOperation(this)}}}function docMethodOp(f){return function(){var cm=this.cm;if(!cm||cm.curOp)return f.apply(this,arguments);startOperation(cm);try{return f.apply(this,arguments)}finally{endOperation(cm)}}}function regChange(cm,from,to,lendiff){null==from&&(from=cm.doc.first),null==to&&(to=cm.doc.first+cm.doc.size),lendiff||(lendiff=0);var display=cm.display;if(lendiff&&to<display.viewTo&&(null==display.updateLineNumbers||display.updateLineNumbers>from)&&(display.updateLineNumbers=from),cm.curOp.viewChanged=!0,from>=display.viewTo)sawCollapsedSpans&&visualLineNo(cm.doc,from)<display.viewTo&&resetView(cm);else if(to<=display.viewFrom)sawCollapsedSpans&&visualLineEndNo(cm.doc,to+lendiff)>display.viewFrom?resetView(cm):(display.viewFrom+=lendiff,display.viewTo+=lendiff);else if(from<=display.viewFrom&&to>=display.viewTo)resetView(cm);else if(from<=display.viewFrom){var cut=viewCuttingPoint(cm,to,to+lendiff,1);cut?(display.view=display.view.slice(cut.index),display.viewFrom=cut.lineN,display.viewTo+=lendiff):resetView(cm)}else if(to>=display.viewTo){var cut$1=viewCuttingPoint(cm,from,from,-1);cut$1?(display.view=display.view.slice(0,cut$1.index),display.viewTo=cut$1.lineN):resetView(cm)}else{var cutTop=viewCuttingPoint(cm,from,from,-1),cutBot=viewCuttingPoint(cm,to,to+lendiff,1);cutTop&&cutBot?(display.view=display.view.slice(0,cutTop.index).concat(buildViewArray(cm,cutTop.lineN,cutBot.lineN)).concat(display.view.slice(cutBot.index)),display.viewTo+=lendiff):resetView(cm)}var ext=display.externalMeasured;ext&&(to<ext.lineN?ext.lineN+=lendiff:from<ext.lineN+ext.size&&(display.externalMeasured=null))}function regLineChange(cm,line,type){cm.curOp.viewChanged=!0;var display=cm.display,ext=cm.display.externalMeasured;if(ext&&line>=ext.lineN&&line<ext.lineN+ext.size&&(display.externalMeasured=null),!(line<display.viewFrom||line>=display.viewTo)){var lineView=display.view[findViewIndex(cm,line)];if(null!=lineView.node){var arr=lineView.changes||(lineView.changes=[]);-1==indexOf(arr,type)&&arr.push(type)}}}function resetView(cm){cm.display.viewFrom=cm.display.viewTo=cm.doc.first,cm.display.view=[],cm.display.viewOffset=0}function viewCuttingPoint(cm,oldN,newN,dir){var diff,index=findViewIndex(cm,oldN),view=cm.display.view;if(!sawCollapsedSpans||newN==cm.doc.first+cm.doc.size)return{index:index,lineN:newN};for(var n=cm.display.viewFrom,i=0;i<index;i++)n+=view[i].size;if(n!=oldN){if(dir>0){if(index==view.length-1)return null;diff=n+view[index].size-oldN,index++}else diff=n-oldN;oldN+=diff,newN+=diff}for(;visualLineNo(cm.doc,newN)!=newN;){if(index==(dir<0?0:view.length-1))return null;newN+=dir*view[index-(dir<0?1:0)].size,index+=dir}return{index:index,lineN:newN}}function adjustView(cm,from,to){var display=cm.display;0==display.view.length||from>=display.viewTo||to<=display.viewFrom?(display.view=buildViewArray(cm,from,to),display.viewFrom=from):(display.viewFrom>from?display.view=buildViewArray(cm,from,display.viewFrom).concat(display.view):display.viewFrom<from&&(display.view=display.view.slice(findViewIndex(cm,from))),display.viewFrom=from,display.viewTo<to?display.view=display.view.concat(buildViewArray(cm,display.viewTo,to)):display.viewTo>to&&(display.view=display.view.slice(0,findViewIndex(cm,to)))),display.viewTo=to}function countDirtyView(cm){for(var view=cm.display.view,dirty=0,i=0;i<view.length;i++){var lineView=view[i];lineView.hidden||lineView.node&&!lineView.changes||++dirty}return dirty}function startWorker(cm,time){cm.doc.highlightFrontier<cm.display.viewTo&&cm.state.highlight.set(time,bind(highlightWorker,cm))}function highlightWorker(cm){var doc=cm.doc;if(!(doc.highlightFrontier>=cm.display.viewTo)){var end=+new Date+cm.options.workTime,context=getContextBefore(cm,doc.highlightFrontier),changedLines=[];doc.iter(context.line,Math.min(doc.first+doc.size,cm.display.viewTo+500),function(line){if(context.line>=cm.display.viewFrom){var oldStyles=line.styles,resetState=line.text.length>cm.options.maxHighlightLength?copyState(doc.mode,context.state):null,highlighted=highlightLine(cm,line,context,!0);resetState&&(context.state=resetState),line.styles=highlighted.styles;var oldCls=line.styleClasses,newCls=highlighted.classes;newCls?line.styleClasses=newCls:oldCls&&(line.styleClasses=null);for(var ischange=!oldStyles||oldStyles.length!=line.styles.length||oldCls!=newCls&&(!oldCls||!newCls||oldCls.bgClass!=newCls.bgClass||oldCls.textClass!=newCls.textClass),i=0;!ischange&&i<oldStyles.length;++i)ischange=oldStyles[i]!=line.styles[i];ischange&&changedLines.push(context.line),line.stateAfter=context.save(),context.nextLine()}else line.text.length<=cm.options.maxHighlightLength&&processLine(cm,line.text,context),line.stateAfter=context.line%5==0?context.save():null,context.nextLine();if(+new Date>end)return startWorker(cm,cm.options.workDelay),!0}),doc.highlightFrontier=context.line,doc.modeFrontier=Math.max(doc.modeFrontier,context.line),changedLines.length&&runInOp(cm,function(){for(var i=0;i<changedLines.length;i++)regLineChange(cm,changedLines[i],"text")})}}function maybeClipScrollbars(cm){var display=cm.display;!display.scrollbarsClipped&&display.scroller.offsetWidth&&(display.nativeBarWidth=display.scroller.offsetWidth-display.scroller.clientWidth,display.heightForcer.style.height=scrollGap(cm)+"px",display.sizer.style.marginBottom=-display.nativeBarWidth+"px",display.sizer.style.borderRightWidth=scrollGap(cm)+"px",display.scrollbarsClipped=!0)}function selectionSnapshot(cm){if(cm.hasFocus())return null;var active=activeElt();if(!active||!contains(cm.display.lineDiv,active))return null;var result={activeElt:active};if(window.getSelection){var sel=window.getSelection();sel.anchorNode&&sel.extend&&contains(cm.display.lineDiv,sel.anchorNode)&&(result.anchorNode=sel.anchorNode,result.anchorOffset=sel.anchorOffset,result.focusNode=sel.focusNode,result.focusOffset=sel.focusOffset)}return result}function restoreSelection(snapshot){if(snapshot&&snapshot.activeElt&&snapshot.activeElt!=activeElt()&&(snapshot.activeElt.focus(),snapshot.anchorNode&&contains(document.body,snapshot.anchorNode)&&contains(document.body,snapshot.focusNode))){var sel=window.getSelection(),range$$1=document.createRange();range$$1.setEnd(snapshot.anchorNode,snapshot.anchorOffset),range$$1.collapse(!1),sel.removeAllRanges(),sel.addRange(range$$1),sel.extend(snapshot.focusNode,snapshot.focusOffset)}}function updateDisplayIfNeeded(cm,update){var display=cm.display,doc=cm.doc;if(update.editorIsHidden)return resetView(cm),!1;if(!update.force&&update.visible.from>=display.viewFrom&&update.visible.to<=display.viewTo&&(null==display.updateLineNumbers||display.updateLineNumbers>=display.viewTo)&&display.renderedView==display.view&&0==countDirtyView(cm))return!1;maybeUpdateLineNumberWidth(cm)&&(resetView(cm),update.dims=getDimensions(cm));var end=doc.first+doc.size,from=Math.max(update.visible.from-cm.options.viewportMargin,doc.first),to=Math.min(end,update.visible.to+cm.options.viewportMargin);display.viewFrom<from&&from-display.viewFrom<20&&(from=Math.max(doc.first,display.viewFrom)),display.viewTo>to&&display.viewTo-to<20&&(to=Math.min(end,display.viewTo)),sawCollapsedSpans&&(from=visualLineNo(cm.doc,from),to=visualLineEndNo(cm.doc,to));var different=from!=display.viewFrom||to!=display.viewTo||display.lastWrapHeight!=update.wrapperHeight||display.lastWrapWidth!=update.wrapperWidth;adjustView(cm,from,to),display.viewOffset=heightAtLine(getLine(cm.doc,display.viewFrom)),cm.display.mover.style.top=display.viewOffset+"px";var toUpdate=countDirtyView(cm);if(!different&&0==toUpdate&&!update.force&&display.renderedView==display.view&&(null==display.updateLineNumbers||display.updateLineNumbers>=display.viewTo))return!1;var selSnapshot=selectionSnapshot(cm);return toUpdate>4&&(display.lineDiv.style.display="none"),patchDisplay(cm,display.updateLineNumbers,update.dims),toUpdate>4&&(display.lineDiv.style.display=""),display.renderedView=display.view,restoreSelection(selSnapshot),removeChildren(display.cursorDiv),removeChildren(display.selectionDiv),display.gutters.style.height=display.sizer.style.minHeight=0,different&&(display.lastWrapHeight=update.wrapperHeight,display.lastWrapWidth=update.wrapperWidth,startWorker(cm,400)),display.updateLineNumbers=null,!0}function postUpdateDisplay(cm,update){for(var viewport=update.viewport,first=!0;(first&&cm.options.lineWrapping&&update.oldDisplayWidth!=displayWidth(cm)||(viewport&&null!=viewport.top&&(viewport={top:Math.min(cm.doc.height+paddingVert(cm.display)-displayHeight(cm),viewport.top)}),update.visible=visibleLines(cm.display,cm.doc,viewport),!(update.visible.from>=cm.display.viewFrom&&update.visible.to<=cm.display.viewTo)))&&updateDisplayIfNeeded(cm,update);first=!1){updateHeightsInViewport(cm);var barMeasure=measureForScrollbars(cm);updateSelection(cm),updateScrollbars(cm,barMeasure),setDocumentHeight(cm,barMeasure),update.force=!1}update.signal(cm,"update",cm),cm.display.viewFrom==cm.display.reportedViewFrom&&cm.display.viewTo==cm.display.reportedViewTo||(update.signal(cm,"viewportChange",cm,cm.display.viewFrom,cm.display.viewTo),cm.display.reportedViewFrom=cm.display.viewFrom,cm.display.reportedViewTo=cm.display.viewTo)}function updateDisplaySimple(cm,viewport){var update=new DisplayUpdate(cm,viewport);if(updateDisplayIfNeeded(cm,update)){updateHeightsInViewport(cm),postUpdateDisplay(cm,update);var barMeasure=measureForScrollbars(cm);updateSelection(cm),updateScrollbars(cm,barMeasure),setDocumentHeight(cm,barMeasure),update.finish()}}function patchDisplay(cm,updateNumbersFrom,dims){function rm(node){var next=node.nextSibling;return webkit&&mac&&cm.display.currentWheelTarget==node?node.style.display="none":node.parentNode.removeChild(node),next}for(var display=cm.display,lineNumbers=cm.options.lineNumbers,container=display.lineDiv,cur=container.firstChild,view=display.view,lineN=display.viewFrom,i=0;i<view.length;i++){var lineView=view[i];if(lineView.hidden);else if(lineView.node&&lineView.node.parentNode==container){for(;cur!=lineView.node;)cur=rm(cur);var updateNumber=lineNumbers&&null!=updateNumbersFrom&&updateNumbersFrom<=lineN&&lineView.lineNumber;lineView.changes&&(indexOf(lineView.changes,"gutter")>-1&&(updateNumber=!1),updateLineForChanges(cm,lineView,lineN,dims)),updateNumber&&(removeChildren(lineView.lineNumber),lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options,lineN)))),cur=lineView.node.nextSibling}else{var node=buildLineElement(cm,lineView,lineN,dims);container.insertBefore(node,cur)}lineN+=lineView.size}for(;cur;)cur=rm(cur)}function updateGutterSpace(cm){var width=cm.display.gutters.offsetWidth;cm.display.sizer.style.marginLeft=width+"px"}function setDocumentHeight(cm,measure){cm.display.sizer.style.minHeight=measure.docHeight+"px",cm.display.heightForcer.style.top=measure.docHeight+"px",cm.display.gutters.style.height=measure.docHeight+cm.display.barHeight+scrollGap(cm)+"px"}function updateGutters(cm){var gutters=cm.display.gutters,specs=cm.options.gutters;removeChildren(gutters);for(var i=0;i<specs.length;++i){var gutterClass=specs[i],gElt=gutters.appendChild(elt("div",null,"CodeMirror-gutter "+gutterClass));"CodeMirror-linenumbers"==gutterClass&&(cm.display.lineGutter=gElt,gElt.style.width=(cm.display.lineNumWidth||1)+"px")}gutters.style.display=i?"":"none",updateGutterSpace(cm)}function setGuttersForLineNumbers(options){var found=indexOf(options.gutters,"CodeMirror-linenumbers");-1==found&&options.lineNumbers?options.gutters=options.gutters.concat(["CodeMirror-linenumbers"]):found>-1&&!options.lineNumbers&&(options.gutters=options.gutters.slice(0),options.gutters.splice(found,1))}function wheelEventDelta(e){var dx=e.wheelDeltaX,dy=e.wheelDeltaY;return null==dx&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(dx=e.detail),null==dy&&e.detail&&e.axis==e.VERTICAL_AXIS?dy=e.detail:null==dy&&(dy=e.wheelDelta),{x:dx,y:dy}}function wheelEventPixels(e){var delta=wheelEventDelta(e);return delta.x*=wheelPixelsPerUnit,delta.y*=wheelPixelsPerUnit,delta}function onScrollWheel(cm,e){var delta=wheelEventDelta(e),dx=delta.x,dy=delta.y,display=cm.display,scroll=display.scroller,canScrollX=scroll.scrollWidth>scroll.clientWidth,canScrollY=scroll.scrollHeight>scroll.clientHeight;if(dx&&canScrollX||dy&&canScrollY){if(dy&&mac&&webkit)outer:for(var cur=e.target,view=display.view;cur!=scroll;cur=cur.parentNode)for(var i=0;i<view.length;i++)if(view[i].node==cur){cm.display.currentWheelTarget=cur;break outer}if(dx&&!gecko&&!presto&&null!=wheelPixelsPerUnit)return dy&&canScrollY&&updateScrollTop(cm,Math.max(0,scroll.scrollTop+dy*wheelPixelsPerUnit)),setScrollLeft(cm,Math.max(0,scroll.scrollLeft+dx*wheelPixelsPerUnit)),(!dy||dy&&canScrollY)&&e_preventDefault(e),void(display.wheelStartX=null);if(dy&&null!=wheelPixelsPerUnit){var pixels=dy*wheelPixelsPerUnit,top=cm.doc.scrollTop,bot=top+display.wrapper.clientHeight;pixels<0?top=Math.max(0,top+pixels-50):bot=Math.min(cm.doc.height,bot+pixels+50),updateDisplaySimple(cm,{top:top,bottom:bot})}wheelSamples<20&&(null==display.wheelStartX?(display.wheelStartX=scroll.scrollLeft,display.wheelStartY=scroll.scrollTop,display.wheelDX=dx,display.wheelDY=dy,setTimeout(function(){if(null!=display.wheelStartX){var movedX=scroll.scrollLeft-display.wheelStartX,movedY=scroll.scrollTop-display.wheelStartY,sample=movedY&&display.wheelDY&&movedY/display.wheelDY||movedX&&display.wheelDX&&movedX/display.wheelDX;display.wheelStartX=display.wheelStartY=null,sample&&(wheelPixelsPerUnit=(wheelPixelsPerUnit*wheelSamples+sample)/(wheelSamples+1),++wheelSamples)}},200)):(display.wheelDX+=dx,display.wheelDY+=dy))}}function normalizeSelection(ranges,primIndex){var prim=ranges[primIndex];ranges.sort(function(a,b){return cmp(a.from(),b.from())}),primIndex=indexOf(ranges,prim);for(var i=1;i<ranges.length;i++){var cur=ranges[i],prev=ranges[i-1];if(cmp(prev.to(),cur.from())>=0){var from=minPos(prev.from(),cur.from()),to=maxPos(prev.to(),cur.to()),inv=prev.empty()?cur.from()==cur.head:prev.from()==prev.head;i<=primIndex&&--primIndex,ranges.splice(--i,2,new Range(inv?to:from,inv?from:to))}}return new Selection(ranges,primIndex)}function simpleSelection(anchor,head){return new Selection([new Range(anchor,head||anchor)],0)}function changeEnd(change){return change.text?Pos(change.from.line+change.text.length-1,lst(change.text).length+(1==change.text.length?change.from.ch:0)):change.to}function adjustForChange(pos,change){if(cmp(pos,change.from)<0)return pos;if(cmp(pos,change.to)<=0)return changeEnd(change);var line=pos.line+change.text.length-(change.to.line-change.from.line)-1,ch=pos.ch;return pos.line==change.to.line&&(ch+=changeEnd(change).ch-change.to.ch),Pos(line,ch)}function computeSelAfterChange(doc,change){for(var out=[],i=0;i<doc.sel.ranges.length;i++){var range=doc.sel.ranges[i];out.push(new Range(adjustForChange(range.anchor,change),adjustForChange(range.head,change)))}return normalizeSelection(out,doc.sel.primIndex)}function offsetPos(pos,old,nw){return pos.line==old.line?Pos(nw.line,pos.ch-old.ch+nw.ch):Pos(nw.line+(pos.line-old.line),pos.ch)}function computeReplacedSel(doc,changes,hint){for(var out=[],oldPrev=Pos(doc.first,0),newPrev=oldPrev,i=0;i<changes.length;i++){var change=changes[i],from=offsetPos(change.from,oldPrev,newPrev),to=offsetPos(changeEnd(change),oldPrev,newPrev);if(oldPrev=change.to,newPrev=to,"around"==hint){var range=doc.sel.ranges[i],inv=cmp(range.head,range.anchor)<0;out[i]=new Range(inv?to:from,inv?from:to)}else out[i]=new Range(from,from)}return new Selection(out,doc.sel.primIndex)}function loadMode(cm){cm.doc.mode=getMode(cm.options,cm.doc.modeOption),resetModeState(cm)}function resetModeState(cm){cm.doc.iter(function(line){line.stateAfter&&(line.stateAfter=null),line.styles&&(line.styles=null)}),cm.doc.modeFrontier=cm.doc.highlightFrontier=cm.doc.first,startWorker(cm,100),cm.state.modeGen++,cm.curOp&®Change(cm)}function isWholeLineUpdate(doc,change){return 0==change.from.ch&&0==change.to.ch&&""==lst(change.text)&&(!doc.cm||doc.cm.options.wholeLineUpdateBefore)}function updateDoc(doc,change,markedSpans,estimateHeight$$1){function spansFor(n){return markedSpans?markedSpans[n]:null}function update(line,text,spans){updateLine(line,text,spans,estimateHeight$$1),signalLater(line,"change",line,change)}function linesFor(start,end){for(var result=[],i=start;i<end;++i)result.push(new Line(text[i],spansFor(i),estimateHeight$$1));return result}var from=change.from,to=change.to,text=change.text,firstLine=getLine(doc,from.line),lastLine=getLine(doc,to.line),lastText=lst(text),lastSpans=spansFor(text.length-1),nlines=to.line-from.line;if(change.full)doc.insert(0,linesFor(0,text.length)),doc.remove(text.length,doc.size-text.length);else if(isWholeLineUpdate(doc,change)){var added=linesFor(0,text.length-1);update(lastLine,lastLine.text,lastSpans),nlines&&doc.remove(from.line,nlines),added.length&&doc.insert(from.line,added)}else if(firstLine==lastLine)if(1==text.length)update(firstLine,firstLine.text.slice(0,from.ch)+lastText+firstLine.text.slice(to.ch),lastSpans);else{var added$1=linesFor(1,text.length-1);added$1.push(new Line(lastText+firstLine.text.slice(to.ch),lastSpans,estimateHeight$$1)),update(firstLine,firstLine.text.slice(0,from.ch)+text[0],spansFor(0)),doc.insert(from.line+1,added$1)}else if(1==text.length)update(firstLine,firstLine.text.slice(0,from.ch)+text[0]+lastLine.text.slice(to.ch),spansFor(0)),doc.remove(from.line+1,nlines);else{update(firstLine,firstLine.text.slice(0,from.ch)+text[0],spansFor(0)),update(lastLine,lastText+lastLine.text.slice(to.ch),lastSpans);var added$2=linesFor(1,text.length-1);nlines>1&&doc.remove(from.line+1,nlines-1),doc.insert(from.line+1,added$2)}signalLater(doc,"change",doc,change)}function linkedDocs(doc,f,sharedHistOnly){function propagate(doc,skip,sharedHist){if(doc.linked)for(var i=0;i<doc.linked.length;++i){var rel=doc.linked[i];if(rel.doc!=skip){var shared=sharedHist&&rel.sharedHist;sharedHistOnly&&!shared||(f(rel.doc,shared),propagate(rel.doc,doc,shared))}}}propagate(doc,null,!0)}function attachDoc(cm,doc){if(doc.cm)throw new Error("This document is already in use.");cm.doc=doc,doc.cm=cm,estimateLineHeights(cm),loadMode(cm),setDirectionClass(cm),cm.options.lineWrapping||findMaxLine(cm),cm.options.mode=doc.modeOption,regChange(cm)}function setDirectionClass(cm){("rtl"==cm.doc.direction?addClass:rmClass)(cm.display.lineDiv,"CodeMirror-rtl")}function directionChanged(cm){runInOp(cm,function(){setDirectionClass(cm),regChange(cm)})}function History(startGen){this.done=[],this.undone=[],this.undoDepth=1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=startGen||1}function historyChangeFromChange(doc,change){var histChange={from:copyPos(change.from),to:changeEnd(change),text:getBetween(doc,change.from,change.to)};return attachLocalSpans(doc,histChange,change.from.line,change.to.line+1),linkedDocs(doc,function(doc){return attachLocalSpans(doc,histChange,change.from.line,change.to.line+1)},!0),histChange}function clearSelectionEvents(array){for(;array.length&&lst(array).ranges;)array.pop()}function lastChangeEvent(hist,force){return force?(clearSelectionEvents(hist.done),lst(hist.done)):hist.done.length&&!lst(hist.done).ranges?lst(hist.done):hist.done.length>1&&!hist.done[hist.done.length-2].ranges?(hist.done.pop(),lst(hist.done)):void 0}function addChangeToHistory(doc,change,selAfter,opId){var hist=doc.history;hist.undone.length=0;var cur,last,time=+new Date;if((hist.lastOp==opId||hist.lastOrigin==change.origin&&change.origin&&("+"==change.origin.charAt(0)&&doc.cm&&hist.lastModTime>time-doc.cm.options.historyEventDelay||"*"==change.origin.charAt(0)))&&(cur=lastChangeEvent(hist,hist.lastOp==opId)))last=lst(cur.changes),0==cmp(change.from,change.to)&&0==cmp(change.from,last.to)?last.to=changeEnd(change):cur.changes.push(historyChangeFromChange(doc,change));else{var before=lst(hist.done);for(before&&before.ranges||pushSelectionToHistory(doc.sel,hist.done),cur={changes:[historyChangeFromChange(doc,change)],generation:hist.generation},hist.done.push(cur);hist.done.length>hist.undoDepth;)hist.done.shift(),hist.done[0].ranges||hist.done.shift()}hist.done.push(selAfter),hist.generation=++hist.maxGeneration,hist.lastModTime=hist.lastSelTime=time,hist.lastOp=hist.lastSelOp=opId,hist.lastOrigin=hist.lastSelOrigin=change.origin,last||signal(doc,"historyAdded")}function selectionEventCanBeMerged(doc,origin,prev,sel){var ch=origin.charAt(0);return"*"==ch||"+"==ch&&prev.ranges.length==sel.ranges.length&&prev.somethingSelected()==sel.somethingSelected()&&new Date-doc.history.lastSelTime<=(doc.cm?doc.cm.options.historyEventDelay:500)}function addSelectionToHistory(doc,sel,opId,options){var hist=doc.history,origin=options&&options.origin;opId==hist.lastSelOp||origin&&hist.lastSelOrigin==origin&&(hist.lastModTime==hist.lastSelTime&&hist.lastOrigin==origin||selectionEventCanBeMerged(doc,origin,lst(hist.done),sel))?hist.done[hist.done.length-1]=sel:pushSelectionToHistory(sel,hist.done),hist.lastSelTime=+new Date,hist.lastSelOrigin=origin,hist.lastSelOp=opId,options&&!1!==options.clearRedo&&clearSelectionEvents(hist.undone)}function pushSelectionToHistory(sel,dest){var top=lst(dest);top&&top.ranges&&top.equals(sel)||dest.push(sel)}function attachLocalSpans(doc,change,from,to){var existing=change["spans_"+doc.id],n=0;doc.iter(Math.max(doc.first,from),Math.min(doc.first+doc.size,to),function(line){line.markedSpans&&((existing||(existing=change["spans_"+doc.id]={}))[n]=line.markedSpans),++n})}function removeClearedSpans(spans){if(!spans)return null;for(var out,i=0;i<spans.length;++i)spans[i].marker.explicitlyCleared?out||(out=spans.slice(0,i)):out&&out.push(spans[i]);return out?out.length?out:null:spans}function getOldSpans(doc,change){var found=change["spans_"+doc.id];if(!found)return null;for(var nw=[],i=0;i<change.text.length;++i)nw.push(removeClearedSpans(found[i]));return nw}function mergeOldSpans(doc,change){var old=getOldSpans(doc,change),stretched=stretchSpansOverChange(doc,change);if(!old)return stretched;if(!stretched)return old;for(var i=0;i<old.length;++i){var oldCur=old[i],stretchCur=stretched[i];if(oldCur&&stretchCur)spans:for(var j=0;j<stretchCur.length;++j){for(var span=stretchCur[j],k=0;k<oldCur.length;++k)if(oldCur[k].marker==span.marker)continue spans;oldCur.push(span)}else stretchCur&&(old[i]=stretchCur)}return old}function copyHistoryArray(events,newGroup,instantiateSel){for(var copy=[],i=0;i<events.length;++i){var event=events[i];if(event.ranges)copy.push(instantiateSel?Selection.prototype.deepCopy.call(event):event);else{var changes=event.changes,newChanges=[];copy.push({changes:newChanges});for(var j=0;j<changes.length;++j){var change=changes[j],m=void 0;if(newChanges.push({from:change.from,to:change.to,text:change.text}),newGroup)for(var prop in change)(m=prop.match(/^spans_(\d+)$/))&&indexOf(newGroup,Number(m[1]))>-1&&(lst(newChanges)[prop]=change[prop],delete change[prop])}}}return copy}function extendRange(range,head,other,extend){if(extend){var anchor=range.anchor;if(other){var posBefore=cmp(head,anchor)<0;posBefore!=cmp(other,anchor)<0?(anchor=head,head=other):posBefore!=cmp(head,other)<0&&(head=other)}return new Range(anchor,head)}return new Range(other||head,head)}function extendSelection(doc,head,other,options,extend){null==extend&&(extend=doc.cm&&(doc.cm.display.shift||doc.extend)),setSelection(doc,new Selection([extendRange(doc.sel.primary(),head,other,extend)],0),options)}function extendSelections(doc,heads,options){for(var out=[],extend=doc.cm&&(doc.cm.display.shift||doc.extend),i=0;i<doc.sel.ranges.length;i++)out[i]=extendRange(doc.sel.ranges[i],heads[i],null,extend);setSelection(doc,normalizeSelection(out,doc.sel.primIndex),options)}function replaceOneSelection(doc,i,range,options){var ranges=doc.sel.ranges.slice(0);ranges[i]=range,setSelection(doc,normalizeSelection(ranges,doc.sel.primIndex),options)}function setSimpleSelection(doc,anchor,head,options){setSelection(doc,simpleSelection(anchor,head),options)}function filterSelectionChange(doc,sel,options){var obj={ranges:sel.ranges,update:function(ranges){var this$1=this;this.ranges=[];for(var i=0;i<ranges.length;i++)this$1.ranges[i]=new Range(clipPos(doc,ranges[i].anchor),clipPos(doc,ranges[i].head))},origin:options&&options.origin};return signal(doc,"beforeSelectionChange",doc,obj),doc.cm&&signal(doc.cm,"beforeSelectionChange",doc.cm,obj),obj.ranges!=sel.ranges?normalizeSelection(obj.ranges,obj.ranges.length-1):sel}function setSelectionReplaceHistory(doc,sel,options){var done=doc.history.done,last=lst(done);last&&last.ranges?(done[done.length-1]=sel,setSelectionNoUndo(doc,sel,options)):setSelection(doc,sel,options)}function setSelection(doc,sel,options){setSelectionNoUndo(doc,sel,options),addSelectionToHistory(doc,doc.sel,doc.cm?doc.cm.curOp.id:NaN,options)}function setSelectionNoUndo(doc,sel,options){(hasHandler(doc,"beforeSelectionChange")||doc.cm&&hasHandler(doc.cm,"beforeSelectionChange"))&&(sel=filterSelectionChange(doc,sel,options)),setSelectionInner(doc,skipAtomicInSelection(doc,sel,options&&options.bias||(cmp(sel.primary().head,doc.sel.primary().head)<0?-1:1),!0)),options&&!1===options.scroll||!doc.cm||ensureCursorVisible(doc.cm)}function setSelectionInner(doc,sel){sel.equals(doc.sel)||(doc.sel=sel,doc.cm&&(doc.cm.curOp.updateInput=doc.cm.curOp.selectionChanged=!0,signalCursorActivity(doc.cm)),signalLater(doc,"cursorActivity",doc))}function reCheckSelection(doc){setSelectionInner(doc,skipAtomicInSelection(doc,doc.sel,null,!1))}function skipAtomicInSelection(doc,sel,bias,mayClear){for(var out,i=0;i<sel.ranges.length;i++){var range=sel.ranges[i],old=sel.ranges.length==doc.sel.ranges.length&&doc.sel.ranges[i],newAnchor=skipAtomic(doc,range.anchor,old&&old.anchor,bias,mayClear),newHead=skipAtomic(doc,range.head,old&&old.head,bias,mayClear);(out||newAnchor!=range.anchor||newHead!=range.head)&&(out||(out=sel.ranges.slice(0,i)),out[i]=new Range(newAnchor,newHead))}return out?normalizeSelection(out,sel.primIndex):sel}function skipAtomicInner(doc,pos,oldPos,dir,mayClear){var line=getLine(doc,pos.line);if(line.markedSpans)for(var i=0;i<line.markedSpans.length;++i){var sp=line.markedSpans[i],m=sp.marker;if((null==sp.from||(m.inclusiveLeft?sp.from<=pos.ch:sp.from<pos.ch))&&(null==sp.to||(m.inclusiveRight?sp.to>=pos.ch:sp.to>pos.ch))){if(mayClear&&(signal(m,"beforeCursorEnter"),m.explicitlyCleared)){if(line.markedSpans){--i;continue}break}if(!m.atomic)continue;if(oldPos){var near=m.find(dir<0?1:-1),diff=void 0;if((dir<0?m.inclusiveRight:m.inclusiveLeft)&&(near=movePos(doc,near,-dir,near&&near.line==pos.line?line:null)),near&&near.line==pos.line&&(diff=cmp(near,oldPos))&&(dir<0?diff<0:diff>0))return skipAtomicInner(doc,near,pos,dir,mayClear)}var far=m.find(dir<0?-1:1);return(dir<0?m.inclusiveLeft:m.inclusiveRight)&&(far=movePos(doc,far,dir,far.line==pos.line?line:null)),far?skipAtomicInner(doc,far,pos,dir,mayClear):null}}return pos}function skipAtomic(doc,pos,oldPos,bias,mayClear){var dir=bias||1,found=skipAtomicInner(doc,pos,oldPos,dir,mayClear)||!mayClear&&skipAtomicInner(doc,pos,oldPos,dir,!0)||skipAtomicInner(doc,pos,oldPos,-dir,mayClear)||!mayClear&&skipAtomicInner(doc,pos,oldPos,-dir,!0);return found||(doc.cantEdit=!0,Pos(doc.first,0))}function movePos(doc,pos,dir,line){return dir<0&&0==pos.ch?pos.line>doc.first?clipPos(doc,Pos(pos.line-1)):null:dir>0&&pos.ch==(line||getLine(doc,pos.line)).text.length?pos.line<doc.first+doc.size-1?Pos(pos.line+1,0):null:new Pos(pos.line,pos.ch+dir)}function selectAll(cm){cm.setSelection(Pos(cm.firstLine(),0),Pos(cm.lastLine()),sel_dontScroll)}function filterChange(doc,change,update){var obj={canceled:!1,from:change.from,to:change.to,text:change.text,origin:change.origin,cancel:function(){return obj.canceled=!0}};return update&&(obj.update=function(from,to,text,origin){from&&(obj.from=clipPos(doc,from)),to&&(obj.to=clipPos(doc,to)),text&&(obj.text=text),void 0!==origin&&(obj.origin=origin)}),signal(doc,"beforeChange",doc,obj),doc.cm&&signal(doc.cm,"beforeChange",doc.cm,obj),obj.canceled?null:{from:obj.from,to:obj.to,text:obj.text,origin:obj.origin}}function makeChange(doc,change,ignoreReadOnly){if(doc.cm){if(!doc.cm.curOp)return operation(doc.cm,makeChange)(doc,change,ignoreReadOnly);if(doc.cm.state.suppressEdits)return}if(!(hasHandler(doc,"beforeChange")||doc.cm&&hasHandler(doc.cm,"beforeChange"))||(change=filterChange(doc,change,!0))){var split=sawReadOnlySpans&&!ignoreReadOnly&&removeReadOnlyRanges(doc,change.from,change.to);if(split)for(var i=split.length-1;i>=0;--i)makeChangeInner(doc,{from:split[i].from,to:split[i].to,text:i?[""]:change.text});else makeChangeInner(doc,change)}}function makeChangeInner(doc,change){if(1!=change.text.length||""!=change.text[0]||0!=cmp(change.from,change.to)){var selAfter=computeSelAfterChange(doc,change);addChangeToHistory(doc,change,selAfter,doc.cm?doc.cm.curOp.id:NaN),makeChangeSingleDoc(doc,change,selAfter,stretchSpansOverChange(doc,change));var rebased=[];linkedDocs(doc,function(doc,sharedHist){sharedHist||-1!=indexOf(rebased,doc.history)||(rebaseHist(doc.history,change),rebased.push(doc.history)),makeChangeSingleDoc(doc,change,null,stretchSpansOverChange(doc,change))})}}function makeChangeFromHistory(doc,type,allowSelectionOnly){if(!doc.cm||!doc.cm.state.suppressEdits||allowSelectionOnly){for(var event,hist=doc.history,selAfter=doc.sel,source="undo"==type?hist.done:hist.undone,dest="undo"==type?hist.undone:hist.done,i=0;i<source.length&&(event=source[i],allowSelectionOnly?!event.ranges||event.equals(doc.sel):event.ranges);i++);if(i!=source.length){for(hist.lastOrigin=hist.lastSelOrigin=null;(event=source.pop()).ranges;){if(pushSelectionToHistory(event,dest),allowSelectionOnly&&!event.equals(doc.sel))return void setSelection(doc,event,{clearRedo:!1});selAfter=event}var antiChanges=[];pushSelectionToHistory(selAfter,dest),dest.push({changes:antiChanges,generation:hist.generation}),hist.generation=event.generation||++hist.maxGeneration;for(var filter=hasHandler(doc,"beforeChange")||doc.cm&&hasHandler(doc.cm,"beforeChange"),i$1=event.changes.length-1;i$1>=0;--i$1){var returned=function(i){var change=event.changes[i];if(change.origin=type,filter&&!filterChange(doc,change,!1))return source.length=0,{};antiChanges.push(historyChangeFromChange(doc,change));var after=i?computeSelAfterChange(doc,change):lst(source);makeChangeSingleDoc(doc,change,after,mergeOldSpans(doc,change)),!i&&doc.cm&&doc.cm.scrollIntoView({from:change.from,to:changeEnd(change)});var rebased=[];linkedDocs(doc,function(doc,sharedHist){sharedHist||-1!=indexOf(rebased,doc.history)||(rebaseHist(doc.history,change),rebased.push(doc.history)),makeChangeSingleDoc(doc,change,null,mergeOldSpans(doc,change))})}(i$1);if(returned)return returned.v}}}}function shiftDoc(doc,distance){if(0!=distance&&(doc.first+=distance,doc.sel=new Selection(map(doc.sel.ranges,function(range){return new Range(Pos(range.anchor.line+distance,range.anchor.ch),Pos(range.head.line+distance,range.head.ch))}),doc.sel.primIndex),doc.cm)){regChange(doc.cm,doc.first,doc.first-distance,distance);for(var d=doc.cm.display,l=d.viewFrom;l<d.viewTo;l++)regLineChange(doc.cm,l,"gutter")}}function makeChangeSingleDoc(doc,change,selAfter,spans){if(doc.cm&&!doc.cm.curOp)return operation(doc.cm,makeChangeSingleDoc)(doc,change,selAfter,spans);if(change.to.line<doc.first)shiftDoc(doc,change.text.length-1-(change.to.line-change.from.line));else if(!(change.from.line>doc.lastLine())){if(change.from.line<doc.first){var shift=change.text.length-1-(doc.first-change.from.line);shiftDoc(doc,shift),change={from:Pos(doc.first,0),to:Pos(change.to.line+shift,change.to.ch),text:[lst(change.text)],origin:change.origin}}var last=doc.lastLine();change.to.line>last&&(change={from:change.from,to:Pos(last,getLine(doc,last).text.length),text:[change.text[0]],origin:change.origin}),change.removed=getBetween(doc,change.from,change.to),selAfter||(selAfter=computeSelAfterChange(doc,change)),doc.cm?makeChangeSingleDocInEditor(doc.cm,change,spans):updateDoc(doc,change,spans),setSelectionNoUndo(doc,selAfter,sel_dontScroll)}}function makeChangeSingleDocInEditor(cm,change,spans){var doc=cm.doc,display=cm.display,from=change.from,to=change.to,recomputeMaxLength=!1,checkWidthStart=from.line;cm.options.lineWrapping||(checkWidthStart=lineNo(visualLine(getLine(doc,from.line))),doc.iter(checkWidthStart,to.line+1,function(line){if(line==display.maxLine)return recomputeMaxLength=!0,!0})),doc.sel.contains(change.from,change.to)>-1&&signalCursorActivity(cm),updateDoc(doc,change,spans,estimateHeight(cm)),cm.options.lineWrapping||(doc.iter(checkWidthStart,from.line+change.text.length,function(line){var len=lineLength(line);len>display.maxLineLength&&(display.maxLine=line,display.maxLineLength=len,display.maxLineChanged=!0,recomputeMaxLength=!1)}),recomputeMaxLength&&(cm.curOp.updateMaxLine=!0)),retreatFrontier(doc,from.line),startWorker(cm,400);var lendiff=change.text.length-(to.line-from.line)-1;change.full?regChange(cm):from.line!=to.line||1!=change.text.length||isWholeLineUpdate(cm.doc,change)?regChange(cm,from.line,to.line+1,lendiff):regLineChange(cm,from.line,"text");var changesHandler=hasHandler(cm,"changes"),changeHandler=hasHandler(cm,"change");if(changeHandler||changesHandler){var obj={from:from,to:to,text:change.text,removed:change.removed,origin:change.origin};changeHandler&&signalLater(cm,"change",cm,obj),changesHandler&&(cm.curOp.changeObjs||(cm.curOp.changeObjs=[])).push(obj)}cm.display.selForContextMenu=null}function replaceRange(doc,code,from,to,origin){if(to||(to=from),cmp(to,from)<0){var tmp=to;to=from,from=tmp}"string"==typeof code&&(code=doc.splitLines(code)),makeChange(doc,{from:from,to:to,text:code,origin:origin})}function rebaseHistSelSingle(pos,from,to,diff){to<pos.line?pos.line+=diff:from<pos.line&&(pos.line=from,pos.ch=0)}function rebaseHistArray(array,from,to,diff){for(var i=0;i<array.length;++i){var sub=array[i],ok=!0;if(sub.ranges){sub.copied||((sub=array[i]=sub.deepCopy()).copied=!0);for(var j=0;j<sub.ranges.length;j++)rebaseHistSelSingle(sub.ranges[j].anchor,from,to,diff),rebaseHistSelSingle(sub.ranges[j].head,from,to,diff)}else{for(var j$1=0;j$1<sub.changes.length;++j$1){var cur=sub.changes[j$1];if(to<cur.from.line)cur.from=Pos(cur.from.line+diff,cur.from.ch),cur.to=Pos(cur.to.line+diff,cur.to.ch);else if(from<=cur.to.line){ok=!1;break}}ok||(array.splice(0,i+1),i=0)}}}function rebaseHist(hist,change){var from=change.from.line,to=change.to.line,diff=change.text.length-(to-from)-1;rebaseHistArray(hist.done,from,to,diff),rebaseHistArray(hist.undone,from,to,diff)}function changeLine(doc,handle,changeType,op){var no=handle,line=handle;return"number"==typeof handle?line=getLine(doc,clipLine(doc,handle)):no=lineNo(handle),null==no?null:(op(line,no)&&doc.cm&®LineChange(doc.cm,no,changeType),line)}function LeafChunk(lines){var this$1=this;this.lines=lines,this.parent=null;for(var height=0,i=0;i<lines.length;++i)lines[i].parent=this$1,height+=lines[i].height;this.height=height}function BranchChunk(children){var this$1=this;this.children=children;for(var size=0,height=0,i=0;i<children.length;++i){var ch=children[i];size+=ch.chunkSize(),height+=ch.height,ch.parent=this$1}this.size=size,this.height=height,this.parent=null}function adjustScrollWhenAboveVisible(cm,line,diff){heightAtLine(line)<(cm.curOp&&cm.curOp.scrollTop||cm.doc.scrollTop)&&addToScrollTop(cm,diff)}function addLineWidget(doc,handle,node,options){var widget=new LineWidget(doc,node,options),cm=doc.cm;return cm&&widget.noHScroll&&(cm.display.alignWidgets=!0),changeLine(doc,handle,"widget",function(line){var widgets=line.widgets||(line.widgets=[]);if(null==widget.insertAt?widgets.push(widget):widgets.splice(Math.min(widgets.length-1,Math.max(0,widget.insertAt)),0,widget),widget.line=line,cm&&!lineIsHidden(doc,line)){var aboveVisible=heightAtLine(line)<doc.scrollTop;updateLineHeight(line,line.height+widgetHeight(widget)),aboveVisible&&addToScrollTop(cm,widget.height),cm.curOp.forceUpdate=!0}return!0}),signalLater(cm,"lineWidgetAdded",cm,widget,"number"==typeof handle?handle:lineNo(handle)),widget}function markText(doc,from,to,options,type){if(options&&options.shared)return markTextShared(doc,from,to,options,type);if(doc.cm&&!doc.cm.curOp)return operation(doc.cm,markText)(doc,from,to,options,type);var marker=new TextMarker(doc,type),diff=cmp(from,to);if(options&©Obj(options,marker,!1),diff>0||0==diff&&!1!==marker.clearWhenEmpty)return marker;if(marker.replacedWith&&(marker.collapsed=!0,marker.widgetNode=eltP("span",[marker.replacedWith],"CodeMirror-widget"),options.handleMouseEvents||marker.widgetNode.setAttribute("cm-ignore-events","true"),options.insertLeft&&(marker.widgetNode.insertLeft=!0)),marker.collapsed){if(conflictingCollapsedRange(doc,from.line,from,to,marker)||from.line!=to.line&&conflictingCollapsedRange(doc,to.line,from,to,marker))throw new Error("Inserting collapsed marker partially overlapping an existing one");seeCollapsedSpans()}marker.addToHistory&&addChangeToHistory(doc,{from:from,to:to,origin:"markText"},doc.sel,NaN);var updateMaxLine,curLine=from.line,cm=doc.cm;if(doc.iter(curLine,to.line+1,function(line){cm&&marker.collapsed&&!cm.options.lineWrapping&&visualLine(line)==cm.display.maxLine&&(updateMaxLine=!0),marker.collapsed&&curLine!=from.line&&updateLineHeight(line,0),addMarkedSpan(line,new MarkedSpan(marker,curLine==from.line?from.ch:null,curLine==to.line?to.ch:null)),++curLine}),marker.collapsed&&doc.iter(from.line,to.line+1,function(line){lineIsHidden(doc,line)&&updateLineHeight(line,0)}),marker.clearOnEnter&&on(marker,"beforeCursorEnter",function(){return marker.clear()}),marker.readOnly&&(seeReadOnlySpans(),(doc.history.done.length||doc.history.undone.length)&&doc.clearHistory()),marker.collapsed&&(marker.id=++nextMarkerId,marker.atomic=!0),cm){if(updateMaxLine&&(cm.curOp.updateMaxLine=!0),marker.collapsed)regChange(cm,from.line,to.line+1);else if(marker.className||marker.title||marker.startStyle||marker.endStyle||marker.css)for(var i=from.line;i<=to.line;i++)regLineChange(cm,i,"text");marker.atomic&&reCheckSelection(cm.doc),signalLater(cm,"markerAdded",cm,marker)}return marker}function markTextShared(doc,from,to,options,type){(options=copyObj(options)).shared=!1;var markers=[markText(doc,from,to,options,type)],primary=markers[0],widget=options.widgetNode;return linkedDocs(doc,function(doc){widget&&(options.widgetNode=widget.cloneNode(!0)),markers.push(markText(doc,clipPos(doc,from),clipPos(doc,to),options,type));for(var i=0;i<doc.linked.length;++i)if(doc.linked[i].isParent)return;primary=lst(markers)}),new SharedTextMarker(markers,primary)}function findSharedMarkers(doc){return doc.findMarks(Pos(doc.first,0),doc.clipPos(Pos(doc.lastLine())),function(m){return m.parent})}function copySharedMarkers(doc,markers){for(var i=0;i<markers.length;i++){var marker=markers[i],pos=marker.find(),mFrom=doc.clipPos(pos.from),mTo=doc.clipPos(pos.to);if(cmp(mFrom,mTo)){var subMark=markText(doc,mFrom,mTo,marker.primary,marker.primary.type);marker.markers.push(subMark),subMark.parent=marker}}}function detachSharedMarkers(markers){for(var i=0;i<markers.length;i++)!function(i){var marker=markers[i],linked=[marker.primary.doc];linkedDocs(marker.primary.doc,function(d){return linked.push(d)});for(var j=0;j<marker.markers.length;j++){var subMarker=marker.markers[j];-1==indexOf(linked,subMarker.doc)&&(subMarker.parent=null,marker.markers.splice(j--,1))}}(i)}function onDrop(e){var cm=this;if(clearDragCursor(cm),!signalDOMEvent(cm,e)&&!eventInWidget(cm.display,e)){e_preventDefault(e),ie&&(lastDrop=+new Date);var pos=posFromMouse(cm,e,!0),files=e.dataTransfer.files;if(pos&&!cm.isReadOnly())if(files&&files.length&&window.FileReader&&window.File)for(var n=files.length,text=Array(n),read=0,i=0;i<n;++i)!function(file,i){if(!cm.options.allowDropFileTypes||-1!=indexOf(cm.options.allowDropFileTypes,file.type)){var reader=new FileReader;reader.onload=operation(cm,function(){var content=reader.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(content)&&(content=""),text[i]=content,++read==n){var change={from:pos=clipPos(cm.doc,pos),to:pos,text:cm.doc.splitLines(text.join(cm.doc.lineSeparator())),origin:"paste"};makeChange(cm.doc,change),setSelectionReplaceHistory(cm.doc,simpleSelection(pos,changeEnd(change)))}}),reader.readAsText(file)}}(files[i],i);else{if(cm.state.draggingText&&cm.doc.sel.contains(pos)>-1)return cm.state.draggingText(e),void setTimeout(function(){return cm.display.input.focus()},20);try{var text$1=e.dataTransfer.getData("Text");if(text$1){var selected;if(cm.state.draggingText&&!cm.state.draggingText.copy&&(selected=cm.listSelections()),setSelectionNoUndo(cm.doc,simpleSelection(pos,pos)),selected)for(var i$1=0;i$1<selected.length;++i$1)replaceRange(cm.doc,"",selected[i$1].anchor,selected[i$1].head,"drag");cm.replaceSelection(text$1,"around","paste"),cm.display.input.focus()}}catch(e){}}}}function onDragStart(cm,e){if(ie&&(!cm.state.draggingText||+new Date-lastDrop<100))e_stop(e);else if(!signalDOMEvent(cm,e)&&!eventInWidget(cm.display,e)&&(e.dataTransfer.setData("Text",cm.getSelection()),e.dataTransfer.effectAllowed="copyMove",e.dataTransfer.setDragImage&&!safari)){var img=elt("img",null,null,"position: fixed; left: 0; top: 0;");img.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",presto&&(img.width=img.height=1,cm.display.wrapper.appendChild(img),img._top=img.offsetTop),e.dataTransfer.setDragImage(img,0,0),presto&&img.parentNode.removeChild(img)}}function onDragOver(cm,e){var pos=posFromMouse(cm,e);if(pos){var frag=document.createDocumentFragment();drawSelectionCursor(cm,pos,frag),cm.display.dragCursor||(cm.display.dragCursor=elt("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),cm.display.lineSpace.insertBefore(cm.display.dragCursor,cm.display.cursorDiv)),removeChildrenAndAdd(cm.display.dragCursor,frag)}}function clearDragCursor(cm){cm.display.dragCursor&&(cm.display.lineSpace.removeChild(cm.display.dragCursor),cm.display.dragCursor=null)}function forEachCodeMirror(f){if(document.getElementsByClassName)for(var byClass=document.getElementsByClassName("CodeMirror"),i=0;i<byClass.length;i++){var cm=byClass[i].CodeMirror;cm&&f(cm)}}function ensureGlobalHandlers(){globalsRegistered||(registerGlobalHandlers(),globalsRegistered=!0)}function registerGlobalHandlers(){var resizeTimer;on(window,"resize",function(){null==resizeTimer&&(resizeTimer=setTimeout(function(){resizeTimer=null,forEachCodeMirror(onResize)},100))}),on(window,"blur",function(){return forEachCodeMirror(onBlur)})}function onResize(cm){var d=cm.display;d.lastWrapHeight==d.wrapper.clientHeight&&d.lastWrapWidth==d.wrapper.clientWidth||(d.cachedCharWidth=d.cachedTextHeight=d.cachedPaddingH=null,d.scrollbarsClipped=!1,cm.setSize())}function normalizeKeyName(name){var parts=name.split(/-(?!$)/);name=parts[parts.length-1];for(var alt,ctrl,shift,cmd,i=0;i<parts.length-1;i++){var mod=parts[i];if(/^(cmd|meta|m)$/i.test(mod))cmd=!0;else if(/^a(lt)?$/i.test(mod))alt=!0;else if(/^(c|ctrl|control)$/i.test(mod))ctrl=!0;else{if(!/^s(hift)?$/i.test(mod))throw new Error("Unrecognized modifier name: "+mod);shift=!0}}return alt&&(name="Alt-"+name),ctrl&&(name="Ctrl-"+name),cmd&&(name="Cmd-"+name),shift&&(name="Shift-"+name),name}function normalizeKeyMap(keymap){var copy={};for(var keyname in keymap)if(keymap.hasOwnProperty(keyname)){var value=keymap[keyname];if(/^(name|fallthrough|(de|at)tach)$/.test(keyname))continue;if("..."==value){delete keymap[keyname];continue}for(var keys=map(keyname.split(" "),normalizeKeyName),i=0;i<keys.length;i++){var val=void 0,name=void 0;i==keys.length-1?(name=keys.join(" "),val=value):(name=keys.slice(0,i+1).join(" "),val="...");var prev=copy[name];if(prev){if(prev!=val)throw new Error("Inconsistent bindings for "+name)}else copy[name]=val}delete keymap[keyname]}for(var prop in copy)keymap[prop]=copy[prop];return keymap}function lookupKey(key,map$$1,handle,context){var found=(map$$1=getKeyMap(map$$1)).call?map$$1.call(key,context):map$$1[key];if(!1===found)return"nothing";if("..."===found)return"multi";if(null!=found&&handle(found))return"handled";if(map$$1.fallthrough){if("[object Array]"!=Object.prototype.toString.call(map$$1.fallthrough))return lookupKey(key,map$$1.fallthrough,handle,context);for(var i=0;i<map$$1.fallthrough.length;i++){var result=lookupKey(key,map$$1.fallthrough[i],handle,context);if(result)return result}}}function isModifierKey(value){var name="string"==typeof value?value:keyNames[value.keyCode];return"Ctrl"==name||"Alt"==name||"Shift"==name||"Mod"==name}function addModifierNames(name,event,noShift){var base=name;return event.altKey&&"Alt"!=base&&(name="Alt-"+name),(flipCtrlCmd?event.metaKey:event.ctrlKey)&&"Ctrl"!=base&&(name="Ctrl-"+name),(flipCtrlCmd?event.ctrlKey:event.metaKey)&&"Cmd"!=base&&(name="Cmd-"+name),!noShift&&event.shiftKey&&"Shift"!=base&&(name="Shift-"+name),name}function keyName(event,noShift){if(presto&&34==event.keyCode&&event.char)return!1;var name=keyNames[event.keyCode];return null!=name&&!event.altGraphKey&&addModifierNames(name,event,noShift)}function getKeyMap(val){return"string"==typeof val?keyMap[val]:val}function deleteNearSelection(cm,compute){for(var ranges=cm.doc.sel.ranges,kill=[],i=0;i<ranges.length;i++){for(var toKill=compute(ranges[i]);kill.length&&cmp(toKill.from,lst(kill).to)<=0;){var replaced=kill.pop();if(cmp(replaced.from,toKill.from)<0){toKill.from=replaced.from;break}}kill.push(toKill)}runInOp(cm,function(){for(var i=kill.length-1;i>=0;i--)replaceRange(cm.doc,"",kill[i].from,kill[i].to,"+delete");ensureCursorVisible(cm)})}function lineStart(cm,lineN){var line=getLine(cm.doc,lineN),visual=visualLine(line);return visual!=line&&(lineN=lineNo(visual)),endOfLine(!0,cm,visual,lineN,1)}function lineEnd(cm,lineN){var line=getLine(cm.doc,lineN),visual=visualLineEnd(line);return visual!=line&&(lineN=lineNo(visual)),endOfLine(!0,cm,line,lineN,-1)}function lineStartSmart(cm,pos){var start=lineStart(cm,pos.line),line=getLine(cm.doc,start.line),order=getOrder(line,cm.doc.direction);if(!order||0==order[0].level){var firstNonWS=Math.max(0,line.text.search(/\S/)),inWS=pos.line==start.line&&pos.ch<=firstNonWS&&pos.ch;return Pos(start.line,inWS?0:firstNonWS,start.sticky)}return start}function doHandleBinding(cm,bound,dropShift){if("string"==typeof bound&&!(bound=commands[bound]))return!1;cm.display.input.ensurePolled();var prevShift=cm.display.shift,done=!1;try{cm.isReadOnly()&&(cm.state.suppressEdits=!0),dropShift&&(cm.display.shift=!1),done=bound(cm)!=Pass}finally{cm.display.shift=prevShift,cm.state.suppressEdits=!1}return done}function lookupKeyForEditor(cm,name,handle){for(var i=0;i<cm.state.keyMaps.length;i++){var result=lookupKey(name,cm.state.keyMaps[i],handle,cm);if(result)return result}return cm.options.extraKeys&&lookupKey(name,cm.options.extraKeys,handle,cm)||lookupKey(name,cm.options.keyMap,handle,cm)}function dispatchKey(cm,name,e,handle){var seq=cm.state.keySeq;if(seq){if(isModifierKey(name))return"handled";stopSeq.set(50,function(){cm.state.keySeq==seq&&(cm.state.keySeq=null,cm.display.input.reset())}),name=seq+" "+name}var result=lookupKeyForEditor(cm,name,handle);return"multi"==result&&(cm.state.keySeq=name),"handled"==result&&signalLater(cm,"keyHandled",cm,name,e),"handled"!=result&&"multi"!=result||(e_preventDefault(e),restartBlink(cm)),seq&&!result&&/\'$/.test(name)?(e_preventDefault(e),!0):!!result}function handleKeyBinding(cm,e){var name=keyName(e,!0);return!!name&&(e.shiftKey&&!cm.state.keySeq?dispatchKey(cm,"Shift-"+name,e,function(b){return doHandleBinding(cm,b,!0)})||dispatchKey(cm,name,e,function(b){if("string"==typeof b?/^go[A-Z]/.test(b):b.motion)return doHandleBinding(cm,b)}):dispatchKey(cm,name,e,function(b){return doHandleBinding(cm,b)}))}function handleCharBinding(cm,e,ch){return dispatchKey(cm,"'"+ch+"'",e,function(b){return doHandleBinding(cm,b,!0)})}function onKeyDown(e){var cm=this;if(cm.curOp.focus=activeElt(),!signalDOMEvent(cm,e)){ie&&ie_version<11&&27==e.keyCode&&(e.returnValue=!1);var code=e.keyCode;cm.display.shift=16==code||e.shiftKey;var handled=handleKeyBinding(cm,e);presto&&(lastStoppedKey=handled?code:null,!handled&&88==code&&!hasCopyEvent&&(mac?e.metaKey:e.ctrlKey)&&cm.replaceSelection("",null,"cut")),18!=code||/\bCodeMirror-crosshair\b/.test(cm.display.lineDiv.className)||showCrossHair(cm)}}function showCrossHair(cm){function up(e){18!=e.keyCode&&e.altKey||(rmClass(lineDiv,"CodeMirror-crosshair"),off(document,"keyup",up),off(document,"mouseover",up))}var lineDiv=cm.display.lineDiv;addClass(lineDiv,"CodeMirror-crosshair"),on(document,"keyup",up),on(document,"mouseover",up)}function onKeyUp(e){16==e.keyCode&&(this.doc.sel.shift=!1),signalDOMEvent(this,e)}function onKeyPress(e){var cm=this;if(!(eventInWidget(cm.display,e)||signalDOMEvent(cm,e)||e.ctrlKey&&!e.altKey||mac&&e.metaKey)){var keyCode=e.keyCode,charCode=e.charCode;if(presto&&keyCode==lastStoppedKey)return lastStoppedKey=null,void e_preventDefault(e);if(!presto||e.which&&!(e.which<10)||!handleKeyBinding(cm,e)){var ch=String.fromCharCode(null==charCode?keyCode:charCode);"\b"!=ch&&(handleCharBinding(cm,e,ch)||cm.display.input.onKeyPress(e))}}}function clickRepeat(pos,button){var now=+new Date;return lastDoubleClick&&lastDoubleClick.compare(now,pos,button)?(lastClick=lastDoubleClick=null,"triple"):lastClick&&lastClick.compare(now,pos,button)?(lastDoubleClick=new PastClick(now,pos,button),lastClick=null,"double"):(lastClick=new PastClick(now,pos,button),lastDoubleClick=null,"single")}function onMouseDown(e){var cm=this,display=cm.display;if(!(signalDOMEvent(cm,e)||display.activeTouch&&display.input.supportsTouch()))if(display.input.ensurePolled(),display.shift=e.shiftKey,eventInWidget(display,e))webkit||(display.scroller.draggable=!1,setTimeout(function(){return display.scroller.draggable=!0},100));else if(!clickInGutter(cm,e)){var pos=posFromMouse(cm,e),button=e_button(e),repeat=pos?clickRepeat(pos,button):"single";window.focus(),1==button&&cm.state.selectingText&&cm.state.selectingText(e),pos&&handleMappedButton(cm,button,pos,repeat,e)||(1==button?pos?leftButtonDown(cm,pos,repeat,e):e_target(e)==display.scroller&&e_preventDefault(e):2==button?(pos&&extendSelection(cm.doc,pos),setTimeout(function(){return display.input.focus()},20)):3==button&&(captureRightClick?onContextMenu(cm,e):delayBlurEvent(cm)))}}function handleMappedButton(cm,button,pos,repeat,event){var name="Click";return"double"==repeat?name="Double"+name:"triple"==repeat&&(name="Triple"+name),name=(1==button?"Left":2==button?"Middle":"Right")+name,dispatchKey(cm,addModifierNames(name,event),event,function(bound){if("string"==typeof bound&&(bound=commands[bound]),!bound)return!1;var done=!1;try{cm.isReadOnly()&&(cm.state.suppressEdits=!0),done=bound(cm,pos)!=Pass}finally{cm.state.suppressEdits=!1}return done})}function configureMouse(cm,repeat,event){var option=cm.getOption("configureMouse"),value=option?option(cm,repeat,event):{};if(null==value.unit){var rect=chromeOS?event.shiftKey&&event.metaKey:event.altKey;value.unit=rect?"rectangle":"single"==repeat?"char":"double"==repeat?"word":"line"}return(null==value.extend||cm.doc.extend)&&(value.extend=cm.doc.extend||event.shiftKey),null==value.addNew&&(value.addNew=mac?event.metaKey:event.ctrlKey),null==value.moveOnDrag&&(value.moveOnDrag=!(mac?event.altKey:event.ctrlKey)),value}function leftButtonDown(cm,pos,repeat,event){ie?setTimeout(bind(ensureFocus,cm),0):cm.curOp.focus=activeElt();var contained,behavior=configureMouse(cm,repeat,event),sel=cm.doc.sel;cm.options.dragDrop&&dragAndDrop&&!cm.isReadOnly()&&"single"==repeat&&(contained=sel.contains(pos))>-1&&(cmp((contained=sel.ranges[contained]).from(),pos)<0||pos.xRel>0)&&(cmp(contained.to(),pos)>0||pos.xRel<0)?leftButtonStartDrag(cm,event,pos,behavior):leftButtonSelect(cm,event,pos,behavior)}function leftButtonStartDrag(cm,event,pos,behavior){var display=cm.display,moved=!1,dragEnd=operation(cm,function(e){webkit&&(display.scroller.draggable=!1),cm.state.draggingText=!1,off(document,"mouseup",dragEnd),off(document,"mousemove",mouseMove),off(display.scroller,"dragstart",dragStart),off(display.scroller,"drop",dragEnd),moved||(e_preventDefault(e),behavior.addNew||extendSelection(cm.doc,pos,null,null,behavior.extend),webkit||ie&&9==ie_version?setTimeout(function(){document.body.focus(),display.input.focus()},20):display.input.focus())}),mouseMove=function(e2){moved=moved||Math.abs(event.clientX-e2.clientX)+Math.abs(event.clientY-e2.clientY)>=10},dragStart=function(){return moved=!0};webkit&&(display.scroller.draggable=!0),cm.state.draggingText=dragEnd,dragEnd.copy=!behavior.moveOnDrag,display.scroller.dragDrop&&display.scroller.dragDrop(),on(document,"mouseup",dragEnd),on(document,"mousemove",mouseMove),on(display.scroller,"dragstart",dragStart),on(display.scroller,"drop",dragEnd),delayBlurEvent(cm),setTimeout(function(){return display.input.focus()},20)}function rangeForUnit(cm,pos,unit){if("char"==unit)return new Range(pos,pos);if("word"==unit)return cm.findWordAt(pos);if("line"==unit)return new Range(Pos(pos.line,0),clipPos(cm.doc,Pos(pos.line+1,0)));var result=unit(cm,pos);return new Range(result.from,result.to)}function leftButtonSelect(cm,event,start,behavior){function extendTo(pos){if(0!=cmp(lastPos,pos))if(lastPos=pos,"rectangle"==behavior.unit){for(var ranges=[],tabSize=cm.options.tabSize,startCol=countColumn(getLine(doc,start.line).text,start.ch,tabSize),posCol=countColumn(getLine(doc,pos.line).text,pos.ch,tabSize),left=Math.min(startCol,posCol),right=Math.max(startCol,posCol),line=Math.min(start.line,pos.line),end=Math.min(cm.lastLine(),Math.max(start.line,pos.line));line<=end;line++){var text=getLine(doc,line).text,leftPos=findColumn(text,left,tabSize);left==right?ranges.push(new Range(Pos(line,leftPos),Pos(line,leftPos))):text.length>leftPos&&ranges.push(new Range(Pos(line,leftPos),Pos(line,findColumn(text,right,tabSize))))}ranges.length||ranges.push(new Range(start,start)),setSelection(doc,normalizeSelection(startSel.ranges.slice(0,ourIndex).concat(ranges),ourIndex),{origin:"*mouse",scroll:!1}),cm.scrollIntoView(pos)}else{var head,oldRange=ourRange,range$$1=rangeForUnit(cm,pos,behavior.unit),anchor=oldRange.anchor;cmp(range$$1.anchor,anchor)>0?(head=range$$1.head,anchor=minPos(oldRange.from(),range$$1.anchor)):(head=range$$1.anchor,anchor=maxPos(oldRange.to(),range$$1.head));var ranges$1=startSel.ranges.slice(0);ranges$1[ourIndex]=new Range(clipPos(doc,anchor),head),setSelection(doc,normalizeSelection(ranges$1,ourIndex),sel_mouse)}}function extend(e){var curCount=++counter,cur=posFromMouse(cm,e,!0,"rectangle"==behavior.unit);if(cur)if(0!=cmp(cur,lastPos)){cm.curOp.focus=activeElt(),extendTo(cur);var visible=visibleLines(display,doc);(cur.line>=visible.to||cur.line<visible.from)&&setTimeout(operation(cm,function(){counter==curCount&&extend(e)}),150)}else{var outside=e.clientY<editorSize.top?-20:e.clientY>editorSize.bottom?20:0;outside&&setTimeout(operation(cm,function(){counter==curCount&&(display.scroller.scrollTop+=outside,extend(e))}),50)}}function done(e){cm.state.selectingText=!1,counter=1/0,e_preventDefault(e),display.input.focus(),off(document,"mousemove",move),off(document,"mouseup",up),doc.history.lastSelOrigin=null}var display=cm.display,doc=cm.doc;e_preventDefault(event);var ourRange,ourIndex,startSel=doc.sel,ranges=startSel.ranges;if(behavior.addNew&&!behavior.extend?(ourIndex=doc.sel.contains(start),ourRange=ourIndex>-1?ranges[ourIndex]:new Range(start,start)):(ourRange=doc.sel.primary(),ourIndex=doc.sel.primIndex),"rectangle"==behavior.unit)behavior.addNew||(ourRange=new Range(start,start)),start=posFromMouse(cm,event,!0,!0),ourIndex=-1;else{var range$$1=rangeForUnit(cm,start,behavior.unit);ourRange=behavior.extend?extendRange(ourRange,range$$1.anchor,range$$1.head,behavior.extend):range$$1}behavior.addNew?-1==ourIndex?(ourIndex=ranges.length,setSelection(doc,normalizeSelection(ranges.concat([ourRange]),ourIndex),{scroll:!1,origin:"*mouse"})):ranges.length>1&&ranges[ourIndex].empty()&&"char"==behavior.unit&&!behavior.extend?(setSelection(doc,normalizeSelection(ranges.slice(0,ourIndex).concat(ranges.slice(ourIndex+1)),0),{scroll:!1,origin:"*mouse"}),startSel=doc.sel):replaceOneSelection(doc,ourIndex,ourRange,sel_mouse):(ourIndex=0,setSelection(doc,new Selection([ourRange],0),sel_mouse),startSel=doc.sel);var lastPos=start,editorSize=display.wrapper.getBoundingClientRect(),counter=0,move=operation(cm,function(e){e_button(e)?extend(e):done(e)}),up=operation(cm,done);cm.state.selectingText=up,on(document,"mousemove",move),on(document,"mouseup",up)}function gutterEvent(cm,e,type,prevent){var mX,mY;try{mX=e.clientX,mY=e.clientY}catch(e){return!1}if(mX>=Math.floor(cm.display.gutters.getBoundingClientRect().right))return!1;prevent&&e_preventDefault(e);var display=cm.display,lineBox=display.lineDiv.getBoundingClientRect();if(mY>lineBox.bottom||!hasHandler(cm,type))return e_defaultPrevented(e);mY-=lineBox.top-display.viewOffset;for(var i=0;i<cm.options.gutters.length;++i){var g=display.gutters.childNodes[i];if(g&&g.getBoundingClientRect().right>=mX)return signal(cm,type,cm,lineAtHeight(cm.doc,mY),cm.options.gutters[i],e),e_defaultPrevented(e)}}function clickInGutter(cm,e){return gutterEvent(cm,e,"gutterClick",!0)}function onContextMenu(cm,e){eventInWidget(cm.display,e)||contextMenuInGutter(cm,e)||signalDOMEvent(cm,e,"contextmenu")||cm.display.input.onContextMenu(e)}function contextMenuInGutter(cm,e){return!!hasHandler(cm,"gutterContextMenu")&&gutterEvent(cm,e,"gutterContextMenu",!1)}function themeChanged(cm){cm.display.wrapper.className=cm.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+cm.options.theme.replace(/(^|\s)\s*/g," cm-s-"),clearCaches(cm)}function guttersChanged(cm){updateGutters(cm),regChange(cm),alignHorizontally(cm)}function dragDropChanged(cm,value,old){if(!value!=!(old&&old!=Init)){var funcs=cm.display.dragFunctions,toggle=value?on:off;toggle(cm.display.scroller,"dragstart",funcs.start),toggle(cm.display.scroller,"dragenter",funcs.enter),toggle(cm.display.scroller,"dragover",funcs.over),toggle(cm.display.scroller,"dragleave",funcs.leave),toggle(cm.display.scroller,"drop",funcs.drop)}}function wrappingChanged(cm){cm.options.lineWrapping?(addClass(cm.display.wrapper,"CodeMirror-wrap"),cm.display.sizer.style.minWidth="",cm.display.sizerWidth=null):(rmClass(cm.display.wrapper,"CodeMirror-wrap"),findMaxLine(cm)),estimateLineHeights(cm),regChange(cm),clearCaches(cm),setTimeout(function(){return updateScrollbars(cm)},100)}function CodeMirror$1(place,options){var this$1=this;if(!(this instanceof CodeMirror$1))return new CodeMirror$1(place,options);this.options=options=options?copyObj(options):{},copyObj(defaults,options,!1),setGuttersForLineNumbers(options);var doc=options.value;"string"==typeof doc&&(doc=new Doc(doc,options.mode,null,options.lineSeparator,options.direction)),this.doc=doc;var input=new CodeMirror$1.inputStyles[options.inputStyle](this),display=this.display=new Display(place,doc,input);display.wrapper.CodeMirror=this,updateGutters(this),themeChanged(this),options.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),initScrollbars(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,selectingText:!1,draggingText:!1,highlight:new Delayed,keySeq:null,specialChars:null},options.autofocus&&!mobile&&display.input.focus(),ie&&ie_version<11&&setTimeout(function(){return this$1.display.input.reset(!0)},20),registerEventHandlers(this),ensureGlobalHandlers(),startOperation(this),this.curOp.forceUpdate=!0,attachDoc(this,doc),options.autofocus&&!mobile||this.hasFocus()?setTimeout(bind(onFocus,this),20):onBlur(this);for(var opt in optionHandlers)optionHandlers.hasOwnProperty(opt)&&optionHandlers[opt](this$1,options[opt],Init);maybeUpdateLineNumberWidth(this),options.finishInit&&options.finishInit(this);for(var i=0;i<initHooks.length;++i)initHooks[i](this$1);endOperation(this),webkit&&options.lineWrapping&&"optimizelegibility"==getComputedStyle(display.lineDiv).textRendering&&(display.lineDiv.style.textRendering="auto")}function registerEventHandlers(cm){function finishTouch(){d.activeTouch&&(touchFinished=setTimeout(function(){return d.activeTouch=null},1e3),(prevTouch=d.activeTouch).end=+new Date)}function isMouseLikeTouchEvent(e){if(1!=e.touches.length)return!1;var touch=e.touches[0];return touch.radiusX<=1&&touch.radiusY<=1}function farAway(touch,other){if(null==other.left)return!0;var dx=other.left-touch.left,dy=other.top-touch.top;return dx*dx+dy*dy>400}var d=cm.display;on(d.scroller,"mousedown",operation(cm,onMouseDown)),ie&&ie_version<11?on(d.scroller,"dblclick",operation(cm,function(e){if(!signalDOMEvent(cm,e)){var pos=posFromMouse(cm,e);if(pos&&!clickInGutter(cm,e)&&!eventInWidget(cm.display,e)){e_preventDefault(e);var word=cm.findWordAt(pos);extendSelection(cm.doc,word.anchor,word.head)}}})):on(d.scroller,"dblclick",function(e){return signalDOMEvent(cm,e)||e_preventDefault(e)}),captureRightClick||on(d.scroller,"contextmenu",function(e){return onContextMenu(cm,e)});var touchFinished,prevTouch={end:0};on(d.scroller,"touchstart",function(e){if(!signalDOMEvent(cm,e)&&!isMouseLikeTouchEvent(e)){d.input.ensurePolled(),clearTimeout(touchFinished);var now=+new Date;d.activeTouch={start:now,moved:!1,prev:now-prevTouch.end<=300?prevTouch:null},1==e.touches.length&&(d.activeTouch.left=e.touches[0].pageX,d.activeTouch.top=e.touches[0].pageY)}}),on(d.scroller,"touchmove",function(){d.activeTouch&&(d.activeTouch.moved=!0)}),on(d.scroller,"touchend",function(e){var touch=d.activeTouch;if(touch&&!eventInWidget(d,e)&&null!=touch.left&&!touch.moved&&new Date-touch.start<300){var range,pos=cm.coordsChar(d.activeTouch,"page");range=!touch.prev||farAway(touch,touch.prev)?new Range(pos,pos):!touch.prev.prev||farAway(touch,touch.prev.prev)?cm.findWordAt(pos):new Range(Pos(pos.line,0),clipPos(cm.doc,Pos(pos.line+1,0))),cm.setSelection(range.anchor,range.head),cm.focus(),e_preventDefault(e)}finishTouch()}),on(d.scroller,"touchcancel",finishTouch),on(d.scroller,"scroll",function(){d.scroller.clientHeight&&(updateScrollTop(cm,d.scroller.scrollTop),setScrollLeft(cm,d.scroller.scrollLeft,!0),signal(cm,"scroll",cm))}),on(d.scroller,"mousewheel",function(e){return onScrollWheel(cm,e)}),on(d.scroller,"DOMMouseScroll",function(e){return onScrollWheel(cm,e)}),on(d.wrapper,"scroll",function(){return d.wrapper.scrollTop=d.wrapper.scrollLeft=0}),d.dragFunctions={enter:function(e){signalDOMEvent(cm,e)||e_stop(e)},over:function(e){signalDOMEvent(cm,e)||(onDragOver(cm,e),e_stop(e))},start:function(e){return onDragStart(cm,e)},drop:operation(cm,onDrop),leave:function(e){signalDOMEvent(cm,e)||clearDragCursor(cm)}};var inp=d.input.getField();on(inp,"keyup",function(e){return onKeyUp.call(cm,e)}),on(inp,"keydown",operation(cm,onKeyDown)),on(inp,"keypress",operation(cm,onKeyPress)),on(inp,"focus",function(e){return onFocus(cm,e)}),on(inp,"blur",function(e){return onBlur(cm,e)})}function indentLine(cm,n,how,aggressive){var state,doc=cm.doc;null==how&&(how="add"),"smart"==how&&(doc.mode.indent?state=getContextBefore(cm,n).state:how="prev");var tabSize=cm.options.tabSize,line=getLine(doc,n),curSpace=countColumn(line.text,null,tabSize);line.stateAfter&&(line.stateAfter=null);var indentation,curSpaceString=line.text.match(/^\s*/)[0];if(aggressive||/\S/.test(line.text)){if("smart"==how&&((indentation=doc.mode.indent(state,line.text.slice(curSpaceString.length),line.text))==Pass||indentation>150)){if(!aggressive)return;how="prev"}}else indentation=0,how="not";"prev"==how?indentation=n>doc.first?countColumn(getLine(doc,n-1).text,null,tabSize):0:"add"==how?indentation=curSpace+cm.options.indentUnit:"subtract"==how?indentation=curSpace-cm.options.indentUnit:"number"==typeof how&&(indentation=curSpace+how),indentation=Math.max(0,indentation);var indentString="",pos=0;if(cm.options.indentWithTabs)for(var i=Math.floor(indentation/tabSize);i;--i)pos+=tabSize,indentString+="\t";if(pos<indentation&&(indentString+=spaceStr(indentation-pos)),indentString!=curSpaceString)return replaceRange(doc,indentString,Pos(n,0),Pos(n,curSpaceString.length),"+input"),line.stateAfter=null,!0;for(var i$1=0;i$1<doc.sel.ranges.length;i$1++){var range=doc.sel.ranges[i$1];if(range.head.line==n&&range.head.ch<curSpaceString.length){var pos$1=Pos(n,curSpaceString.length);replaceOneSelection(doc,i$1,new Range(pos$1,pos$1));break}}}function setLastCopied(newLastCopied){lastCopied=newLastCopied}function applyTextInput(cm,inserted,deleted,sel,origin){var doc=cm.doc;cm.display.shift=!1,sel||(sel=doc.sel);var paste=cm.state.pasteIncoming||"paste"==origin,textLines=splitLinesAuto(inserted),multiPaste=null;if(paste&&sel.ranges.length>1)if(lastCopied&&lastCopied.text.join("\n")==inserted){if(sel.ranges.length%lastCopied.text.length==0){multiPaste=[];for(var i=0;i<lastCopied.text.length;i++)multiPaste.push(doc.splitLines(lastCopied.text[i]))}}else textLines.length==sel.ranges.length&&cm.options.pasteLinesPerSelection&&(multiPaste=map(textLines,function(l){return[l]}));for(var updateInput,i$1=sel.ranges.length-1;i$1>=0;i$1--){var range$$1=sel.ranges[i$1],from=range$$1.from(),to=range$$1.to();range$$1.empty()&&(deleted&&deleted>0?from=Pos(from.line,from.ch-deleted):cm.state.overwrite&&!paste?to=Pos(to.line,Math.min(getLine(doc,to.line).text.length,to.ch+lst(textLines).length)):lastCopied&&lastCopied.lineWise&&lastCopied.text.join("\n")==inserted&&(from=to=Pos(from.line,0))),updateInput=cm.curOp.updateInput;var changeEvent={from:from,to:to,text:multiPaste?multiPaste[i$1%multiPaste.length]:textLines,origin:origin||(paste?"paste":cm.state.cutIncoming?"cut":"+input")};makeChange(cm.doc,changeEvent),signalLater(cm,"inputRead",cm,changeEvent)}inserted&&!paste&&triggerElectric(cm,inserted),ensureCursorVisible(cm),cm.curOp.updateInput=updateInput,cm.curOp.typing=!0,cm.state.pasteIncoming=cm.state.cutIncoming=!1}function handlePaste(e,cm){var pasted=e.clipboardData&&e.clipboardData.getData("Text");if(pasted)return e.preventDefault(),cm.isReadOnly()||cm.options.disableInput||runInOp(cm,function(){return applyTextInput(cm,pasted,0,null,"paste")}),!0}function triggerElectric(cm,inserted){if(cm.options.electricChars&&cm.options.smartIndent)for(var sel=cm.doc.sel,i=sel.ranges.length-1;i>=0;i--){var range$$1=sel.ranges[i];if(!(range$$1.head.ch>100||i&&sel.ranges[i-1].head.line==range$$1.head.line)){var mode=cm.getModeAt(range$$1.head),indented=!1;if(mode.electricChars){for(var j=0;j<mode.electricChars.length;j++)if(inserted.indexOf(mode.electricChars.charAt(j))>-1){indented=indentLine(cm,range$$1.head.line,"smart");break}}else mode.electricInput&&mode.electricInput.test(getLine(cm.doc,range$$1.head.line).text.slice(0,range$$1.head.ch))&&(indented=indentLine(cm,range$$1.head.line,"smart"));indented&&signalLater(cm,"electricInput",cm,range$$1.head.line)}}}function copyableRanges(cm){for(var text=[],ranges=[],i=0;i<cm.doc.sel.ranges.length;i++){var line=cm.doc.sel.ranges[i].head.line,lineRange={anchor:Pos(line,0),head:Pos(line+1,0)};ranges.push(lineRange),text.push(cm.getRange(lineRange.anchor,lineRange.head))}return{text:text,ranges:ranges}}function disableBrowserMagic(field,spellcheck){field.setAttribute("autocorrect","off"),field.setAttribute("autocapitalize","off"),field.setAttribute("spellcheck",!!spellcheck)}function hiddenTextarea(){var te=elt("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),div=elt("div",[te],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return webkit?te.style.width="1000px":te.setAttribute("wrap","off"),ios&&(te.style.border="1px solid black"),disableBrowserMagic(te),div}function findPosH(doc,pos,dir,unit,visually){function findNextLine(){var l=pos.line+dir;return!(l<doc.first||l>=doc.first+doc.size)&&(pos=new Pos(l,pos.ch,pos.sticky),lineObj=getLine(doc,l))}function moveOnce(boundToLine){var next;if(null==(next=visually?moveVisually(doc.cm,lineObj,pos,dir):moveLogically(lineObj,pos,dir))){if(boundToLine||!findNextLine())return!1;pos=endOfLine(visually,doc.cm,lineObj,pos.line,dir)}else pos=next;return!0}var oldPos=pos,origDir=dir,lineObj=getLine(doc,pos.line);if("char"==unit)moveOnce();else if("column"==unit)moveOnce(!0);else if("word"==unit||"group"==unit)for(var sawType=null,group="group"==unit,helper=doc.cm&&doc.cm.getHelper(pos,"wordChars"),first=!0;!(dir<0)||moveOnce(!first);first=!1){var cur=lineObj.text.charAt(pos.ch)||"\n",type=isWordChar(cur,helper)?"w":group&&"\n"==cur?"n":!group||/\s/.test(cur)?null:"p";if(!group||first||type||(type="s"),sawType&&sawType!=type){dir<0&&(dir=1,moveOnce(),pos.sticky="after");break}if(type&&(sawType=type),dir>0&&!moveOnce(!first))break}var result=skipAtomic(doc,pos,oldPos,origDir,!0);return equalCursorPos(oldPos,result)&&(result.hitSide=!0),result}function findPosV(cm,pos,dir,unit){var y,doc=cm.doc,x=pos.left;if("page"==unit){var pageSize=Math.min(cm.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),moveAmount=Math.max(pageSize-.5*textHeight(cm.display),3);y=(dir>0?pos.bottom:pos.top)+dir*moveAmount}else"line"==unit&&(y=dir>0?pos.bottom+3:pos.top-3);for(var target;(target=coordsChar(cm,x,y)).outside;){if(dir<0?y<=0:y>=doc.height){target.hitSide=!0;break}y+=5*dir}return target}function posToDOM(cm,pos){var view=findViewForLine(cm,pos.line);if(!view||view.hidden)return null;var line=getLine(cm.doc,pos.line),info=mapFromLineView(view,line,pos.line),order=getOrder(line,cm.doc.direction),side="left";order&&(side=getBidiPartAt(order,pos.ch)%2?"right":"left");var result=nodeAndOffsetInLineMap(info.map,pos.ch,side);return result.offset="right"==result.collapse?result.end:result.start,result}function isInGutter(node){for(var scan=node;scan;scan=scan.parentNode)if(/CodeMirror-gutter-wrapper/.test(scan.className))return!0;return!1}function badPos(pos,bad){return bad&&(pos.bad=!0),pos}function domTextBetween(cm,from,to,fromLine,toLine){function recognizeMarker(id){return function(marker){return marker.id==id}}function close(){closing&&(text+=lineSep,closing=!1)}function addText(str){str&&(close(),text+=str)}function walk(node){if(1==node.nodeType){var cmText=node.getAttribute("cm-text");if(null!=cmText)return void addText(cmText||node.textContent.replace(/\u200b/g,""));var range$$1,markerID=node.getAttribute("cm-marker");if(markerID){var found=cm.findMarks(Pos(fromLine,0),Pos(toLine+1,0),recognizeMarker(+markerID));return void(found.length&&(range$$1=found[0].find())&&addText(getBetween(cm.doc,range$$1.from,range$$1.to).join(lineSep)))}if("false"==node.getAttribute("contenteditable"))return;var isBlock=/^(pre|div|p)$/i.test(node.nodeName);isBlock&&close();for(var i=0;i<node.childNodes.length;i++)walk(node.childNodes[i]);isBlock&&(closing=!0)}else 3==node.nodeType&&addText(node.nodeValue)}for(var text="",closing=!1,lineSep=cm.doc.lineSeparator();walk(from),from!=to;)from=from.nextSibling;return text}function domToPos(cm,node,offset){var lineNode;if(node==cm.display.lineDiv){if(!(lineNode=cm.display.lineDiv.childNodes[offset]))return badPos(cm.clipPos(Pos(cm.display.viewTo-1)),!0);node=null,offset=0}else for(lineNode=node;;lineNode=lineNode.parentNode){if(!lineNode||lineNode==cm.display.lineDiv)return null;if(lineNode.parentNode&&lineNode.parentNode==cm.display.lineDiv)break}for(var i=0;i<cm.display.view.length;i++){var lineView=cm.display.view[i];if(lineView.node==lineNode)return locateNodeInLineView(lineView,node,offset)}}function locateNodeInLineView(lineView,node,offset){function find(textNode,topNode,offset){for(var i=-1;i<(maps?maps.length:0);i++)for(var map$$1=i<0?measure.map:maps[i],j=0;j<map$$1.length;j+=3){var curNode=map$$1[j+2];if(curNode==textNode||curNode==topNode){var line=lineNo(i<0?lineView.line:lineView.rest[i]),ch=map$$1[j]+offset;return(offset<0||curNode!=textNode)&&(ch=map$$1[j+(offset?1:0)]),Pos(line,ch)}}}var wrapper=lineView.text.firstChild,bad=!1;if(!node||!contains(wrapper,node))return badPos(Pos(lineNo(lineView.line),0),!0);if(node==wrapper&&(bad=!0,node=wrapper.childNodes[offset],offset=0,!node)){var line=lineView.rest?lst(lineView.rest):lineView.line;return badPos(Pos(lineNo(line),line.text.length),bad)}var textNode=3==node.nodeType?node:null,topNode=node;for(textNode||1!=node.childNodes.length||3!=node.firstChild.nodeType||(textNode=node.firstChild,offset&&(offset=textNode.nodeValue.length));topNode.parentNode!=wrapper;)topNode=topNode.parentNode;var measure=lineView.measure,maps=measure.maps,found=find(textNode,topNode,offset);if(found)return badPos(found,bad);for(var after=topNode.nextSibling,dist=textNode?textNode.nodeValue.length-offset:0;after;after=after.nextSibling){if(found=find(after,after.firstChild,0))return badPos(Pos(found.line,found.ch-dist),bad);dist+=after.textContent.length}for(var before=topNode.previousSibling,dist$1=offset;before;before=before.previousSibling){if(found=find(before,before.firstChild,-1))return badPos(Pos(found.line,found.ch+dist$1),bad);dist$1+=before.textContent.length}}var userAgent=navigator.userAgent,platform=navigator.platform,gecko=/gecko\/\d/i.test(userAgent),ie_upto10=/MSIE \d/.test(userAgent),ie_11up=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(userAgent),edge=/Edge\/(\d+)/.exec(userAgent),ie=ie_upto10||ie_11up||edge,ie_version=ie&&(ie_upto10?document.documentMode||6:+(edge||ie_11up)[1]),webkit=!edge&&/WebKit\//.test(userAgent),qtwebkit=webkit&&/Qt\/\d+\.\d+/.test(userAgent),chrome=!edge&&/Chrome\//.test(userAgent),presto=/Opera\//.test(userAgent),safari=/Apple Computer/.test(navigator.vendor),mac_geMountainLion=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(userAgent),phantom=/PhantomJS/.test(userAgent),ios=!edge&&/AppleWebKit/.test(userAgent)&&/Mobile\/\w+/.test(userAgent),android=/Android/.test(userAgent),mobile=ios||android||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent),mac=ios||/Mac/.test(platform),chromeOS=/\bCrOS\b/.test(userAgent),windows=/win/i.test(platform),presto_version=presto&&userAgent.match(/Version\/(\d*\.\d*)/);presto_version&&(presto_version=Number(presto_version[1])),presto_version&&presto_version>=15&&(presto=!1,webkit=!0);var range,flipCtrlCmd=mac&&(qtwebkit||presto&&(null==presto_version||presto_version<12.11)),captureRightClick=gecko||ie&&ie_version>=9,rmClass=function(node,cls){var current=node.className,match=classTest(cls).exec(current);if(match){var after=current.slice(match.index+match[0].length);node.className=current.slice(0,match.index)+(after?match[1]+after:"")}};range=document.createRange?function(node,start,end,endNode){var r=document.createRange();return r.setEnd(endNode||node,end),r.setStart(node,start),r}:function(node,start,end){var r=document.body.createTextRange();try{r.moveToElementText(node.parentNode)}catch(e){return r}return r.collapse(!0),r.moveEnd("character",end),r.moveStart("character",start),r};var selectInput=function(node){node.select()};ios?selectInput=function(node){node.selectionStart=0,node.selectionEnd=node.value.length}:ie&&(selectInput=function(node){try{node.select()}catch(_e){}});var Delayed=function(){this.id=null};Delayed.prototype.set=function(ms,f){clearTimeout(this.id),this.id=setTimeout(f,ms)};var zwspSupported,badBidiRects,scrollerGap=30,Pass={toString:function(){return"CodeMirror.Pass"}},sel_dontScroll={scroll:!1},sel_mouse={origin:"*mouse"},sel_move={origin:"+move"},spaceStrs=[""],nonASCIISingleCaseWordChar=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,extendingChars=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/,sawReadOnlySpans=!1,sawCollapsedSpans=!1,bidiOther=null,bidiOrdering=function(){function charType(code){return code<=247?lowTypes.charAt(code):1424<=code&&code<=1524?"R":1536<=code&&code<=1785?arabicTypes.charAt(code-1536):1774<=code&&code<=2220?"r":8192<=code&&code<=8203?"w":8204==code?"b":"L"}function BidiSpan(level,from,to){this.level=level,this.from=from,this.to=to}var lowTypes="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",arabicTypes="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111",bidiRE=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,isNeutral=/[stwN]/,isStrong=/[LRr]/,countsAsLeft=/[Lb1n]/,countsAsNum=/[1n]/;return function(str,direction){var outerType="ltr"==direction?"L":"R";if(0==str.length||"ltr"==direction&&!bidiRE.test(str))return!1;for(var len=str.length,types=[],i=0;i<len;++i)types.push(charType(str.charCodeAt(i)));for(var i$1=0,prev=outerType;i$1<len;++i$1){var type=types[i$1];"m"==type?types[i$1]=prev:prev=type}for(var i$2=0,cur=outerType;i$2<len;++i$2){var type$1=types[i$2];"1"==type$1&&"r"==cur?types[i$2]="n":isStrong.test(type$1)&&(cur=type$1,"r"==type$1&&(types[i$2]="R"))}for(var i$3=1,prev$1=types[0];i$3<len-1;++i$3){var type$2=types[i$3];"+"==type$2&&"1"==prev$1&&"1"==types[i$3+1]?types[i$3]="1":","!=type$2||prev$1!=types[i$3+1]||"1"!=prev$1&&"n"!=prev$1||(types[i$3]=prev$1),prev$1=type$2}for(var i$4=0;i$4<len;++i$4){var type$3=types[i$4];if(","==type$3)types[i$4]="N";else if("%"==type$3){var end=void 0;for(end=i$4+1;end<len&&"%"==types[end];++end);for(var replace=i$4&&"!"==types[i$4-1]||end<len&&"1"==types[end]?"1":"N",j=i$4;j<end;++j)types[j]=replace;i$4=end-1}}for(var i$5=0,cur$1=outerType;i$5<len;++i$5){var type$4=types[i$5];"L"==cur$1&&"1"==type$4?types[i$5]="L":isStrong.test(type$4)&&(cur$1=type$4)}for(var i$6=0;i$6<len;++i$6)if(isNeutral.test(types[i$6])){var end$1=void 0;for(end$1=i$6+1;end$1<len&&isNeutral.test(types[end$1]);++end$1);for(var before="L"==(i$6?types[i$6-1]:outerType),replace$1=before==("L"==(end$1<len?types[end$1]:outerType))?before?"L":"R":outerType,j$1=i$6;j$1<end$1;++j$1)types[j$1]=replace$1;i$6=end$1-1}for(var m,order=[],i$7=0;i$7<len;)if(countsAsLeft.test(types[i$7])){var start=i$7;for(++i$7;i$7<len&&countsAsLeft.test(types[i$7]);++i$7);order.push(new BidiSpan(0,start,i$7))}else{var pos=i$7,at=order.length;for(++i$7;i$7<len&&"L"!=types[i$7];++i$7);for(var j$2=pos;j$2<i$7;)if(countsAsNum.test(types[j$2])){pos<j$2&&order.splice(at,0,new BidiSpan(1,pos,j$2));var nstart=j$2;for(++j$2;j$2<i$7&&countsAsNum.test(types[j$2]);++j$2);order.splice(at,0,new BidiSpan(2,nstart,j$2)),pos=j$2}else++j$2;pos<i$7&&order.splice(at,0,new BidiSpan(1,pos,i$7))}return 1==order[0].level&&(m=str.match(/^\s+/))&&(order[0].from=m[0].length,order.unshift(new BidiSpan(0,0,m[0].length))),1==lst(order).level&&(m=str.match(/\s+$/))&&(lst(order).to-=m[0].length,order.push(new BidiSpan(0,len-m[0].length,len))),"rtl"==direction?order.reverse():order}}(),noHandlers=[],on=function(emitter,type,f){if(emitter.addEventListener)emitter.addEventListener(type,f,!1);else if(emitter.attachEvent)emitter.attachEvent("on"+type,f);else{var map$$1=emitter._handlers||(emitter._handlers={});map$$1[type]=(map$$1[type]||noHandlers).concat(f)}},dragAndDrop=function(){if(ie&&ie_version<9)return!1;var div=elt("div");return"draggable"in div||"dragDrop"in div}(),splitLinesAuto=3!="\n\nb".split(/\n/).length?function(string){for(var pos=0,result=[],l=string.length;pos<=l;){var nl=string.indexOf("\n",pos);-1==nl&&(nl=string.length);var line=string.slice(pos,"\r"==string.charAt(nl-1)?nl-1:nl),rt=line.indexOf("\r");-1!=rt?(result.push(line.slice(0,rt)),pos+=rt+1):(result.push(line),pos=nl+1)}return result}:function(string){return string.split(/\r\n?|\n/)},hasSelection=window.getSelection?function(te){try{return te.selectionStart!=te.selectionEnd}catch(e){return!1}}:function(te){var range$$1;try{range$$1=te.ownerDocument.selection.createRange()}catch(e){}return!(!range$$1||range$$1.parentElement()!=te)&&0!=range$$1.compareEndPoints("StartToEnd",range$$1)},hasCopyEvent=function(){var e=elt("div");return"oncopy"in e||(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy)}(),badZoomedRects=null,modes={},mimeModes={},modeExtensions={},StringStream=function(string,tabSize,lineOracle){this.pos=this.start=0,this.string=string,this.tabSize=tabSize||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=lineOracle};StringStream.prototype.eol=function(){return this.pos>=this.string.length},StringStream.prototype.sol=function(){return this.pos==this.lineStart},StringStream.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},StringStream.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},StringStream.prototype.eat=function(match){var ch=this.string.charAt(this.pos);if("string"==typeof match?ch==match:ch&&(match.test?match.test(ch):match(ch)))return++this.pos,ch},StringStream.prototype.eatWhile=function(match){for(var start=this.pos;this.eat(match););return this.pos>start},StringStream.prototype.eatSpace=function(){for(var this$1=this,start=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this$1.pos;return this.pos>start},StringStream.prototype.skipToEnd=function(){this.pos=this.string.length},StringStream.prototype.skipTo=function(ch){var found=this.string.indexOf(ch,this.pos);if(found>-1)return this.pos=found,!0},StringStream.prototype.backUp=function(n){this.pos-=n},StringStream.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=countColumn(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?countColumn(this.string,this.lineStart,this.tabSize):0)},StringStream.prototype.indentation=function(){return countColumn(this.string,null,this.tabSize)-(this.lineStart?countColumn(this.string,this.lineStart,this.tabSize):0)},StringStream.prototype.match=function(pattern,consume,caseInsensitive){if("string"!=typeof pattern){var match=this.string.slice(this.pos).match(pattern);return match&&match.index>0?null:(match&&!1!==consume&&(this.pos+=match[0].length),match)}var cased=function(str){return caseInsensitive?str.toLowerCase():str};if(cased(this.string.substr(this.pos,pattern.length))==cased(pattern))return!1!==consume&&(this.pos+=pattern.length),!0},StringStream.prototype.current=function(){return this.string.slice(this.start,this.pos)},StringStream.prototype.hideFirstChars=function(n,inner){this.lineStart+=n;try{return inner()}finally{this.lineStart-=n}},StringStream.prototype.lookAhead=function(n){var oracle=this.lineOracle;return oracle&&oracle.lookAhead(n)};var SavedContext=function(state,lookAhead){this.state=state,this.lookAhead=lookAhead},Context=function(doc,state,line,lookAhead){this.state=state,this.doc=doc,this.line=line,this.maxLookAhead=lookAhead||0};Context.prototype.lookAhead=function(n){var line=this.doc.getLine(this.line+n);return null!=line&&n>this.maxLookAhead&&(this.maxLookAhead=n),line},Context.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Context.fromSaved=function(doc,saved,line){return saved instanceof SavedContext?new Context(doc,copyState(doc.mode,saved.saved),line,saved.lookAhead):new Context(doc,copyState(doc.mode,saved),line)},Context.prototype.save=function(copy){var state=!1!==copy?copyState(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new SavedContext(state,this.maxLookAhead):state};var Token=function(stream,type,state){this.start=stream.start,this.end=stream.pos,this.string=stream.current(),this.type=type||null,this.state=state},Line=function(text,markedSpans,estimateHeight){this.text=text,attachMarkedSpans(this,markedSpans),this.height=estimateHeight?estimateHeight(this):1};Line.prototype.lineNo=function(){return lineNo(this)},eventMixin(Line);var measureText,styleToClassCache={},styleToClassCacheWithMode={},operationGroup=null,orphanDelayedCallbacks=null,nullRect={left:0,right:0,top:0,bottom:0},NativeScrollbars=function(place,scroll,cm){this.cm=cm;var vert=this.vert=elt("div",[elt("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),horiz=this.horiz=elt("div",[elt("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");place(vert),place(horiz),on(vert,"scroll",function(){vert.clientHeight&&scroll(vert.scrollTop,"vertical")}),on(horiz,"scroll",function(){horiz.clientWidth&&scroll(horiz.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,ie&&ie_version<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};NativeScrollbars.prototype.update=function(measure){var needsH=measure.scrollWidth>measure.clientWidth+1,needsV=measure.scrollHeight>measure.clientHeight+1,sWidth=measure.nativeBarWidth;if(needsV){this.vert.style.display="block",this.vert.style.bottom=needsH?sWidth+"px":"0";var totalHeight=measure.viewHeight-(needsH?sWidth:0);this.vert.firstChild.style.height=Math.max(0,measure.scrollHeight-measure.clientHeight+totalHeight)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(needsH){this.horiz.style.display="block",this.horiz.style.right=needsV?sWidth+"px":"0",this.horiz.style.left=measure.barLeft+"px";var totalWidth=measure.viewWidth-measure.barLeft-(needsV?sWidth:0);this.horiz.firstChild.style.width=Math.max(0,measure.scrollWidth-measure.clientWidth+totalWidth)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&measure.clientHeight>0&&(0==sWidth&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:needsV?sWidth:0,bottom:needsH?sWidth:0}},NativeScrollbars.prototype.setScrollLeft=function(pos){this.horiz.scrollLeft!=pos&&(this.horiz.scrollLeft=pos),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},NativeScrollbars.prototype.setScrollTop=function(pos){this.vert.scrollTop!=pos&&(this.vert.scrollTop=pos),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},NativeScrollbars.prototype.zeroWidthHack=function(){var w=mac&&!mac_geMountainLion?"12px":"18px";this.horiz.style.height=this.vert.style.width=w,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new Delayed,this.disableVert=new Delayed},NativeScrollbars.prototype.enableZeroWidthBar=function(bar,delay,type){function maybeDisable(){var box=bar.getBoundingClientRect();("vert"==type?document.elementFromPoint(box.right-1,(box.top+box.bottom)/2):document.elementFromPoint((box.right+box.left)/2,box.bottom-1))!=bar?bar.style.pointerEvents="none":delay.set(1e3,maybeDisable)}bar.style.pointerEvents="auto",delay.set(1e3,maybeDisable)},NativeScrollbars.prototype.clear=function(){var parent=this.horiz.parentNode;parent.removeChild(this.horiz),parent.removeChild(this.vert)};var NullScrollbars=function(){};NullScrollbars.prototype.update=function(){return{bottom:0,right:0}},NullScrollbars.prototype.setScrollLeft=function(){},NullScrollbars.prototype.setScrollTop=function(){},NullScrollbars.prototype.clear=function(){};var scrollbarModel={native:NativeScrollbars,null:NullScrollbars},nextOpId=0,DisplayUpdate=function(cm,viewport,force){var display=cm.display;this.viewport=viewport,this.visible=visibleLines(display,cm.doc,viewport),this.editorIsHidden=!display.wrapper.offsetWidth,this.wrapperHeight=display.wrapper.clientHeight,this.wrapperWidth=display.wrapper.clientWidth,this.oldDisplayWidth=displayWidth(cm),this.force=force,this.dims=getDimensions(cm),this.events=[]};DisplayUpdate.prototype.signal=function(emitter,type){hasHandler(emitter,type)&&this.events.push(arguments)},DisplayUpdate.prototype.finish=function(){for(var this$1=this,i=0;i<this.events.length;i++)signal.apply(null,this$1.events[i])};var wheelSamples=0,wheelPixelsPerUnit=null;ie?wheelPixelsPerUnit=-.53:gecko?wheelPixelsPerUnit=15:chrome?wheelPixelsPerUnit=-.7:safari&&(wheelPixelsPerUnit=-1/3);var Selection=function(ranges,primIndex){this.ranges=ranges,this.primIndex=primIndex};Selection.prototype.primary=function(){return this.ranges[this.primIndex]},Selection.prototype.equals=function(other){var this$1=this;if(other==this)return!0;if(other.primIndex!=this.primIndex||other.ranges.length!=this.ranges.length)return!1;for(var i=0;i<this.ranges.length;i++){var here=this$1.ranges[i],there=other.ranges[i];if(!equalCursorPos(here.anchor,there.anchor)||!equalCursorPos(here.head,there.head))return!1}return!0},Selection.prototype.deepCopy=function(){for(var this$1=this,out=[],i=0;i<this.ranges.length;i++)out[i]=new Range(copyPos(this$1.ranges[i].anchor),copyPos(this$1.ranges[i].head));return new Selection(out,this.primIndex)},Selection.prototype.somethingSelected=function(){for(var this$1=this,i=0;i<this.ranges.length;i++)if(!this$1.ranges[i].empty())return!0;return!1},Selection.prototype.contains=function(pos,end){var this$1=this;end||(end=pos);for(var i=0;i<this.ranges.length;i++){var range=this$1.ranges[i];if(cmp(end,range.from())>=0&&cmp(pos,range.to())<=0)return i}return-1};var Range=function(anchor,head){this.anchor=anchor,this.head=head};Range.prototype.from=function(){return minPos(this.anchor,this.head)},Range.prototype.to=function(){return maxPos(this.anchor,this.head)},Range.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},LeafChunk.prototype={chunkSize:function(){return this.lines.length},removeInner:function(at,n){for(var this$1=this,i=at,e=at+n;i<e;++i){var line=this$1.lines[i];this$1.height-=line.height,cleanUpLine(line),signalLater(line,"delete")}this.lines.splice(at,n)},collapse:function(lines){lines.push.apply(lines,this.lines)},insertInner:function(at,lines,height){var this$1=this;this.height+=height,this.lines=this.lines.slice(0,at).concat(lines).concat(this.lines.slice(at));for(var i=0;i<lines.length;++i)lines[i].parent=this$1},iterN:function(at,n,op){for(var this$1=this,e=at+n;at<e;++at)if(op(this$1.lines[at]))return!0}},BranchChunk.prototype={chunkSize:function(){return this.size},removeInner:function(at,n){var this$1=this;this.size-=n;for(var i=0;i<this.children.length;++i){var child=this$1.children[i],sz=child.chunkSize();if(at<sz){var rm=Math.min(n,sz-at),oldHeight=child.height;if(child.removeInner(at,rm),this$1.height-=oldHeight-child.height,sz==rm&&(this$1.children.splice(i--,1),child.parent=null),0==(n-=rm))break;at=0}else at-=sz}if(this.size-n<25&&(this.children.length>1||!(this.children[0]instanceof LeafChunk))){var lines=[];this.collapse(lines),this.children=[new LeafChunk(lines)],this.children[0].parent=this}},collapse:function(lines){for(var this$1=this,i=0;i<this.children.length;++i)this$1.children[i].collapse(lines)},insertInner:function(at,lines,height){var this$1=this;this.size+=lines.length,this.height+=height;for(var i=0;i<this.children.length;++i){var child=this$1.children[i],sz=child.chunkSize();if(at<=sz){if(child.insertInner(at,lines,height),child.lines&&child.lines.length>50){for(var remaining=child.lines.length%25+25,pos=remaining;pos<child.lines.length;){var leaf=new LeafChunk(child.lines.slice(pos,pos+=25));child.height-=leaf.height,this$1.children.splice(++i,0,leaf),leaf.parent=this$1}child.lines=child.lines.slice(0,remaining),this$1.maybeSpill()}break}at-=sz}},maybeSpill:function(){if(!(this.children.length<=10)){var me=this;do{var sibling=new BranchChunk(me.children.splice(me.children.length-5,5));if(me.parent){me.size-=sibling.size,me.height-=sibling.height;var myIndex=indexOf(me.parent.children,me);me.parent.children.splice(myIndex+1,0,sibling)}else{var copy=new BranchChunk(me.children);copy.parent=me,me.children=[copy,sibling],me=copy}sibling.parent=me.parent}while(me.children.length>10);me.parent.maybeSpill()}},iterN:function(at,n,op){for(var this$1=this,i=0;i<this.children.length;++i){var child=this$1.children[i],sz=child.chunkSize();if(at<sz){var used=Math.min(n,sz-at);if(child.iterN(at,used,op))return!0;if(0==(n-=used))break;at=0}else at-=sz}}};var LineWidget=function(doc,node,options){var this$1=this;if(options)for(var opt in options)options.hasOwnProperty(opt)&&(this$1[opt]=options[opt]);this.doc=doc,this.node=node};LineWidget.prototype.clear=function(){var this$1=this,cm=this.doc.cm,ws=this.line.widgets,line=this.line,no=lineNo(line);if(null!=no&&ws){for(var i=0;i<ws.length;++i)ws[i]==this$1&&ws.splice(i--,1);ws.length||(line.widgets=null);var height=widgetHeight(this);updateLineHeight(line,Math.max(0,line.height-height)),cm&&(runInOp(cm,function(){adjustScrollWhenAboveVisible(cm,line,-height),regLineChange(cm,no,"widget")}),signalLater(cm,"lineWidgetCleared",cm,this,no))}},LineWidget.prototype.changed=function(){var this$1=this,oldH=this.height,cm=this.doc.cm,line=this.line;this.height=null;var diff=widgetHeight(this)-oldH;diff&&(updateLineHeight(line,line.height+diff),cm&&runInOp(cm,function(){cm.curOp.forceUpdate=!0,adjustScrollWhenAboveVisible(cm,line,diff),signalLater(cm,"lineWidgetChanged",cm,this$1,lineNo(line))}))},eventMixin(LineWidget);var nextMarkerId=0,TextMarker=function(doc,type){this.lines=[],this.type=type,this.doc=doc,this.id=++nextMarkerId};TextMarker.prototype.clear=function(){var this$1=this;if(!this.explicitlyCleared){var cm=this.doc.cm,withOp=cm&&!cm.curOp;if(withOp&&startOperation(cm),hasHandler(this,"clear")){var found=this.find();found&&signalLater(this,"clear",found.from,found.to)}for(var min=null,max=null,i=0;i<this.lines.length;++i){var line=this$1.lines[i],span=getMarkedSpanFor(line.markedSpans,this$1);cm&&!this$1.collapsed?regLineChange(cm,lineNo(line),"text"):cm&&(null!=span.to&&(max=lineNo(line)),null!=span.from&&(min=lineNo(line))),line.markedSpans=removeMarkedSpan(line.markedSpans,span),null==span.from&&this$1.collapsed&&!lineIsHidden(this$1.doc,line)&&cm&&updateLineHeight(line,textHeight(cm.display))}if(cm&&this.collapsed&&!cm.options.lineWrapping)for(var i$1=0;i$1<this.lines.length;++i$1){var visual=visualLine(this$1.lines[i$1]),len=lineLength(visual);len>cm.display.maxLineLength&&(cm.display.maxLine=visual,cm.display.maxLineLength=len,cm.display.maxLineChanged=!0)}null!=min&&cm&&this.collapsed&®Change(cm,min,max+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,cm&&reCheckSelection(cm.doc)),cm&&signalLater(cm,"markerCleared",cm,this,min,max),withOp&&endOperation(cm),this.parent&&this.parent.clear()}},TextMarker.prototype.find=function(side,lineObj){var this$1=this;null==side&&"bookmark"==this.type&&(side=1);for(var from,to,i=0;i<this.lines.length;++i){var line=this$1.lines[i],span=getMarkedSpanFor(line.markedSpans,this$1);if(null!=span.from&&(from=Pos(lineObj?line:lineNo(line),span.from),-1==side))return from;if(null!=span.to&&(to=Pos(lineObj?line:lineNo(line),span.to),1==side))return to}return from&&{from:from,to:to}},TextMarker.prototype.changed=function(){var this$1=this,pos=this.find(-1,!0),widget=this,cm=this.doc.cm;pos&&cm&&runInOp(cm,function(){var line=pos.line,lineN=lineNo(pos.line),view=findViewForLine(cm,lineN);if(view&&(clearLineMeasurementCacheFor(view),cm.curOp.selectionChanged=cm.curOp.forceUpdate=!0),cm.curOp.updateMaxLine=!0,!lineIsHidden(widget.doc,line)&&null!=widget.height){var oldHeight=widget.height;widget.height=null;var dHeight=widgetHeight(widget)-oldHeight;dHeight&&updateLineHeight(line,line.height+dHeight)}signalLater(cm,"markerChanged",cm,this$1)})},TextMarker.prototype.attachLine=function(line){if(!this.lines.length&&this.doc.cm){var op=this.doc.cm.curOp;op.maybeHiddenMarkers&&-1!=indexOf(op.maybeHiddenMarkers,this)||(op.maybeUnhiddenMarkers||(op.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(line)},TextMarker.prototype.detachLine=function(line){if(this.lines.splice(indexOf(this.lines,line),1),!this.lines.length&&this.doc.cm){var op=this.doc.cm.curOp;(op.maybeHiddenMarkers||(op.maybeHiddenMarkers=[])).push(this)}},eventMixin(TextMarker);var SharedTextMarker=function(markers,primary){var this$1=this;this.markers=markers,this.primary=primary;for(var i=0;i<markers.length;++i)markers[i].parent=this$1};SharedTextMarker.prototype.clear=function(){var this$1=this;if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var i=0;i<this.markers.length;++i)this$1.markers[i].clear();signalLater(this,"clear")}},SharedTextMarker.prototype.find=function(side,lineObj){return this.primary.find(side,lineObj)},eventMixin(SharedTextMarker);var nextDocId=0,Doc=function(text,mode,firstLine,lineSep,direction){if(!(this instanceof Doc))return new Doc(text,mode,firstLine,lineSep,direction);null==firstLine&&(firstLine=0),BranchChunk.call(this,[new LeafChunk([new Line("",null)])]),this.first=firstLine,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=firstLine;var start=Pos(firstLine,0);this.sel=simpleSelection(start),this.history=new History(null),this.id=++nextDocId,this.modeOption=mode,this.lineSep=lineSep,this.direction="rtl"==direction?"rtl":"ltr",this.extend=!1,"string"==typeof text&&(text=this.splitLines(text)),updateDoc(this,{from:start,to:start,text:text}),setSelection(this,simpleSelection(start),sel_dontScroll)};Doc.prototype=createObj(BranchChunk.prototype,{constructor:Doc,iter:function(from,to,op){op?this.iterN(from-this.first,to-from,op):this.iterN(this.first,this.first+this.size,from)},insert:function(at,lines){for(var height=0,i=0;i<lines.length;++i)height+=lines[i].height;this.insertInner(at-this.first,lines,height)},remove:function(at,n){this.removeInner(at-this.first,n)},getValue:function(lineSep){var lines=getLines(this,this.first,this.first+this.size);return!1===lineSep?lines:lines.join(lineSep||this.lineSeparator())},setValue:docMethodOp(function(code){var top=Pos(this.first,0),last=this.first+this.size-1;makeChange(this,{from:top,to:Pos(last,getLine(this,last).text.length),text:this.splitLines(code),origin:"setValue",full:!0},!0),this.cm&&scrollToCoords(this.cm,0,0),setSelection(this,simpleSelection(top),sel_dontScroll)}),replaceRange:function(code,from,to,origin){replaceRange(this,code,from=clipPos(this,from),to=to?clipPos(this,to):from,origin)},getRange:function(from,to,lineSep){var lines=getBetween(this,clipPos(this,from),clipPos(this,to));return!1===lineSep?lines:lines.join(lineSep||this.lineSeparator())},getLine:function(line){var l=this.getLineHandle(line);return l&&l.text},getLineHandle:function(line){if(isLine(this,line))return getLine(this,line)},getLineNumber:function(line){return lineNo(line)},getLineHandleVisualStart:function(line){return"number"==typeof line&&(line=getLine(this,line)),visualLine(line)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(pos){return clipPos(this,pos)},getCursor:function(start){var range$$1=this.sel.primary();return null==start||"head"==start?range$$1.head:"anchor"==start?range$$1.anchor:"end"==start||"to"==start||!1===start?range$$1.to():range$$1.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:docMethodOp(function(line,ch,options){setSimpleSelection(this,clipPos(this,"number"==typeof line?Pos(line,ch||0):line),null,options)}),setSelection:docMethodOp(function(anchor,head,options){setSimpleSelection(this,clipPos(this,anchor),clipPos(this,head||anchor),options)}),extendSelection:docMethodOp(function(head,other,options){extendSelection(this,clipPos(this,head),other&&clipPos(this,other),options)}),extendSelections:docMethodOp(function(heads,options){extendSelections(this,clipPosArray(this,heads),options)}),extendSelectionsBy:docMethodOp(function(f,options){extendSelections(this,clipPosArray(this,map(this.sel.ranges,f)),options)}),setSelections:docMethodOp(function(ranges,primary,options){var this$1=this;if(ranges.length){for(var out=[],i=0;i<ranges.length;i++)out[i]=new Range(clipPos(this$1,ranges[i].anchor),clipPos(this$1,ranges[i].head));null==primary&&(primary=Math.min(ranges.length-1,this.sel.primIndex)),setSelection(this,normalizeSelection(out,primary),options)}}),addSelection:docMethodOp(function(anchor,head,options){var ranges=this.sel.ranges.slice(0);ranges.push(new Range(clipPos(this,anchor),clipPos(this,head||anchor))),setSelection(this,normalizeSelection(ranges,ranges.length-1),options)}),getSelection:function(lineSep){for(var lines,this$1=this,ranges=this.sel.ranges,i=0;i<ranges.length;i++){var sel=getBetween(this$1,ranges[i].from(),ranges[i].to());lines=lines?lines.concat(sel):sel}return!1===lineSep?lines:lines.join(lineSep||this.lineSeparator())},getSelections:function(lineSep){for(var this$1=this,parts=[],ranges=this.sel.ranges,i=0;i<ranges.length;i++){var sel=getBetween(this$1,ranges[i].from(),ranges[i].to());!1!==lineSep&&(sel=sel.join(lineSep||this$1.lineSeparator())),parts[i]=sel}return parts},replaceSelection:function(code,collapse,origin){for(var dup=[],i=0;i<this.sel.ranges.length;i++)dup[i]=code;this.replaceSelections(dup,collapse,origin||"+input")},replaceSelections:docMethodOp(function(code,collapse,origin){for(var this$1=this,changes=[],sel=this.sel,i=0;i<sel.ranges.length;i++){var range$$1=sel.ranges[i];changes[i]={from:range$$1.from(),to:range$$1.to(),text:this$1.splitLines(code[i]),origin:origin}}for(var newSel=collapse&&"end"!=collapse&&computeReplacedSel(this,changes,collapse),i$1=changes.length-1;i$1>=0;i$1--)makeChange(this$1,changes[i$1]);newSel?setSelectionReplaceHistory(this,newSel):this.cm&&ensureCursorVisible(this.cm)}),undo:docMethodOp(function(){makeChangeFromHistory(this,"undo")}),redo:docMethodOp(function(){makeChangeFromHistory(this,"redo")}),undoSelection:docMethodOp(function(){makeChangeFromHistory(this,"undo",!0)}),redoSelection:docMethodOp(function(){makeChangeFromHistory(this,"redo",!0)}),setExtending:function(val){this.extend=val},getExtending:function(){return this.extend},historySize:function(){for(var hist=this.history,done=0,undone=0,i=0;i<hist.done.length;i++)hist.done[i].ranges||++done;for(var i$1=0;i$1<hist.undone.length;i$1++)hist.undone[i$1].ranges||++undone;return{undo:done,redo:undone}},clearHistory:function(){this.history=new History(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(forceSplit){return forceSplit&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(gen){return this.history.generation==(gen||this.cleanGeneration)},getHistory:function(){return{done:copyHistoryArray(this.history.done),undone:copyHistoryArray(this.history.undone)}},setHistory:function(histData){var hist=this.history=new History(this.history.maxGeneration);hist.done=copyHistoryArray(histData.done.slice(0),null,!0),hist.undone=copyHistoryArray(histData.undone.slice(0),null,!0)},setGutterMarker:docMethodOp(function(line,gutterID,value){return changeLine(this,line,"gutter",function(line){var markers=line.gutterMarkers||(line.gutterMarkers={});return markers[gutterID]=value,!value&&isEmpty(markers)&&(line.gutterMarkers=null),!0})}),clearGutter:docMethodOp(function(gutterID){var this$1=this;this.iter(function(line){line.gutterMarkers&&line.gutterMarkers[gutterID]&&changeLine(this$1,line,"gutter",function(){return line.gutterMarkers[gutterID]=null,isEmpty(line.gutterMarkers)&&(line.gutterMarkers=null),!0})})}),lineInfo:function(line){var n;if("number"==typeof line){if(!isLine(this,line))return null;if(n=line,!(line=getLine(this,line)))return null}else if(null==(n=lineNo(line)))return null;return{line:n,handle:line,text:line.text,gutterMarkers:line.gutterMarkers,textClass:line.textClass,bgClass:line.bgClass,wrapClass:line.wrapClass,widgets:line.widgets}},addLineClass:docMethodOp(function(handle,where,cls){return changeLine(this,handle,"gutter"==where?"gutter":"class",function(line){var prop="text"==where?"textClass":"background"==where?"bgClass":"gutter"==where?"gutterClass":"wrapClass";if(line[prop]){if(classTest(cls).test(line[prop]))return!1;line[prop]+=" "+cls}else line[prop]=cls;return!0})}),removeLineClass:docMethodOp(function(handle,where,cls){return changeLine(this,handle,"gutter"==where?"gutter":"class",function(line){var prop="text"==where?"textClass":"background"==where?"bgClass":"gutter"==where?"gutterClass":"wrapClass",cur=line[prop];if(!cur)return!1;if(null==cls)line[prop]=null;else{var found=cur.match(classTest(cls));if(!found)return!1;var end=found.index+found[0].length;line[prop]=cur.slice(0,found.index)+(found.index&&end!=cur.length?" ":"")+cur.slice(end)||null}return!0})}),addLineWidget:docMethodOp(function(handle,node,options){return addLineWidget(this,handle,node,options)}),removeLineWidget:function(widget){widget.clear()},markText:function(from,to,options){return markText(this,clipPos(this,from),clipPos(this,to),options,options&&options.type||"range")},setBookmark:function(pos,options){var realOpts={replacedWith:options&&(null==options.nodeType?options.widget:options),insertLeft:options&&options.insertLeft,clearWhenEmpty:!1,shared:options&&options.shared,handleMouseEvents:options&&options.handleMouseEvents};return pos=clipPos(this,pos),markText(this,pos,pos,realOpts,"bookmark")},findMarksAt:function(pos){var markers=[],spans=getLine(this,(pos=clipPos(this,pos)).line).markedSpans;if(spans)for(var i=0;i<spans.length;++i){var span=spans[i];(null==span.from||span.from<=pos.ch)&&(null==span.to||span.to>=pos.ch)&&markers.push(span.marker.parent||span.marker)}return markers},findMarks:function(from,to,filter){from=clipPos(this,from),to=clipPos(this,to);var found=[],lineNo$$1=from.line;return this.iter(from.line,to.line+1,function(line){var spans=line.markedSpans;if(spans)for(var i=0;i<spans.length;i++){var span=spans[i];null!=span.to&&lineNo$$1==from.line&&from.ch>=span.to||null==span.from&&lineNo$$1!=from.line||null!=span.from&&lineNo$$1==to.line&&span.from>=to.ch||filter&&!filter(span.marker)||found.push(span.marker.parent||span.marker)}++lineNo$$1}),found},getAllMarks:function(){var markers=[];return this.iter(function(line){var sps=line.markedSpans;if(sps)for(var i=0;i<sps.length;++i)null!=sps[i].from&&markers.push(sps[i].marker)}),markers},posFromIndex:function(off){var ch,lineNo$$1=this.first,sepSize=this.lineSeparator().length;return this.iter(function(line){var sz=line.text.length+sepSize;if(sz>off)return ch=off,!0;off-=sz,++lineNo$$1}),clipPos(this,Pos(lineNo$$1,ch))},indexFromPos:function(coords){var index=(coords=clipPos(this,coords)).ch;if(coords.line<this.first||coords.ch<0)return 0;var sepSize=this.lineSeparator().length;return this.iter(this.first,coords.line,function(line){index+=line.text.length+sepSize}),index},copy:function(copyHistory){var doc=new Doc(getLines(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return doc.scrollTop=this.scrollTop,doc.scrollLeft=this.scrollLeft,doc.sel=this.sel,doc.extend=!1,copyHistory&&(doc.history.undoDepth=this.history.undoDepth,doc.setHistory(this.getHistory())),doc},linkedDoc:function(options){options||(options={});var from=this.first,to=this.first+this.size;null!=options.from&&options.from>from&&(from=options.from),null!=options.to&&options.to<to&&(to=options.to);var copy=new Doc(getLines(this,from,to),options.mode||this.modeOption,from,this.lineSep,this.direction);return options.sharedHist&&(copy.history=this.history),(this.linked||(this.linked=[])).push({doc:copy,sharedHist:options.sharedHist}),copy.linked=[{doc:this,isParent:!0,sharedHist:options.sharedHist}],copySharedMarkers(copy,findSharedMarkers(this)),copy},unlinkDoc:function(other){var this$1=this;if(other instanceof CodeMirror$1&&(other=other.doc),this.linked)for(var i=0;i<this.linked.length;++i)if(this$1.linked[i].doc==other){this$1.linked.splice(i,1),other.unlinkDoc(this$1),detachSharedMarkers(findSharedMarkers(this$1));break}if(other.history==this.history){var splitIds=[other.id];linkedDocs(other,function(doc){return splitIds.push(doc.id)},!0),other.history=new History(null),other.history.done=copyHistoryArray(this.history.done,splitIds),other.history.undone=copyHistoryArray(this.history.undone,splitIds)}},iterLinkedDocs:function(f){linkedDocs(this,f)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(str){return this.lineSep?str.split(this.lineSep):splitLinesAuto(str)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:docMethodOp(function(dir){"rtl"!=dir&&(dir="ltr"),dir!=this.direction&&(this.direction=dir,this.iter(function(line){return line.order=null}),this.cm&&directionChanged(this.cm))})}),Doc.prototype.eachLine=Doc.prototype.iter;for(var lastDrop=0,globalsRegistered=!1,keyNames={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},i=0;i<10;i++)keyNames[i+48]=keyNames[i+96]=String(i);for(var i$1=65;i$1<=90;i$1++)keyNames[i$1]=String.fromCharCode(i$1);for(var i$2=1;i$2<=12;i$2++)keyNames[i$2+111]=keyNames[i$2+63235]="F"+i$2;var keyMap={};keyMap.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},keyMap.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},keyMap.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},keyMap.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},keyMap.default=mac?keyMap.macDefault:keyMap.pcDefault;var commands={selectAll:selectAll,singleSelection:function(cm){return cm.setSelection(cm.getCursor("anchor"),cm.getCursor("head"),sel_dontScroll)},killLine:function(cm){return deleteNearSelection(cm,function(range){if(range.empty()){var len=getLine(cm.doc,range.head.line).text.length;return range.head.ch==len&&range.head.line<cm.lastLine()?{from:range.head,to:Pos(range.head.line+1,0)}:{from:range.head,to:Pos(range.head.line,len)}}return{from:range.from(),to:range.to()}})},deleteLine:function(cm){return deleteNearSelection(cm,function(range){return{from:Pos(range.from().line,0),to:clipPos(cm.doc,Pos(range.to().line+1,0))}})},delLineLeft:function(cm){return deleteNearSelection(cm,function(range){return{from:Pos(range.from().line,0),to:range.from()}})},delWrappedLineLeft:function(cm){return deleteNearSelection(cm,function(range){var top=cm.charCoords(range.head,"div").top+5;return{from:cm.coordsChar({left:0,top:top},"div"),to:range.from()}})},delWrappedLineRight:function(cm){return deleteNearSelection(cm,function(range){var top=cm.charCoords(range.head,"div").top+5,rightPos=cm.coordsChar({left:cm.display.lineDiv.offsetWidth+100,top:top},"div");return{from:range.from(),to:rightPos}})},undo:function(cm){return cm.undo()},redo:function(cm){return cm.redo()},undoSelection:function(cm){return cm.undoSelection()},redoSelection:function(cm){return cm.redoSelection()},goDocStart:function(cm){return cm.extendSelection(Pos(cm.firstLine(),0))},goDocEnd:function(cm){return cm.extendSelection(Pos(cm.lastLine()))},goLineStart:function(cm){return cm.extendSelectionsBy(function(range){return lineStart(cm,range.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(cm){return cm.extendSelectionsBy(function(range){return lineStartSmart(cm,range.head)},{origin:"+move",bias:1})},goLineEnd:function(cm){return cm.extendSelectionsBy(function(range){return lineEnd(cm,range.head.line)},{origin:"+move",bias:-1})},goLineRight:function(cm){return cm.extendSelectionsBy(function(range){var top=cm.charCoords(range.head,"div").top+5;return cm.coordsChar({left:cm.display.lineDiv.offsetWidth+100,top:top},"div")},sel_move)},goLineLeft:function(cm){return cm.extendSelectionsBy(function(range){var top=cm.charCoords(range.head,"div").top+5;return cm.coordsChar({left:0,top:top},"div")},sel_move)},goLineLeftSmart:function(cm){return cm.extendSelectionsBy(function(range){var top=cm.charCoords(range.head,"div").top+5,pos=cm.coordsChar({left:0,top:top},"div");return pos.ch<cm.getLine(pos.line).search(/\S/)?lineStartSmart(cm,range.head):pos},sel_move)},goLineUp:function(cm){return cm.moveV(-1,"line")},goLineDown:function(cm){return cm.moveV(1,"line")},goPageUp:function(cm){return cm.moveV(-1,"page")},goPageDown:function(cm){return cm.moveV(1,"page")},goCharLeft:function(cm){return cm.moveH(-1,"char")},goCharRight:function(cm){return cm.moveH(1,"char")},goColumnLeft:function(cm){return cm.moveH(-1,"column")},goColumnRight:function(cm){return cm.moveH(1,"column")},goWordLeft:function(cm){return cm.moveH(-1,"word")},goGroupRight:function(cm){return cm.moveH(1,"group")},goGroupLeft:function(cm){return cm.moveH(-1,"group")},goWordRight:function(cm){return cm.moveH(1,"word")},delCharBefore:function(cm){return cm.deleteH(-1,"char")},delCharAfter:function(cm){return cm.deleteH(1,"char")},delWordBefore:function(cm){return cm.deleteH(-1,"word")},delWordAfter:function(cm){return cm.deleteH(1,"word")},delGroupBefore:function(cm){return cm.deleteH(-1,"group")},delGroupAfter:function(cm){return cm.deleteH(1,"group")},indentAuto:function(cm){return cm.indentSelection("smart")},indentMore:function(cm){return cm.indentSelection("add")},indentLess:function(cm){return cm.indentSelection("subtract")},insertTab:function(cm){return cm.replaceSelection("\t")},insertSoftTab:function(cm){for(var spaces=[],ranges=cm.listSelections(),tabSize=cm.options.tabSize,i=0;i<ranges.length;i++){var pos=ranges[i].from(),col=countColumn(cm.getLine(pos.line),pos.ch,tabSize);spaces.push(spaceStr(tabSize-col%tabSize))}cm.replaceSelections(spaces)},defaultTab:function(cm){cm.somethingSelected()?cm.indentSelection("add"):cm.execCommand("insertTab")},transposeChars:function(cm){return runInOp(cm,function(){for(var ranges=cm.listSelections(),newSel=[],i=0;i<ranges.length;i++)if(ranges[i].empty()){var cur=ranges[i].head,line=getLine(cm.doc,cur.line).text;if(line)if(cur.ch==line.length&&(cur=new Pos(cur.line,cur.ch-1)),cur.ch>0)cur=new Pos(cur.line,cur.ch+1),cm.replaceRange(line.charAt(cur.ch-1)+line.charAt(cur.ch-2),Pos(cur.line,cur.ch-2),cur,"+transpose");else if(cur.line>cm.doc.first){var prev=getLine(cm.doc,cur.line-1).text;prev&&(cur=new Pos(cur.line,1),cm.replaceRange(line.charAt(0)+cm.doc.lineSeparator()+prev.charAt(prev.length-1),Pos(cur.line-1,prev.length-1),cur,"+transpose"))}newSel.push(new Range(cur,cur))}cm.setSelections(newSel)})},newlineAndIndent:function(cm){return runInOp(cm,function(){for(var sels=cm.listSelections(),i=sels.length-1;i>=0;i--)cm.replaceRange(cm.doc.lineSeparator(),sels[i].anchor,sels[i].head,"+input");sels=cm.listSelections();for(var i$1=0;i$1<sels.length;i$1++)cm.indentLine(sels[i$1].from().line,null,!0);ensureCursorVisible(cm)})},openLine:function(cm){return cm.replaceSelection("\n","start")},toggleOverwrite:function(cm){return cm.toggleOverwrite()}},stopSeq=new Delayed,lastStoppedKey=null,PastClick=function(time,pos,button){this.time=time,this.pos=pos,this.button=button};PastClick.prototype.compare=function(time,pos,button){return this.time+400>time&&0==cmp(pos,this.pos)&&button==this.button};var lastClick,lastDoubleClick,Init={toString:function(){return"CodeMirror.Init"}},defaults={},optionHandlers={};CodeMirror$1.defaults=defaults,CodeMirror$1.optionHandlers=optionHandlers;var initHooks=[];CodeMirror$1.defineInitHook=function(f){return initHooks.push(f)};var lastCopied=null,ContentEditableInput=function(cm){this.cm=cm,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Delayed,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};ContentEditableInput.prototype.init=function(display){function onCopyCut(e){if(!signalDOMEvent(cm,e)){if(cm.somethingSelected())setLastCopied({lineWise:!1,text:cm.getSelections()}),"cut"==e.type&&cm.replaceSelection("",null,"cut");else{if(!cm.options.lineWiseCopyCut)return;var ranges=copyableRanges(cm);setLastCopied({lineWise:!0,text:ranges.text}),"cut"==e.type&&cm.operation(function(){cm.setSelections(ranges.ranges,0,sel_dontScroll),cm.replaceSelection("",null,"cut")})}if(e.clipboardData){e.clipboardData.clearData();var content=lastCopied.text.join("\n");if(e.clipboardData.setData("Text",content),e.clipboardData.getData("Text")==content)return void e.preventDefault()}var kludge=hiddenTextarea(),te=kludge.firstChild;cm.display.lineSpace.insertBefore(kludge,cm.display.lineSpace.firstChild),te.value=lastCopied.text.join("\n");var hadFocus=document.activeElement;selectInput(te),setTimeout(function(){cm.display.lineSpace.removeChild(kludge),hadFocus.focus(),hadFocus==div&&input.showPrimarySelection()},50)}}var this$1=this,input=this,cm=input.cm,div=input.div=display.lineDiv;disableBrowserMagic(div,cm.options.spellcheck),on(div,"paste",function(e){signalDOMEvent(cm,e)||handlePaste(e,cm)||ie_version<=11&&setTimeout(operation(cm,function(){return this$1.updateFromDOM()}),20)}),on(div,"compositionstart",function(e){this$1.composing={data:e.data,done:!1}}),on(div,"compositionupdate",function(e){this$1.composing||(this$1.composing={data:e.data,done:!1})}),on(div,"compositionend",function(e){this$1.composing&&(e.data!=this$1.composing.data&&this$1.readFromDOMSoon(),this$1.composing.done=!0)}),on(div,"touchstart",function(){return input.forceCompositionEnd()}),on(div,"input",function(){this$1.composing||this$1.readFromDOMSoon()}),on(div,"copy",onCopyCut),on(div,"cut",onCopyCut)},ContentEditableInput.prototype.prepareSelection=function(){var result=prepareSelection(this.cm,!1);return result.focus=this.cm.state.focused,result},ContentEditableInput.prototype.showSelection=function(info,takeFocus){info&&this.cm.display.view.length&&((info.focus||takeFocus)&&this.showPrimarySelection(),this.showMultipleSelections(info))},ContentEditableInput.prototype.showPrimarySelection=function(){var sel=window.getSelection(),cm=this.cm,prim=cm.doc.sel.primary(),from=prim.from(),to=prim.to();if(cm.display.viewTo==cm.display.viewFrom||from.line>=cm.display.viewTo||to.line<cm.display.viewFrom)sel.removeAllRanges();else{var curAnchor=domToPos(cm,sel.anchorNode,sel.anchorOffset),curFocus=domToPos(cm,sel.focusNode,sel.focusOffset);if(!curAnchor||curAnchor.bad||!curFocus||curFocus.bad||0!=cmp(minPos(curAnchor,curFocus),from)||0!=cmp(maxPos(curAnchor,curFocus),to)){var view=cm.display.view,start=from.line>=cm.display.viewFrom&&posToDOM(cm,from)||{node:view[0].measure.map[2],offset:0},end=to.line<cm.display.viewTo&&posToDOM(cm,to);if(!end){var measure=view[view.length-1].measure,map$$1=measure.maps?measure.maps[measure.maps.length-1]:measure.map;end={node:map$$1[map$$1.length-1],offset:map$$1[map$$1.length-2]-map$$1[map$$1.length-3]}}if(start&&end){var rng,old=sel.rangeCount&&sel.getRangeAt(0);try{rng=range(start.node,start.offset,end.offset,end.node)}catch(e){}rng&&(!gecko&&cm.state.focused?(sel.collapse(start.node,start.offset),rng.collapsed||(sel.removeAllRanges(),sel.addRange(rng))):(sel.removeAllRanges(),sel.addRange(rng)),old&&null==sel.anchorNode?sel.addRange(old):gecko&&this.startGracePeriod()),this.rememberSelection()}else sel.removeAllRanges()}}},ContentEditableInput.prototype.startGracePeriod=function(){var this$1=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){this$1.gracePeriod=!1,this$1.selectionChanged()&&this$1.cm.operation(function(){return this$1.cm.curOp.selectionChanged=!0})},20)},ContentEditableInput.prototype.showMultipleSelections=function(info){removeChildrenAndAdd(this.cm.display.cursorDiv,info.cursors),removeChildrenAndAdd(this.cm.display.selectionDiv,info.selection)},ContentEditableInput.prototype.rememberSelection=function(){var sel=window.getSelection();this.lastAnchorNode=sel.anchorNode,this.lastAnchorOffset=sel.anchorOffset,this.lastFocusNode=sel.focusNode,this.lastFocusOffset=sel.focusOffset},ContentEditableInput.prototype.selectionInEditor=function(){var sel=window.getSelection();if(!sel.rangeCount)return!1;var node=sel.getRangeAt(0).commonAncestorContainer;return contains(this.div,node)},ContentEditableInput.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()||this.showSelection(this.prepareSelection(),!0),this.div.focus())},ContentEditableInput.prototype.blur=function(){this.div.blur()},ContentEditableInput.prototype.getField=function(){return this.div},ContentEditableInput.prototype.supportsTouch=function(){return!0},ContentEditableInput.prototype.receivedFocus=function(){function poll(){input.cm.state.focused&&(input.pollSelection(),input.polling.set(input.cm.options.pollInterval,poll))}var input=this;this.selectionInEditor()?this.pollSelection():runInOp(this.cm,function(){return input.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,poll)},ContentEditableInput.prototype.selectionChanged=function(){var sel=window.getSelection();return sel.anchorNode!=this.lastAnchorNode||sel.anchorOffset!=this.lastAnchorOffset||sel.focusNode!=this.lastFocusNode||sel.focusOffset!=this.lastFocusOffset},ContentEditableInput.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var sel=window.getSelection(),cm=this.cm;if(android&&chrome&&this.cm.options.gutters.length&&isInGutter(sel.anchorNode))return this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),void this.focus();if(!this.composing){this.rememberSelection();var anchor=domToPos(cm,sel.anchorNode,sel.anchorOffset),head=domToPos(cm,sel.focusNode,sel.focusOffset);anchor&&head&&runInOp(cm,function(){setSelection(cm.doc,simpleSelection(anchor,head),sel_dontScroll),(anchor.bad||head.bad)&&(cm.curOp.selectionChanged=!0)})}}},ContentEditableInput.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var cm=this.cm,display=cm.display,sel=cm.doc.sel.primary(),from=sel.from(),to=sel.to();if(0==from.ch&&from.line>cm.firstLine()&&(from=Pos(from.line-1,getLine(cm.doc,from.line-1).length)),to.ch==getLine(cm.doc,to.line).text.length&&to.line<cm.lastLine()&&(to=Pos(to.line+1,0)),from.line<display.viewFrom||to.line>display.viewTo-1)return!1;var fromIndex,fromLine,fromNode;from.line==display.viewFrom||0==(fromIndex=findViewIndex(cm,from.line))?(fromLine=lineNo(display.view[0].line),fromNode=display.view[0].node):(fromLine=lineNo(display.view[fromIndex].line),fromNode=display.view[fromIndex-1].node.nextSibling);var toLine,toNode,toIndex=findViewIndex(cm,to.line);if(toIndex==display.view.length-1?(toLine=display.viewTo-1,toNode=display.lineDiv.lastChild):(toLine=lineNo(display.view[toIndex+1].line)-1,toNode=display.view[toIndex+1].node.previousSibling),!fromNode)return!1;for(var newText=cm.doc.splitLines(domTextBetween(cm,fromNode,toNode,fromLine,toLine)),oldText=getBetween(cm.doc,Pos(fromLine,0),Pos(toLine,getLine(cm.doc,toLine).text.length));newText.length>1&&oldText.length>1;)if(lst(newText)==lst(oldText))newText.pop(),oldText.pop(),toLine--;else{if(newText[0]!=oldText[0])break;newText.shift(),oldText.shift(),fromLine++}for(var cutFront=0,cutEnd=0,newTop=newText[0],oldTop=oldText[0],maxCutFront=Math.min(newTop.length,oldTop.length);cutFront<maxCutFront&&newTop.charCodeAt(cutFront)==oldTop.charCodeAt(cutFront);)++cutFront;for(var newBot=lst(newText),oldBot=lst(oldText),maxCutEnd=Math.min(newBot.length-(1==newText.length?cutFront:0),oldBot.length-(1==oldText.length?cutFront:0));cutEnd<maxCutEnd&&newBot.charCodeAt(newBot.length-cutEnd-1)==oldBot.charCodeAt(oldBot.length-cutEnd-1);)++cutEnd;if(1==newText.length&&1==oldText.length&&fromLine==from.line)for(;cutFront&&cutFront>from.ch&&newBot.charCodeAt(newBot.length-cutEnd-1)==oldBot.charCodeAt(oldBot.length-cutEnd-1);)cutFront--,cutEnd++;newText[newText.length-1]=newBot.slice(0,newBot.length-cutEnd).replace(/^\u200b+/,""),newText[0]=newText[0].slice(cutFront).replace(/\u200b+$/,"");var chFrom=Pos(fromLine,cutFront),chTo=Pos(toLine,oldText.length?lst(oldText).length-cutEnd:0);return newText.length>1||newText[0]||cmp(chFrom,chTo)?(replaceRange(cm.doc,newText,chFrom,chTo,"+input"),!0):void 0},ContentEditableInput.prototype.ensurePolled=function(){this.forceCompositionEnd()},ContentEditableInput.prototype.reset=function(){this.forceCompositionEnd()},ContentEditableInput.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},ContentEditableInput.prototype.readFromDOMSoon=function(){var this$1=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout(function(){if(this$1.readDOMTimeout=null,this$1.composing){if(!this$1.composing.done)return;this$1.composing=null}this$1.updateFromDOM()},80))},ContentEditableInput.prototype.updateFromDOM=function(){var this$1=this;!this.cm.isReadOnly()&&this.pollContent()||runInOp(this.cm,function(){return regChange(this$1.cm)})},ContentEditableInput.prototype.setUneditable=function(node){node.contentEditable="false"},ContentEditableInput.prototype.onKeyPress=function(e){0!=e.charCode&&(e.preventDefault(),this.cm.isReadOnly()||operation(this.cm,applyTextInput)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},ContentEditableInput.prototype.readOnlyChanged=function(val){this.div.contentEditable=String("nocursor"!=val)},ContentEditableInput.prototype.onContextMenu=function(){},ContentEditableInput.prototype.resetPosition=function(){},ContentEditableInput.prototype.needsContentAttribute=!0;var TextareaInput=function(cm){this.cm=cm,this.prevInput="",this.pollingFast=!1,this.polling=new Delayed,this.inaccurateSelection=!1,this.hasSelection=!1,this.composing=null};TextareaInput.prototype.init=function(display){function prepareCopyCut(e){if(!signalDOMEvent(cm,e)){if(cm.somethingSelected())setLastCopied({lineWise:!1,text:cm.getSelections()}),input.inaccurateSelection&&(input.prevInput="",input.inaccurateSelection=!1,te.value=lastCopied.text.join("\n"),selectInput(te));else{if(!cm.options.lineWiseCopyCut)return;var ranges=copyableRanges(cm);setLastCopied({lineWise:!0,text:ranges.text}),"cut"==e.type?cm.setSelections(ranges.ranges,null,sel_dontScroll):(input.prevInput="",te.value=ranges.text.join("\n"),selectInput(te))}"cut"==e.type&&(cm.state.cutIncoming=!0)}}var this$1=this,input=this,cm=this.cm,div=this.wrapper=hiddenTextarea(),te=this.textarea=div.firstChild;display.wrapper.insertBefore(div,display.wrapper.firstChild),ios&&(te.style.width="0px"),on(te,"input",function(){ie&&ie_version>=9&&this$1.hasSelection&&(this$1.hasSelection=null),input.poll()}),on(te,"paste",function(e){signalDOMEvent(cm,e)||handlePaste(e,cm)||(cm.state.pasteIncoming=!0,input.fastPoll())}),on(te,"cut",prepareCopyCut),on(te,"copy",prepareCopyCut),on(display.scroller,"paste",function(e){eventInWidget(display,e)||signalDOMEvent(cm,e)||(cm.state.pasteIncoming=!0,input.focus())}),on(display.lineSpace,"selectstart",function(e){eventInWidget(display,e)||e_preventDefault(e)}),on(te,"compositionstart",function(){var start=cm.getCursor("from");input.composing&&input.composing.range.clear(),input.composing={start:start,range:cm.markText(start,cm.getCursor("to"),{className:"CodeMirror-composing"})}}),on(te,"compositionend",function(){input.composing&&(input.poll(),input.composing.range.clear(),input.composing=null)})},TextareaInput.prototype.prepareSelection=function(){var cm=this.cm,display=cm.display,doc=cm.doc,result=prepareSelection(cm);if(cm.options.moveInputWithCursor){var headPos=cursorCoords(cm,doc.sel.primary().head,"div"),wrapOff=display.wrapper.getBoundingClientRect(),lineOff=display.lineDiv.getBoundingClientRect();result.teTop=Math.max(0,Math.min(display.wrapper.clientHeight-10,headPos.top+lineOff.top-wrapOff.top)),result.teLeft=Math.max(0,Math.min(display.wrapper.clientWidth-10,headPos.left+lineOff.left-wrapOff.left))}return result},TextareaInput.prototype.showSelection=function(drawn){var display=this.cm.display;removeChildrenAndAdd(display.cursorDiv,drawn.cursors),removeChildrenAndAdd(display.selectionDiv,drawn.selection),null!=drawn.teTop&&(this.wrapper.style.top=drawn.teTop+"px",this.wrapper.style.left=drawn.teLeft+"px")},TextareaInput.prototype.reset=function(typing){if(!this.contextMenuPending&&!this.composing){var minimal,selected,cm=this.cm,doc=cm.doc;if(cm.somethingSelected()){this.prevInput="";var range$$1=doc.sel.primary(),content=(minimal=hasCopyEvent&&(range$$1.to().line-range$$1.from().line>100||(selected=cm.getSelection()).length>1e3))?"-":selected||cm.getSelection();this.textarea.value=content,cm.state.focused&&selectInput(this.textarea),ie&&ie_version>=9&&(this.hasSelection=content)}else typing||(this.prevInput=this.textarea.value="",ie&&ie_version>=9&&(this.hasSelection=null));this.inaccurateSelection=minimal}},TextareaInput.prototype.getField=function(){return this.textarea},TextareaInput.prototype.supportsTouch=function(){return!1},TextareaInput.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!mobile||activeElt()!=this.textarea))try{this.textarea.focus()}catch(e){}},TextareaInput.prototype.blur=function(){this.textarea.blur()},TextareaInput.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},TextareaInput.prototype.receivedFocus=function(){this.slowPoll()},TextareaInput.prototype.slowPoll=function(){var this$1=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){this$1.poll(),this$1.cm.state.focused&&this$1.slowPoll()})},TextareaInput.prototype.fastPoll=function(){function p(){input.poll()||missed?(input.pollingFast=!1,input.slowPoll()):(missed=!0,input.polling.set(60,p))}var missed=!1,input=this;input.pollingFast=!0,input.polling.set(20,p)},TextareaInput.prototype.poll=function(){var this$1=this,cm=this.cm,input=this.textarea,prevInput=this.prevInput;if(this.contextMenuPending||!cm.state.focused||hasSelection(input)&&!prevInput&&!this.composing||cm.isReadOnly()||cm.options.disableInput||cm.state.keySeq)return!1;var text=input.value;if(text==prevInput&&!cm.somethingSelected())return!1;if(ie&&ie_version>=9&&this.hasSelection===text||mac&&/[\uf700-\uf7ff]/.test(text))return cm.display.input.reset(),!1;if(cm.doc.sel==cm.display.selForContextMenu){var first=text.charCodeAt(0);if(8203!=first||prevInput||(prevInput=""),8666==first)return this.reset(),this.cm.execCommand("undo")}for(var same=0,l=Math.min(prevInput.length,text.length);same<l&&prevInput.charCodeAt(same)==text.charCodeAt(same);)++same;return runInOp(cm,function(){applyTextInput(cm,text.slice(same),prevInput.length-same,null,this$1.composing?"*compose":null),text.length>1e3||text.indexOf("\n")>-1?input.value=this$1.prevInput="":this$1.prevInput=text,this$1.composing&&(this$1.composing.range.clear(),this$1.composing.range=cm.markText(this$1.composing.start,cm.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},TextareaInput.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},TextareaInput.prototype.onKeyPress=function(){ie&&ie_version>=9&&(this.hasSelection=null),this.fastPoll()},TextareaInput.prototype.onContextMenu=function(e){function prepareSelectAllHack(){if(null!=te.selectionStart){var selected=cm.somethingSelected(),extval=""+(selected?te.value:"");te.value="⇚",te.value=extval,input.prevInput=selected?"":"",te.selectionStart=1,te.selectionEnd=extval.length,display.selForContextMenu=cm.doc.sel}}function rehide(){if(input.contextMenuPending=!1,input.wrapper.style.cssText=oldWrapperCSS,te.style.cssText=oldCSS,ie&&ie_version<9&&display.scrollbars.setScrollTop(display.scroller.scrollTop=scrollPos),null!=te.selectionStart){(!ie||ie&&ie_version<9)&&prepareSelectAllHack();var i=0,poll=function(){display.selForContextMenu==cm.doc.sel&&0==te.selectionStart&&te.selectionEnd>0&&""==input.prevInput?operation(cm,selectAll)(cm):i++<10?display.detectingSelectAll=setTimeout(poll,500):(display.selForContextMenu=null,display.input.reset())};display.detectingSelectAll=setTimeout(poll,200)}}var input=this,cm=input.cm,display=cm.display,te=input.textarea,pos=posFromMouse(cm,e),scrollPos=display.scroller.scrollTop;if(pos&&!presto){cm.options.resetSelectionOnContextMenu&&-1==cm.doc.sel.contains(pos)&&operation(cm,setSelection)(cm.doc,simpleSelection(pos),sel_dontScroll);var oldCSS=te.style.cssText,oldWrapperCSS=input.wrapper.style.cssText;input.wrapper.style.cssText="position: absolute";var wrapperBox=input.wrapper.getBoundingClientRect();te.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-wrapperBox.top-5)+"px; left: "+(e.clientX-wrapperBox.left-5)+"px;\n z-index: 1000; background: "+(ie?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";var oldScrollY;if(webkit&&(oldScrollY=window.scrollY),display.input.focus(),webkit&&window.scrollTo(null,oldScrollY),display.input.reset(),cm.somethingSelected()||(te.value=input.prevInput=" "),input.contextMenuPending=!0,display.selForContextMenu=cm.doc.sel,clearTimeout(display.detectingSelectAll),ie&&ie_version>=9&&prepareSelectAllHack(),captureRightClick){e_stop(e);var mouseup=function(){off(window,"mouseup",mouseup),setTimeout(rehide,20)};on(window,"mouseup",mouseup)}else setTimeout(rehide,50)}},TextareaInput.prototype.readOnlyChanged=function(val){val||this.reset(),this.textarea.disabled="nocursor"==val},TextareaInput.prototype.setUneditable=function(){},TextareaInput.prototype.needsContentAttribute=!1,function(CodeMirror){function option(name,deflt,handle,notOnInit){CodeMirror.defaults[name]=deflt,handle&&(optionHandlers[name]=notOnInit?function(cm,val,old){old!=Init&&handle(cm,val,old)}:handle)}var optionHandlers=CodeMirror.optionHandlers;CodeMirror.defineOption=option,CodeMirror.Init=Init,option("value","",function(cm,val){return cm.setValue(val)},!0),option("mode",null,function(cm,val){cm.doc.modeOption=val,loadMode(cm)},!0),option("indentUnit",2,loadMode,!0),option("indentWithTabs",!1),option("smartIndent",!0),option("tabSize",4,function(cm){resetModeState(cm),clearCaches(cm),regChange(cm)},!0),option("lineSeparator",null,function(cm,val){if(cm.doc.lineSep=val,val){var newBreaks=[],lineNo=cm.doc.first;cm.doc.iter(function(line){for(var pos=0;;){var found=line.text.indexOf(val,pos);if(-1==found)break;pos=found+val.length,newBreaks.push(Pos(lineNo,found))}lineNo++});for(var i=newBreaks.length-1;i>=0;i--)replaceRange(cm.doc,val,newBreaks[i],Pos(newBreaks[i].line,newBreaks[i].ch+val.length))}}),option("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g,function(cm,val,old){cm.state.specialChars=new RegExp(val.source+(val.test("\t")?"":"|\t"),"g"),old!=Init&&cm.refresh()}),option("specialCharPlaceholder",defaultSpecialCharPlaceholder,function(cm){return cm.refresh()},!0),option("electricChars",!0),option("inputStyle",mobile?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),option("spellcheck",!1,function(cm,val){return cm.getInputField().spellcheck=val},!0),option("rtlMoveVisually",!windows),option("wholeLineUpdateBefore",!0),option("theme","default",function(cm){themeChanged(cm),guttersChanged(cm)},!0),option("keyMap","default",function(cm,val,old){var next=getKeyMap(val),prev=old!=Init&&getKeyMap(old);prev&&prev.detach&&prev.detach(cm,next),next.attach&&next.attach(cm,prev||null)}),option("extraKeys",null),option("configureMouse",null),option("lineWrapping",!1,wrappingChanged,!0),option("gutters",[],function(cm){setGuttersForLineNumbers(cm.options),guttersChanged(cm)},!0),option("fixedGutter",!0,function(cm,val){cm.display.gutters.style.left=val?compensateForHScroll(cm.display)+"px":"0",cm.refresh()},!0),option("coverGutterNextToScrollbar",!1,function(cm){return updateScrollbars(cm)},!0),option("scrollbarStyle","native",function(cm){initScrollbars(cm),updateScrollbars(cm),cm.display.scrollbars.setScrollTop(cm.doc.scrollTop),cm.display.scrollbars.setScrollLeft(cm.doc.scrollLeft)},!0),option("lineNumbers",!1,function(cm){setGuttersForLineNumbers(cm.options),guttersChanged(cm)},!0),option("firstLineNumber",1,guttersChanged,!0),option("lineNumberFormatter",function(integer){return integer},guttersChanged,!0),option("showCursorWhenSelecting",!1,updateSelection,!0),option("resetSelectionOnContextMenu",!0),option("lineWiseCopyCut",!0),option("pasteLinesPerSelection",!0),option("readOnly",!1,function(cm,val){"nocursor"==val&&(onBlur(cm),cm.display.input.blur()),cm.display.input.readOnlyChanged(val)}),option("disableInput",!1,function(cm,val){val||cm.display.input.reset()},!0),option("dragDrop",!0,dragDropChanged),option("allowDropFileTypes",null),option("cursorBlinkRate",530),option("cursorScrollMargin",0),option("cursorHeight",1,updateSelection,!0),option("singleCursorHeightPerLine",!0,updateSelection,!0),option("workTime",100),option("workDelay",100),option("flattenSpans",!0,resetModeState,!0),option("addModeClass",!1,resetModeState,!0),option("pollInterval",100),option("undoDepth",200,function(cm,val){return cm.doc.history.undoDepth=val}),option("historyEventDelay",1250),option("viewportMargin",10,function(cm){return cm.refresh()},!0),option("maxHighlightLength",1e4,resetModeState,!0),option("moveInputWithCursor",!0,function(cm,val){val||cm.display.input.resetPosition()}),option("tabindex",null,function(cm,val){return cm.display.input.getField().tabIndex=val||""}),option("autofocus",null),option("direction","ltr",function(cm,val){return cm.doc.setDirection(val)},!0)}(CodeMirror$1),function(CodeMirror){var optionHandlers=CodeMirror.optionHandlers,helpers=CodeMirror.helpers={};CodeMirror.prototype={constructor:CodeMirror,focus:function(){window.focus(),this.display.input.focus()},setOption:function(option,value){var options=this.options,old=options[option];options[option]==value&&"mode"!=option||(options[option]=value,optionHandlers.hasOwnProperty(option)&&operation(this,optionHandlers[option])(this,value,old),signal(this,"optionChange",this,option))},getOption:function(option){return this.options[option]},getDoc:function(){return this.doc},addKeyMap:function(map$$1,bottom){this.state.keyMaps[bottom?"push":"unshift"](getKeyMap(map$$1))},removeKeyMap:function(map$$1){for(var maps=this.state.keyMaps,i=0;i<maps.length;++i)if(maps[i]==map$$1||maps[i].name==map$$1)return maps.splice(i,1),!0},addOverlay:methodOp(function(spec,options){var mode=spec.token?spec:CodeMirror.getMode(this.options,spec);if(mode.startState)throw new Error("Overlays may not be stateful.");insertSorted(this.state.overlays,{mode:mode,modeSpec:spec,opaque:options&&options.opaque,priority:options&&options.priority||0},function(overlay){return overlay.priority}),this.state.modeGen++,regChange(this)}),removeOverlay:methodOp(function(spec){for(var this$1=this,overlays=this.state.overlays,i=0;i<overlays.length;++i){var cur=overlays[i].modeSpec;if(cur==spec||"string"==typeof spec&&cur.name==spec)return overlays.splice(i,1),this$1.state.modeGen++,void regChange(this$1)}}),indentLine:methodOp(function(n,dir,aggressive){"string"!=typeof dir&&"number"!=typeof dir&&(dir=null==dir?this.options.smartIndent?"smart":"prev":dir?"add":"subtract"),isLine(this.doc,n)&&indentLine(this,n,dir,aggressive)}),indentSelection:methodOp(function(how){for(var this$1=this,ranges=this.doc.sel.ranges,end=-1,i=0;i<ranges.length;i++){var range$$1=ranges[i];if(range$$1.empty())range$$1.head.line>end&&(indentLine(this$1,range$$1.head.line,how,!0),end=range$$1.head.line,i==this$1.doc.sel.primIndex&&ensureCursorVisible(this$1));else{var from=range$$1.from(),to=range$$1.to(),start=Math.max(end,from.line);end=Math.min(this$1.lastLine(),to.line-(to.ch?0:1))+1;for(var j=start;j<end;++j)indentLine(this$1,j,how);var newRanges=this$1.doc.sel.ranges;0==from.ch&&ranges.length==newRanges.length&&newRanges[i].from().ch>0&&replaceOneSelection(this$1.doc,i,new Range(from,newRanges[i].to()),sel_dontScroll)}}}),getTokenAt:function(pos,precise){return takeToken(this,pos,precise)},getLineTokens:function(line,precise){return takeToken(this,Pos(line),precise,!0)},getTokenTypeAt:function(pos){pos=clipPos(this.doc,pos);var type,styles=getLineStyles(this,getLine(this.doc,pos.line)),before=0,after=(styles.length-1)/2,ch=pos.ch;if(0==ch)type=styles[2];else for(;;){var mid=before+after>>1;if((mid?styles[2*mid-1]:0)>=ch)after=mid;else{if(!(styles[2*mid+1]<ch)){type=styles[2*mid+2];break}before=mid+1}}var cut=type?type.indexOf("overlay "):-1;return cut<0?type:0==cut?null:type.slice(0,cut-1)},getModeAt:function(pos){var mode=this.doc.mode;return mode.innerMode?CodeMirror.innerMode(mode,this.getTokenAt(pos).state).mode:mode},getHelper:function(pos,type){return this.getHelpers(pos,type)[0]},getHelpers:function(pos,type){var this$1=this,found=[];if(!helpers.hasOwnProperty(type))return found;var help=helpers[type],mode=this.getModeAt(pos);if("string"==typeof mode[type])help[mode[type]]&&found.push(help[mode[type]]);else if(mode[type])for(var i=0;i<mode[type].length;i++){var val=help[mode[type][i]];val&&found.push(val)}else mode.helperType&&help[mode.helperType]?found.push(help[mode.helperType]):help[mode.name]&&found.push(help[mode.name]);for(var i$1=0;i$1<help._global.length;i$1++){var cur=help._global[i$1];cur.pred(mode,this$1)&&-1==indexOf(found,cur.val)&&found.push(cur.val)}return found},getStateAfter:function(line,precise){var doc=this.doc;return line=clipLine(doc,null==line?doc.first+doc.size-1:line),getContextBefore(this,line+1,precise).state},cursorCoords:function(start,mode){var pos,range$$1=this.doc.sel.primary();return pos=null==start?range$$1.head:"object"==typeof start?clipPos(this.doc,start):start?range$$1.from():range$$1.to(),cursorCoords(this,pos,mode||"page")},charCoords:function(pos,mode){return charCoords(this,clipPos(this.doc,pos),mode||"page")},coordsChar:function(coords,mode){return coords=fromCoordSystem(this,coords,mode||"page"),coordsChar(this,coords.left,coords.top)},lineAtHeight:function(height,mode){return height=fromCoordSystem(this,{top:height,left:0},mode||"page").top,lineAtHeight(this.doc,height+this.display.viewOffset)},heightAtLine:function(line,mode,includeWidgets){var lineObj,end=!1;if("number"==typeof line){var last=this.doc.first+this.doc.size-1;line<this.doc.first?line=this.doc.first:line>last&&(line=last,end=!0),lineObj=getLine(this.doc,line)}else lineObj=line;return intoCoordSystem(this,lineObj,{top:0,left:0},mode||"page",includeWidgets||end).top+(end?this.doc.height-heightAtLine(lineObj):0)},defaultTextHeight:function(){return textHeight(this.display)},defaultCharWidth:function(){return charWidth(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(pos,node,scroll,vert,horiz){var display=this.display,top=(pos=cursorCoords(this,clipPos(this.doc,pos))).bottom,left=pos.left;if(node.style.position="absolute",node.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(node),display.sizer.appendChild(node),"over"==vert)top=pos.top;else if("above"==vert||"near"==vert){var vspace=Math.max(display.wrapper.clientHeight,this.doc.height),hspace=Math.max(display.sizer.clientWidth,display.lineSpace.clientWidth);("above"==vert||pos.bottom+node.offsetHeight>vspace)&&pos.top>node.offsetHeight?top=pos.top-node.offsetHeight:pos.bottom+node.offsetHeight<=vspace&&(top=pos.bottom),left+node.offsetWidth>hspace&&(left=hspace-node.offsetWidth)}node.style.top=top+"px",node.style.left=node.style.right="","right"==horiz?(left=display.sizer.clientWidth-node.offsetWidth,node.style.right="0px"):("left"==horiz?left=0:"middle"==horiz&&(left=(display.sizer.clientWidth-node.offsetWidth)/2),node.style.left=left+"px"),scroll&&scrollIntoView(this,{left:left,top:top,right:left+node.offsetWidth,bottom:top+node.offsetHeight})},triggerOnKeyDown:methodOp(onKeyDown),triggerOnKeyPress:methodOp(onKeyPress),triggerOnKeyUp:onKeyUp,triggerOnMouseDown:methodOp(onMouseDown),execCommand:function(cmd){if(commands.hasOwnProperty(cmd))return commands[cmd].call(null,this)},triggerElectric:methodOp(function(text){triggerElectric(this,text)}),findPosH:function(from,amount,unit,visually){var this$1=this,dir=1;amount<0&&(dir=-1,amount=-amount);for(var cur=clipPos(this.doc,from),i=0;i<amount&&!(cur=findPosH(this$1.doc,cur,dir,unit,visually)).hitSide;++i);return cur},moveH:methodOp(function(dir,unit){var this$1=this;this.extendSelectionsBy(function(range$$1){return this$1.display.shift||this$1.doc.extend||range$$1.empty()?findPosH(this$1.doc,range$$1.head,dir,unit,this$1.options.rtlMoveVisually):dir<0?range$$1.from():range$$1.to()},sel_move)}),deleteH:methodOp(function(dir,unit){var sel=this.doc.sel,doc=this.doc;sel.somethingSelected()?doc.replaceSelection("",null,"+delete"):deleteNearSelection(this,function(range$$1){var other=findPosH(doc,range$$1.head,dir,unit,!1);return dir<0?{from:other,to:range$$1.head}:{from:range$$1.head,to:other}})}),findPosV:function(from,amount,unit,goalColumn){var this$1=this,dir=1,x=goalColumn;amount<0&&(dir=-1,amount=-amount);for(var cur=clipPos(this.doc,from),i=0;i<amount;++i){var coords=cursorCoords(this$1,cur,"div");if(null==x?x=coords.left:coords.left=x,(cur=findPosV(this$1,coords,dir,unit)).hitSide)break}return cur},moveV:methodOp(function(dir,unit){var this$1=this,doc=this.doc,goals=[],collapse=!this.display.shift&&!doc.extend&&doc.sel.somethingSelected();if(doc.extendSelectionsBy(function(range$$1){if(collapse)return dir<0?range$$1.from():range$$1.to();var headPos=cursorCoords(this$1,range$$1.head,"div");null!=range$$1.goalColumn&&(headPos.left=range$$1.goalColumn),goals.push(headPos.left);var pos=findPosV(this$1,headPos,dir,unit);return"page"==unit&&range$$1==doc.sel.primary()&&addToScrollTop(this$1,charCoords(this$1,pos,"div").top-headPos.top),pos},sel_move),goals.length)for(var i=0;i<doc.sel.ranges.length;i++)doc.sel.ranges[i].goalColumn=goals[i]}),findWordAt:function(pos){var line=getLine(this.doc,pos.line).text,start=pos.ch,end=pos.ch;if(line){var helper=this.getHelper(pos,"wordChars");"before"!=pos.sticky&&end!=line.length||!start?++end:--start;for(var startChar=line.charAt(start),check=isWordChar(startChar,helper)?function(ch){return isWordChar(ch,helper)}:/\s/.test(startChar)?function(ch){return/\s/.test(ch)}:function(ch){return!/\s/.test(ch)&&!isWordChar(ch)};start>0&&check(line.charAt(start-1));)--start;for(;end<line.length&&check(line.charAt(end));)++end}return new Range(Pos(pos.line,start),Pos(pos.line,end))},toggleOverwrite:function(value){null!=value&&value==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?addClass(this.display.cursorDiv,"CodeMirror-overwrite"):rmClass(this.display.cursorDiv,"CodeMirror-overwrite"),signal(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==activeElt()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:methodOp(function(x,y){scrollToCoords(this,x,y)}),getScrollInfo:function(){var scroller=this.display.scroller;return{left:scroller.scrollLeft,top:scroller.scrollTop,height:scroller.scrollHeight-scrollGap(this)-this.display.barHeight,width:scroller.scrollWidth-scrollGap(this)-this.display.barWidth,clientHeight:displayHeight(this),clientWidth:displayWidth(this)}},scrollIntoView:methodOp(function(range$$1,margin){null==range$$1?(range$$1={from:this.doc.sel.primary().head,to:null},null==margin&&(margin=this.options.cursorScrollMargin)):"number"==typeof range$$1?range$$1={from:Pos(range$$1,0),to:null}:null==range$$1.from&&(range$$1={from:range$$1,to:null}),range$$1.to||(range$$1.to=range$$1.from),range$$1.margin=margin||0,null!=range$$1.from.line?scrollToRange(this,range$$1):scrollToCoordsRange(this,range$$1.from,range$$1.to,range$$1.margin)}),setSize:methodOp(function(width,height){var this$1=this,interpret=function(val){return"number"==typeof val||/^\d+$/.test(String(val))?val+"px":val};null!=width&&(this.display.wrapper.style.width=interpret(width)),null!=height&&(this.display.wrapper.style.height=interpret(height)),this.options.lineWrapping&&clearLineMeasurementCache(this);var lineNo$$1=this.display.viewFrom;this.doc.iter(lineNo$$1,this.display.viewTo,function(line){if(line.widgets)for(var i=0;i<line.widgets.length;i++)if(line.widgets[i].noHScroll){regLineChange(this$1,lineNo$$1,"widget");break}++lineNo$$1}),this.curOp.forceUpdate=!0,signal(this,"refresh",this)}),operation:function(f){return runInOp(this,f)},refresh:methodOp(function(){var oldHeight=this.display.cachedTextHeight;regChange(this),this.curOp.forceUpdate=!0,clearCaches(this),scrollToCoords(this,this.doc.scrollLeft,this.doc.scrollTop),updateGutterSpace(this),(null==oldHeight||Math.abs(oldHeight-textHeight(this.display))>.5)&&estimateLineHeights(this),signal(this,"refresh",this)}),swapDoc:methodOp(function(doc){var old=this.doc;return old.cm=null,attachDoc(this,doc),clearCaches(this),this.display.input.reset(),scrollToCoords(this,doc.scrollLeft,doc.scrollTop),this.curOp.forceScroll=!0,signalLater(this,"swapDoc",this,old),old}),getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},eventMixin(CodeMirror),CodeMirror.registerHelper=function(type,name,value){helpers.hasOwnProperty(type)||(helpers[type]=CodeMirror[type]={_global:[]}),helpers[type][name]=value},CodeMirror.registerGlobalHelper=function(type,name,predicate,value){CodeMirror.registerHelper(type,name,value),helpers[type]._global.push({pred:predicate,val:value})}}(CodeMirror$1);var dontDelegate="iter insert remove copy getEditor constructor".split(" ");for(var prop in Doc.prototype)Doc.prototype.hasOwnProperty(prop)&&indexOf(dontDelegate,prop)<0&&(CodeMirror$1.prototype[prop]=function(method){return function(){return method.apply(this.doc,arguments)}}(Doc.prototype[prop]));return eventMixin(Doc),CodeMirror$1.inputStyles={textarea:TextareaInput,contenteditable:ContentEditableInput},CodeMirror$1.defineMode=function(name){CodeMirror$1.defaults.mode||"null"==name||(CodeMirror$1.defaults.mode=name),defineMode.apply(this,arguments)},CodeMirror$1.defineMIME=function(mime,spec){mimeModes[mime]=spec},CodeMirror$1.defineMode("null",function(){return{token:function(stream){return stream.skipToEnd()}}}),CodeMirror$1.defineMIME("text/plain","null"),CodeMirror$1.defineExtension=function(name,func){CodeMirror$1.prototype[name]=func},CodeMirror$1.defineDocExtension=function(name,func){Doc.prototype[name]=func},CodeMirror$1.fromTextArea=function(textarea,options){function save(){textarea.value=cm.getValue()}if(options=options?copyObj(options):{},options.value=textarea.value,!options.tabindex&&textarea.tabIndex&&(options.tabindex=textarea.tabIndex),!options.placeholder&&textarea.placeholder&&(options.placeholder=textarea.placeholder),null==options.autofocus){var hasFocus=activeElt();options.autofocus=hasFocus==textarea||null!=textarea.getAttribute("autofocus")&&hasFocus==document.body}var realSubmit;if(textarea.form&&(on(textarea.form,"submit",save),!options.leaveSubmitMethodAlone)){var form=textarea.form;realSubmit=form.submit;try{var wrappedSubmit=form.submit=function(){save(),form.submit=realSubmit,form.submit(),form.submit=wrappedSubmit}}catch(e){}}options.finishInit=function(cm){cm.save=save,cm.getTextArea=function(){return textarea},cm.toTextArea=function(){cm.toTextArea=isNaN,save(),textarea.parentNode.removeChild(cm.getWrapperElement()),textarea.style.display="",textarea.form&&(off(textarea.form,"submit",save),"function"==typeof textarea.form.submit&&(textarea.form.submit=realSubmit))}},textarea.style.display="none";var cm=CodeMirror$1(function(node){return textarea.parentNode.insertBefore(node,textarea.nextSibling)},options);return cm},function(CodeMirror){CodeMirror.off=off,CodeMirror.on=on,CodeMirror.wheelEventPixels=wheelEventPixels,CodeMirror.Doc=Doc,CodeMirror.splitLines=splitLinesAuto,CodeMirror.countColumn=countColumn,CodeMirror.findColumn=findColumn,CodeMirror.isWordChar=isWordCharBasic,CodeMirror.Pass=Pass,CodeMirror.signal=signal,CodeMirror.Line=Line,CodeMirror.changeEnd=changeEnd,CodeMirror.scrollbarModel=scrollbarModel,CodeMirror.Pos=Pos,CodeMirror.cmpPos=cmp,CodeMirror.modes=modes,CodeMirror.mimeModes=mimeModes,CodeMirror.resolveMode=resolveMode,CodeMirror.getMode=getMode,CodeMirror.modeExtensions=modeExtensions,CodeMirror.extendMode=extendMode,CodeMirror.copyState=copyState,CodeMirror.startState=startState,CodeMirror.innerMode=innerMode,CodeMirror.commands=commands,CodeMirror.keyMap=keyMap,CodeMirror.keyName=keyName,CodeMirror.isModifierKey=isModifierKey,CodeMirror.lookupKey=lookupKey,CodeMirror.normalizeKeyMap=normalizeKeyMap,CodeMirror.StringStream=StringStream,CodeMirror.SharedTextMarker=SharedTextMarker,CodeMirror.TextMarker=TextMarker,CodeMirror.LineWidget=LineWidget,CodeMirror.e_preventDefault=e_preventDefault,CodeMirror.e_stopPropagation=e_stopPropagation,CodeMirror.e_stop=e_stop,CodeMirror.addClass=addClass,CodeMirror.contains=contains,CodeMirror.rmClass=rmClass,CodeMirror.keyNames=keyNames}(CodeMirror$1),CodeMirror$1.version="5.27.2",CodeMirror$1})},{}],64:[function(require,module,exports){"use strict";function makeEmptyFunction(arg){return function(){return arg}}var emptyFunction=function(){};emptyFunction.thatReturns=makeEmptyFunction,emptyFunction.thatReturnsFalse=makeEmptyFunction(!1),emptyFunction.thatReturnsTrue=makeEmptyFunction(!0),emptyFunction.thatReturnsNull=makeEmptyFunction(null),emptyFunction.thatReturnsThis=function(){return this},emptyFunction.thatReturnsArgument=function(arg){return arg},module.exports=emptyFunction},{}],65:[function(require,module,exports){(function(process){"use strict";var validateFormat=function(format){};"production"!==process.env.NODE_ENV&&(validateFormat=function(format){if(void 0===format)throw new Error("invariant requires an error message argument")}),module.exports=function(condition,format,a,b,c,d,e,f){if(validateFormat(format),!condition){var error;if(void 0===format)error=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var args=[a,b,c,d,e,f],argIndex=0;(error=new Error(format.replace(/%s/g,function(){return args[argIndex++]}))).name="Invariant Violation"}throw error.framesToPop=1,error}}}).call(this,require("_process"))},{_process:168}],66:[function(require,module,exports){(function(process){"use strict";var warning=require("./emptyFunction");"production"!==process.env.NODE_ENV&&function(){var printWarning=function(format){for(var _len=arguments.length,args=Array(_len>1?_len-1:0),_key=1;_key<_len;_key++)args[_key-1]=arguments[_key];var argIndex=0,message="Warning: "+format.replace(/%s/g,function(){return args[argIndex++]});"undefined"!=typeof console&&console.error(message);try{throw new Error(message)}catch(x){}};warning=function(condition,format){if(void 0===format)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");if(0!==format.indexOf("Failed Composite propType: ")&&!condition){for(var _len2=arguments.length,args=Array(_len2>2?_len2-2:0),_key2=2;_key2<_len2;_key2++)args[_key2-2]=arguments[_key2];printWarning.apply(void 0,[format].concat(args))}}}(),module.exports=warning}).call(this,require("_process"))},{"./emptyFunction":64,_process:168}],67:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0}),exports.GraphQLLanguageService=void 0;var _kinds=require("graphql/language/kinds"),_graphql=require("graphql"),_getAutocompleteSuggestions2=require("./getAutocompleteSuggestions"),_getDiagnostics=require("./getDiagnostics"),_getDefinition=require("./getDefinition"),_graphqlLanguageServiceUtils=require("graphql-language-service-utils");exports.GraphQLLanguageService=function(){function GraphQLLanguageService(cache){_classCallCheck(this,GraphQLLanguageService),this._graphQLCache=cache,this._graphQLConfig=cache.getGraphQLConfig()}return GraphQLLanguageService.prototype.getDiagnostics=function(query,uri){var source,appName,schema,customRules,fragmentDefinitions,fragmentDependencies,dependenciesSource,customRulesModulePath,rulesPath;return regeneratorRuntime.async(function(_context){for(;;)switch(_context.prev=_context.next){case 0:if(source=query,appName=this._graphQLConfig.getAppConfigNameByFilePath(uri),schema=void 0,customRules=void 0,!this._graphQLConfig.getSchemaPath(appName)){_context.next=18;break}return _context.next=7,regeneratorRuntime.awrap(this._graphQLCache.getSchema(this._graphQLConfig.getSchemaPath(appName)));case 7:return schema=_context.sent,_context.next=10,regeneratorRuntime.awrap(this._graphQLCache.getFragmentDefinitions(this._graphQLConfig,appName));case 10:return fragmentDefinitions=_context.sent,_context.next=13,regeneratorRuntime.awrap(this._graphQLCache.getFragmentDependencies(query,fragmentDefinitions));case 13:fragmentDependencies=_context.sent,dependenciesSource=fragmentDependencies.reduce(function(prev,cur){return prev+" "+(0,_graphql.print)(cur.definition)},""),source=source+" "+dependenciesSource,(customRulesModulePath=this._graphQLConfig.getCustomValidationRulesModulePath(appName))&&(rulesPath=require.resolve(""+customRulesModulePath))&&(customRules=require(""+rulesPath)(this._graphQLConfig));case 18:return _context.abrupt("return",(0,_getDiagnostics.getDiagnostics)(source,schema,customRules));case 19:case"end":return _context.stop()}},null,this)},GraphQLLanguageService.prototype.getAutocompleteSuggestions=function(query,position,filePath){var appName,schema;return regeneratorRuntime.async(function(_context2){for(;;)switch(_context2.prev=_context2.next){case 0:if(appName=this._graphQLConfig.getAppConfigNameByFilePath(filePath),schema=void 0,!this._graphQLConfig.getSchemaPath(appName)){_context2.next=8;break}return _context2.next=5,regeneratorRuntime.awrap(this._graphQLCache.getSchema(this._graphQLConfig.getSchemaPath(appName)));case 5:if(!(schema=_context2.sent)){_context2.next=8;break}return _context2.abrupt("return",(0,_getAutocompleteSuggestions2.getAutocompleteSuggestions)(schema,query,position));case 8:return _context2.abrupt("return",[]);case 9:case"end":return _context2.stop()}},null,this)},GraphQLLanguageService.prototype.getDefinition=function(query,position,filePath){var appName,ast,node;return regeneratorRuntime.async(function(_context3){for(;;)switch(_context3.prev=_context3.next){case 0:appName=this._graphQLConfig.getAppConfigNameByFilePath(filePath),ast=void 0,_context3.prev=2,ast=(0,_graphql.parse)(query),_context3.next=9;break;case 6:return _context3.prev=6,_context3.t0=_context3.catch(2),_context3.abrupt("return",null);case 9:if(!(node=(0,_graphqlLanguageServiceUtils.getASTNodeAtPosition)(query,ast,position))){_context3.next=16;break}_context3.t1=node.kind,_context3.next=_context3.t1===_kinds.FRAGMENT_SPREAD?14:_context3.t1===_kinds.FRAGMENT_DEFINITION?15:_context3.t1===_kinds.OPERATION_DEFINITION?15:16;break;case 14:return _context3.abrupt("return",this._getDefinitionForFragmentSpread(query,ast,node,filePath,this._graphQLConfig,appName));case 15:return _context3.abrupt("return",(0,_getDefinition.getDefinitionQueryResultForDefinitionNode)(filePath,query,node));case 16:return _context3.abrupt("return",null);case 17:case"end":return _context3.stop()}},null,this,[[2,6]])},GraphQLLanguageService.prototype._getDefinitionForFragmentSpread=function(query,ast,node,filePath,graphQLConfig,appName){var fragmentDefinitions,dependencies,localFragDefinitions,typeCastedDefs,localFragInfos,result;return regeneratorRuntime.async(function(_context4){for(;;)switch(_context4.prev=_context4.next){case 0:return _context4.next=2,regeneratorRuntime.awrap(this._graphQLCache.getFragmentDefinitions(graphQLConfig,appName));case 2:return fragmentDefinitions=_context4.sent,_context4.next=5,regeneratorRuntime.awrap(this._graphQLCache.getFragmentDependenciesForAST(ast,fragmentDefinitions));case 5:return dependencies=_context4.sent,localFragDefinitions=ast.definitions.filter(function(definition){return definition.kind===_kinds.FRAGMENT_DEFINITION}),typeCastedDefs=localFragDefinitions,localFragInfos=typeCastedDefs.map(function(definition){return{filePath:filePath,content:query,definition:definition}}),_context4.next=11,regeneratorRuntime.awrap((0,_getDefinition.getDefinitionQueryResultForFragmentSpread)(query,node,dependencies.concat(localFragInfos)));case 11:return result=_context4.sent,_context4.abrupt("return",result);case 13:case"end":return _context4.stop()}},null,this)},GraphQLLanguageService}()},{"./getAutocompleteSuggestions":69,"./getDefinition":70,"./getDiagnostics":71,graphql:92,"graphql-language-service-utils":81,"graphql/language/kinds":102}],68:[function(require,module,exports){"use strict";function forEachState(stack,fn){for(var reverseStateStack=[],state=stack;state&&state.kind;)reverseStateStack.push(state),state=state.prevState;for(var i=reverseStateStack.length-1;i>=0;i--)fn(reverseStateStack[i])}function filterAndSortList(list,text){return text?filterNonEmpty(filterNonEmpty(list.map(function(entry){return{proximity:getProximity(normalizeText(entry.label),text),entry:entry}}),function(pair){return pair.proximity<=2}),function(pair){return!pair.entry.isDeprecated}).sort(function(a,b){return(a.entry.isDeprecated?1:0)-(b.entry.isDeprecated?1:0)||a.proximity-b.proximity||a.entry.label.length-b.entry.label.length}).map(function(pair){return pair.entry}):filterNonEmpty(list,function(entry){return!entry.isDeprecated})}function filterNonEmpty(array,predicate){var filtered=array.filter(predicate);return 0===filtered.length?array:filtered}function normalizeText(text){return text.toLowerCase().replace(/\W/g,"")}function getProximity(suggestion,text){var proximity=lexicalDistance(text,suggestion);return suggestion.length>text.length&&(proximity-=suggestion.length-text.length-1,proximity+=0===suggestion.indexOf(text)?0:.5),proximity}function lexicalDistance(a,b){var i=void 0,j=void 0,d=[],aLength=a.length,bLength=b.length;for(i=0;i<=aLength;i++)d[i]=[i];for(j=1;j<=bLength;j++)d[0][j]=j;for(i=1;i<=aLength;i++)for(j=1;j<=bLength;j++){var cost=a[i-1]===b[j-1]?0:1;d[i][j]=Math.min(d[i-1][j]+1,d[i][j-1]+1,d[i-1][j-1]+cost),i>1&&j>1&&a[i-1]===b[j-2]&&a[i-2]===b[j-1]&&(d[i][j]=Math.min(d[i][j],d[i-2][j-2]+cost))}return d[aLength][bLength]}Object.defineProperty(exports,"__esModule",{value:!0}),exports.getDefinitionState=function(tokenState){var definitionState=void 0;return forEachState(tokenState,function(state){switch(state.kind){case"Query":case"ShortQuery":case"Mutation":case"Subscription":case"FragmentDefinition":definitionState=state}}),definitionState},exports.getFieldDef=function(schema,type,fieldName){return fieldName===_introspection.SchemaMetaFieldDef.name&&schema.getQueryType()===type?_introspection.SchemaMetaFieldDef:fieldName===_introspection.TypeMetaFieldDef.name&&schema.getQueryType()===type?_introspection.TypeMetaFieldDef:fieldName===_introspection.TypeNameMetaFieldDef.name&&(0,_graphql.isCompositeType)(type)?_introspection.TypeNameMetaFieldDef:type.getFields&&"function"==typeof type.getFields?type.getFields()[fieldName]:null},exports.forEachState=forEachState,exports.objectValues=function(object){for(var keys=Object.keys(object),len=keys.length,values=new Array(len),i=0;i<len;++i)values[i]=object[keys[i]];return values},exports.hintList=function(token,list){return filterAndSortList(list,normalizeText(token.string))};var _graphql=require("graphql"),_introspection=require("graphql/type/introspection")},{graphql:92,"graphql/type/introspection":115}],69:[function(require,module,exports){"use strict";function getSuggestionsForFieldNames(token,typeInfo,schema){if(typeInfo.parentType){var parentType=typeInfo.parentType,fields=parentType.getFields instanceof Function?(0,_autocompleteUtils.objectValues)(parentType.getFields()):[];return(0,_graphql.isAbstractType)(parentType)&&fields.push(_graphql.TypeNameMetaFieldDef),parentType===schema.getQueryType()&&fields.push(_graphql.SchemaMetaFieldDef,_graphql.TypeMetaFieldDef),(0,_autocompleteUtils.hintList)(token,fields.map(function(field){return{label:field.name,detail:String(field.type),documentation:field.description,isDeprecated:field.isDeprecated,deprecationReason:field.deprecationReason}}))}return[]}function getSuggestionsForInputValues(token,typeInfo){var namedInputType=(0,_graphql.getNamedType)(typeInfo.inputType);if(namedInputType instanceof _graphql.GraphQLEnumType){var values=namedInputType.getValues();return(0,_autocompleteUtils.hintList)(token,values.map(function(value){return{label:value.name,detail:String(namedInputType),documentation:value.description,isDeprecated:value.isDeprecated,deprecationReason:value.deprecationReason}}))}return namedInputType===_graphql.GraphQLBoolean?(0,_autocompleteUtils.hintList)(token,[{label:"true",detail:String(_graphql.GraphQLBoolean),documentation:"Not false."},{label:"false",detail:String(_graphql.GraphQLBoolean),documentation:"Not true."}]):[]}function getSuggestionsForFragmentTypeConditions(token,typeInfo,schema){var possibleTypes=void 0;if(typeInfo.parentType)if((0,_graphql.isAbstractType)(typeInfo.parentType)){var abstractType=(0,_graphql.assertAbstractType)(typeInfo.parentType),possibleObjTypes=schema.getPossibleTypes(abstractType),possibleIfaceMap=Object.create(null);possibleObjTypes.forEach(function(type){type.getInterfaces().forEach(function(iface){possibleIfaceMap[iface.name]=iface})}),possibleTypes=possibleObjTypes.concat((0,_autocompleteUtils.objectValues)(possibleIfaceMap))}else possibleTypes=[typeInfo.parentType];else{var typeMap=schema.getTypeMap();possibleTypes=(0,_autocompleteUtils.objectValues)(typeMap).filter(_graphql.isCompositeType)}return(0,_autocompleteUtils.hintList)(token,possibleTypes.map(function(type){var namedType=(0,_graphql.getNamedType)(type);return{label:String(type),documentation:namedType&&namedType.description||""}}))}function getSuggestionsForFragmentSpread(token,typeInfo,schema,queryText){var typeMap=schema.getTypeMap(),defState=(0,_autocompleteUtils.getDefinitionState)(token.state),relevantFrags=getFragmentDefinitions(queryText).filter(function(frag){return typeMap[frag.typeCondition.name.value]&&!(defState&&"FragmentDefinition"===defState.kind&&defState.name===frag.name.value)&&(0,_graphql.isCompositeType)(typeInfo.parentType)&&(0,_graphql.isCompositeType)(typeMap[frag.typeCondition.name.value])&&(0,_graphql.doTypesOverlap)(schema,typeInfo.parentType,typeMap[frag.typeCondition.name.value])});return(0,_autocompleteUtils.hintList)(token,relevantFrags.map(function(frag){return{label:frag.name.value,detail:String(typeMap[frag.typeCondition.name.value]),documentation:"fragment "+frag.name.value+" on "+frag.typeCondition.name.value}}))}function getFragmentDefinitions(queryText){var fragmentDefs=[];return runOnlineParser(queryText,function(_,state){"FragmentDefinition"===state.kind&&state.name&&state.type&&fragmentDefs.push({kind:"FragmentDefinition",name:{kind:"Name",value:state.name},selectionSet:{kind:"SelectionSet",selections:[]},typeCondition:{kind:"NamedType",name:{kind:"Name",value:state.type}}})}),fragmentDefs}function getSuggestionsForVariableDefinition(token,schema){var inputTypeMap=schema.getTypeMap(),inputTypes=(0,_autocompleteUtils.objectValues)(inputTypeMap).filter(_graphql.isInputType);return(0,_autocompleteUtils.hintList)(token,inputTypes.map(function(type){return{label:type.name,documentation:type.description}}))}function getSuggestionsForDirective(token,state,schema){if(state.prevState&&state.prevState.kind){var directives=schema.getDirectives().filter(function(directive){return canUseDirective(state.prevState,directive)});return(0,_autocompleteUtils.hintList)(token,directives.map(function(directive){return{label:directive.name,documentation:directive.description||""}}))}return[]}function getTokenAtPosition(queryText,cursor){var styleAtCursor=null,stateAtCursor=null,stringAtCursor=null,token=runOnlineParser(queryText,function(stream,state,style,index){if(index===cursor.line&&stream.getCurrentPosition()>=cursor.character)return styleAtCursor=style,stateAtCursor=_extends({},state),stringAtCursor=stream.current(),"BREAK"});return{start:token.start,end:token.end,string:stringAtCursor||token.string,state:stateAtCursor||token.state,style:styleAtCursor||token.style}}function runOnlineParser(queryText,callback){for(var lines=queryText.split("\n"),parser=(0,_graphqlLanguageServiceParser.onlineParser)(),state=parser.startState(),style="",stream=new _graphqlLanguageServiceParser.CharacterStream(""),i=0;i<lines.length;i++){for(stream=new _graphqlLanguageServiceParser.CharacterStream(lines[i]);!stream.eol()&&"BREAK"!==callback(stream,state,style=parser.token(stream,state),i););callback(stream,state,style,i),state.kind||(state=parser.startState())}return{start:stream.getStartOfToken(),end:stream.getCurrentPosition(),string:stream.current(),state:state,style:style}}function canUseDirective(state,directive){if(!state||!state.kind)return!1;var kind=state.kind,locations=directive.locations;switch(kind){case"Query":return-1!==locations.indexOf("QUERY");case"Mutation":return-1!==locations.indexOf("MUTATION");case"Subscription":return-1!==locations.indexOf("SUBSCRIPTION");case"Field":case"AliasedField":return-1!==locations.indexOf("FIELD");case"FragmentDefinition":return-1!==locations.indexOf("FRAGMENT_DEFINITION");case"FragmentSpread":return-1!==locations.indexOf("FRAGMENT_SPREAD");case"InlineFragment":return-1!==locations.indexOf("INLINE_FRAGMENT");case"SchemaDef":return-1!==locations.indexOf("SCHEMA");case"ScalarDef":return-1!==locations.indexOf("SCALAR");case"ObjectTypeDef":return-1!==locations.indexOf("OBJECT");case"FieldDef":return-1!==locations.indexOf("FIELD_DEFINITION");case"InterfaceDef":return-1!==locations.indexOf("INTERFACE");case"UnionDef":return-1!==locations.indexOf("UNION");case"EnumDef":return-1!==locations.indexOf("ENUM");case"EnumValue":return-1!==locations.indexOf("ENUM_VALUE");case"InputDef":return-1!==locations.indexOf("INPUT_OBJECT");case"InputValueDef":switch(state.prevState&&state.prevState.kind){case"ArgumentsDef":return-1!==locations.indexOf("ARGUMENT_DEFINITION");case"InputDef":return-1!==locations.indexOf("INPUT_FIELD_DEFINITION")}}return!1}function getTypeInfo(schema,tokenState){var argDef=void 0,argDefs=void 0,directiveDef=void 0,enumValue=void 0,fieldDef=void 0,inputType=void 0,objectFieldDefs=void 0,parentType=void 0,type=void 0;return(0,_autocompleteUtils.forEachState)(tokenState,function(state){switch(state.kind){case"Query":case"ShortQuery":type=schema.getQueryType();break;case"Mutation":type=schema.getMutationType();break;case"Subscription":type=schema.getSubscriptionType();break;case"InlineFragment":case"FragmentDefinition":state.type&&(type=schema.getType(state.type));break;case"Field":case"AliasedField":type&&state.name?(fieldDef=parentType?(0,_autocompleteUtils.getFieldDef)(schema,parentType,state.name):null,type=fieldDef?fieldDef.type:null):fieldDef=null;break;case"SelectionSet":parentType=(0,_graphql.getNamedType)(type);break;case"Directive":directiveDef=state.name?schema.getDirective(state.name):null;break;case"Arguments":if(state.prevState)switch(state.prevState.kind){case"Field":argDefs=fieldDef&&fieldDef.args;break;case"Directive":argDefs=directiveDef&&directiveDef.args;break;case"AliasedField":var name=state.prevState&&state.prevState.name;if(!name){argDefs=null;break}var field=parentType?(0,_autocompleteUtils.getFieldDef)(schema,parentType,name):null;if(!field){argDefs=null;break}argDefs=field.args;break;default:argDefs=null}else argDefs=null;break;case"Argument":if(argDefs)for(var i=0;i<argDefs.length;i++)if(argDefs[i].name===state.name){argDef=argDefs[i];break}inputType=argDef&&argDef.type;break;case"EnumValue":var enumType=(0,_graphql.getNamedType)(inputType);enumValue=enumType instanceof _graphql.GraphQLEnumType?find(enumType.getValues(),function(val){return val.value===state.name}):null;break;case"ListValue":var nullableType=(0,_graphql.getNullableType)(inputType);inputType=nullableType instanceof _graphql.GraphQLList?nullableType.ofType:null;break;case"ObjectValue":var objectType=(0,_graphql.getNamedType)(inputType);objectFieldDefs=objectType instanceof _graphql.GraphQLInputObjectType?objectType.getFields():null;break;case"ObjectField":var objectField=state.name&&objectFieldDefs?objectFieldDefs[state.name]:null;inputType=objectField&&objectField.type;break;case"NamedType":state.name&&(type=schema.getType(state.name))}}),{argDef:argDef,argDefs:argDefs,directiveDef:directiveDef,enumValue:enumValue,fieldDef:fieldDef,inputType:inputType,objectFieldDefs:objectFieldDefs,parentType:parentType,type:type}}function find(array,predicate){for(var i=0;i<array.length;i++)if(predicate(array[i]))return array[i];return null}Object.defineProperty(exports,"__esModule",{value:!0});var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key])}return target};exports.getAutocompleteSuggestions=function(schema,queryText,cursor,contextToken){var token=contextToken||getTokenAtPosition(queryText,cursor),state="Invalid"===token.state.kind?token.state.prevState:token.state;if(!state)return[];var kind=state.kind,step=state.step,typeInfo=getTypeInfo(schema,token.state);if("Document"===kind)return(0,_autocompleteUtils.hintList)(token,[{label:"query"},{label:"mutation"},{label:"subscription"},{label:"fragment"},{label:"{"}]);if("SelectionSet"===kind||"Field"===kind||"AliasedField"===kind)return getSuggestionsForFieldNames(token,typeInfo,schema);if("Arguments"===kind||"Argument"===kind&&0===step){var argDefs=typeInfo.argDefs;if(argDefs)return(0,_autocompleteUtils.hintList)(token,argDefs.map(function(argDef){return{label:argDef.name,detail:String(argDef.type),documentation:argDef.description}}))}if(("ObjectValue"===kind||"ObjectField"===kind&&0===step)&&typeInfo.objectFieldDefs){var objectFields=(0,_autocompleteUtils.objectValues)(typeInfo.objectFieldDefs);return(0,_autocompleteUtils.hintList)(token,objectFields.map(function(field){return{label:field.name,detail:String(field.type),documentation:field.description}}))}return"EnumValue"===kind||"ListValue"===kind&&1===step||"ObjectField"===kind&&2===step||"Argument"===kind&&2===step?getSuggestionsForInputValues(token,typeInfo):"TypeCondition"===kind&&1===step||"NamedType"===kind&&null!=state.prevState&&"TypeCondition"===state.prevState.kind?getSuggestionsForFragmentTypeConditions(token,typeInfo,schema):"FragmentSpread"===kind&&1===step?getSuggestionsForFragmentSpread(token,typeInfo,schema,queryText):"VariableDefinition"===kind&&2===step||"ListType"===kind&&1===step||"NamedType"===kind&&state.prevState&&("VariableDefinition"===state.prevState.kind||"ListType"===state.prevState.kind)?getSuggestionsForVariableDefinition(token,schema):"Directive"===kind?getSuggestionsForDirective(token,state,schema):[]};var _graphql=require("graphql"),_graphqlLanguageServiceParser=require("graphql-language-service-parser"),_autocompleteUtils=require("./autocompleteUtils")},{"./autocompleteUtils":68,graphql:92,"graphql-language-service-parser":77}],70:[function(require,module,exports){(function(process){"use strict";function getRange(text,node){var location=node.loc;return(0,_assert2.default)(location,"Expected ASTNode to have a location."),(0,_graphqlLanguageServiceUtils.locToRange)(text,location)}function getPosition(text,node){var location=node.loc;return(0,_assert2.default)(location,"Expected ASTNode to have a location."),(0,_graphqlLanguageServiceUtils.offsetToPosition)(text,location.start)}function getDefinitionForFragmentDefinition(path,text,definition){var name=definition.name;return(0,_assert2.default)(name,"Expected ASTNode to have a Name."),{path:path,position:getPosition(text,name),range:getRange(text,definition),name:name.value||"",language:LANGUAGE,projectRoot:path}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.LANGUAGE=void 0,exports.getDefinitionQueryResultForFragmentSpread=function(text,fragment,dependencies){var name,defNodes,definitions;return regeneratorRuntime.async(function(_context){for(;;)switch(_context.prev=_context.next){case 0:if(name=fragment.name.value,0!==(defNodes=dependencies.filter(function(_ref){return _ref.definition.name.value===name})).length){_context.next=5;break}return process.stderr.write("Definition not found for GraphQL fragment "+name),_context.abrupt("return",{queryRange:[],definitions:[]});case 5:return definitions=defNodes.map(function(_ref2){var filePath=_ref2.filePath,content=_ref2.content,definition=_ref2.definition;return getDefinitionForFragmentDefinition(filePath||"",content,definition)}),_context.abrupt("return",{definitions:definitions,queryRange:definitions.map(function(_){return getRange(text,fragment)})});case 7:case"end":return _context.stop()}},null,this)},exports.getDefinitionQueryResultForDefinitionNode=function(path,text,definition){return{definitions:[getDefinitionForFragmentDefinition(path,text,definition)],queryRange:definition.name?[getRange(text,definition.name)]:[]}};var _graphqlLanguageServiceUtils=require("graphql-language-service-utils"),_assert2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(require("assert")),LANGUAGE=exports.LANGUAGE="GraphQL"}).call(this,require("_process"))},{_process:168,assert:34,"graphql-language-service-utils":81}],71:[function(require,module,exports){"use strict";function mapCat(array,mapper){return Array.prototype.concat.apply([],array.map(mapper))}function annotations(error,severity,type){return error.nodes?error.nodes.map(function(node){var highlightNode="Variable"!==node.kind&&node.name?node.name:node.variable?node.variable:node;(0,_assert2.default)(error.locations,"GraphQL validation error requires locations.");var loc=error.locations[0],highlightLoc=getLocation(highlightNode),end=loc.column+(highlightLoc.end-highlightLoc.start);return{source:"GraphQL: "+type,message:error.message,severity:severity,range:new _graphqlLanguageServiceUtils.Range(new _graphqlLanguageServiceUtils.Position(loc.line-1,loc.column-1),new _graphqlLanguageServiceUtils.Position(loc.line-1,end))}}):[]}function getLocation(node){var location=node.loc;return(0,_assert2.default)(location,"Expected ASTNode to have a location."),location}function getRange(location,queryText){var parser=(0,_graphqlLanguageServiceParser.onlineParser)(),state=parser.startState(),lines=queryText.split("\n");(0,_assert2.default)(lines.length>=location.line,"Query text must have more lines than where the error happened");for(var stream=null,i=0;i<location.line;i++)for(stream=new _graphqlLanguageServiceParser.CharacterStream(lines[i]);!stream.eol()&&"invalidchar"!==parser.token(stream,state););(0,_assert2.default)(stream,"Expected Parser stream to be available.");var line=location.line-1,start=stream.getStartOfToken(),end=stream.getCurrentPosition();return new _graphqlLanguageServiceUtils.Range(new _graphqlLanguageServiceUtils.Position(line,start),new _graphqlLanguageServiceUtils.Position(line,end))}Object.defineProperty(exports,"__esModule",{value:!0}),exports.SEVERITY=void 0,exports.getDiagnostics=function(queryText){var schema=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,customRules=arguments[2],ast=null;try{ast=(0,_graphql.parse)(queryText)}catch(error){var range=getRange(error.locations[0],queryText);return[{severity:SEVERITY.ERROR,message:error.message,source:"GraphQL: Syntax",range:range}]}if(!schema)return[];var validationErrorAnnotations=mapCat((0,_graphqlLanguageServiceUtils.validateWithCustomRules)(schema,ast,customRules),function(error){return annotations(error,SEVERITY.ERROR,"Validation")}),deprecationWarningAnnotations=_graphql.findDeprecatedUsages?mapCat((0,_graphql.findDeprecatedUsages)(schema,ast),function(error){return annotations(error,SEVERITY.WARNING,"Deprecation")}):[];return validationErrorAnnotations.concat(deprecationWarningAnnotations)};var _assert2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(require("assert")),_graphql=require("graphql"),_graphqlLanguageServiceParser=require("graphql-language-service-parser"),_graphqlLanguageServiceUtils=require("graphql-language-service-utils"),SEVERITY=exports.SEVERITY={ERROR:1,WARNING:2,INFORMATION:3,HINT:4}},{assert:34,graphql:92,"graphql-language-service-parser":77,"graphql-language-service-utils":81}],72:[function(require,module,exports){"use strict";function outlineTreeConverter(docText){var meta=function(node){return{representativeName:node.name,startPosition:(0,_graphqlLanguageServiceUtils.offsetToPosition)(docText,node.loc.start),endPosition:(0,_graphqlLanguageServiceUtils.offsetToPosition)(docText,node.loc.end),children:node.selectionSet||[]}};return{Field:function(node){var tokenizedText=node.alias?[buildToken("plain",node.alias),buildToken("plain",": ")]:[];return tokenizedText.push(buildToken("plain",node.name)),_extends({tokenizedText:tokenizedText},meta(node))},OperationDefinition:function(node){return _extends({tokenizedText:[buildToken("keyword",node.operation),buildToken("whitespace"," "),buildToken("class-name",node.name)]},meta(node))},Document:function(node){return node.definitions},SelectionSet:function(node){return concatMap(node.selections,function(child){return child.kind===_kinds.INLINE_FRAGMENT?child.selectionSet:child})},Name:function(node){return node.value},FragmentDefinition:function(node){return _extends({tokenizedText:[buildToken("keyword","fragment"),buildToken("whitespace"," "),buildToken("class-name",node.name)]},meta(node))},FragmentSpread:function(node){return _extends({tokenizedText:[buildToken("plain","..."),buildToken("class-name",node.name)]},meta(node))},InlineFragment:function(node){return node.selectionSet}}}function buildToken(kind,value){return{kind:kind,value:value}}function concatMap(arr,fn){for(var res=[],i=0;i<arr.length;i++){var x=fn(arr[i],i);Array.isArray(x)?res.push.apply(res,x):res.push(x)}return res}Object.defineProperty(exports,"__esModule",{value:!0});var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key])}return target};exports.getOutline=function(queryText){var ast=void 0;try{ast=(0,_graphql.parse)(queryText)}catch(error){return null}var visitorFns=outlineTreeConverter(queryText);return{outlineTrees:(0,_graphql.visit)(ast,{leave:function(node){return OUTLINEABLE_KINDS[node.kind]&&visitorFns[node.kind]?visitorFns[node.kind](node):null}})}};var _graphql=require("graphql"),_kinds=require("graphql/language/kinds"),_graphqlLanguageServiceUtils=require("graphql-language-service-utils"),OUTLINEABLE_KINDS={Field:!0,OperationDefinition:!0,Document:!0,SelectionSet:!0,Name:!0,FragmentDefinition:!0,FragmentSpread:!0,InlineFragment:!0}},{graphql:92,"graphql-language-service-utils":81,"graphql/language/kinds":102}],73:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _autocompleteUtils=require("./autocompleteUtils");Object.defineProperty(exports,"getDefinitionState",{enumerable:!0,get:function(){return _autocompleteUtils.getDefinitionState}}),Object.defineProperty(exports,"getFieldDef",{enumerable:!0,get:function(){return _autocompleteUtils.getFieldDef}}),Object.defineProperty(exports,"forEachState",{enumerable:!0,get:function(){return _autocompleteUtils.forEachState}}),Object.defineProperty(exports,"objectValues",{enumerable:!0,get:function(){return _autocompleteUtils.objectValues}}),Object.defineProperty(exports,"hintList",{enumerable:!0,get:function(){return _autocompleteUtils.hintList}});var _getAutocompleteSuggestions=require("./getAutocompleteSuggestions");Object.defineProperty(exports,"getAutocompleteSuggestions",{enumerable:!0,get:function(){return _getAutocompleteSuggestions.getAutocompleteSuggestions}});var _getDefinition=require("./getDefinition");Object.defineProperty(exports,"LANGUAGE",{enumerable:!0,get:function(){return _getDefinition.LANGUAGE}}),Object.defineProperty(exports,"getDefinitionQueryResultForFragmentSpread",{enumerable:!0,get:function(){return _getDefinition.getDefinitionQueryResultForFragmentSpread}}),Object.defineProperty(exports,"getDefinitionQueryResultForDefinitionNode",{enumerable:!0,get:function(){return _getDefinition.getDefinitionQueryResultForDefinitionNode}});var _getDiagnostics=require("./getDiagnostics");Object.defineProperty(exports,"getDiagnostics",{enumerable:!0,get:function(){return _getDiagnostics.getDiagnostics}});var _getOutline=require("./getOutline");Object.defineProperty(exports,"getOutline",{enumerable:!0,get:function(){return _getOutline.getOutline}});var _GraphQLLanguageService=require("./GraphQLLanguageService");Object.defineProperty(exports,"GraphQLLanguageService",{enumerable:!0,get:function(){return _GraphQLLanguageService.GraphQLLanguageService}})},{"./GraphQLLanguageService":67,"./autocompleteUtils":68,"./getAutocompleteSuggestions":69,"./getDefinition":70,"./getDiagnostics":71,"./getOutline":72}],74:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0});var CharacterStream=function(){function CharacterStream(sourceText){var _this=this;_classCallCheck(this,CharacterStream),this.getStartOfToken=function(){return _this._start},this.getCurrentPosition=function(){return _this._pos},this.eol=function(){return _this._sourceText.length===_this._pos},this.sol=function(){return 0===_this._pos},this.peek=function(){return _this._sourceText.charAt(_this._pos)?_this._sourceText.charAt(_this._pos):null},this.next=function(){var char=_this._sourceText.charAt(_this._pos);return _this._pos++,char},this.eat=function(pattern){if(_this._testNextCharacter(pattern))return _this._start=_this._pos,_this._pos++,_this._sourceText.charAt(_this._pos-1)},this.eatWhile=function(match){var isMatched=_this._testNextCharacter(match),didEat=!1;for(isMatched&&(didEat=isMatched,_this._start=_this._pos);isMatched;)_this._pos++,isMatched=_this._testNextCharacter(match),didEat=!0;return didEat},this.eatSpace=function(){return _this.eatWhile(/[\s\u00a0]/)},this.skipToEnd=function(){_this._pos=_this._sourceText.length},this.skipTo=function(position){_this._pos=position},this.match=function(pattern){var consume=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],caseFold=arguments.length>2&&void 0!==arguments[2]&&arguments[2],token=null,match=null;return"string"==typeof pattern?(match=new RegExp(pattern,caseFold?"i":"g").test(_this._sourceText.substr(_this._pos,pattern.length)),token=pattern):pattern instanceof RegExp&&(token=(match=_this._sourceText.slice(_this._pos).match(pattern))&&match[0]),!(null==match||!("string"==typeof pattern||match instanceof Array&&_this._sourceText.startsWith(match[0],_this._pos)))&&(consume&&(_this._start=_this._pos,token&&token.length&&(_this._pos+=token.length)),match)},this.backUp=function(num){_this._pos-=num},this.column=function(){return _this._pos},this.indentation=function(){var match=_this._sourceText.match(/\s*/),indent=0;if(match&&0===match.length)for(var whitespaces=match[0],pos=0;whitespaces.length>pos;)9===whitespaces.charCodeAt(pos)?indent+=2:indent++,pos++;return indent},this.current=function(){return _this._sourceText.slice(_this._start,_this._pos)},this._start=0,this._pos=0,this._sourceText=sourceText}return CharacterStream.prototype._testNextCharacter=function(pattern){var character=this._sourceText.charAt(this._pos);return"string"==typeof pattern?character===pattern:pattern instanceof RegExp?pattern.test(character):pattern(character)},CharacterStream}();exports.default=CharacterStream},{}],75:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.opt=function(ofRule){return{ofRule:ofRule}},exports.list=function(ofRule,separator){return{ofRule:ofRule,isList:!0,separator:separator}},exports.butNot=function(rule,exclusions){var ruleMatch=rule.match;return rule.match=function(token){var check=!1;return ruleMatch&&(check=ruleMatch(token)),check&&exclusions.every(function(exclusion){return exclusion.match&&!exclusion.match(token)})},rule},exports.t=function(kind,style){return{style:style,match:function(token){return token.kind===kind}}},exports.p=function(value,style){return{style:style||"punctuation",match:function(token){return"Punctuation"===token.kind&&token.value===value}}}},{}],76:[function(require,module,exports){"use strict";function word(value){return{style:"keyword",match:function(token){return"Name"===token.kind&&token.value===value}}}function name(style){return{style:style,match:function(token){return"Name"===token.kind},update:function(state,token){state.name=token.value}}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.ParseRules=exports.LexRules=exports.isIgnored=void 0;var _RuleHelpers=require("./RuleHelpers");exports.isIgnored=function(ch){return" "===ch||"\t"===ch||","===ch||"\n"===ch||"\r"===ch||"\ufeff"===ch},exports.LexRules={Name:/^[_A-Za-z][_0-9A-Za-z]*/,Punctuation:/^(?:!|\$|\(|\)|\.\.\.|:|=|@|\[|]|\{|\||\})/,Number:/^-?(?:0|(?:[1-9][0-9]*))(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?/,String:/^"(?:[^"\\]|\\(?:"|\/|\\|b|f|n|r|t|u[0-9a-fA-F]{4}))*"?/,Comment:/^#.*/},exports.ParseRules={Document:[(0,_RuleHelpers.list)("Definition")],Definition:function(token){switch(token.value){case"{":return"ShortQuery";case"query":return"Query";case"mutation":return"Mutation";case"subscription":return"Subscription";case"fragment":return"FragmentDefinition";case"schema":return"SchemaDef";case"scalar":return"ScalarDef";case"type":return"ObjectTypeDef";case"interface":return"InterfaceDef";case"union":return"UnionDef";case"enum":return"EnumDef";case"input":return"InputDef";case"extend":return"ExtendDef";case"directive":return"DirectiveDef"}},ShortQuery:["SelectionSet"],Query:[word("query"),(0,_RuleHelpers.opt)(name("def")),(0,_RuleHelpers.opt)("VariableDefinitions"),(0,_RuleHelpers.list)("Directive"),"SelectionSet"],Mutation:[word("mutation"),(0,_RuleHelpers.opt)(name("def")),(0,_RuleHelpers.opt)("VariableDefinitions"),(0,_RuleHelpers.list)("Directive"),"SelectionSet"],Subscription:[word("subscription"),(0,_RuleHelpers.opt)(name("def")),(0,_RuleHelpers.opt)("VariableDefinitions"),(0,_RuleHelpers.list)("Directive"),"SelectionSet"],VariableDefinitions:[(0,_RuleHelpers.p)("("),(0,_RuleHelpers.list)("VariableDefinition"),(0,_RuleHelpers.p)(")")],VariableDefinition:["Variable",(0,_RuleHelpers.p)(":"),"Type",(0,_RuleHelpers.opt)("DefaultValue")],Variable:[(0,_RuleHelpers.p)("$","variable"),name("variable")],DefaultValue:[(0,_RuleHelpers.p)("="),"Value"],SelectionSet:[(0,_RuleHelpers.p)("{"),(0,_RuleHelpers.list)("Selection"),(0,_RuleHelpers.p)("}")],Selection:function(token,stream){return"..."===token.value?stream.match(/[\s\u00a0,]*(on\b|@|{)/,!1)?"InlineFragment":"FragmentSpread":stream.match(/[\s\u00a0,]*:/,!1)?"AliasedField":"Field"},AliasedField:[name("property"),(0,_RuleHelpers.p)(":"),name("qualifier"),(0,_RuleHelpers.opt)("Arguments"),(0,_RuleHelpers.list)("Directive"),(0,_RuleHelpers.opt)("SelectionSet")],Field:[name("property"),(0,_RuleHelpers.opt)("Arguments"),(0,_RuleHelpers.list)("Directive"),(0,_RuleHelpers.opt)("SelectionSet")],Arguments:[(0,_RuleHelpers.p)("("),(0,_RuleHelpers.list)("Argument"),(0,_RuleHelpers.p)(")")],Argument:[name("attribute"),(0,_RuleHelpers.p)(":"),"Value"],FragmentSpread:[(0,_RuleHelpers.p)("..."),name("def"),(0,_RuleHelpers.list)("Directive")],InlineFragment:[(0,_RuleHelpers.p)("..."),(0,_RuleHelpers.opt)("TypeCondition"),(0,_RuleHelpers.list)("Directive"),"SelectionSet"],FragmentDefinition:[word("fragment"),(0,_RuleHelpers.opt)((0,_RuleHelpers.butNot)(name("def"),[word("on")])),"TypeCondition",(0,_RuleHelpers.list)("Directive"),"SelectionSet"],TypeCondition:[word("on"),"NamedType"],Value:function(token){switch(token.kind){case"Number":return"NumberValue";case"String":return"StringValue";case"Punctuation":switch(token.value){case"[":return"ListValue";case"{":return"ObjectValue";case"$":return"Variable"}return null;case"Name":switch(token.value){case"true":case"false":return"BooleanValue"}return"null"===token.value?"NullValue":"EnumValue"}},NumberValue:[(0,_RuleHelpers.t)("Number","number")],StringValue:[(0,_RuleHelpers.t)("String","string")],BooleanValue:[(0,_RuleHelpers.t)("Name","builtin")],NullValue:[(0,_RuleHelpers.t)("Name","keyword")],EnumValue:[name("string-2")],ListValue:[(0,_RuleHelpers.p)("["),(0,_RuleHelpers.list)("Value"),(0,_RuleHelpers.p)("]")],ObjectValue:[(0,_RuleHelpers.p)("{"),(0,_RuleHelpers.list)("ObjectField"),(0,_RuleHelpers.p)("}")],ObjectField:[name("attribute"),(0,_RuleHelpers.p)(":"),"Value"],Type:function(token){return"["===token.value?"ListType":"NonNullType"},ListType:[(0,_RuleHelpers.p)("["),"Type",(0,_RuleHelpers.p)("]"),(0,_RuleHelpers.opt)((0,_RuleHelpers.p)("!"))],NonNullType:["NamedType",(0,_RuleHelpers.opt)((0,_RuleHelpers.p)("!"))],NamedType:[{style:"atom",match:function(token){return"Name"===token.kind},update:function(state,token){state.prevState&&state.prevState.prevState&&(state.name=token.value,state.prevState.prevState.type=token.value)}}],Directive:[(0,_RuleHelpers.p)("@","meta"),name("meta"),(0,_RuleHelpers.opt)("Arguments")],SchemaDef:[word("schema"),(0,_RuleHelpers.list)("Directive"),(0,_RuleHelpers.p)("{"),(0,_RuleHelpers.list)("OperationTypeDef"),(0,_RuleHelpers.p)("}")],OperationTypeDef:[name("keyword"),(0,_RuleHelpers.p)(":"),name("atom")],ScalarDef:[word("scalar"),name("atom"),(0,_RuleHelpers.list)("Directive")],ObjectTypeDef:[word("type"),name("atom"),(0,_RuleHelpers.opt)("Implements"),(0,_RuleHelpers.list)("Directive"),(0,_RuleHelpers.p)("{"),(0,_RuleHelpers.list)("FieldDef"),(0,_RuleHelpers.p)("}")],Implements:[word("implements"),(0,_RuleHelpers.list)("NamedType")],FieldDef:[name("property"),(0,_RuleHelpers.opt)("ArgumentsDef"),(0,_RuleHelpers.p)(":"),"Type",(0,_RuleHelpers.list)("Directive")],ArgumentsDef:[(0,_RuleHelpers.p)("("),(0,_RuleHelpers.list)("InputValueDef"),(0,_RuleHelpers.p)(")")],InputValueDef:[name("attribute"),(0,_RuleHelpers.p)(":"),"Type",(0,_RuleHelpers.opt)("DefaultValue"),(0,_RuleHelpers.list)("Directive")],InterfaceDef:[word("interface"),name("atom"),(0,_RuleHelpers.list)("Directive"),(0,_RuleHelpers.p)("{"),(0,_RuleHelpers.list)("FieldDef"),(0,_RuleHelpers.p)("}")],UnionDef:[word("union"),name("atom"),(0,_RuleHelpers.list)("Directive"),(0,_RuleHelpers.p)("="),(0,_RuleHelpers.list)("UnionMember",(0,_RuleHelpers.p)("|"))],UnionMember:["NamedType"],EnumDef:[word("enum"),name("atom"),(0,_RuleHelpers.list)("Directive"),(0,_RuleHelpers.p)("{"),(0,_RuleHelpers.list)("EnumValueDef"),(0,_RuleHelpers.p)("}")],EnumValueDef:[name("string-2"),(0,_RuleHelpers.list)("Directive")],InputDef:[word("input"),name("atom"),(0,_RuleHelpers.list)("Directive"),(0,_RuleHelpers.p)("{"),(0,_RuleHelpers.list)("InputValueDef"),(0,_RuleHelpers.p)("}")],ExtendDef:[word("extend"),"ObjectTypeDef"],DirectiveDef:[word("directive"),(0,_RuleHelpers.p)("@","meta"),name("meta"),(0,_RuleHelpers.opt)("ArgumentsDef"),word("on"),(0,_RuleHelpers.list)("DirectiveLocation",(0,_RuleHelpers.p)("|"))],DirectiveLocation:[name("string-2")]}},{"./RuleHelpers":75}],77:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}Object.defineProperty(exports,"__esModule",{value:!0});var _CharacterStream=require("./CharacterStream");Object.defineProperty(exports,"CharacterStream",{enumerable:!0,get:function(){return _interopRequireDefault(_CharacterStream).default}});var _Rules=require("./Rules");Object.defineProperty(exports,"LexRules",{enumerable:!0,get:function(){return _Rules.LexRules}}),Object.defineProperty(exports,"ParseRules",{enumerable:!0,get:function(){return _Rules.ParseRules}}),Object.defineProperty(exports,"isIgnored",{enumerable:!0,get:function(){return _Rules.isIgnored}});var _RuleHelpers=require("./RuleHelpers");Object.defineProperty(exports,"butNot",{enumerable:!0,get:function(){return _RuleHelpers.butNot}}),Object.defineProperty(exports,"list",{enumerable:!0,get:function(){return _RuleHelpers.list}}),Object.defineProperty(exports,"opt",{enumerable:!0,get:function(){return _RuleHelpers.opt}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return _RuleHelpers.p}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return _RuleHelpers.t}});var _onlineParser=require("./onlineParser");Object.defineProperty(exports,"onlineParser",{enumerable:!0,get:function(){return _interopRequireDefault(_onlineParser).default}})},{"./CharacterStream":74,"./RuleHelpers":75,"./Rules":76,"./onlineParser":78}],78:[function(require,module,exports){"use strict";function getToken(stream,state,options){var lexRules=options.lexRules,parseRules=options.parseRules,eatWhitespace=options.eatWhitespace,editorConfig=options.editorConfig;if(state.rule&&0===state.rule.length?popRule(state):state.needsAdvance&&(state.needsAdvance=!1,advanceRule(state,!0)),stream.sol()){var tabSize=editorConfig&&editorConfig.tabSize||2;state.indentLevel=Math.floor(stream.indentation()/tabSize)}if(eatWhitespace(stream))return"ws";var token=lex(lexRules,stream);if(!token)return stream.match(/\S+/),pushRule(SpecialParseRules,state,"Invalid"),"invalidchar";if("Comment"===token.kind)return pushRule(SpecialParseRules,state,"Comment"),"comment";var backupState=assign({},state);if("Punctuation"===token.kind)if(/^[{([]/.test(token.value))state.levels=(state.levels||[]).concat(state.indentLevel+1);else if(/^[})\]]/.test(token.value)){var levels=state.levels=(state.levels||[]).slice(0,-1);state.indentLevel&&levels.length>0&&levels[levels.length-1]<state.indentLevel&&(state.indentLevel=levels[levels.length-1])}for(;state.rule;){var expected="function"==typeof state.rule?0===state.step?state.rule(token,stream):null:state.rule[state.step];if(state.needsSeperator&&(expected=expected&&expected.separator),expected){if(expected.ofRule&&(expected=expected.ofRule),"string"==typeof expected){pushRule(parseRules,state,expected);continue}if(expected.match&&expected.match(token))return expected.update&&expected.update(state,token),"Punctuation"===token.kind?advanceRule(state,!0):state.needsAdvance=!0,expected.style}unsuccessful(state)}return assign(state,backupState),pushRule(SpecialParseRules,state,"Invalid"),"invalidchar"}function assign(to,from){for(var keys=Object.keys(from),i=0;i<keys.length;i++)to[keys[i]]=from[keys[i]];return to}function pushRule(rules,state,ruleKind){if(!rules[ruleKind])throw new TypeError("Unknown rule: "+ruleKind);state.prevState=_extends({},state),state.kind=ruleKind,state.name=null,state.type=null,state.rule=rules[ruleKind],state.step=0,state.needsSeperator=!1}function popRule(state){state.prevState&&(state.kind=state.prevState.kind,state.name=state.prevState.name,state.type=state.prevState.type,state.rule=state.prevState.rule,state.step=state.prevState.step,state.needsSeperator=state.prevState.needsSeperator,state.prevState=state.prevState.prevState)}function advanceRule(state,successful){if(isList(state)){if(state.rule&&state.rule[state.step].separator){var separator=state.rule[state.step].separator;if(state.needsSeperator=!state.needsSeperator,!state.needsSeperator&&separator.ofRule)return}if(successful)return}for(state.needsSeperator=!1,state.step++;state.rule&&!(Array.isArray(state.rule)&&state.step<state.rule.length);)popRule(state),state.rule&&(isList(state)?state.rule&&state.rule[state.step].separator&&(state.needsSeperator=!state.needsSeperator):(state.needsSeperator=!1,state.step++))}function isList(state){return Array.isArray(state.rule)&&"string"!=typeof state.rule[state.step]&&state.rule[state.step].isList}function unsuccessful(state){for(;state.rule&&(!Array.isArray(state.rule)||!state.rule[state.step].ofRule);)popRule(state);state.rule&&advanceRule(state,!1)}function lex(lexRules,stream){for(var kinds=Object.keys(lexRules),i=0;i<kinds.length;i++){var match=stream.match(lexRules[kinds[i]]);if(match&&match instanceof Array)return{kind:kinds[i],value:match[0]}}}Object.defineProperty(exports,"__esModule",{value:!0});var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key])}return target};exports.default=function(){var options=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{eatWhitespace:function(stream){return stream.eatWhile(_Rules.isIgnored)},lexRules:_Rules.LexRules,parseRules:_Rules.ParseRules,editorConfig:{}};return{startState:function(){var initialState={level:0,step:0,name:null,kind:null,type:null,rule:null,needsSeperator:!1,prevState:null};return pushRule(options.parseRules,initialState,"Document"),initialState},token:function(stream,state){return getToken(stream,state,options)}}};var _Rules=require("./Rules"),SpecialParseRules={Invalid:[],Comment:[]}},{"./Rules":76}],79:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function offsetToPosition(text,loc){var buf=text.slice(0,loc),lines=buf.split("\n").length-1,lastLineIndex=buf.lastIndexOf("\n");return new Position(lines,loc-lastLineIndex-1)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.offsetToPosition=offsetToPosition,exports.locToRange=function(text,loc){var start=offsetToPosition(text,loc.start),end=offsetToPosition(text,loc.end);return new Range(start,end)};var Range=exports.Range=function(){function Range(start,end){var _this=this;_classCallCheck(this,Range),this.containsPosition=function(position){return _this.start.line===position.line?_this.start.character<=position.character:_this.end.line===position.line?_this.end.character>=position.character:_this.start.line<=position.line&&_this.end.line>=position.line},this.start=start,this.end=end}return Range.prototype.setStart=function(line,character){this.start=new Position(line,character)},Range.prototype.setEnd=function(line,character){this.end=new Position(line,character)},Range}(),Position=exports.Position=function(){function Position(line,character){var _this2=this;_classCallCheck(this,Position),this.lessThanOrEqualTo=function(position){return _this2.line<position.line||_this2.line===position.line&&_this2.character<=position.character},this.line=line,this.character=character}return Position.prototype.setLine=function(line){this.line=line},Position.prototype.setCharacter=function(character){this.character=character},Position}()},{}],80:[function(require,module,exports){"use strict";function pointToOffset(text,point){var linesUntilPosition=text.split("\n").slice(0,point.line);return point.character+linesUntilPosition.map(function(line){return line.length+1}).reduce(function(a,b){return a+b},0)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.getASTNodeAtPosition=function(query,ast,point){var offset=pointToOffset(query,point),nodeContainingPosition=void 0;return(0,_graphql.visit)(ast,{enter:function(node){if(!("Name"!==node.kind&&node.loc.start<=offset&&offset<=node.loc.end))return!1;nodeContainingPosition=node},leave:function(node){if(node.loc.start<=offset&&offset<=node.loc.end)return!1}}),nodeContainingPosition},exports.pointToOffset=pointToOffset;require("./Range");var _graphql=require("graphql")},{"./Range":79,graphql:92}],81:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _getASTNodeAtPosition=require("./getASTNodeAtPosition");Object.defineProperty(exports,"getASTNodeAtPosition",{enumerable:!0,get:function(){return _getASTNodeAtPosition.getASTNodeAtPosition}}),Object.defineProperty(exports,"pointToOffset",{enumerable:!0,get:function(){return _getASTNodeAtPosition.pointToOffset}});var _Range=require("./Range");Object.defineProperty(exports,"Position",{enumerable:!0,get:function(){return _Range.Position}}),Object.defineProperty(exports,"Range",{enumerable:!0,get:function(){return _Range.Range}}),Object.defineProperty(exports,"locToRange",{enumerable:!0,get:function(){return _Range.locToRange}}),Object.defineProperty(exports,"offsetToPosition",{enumerable:!0,get:function(){return _Range.offsetToPosition}});var _validateWithCustomRules=require("./validateWithCustomRules");Object.defineProperty(exports,"validateWithCustomRules",{enumerable:!0,get:function(){return _validateWithCustomRules.validateWithCustomRules}})},{"./Range":79,"./getASTNodeAtPosition":80,"./validateWithCustomRules":82}],82:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.validateWithCustomRules=function(schema,ast,customRules){var NoUnusedFragments=require("graphql/validation/rules/NoUnusedFragments").NoUnusedFragments,rules=_graphql.specifiedRules.filter(function(rule){return rule!==NoUnusedFragments}),typeInfo=new _graphql.TypeInfo(schema);customRules&&Array.prototype.push.apply(rules,customRules);var errors=(0,_graphql.validate)(schema,ast,rules,typeInfo);return errors.length>0?errors:[]};var _graphql=require("graphql")},{graphql:92,"graphql/validation/rules/NoUnusedFragments":149}],83:[function(require,module,exports){"use strict";function GraphQLError(message,nodes,source,positions,path,originalError){var _source=source;if(!_source&&nodes&&nodes.length>0){var node=nodes[0];_source=node&&node.loc&&node.loc.source}var _positions=positions;!_positions&&nodes&&(_positions=nodes.filter(function(node){return Boolean(node.loc)}).map(function(node){return node.loc.start})),_positions&&0===_positions.length&&(_positions=void 0);var _locations=void 0,_source2=_source;_source2&&_positions&&(_locations=_positions.map(function(pos){return(0,_location.getLocation)(_source2,pos)})),Object.defineProperties(this,{message:{value:message,enumerable:!0,writable:!0},locations:{value:_locations||void 0,enumerable:!0},path:{value:path||void 0,enumerable:!0},nodes:{value:nodes||void 0},source:{value:_source||void 0},positions:{value:_positions||void 0},originalError:{value:originalError}}),originalError&&originalError.stack?Object.defineProperty(this,"stack",{value:originalError.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,GraphQLError):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}Object.defineProperty(exports,"__esModule",{value:!0}),exports.GraphQLError=GraphQLError;var _location=require("../language/location");GraphQLError.prototype=Object.create(Error.prototype,{constructor:{value:GraphQLError},name:{value:"GraphQLError"}})},{"../language/location":104}],84:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.formatError=function(error){return(0,_invariant2.default)(error,"Received null or undefined error."),{message:error.message,locations:error.locations,path:error.path}};var _invariant2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(require("../jsutils/invariant"))},{"../jsutils/invariant":94}],85:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _GraphQLError=require("./GraphQLError");Object.defineProperty(exports,"GraphQLError",{enumerable:!0,get:function(){return _GraphQLError.GraphQLError}});var _syntaxError=require("./syntaxError");Object.defineProperty(exports,"syntaxError",{enumerable:!0,get:function(){return _syntaxError.syntaxError}});var _locatedError=require("./locatedError");Object.defineProperty(exports,"locatedError",{enumerable:!0,get:function(){return _locatedError.locatedError}});var _formatError=require("./formatError");Object.defineProperty(exports,"formatError",{enumerable:!0,get:function(){return _formatError.formatError}})},{"./GraphQLError":83,"./formatError":84,"./locatedError":86,"./syntaxError":87}],86:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.locatedError=function(originalError,nodes,path){if(originalError&&originalError.path)return originalError;var message=originalError?originalError.message||String(originalError):"An unknown error occurred.";return new _GraphQLError.GraphQLError(message,originalError&&originalError.nodes||nodes,originalError&&originalError.source,originalError&&originalError.positions,path,originalError)};var _GraphQLError=require("./GraphQLError")},{"./GraphQLError":83}],87:[function(require,module,exports){"use strict";function highlightSourceAtLocation(source,location){var line=location.line,prevLineNum=(line-1).toString(),lineNum=line.toString(),nextLineNum=(line+1).toString(),padLen=nextLineNum.length,lines=source.body.split(/\r\n|[\n\r]/g);return(line>=2?lpad(padLen,prevLineNum)+": "+lines[line-2]+"\n":"")+lpad(padLen,lineNum)+": "+lines[line-1]+"\n"+Array(2+padLen+location.column).join(" ")+"^\n"+(line<lines.length?lpad(padLen,nextLineNum)+": "+lines[line]+"\n":"")}function lpad(len,str){return Array(len-str.length+1).join(" ")+str}Object.defineProperty(exports,"__esModule",{value:!0}),exports.syntaxError=function(source,position,description){var location=(0,_location.getLocation)(source,position);return new _GraphQLError.GraphQLError("Syntax Error "+source.name+" ("+location.line+":"+location.column+") "+description+"\n\n"+highlightSourceAtLocation(source,location),void 0,source,[position])};var _location=require("../language/location"),_GraphQLError=require("./GraphQLError")},{"../language/location":104,"./GraphQLError":83}],88:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function executeImpl(schema,document,rootValue,contextValue,variableValues,operationName,fieldResolver){assertValidExecutionArguments(schema,document,variableValues);var context=void 0;try{context=buildExecutionContext(schema,document,rootValue,contextValue,variableValues,operationName,fieldResolver)}catch(error){return Promise.resolve({errors:[error]})}return Promise.resolve(executeOperation(context,context.operation,rootValue)).then(function(data){return 0===context.errors.length?{data:data}:{errors:context.errors,data:data}})}function responsePathAsArray(path){for(var flattened=[],curr=path;curr;)flattened.push(curr.key),curr=curr.prev;return flattened.reverse()}function addPath(prev,key){return{prev:prev,key:key}}function assertValidExecutionArguments(schema,document,rawVariableValues){(0,_invariant2.default)(schema,"Must provide schema"),(0,_invariant2.default)(document,"Must provide document"),(0,_invariant2.default)(schema instanceof _schema.GraphQLSchema,"Schema must be an instance of GraphQLSchema. Also ensure that there are not multiple versions of GraphQL installed in your node_modules directory."),(0,_invariant2.default)(!rawVariableValues||"object"==typeof rawVariableValues,"Variables must be provided as an Object where each property is a variable value. Perhaps look to see if an unparsed JSON string was provided.")}function buildExecutionContext(schema,document,rootValue,contextValue,rawVariableValues,operationName,fieldResolver){var errors=[],operation=void 0,fragments=Object.create(null);if(document.definitions.forEach(function(definition){switch(definition.kind){case Kind.OPERATION_DEFINITION:if(!operationName&&operation)throw new _error.GraphQLError("Must provide operation name if query contains multiple operations.");(!operationName||definition.name&&definition.name.value===operationName)&&(operation=definition);break;case Kind.FRAGMENT_DEFINITION:fragments[definition.name.value]=definition;break;default:throw new _error.GraphQLError("GraphQL cannot execute a request containing a "+definition.kind+".",[definition])}}),!operation)throw operationName?new _error.GraphQLError('Unknown operation named "'+operationName+'".'):new _error.GraphQLError("Must provide an operation.");var variableValues=(0,_values.getVariableValues)(schema,operation.variableDefinitions||[],rawVariableValues||{});return{schema:schema,fragments:fragments,rootValue:rootValue,contextValue:contextValue,operation:operation,variableValues:variableValues,fieldResolver:fieldResolver||defaultFieldResolver,errors:errors}}function executeOperation(exeContext,operation,rootValue){var type=getOperationRootType(exeContext.schema,operation),fields=collectFields(exeContext,type,operation.selectionSet,Object.create(null),Object.create(null));try{var result="mutation"===operation.operation?executeFieldsSerially(exeContext,type,rootValue,void 0,fields):executeFields(exeContext,type,rootValue,void 0,fields),promise=getPromise(result);return promise?promise.then(void 0,function(error){return exeContext.errors.push(error),Promise.resolve(null)}):result}catch(error){return exeContext.errors.push(error),null}}function getOperationRootType(schema,operation){switch(operation.operation){case"query":return schema.getQueryType();case"mutation":var mutationType=schema.getMutationType();if(!mutationType)throw new _error.GraphQLError("Schema is not configured for mutations",[operation]);return mutationType;case"subscription":var subscriptionType=schema.getSubscriptionType();if(!subscriptionType)throw new _error.GraphQLError("Schema is not configured for subscriptions",[operation]);return subscriptionType;default:throw new _error.GraphQLError("Can only execute queries, mutations and subscriptions",[operation])}}function executeFieldsSerially(exeContext,parentType,sourceValue,path,fields){return Object.keys(fields).reduce(function(prevPromise,responseName){return prevPromise.then(function(results){var fieldNodes=fields[responseName],fieldPath=addPath(path,responseName),result=resolveField(exeContext,parentType,sourceValue,fieldNodes,fieldPath);if(void 0===result)return results;var promise=getPromise(result);return promise?promise.then(function(resolvedResult){return results[responseName]=resolvedResult,results}):(results[responseName]=result,results)})},Promise.resolve({}))}function executeFields(exeContext,parentType,sourceValue,path,fields){var containsPromise=!1,finalResults=Object.keys(fields).reduce(function(results,responseName){var fieldNodes=fields[responseName],fieldPath=addPath(path,responseName),result=resolveField(exeContext,parentType,sourceValue,fieldNodes,fieldPath);return void 0===result?results:(results[responseName]=result,getPromise(result)&&(containsPromise=!0),results)},Object.create(null));return containsPromise?promiseForObject(finalResults):finalResults}function collectFields(exeContext,runtimeType,selectionSet,fields,visitedFragmentNames){for(var i=0;i<selectionSet.selections.length;i++){var selection=selectionSet.selections[i];switch(selection.kind){case Kind.FIELD:if(!shouldIncludeNode(exeContext,selection))continue;var _name=getFieldEntryKey(selection);fields[_name]||(fields[_name]=[]),fields[_name].push(selection);break;case Kind.INLINE_FRAGMENT:if(!shouldIncludeNode(exeContext,selection)||!doesFragmentConditionMatch(exeContext,selection,runtimeType))continue;collectFields(exeContext,runtimeType,selection.selectionSet,fields,visitedFragmentNames);break;case Kind.FRAGMENT_SPREAD:var fragName=selection.name.value;if(visitedFragmentNames[fragName]||!shouldIncludeNode(exeContext,selection))continue;visitedFragmentNames[fragName]=!0;var fragment=exeContext.fragments[fragName];if(!fragment||!doesFragmentConditionMatch(exeContext,fragment,runtimeType))continue;collectFields(exeContext,runtimeType,fragment.selectionSet,fields,visitedFragmentNames)}}return fields}function shouldIncludeNode(exeContext,node){var skip=(0,_values.getDirectiveValues)(_directives.GraphQLSkipDirective,node,exeContext.variableValues);if(skip&&!0===skip.if)return!1;var include=(0,_values.getDirectiveValues)(_directives.GraphQLIncludeDirective,node,exeContext.variableValues);return!include||!1!==include.if}function doesFragmentConditionMatch(exeContext,fragment,type){var typeConditionNode=fragment.typeCondition;if(!typeConditionNode)return!0;var conditionalType=(0,_typeFromAST.typeFromAST)(exeContext.schema,typeConditionNode);return conditionalType===type||!!(0,_definition.isAbstractType)(conditionalType)&&exeContext.schema.isPossibleType(conditionalType,type)}function promiseForObject(object){var keys=Object.keys(object),valuesAndPromises=keys.map(function(name){return object[name]});return Promise.all(valuesAndPromises).then(function(values){return values.reduce(function(resolvedObject,value,i){return resolvedObject[keys[i]]=value,resolvedObject},Object.create(null))})}function getFieldEntryKey(node){return node.alias?node.alias.value:node.name.value}function resolveField(exeContext,parentType,source,fieldNodes,path){var fieldName=fieldNodes[0].name.value,fieldDef=getFieldDef(exeContext.schema,parentType,fieldName);if(fieldDef){var resolveFn=fieldDef.resolve||exeContext.fieldResolver,info=buildResolveInfo(exeContext,fieldDef,fieldNodes,parentType,path),result=resolveFieldValueOrError(exeContext,fieldDef,fieldNodes,resolveFn,source,info);return completeValueCatchingError(exeContext,fieldDef.type,fieldNodes,info,path,result)}}function buildResolveInfo(exeContext,fieldDef,fieldNodes,parentType,path){return{fieldName:fieldNodes[0].name.value,fieldNodes:fieldNodes,returnType:fieldDef.type,parentType:parentType,path:path,schema:exeContext.schema,fragments:exeContext.fragments,rootValue:exeContext.rootValue,operation:exeContext.operation,variableValues:exeContext.variableValues}}function resolveFieldValueOrError(exeContext,fieldDef,fieldNodes,resolveFn,source,info){try{return resolveFn(source,(0,_values.getArgumentValues)(fieldDef,fieldNodes[0],exeContext.variableValues),exeContext.contextValue,info)}catch(error){return error instanceof Error?error:new Error(error)}}function completeValueCatchingError(exeContext,returnType,fieldNodes,info,path,result){if(returnType instanceof _definition.GraphQLNonNull)return completeValueWithLocatedError(exeContext,returnType,fieldNodes,info,path,result);try{var completed=completeValueWithLocatedError(exeContext,returnType,fieldNodes,info,path,result),promise=getPromise(completed);return promise?promise.then(void 0,function(error){return exeContext.errors.push(error),Promise.resolve(null)}):completed}catch(error){return exeContext.errors.push(error),null}}function completeValueWithLocatedError(exeContext,returnType,fieldNodes,info,path,result){try{var completed=completeValue(exeContext,returnType,fieldNodes,info,path,result),promise=getPromise(completed);return promise?promise.then(void 0,function(error){return Promise.reject((0,_error.locatedError)(error,fieldNodes,responsePathAsArray(path)))}):completed}catch(error){throw(0,_error.locatedError)(error,fieldNodes,responsePathAsArray(path))}}function completeValue(exeContext,returnType,fieldNodes,info,path,result){var promise=getPromise(result);if(promise)return promise.then(function(resolved){return completeValue(exeContext,returnType,fieldNodes,info,path,resolved)});if(result instanceof Error)throw result;if(returnType instanceof _definition.GraphQLNonNull){var completed=completeValue(exeContext,returnType.ofType,fieldNodes,info,path,result);if(null===completed)throw new Error("Cannot return null for non-nullable field "+info.parentType.name+"."+info.fieldName+".");return completed}if((0,_isNullish2.default)(result))return null;if(returnType instanceof _definition.GraphQLList)return completeListValue(exeContext,returnType,fieldNodes,info,path,result);if((0,_definition.isLeafType)(returnType))return completeLeafValue(returnType,result);if((0,_definition.isAbstractType)(returnType))return completeAbstractValue(exeContext,returnType,fieldNodes,info,path,result);if(returnType instanceof _definition.GraphQLObjectType)return completeObjectValue(exeContext,returnType,fieldNodes,info,path,result);throw new Error('Cannot complete value of unexpected type "'+String(returnType)+'".')}function completeListValue(exeContext,returnType,fieldNodes,info,path,result){(0,_invariant2.default)((0,_iterall.isCollection)(result),"Expected Iterable, but did not find one for field "+info.parentType.name+"."+info.fieldName+".");var itemType=returnType.ofType,containsPromise=!1,completedResults=[];return(0,_iterall.forEach)(result,function(item,index){var fieldPath=addPath(path,index),completedItem=completeValueCatchingError(exeContext,itemType,fieldNodes,info,fieldPath,item);!containsPromise&&getPromise(completedItem)&&(containsPromise=!0),completedResults.push(completedItem)}),containsPromise?Promise.all(completedResults):completedResults}function completeLeafValue(returnType,result){(0,_invariant2.default)(returnType.serialize,"Missing serialize method on type");var serializedResult=returnType.serialize(result);if((0,_isNullish2.default)(serializedResult))throw new Error('Expected a value of type "'+String(returnType)+'" but received: '+String(result));return serializedResult}function completeAbstractValue(exeContext,returnType,fieldNodes,info,path,result){var runtimeType=returnType.resolveType?returnType.resolveType(result,exeContext.contextValue,info):defaultResolveTypeFn(result,exeContext.contextValue,info,returnType),promise=getPromise(runtimeType);return promise?promise.then(function(resolvedRuntimeType){return completeObjectValue(exeContext,ensureValidRuntimeType(resolvedRuntimeType,exeContext,returnType,fieldNodes,info,result),fieldNodes,info,path,result)}):completeObjectValue(exeContext,ensureValidRuntimeType(runtimeType,exeContext,returnType,fieldNodes,info,result),fieldNodes,info,path,result)}function ensureValidRuntimeType(runtimeTypeOrName,exeContext,returnType,fieldNodes,info,result){var runtimeType="string"==typeof runtimeTypeOrName?exeContext.schema.getType(runtimeTypeOrName):runtimeTypeOrName;if(!(runtimeType instanceof _definition.GraphQLObjectType))throw new _error.GraphQLError("Abstract type "+returnType.name+" must resolve to an Object type at runtime for field "+info.parentType.name+"."+info.fieldName+' with value "'+String(result)+'", received "'+String(runtimeType)+'".',fieldNodes);if(!exeContext.schema.isPossibleType(returnType,runtimeType))throw new _error.GraphQLError('Runtime Object type "'+runtimeType.name+'" is not a possible type for "'+returnType.name+'".',fieldNodes);return runtimeType}function completeObjectValue(exeContext,returnType,fieldNodes,info,path,result){if(returnType.isTypeOf){var isTypeOf=returnType.isTypeOf(result,exeContext.contextValue,info),promise=getPromise(isTypeOf);if(promise)return promise.then(function(isTypeOfResult){if(!isTypeOfResult)throw invalidReturnTypeError(returnType,result,fieldNodes);return collectAndExecuteSubfields(exeContext,returnType,fieldNodes,info,path,result)});if(!isTypeOf)throw invalidReturnTypeError(returnType,result,fieldNodes)}return collectAndExecuteSubfields(exeContext,returnType,fieldNodes,info,path,result)}function invalidReturnTypeError(returnType,result,fieldNodes){return new _error.GraphQLError('Expected value of type "'+returnType.name+'" but got: '+String(result)+".",fieldNodes)}function collectAndExecuteSubfields(exeContext,returnType,fieldNodes,info,path,result){for(var subFieldNodes=Object.create(null),visitedFragmentNames=Object.create(null),i=0;i<fieldNodes.length;i++){var selectionSet=fieldNodes[i].selectionSet;selectionSet&&(subFieldNodes=collectFields(exeContext,returnType,selectionSet,subFieldNodes,visitedFragmentNames))}return executeFields(exeContext,returnType,result,path,subFieldNodes)}function defaultResolveTypeFn(value,context,info,abstractType){for(var possibleTypes=info.schema.getPossibleTypes(abstractType),promisedIsTypeOfResults=[],i=0;i<possibleTypes.length;i++){var type=possibleTypes[i];if(type.isTypeOf){var isTypeOfResult=type.isTypeOf(value,context,info),promise=getPromise(isTypeOfResult);if(promise)promisedIsTypeOfResults[i]=promise;else if(isTypeOfResult)return type}}if(promisedIsTypeOfResults.length)return Promise.all(promisedIsTypeOfResults).then(function(isTypeOfResults){for(var _i=0;_i<isTypeOfResults.length;_i++)if(isTypeOfResults[_i])return possibleTypes[_i]})}function getPromise(value){if("object"==typeof value&&null!==value&&"function"==typeof value.then)return value}function getFieldDef(schema,parentType,fieldName){return fieldName===_introspection.SchemaMetaFieldDef.name&&schema.getQueryType()===parentType?_introspection.SchemaMetaFieldDef:fieldName===_introspection.TypeMetaFieldDef.name&&schema.getQueryType()===parentType?_introspection.TypeMetaFieldDef:fieldName===_introspection.TypeNameMetaFieldDef.name?_introspection.TypeNameMetaFieldDef:parentType.getFields()[fieldName]}Object.defineProperty(exports,"__esModule",{value:!0}),exports.defaultFieldResolver=void 0,exports.execute=function(argsOrSchema,document,rootValue,contextValue,variableValues,operationName,fieldResolver){var args=1===arguments.length?argsOrSchema:void 0,schema=args?args.schema:argsOrSchema;return args?executeImpl(schema,args.document,args.rootValue,args.contextValue,args.variableValues,args.operationName,args.fieldResolver):executeImpl(schema,document,rootValue,contextValue,variableValues,operationName,fieldResolver)},exports.responsePathAsArray=responsePathAsArray,exports.addPath=addPath,exports.assertValidExecutionArguments=assertValidExecutionArguments,exports.buildExecutionContext=buildExecutionContext,exports.getOperationRootType=getOperationRootType,exports.collectFields=collectFields,exports.buildResolveInfo=buildResolveInfo,exports.resolveFieldValueOrError=resolveFieldValueOrError,exports.getFieldDef=getFieldDef;var _iterall=require("iterall"),_error=require("../error"),_invariant2=_interopRequireDefault(require("../jsutils/invariant")),_isNullish2=_interopRequireDefault(require("../jsutils/isNullish")),_typeFromAST=require("../utilities/typeFromAST"),Kind=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(require("../language/kinds")),_values=require("./values"),_definition=require("../type/definition"),_schema=require("../type/schema"),_introspection=require("../type/introspection"),_directives=require("../type/directives"),defaultFieldResolver=exports.defaultFieldResolver=function(source,args,context,info){if("object"==typeof source||"function"==typeof source){var property=source[info.fieldName];return"function"==typeof property?source[info.fieldName](args,context,info):property}}},{"../error":85,"../jsutils/invariant":94,"../jsutils/isNullish":96,"../language/kinds":102,"../type/definition":112,"../type/directives":113,"../type/introspection":115,"../type/schema":117,"../utilities/typeFromAST":135,"./values":90,iterall:166}],89:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _execute=require("./execute");Object.defineProperty(exports,"execute",{enumerable:!0,get:function(){return _execute.execute}}),Object.defineProperty(exports,"defaultFieldResolver",{enumerable:!0,get:function(){return _execute.defaultFieldResolver}}),Object.defineProperty(exports,"responsePathAsArray",{enumerable:!0,get:function(){return _execute.responsePathAsArray}});var _values=require("./values");Object.defineProperty(exports,"getDirectiveValues",{enumerable:!0,get:function(){return _values.getDirectiveValues}})},{"./execute":88,"./values":90}],90:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function getArgumentValues(def,node,variableValues){var argDefs=def.args,argNodes=node.arguments;if(!argDefs||!argNodes)return{};for(var coercedValues=Object.create(null),argNodeMap=(0,_keyMap2.default)(argNodes,function(arg){return arg.name.value}),i=0;i<argDefs.length;i++){var argDef=argDefs[i],name=argDef.name,argType=argDef.type,argumentNode=argNodeMap[name],defaultValue=argDef.defaultValue;if(argumentNode)if(argumentNode.value.kind===Kind.VARIABLE){var variableName=argumentNode.value.name.value;if(variableValues&&!(0,_isInvalid2.default)(variableValues[variableName]))coercedValues[name]=variableValues[variableName];else if((0,_isInvalid2.default)(defaultValue)){if(argType instanceof _definition.GraphQLNonNull)throw new _error.GraphQLError('Argument "'+name+'" of required type "'+String(argType)+'" was provided the variable "$'+variableName+'" which was not provided a runtime value.',[argumentNode.value])}else coercedValues[name]=defaultValue}else{var valueNode=argumentNode.value,coercedValue=(0,_valueFromAST.valueFromAST)(valueNode,argType,variableValues);if((0,_isInvalid2.default)(coercedValue)){var errors=(0,_isValidLiteralValue.isValidLiteralValue)(argType,valueNode),message=errors?"\n"+errors.join("\n"):"";throw new _error.GraphQLError('Argument "'+name+'" got invalid value '+(0,_printer.print)(valueNode)+"."+message,[argumentNode.value])}coercedValues[name]=coercedValue}else if((0,_isInvalid2.default)(defaultValue)){if(argType instanceof _definition.GraphQLNonNull)throw new _error.GraphQLError('Argument "'+name+'" of required type "'+String(argType)+'" was not provided.',[node])}else coercedValues[name]=defaultValue}return coercedValues}function coerceValue(type,value){var _value=value;if(!(0,_isInvalid2.default)(_value)){if(type instanceof _definition.GraphQLNonNull){if(null===_value)return;return coerceValue(type.ofType,_value)}if(null===_value)return null;if(type instanceof _definition.GraphQLList){var itemType=type.ofType;if((0,_iterall.isCollection)(_value)){var coercedValues=[],valueIter=(0,_iterall.createIterator)(_value);if(!valueIter)return;for(var step=void 0;!(step=valueIter.next()).done;){var itemValue=coerceValue(itemType,step.value);if((0,_isInvalid2.default)(itemValue))return;coercedValues.push(itemValue)}return coercedValues}var coercedValue=coerceValue(itemType,_value);if((0,_isInvalid2.default)(coercedValue))return;return[coerceValue(itemType,_value)]}if(type instanceof _definition.GraphQLInputObjectType){if("object"!=typeof _value)return;for(var coercedObj=Object.create(null),fields=type.getFields(),fieldNames=Object.keys(fields),i=0;i<fieldNames.length;i++){var fieldName=fieldNames[i],field=fields[fieldName];if((0,_isInvalid2.default)(_value[fieldName]))if((0,_isInvalid2.default)(field.defaultValue)){if(field.type instanceof _definition.GraphQLNonNull)return}else coercedObj[fieldName]=field.defaultValue;else{var fieldValue=coerceValue(field.type,_value[fieldName]);if((0,_isInvalid2.default)(fieldValue))return;coercedObj[fieldName]=fieldValue}}return coercedObj}(0,_invariant2.default)(type instanceof _definition.GraphQLScalarType||type instanceof _definition.GraphQLEnumType,"Must be input type");var parsed=type.parseValue(_value);if(!(0,_isNullish2.default)(parsed))return parsed}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.getVariableValues=function(schema,varDefNodes,inputs){for(var coercedValues=Object.create(null),i=0;i<varDefNodes.length;i++){var varDefNode=varDefNodes[i],varName=varDefNode.variable.name.value,varType=(0,_typeFromAST.typeFromAST)(schema,varDefNode.type);if(!(0,_definition.isInputType)(varType))throw new _error.GraphQLError('Variable "$'+varName+'" expected value of type "'+(0,_printer.print)(varDefNode.type)+'" which cannot be used as an input type.',[varDefNode.type]);var value=inputs[varName];if((0,_isInvalid2.default)(value)){var defaultValue=varDefNode.defaultValue;if(defaultValue&&(coercedValues[varName]=(0,_valueFromAST.valueFromAST)(defaultValue,varType)),varType instanceof _definition.GraphQLNonNull)throw new _error.GraphQLError('Variable "$'+varName+'" of required type "'+String(varType)+'" was not provided.',[varDefNode])}else{var errors=(0,_isValidJSValue.isValidJSValue)(value,varType);if(errors.length){var message=errors?"\n"+errors.join("\n"):"";throw new _error.GraphQLError('Variable "$'+varName+'" got invalid value '+JSON.stringify(value)+"."+message,[varDefNode])}var coercedValue=coerceValue(varType,value);(0,_invariant2.default)(!(0,_isInvalid2.default)(coercedValue),"Should have reported error."),coercedValues[varName]=coercedValue}}return coercedValues},exports.getArgumentValues=getArgumentValues,exports.getDirectiveValues=function(directiveDef,node,variableValues){var directiveNode=node.directives&&(0,_find2.default)(node.directives,function(directive){return directive.name.value===directiveDef.name});if(directiveNode)return getArgumentValues(directiveDef,directiveNode,variableValues)};var _iterall=require("iterall"),_error=require("../error"),_find2=_interopRequireDefault(require("../jsutils/find")),_invariant2=_interopRequireDefault(require("../jsutils/invariant")),_isNullish2=_interopRequireDefault(require("../jsutils/isNullish")),_isInvalid2=_interopRequireDefault(require("../jsutils/isInvalid")),_keyMap2=_interopRequireDefault(require("../jsutils/keyMap")),_typeFromAST=require("../utilities/typeFromAST"),_valueFromAST=require("../utilities/valueFromAST"),_isValidJSValue=require("../utilities/isValidJSValue"),_isValidLiteralValue=require("../utilities/isValidLiteralValue"),Kind=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(require("../language/kinds")),_printer=require("../language/printer"),_definition=require("../type/definition")},{"../error":85,"../jsutils/find":93,"../jsutils/invariant":94,"../jsutils/isInvalid":95,"../jsutils/isNullish":96,"../jsutils/keyMap":97,"../language/kinds":102,"../language/printer":106,"../type/definition":112,"../utilities/isValidJSValue":130,"../utilities/isValidLiteralValue":131,"../utilities/typeFromAST":135,"../utilities/valueFromAST":136,iterall:166}],91:[function(require,module,exports){"use strict";function graphqlImpl(schema,source,rootValue,contextValue,variableValues,operationName,fieldResolver){return new Promise(function(resolve){var document=void 0;try{document=(0,_parser.parse)(source)}catch(syntaxError){return resolve({errors:[syntaxError]})}var validationErrors=(0,_validate.validate)(schema,document);if(validationErrors.length>0)return resolve({errors:validationErrors});resolve((0,_execute.execute)(schema,document,rootValue,contextValue,variableValues,operationName,fieldResolver))})}Object.defineProperty(exports,"__esModule",{value:!0}),exports.graphql=function(argsOrSchema,source,rootValue,contextValue,variableValues,operationName,fieldResolver){var args=1===arguments.length?argsOrSchema:void 0,schema=args?args.schema:argsOrSchema;return args?graphqlImpl(schema,args.source,args.rootValue,args.contextValue,args.variableValues,args.operationName,args.fieldResolver):graphqlImpl(schema,source,rootValue,contextValue,variableValues,operationName,fieldResolver)};var _parser=require("./language/parser"),_validate=require("./validation/validate"),_execute=require("./execution/execute")},{"./execution/execute":88,"./language/parser":105,"./validation/validate":165}],92:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _graphql=require("./graphql");Object.defineProperty(exports,"graphql",{enumerable:!0,get:function(){return _graphql.graphql}});var _type=require("./type");Object.defineProperty(exports,"GraphQLSchema",{enumerable:!0,get:function(){return _type.GraphQLSchema}}),Object.defineProperty(exports,"GraphQLScalarType",{enumerable:!0,get:function(){return _type.GraphQLScalarType}}),Object.defineProperty(exports,"GraphQLObjectType",{enumerable:!0,get:function(){return _type.GraphQLObjectType}}),Object.defineProperty(exports,"GraphQLInterfaceType",{enumerable:!0,get:function(){return _type.GraphQLInterfaceType}}),Object.defineProperty(exports,"GraphQLUnionType",{enumerable:!0,get:function(){return _type.GraphQLUnionType}}),Object.defineProperty(exports,"GraphQLEnumType",{enumerable:!0,get:function(){return _type.GraphQLEnumType}}),Object.defineProperty(exports,"GraphQLInputObjectType",{enumerable:!0,get:function(){return _type.GraphQLInputObjectType}}),Object.defineProperty(exports,"GraphQLList",{enumerable:!0,get:function(){return _type.GraphQLList}}),Object.defineProperty(exports,"GraphQLNonNull",{enumerable:!0,get:function(){return _type.GraphQLNonNull}}),Object.defineProperty(exports,"GraphQLDirective",{enumerable:!0,get:function(){return _type.GraphQLDirective}}),Object.defineProperty(exports,"TypeKind",{enumerable:!0,get:function(){return _type.TypeKind}}),Object.defineProperty(exports,"DirectiveLocation",{enumerable:!0,get:function(){return _type.DirectiveLocation}}),Object.defineProperty(exports,"GraphQLInt",{enumerable:!0,get:function(){return _type.GraphQLInt}}),Object.defineProperty(exports,"GraphQLFloat",{enumerable:!0,get:function(){return _type.GraphQLFloat}}),Object.defineProperty(exports,"GraphQLString",{enumerable:!0,get:function(){return _type.GraphQLString}}),Object.defineProperty(exports,"GraphQLBoolean",{enumerable:!0,get:function(){return _type.GraphQLBoolean}}),Object.defineProperty(exports,"GraphQLID",{enumerable:!0,get:function(){return _type.GraphQLID}}),Object.defineProperty(exports,"specifiedDirectives",{enumerable:!0,get:function(){return _type.specifiedDirectives}}),Object.defineProperty(exports,"GraphQLIncludeDirective",{enumerable:!0,get:function(){return _type.GraphQLIncludeDirective}}),Object.defineProperty(exports,"GraphQLSkipDirective",{enumerable:!0,get:function(){return _type.GraphQLSkipDirective}}),Object.defineProperty(exports,"GraphQLDeprecatedDirective",{enumerable:!0,get:function(){return _type.GraphQLDeprecatedDirective}}),Object.defineProperty(exports,"DEFAULT_DEPRECATION_REASON",{enumerable:!0,get:function(){return _type.DEFAULT_DEPRECATION_REASON}}),Object.defineProperty(exports,"SchemaMetaFieldDef",{enumerable:!0,get:function(){return _type.SchemaMetaFieldDef}}),Object.defineProperty(exports,"TypeMetaFieldDef",{enumerable:!0,get:function(){return _type.TypeMetaFieldDef}}),Object.defineProperty(exports,"TypeNameMetaFieldDef",{enumerable:!0,get:function(){return _type.TypeNameMetaFieldDef}}),Object.defineProperty(exports,"__Schema",{enumerable:!0,get:function(){return _type.__Schema}}),Object.defineProperty(exports,"__Directive",{enumerable:!0,get:function(){return _type.__Directive}}),Object.defineProperty(exports,"__DirectiveLocation",{enumerable:!0,get:function(){return _type.__DirectiveLocation}}),Object.defineProperty(exports,"__Type",{enumerable:!0,get:function(){return _type.__Type}}),Object.defineProperty(exports,"__Field",{enumerable:!0,get:function(){return _type.__Field}}),Object.defineProperty(exports,"__InputValue",{enumerable:!0,get:function(){return _type.__InputValue}}),Object.defineProperty(exports,"__EnumValue",{enumerable:!0,get:function(){return _type.__EnumValue}}),Object.defineProperty(exports,"__TypeKind",{enumerable:!0,get:function(){return _type.__TypeKind}}),Object.defineProperty(exports,"isType",{enumerable:!0,get:function(){return _type.isType}}),Object.defineProperty(exports,"isInputType",{enumerable:!0,get:function(){return _type.isInputType}}),Object.defineProperty(exports,"isOutputType",{enumerable:!0,get:function(){return _type.isOutputType}}),Object.defineProperty(exports,"isLeafType",{enumerable:!0,get:function(){return _type.isLeafType}}),Object.defineProperty(exports,"isCompositeType",{enumerable:!0,get:function(){return _type.isCompositeType}}),Object.defineProperty(exports,"isAbstractType",{enumerable:!0,get:function(){return _type.isAbstractType}}),Object.defineProperty(exports,"isNamedType",{enumerable:!0,get:function(){return _type.isNamedType}}),Object.defineProperty(exports,"assertType",{enumerable:!0,get:function(){return _type.assertType}}),Object.defineProperty(exports,"assertInputType",{enumerable:!0,get:function(){return _type.assertInputType}}),Object.defineProperty(exports,"assertOutputType",{enumerable:!0,get:function(){return _type.assertOutputType}}),Object.defineProperty(exports,"assertLeafType",{enumerable:!0,get:function(){return _type.assertLeafType}}),Object.defineProperty(exports,"assertCompositeType",{enumerable:!0,get:function(){return _type.assertCompositeType}}),Object.defineProperty(exports,"assertAbstractType",{enumerable:!0,get:function(){return _type.assertAbstractType}}),Object.defineProperty(exports,"assertNamedType",{enumerable:!0,get:function(){return _type.assertNamedType}}),Object.defineProperty(exports,"getNullableType",{enumerable:!0,get:function(){return _type.getNullableType}}),Object.defineProperty(exports,"getNamedType",{enumerable:!0,get:function(){return _type.getNamedType}});var _language=require("./language");Object.defineProperty(exports,"Source",{enumerable:!0,get:function(){return _language.Source}}),Object.defineProperty(exports,"getLocation",{enumerable:!0,get:function(){return _language.getLocation}}),Object.defineProperty(exports,"parse",{enumerable:!0,get:function(){return _language.parse}}),Object.defineProperty(exports,"parseValue",{enumerable:!0,get:function(){return _language.parseValue}}),Object.defineProperty(exports,"parseType",{enumerable:!0,get:function(){return _language.parseType}}),Object.defineProperty(exports,"print",{enumerable:!0,get:function(){return _language.print}}),Object.defineProperty(exports,"visit",{enumerable:!0,get:function(){return _language.visit}}),Object.defineProperty(exports,"visitInParallel",{enumerable:!0,get:function(){return _language.visitInParallel}}),Object.defineProperty(exports,"visitWithTypeInfo",{enumerable:!0,get:function(){return _language.visitWithTypeInfo}}),Object.defineProperty(exports,"getVisitFn",{enumerable:!0,get:function(){return _language.getVisitFn}}),Object.defineProperty(exports,"Kind",{enumerable:!0,get:function(){return _language.Kind}}),Object.defineProperty(exports,"TokenKind",{enumerable:!0,get:function(){return _language.TokenKind}}),Object.defineProperty(exports,"BREAK",{enumerable:!0,get:function(){return _language.BREAK}});var _execution=require("./execution");Object.defineProperty(exports,"execute",{enumerable:!0,get:function(){return _execution.execute}}),Object.defineProperty(exports,"defaultFieldResolver",{enumerable:!0,get:function(){return _execution.defaultFieldResolver}}),Object.defineProperty(exports,"responsePathAsArray",{enumerable:!0,get:function(){return _execution.responsePathAsArray}}),Object.defineProperty(exports,"getDirectiveValues",{enumerable:!0,get:function(){return _execution.getDirectiveValues}});var _subscription=require("./subscription");Object.defineProperty(exports,"subscribe",{enumerable:!0,get:function(){return _subscription.subscribe}}),Object.defineProperty(exports,"createSourceEventStream",{enumerable:!0,get:function(){return _subscription.createSourceEventStream}});var _validation=require("./validation");Object.defineProperty(exports,"validate",{enumerable:!0,get:function(){return _validation.validate}}),Object.defineProperty(exports,"ValidationContext",{enumerable:!0,get:function(){return _validation.ValidationContext}}),Object.defineProperty(exports,"specifiedRules",{enumerable:!0,get:function(){return _validation.specifiedRules}}),Object.defineProperty(exports,"ArgumentsOfCorrectTypeRule",{enumerable:!0,get:function(){return _validation.ArgumentsOfCorrectTypeRule}}),Object.defineProperty(exports,"DefaultValuesOfCorrectTypeRule",{enumerable:!0,get:function(){return _validation.DefaultValuesOfCorrectTypeRule}}),Object.defineProperty(exports,"FieldsOnCorrectTypeRule",{enumerable:!0,get:function(){return _validation.FieldsOnCorrectTypeRule}}),Object.defineProperty(exports,"FragmentsOnCompositeTypesRule",{enumerable:!0,get:function(){return _validation.FragmentsOnCompositeTypesRule}}),Object.defineProperty(exports,"KnownArgumentNamesRule",{enumerable:!0,get:function(){return _validation.KnownArgumentNamesRule}}),Object.defineProperty(exports,"KnownDirectivesRule",{enumerable:!0,get:function(){return _validation.KnownDirectivesRule}}),Object.defineProperty(exports,"KnownFragmentNamesRule",{enumerable:!0,get:function(){return _validation.KnownFragmentNamesRule}}),Object.defineProperty(exports,"KnownTypeNamesRule",{enumerable:!0,get:function(){return _validation.KnownTypeNamesRule}}),Object.defineProperty(exports,"LoneAnonymousOperationRule",{enumerable:!0,get:function(){return _validation.LoneAnonymousOperationRule}}),Object.defineProperty(exports,"NoFragmentCyclesRule",{enumerable:!0,get:function(){return _validation.NoFragmentCyclesRule}}),Object.defineProperty(exports,"NoUndefinedVariablesRule",{enumerable:!0,get:function(){return _validation.NoUndefinedVariablesRule}}),Object.defineProperty(exports,"NoUnusedFragmentsRule",{enumerable:!0,get:function(){return _validation.NoUnusedFragmentsRule}}),Object.defineProperty(exports,"NoUnusedVariablesRule",{enumerable:!0,get:function(){return _validation.NoUnusedVariablesRule}}),Object.defineProperty(exports,"OverlappingFieldsCanBeMergedRule",{enumerable:!0,get:function(){return _validation.OverlappingFieldsCanBeMergedRule}}),Object.defineProperty(exports,"PossibleFragmentSpreadsRule",{enumerable:!0,get:function(){return _validation.PossibleFragmentSpreadsRule}}),Object.defineProperty(exports,"ProvidedNonNullArgumentsRule",{enumerable:!0,get:function(){return _validation.ProvidedNonNullArgumentsRule}}),Object.defineProperty(exports,"ScalarLeafsRule",{enumerable:!0,get:function(){return _validation.ScalarLeafsRule}}),Object.defineProperty(exports,"SingleFieldSubscriptionsRule",{enumerable:!0,get:function(){return _validation.SingleFieldSubscriptionsRule}}),Object.defineProperty(exports,"UniqueArgumentNamesRule",{enumerable:!0,get:function(){return _validation.UniqueArgumentNamesRule}}),Object.defineProperty(exports,"UniqueDirectivesPerLocationRule",{enumerable:!0,get:function(){return _validation.UniqueDirectivesPerLocationRule}}),Object.defineProperty(exports,"UniqueFragmentNamesRule",{enumerable:!0,get:function(){return _validation.UniqueFragmentNamesRule}}),Object.defineProperty(exports,"UniqueInputFieldNamesRule",{enumerable:!0,get:function(){return _validation.UniqueInputFieldNamesRule}}),Object.defineProperty(exports,"UniqueOperationNamesRule",{enumerable:!0,get:function(){return _validation.UniqueOperationNamesRule}}),Object.defineProperty(exports,"UniqueVariableNamesRule",{enumerable:!0,get:function(){return _validation.UniqueVariableNamesRule}}),Object.defineProperty(exports,"VariablesAreInputTypesRule",{enumerable:!0,get:function(){return _validation.VariablesAreInputTypesRule}}),Object.defineProperty(exports,"VariablesInAllowedPositionRule",{enumerable:!0,get:function(){return _validation.VariablesInAllowedPositionRule}});var _error=require("./error");Object.defineProperty(exports,"GraphQLError",{enumerable:!0,get:function(){return _error.GraphQLError}}),Object.defineProperty(exports,"formatError",{enumerable:!0,get:function(){return _error.formatError}});var _utilities=require("./utilities");Object.defineProperty(exports,"introspectionQuery",{enumerable:!0,get:function(){return _utilities.introspectionQuery}}),Object.defineProperty(exports,"getOperationAST",{enumerable:!0,get:function(){return _utilities.getOperationAST}}),Object.defineProperty(exports,"buildClientSchema",{enumerable:!0,get:function(){return _utilities.buildClientSchema}}),Object.defineProperty(exports,"buildASTSchema",{enumerable:!0,get:function(){return _utilities.buildASTSchema}}),Object.defineProperty(exports,"buildSchema",{enumerable:!0,get:function(){return _utilities.buildSchema}}),Object.defineProperty(exports,"extendSchema",{enumerable:!0,get:function(){return _utilities.extendSchema}}),Object.defineProperty(exports,"printSchema",{enumerable:!0,get:function(){return _utilities.printSchema}}),Object.defineProperty(exports,"printIntrospectionSchema",{enumerable:!0,get:function(){return _utilities.printIntrospectionSchema}}),Object.defineProperty(exports,"printType",{enumerable:!0,get:function(){return _utilities.printType}}),Object.defineProperty(exports,"typeFromAST",{enumerable:!0,get:function(){return _utilities.typeFromAST}}),Object.defineProperty(exports,"valueFromAST",{enumerable:!0,get:function(){return _utilities.valueFromAST}}),Object.defineProperty(exports,"astFromValue",{enumerable:!0,get:function(){return _utilities.astFromValue}}),Object.defineProperty(exports,"TypeInfo",{enumerable:!0,get:function(){return _utilities.TypeInfo}}),Object.defineProperty(exports,"isValidJSValue",{enumerable:!0,get:function(){return _utilities.isValidJSValue}}),Object.defineProperty(exports,"isValidLiteralValue",{enumerable:!0,get:function(){return _utilities.isValidLiteralValue}}),Object.defineProperty(exports,"concatAST",{enumerable:!0,get:function(){return _utilities.concatAST}}),Object.defineProperty(exports,"separateOperations",{enumerable:!0,get:function(){return _utilities.separateOperations}}),Object.defineProperty(exports,"isEqualType",{enumerable:!0,get:function(){return _utilities.isEqualType}}),Object.defineProperty(exports,"isTypeSubTypeOf",{enumerable:!0,get:function(){return _utilities.isTypeSubTypeOf}}),Object.defineProperty(exports,"doTypesOverlap",{enumerable:!0,get:function(){return _utilities.doTypesOverlap}}),Object.defineProperty(exports,"assertValidName",{enumerable:!0,get:function(){return _utilities.assertValidName}}),Object.defineProperty(exports,"findBreakingChanges",{enumerable:!0,get:function(){return _utilities.findBreakingChanges}}),Object.defineProperty(exports,"BreakingChangeType",{enumerable:!0,get:function(){return _utilities.BreakingChangeType}}),Object.defineProperty(exports,"DangerousChangeType",{enumerable:!0,get:function(){return _utilities.DangerousChangeType}}),Object.defineProperty(exports,"findDeprecatedUsages",{enumerable:!0,get:function(){return _utilities.findDeprecatedUsages}})},{"./error":85,"./execution":89,"./graphql":91,"./language":101,"./subscription":109,"./type":114,"./utilities":128,"./validation":137}],93:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(list,predicate){for(var i=0;i<list.length;i++)if(predicate(list[i]))return list[i]}},{}],94:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(condition,message){if(!condition)throw new Error(message)}},{}],95:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(value){return void 0===value||value!==value}},{}],96:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(value){return null===value||void 0===value||value!==value}},{}],97:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(list,keyFn){return list.reduce(function(map,item){return map[keyFn(item)]=item,map},Object.create(null))}},{}],98:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(list,keyFn,valFn){return list.reduce(function(map,item){return map[keyFn(item)]=valFn(item),map},Object.create(null))}},{}],99:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(items){var selected=items.slice(0,MAX_LENGTH);return selected.map(function(item){return'"'+item+'"'}).reduce(function(list,quoted,index){return list+(selected.length>2?", ":" ")+(index===selected.length-1?"or ":"")+quoted})};var MAX_LENGTH=5},{}],100:[function(require,module,exports){"use strict";function lexicalDistance(a,b){var i=void 0,j=void 0,d=[],aLength=a.length,bLength=b.length;for(i=0;i<=aLength;i++)d[i]=[i];for(j=1;j<=bLength;j++)d[0][j]=j;for(i=1;i<=aLength;i++)for(j=1;j<=bLength;j++){var cost=a[i-1]===b[j-1]?0:1;d[i][j]=Math.min(d[i-1][j]+1,d[i][j-1]+1,d[i-1][j-1]+cost),i>1&&j>1&&a[i-1]===b[j-2]&&a[i-2]===b[j-1]&&(d[i][j]=Math.min(d[i][j],d[i-2][j-2]+cost))}return d[aLength][bLength]}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(input,options){for(var optionsByDistance=Object.create(null),oLength=options.length,inputThreshold=input.length/2,i=0;i<oLength;i++){var distance=lexicalDistance(input,options[i]);distance<=Math.max(inputThreshold,options[i].length/2,1)&&(optionsByDistance[options[i]]=distance)}return Object.keys(optionsByDistance).sort(function(a,b){return optionsByDistance[a]-optionsByDistance[b]})}},{}],101:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.BREAK=exports.getVisitFn=exports.visitWithTypeInfo=exports.visitInParallel=exports.visit=exports.Source=exports.print=exports.parseType=exports.parseValue=exports.parse=exports.TokenKind=exports.createLexer=exports.Kind=exports.getLocation=void 0;var _location=require("./location");Object.defineProperty(exports,"getLocation",{enumerable:!0,get:function(){return _location.getLocation}});var _lexer=require("./lexer");Object.defineProperty(exports,"createLexer",{enumerable:!0,get:function(){return _lexer.createLexer}}),Object.defineProperty(exports,"TokenKind",{enumerable:!0,get:function(){return _lexer.TokenKind}});var _parser=require("./parser");Object.defineProperty(exports,"parse",{enumerable:!0,get:function(){return _parser.parse}}),Object.defineProperty(exports,"parseValue",{enumerable:!0,get:function(){return _parser.parseValue}}),Object.defineProperty(exports,"parseType",{enumerable:!0,get:function(){return _parser.parseType}});var _printer=require("./printer");Object.defineProperty(exports,"print",{enumerable:!0,get:function(){return _printer.print}});var _source=require("./source");Object.defineProperty(exports,"Source",{enumerable:!0,get:function(){return _source.Source}});var _visitor=require("./visitor");Object.defineProperty(exports,"visit",{enumerable:!0,get:function(){return _visitor.visit}}),Object.defineProperty(exports,"visitInParallel",{enumerable:!0,get:function(){return _visitor.visitInParallel}}),Object.defineProperty(exports,"visitWithTypeInfo",{enumerable:!0,get:function(){return _visitor.visitWithTypeInfo}}),Object.defineProperty(exports,"getVisitFn",{enumerable:!0,get:function(){return _visitor.getVisitFn}}),Object.defineProperty(exports,"BREAK",{enumerable:!0,get:function(){return _visitor.BREAK}});var Kind=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(require("./kinds"));exports.Kind=Kind},{"./kinds":102,"./lexer":103,"./location":104,"./parser":105,"./printer":106,"./source":107,"./visitor":108}],102:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.NAME="Name",exports.DOCUMENT="Document",exports.OPERATION_DEFINITION="OperationDefinition",exports.VARIABLE_DEFINITION="VariableDefinition",exports.VARIABLE="Variable",exports.SELECTION_SET="SelectionSet",exports.FIELD="Field",exports.ARGUMENT="Argument",exports.FRAGMENT_SPREAD="FragmentSpread",exports.INLINE_FRAGMENT="InlineFragment",exports.FRAGMENT_DEFINITION="FragmentDefinition",exports.INT="IntValue",exports.FLOAT="FloatValue",exports.STRING="StringValue",exports.BOOLEAN="BooleanValue",exports.NULL="NullValue",exports.ENUM="EnumValue",exports.LIST="ListValue",exports.OBJECT="ObjectValue",exports.OBJECT_FIELD="ObjectField",exports.DIRECTIVE="Directive",exports.NAMED_TYPE="NamedType",exports.LIST_TYPE="ListType",exports.NON_NULL_TYPE="NonNullType",exports.SCHEMA_DEFINITION="SchemaDefinition",exports.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",exports.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",exports.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",exports.FIELD_DEFINITION="FieldDefinition",exports.INPUT_VALUE_DEFINITION="InputValueDefinition",exports.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",exports.UNION_TYPE_DEFINITION="UnionTypeDefinition",exports.ENUM_TYPE_DEFINITION="EnumTypeDefinition",exports.ENUM_VALUE_DEFINITION="EnumValueDefinition",exports.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",exports.TYPE_EXTENSION_DEFINITION="TypeExtensionDefinition",exports.DIRECTIVE_DEFINITION="DirectiveDefinition"},{}],103:[function(require,module,exports){"use strict";function advanceLexer(){var token=this.lastToken=this.token;if(token.kind!==EOF){do{token=token.next=readToken(this,token)}while(token.kind===COMMENT);this.token=token}return token}function Tok(kind,start,end,line,column,prev,value){this.kind=kind,this.start=start,this.end=end,this.line=line,this.column=column,this.value=value,this.prev=prev,this.next=null}function printCharCode(code){return isNaN(code)?EOF:code<127?JSON.stringify(String.fromCharCode(code)):'"\\u'+("00"+code.toString(16).toUpperCase()).slice(-4)+'"'}function readToken(lexer,prev){var source=lexer.source,body=source.body,bodyLength=body.length,position=positionAfterWhitespace(body,prev.end,lexer),line=lexer.line,col=1+position-lexer.lineStart;if(position>=bodyLength)return new Tok(EOF,bodyLength,bodyLength,line,col,prev);var code=charCodeAt.call(body,position);if(code<32&&9!==code&&10!==code&&13!==code)throw(0,_error.syntaxError)(source,position,"Cannot contain the invalid character "+printCharCode(code)+".");switch(code){case 33:return new Tok(BANG,position,position+1,line,col,prev);case 35:return readComment(source,position,line,col,prev);case 36:return new Tok(DOLLAR,position,position+1,line,col,prev);case 40:return new Tok(PAREN_L,position,position+1,line,col,prev);case 41:return new Tok(PAREN_R,position,position+1,line,col,prev);case 46:if(46===charCodeAt.call(body,position+1)&&46===charCodeAt.call(body,position+2))return new Tok(SPREAD,position,position+3,line,col,prev);break;case 58:return new Tok(COLON,position,position+1,line,col,prev);case 61:return new Tok(EQUALS,position,position+1,line,col,prev);case 64:return new Tok(AT,position,position+1,line,col,prev);case 91:return new Tok(BRACKET_L,position,position+1,line,col,prev);case 93:return new Tok(BRACKET_R,position,position+1,line,col,prev);case 123:return new Tok(BRACE_L,position,position+1,line,col,prev);case 124:return new Tok(PIPE,position,position+1,line,col,prev);case 125:return new Tok(BRACE_R,position,position+1,line,col,prev);case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 95:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:return readName(source,position,line,col,prev);case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return readNumber(source,position,code,line,col,prev);case 34:return readString(source,position,line,col,prev)}throw(0,_error.syntaxError)(source,position,unexpectedCharacterMessage(code))}function unexpectedCharacterMessage(code){return 39===code?"Unexpected single quote character ('), did you mean to use a double quote (\")?":"Cannot parse the unexpected character "+printCharCode(code)+"."}function positionAfterWhitespace(body,startPosition,lexer){for(var bodyLength=body.length,position=startPosition;position<bodyLength;){var code=charCodeAt.call(body,position);if(9===code||32===code||44===code||65279===code)++position;else if(10===code)++position,++lexer.line,lexer.lineStart=position;else{if(13!==code)break;10===charCodeAt.call(body,position+1)?position+=2:++position,++lexer.line,lexer.lineStart=position}}return position}function readComment(source,start,line,col,prev){var body=source.body,code=void 0,position=start;do{code=charCodeAt.call(body,++position)}while(null!==code&&(code>31||9===code));return new Tok(COMMENT,start,position,line,col,prev,slice.call(body,start+1,position))}function readNumber(source,start,firstCode,line,col,prev){var body=source.body,code=firstCode,position=start,isFloat=!1;if(45===code&&(code=charCodeAt.call(body,++position)),48===code){if((code=charCodeAt.call(body,++position))>=48&&code<=57)throw(0,_error.syntaxError)(source,position,"Invalid number, unexpected digit after 0: "+printCharCode(code)+".")}else position=readDigits(source,position,code),code=charCodeAt.call(body,position);return 46===code&&(isFloat=!0,code=charCodeAt.call(body,++position),position=readDigits(source,position,code),code=charCodeAt.call(body,position)),69!==code&&101!==code||(isFloat=!0,43!==(code=charCodeAt.call(body,++position))&&45!==code||(code=charCodeAt.call(body,++position)),position=readDigits(source,position,code)),new Tok(isFloat?FLOAT:INT,start,position,line,col,prev,slice.call(body,start,position))}function readDigits(source,start,firstCode){var body=source.body,position=start,code=firstCode;if(code>=48&&code<=57){do{code=charCodeAt.call(body,++position)}while(code>=48&&code<=57);return position}throw(0,_error.syntaxError)(source,position,"Invalid number, expected digit but got: "+printCharCode(code)+".")}function readString(source,start,line,col,prev){for(var body=source.body,position=start+1,chunkStart=position,code=0,value="";position<body.length&&null!==(code=charCodeAt.call(body,position))&&10!==code&&13!==code&&34!==code;){if(code<32&&9!==code)throw(0,_error.syntaxError)(source,position,"Invalid character within String: "+printCharCode(code)+".");if(++position,92===code){switch(value+=slice.call(body,chunkStart,position-1),code=charCodeAt.call(body,position)){case 34:value+='"';break;case 47:value+="/";break;case 92:value+="\\";break;case 98:value+="\b";break;case 102:value+="\f";break;case 110:value+="\n";break;case 114:value+="\r";break;case 116:value+="\t";break;case 117:var charCode=uniCharCode(charCodeAt.call(body,position+1),charCodeAt.call(body,position+2),charCodeAt.call(body,position+3),charCodeAt.call(body,position+4));if(charCode<0)throw(0,_error.syntaxError)(source,position,"Invalid character escape sequence: \\u"+body.slice(position+1,position+5)+".");value+=String.fromCharCode(charCode),position+=4;break;default:throw(0,_error.syntaxError)(source,position,"Invalid character escape sequence: \\"+String.fromCharCode(code)+".")}chunkStart=++position}}if(34!==code)throw(0,_error.syntaxError)(source,position,"Unterminated string.");return value+=slice.call(body,chunkStart,position),new Tok(STRING,start,position+1,line,col,prev,value)}function uniCharCode(a,b,c,d){return char2hex(a)<<12|char2hex(b)<<8|char2hex(c)<<4|char2hex(d)}function char2hex(a){return a>=48&&a<=57?a-48:a>=65&&a<=70?a-55:a>=97&&a<=102?a-87:-1}function readName(source,position,line,col,prev){for(var body=source.body,bodyLength=body.length,end=position+1,code=0;end!==bodyLength&&null!==(code=charCodeAt.call(body,end))&&(95===code||code>=48&&code<=57||code>=65&&code<=90||code>=97&&code<=122);)++end;return new Tok(NAME,position,end,line,col,prev,slice.call(body,position,end))}Object.defineProperty(exports,"__esModule",{value:!0}),exports.TokenKind=void 0,exports.createLexer=function(source,options){var startOfFileToken=new Tok(SOF,0,0,0,0,null);return{source:source,options:options,lastToken:startOfFileToken,token:startOfFileToken,line:1,lineStart:0,advance:advanceLexer}},exports.getTokenDesc=function(token){var value=token.value;return value?token.kind+' "'+value+'"':token.kind};var _error=require("../error"),SOF="<SOF>",EOF="<EOF>",BANG="!",DOLLAR="$",PAREN_L="(",PAREN_R=")",SPREAD="...",COLON=":",EQUALS="=",AT="@",BRACKET_L="[",BRACKET_R="]",BRACE_L="{",PIPE="|",BRACE_R="}",NAME="Name",INT="Int",FLOAT="Float",STRING="String",COMMENT="Comment",charCodeAt=(exports.TokenKind={SOF:SOF,EOF:EOF,BANG:BANG,DOLLAR:DOLLAR,PAREN_L:PAREN_L,PAREN_R:PAREN_R,SPREAD:SPREAD,COLON:COLON,EQUALS:EQUALS,AT:AT,BRACKET_L:BRACKET_L,BRACKET_R:BRACKET_R,BRACE_L:BRACE_L,PIPE:PIPE,BRACE_R:BRACE_R,NAME:NAME,INT:INT,FLOAT:FLOAT,STRING:STRING,COMMENT:COMMENT},String.prototype.charCodeAt),slice=String.prototype.slice;Tok.prototype.toJSON=Tok.prototype.inspect=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}},{"../error":85}],104:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getLocation=function(source,position){for(var lineRegexp=/\r\n|[\n\r]/g,line=1,column=position+1,match=void 0;(match=lineRegexp.exec(source.body))&&match.index<position;)line+=1,column=position+1-(match.index+match[0].length);return{line:line,column:column}}},{}],105:[function(require,module,exports){"use strict";function parseName(lexer){var token=expect(lexer,_lexer.TokenKind.NAME);return{kind:_kinds.NAME,value:token.value,loc:loc(lexer,token)}}function parseDocument(lexer){var start=lexer.token;expect(lexer,_lexer.TokenKind.SOF);var definitions=[];do{definitions.push(parseDefinition(lexer))}while(!skip(lexer,_lexer.TokenKind.EOF));return{kind:_kinds.DOCUMENT,definitions:definitions,loc:loc(lexer,start)}}function parseDefinition(lexer){if(peek(lexer,_lexer.TokenKind.BRACE_L))return parseOperationDefinition(lexer);if(peek(lexer,_lexer.TokenKind.NAME))switch(lexer.token.value){case"query":case"mutation":case"subscription":return parseOperationDefinition(lexer);case"fragment":return parseFragmentDefinition(lexer);case"schema":case"scalar":case"type":case"interface":case"union":case"enum":case"input":case"extend":case"directive":return parseTypeSystemDefinition(lexer)}throw unexpected(lexer)}function parseOperationDefinition(lexer){var start=lexer.token;if(peek(lexer,_lexer.TokenKind.BRACE_L))return{kind:_kinds.OPERATION_DEFINITION,operation:"query",name:null,variableDefinitions:null,directives:[],selectionSet:parseSelectionSet(lexer),loc:loc(lexer,start)};var operation=parseOperationType(lexer),name=void 0;return peek(lexer,_lexer.TokenKind.NAME)&&(name=parseName(lexer)),{kind:_kinds.OPERATION_DEFINITION,operation:operation,name:name,variableDefinitions:parseVariableDefinitions(lexer),directives:parseDirectives(lexer),selectionSet:parseSelectionSet(lexer),loc:loc(lexer,start)}}function parseOperationType(lexer){var operationToken=expect(lexer,_lexer.TokenKind.NAME);switch(operationToken.value){case"query":return"query";case"mutation":return"mutation";case"subscription":return"subscription"}throw unexpected(lexer,operationToken)}function parseVariableDefinitions(lexer){return peek(lexer,_lexer.TokenKind.PAREN_L)?many(lexer,_lexer.TokenKind.PAREN_L,parseVariableDefinition,_lexer.TokenKind.PAREN_R):[]}function parseVariableDefinition(lexer){var start=lexer.token;return{kind:_kinds.VARIABLE_DEFINITION,variable:parseVariable(lexer),type:(expect(lexer,_lexer.TokenKind.COLON),parseTypeReference(lexer)),defaultValue:skip(lexer,_lexer.TokenKind.EQUALS)?parseValueLiteral(lexer,!0):null,loc:loc(lexer,start)}}function parseVariable(lexer){var start=lexer.token;return expect(lexer,_lexer.TokenKind.DOLLAR),{kind:_kinds.VARIABLE,name:parseName(lexer),loc:loc(lexer,start)}}function parseSelectionSet(lexer){var start=lexer.token;return{kind:_kinds.SELECTION_SET,selections:many(lexer,_lexer.TokenKind.BRACE_L,parseSelection,_lexer.TokenKind.BRACE_R),loc:loc(lexer,start)}}function parseSelection(lexer){return peek(lexer,_lexer.TokenKind.SPREAD)?parseFragment(lexer):parseField(lexer)}function parseField(lexer){var start=lexer.token,nameOrAlias=parseName(lexer),alias=void 0,name=void 0;return skip(lexer,_lexer.TokenKind.COLON)?(alias=nameOrAlias,name=parseName(lexer)):(alias=null,name=nameOrAlias),{kind:_kinds.FIELD,alias:alias,name:name,arguments:parseArguments(lexer),directives:parseDirectives(lexer),selectionSet:peek(lexer,_lexer.TokenKind.BRACE_L)?parseSelectionSet(lexer):null,loc:loc(lexer,start)}}function parseArguments(lexer){return peek(lexer,_lexer.TokenKind.PAREN_L)?many(lexer,_lexer.TokenKind.PAREN_L,parseArgument,_lexer.TokenKind.PAREN_R):[]}function parseArgument(lexer){var start=lexer.token;return{kind:_kinds.ARGUMENT,name:parseName(lexer),value:(expect(lexer,_lexer.TokenKind.COLON),parseValueLiteral(lexer,!1)),loc:loc(lexer,start)}}function parseFragment(lexer){var start=lexer.token;if(expect(lexer,_lexer.TokenKind.SPREAD),peek(lexer,_lexer.TokenKind.NAME)&&"on"!==lexer.token.value)return{kind:_kinds.FRAGMENT_SPREAD,name:parseFragmentName(lexer),directives:parseDirectives(lexer),loc:loc(lexer,start)};var typeCondition=null;return"on"===lexer.token.value&&(lexer.advance(),typeCondition=parseNamedType(lexer)),{kind:_kinds.INLINE_FRAGMENT,typeCondition:typeCondition,directives:parseDirectives(lexer),selectionSet:parseSelectionSet(lexer),loc:loc(lexer,start)}}function parseFragmentDefinition(lexer){var start=lexer.token;return expectKeyword(lexer,"fragment"),{kind:_kinds.FRAGMENT_DEFINITION,name:parseFragmentName(lexer),typeCondition:(expectKeyword(lexer,"on"),parseNamedType(lexer)),directives:parseDirectives(lexer),selectionSet:parseSelectionSet(lexer),loc:loc(lexer,start)}}function parseFragmentName(lexer){if("on"===lexer.token.value)throw unexpected(lexer);return parseName(lexer)}function parseValueLiteral(lexer,isConst){var token=lexer.token;switch(token.kind){case _lexer.TokenKind.BRACKET_L:return parseList(lexer,isConst);case _lexer.TokenKind.BRACE_L:return parseObject(lexer,isConst);case _lexer.TokenKind.INT:return lexer.advance(),{kind:_kinds.INT,value:token.value,loc:loc(lexer,token)};case _lexer.TokenKind.FLOAT:return lexer.advance(),{kind:_kinds.FLOAT,value:token.value,loc:loc(lexer,token)};case _lexer.TokenKind.STRING:return lexer.advance(),{kind:_kinds.STRING,value:token.value,loc:loc(lexer,token)};case _lexer.TokenKind.NAME:return"true"===token.value||"false"===token.value?(lexer.advance(),{kind:_kinds.BOOLEAN,value:"true"===token.value,loc:loc(lexer,token)}):"null"===token.value?(lexer.advance(),{kind:_kinds.NULL,loc:loc(lexer,token)}):(lexer.advance(),{kind:_kinds.ENUM,value:token.value,loc:loc(lexer,token)});case _lexer.TokenKind.DOLLAR:if(!isConst)return parseVariable(lexer)}throw unexpected(lexer)}function parseConstValue(lexer){return parseValueLiteral(lexer,!0)}function parseValueValue(lexer){return parseValueLiteral(lexer,!1)}function parseList(lexer,isConst){var start=lexer.token,item=isConst?parseConstValue:parseValueValue;return{kind:_kinds.LIST,values:any(lexer,_lexer.TokenKind.BRACKET_L,item,_lexer.TokenKind.BRACKET_R),loc:loc(lexer,start)}}function parseObject(lexer,isConst){var start=lexer.token;expect(lexer,_lexer.TokenKind.BRACE_L);for(var fields=[];!skip(lexer,_lexer.TokenKind.BRACE_R);)fields.push(parseObjectField(lexer,isConst));return{kind:_kinds.OBJECT,fields:fields,loc:loc(lexer,start)}}function parseObjectField(lexer,isConst){var start=lexer.token;return{kind:_kinds.OBJECT_FIELD,name:parseName(lexer),value:(expect(lexer,_lexer.TokenKind.COLON),parseValueLiteral(lexer,isConst)),loc:loc(lexer,start)}}function parseDirectives(lexer){for(var directives=[];peek(lexer,_lexer.TokenKind.AT);)directives.push(parseDirective(lexer));return directives}function parseDirective(lexer){var start=lexer.token;return expect(lexer,_lexer.TokenKind.AT),{kind:_kinds.DIRECTIVE,name:parseName(lexer),arguments:parseArguments(lexer),loc:loc(lexer,start)}}function parseTypeReference(lexer){var start=lexer.token,type=void 0;return skip(lexer,_lexer.TokenKind.BRACKET_L)?(type=parseTypeReference(lexer),expect(lexer,_lexer.TokenKind.BRACKET_R),type={kind:_kinds.LIST_TYPE,type:type,loc:loc(lexer,start)}):type=parseNamedType(lexer),skip(lexer,_lexer.TokenKind.BANG)?{kind:_kinds.NON_NULL_TYPE,type:type,loc:loc(lexer,start)}:type}function parseNamedType(lexer){var start=lexer.token;return{kind:_kinds.NAMED_TYPE,name:parseName(lexer),loc:loc(lexer,start)}}function parseTypeSystemDefinition(lexer){if(peek(lexer,_lexer.TokenKind.NAME))switch(lexer.token.value){case"schema":return parseSchemaDefinition(lexer);case"scalar":return parseScalarTypeDefinition(lexer);case"type":return parseObjectTypeDefinition(lexer);case"interface":return parseInterfaceTypeDefinition(lexer);case"union":return parseUnionTypeDefinition(lexer);case"enum":return parseEnumTypeDefinition(lexer);case"input":return parseInputObjectTypeDefinition(lexer);case"extend":return parseTypeExtensionDefinition(lexer);case"directive":return parseDirectiveDefinition(lexer)}throw unexpected(lexer)}function parseSchemaDefinition(lexer){var start=lexer.token;expectKeyword(lexer,"schema");var directives=parseDirectives(lexer),operationTypes=many(lexer,_lexer.TokenKind.BRACE_L,parseOperationTypeDefinition,_lexer.TokenKind.BRACE_R);return{kind:_kinds.SCHEMA_DEFINITION,directives:directives,operationTypes:operationTypes,loc:loc(lexer,start)}}function parseOperationTypeDefinition(lexer){var start=lexer.token,operation=parseOperationType(lexer);expect(lexer,_lexer.TokenKind.COLON);var type=parseNamedType(lexer);return{kind:_kinds.OPERATION_TYPE_DEFINITION,operation:operation,type:type,loc:loc(lexer,start)}}function parseScalarTypeDefinition(lexer){var start=lexer.token;expectKeyword(lexer,"scalar");var name=parseName(lexer),directives=parseDirectives(lexer);return{kind:_kinds.SCALAR_TYPE_DEFINITION,name:name,directives:directives,loc:loc(lexer,start)}}function parseObjectTypeDefinition(lexer){var start=lexer.token;expectKeyword(lexer,"type");var name=parseName(lexer),interfaces=parseImplementsInterfaces(lexer),directives=parseDirectives(lexer),fields=any(lexer,_lexer.TokenKind.BRACE_L,parseFieldDefinition,_lexer.TokenKind.BRACE_R);return{kind:_kinds.OBJECT_TYPE_DEFINITION,name:name,interfaces:interfaces,directives:directives,fields:fields,loc:loc(lexer,start)}}function parseImplementsInterfaces(lexer){var types=[];if("implements"===lexer.token.value){lexer.advance();do{types.push(parseNamedType(lexer))}while(peek(lexer,_lexer.TokenKind.NAME))}return types}function parseFieldDefinition(lexer){var start=lexer.token,name=parseName(lexer),args=parseArgumentDefs(lexer);expect(lexer,_lexer.TokenKind.COLON);var type=parseTypeReference(lexer),directives=parseDirectives(lexer);return{kind:_kinds.FIELD_DEFINITION,name:name,arguments:args,type:type,directives:directives,loc:loc(lexer,start)}}function parseArgumentDefs(lexer){return peek(lexer,_lexer.TokenKind.PAREN_L)?many(lexer,_lexer.TokenKind.PAREN_L,parseInputValueDef,_lexer.TokenKind.PAREN_R):[]}function parseInputValueDef(lexer){var start=lexer.token,name=parseName(lexer);expect(lexer,_lexer.TokenKind.COLON);var type=parseTypeReference(lexer),defaultValue=null;skip(lexer,_lexer.TokenKind.EQUALS)&&(defaultValue=parseConstValue(lexer));var directives=parseDirectives(lexer);return{kind:_kinds.INPUT_VALUE_DEFINITION,name:name,type:type,defaultValue:defaultValue,directives:directives,loc:loc(lexer,start)}}function parseInterfaceTypeDefinition(lexer){var start=lexer.token;expectKeyword(lexer,"interface");var name=parseName(lexer),directives=parseDirectives(lexer),fields=any(lexer,_lexer.TokenKind.BRACE_L,parseFieldDefinition,_lexer.TokenKind.BRACE_R);return{kind:_kinds.INTERFACE_TYPE_DEFINITION,name:name,directives:directives,fields:fields,loc:loc(lexer,start)}}function parseUnionTypeDefinition(lexer){var start=lexer.token;expectKeyword(lexer,"union");var name=parseName(lexer),directives=parseDirectives(lexer);expect(lexer,_lexer.TokenKind.EQUALS);var types=parseUnionMembers(lexer);return{kind:_kinds.UNION_TYPE_DEFINITION,name:name,directives:directives,types:types,loc:loc(lexer,start)}}function parseUnionMembers(lexer){skip(lexer,_lexer.TokenKind.PIPE);var members=[];do{members.push(parseNamedType(lexer))}while(skip(lexer,_lexer.TokenKind.PIPE));return members}function parseEnumTypeDefinition(lexer){var start=lexer.token;expectKeyword(lexer,"enum");var name=parseName(lexer),directives=parseDirectives(lexer),values=many(lexer,_lexer.TokenKind.BRACE_L,parseEnumValueDefinition,_lexer.TokenKind.BRACE_R);return{kind:_kinds.ENUM_TYPE_DEFINITION,name:name,directives:directives,values:values,loc:loc(lexer,start)}}function parseEnumValueDefinition(lexer){var start=lexer.token,name=parseName(lexer),directives=parseDirectives(lexer);return{kind:_kinds.ENUM_VALUE_DEFINITION,name:name,directives:directives,loc:loc(lexer,start)}}function parseInputObjectTypeDefinition(lexer){var start=lexer.token;expectKeyword(lexer,"input");var name=parseName(lexer),directives=parseDirectives(lexer),fields=any(lexer,_lexer.TokenKind.BRACE_L,parseInputValueDef,_lexer.TokenKind.BRACE_R);return{kind:_kinds.INPUT_OBJECT_TYPE_DEFINITION,name:name,directives:directives,fields:fields,loc:loc(lexer,start)}}function parseTypeExtensionDefinition(lexer){var start=lexer.token;expectKeyword(lexer,"extend");var definition=parseObjectTypeDefinition(lexer);return{kind:_kinds.TYPE_EXTENSION_DEFINITION,definition:definition,loc:loc(lexer,start)}}function parseDirectiveDefinition(lexer){var start=lexer.token;expectKeyword(lexer,"directive"),expect(lexer,_lexer.TokenKind.AT);var name=parseName(lexer),args=parseArgumentDefs(lexer);expectKeyword(lexer,"on");var locations=parseDirectiveLocations(lexer);return{kind:_kinds.DIRECTIVE_DEFINITION,name:name,arguments:args,locations:locations,loc:loc(lexer,start)}}function parseDirectiveLocations(lexer){skip(lexer,_lexer.TokenKind.PIPE);var locations=[];do{locations.push(parseName(lexer))}while(skip(lexer,_lexer.TokenKind.PIPE));return locations}function loc(lexer,startToken){if(!lexer.options.noLocation)return new Loc(startToken,lexer.lastToken,lexer.source)}function Loc(startToken,endToken,source){this.start=startToken.start,this.end=endToken.end,this.startToken=startToken,this.endToken=endToken,this.source=source}function peek(lexer,kind){return lexer.token.kind===kind}function skip(lexer,kind){var match=lexer.token.kind===kind;return match&&lexer.advance(),match}function expect(lexer,kind){var token=lexer.token;if(token.kind===kind)return lexer.advance(),token;throw(0,_error.syntaxError)(lexer.source,token.start,"Expected "+kind+", found "+(0,_lexer.getTokenDesc)(token))}function expectKeyword(lexer,value){var token=lexer.token;if(token.kind===_lexer.TokenKind.NAME&&token.value===value)return lexer.advance(),token;throw(0,_error.syntaxError)(lexer.source,token.start,'Expected "'+value+'", found '+(0,_lexer.getTokenDesc)(token))}function unexpected(lexer,atToken){var token=atToken||lexer.token;return(0,_error.syntaxError)(lexer.source,token.start,"Unexpected "+(0,_lexer.getTokenDesc)(token))}function any(lexer,openKind,parseFn,closeKind){expect(lexer,openKind);for(var nodes=[];!skip(lexer,closeKind);)nodes.push(parseFn(lexer));return nodes}function many(lexer,openKind,parseFn,closeKind){expect(lexer,openKind);for(var nodes=[parseFn(lexer)];!skip(lexer,closeKind);)nodes.push(parseFn(lexer));return nodes}Object.defineProperty(exports,"__esModule",{value:!0}),exports.parse=function(source,options){var sourceObj="string"==typeof source?new _source.Source(source):source;if(!(sourceObj instanceof _source.Source))throw new TypeError("Must provide Source. Received: "+String(sourceObj));return parseDocument((0,_lexer.createLexer)(sourceObj,options||{}))},exports.parseValue=function(source,options){var sourceObj="string"==typeof source?new _source.Source(source):source,lexer=(0,_lexer.createLexer)(sourceObj,options||{});expect(lexer,_lexer.TokenKind.SOF);var value=parseValueLiteral(lexer,!1);return expect(lexer,_lexer.TokenKind.EOF),value},exports.parseType=function(source,options){var sourceObj="string"==typeof source?new _source.Source(source):source,lexer=(0,_lexer.createLexer)(sourceObj,options||{});expect(lexer,_lexer.TokenKind.SOF);var type=parseTypeReference(lexer);return expect(lexer,_lexer.TokenKind.EOF),type},exports.parseConstValue=parseConstValue,exports.parseTypeReference=parseTypeReference,exports.parseNamedType=parseNamedType;var _source=require("./source"),_error=require("../error"),_lexer=require("./lexer"),_kinds=require("./kinds");Loc.prototype.toJSON=Loc.prototype.inspect=function(){return{start:this.start,end:this.end}}},{"../error":85,"./kinds":102,"./lexer":103,"./source":107}],106:[function(require,module,exports){"use strict";function join(maybeArray,separator){return maybeArray?maybeArray.filter(function(x){return x}).join(separator||""):""}function block(array){return array&&0!==array.length?indent("{\n"+join(array,"\n"))+"\n}":"{}"}function wrap(start,maybeString,end){return maybeString?start+maybeString+(end||""):""}function indent(maybeString){return maybeString&&maybeString.replace(/\n/g,"\n ")}Object.defineProperty(exports,"__esModule",{value:!0}),exports.print=function(ast){return(0,_visitor.visit)(ast,{leave:printDocASTReducer})};var _visitor=require("./visitor"),printDocASTReducer={Name:function(node){return node.value},Variable:function(node){return"$"+node.name},Document:function(node){return join(node.definitions,"\n\n")+"\n"},OperationDefinition:function(node){var op=node.operation,name=node.name,varDefs=wrap("(",join(node.variableDefinitions,", "),")"),directives=join(node.directives," "),selectionSet=node.selectionSet;return name||directives||varDefs||"query"!==op?join([op,join([name,varDefs]),directives,selectionSet]," "):selectionSet},VariableDefinition:function(_ref){return _ref.variable+": "+_ref.type+wrap(" = ",_ref.defaultValue)},SelectionSet:function(_ref2){return block(_ref2.selections)},Field:function(_ref3){var alias=_ref3.alias,name=_ref3.name,args=_ref3.arguments,directives=_ref3.directives,selectionSet=_ref3.selectionSet;return join([wrap("",alias,": ")+name+wrap("(",join(args,", "),")"),join(directives," "),selectionSet]," ")},Argument:function(_ref4){return _ref4.name+": "+_ref4.value},FragmentSpread:function(_ref5){return"..."+_ref5.name+wrap(" ",join(_ref5.directives," "))},InlineFragment:function(_ref6){var typeCondition=_ref6.typeCondition,directives=_ref6.directives,selectionSet=_ref6.selectionSet;return join(["...",wrap("on ",typeCondition),join(directives," "),selectionSet]," ")},FragmentDefinition:function(_ref7){var name=_ref7.name,typeCondition=_ref7.typeCondition,directives=_ref7.directives,selectionSet=_ref7.selectionSet;return"fragment "+name+" on "+typeCondition+" "+wrap("",join(directives," ")," ")+selectionSet},IntValue:function(_ref8){return _ref8.value},FloatValue:function(_ref9){return _ref9.value},StringValue:function(_ref10){var value=_ref10.value;return JSON.stringify(value)},BooleanValue:function(_ref11){var value=_ref11.value;return JSON.stringify(value)},NullValue:function(){return"null"},EnumValue:function(_ref12){return _ref12.value},ListValue:function(_ref13){return"["+join(_ref13.values,", ")+"]"},ObjectValue:function(_ref14){return"{"+join(_ref14.fields,", ")+"}"},ObjectField:function(_ref15){return _ref15.name+": "+_ref15.value},Directive:function(_ref16){return"@"+_ref16.name+wrap("(",join(_ref16.arguments,", "),")")},NamedType:function(_ref17){return _ref17.name},ListType:function(_ref18){return"["+_ref18.type+"]"},NonNullType:function(_ref19){return _ref19.type+"!"},SchemaDefinition:function(_ref20){var directives=_ref20.directives,operationTypes=_ref20.operationTypes;return join(["schema",join(directives," "),block(operationTypes)]," ")},OperationTypeDefinition:function(_ref21){return _ref21.operation+": "+_ref21.type},ScalarTypeDefinition:function(_ref22){return join(["scalar",_ref22.name,join(_ref22.directives," ")]," ")},ObjectTypeDefinition:function(_ref23){var name=_ref23.name,interfaces=_ref23.interfaces,directives=_ref23.directives,fields=_ref23.fields;return join(["type",name,wrap("implements ",join(interfaces,", ")),join(directives," "),block(fields)]," ")},FieldDefinition:function(_ref24){var name=_ref24.name,args=_ref24.arguments,type=_ref24.type,directives=_ref24.directives;return name+wrap("(",join(args,", "),")")+": "+type+wrap(" ",join(directives," "))},InputValueDefinition:function(_ref25){var name=_ref25.name,type=_ref25.type,defaultValue=_ref25.defaultValue,directives=_ref25.directives;return join([name+": "+type,wrap("= ",defaultValue),join(directives," ")]," ")},InterfaceTypeDefinition:function(_ref26){var name=_ref26.name,directives=_ref26.directives,fields=_ref26.fields;return join(["interface",name,join(directives," "),block(fields)]," ")},UnionTypeDefinition:function(_ref27){var name=_ref27.name,directives=_ref27.directives,types=_ref27.types;return join(["union",name,join(directives," "),"= "+join(types," | ")]," ")},EnumTypeDefinition:function(_ref28){var name=_ref28.name,directives=_ref28.directives,values=_ref28.values;return join(["enum",name,join(directives," "),block(values)]," ")},EnumValueDefinition:function(_ref29){return join([_ref29.name,join(_ref29.directives," ")]," ")},InputObjectTypeDefinition:function(_ref30){var name=_ref30.name,directives=_ref30.directives,fields=_ref30.fields;return join(["input",name,join(directives," "),block(fields)]," ")},TypeExtensionDefinition:function(_ref31){return"extend "+_ref31.definition},DirectiveDefinition:function(_ref32){var name=_ref32.name,args=_ref32.arguments,locations=_ref32.locations;return"directive @"+name+wrap("(",join(args,", "),")")+" on "+join(locations," | ")}}},{"./visitor":108}],107:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0});exports.Source=function Source(body,name){_classCallCheck(this,Source),this.body=body,this.name=name||"GraphQL request"}},{}],108:[function(require,module,exports){"use strict";function isNode(maybeNode){return maybeNode&&"string"==typeof maybeNode.kind}function getVisitFn(visitor,kind,isLeaving){var kindVisitor=visitor[kind];if(kindVisitor){if(!isLeaving&&"function"==typeof kindVisitor)return kindVisitor;var kindSpecificVisitor=isLeaving?kindVisitor.leave:kindVisitor.enter;if("function"==typeof kindSpecificVisitor)return kindSpecificVisitor}else{var specificVisitor=isLeaving?visitor.leave:visitor.enter;if(specificVisitor){if("function"==typeof specificVisitor)return specificVisitor;var specificKindVisitor=specificVisitor[kind];if("function"==typeof specificKindVisitor)return specificKindVisitor}}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.visit=function(root,visitor,keyMap){var visitorKeys=keyMap||QueryDocumentKeys,stack=void 0,inArray=Array.isArray(root),keys=[root],index=-1,edits=[],parent=void 0,path=[],ancestors=[],newRoot=root;do{var isLeaving=++index===keys.length,key=void 0,node=void 0,isEdited=isLeaving&&0!==edits.length;if(isLeaving){if(key=0===ancestors.length?void 0:path.pop(),node=parent,parent=ancestors.pop(),isEdited){if(inArray)node=node.slice();else{var clone={};for(var k in node)node.hasOwnProperty(k)&&(clone[k]=node[k]);node=clone}for(var editOffset=0,ii=0;ii<edits.length;ii++){var editKey=edits[ii][0],editValue=edits[ii][1];inArray&&(editKey-=editOffset),inArray&&null===editValue?(node.splice(editKey,1),editOffset++):node[editKey]=editValue}}index=stack.index,keys=stack.keys,edits=stack.edits,inArray=stack.inArray,stack=stack.prev}else{if(key=parent?inArray?index:keys[index]:void 0,null===(node=parent?parent[key]:newRoot)||void 0===node)continue;parent&&path.push(key)}var result=void 0;if(!Array.isArray(node)){if(!isNode(node))throw new Error("Invalid AST Node: "+JSON.stringify(node));var visitFn=getVisitFn(visitor,node.kind,isLeaving);if(visitFn){if((result=visitFn.call(visitor,node,key,parent,path,ancestors))===BREAK)break;if(!1===result){if(!isLeaving){path.pop();continue}}else if(void 0!==result&&(edits.push([key,result]),!isLeaving)){if(!isNode(result)){path.pop();continue}node=result}}}void 0===result&&isEdited&&edits.push([key,node]),isLeaving||(stack={inArray:inArray,index:index,keys:keys,edits:edits,prev:stack},keys=(inArray=Array.isArray(node))?node:visitorKeys[node.kind]||[],index=-1,edits=[],parent&&ancestors.push(parent),parent=node)}while(void 0!==stack);return 0!==edits.length&&(newRoot=edits[edits.length-1][1]),newRoot},exports.visitInParallel=function(visitors){var skipping=new Array(visitors.length);return{enter:function(node){for(var i=0;i<visitors.length;i++)if(!skipping[i]){var fn=getVisitFn(visitors[i],node.kind,!1);if(fn){var result=fn.apply(visitors[i],arguments);if(!1===result)skipping[i]=node;else if(result===BREAK)skipping[i]=BREAK;else if(void 0!==result)return result}}},leave:function(node){for(var i=0;i<visitors.length;i++)if(skipping[i])skipping[i]===node&&(skipping[i]=null);else{var fn=getVisitFn(visitors[i],node.kind,!0);if(fn){var result=fn.apply(visitors[i],arguments);if(result===BREAK)skipping[i]=BREAK;else if(void 0!==result&&!1!==result)return result}}}}},exports.visitWithTypeInfo=function(typeInfo,visitor){return{enter:function(node){typeInfo.enter(node);var fn=getVisitFn(visitor,node.kind,!1);if(fn){var result=fn.apply(visitor,arguments);return void 0!==result&&(typeInfo.leave(node),isNode(result)&&typeInfo.enter(result)),result}},leave:function(node){var fn=getVisitFn(visitor,node.kind,!0),result=void 0;return fn&&(result=fn.apply(visitor,arguments)),typeInfo.leave(node),result}}},exports.getVisitFn=getVisitFn;var QueryDocumentKeys=exports.QueryDocumentKeys={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["name","directives"],ObjectTypeDefinition:["name","interfaces","directives","fields"],FieldDefinition:["name","arguments","type","directives"],InputValueDefinition:["name","type","defaultValue","directives"],InterfaceTypeDefinition:["name","directives","fields"],UnionTypeDefinition:["name","directives","types"],EnumTypeDefinition:["name","directives","values"],EnumValueDefinition:["name","directives"],InputObjectTypeDefinition:["name","directives","fields"],TypeExtensionDefinition:["definition"],DirectiveDefinition:["name","arguments","locations"]},BREAK=exports.BREAK={}},{}],109:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _subscribe=require("./subscribe");Object.defineProperty(exports,"subscribe",{enumerable:!0,get:function(){return _subscribe.subscribe}}),Object.defineProperty(exports,"createSourceEventStream",{enumerable:!0,get:function(){return _subscribe.createSourceEventStream}})},{"./subscribe":111}],110:[function(require,module,exports){"use strict";function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function asyncMapValue(value,callback){return new Promise(function(resolve){return resolve(callback(value))})}function iteratorResult(value){return{value:value,done:!1}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(iterable,callback){function mapResult(result){return result.done?result:asyncMapValue(result.value,callback).then(iteratorResult,abruptClose)}var iterator=(0,_iterall.getAsyncIterator)(iterable),$return=void 0,abruptClose=void 0;return"function"==typeof iterator.return&&($return=iterator.return,abruptClose=function(error){var rethrow=function(){return Promise.reject(error)};return $return.call(iterator).then(rethrow,rethrow)}),_defineProperty({next:function(){return iterator.next().then(mapResult)},return:function(){return $return?$return.call(iterator).then(mapResult):Promise.resolve({value:void 0,done:!0})},throw:function(error){return"function"==typeof iterator.throw?iterator.throw(error).then(mapResult):Promise.reject(error).catch(abruptClose)}},_iterall.$$asyncIterator,function(){return this})};var _iterall=require("iterall")},{iterall:166}],111:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function subscribeImpl(schema,document,rootValue,contextValue,variableValues,operationName,fieldResolver,subscribeFieldResolver){var subscription=createSourceEventStream(schema,document,rootValue,contextValue,variableValues,operationName,subscribeFieldResolver);return(0,_mapAsyncIterator2.default)(subscription,function(payload){return(0,_execute.execute)(schema,document,payload,contextValue,variableValues,operationName,fieldResolver)})}function createSourceEventStream(schema,document,rootValue,contextValue,variableValues,operationName,fieldResolver){(0,_execute.assertValidExecutionArguments)(schema,document,variableValues);var exeContext=(0,_execute.buildExecutionContext)(schema,document,rootValue,contextValue,variableValues,operationName,fieldResolver),type=(0,_execute.getOperationRootType)(schema,exeContext.operation),fields=(0,_execute.collectFields)(exeContext,type,exeContext.operation.selectionSet,Object.create(null),Object.create(null)),responseName=Object.keys(fields)[0],fieldNodes=fields[responseName],fieldNode=fieldNodes[0],fieldDef=(0,_execute.getFieldDef)(schema,type,fieldNode.name.value);(0,_invariant2.default)(fieldDef,"This subscription is not defined by the schema.");var resolveFn=fieldDef.subscribe||exeContext.fieldResolver,info=(0,_execute.buildResolveInfo)(exeContext,fieldDef,fieldNodes,type,(0,_execute.addPath)(void 0,responseName)),subscription=(0,_execute.resolveFieldValueOrError)(exeContext,fieldDef,fieldNodes,resolveFn,rootValue,info);if(subscription instanceof Error)throw subscription;if(!(0,_iterall.isAsyncIterable)(subscription))throw new Error("Subscription must return Async Iterable. Received: "+String(subscription));return subscription}Object.defineProperty(exports,"__esModule",{value:!0}),exports.subscribe=function(argsOrSchema,document,rootValue,contextValue,variableValues,operationName,fieldResolver,subscribeFieldResolver){var args=1===arguments.length?argsOrSchema:void 0,schema=args?args.schema:argsOrSchema;return args?subscribeImpl(schema,args.document,args.rootValue,args.contextValue,args.variableValues,args.operationName,args.fieldResolver,args.subscribeFieldResolver):subscribeImpl(schema,document,rootValue,contextValue,variableValues,operationName,fieldResolver,subscribeFieldResolver)},exports.createSourceEventStream=createSourceEventStream;var _iterall=require("iterall"),_execute=require("../execution/execute"),_invariant2=(require("../type/schema"),_interopRequireDefault(require("../jsutils/invariant"))),_mapAsyncIterator2=_interopRequireDefault(require("./mapAsyncIterator"))},{"../execution/execute":88,"../jsutils/invariant":94,"../type/schema":117,"./mapAsyncIterator":110,iterall:166}],112:[function(require,module,exports){"use strict";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 isType(type){return type instanceof GraphQLScalarType||type instanceof GraphQLObjectType||type instanceof GraphQLInterfaceType||type instanceof GraphQLUnionType||type instanceof GraphQLEnumType||type instanceof GraphQLInputObjectType||type instanceof GraphQLList||type instanceof GraphQLNonNull}function isInputType(type){return type instanceof GraphQLScalarType||type instanceof GraphQLEnumType||type instanceof GraphQLInputObjectType||type instanceof GraphQLNonNull&&isInputType(type.ofType)||type instanceof GraphQLList&&isInputType(type.ofType)}function isOutputType(type){return type instanceof GraphQLScalarType||type instanceof GraphQLObjectType||type instanceof GraphQLInterfaceType||type instanceof GraphQLUnionType||type instanceof GraphQLEnumType||type instanceof GraphQLNonNull&&isOutputType(type.ofType)||type instanceof GraphQLList&&isOutputType(type.ofType)}function isLeafType(type){return type instanceof GraphQLScalarType||type instanceof GraphQLEnumType}function isCompositeType(type){return type instanceof GraphQLObjectType||type instanceof GraphQLInterfaceType||type instanceof GraphQLUnionType}function isAbstractType(type){return type instanceof GraphQLInterfaceType||type instanceof GraphQLUnionType}function isNamedType(type){return type instanceof GraphQLScalarType||type instanceof GraphQLObjectType||type instanceof GraphQLInterfaceType||type instanceof GraphQLUnionType||type instanceof GraphQLEnumType||type instanceof GraphQLInputObjectType}function resolveThunk(thunk){return"function"==typeof thunk?thunk():thunk}function defineInterfaces(type,interfacesThunk){var interfaces=resolveThunk(interfacesThunk);if(!interfaces)return[];(0,_invariant2.default)(Array.isArray(interfaces),type.name+" interfaces must be an Array or a function which returns an Array.");var implementedTypeNames=Object.create(null);return interfaces.forEach(function(iface){(0,_invariant2.default)(iface instanceof GraphQLInterfaceType,type.name+" may only implement Interface types, it cannot implement: "+String(iface)+"."),(0,_invariant2.default)(!implementedTypeNames[iface.name],type.name+" may declare it implements "+iface.name+" only once."),implementedTypeNames[iface.name]=!0,"function"!=typeof iface.resolveType&&(0,_invariant2.default)("function"==typeof type.isTypeOf,"Interface Type "+iface.name+' does not provide a "resolveType" function and implementing Type '+type.name+' does not provide a "isTypeOf" function. There is no way to resolve this implementing type during execution.')}),interfaces}function defineFieldMap(type,fieldsThunk){var fieldMap=resolveThunk(fieldsThunk);(0,_invariant2.default)(isPlainObj(fieldMap),type.name+" fields must be an object with field names as keys or a function which returns such an object.");var fieldNames=Object.keys(fieldMap);(0,_invariant2.default)(fieldNames.length>0,type.name+" fields must be an object with field names as keys or a function which returns such an object.");var resultFieldMap=Object.create(null);return fieldNames.forEach(function(fieldName){(0,_assertValidName.assertValidName)(fieldName);var fieldConfig=fieldMap[fieldName];(0,_invariant2.default)(isPlainObj(fieldConfig),type.name+"."+fieldName+" field config must be an object"),(0,_invariant2.default)(!fieldConfig.hasOwnProperty("isDeprecated"),type.name+"."+fieldName+' should provide "deprecationReason" instead of "isDeprecated".');var field=_extends({},fieldConfig,{isDeprecated:Boolean(fieldConfig.deprecationReason),name:fieldName});(0,_invariant2.default)(isOutputType(field.type),type.name+"."+fieldName+" field type must be Output Type but got: "+String(field.type)+"."),(0,_invariant2.default)(isValidResolver(field.resolve),type.name+"."+fieldName+" field resolver must be a function if provided, but got: "+String(field.resolve)+".");var argsConfig=fieldConfig.args;argsConfig?((0,_invariant2.default)(isPlainObj(argsConfig),type.name+"."+fieldName+" args must be an object with argument names as keys."),field.args=Object.keys(argsConfig).map(function(argName){(0,_assertValidName.assertValidName)(argName);var arg=argsConfig[argName];return(0,_invariant2.default)(isInputType(arg.type),type.name+"."+fieldName+"("+argName+":) argument type must be Input Type but got: "+String(arg.type)+"."),{name:argName,description:void 0===arg.description?null:arg.description,type:arg.type,defaultValue:arg.defaultValue}})):field.args=[],resultFieldMap[fieldName]=field}),resultFieldMap}function isPlainObj(obj){return obj&&"object"==typeof obj&&!Array.isArray(obj)}function isValidResolver(resolver){return null==resolver||"function"==typeof resolver}function defineTypes(unionType,typesThunk){var types=resolveThunk(typesThunk);(0,_invariant2.default)(Array.isArray(types)&&types.length>0,"Must provide Array of types or a function which returns such an array for Union "+unionType.name+".");var includedTypeNames=Object.create(null);return types.forEach(function(objType){(0,_invariant2.default)(objType instanceof GraphQLObjectType,unionType.name+" may only contain Object types, it cannot contain: "+String(objType)+"."),(0,_invariant2.default)(!includedTypeNames[objType.name],unionType.name+" can include "+objType.name+" type only once."),includedTypeNames[objType.name]=!0,"function"!=typeof unionType.resolveType&&(0,_invariant2.default)("function"==typeof objType.isTypeOf,'Union type "'+unionType.name+'" does not provide a "resolveType" function and possible type "'+objType.name+'" does not provide an "isTypeOf" function. There is no way to resolve this possible type during execution.')}),types}function defineEnumValues(type,valueMap){(0,_invariant2.default)(isPlainObj(valueMap),type.name+" values must be an object with value names as keys.");var valueNames=Object.keys(valueMap);return(0,_invariant2.default)(valueNames.length>0,type.name+" values must be an object with value names as keys."),valueNames.map(function(valueName){(0,_assertValidName.assertValidName)(valueName),(0,_invariant2.default)(-1===["true","false","null"].indexOf(valueName),'Name "'+valueName+'" can not be used as an Enum value.');var value=valueMap[valueName];return(0,_invariant2.default)(isPlainObj(value),type.name+"."+valueName+' must refer to an object with a "value" key representing an internal value but got: '+String(value)+"."),(0,_invariant2.default)(!value.hasOwnProperty("isDeprecated"),type.name+"."+valueName+' should provide "deprecationReason" instead of "isDeprecated".'),{name:valueName,description:value.description,isDeprecated:Boolean(value.deprecationReason),deprecationReason:value.deprecationReason,value:value.hasOwnProperty("value")?value.value:valueName}})}Object.defineProperty(exports,"__esModule",{value:!0}),exports.GraphQLNonNull=exports.GraphQLList=exports.GraphQLInputObjectType=exports.GraphQLEnumType=exports.GraphQLUnionType=exports.GraphQLInterfaceType=exports.GraphQLObjectType=exports.GraphQLScalarType=void 0;var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key])}return target};exports.isType=isType,exports.assertType=function(type){return(0,_invariant2.default)(isType(type),"Expected "+String(type)+" to be a GraphQL type."),type},exports.isInputType=isInputType,exports.assertInputType=function(type){return(0,_invariant2.default)(isInputType(type),"Expected "+String(type)+" to be a GraphQL input type."),type},exports.isOutputType=isOutputType,exports.assertOutputType=function(type){return(0,_invariant2.default)(isOutputType(type),"Expected "+String(type)+" to be a GraphQL output type."),type},exports.isLeafType=isLeafType,exports.assertLeafType=function(type){return(0,_invariant2.default)(isLeafType(type),"Expected "+String(type)+" to be a GraphQL leaf type."),type},exports.isCompositeType=isCompositeType,exports.assertCompositeType=function(type){return(0,_invariant2.default)(isCompositeType(type),"Expected "+String(type)+" to be a GraphQL composite type."),type},exports.isAbstractType=isAbstractType,exports.assertAbstractType=function(type){return(0,_invariant2.default)(isAbstractType(type),"Expected "+String(type)+" to be a GraphQL abstract type."),type},exports.getNullableType=function(type){return type instanceof GraphQLNonNull?type.ofType:type},exports.isNamedType=isNamedType,exports.assertNamedType=function(type){return(0,_invariant2.default)(isNamedType(type),"Expected "+String(type)+" to be a GraphQL named type."),type},exports.getNamedType=function(type){if(type){for(var unmodifiedType=type;unmodifiedType instanceof GraphQLList||unmodifiedType instanceof GraphQLNonNull;)unmodifiedType=unmodifiedType.ofType;return unmodifiedType}};var _invariant2=_interopRequireDefault(require("../jsutils/invariant")),_isNullish2=_interopRequireDefault(require("../jsutils/isNullish")),Kind=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(require("../language/kinds")),_assertValidName=require("../utilities/assertValidName"),GraphQLScalarType=exports.GraphQLScalarType=function(){function GraphQLScalarType(config){_classCallCheck(this,GraphQLScalarType),(0,_assertValidName.assertValidName)(config.name),this.name=config.name,this.description=config.description,(0,_invariant2.default)("function"==typeof config.serialize,this.name+' must provide "serialize" function. If this custom Scalar is also used as an input type, ensure "parseValue" and "parseLiteral" functions are also provided.'),(config.parseValue||config.parseLiteral)&&(0,_invariant2.default)("function"==typeof config.parseValue&&"function"==typeof config.parseLiteral,this.name+' must provide both "parseValue" and "parseLiteral" functions.'),this._scalarConfig=config}return GraphQLScalarType.prototype.serialize=function(value){return(0,this._scalarConfig.serialize)(value)},GraphQLScalarType.prototype.isValidValue=function(value){return!(0,_isNullish2.default)(this.parseValue(value))},GraphQLScalarType.prototype.parseValue=function(value){var parser=this._scalarConfig.parseValue;return parser&&!(0,_isNullish2.default)(value)?parser(value):void 0},GraphQLScalarType.prototype.isValidLiteral=function(valueNode){return!(0,_isNullish2.default)(this.parseLiteral(valueNode))},GraphQLScalarType.prototype.parseLiteral=function(valueNode){var parser=this._scalarConfig.parseLiteral;return parser?parser(valueNode):void 0},GraphQLScalarType.prototype.toString=function(){return this.name},GraphQLScalarType}();GraphQLScalarType.prototype.toJSON=GraphQLScalarType.prototype.inspect=GraphQLScalarType.prototype.toString;var GraphQLObjectType=exports.GraphQLObjectType=function(){function GraphQLObjectType(config){_classCallCheck(this,GraphQLObjectType),(0,_assertValidName.assertValidName)(config.name,config.isIntrospection),this.name=config.name,this.description=config.description,config.isTypeOf&&(0,_invariant2.default)("function"==typeof config.isTypeOf,this.name+' must provide "isTypeOf" as a function.'),this.isTypeOf=config.isTypeOf,this._typeConfig=config}return GraphQLObjectType.prototype.getFields=function(){return this._fields||(this._fields=defineFieldMap(this,this._typeConfig.fields))},GraphQLObjectType.prototype.getInterfaces=function(){return this._interfaces||(this._interfaces=defineInterfaces(this,this._typeConfig.interfaces))},GraphQLObjectType.prototype.toString=function(){return this.name},GraphQLObjectType}();GraphQLObjectType.prototype.toJSON=GraphQLObjectType.prototype.inspect=GraphQLObjectType.prototype.toString;var GraphQLInterfaceType=exports.GraphQLInterfaceType=function(){function GraphQLInterfaceType(config){_classCallCheck(this,GraphQLInterfaceType),(0,_assertValidName.assertValidName)(config.name),this.name=config.name,this.description=config.description,config.resolveType&&(0,_invariant2.default)("function"==typeof config.resolveType,this.name+' must provide "resolveType" as a function.'),this.resolveType=config.resolveType,this._typeConfig=config}return GraphQLInterfaceType.prototype.getFields=function(){return this._fields||(this._fields=defineFieldMap(this,this._typeConfig.fields))},GraphQLInterfaceType.prototype.toString=function(){return this.name},GraphQLInterfaceType}();GraphQLInterfaceType.prototype.toJSON=GraphQLInterfaceType.prototype.inspect=GraphQLInterfaceType.prototype.toString;var GraphQLUnionType=exports.GraphQLUnionType=function(){function GraphQLUnionType(config){_classCallCheck(this,GraphQLUnionType),(0,_assertValidName.assertValidName)(config.name),this.name=config.name,this.description=config.description,config.resolveType&&(0,_invariant2.default)("function"==typeof config.resolveType,this.name+' must provide "resolveType" as a function.'),this.resolveType=config.resolveType,this._typeConfig=config}return GraphQLUnionType.prototype.getTypes=function(){return this._types||(this._types=defineTypes(this,this._typeConfig.types))},GraphQLUnionType.prototype.toString=function(){return this.name},GraphQLUnionType}();GraphQLUnionType.prototype.toJSON=GraphQLUnionType.prototype.inspect=GraphQLUnionType.prototype.toString;var GraphQLEnumType=exports.GraphQLEnumType=function(){function GraphQLEnumType(config){_classCallCheck(this,GraphQLEnumType),this.name=config.name,(0,_assertValidName.assertValidName)(config.name,config.isIntrospection),this.description=config.description,this._values=defineEnumValues(this,config.values),this._enumConfig=config}return GraphQLEnumType.prototype.getValues=function(){return this._values},GraphQLEnumType.prototype.getValue=function(name){return this._getNameLookup()[name]},GraphQLEnumType.prototype.serialize=function(value){var enumValue=this._getValueLookup().get(value);return enumValue?enumValue.name:null},GraphQLEnumType.prototype.isValidValue=function(value){return"string"==typeof value&&void 0!==this._getNameLookup()[value]},GraphQLEnumType.prototype.parseValue=function(value){if("string"==typeof value){var enumValue=this._getNameLookup()[value];if(enumValue)return enumValue.value}},GraphQLEnumType.prototype.isValidLiteral=function(valueNode){return valueNode.kind===Kind.ENUM&&void 0!==this._getNameLookup()[valueNode.value]},GraphQLEnumType.prototype.parseLiteral=function(valueNode){if(valueNode.kind===Kind.ENUM){var enumValue=this._getNameLookup()[valueNode.value];if(enumValue)return enumValue.value}},GraphQLEnumType.prototype._getValueLookup=function(){if(!this._valueLookup){var lookup=new Map;this.getValues().forEach(function(value){lookup.set(value.value,value)}),this._valueLookup=lookup}return this._valueLookup},GraphQLEnumType.prototype._getNameLookup=function(){if(!this._nameLookup){var lookup=Object.create(null);this.getValues().forEach(function(value){lookup[value.name]=value}),this._nameLookup=lookup}return this._nameLookup},GraphQLEnumType.prototype.toString=function(){return this.name},GraphQLEnumType}();GraphQLEnumType.prototype.toJSON=GraphQLEnumType.prototype.inspect=GraphQLEnumType.prototype.toString;var GraphQLInputObjectType=exports.GraphQLInputObjectType=function(){function GraphQLInputObjectType(config){_classCallCheck(this,GraphQLInputObjectType),(0,_assertValidName.assertValidName)(config.name),this.name=config.name,this.description=config.description,this._typeConfig=config}return GraphQLInputObjectType.prototype.getFields=function(){return this._fields||(this._fields=this._defineFieldMap())},GraphQLInputObjectType.prototype._defineFieldMap=function(){var _this=this,fieldMap=resolveThunk(this._typeConfig.fields);(0,_invariant2.default)(isPlainObj(fieldMap),this.name+" fields must be an object with field names as keys or a function which returns such an object.");var fieldNames=Object.keys(fieldMap);(0,_invariant2.default)(fieldNames.length>0,this.name+" fields must be an object with field names as keys or a function which returns such an object.");var resultFieldMap=Object.create(null);return fieldNames.forEach(function(fieldName){(0,_assertValidName.assertValidName)(fieldName);var field=_extends({},fieldMap[fieldName],{name:fieldName});(0,_invariant2.default)(isInputType(field.type),_this.name+"."+fieldName+" field type must be Input Type but got: "+String(field.type)+"."),(0,_invariant2.default)(null==field.resolve,_this.name+"."+fieldName+" field type has a resolve property, but Input Types cannot define resolvers."),resultFieldMap[fieldName]=field}),resultFieldMap},GraphQLInputObjectType.prototype.toString=function(){return this.name},GraphQLInputObjectType}();GraphQLInputObjectType.prototype.toJSON=GraphQLInputObjectType.prototype.inspect=GraphQLInputObjectType.prototype.toString;var GraphQLList=exports.GraphQLList=function(){function GraphQLList(type){_classCallCheck(this,GraphQLList),(0,_invariant2.default)(isType(type),"Can only create List of a GraphQLType but got: "+String(type)+"."),this.ofType=type}return GraphQLList.prototype.toString=function(){return"["+String(this.ofType)+"]"},GraphQLList}();GraphQLList.prototype.toJSON=GraphQLList.prototype.inspect=GraphQLList.prototype.toString;var GraphQLNonNull=exports.GraphQLNonNull=function(){function GraphQLNonNull(type){_classCallCheck(this,GraphQLNonNull),(0,_invariant2.default)(isType(type)&&!(type instanceof GraphQLNonNull),"Can only create NonNull of a Nullable GraphQLType but got: "+String(type)+"."),this.ofType=type}return GraphQLNonNull.prototype.toString=function(){return this.ofType.toString()+"!"},GraphQLNonNull}();GraphQLNonNull.prototype.toJSON=GraphQLNonNull.prototype.inspect=GraphQLNonNull.prototype.toString},{"../jsutils/invariant":94,"../jsutils/isNullish":96,"../language/kinds":102,"../utilities/assertValidName":119}],113:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0}),exports.specifiedDirectives=exports.GraphQLDeprecatedDirective=exports.DEFAULT_DEPRECATION_REASON=exports.GraphQLSkipDirective=exports.GraphQLIncludeDirective=exports.GraphQLDirective=exports.DirectiveLocation=void 0;var _definition=require("./definition"),_scalars=require("./scalars"),_invariant2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(require("../jsutils/invariant")),_assertValidName=require("../utilities/assertValidName"),DirectiveLocation=exports.DirectiveLocation={QUERY:"QUERY",MUTATION:"MUTATION",SUBSCRIPTION:"SUBSCRIPTION",FIELD:"FIELD",FRAGMENT_DEFINITION:"FRAGMENT_DEFINITION",FRAGMENT_SPREAD:"FRAGMENT_SPREAD",INLINE_FRAGMENT:"INLINE_FRAGMENT",SCHEMA:"SCHEMA",SCALAR:"SCALAR",OBJECT:"OBJECT",FIELD_DEFINITION:"FIELD_DEFINITION",ARGUMENT_DEFINITION:"ARGUMENT_DEFINITION",INTERFACE:"INTERFACE",UNION:"UNION",ENUM:"ENUM",ENUM_VALUE:"ENUM_VALUE",INPUT_OBJECT:"INPUT_OBJECT",INPUT_FIELD_DEFINITION:"INPUT_FIELD_DEFINITION"},GraphQLDirective=exports.GraphQLDirective=function GraphQLDirective(config){_classCallCheck(this,GraphQLDirective),(0,_invariant2.default)(config.name,"Directive must be named."),(0,_assertValidName.assertValidName)(config.name),(0,_invariant2.default)(Array.isArray(config.locations),"Must provide locations for directive."),this.name=config.name,this.description=config.description,this.locations=config.locations;var args=config.args;args?((0,_invariant2.default)(!Array.isArray(args),"@"+config.name+" args must be an object with argument names as keys."),this.args=Object.keys(args).map(function(argName){(0,_assertValidName.assertValidName)(argName);var arg=args[argName];return(0,_invariant2.default)((0,_definition.isInputType)(arg.type),"@"+config.name+"("+argName+":) argument type must be Input Type but got: "+String(arg.type)+"."),{name:argName,description:void 0===arg.description?null:arg.description,type:arg.type,defaultValue:arg.defaultValue}})):this.args=[]},GraphQLIncludeDirective=exports.GraphQLIncludeDirective=new GraphQLDirective({name:"include",description:"Directs the executor to include this field or fragment only when the `if` argument is true.",locations:[DirectiveLocation.FIELD,DirectiveLocation.FRAGMENT_SPREAD,DirectiveLocation.INLINE_FRAGMENT],args:{if:{type:new _definition.GraphQLNonNull(_scalars.GraphQLBoolean),description:"Included when true."}}}),GraphQLSkipDirective=exports.GraphQLSkipDirective=new GraphQLDirective({name:"skip",description:"Directs the executor to skip this field or fragment when the `if` argument is true.",locations:[DirectiveLocation.FIELD,DirectiveLocation.FRAGMENT_SPREAD,DirectiveLocation.INLINE_FRAGMENT],args:{if:{type:new _definition.GraphQLNonNull(_scalars.GraphQLBoolean),description:"Skipped when true."}}}),DEFAULT_DEPRECATION_REASON=exports.DEFAULT_DEPRECATION_REASON="No longer supported",GraphQLDeprecatedDirective=exports.GraphQLDeprecatedDirective=new GraphQLDirective({name:"deprecated",description:"Marks an element of a GraphQL schema as no longer supported.",locations:[DirectiveLocation.FIELD_DEFINITION,DirectiveLocation.ENUM_VALUE],args:{reason:{type:_scalars.GraphQLString,description:"Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted in [Markdown](https://daringfireball.net/projects/markdown/).",defaultValue:DEFAULT_DEPRECATION_REASON}}});exports.specifiedDirectives=[GraphQLIncludeDirective,GraphQLSkipDirective,GraphQLDeprecatedDirective]},{"../jsutils/invariant":94,"../utilities/assertValidName":119,"./definition":112,"./scalars":116}],114:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _schema=require("./schema");Object.defineProperty(exports,"GraphQLSchema",{enumerable:!0,get:function(){return _schema.GraphQLSchema}});var _definition=require("./definition");Object.defineProperty(exports,"isType",{enumerable:!0,get:function(){return _definition.isType}}),Object.defineProperty(exports,"isInputType",{enumerable:!0,get:function(){return _definition.isInputType}}),Object.defineProperty(exports,"isOutputType",{enumerable:!0,get:function(){return _definition.isOutputType}}),Object.defineProperty(exports,"isLeafType",{enumerable:!0,get:function(){return _definition.isLeafType}}),Object.defineProperty(exports,"isCompositeType",{enumerable:!0,get:function(){return _definition.isCompositeType}}),Object.defineProperty(exports,"isAbstractType",{enumerable:!0,get:function(){return _definition.isAbstractType}}),Object.defineProperty(exports,"isNamedType",{enumerable:!0,get:function(){return _definition.isNamedType}}),Object.defineProperty(exports,"assertType",{enumerable:!0,get:function(){return _definition.assertType}}),Object.defineProperty(exports,"assertInputType",{enumerable:!0,get:function(){return _definition.assertInputType}}),Object.defineProperty(exports,"assertOutputType",{enumerable:!0,get:function(){return _definition.assertOutputType}}),Object.defineProperty(exports,"assertLeafType",{enumerable:!0,get:function(){return _definition.assertLeafType}}),Object.defineProperty(exports,"assertCompositeType",{enumerable:!0,get:function(){return _definition.assertCompositeType}}),Object.defineProperty(exports,"assertAbstractType",{enumerable:!0,get:function(){return _definition.assertAbstractType}}),Object.defineProperty(exports,"assertNamedType",{enumerable:!0,get:function(){return _definition.assertNamedType}}),Object.defineProperty(exports,"getNullableType",{enumerable:!0,get:function(){return _definition.getNullableType}}),Object.defineProperty(exports,"getNamedType",{enumerable:!0,get:function(){return _definition.getNamedType}}),Object.defineProperty(exports,"GraphQLScalarType",{enumerable:!0,get:function(){return _definition.GraphQLScalarType}}),Object.defineProperty(exports,"GraphQLObjectType",{enumerable:!0,get:function(){return _definition.GraphQLObjectType}}),Object.defineProperty(exports,"GraphQLInterfaceType",{enumerable:!0,get:function(){return _definition.GraphQLInterfaceType}}),Object.defineProperty(exports,"GraphQLUnionType",{enumerable:!0,get:function(){return _definition.GraphQLUnionType}}),Object.defineProperty(exports,"GraphQLEnumType",{enumerable:!0,get:function(){return _definition.GraphQLEnumType}}),Object.defineProperty(exports,"GraphQLInputObjectType",{enumerable:!0,get:function(){return _definition.GraphQLInputObjectType}}),Object.defineProperty(exports,"GraphQLList",{enumerable:!0,get:function(){return _definition.GraphQLList}}),Object.defineProperty(exports,"GraphQLNonNull",{enumerable:!0,get:function(){return _definition.GraphQLNonNull}});var _directives=require("./directives");Object.defineProperty(exports,"DirectiveLocation",{enumerable:!0,get:function(){return _directives.DirectiveLocation}}),Object.defineProperty(exports,"GraphQLDirective",{enumerable:!0,get:function(){return _directives.GraphQLDirective}}),Object.defineProperty(exports,"specifiedDirectives",{enumerable:!0,get:function(){return _directives.specifiedDirectives}}),Object.defineProperty(exports,"GraphQLIncludeDirective",{enumerable:!0,get:function(){return _directives.GraphQLIncludeDirective}}),Object.defineProperty(exports,"GraphQLSkipDirective",{enumerable:!0,get:function(){return _directives.GraphQLSkipDirective}}),Object.defineProperty(exports,"GraphQLDeprecatedDirective",{enumerable:!0,get:function(){return _directives.GraphQLDeprecatedDirective}}),Object.defineProperty(exports,"DEFAULT_DEPRECATION_REASON",{enumerable:!0,get:function(){return _directives.DEFAULT_DEPRECATION_REASON}});var _scalars=require("./scalars");Object.defineProperty(exports,"GraphQLInt",{enumerable:!0,get:function(){return _scalars.GraphQLInt}}),Object.defineProperty(exports,"GraphQLFloat",{enumerable:!0,get:function(){return _scalars.GraphQLFloat}}),Object.defineProperty(exports,"GraphQLString",{enumerable:!0,get:function(){return _scalars.GraphQLString}}),Object.defineProperty(exports,"GraphQLBoolean",{enumerable:!0,get:function(){return _scalars.GraphQLBoolean}}),Object.defineProperty(exports,"GraphQLID",{enumerable:!0,get:function(){return _scalars.GraphQLID}});var _introspection=require("./introspection");Object.defineProperty(exports,"TypeKind",{enumerable:!0,get:function(){return _introspection.TypeKind}}),Object.defineProperty(exports,"__Schema",{enumerable:!0,get:function(){return _introspection.__Schema}}),Object.defineProperty(exports,"__Directive",{enumerable:!0,get:function(){return _introspection.__Directive}}),Object.defineProperty(exports,"__DirectiveLocation",{enumerable:!0,get:function(){return _introspection.__DirectiveLocation}}),Object.defineProperty(exports,"__Type",{enumerable:!0,get:function(){return _introspection.__Type}}),Object.defineProperty(exports,"__Field",{enumerable:!0,get:function(){return _introspection.__Field}}),Object.defineProperty(exports,"__InputValue",{enumerable:!0,get:function(){return _introspection.__InputValue}}),Object.defineProperty(exports,"__EnumValue",{enumerable:!0,get:function(){return _introspection.__EnumValue}}),Object.defineProperty(exports,"__TypeKind",{enumerable:!0,get:function(){return _introspection.__TypeKind}}),Object.defineProperty(exports,"SchemaMetaFieldDef",{enumerable:!0,get:function(){return _introspection.SchemaMetaFieldDef}}),Object.defineProperty(exports,"TypeMetaFieldDef",{enumerable:!0,get:function(){return _introspection.TypeMetaFieldDef}}),Object.defineProperty(exports,"TypeNameMetaFieldDef",{enumerable:!0,get:function(){return _introspection.TypeNameMetaFieldDef}})},{"./definition":112,"./directives":113,"./introspection":115,"./scalars":116,"./schema":117}],115:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.TypeNameMetaFieldDef=exports.TypeMetaFieldDef=exports.SchemaMetaFieldDef=exports.__TypeKind=exports.TypeKind=exports.__EnumValue=exports.__InputValue=exports.__Field=exports.__Type=exports.__DirectiveLocation=exports.__Directive=exports.__Schema=void 0;var _isInvalid2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(require("../jsutils/isInvalid")),_astFromValue=require("../utilities/astFromValue"),_printer=require("../language/printer"),_definition=require("./definition"),_scalars=require("./scalars"),_directives=require("./directives"),__Schema=exports.__Schema=new _definition.GraphQLObjectType({name:"__Schema",isIntrospection:!0,description:"A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.",fields:function(){return{types:{description:"A list of all types supported by this server.",type:new _definition.GraphQLNonNull(new _definition.GraphQLList(new _definition.GraphQLNonNull(__Type))),resolve:function(schema){var typeMap=schema.getTypeMap();return Object.keys(typeMap).map(function(key){return typeMap[key]})}},queryType:{description:"The type that query operations will be rooted at.",type:new _definition.GraphQLNonNull(__Type),resolve:function(schema){return schema.getQueryType()}},mutationType:{description:"If this server supports mutation, the type that mutation operations will be rooted at.",type:__Type,resolve:function(schema){return schema.getMutationType()}},subscriptionType:{description:"If this server support subscription, the type that subscription operations will be rooted at.",type:__Type,resolve:function(schema){return schema.getSubscriptionType()}},directives:{description:"A list of all directives supported by this server.",type:new _definition.GraphQLNonNull(new _definition.GraphQLList(new _definition.GraphQLNonNull(__Directive))),resolve:function(schema){return schema.getDirectives()}}}}}),__Directive=exports.__Directive=new _definition.GraphQLObjectType({name:"__Directive",isIntrospection:!0,description:"A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document.\n\nIn some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.",fields:function(){return{name:{type:new _definition.GraphQLNonNull(_scalars.GraphQLString)},description:{type:_scalars.GraphQLString},locations:{type:new _definition.GraphQLNonNull(new _definition.GraphQLList(new _definition.GraphQLNonNull(__DirectiveLocation)))},args:{type:new _definition.GraphQLNonNull(new _definition.GraphQLList(new _definition.GraphQLNonNull(__InputValue))),resolve:function(directive){return directive.args||[]}},onOperation:{deprecationReason:"Use `locations`.",type:new _definition.GraphQLNonNull(_scalars.GraphQLBoolean),resolve:function(d){return-1!==d.locations.indexOf(_directives.DirectiveLocation.QUERY)||-1!==d.locations.indexOf(_directives.DirectiveLocation.MUTATION)||-1!==d.locations.indexOf(_directives.DirectiveLocation.SUBSCRIPTION)}},onFragment:{deprecationReason:"Use `locations`.",type:new _definition.GraphQLNonNull(_scalars.GraphQLBoolean),resolve:function(d){return-1!==d.locations.indexOf(_directives.DirectiveLocation.FRAGMENT_SPREAD)||-1!==d.locations.indexOf(_directives.DirectiveLocation.INLINE_FRAGMENT)||-1!==d.locations.indexOf(_directives.DirectiveLocation.FRAGMENT_DEFINITION)}},onField:{deprecationReason:"Use `locations`.",type:new _definition.GraphQLNonNull(_scalars.GraphQLBoolean),resolve:function(d){return-1!==d.locations.indexOf(_directives.DirectiveLocation.FIELD)}}}}}),__DirectiveLocation=exports.__DirectiveLocation=new _definition.GraphQLEnumType({name:"__DirectiveLocation",isIntrospection:!0,description:"A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.",values:{QUERY:{value:_directives.DirectiveLocation.QUERY,description:"Location adjacent to a query operation."},MUTATION:{value:_directives.DirectiveLocation.MUTATION,description:"Location adjacent to a mutation operation."},SUBSCRIPTION:{value:_directives.DirectiveLocation.SUBSCRIPTION,description:"Location adjacent to a subscription operation."},FIELD:{value:_directives.DirectiveLocation.FIELD,description:"Location adjacent to a field."},FRAGMENT_DEFINITION:{value:_directives.DirectiveLocation.FRAGMENT_DEFINITION,description:"Location adjacent to a fragment definition."},FRAGMENT_SPREAD:{value:_directives.DirectiveLocation.FRAGMENT_SPREAD,description:"Location adjacent to a fragment spread."},INLINE_FRAGMENT:{value:_directives.DirectiveLocation.INLINE_FRAGMENT,description:"Location adjacent to an inline fragment."},SCHEMA:{value:_directives.DirectiveLocation.SCHEMA,description:"Location adjacent to a schema definition."},SCALAR:{value:_directives.DirectiveLocation.SCALAR,description:"Location adjacent to a scalar definition."},OBJECT:{value:_directives.DirectiveLocation.OBJECT,description:"Location adjacent to an object type definition."},FIELD_DEFINITION:{value:_directives.DirectiveLocation.FIELD_DEFINITION,description:"Location adjacent to a field definition."},ARGUMENT_DEFINITION:{value:_directives.DirectiveLocation.ARGUMENT_DEFINITION,description:"Location adjacent to an argument definition."},INTERFACE:{value:_directives.DirectiveLocation.INTERFACE,description:"Location adjacent to an interface definition."},UNION:{value:_directives.DirectiveLocation.UNION,description:"Location adjacent to a union definition."},ENUM:{value:_directives.DirectiveLocation.ENUM,description:"Location adjacent to an enum definition."},ENUM_VALUE:{value:_directives.DirectiveLocation.ENUM_VALUE,description:"Location adjacent to an enum value definition."},INPUT_OBJECT:{value:_directives.DirectiveLocation.INPUT_OBJECT,description:"Location adjacent to an input object type definition."},INPUT_FIELD_DEFINITION:{value:_directives.DirectiveLocation.INPUT_FIELD_DEFINITION,description:"Location adjacent to an input object field definition."}}}),__Type=exports.__Type=new _definition.GraphQLObjectType({name:"__Type",isIntrospection:!0,description:"The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\n\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name and description, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.",fields:function(){return{kind:{type:new _definition.GraphQLNonNull(__TypeKind),resolve:function(type){if(type instanceof _definition.GraphQLScalarType)return TypeKind.SCALAR;if(type instanceof _definition.GraphQLObjectType)return TypeKind.OBJECT;if(type instanceof _definition.GraphQLInterfaceType)return TypeKind.INTERFACE;if(type instanceof _definition.GraphQLUnionType)return TypeKind.UNION;if(type instanceof _definition.GraphQLEnumType)return TypeKind.ENUM;if(type instanceof _definition.GraphQLInputObjectType)return TypeKind.INPUT_OBJECT;if(type instanceof _definition.GraphQLList)return TypeKind.LIST;if(type instanceof _definition.GraphQLNonNull)return TypeKind.NON_NULL;throw new Error("Unknown kind of type: "+type)}},name:{type:_scalars.GraphQLString},description:{type:_scalars.GraphQLString},fields:{type:new _definition.GraphQLList(new _definition.GraphQLNonNull(__Field)),args:{includeDeprecated:{type:_scalars.GraphQLBoolean,defaultValue:!1}},resolve:function(type,_ref){var includeDeprecated=_ref.includeDeprecated;if(type instanceof _definition.GraphQLObjectType||type instanceof _definition.GraphQLInterfaceType){var fieldMap=type.getFields(),fields=Object.keys(fieldMap).map(function(fieldName){return fieldMap[fieldName]});return includeDeprecated||(fields=fields.filter(function(field){return!field.deprecationReason})),fields}return null}},interfaces:{type:new _definition.GraphQLList(new _definition.GraphQLNonNull(__Type)),resolve:function(type){if(type instanceof _definition.GraphQLObjectType)return type.getInterfaces()}},possibleTypes:{type:new _definition.GraphQLList(new _definition.GraphQLNonNull(__Type)),resolve:function(type,args,context,_ref2){var schema=_ref2.schema;if((0,_definition.isAbstractType)(type))return schema.getPossibleTypes(type)}},enumValues:{type:new _definition.GraphQLList(new _definition.GraphQLNonNull(__EnumValue)),args:{includeDeprecated:{type:_scalars.GraphQLBoolean,defaultValue:!1}},resolve:function(type,_ref3){var includeDeprecated=_ref3.includeDeprecated;if(type instanceof _definition.GraphQLEnumType){var values=type.getValues();return includeDeprecated||(values=values.filter(function(value){return!value.deprecationReason})),values}}},inputFields:{type:new _definition.GraphQLList(new _definition.GraphQLNonNull(__InputValue)),resolve:function(type){if(type instanceof _definition.GraphQLInputObjectType){var fieldMap=type.getFields();return Object.keys(fieldMap).map(function(fieldName){return fieldMap[fieldName]})}}},ofType:{type:__Type}}}}),__Field=exports.__Field=new _definition.GraphQLObjectType({name:"__Field",isIntrospection:!0,description:"Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.",fields:function(){return{name:{type:new _definition.GraphQLNonNull(_scalars.GraphQLString)},description:{type:_scalars.GraphQLString},args:{type:new _definition.GraphQLNonNull(new _definition.GraphQLList(new _definition.GraphQLNonNull(__InputValue))),resolve:function(field){return field.args||[]}},type:{type:new _definition.GraphQLNonNull(__Type)},isDeprecated:{type:new _definition.GraphQLNonNull(_scalars.GraphQLBoolean)},deprecationReason:{type:_scalars.GraphQLString}}}}),__InputValue=exports.__InputValue=new _definition.GraphQLObjectType({name:"__InputValue",isIntrospection:!0,description:"Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.",fields:function(){return{name:{type:new _definition.GraphQLNonNull(_scalars.GraphQLString)},description:{type:_scalars.GraphQLString},type:{type:new _definition.GraphQLNonNull(__Type)},defaultValue:{type:_scalars.GraphQLString,description:"A GraphQL-formatted string representing the default value for this input value.",resolve:function(inputVal){return(0,_isInvalid2.default)(inputVal.defaultValue)?null:(0,_printer.print)((0,_astFromValue.astFromValue)(inputVal.defaultValue,inputVal.type))}}}}}),__EnumValue=exports.__EnumValue=new _definition.GraphQLObjectType({name:"__EnumValue",isIntrospection:!0,description:"One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.",fields:function(){return{name:{type:new _definition.GraphQLNonNull(_scalars.GraphQLString)},description:{type:_scalars.GraphQLString},isDeprecated:{type:new _definition.GraphQLNonNull(_scalars.GraphQLBoolean)},deprecationReason:{type:_scalars.GraphQLString}}}}),TypeKind=exports.TypeKind={SCALAR:"SCALAR",OBJECT:"OBJECT",INTERFACE:"INTERFACE",UNION:"UNION",ENUM:"ENUM",INPUT_OBJECT:"INPUT_OBJECT",LIST:"LIST",NON_NULL:"NON_NULL"},__TypeKind=exports.__TypeKind=new _definition.GraphQLEnumType({name:"__TypeKind",isIntrospection:!0,description:"An enum describing what kind of type a given `__Type` is.",values:{SCALAR:{value:TypeKind.SCALAR,description:"Indicates this type is a scalar."},OBJECT:{value:TypeKind.OBJECT,description:"Indicates this type is an object. `fields` and `interfaces` are valid fields."},INTERFACE:{value:TypeKind.INTERFACE,description:"Indicates this type is an interface. `fields` and `possibleTypes` are valid fields."},UNION:{value:TypeKind.UNION,description:"Indicates this type is a union. `possibleTypes` is a valid field."},ENUM:{value:TypeKind.ENUM,description:"Indicates this type is an enum. `enumValues` is a valid field."},INPUT_OBJECT:{value:TypeKind.INPUT_OBJECT,description:"Indicates this type is an input object. `inputFields` is a valid field."},LIST:{value:TypeKind.LIST,description:"Indicates this type is a list. `ofType` is a valid field."},NON_NULL:{value:TypeKind.NON_NULL,description:"Indicates this type is a non-null. `ofType` is a valid field."}}});exports.SchemaMetaFieldDef={name:"__schema",type:new _definition.GraphQLNonNull(__Schema),description:"Access the current type schema of this server.",args:[],resolve:function(source,args,context,_ref4){return _ref4.schema}},exports.TypeMetaFieldDef={name:"__type",type:__Type,description:"Request the type information of a single type.",args:[{name:"name",type:new _definition.GraphQLNonNull(_scalars.GraphQLString)}],resolve:function(source,_ref5,context,_ref6){var name=_ref5.name;return _ref6.schema.getType(name)}},exports.TypeNameMetaFieldDef={name:"__typename",type:new _definition.GraphQLNonNull(_scalars.GraphQLString),description:"The name of the current Object type at runtime.",args:[],resolve:function(source,args,context,_ref7){return _ref7.parentType.name}}},{"../jsutils/isInvalid":95,"../language/printer":106,"../utilities/astFromValue":120,"./definition":112,"./directives":113,"./scalars":116}],116:[function(require,module,exports){"use strict";function coerceInt(value){if(""===value)throw new TypeError("Int cannot represent non 32-bit signed integer value: (empty string)");var num=Number(value);if(num!==num||num>MAX_INT||num<MIN_INT)throw new TypeError("Int cannot represent non 32-bit signed integer value: "+String(value));var int=Math.floor(num);if(int!==num)throw new TypeError("Int cannot represent non-integer value: "+String(value));return int}function coerceFloat(value){if(""===value)throw new TypeError("Float cannot represent non numeric value: (empty string)");var num=Number(value);if(num===num)return num;throw new TypeError("Float cannot represent non numeric value: "+String(value))}Object.defineProperty(exports,"__esModule",{value:!0}),exports.GraphQLID=exports.GraphQLBoolean=exports.GraphQLString=exports.GraphQLFloat=exports.GraphQLInt=void 0;var _definition=require("./definition"),Kind=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(require("../language/kinds")),MAX_INT=2147483647,MIN_INT=-2147483648;exports.GraphQLInt=new _definition.GraphQLScalarType({name:"Int",description:"The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1. ",serialize:coerceInt,parseValue:coerceInt,parseLiteral:function(ast){if(ast.kind===Kind.INT){var num=parseInt(ast.value,10);if(num<=MAX_INT&&num>=MIN_INT)return num}return null}}),exports.GraphQLFloat=new _definition.GraphQLScalarType({name:"Float",description:"The `Float` scalar type represents signed double-precision fractional values as specified by [IEEE 754](http://en.wikipedia.org/wiki/IEEE_floating_point). ",serialize:coerceFloat,parseValue:coerceFloat,parseLiteral:function(ast){return ast.kind===Kind.FLOAT||ast.kind===Kind.INT?parseFloat(ast.value):null}}),exports.GraphQLString=new _definition.GraphQLScalarType({name:"String",description:"The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.",serialize:String,parseValue:String,parseLiteral:function(ast){return ast.kind===Kind.STRING?ast.value:null}}),exports.GraphQLBoolean=new _definition.GraphQLScalarType({name:"Boolean",description:"The `Boolean` scalar type represents `true` or `false`.",serialize:Boolean,parseValue:Boolean,parseLiteral:function(ast){return ast.kind===Kind.BOOLEAN?ast.value:null}}),exports.GraphQLID=new _definition.GraphQLScalarType({name:"ID",description:'The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `"4"`) or integer (such as `4`) input value will be accepted as an ID.',serialize:String,parseValue:String,parseLiteral:function(ast){return ast.kind===Kind.STRING||ast.kind===Kind.INT?ast.value:null}})},{"../language/kinds":102,"./definition":112}],117:[function(require,module,exports){"use strict";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 typeMapReducer(map,type){if(!type)return map;if(type instanceof _definition.GraphQLList||type instanceof _definition.GraphQLNonNull)return typeMapReducer(map,type.ofType);if(map[type.name])return(0,_invariant2.default)(map[type.name]===type,'Schema must contain unique named types but contains multiple types named "'+type.name+'".'),map;map[type.name]=type;var reducedMap=map;if(type instanceof _definition.GraphQLUnionType&&(reducedMap=type.getTypes().reduce(typeMapReducer,reducedMap)),type instanceof _definition.GraphQLObjectType&&(reducedMap=type.getInterfaces().reduce(typeMapReducer,reducedMap)),type instanceof _definition.GraphQLObjectType||type instanceof _definition.GraphQLInterfaceType){var fieldMap=type.getFields();Object.keys(fieldMap).forEach(function(fieldName){var field=fieldMap[fieldName];if(field.args){var fieldArgTypes=field.args.map(function(arg){return arg.type});reducedMap=fieldArgTypes.reduce(typeMapReducer,reducedMap)}reducedMap=typeMapReducer(reducedMap,field.type)})}if(type instanceof _definition.GraphQLInputObjectType){var _fieldMap=type.getFields();Object.keys(_fieldMap).forEach(function(fieldName){var field=_fieldMap[fieldName];reducedMap=typeMapReducer(reducedMap,field.type)})}return reducedMap}function assertObjectImplementsInterface(schema,object,iface){var objectFieldMap=object.getFields(),ifaceFieldMap=iface.getFields();Object.keys(ifaceFieldMap).forEach(function(fieldName){var objectField=objectFieldMap[fieldName],ifaceField=ifaceFieldMap[fieldName];(0,_invariant2.default)(objectField,'"'+iface.name+'" expects field "'+fieldName+'" but "'+object.name+'" does not provide it.'),(0,_invariant2.default)((0,_typeComparators.isTypeSubTypeOf)(schema,objectField.type,ifaceField.type),iface.name+"."+fieldName+' expects type "'+String(ifaceField.type)+'" but '+object.name+"."+fieldName+' provides type "'+String(objectField.type)+'".'),ifaceField.args.forEach(function(ifaceArg){var argName=ifaceArg.name,objectArg=(0,_find2.default)(objectField.args,function(arg){return arg.name===argName});(0,_invariant2.default)(objectArg,iface.name+"."+fieldName+' expects argument "'+argName+'" but '+object.name+"."+fieldName+" does not provide it."),(0,_invariant2.default)((0,_typeComparators.isEqualType)(ifaceArg.type,objectArg.type),iface.name+"."+fieldName+"("+argName+':) expects type "'+String(ifaceArg.type)+'" but '+object.name+"."+fieldName+"("+argName+':) provides type "'+String(objectArg.type)+'".')}),objectField.args.forEach(function(objectArg){var argName=objectArg.name;(0,_find2.default)(ifaceField.args,function(arg){return arg.name===argName})||(0,_invariant2.default)(!(objectArg.type instanceof _definition.GraphQLNonNull),object.name+"."+fieldName+"("+argName+':) is of required type "'+String(objectArg.type)+'" but is not also provided by the interface '+iface.name+"."+fieldName+".")})})}Object.defineProperty(exports,"__esModule",{value:!0}),exports.GraphQLSchema=void 0;var _definition=require("./definition"),_directives=require("./directives"),_introspection=require("./introspection"),_find2=_interopRequireDefault(require("../jsutils/find")),_invariant2=_interopRequireDefault(require("../jsutils/invariant")),_typeComparators=require("../utilities/typeComparators");exports.GraphQLSchema=function(){function GraphQLSchema(config){var _this=this;_classCallCheck(this,GraphQLSchema),(0,_invariant2.default)("object"==typeof config,"Must provide configuration object."),(0,_invariant2.default)(config.query instanceof _definition.GraphQLObjectType,"Schema query must be Object Type but got: "+String(config.query)+"."),this._queryType=config.query,(0,_invariant2.default)(!config.mutation||config.mutation instanceof _definition.GraphQLObjectType,"Schema mutation must be Object Type if provided but got: "+String(config.mutation)+"."),this._mutationType=config.mutation,(0,_invariant2.default)(!config.subscription||config.subscription instanceof _definition.GraphQLObjectType,"Schema subscription must be Object Type if provided but got: "+String(config.subscription)+"."),this._subscriptionType=config.subscription,(0,_invariant2.default)(!config.types||Array.isArray(config.types),"Schema types must be Array if provided but got: "+String(config.types)+"."),(0,_invariant2.default)(!config.directives||Array.isArray(config.directives)&&config.directives.every(function(directive){return directive instanceof _directives.GraphQLDirective}),"Schema directives must be Array<GraphQLDirective> if provided but got: "+String(config.directives)+"."),this._directives=config.directives||_directives.specifiedDirectives;var initialTypes=[this.getQueryType(),this.getMutationType(),this.getSubscriptionType(),_introspection.__Schema],types=config.types;types&&(initialTypes=initialTypes.concat(types)),this._typeMap=initialTypes.reduce(typeMapReducer,Object.create(null)),this._implementations=Object.create(null),Object.keys(this._typeMap).forEach(function(typeName){var type=_this._typeMap[typeName];type instanceof _definition.GraphQLObjectType&&type.getInterfaces().forEach(function(iface){var impls=_this._implementations[iface.name];impls?impls.push(type):_this._implementations[iface.name]=[type]})}),Object.keys(this._typeMap).forEach(function(typeName){var type=_this._typeMap[typeName];type instanceof _definition.GraphQLObjectType&&type.getInterfaces().forEach(function(iface){return assertObjectImplementsInterface(_this,type,iface)})})}return GraphQLSchema.prototype.getQueryType=function(){return this._queryType},GraphQLSchema.prototype.getMutationType=function(){return this._mutationType},GraphQLSchema.prototype.getSubscriptionType=function(){return this._subscriptionType},GraphQLSchema.prototype.getTypeMap=function(){return this._typeMap},GraphQLSchema.prototype.getType=function(name){return this.getTypeMap()[name]},GraphQLSchema.prototype.getPossibleTypes=function(abstractType){return abstractType instanceof _definition.GraphQLUnionType?abstractType.getTypes():((0,_invariant2.default)(abstractType instanceof _definition.GraphQLInterfaceType),this._implementations[abstractType.name])},GraphQLSchema.prototype.isPossibleType=function(abstractType,possibleType){var possibleTypeMap=this._possibleTypeMap;if(possibleTypeMap||(this._possibleTypeMap=possibleTypeMap=Object.create(null)),!possibleTypeMap[abstractType.name]){var possibleTypes=this.getPossibleTypes(abstractType);(0,_invariant2.default)(Array.isArray(possibleTypes),"Could not find possible implementing types for "+abstractType.name+" in schema. Check that schema.types is defined and is an array of all possible types in the schema."),possibleTypeMap[abstractType.name]=possibleTypes.reduce(function(map,type){return map[type.name]=!0,map},Object.create(null))}return Boolean(possibleTypeMap[abstractType.name][possibleType.name])},GraphQLSchema.prototype.getDirectives=function(){return this._directives},GraphQLSchema.prototype.getDirective=function(name){return(0,_find2.default)(this.getDirectives(),function(directive){return directive.name===name})},GraphQLSchema}()},{"../jsutils/find":93,"../jsutils/invariant":94,"../utilities/typeComparators":134,"./definition":112,"./directives":113,"./introspection":115}],118:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function getFieldDef(schema,parentType,fieldNode){var name=fieldNode.name.value;return name===_introspection.SchemaMetaFieldDef.name&&schema.getQueryType()===parentType?_introspection.SchemaMetaFieldDef:name===_introspection.TypeMetaFieldDef.name&&schema.getQueryType()===parentType?_introspection.TypeMetaFieldDef:name===_introspection.TypeNameMetaFieldDef.name&&(0,_definition.isCompositeType)(parentType)?_introspection.TypeNameMetaFieldDef:parentType instanceof _definition.GraphQLObjectType||parentType instanceof _definition.GraphQLInterfaceType?parentType.getFields()[name]:void 0}Object.defineProperty(exports,"__esModule",{value:!0}),exports.TypeInfo=void 0;var Kind=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(require("../language/kinds")),_definition=require("../type/definition"),_introspection=require("../type/introspection"),_typeFromAST=require("./typeFromAST"),_find2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(require("../jsutils/find"));exports.TypeInfo=function(){function TypeInfo(schema,getFieldDefFn){_classCallCheck(this,TypeInfo),this._schema=schema,this._typeStack=[],this._parentTypeStack=[],this._inputTypeStack=[],this._fieldDefStack=[],this._directive=null,this._argument=null,this._enumValue=null,this._getFieldDef=getFieldDefFn||getFieldDef}return TypeInfo.prototype.getType=function(){if(this._typeStack.length>0)return this._typeStack[this._typeStack.length-1]},TypeInfo.prototype.getParentType=function(){if(this._parentTypeStack.length>0)return this._parentTypeStack[this._parentTypeStack.length-1]},TypeInfo.prototype.getInputType=function(){if(this._inputTypeStack.length>0)return this._inputTypeStack[this._inputTypeStack.length-1]},TypeInfo.prototype.getFieldDef=function(){if(this._fieldDefStack.length>0)return this._fieldDefStack[this._fieldDefStack.length-1]},TypeInfo.prototype.getDirective=function(){return this._directive},TypeInfo.prototype.getArgument=function(){return this._argument},TypeInfo.prototype.getEnumValue=function(){return this._enumValue},TypeInfo.prototype.enter=function(node){var schema=this._schema;switch(node.kind){case Kind.SELECTION_SET:var namedType=(0,_definition.getNamedType)(this.getType());this._parentTypeStack.push((0,_definition.isCompositeType)(namedType)?namedType:void 0);break;case Kind.FIELD:var parentType=this.getParentType(),fieldDef=void 0;parentType&&(fieldDef=this._getFieldDef(schema,parentType,node)),this._fieldDefStack.push(fieldDef),this._typeStack.push(fieldDef&&fieldDef.type);break;case Kind.DIRECTIVE:this._directive=schema.getDirective(node.name.value);break;case Kind.OPERATION_DEFINITION:var type=void 0;"query"===node.operation?type=schema.getQueryType():"mutation"===node.operation?type=schema.getMutationType():"subscription"===node.operation&&(type=schema.getSubscriptionType()),this._typeStack.push(type);break;case Kind.INLINE_FRAGMENT:case Kind.FRAGMENT_DEFINITION:var typeConditionAST=node.typeCondition,outputType=typeConditionAST?(0,_typeFromAST.typeFromAST)(schema,typeConditionAST):this.getType();this._typeStack.push((0,_definition.isOutputType)(outputType)?outputType:void 0);break;case Kind.VARIABLE_DEFINITION:var inputType=(0,_typeFromAST.typeFromAST)(schema,node.type);this._inputTypeStack.push((0,_definition.isInputType)(inputType)?inputType:void 0);break;case Kind.ARGUMENT:var argDef=void 0,argType=void 0,fieldOrDirective=this.getDirective()||this.getFieldDef();fieldOrDirective&&(argDef=(0,_find2.default)(fieldOrDirective.args,function(arg){return arg.name===node.name.value}))&&(argType=argDef.type),this._argument=argDef,this._inputTypeStack.push(argType);break;case Kind.LIST:var listType=(0,_definition.getNullableType)(this.getInputType());this._inputTypeStack.push(listType instanceof _definition.GraphQLList?listType.ofType:void 0);break;case Kind.OBJECT_FIELD:var objectType=(0,_definition.getNamedType)(this.getInputType()),fieldType=void 0;if(objectType instanceof _definition.GraphQLInputObjectType){var inputField=objectType.getFields()[node.name.value];fieldType=inputField?inputField.type:void 0}this._inputTypeStack.push(fieldType);break;case Kind.ENUM:var enumType=(0,_definition.getNamedType)(this.getInputType()),enumValue=void 0;enumType instanceof _definition.GraphQLEnumType&&(enumValue=enumType.getValue(node.value)),this._enumValue=enumValue}},TypeInfo.prototype.leave=function(node){switch(node.kind){case Kind.SELECTION_SET:this._parentTypeStack.pop();break;case Kind.FIELD:this._fieldDefStack.pop(),this._typeStack.pop();break;case Kind.DIRECTIVE:this._directive=null;break;case Kind.OPERATION_DEFINITION:case Kind.INLINE_FRAGMENT:case Kind.FRAGMENT_DEFINITION:this._typeStack.pop();break;case Kind.VARIABLE_DEFINITION:this._inputTypeStack.pop();break;case Kind.ARGUMENT:this._argument=null,this._inputTypeStack.pop();break;case Kind.LIST:case Kind.OBJECT_FIELD:this._inputTypeStack.pop();break;case Kind.ENUM:this._enumValue=null}},TypeInfo}()},{"../jsutils/find":93,"../language/kinds":102,"../type/definition":112,"../type/introspection":115,"./typeFromAST":135}],119:[function(require,module,exports){(function(process){"use strict";function formatWarning(error){var formatted="",errorString=String(error).replace(ERROR_PREFIX_RX,""),stack=error.stack;return stack&&(formatted=stack.replace(ERROR_PREFIX_RX,"")),-1===formatted.indexOf(errorString)&&(formatted=errorString+"\n"+formatted),formatted.trim()}Object.defineProperty(exports,"__esModule",{value:!0}),exports.assertValidName=function(name,isIntrospection){if(!name||"string"!=typeof name)throw new Error("Must be named. Unexpected name: "+name+".");if(!isIntrospection&&!hasWarnedAboutDunder&&!noNameWarning&&"__"===name.slice(0,2)&&(hasWarnedAboutDunder=!0,console&&console.warn)){var error=new Error('Name "'+name+'" must not begin with "__", which is reserved by GraphQL introspection. In a future release of graphql this will become a hard error.');console.warn(formatWarning(error))}if(!NAME_RX.test(name))throw new Error('Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but "'+name+'" does not.')},exports.formatWarning=formatWarning;var NAME_RX=/^[_a-zA-Z][_a-zA-Z0-9]*$/,ERROR_PREFIX_RX=/^Error: /,noNameWarning=Boolean(process&&process.env&&process.env.GRAPHQL_NO_NAME_WARNING),hasWarnedAboutDunder=!1}).call(this,require("_process"))},{_process:168}],120:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function astFromValue(value,type){var _value=value;if(type instanceof _definition.GraphQLNonNull){var astValue=astFromValue(_value,type.ofType);return astValue&&astValue.kind===Kind.NULL?null:astValue}if(null===_value)return{kind:Kind.NULL};if((0,_isInvalid2.default)(_value))return null;if(type instanceof _definition.GraphQLList){var itemType=type.ofType;if((0,_iterall.isCollection)(_value)){var valuesNodes=[];return(0,_iterall.forEach)(_value,function(item){var itemNode=astFromValue(item,itemType);itemNode&&valuesNodes.push(itemNode)}),{kind:Kind.LIST,values:valuesNodes}}return astFromValue(_value,itemType)}if(type instanceof _definition.GraphQLInputObjectType){if(null===_value||"object"!=typeof _value)return null;var fields=type.getFields(),fieldNodes=[];return Object.keys(fields).forEach(function(fieldName){var fieldType=fields[fieldName].type,fieldValue=astFromValue(_value[fieldName],fieldType);fieldValue&&fieldNodes.push({kind:Kind.OBJECT_FIELD,name:{kind:Kind.NAME,value:fieldName},value:fieldValue})}),{kind:Kind.OBJECT,fields:fieldNodes}}(0,_invariant2.default)(type instanceof _definition.GraphQLScalarType||type instanceof _definition.GraphQLEnumType,"Must provide Input Type, cannot use: "+String(type));var serialized=type.serialize(_value);if((0,_isNullish2.default)(serialized))return null;if("boolean"==typeof serialized)return{kind:Kind.BOOLEAN,value:serialized};if("number"==typeof serialized){var stringNum=String(serialized);return/^[0-9]+$/.test(stringNum)?{kind:Kind.INT,value:stringNum}:{kind:Kind.FLOAT,value:stringNum}}if("string"==typeof serialized)return type instanceof _definition.GraphQLEnumType?{kind:Kind.ENUM,value:serialized}:type===_scalars.GraphQLID&&/^[0-9]+$/.test(serialized)?{kind:Kind.INT,value:serialized}:{kind:Kind.STRING,value:JSON.stringify(serialized).slice(1,-1)};throw new TypeError("Cannot convert value to AST: "+String(serialized))}Object.defineProperty(exports,"__esModule",{value:!0}),exports.astFromValue=astFromValue;var _iterall=require("iterall"),_invariant2=_interopRequireDefault(require("../jsutils/invariant")),_isNullish2=_interopRequireDefault(require("../jsutils/isNullish")),_isInvalid2=_interopRequireDefault(require("../jsutils/isInvalid")),Kind=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(require("../language/kinds")),_definition=require("../type/definition"),_scalars=require("../type/scalars")},{"../jsutils/invariant":94,"../jsutils/isInvalid":95,"../jsutils/isNullish":96,"../language/kinds":102,"../type/definition":112,"../type/scalars":116,iterall:166}],121:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function buildWrappedType(innerType,inputTypeNode){if(inputTypeNode.kind===Kind.LIST_TYPE)return new _definition.GraphQLList(buildWrappedType(innerType,inputTypeNode.type));if(inputTypeNode.kind===Kind.NON_NULL_TYPE){var wrappedType=buildWrappedType(innerType,inputTypeNode.type);return(0,_invariant2.default)(!(wrappedType instanceof _definition.GraphQLNonNull),"No nesting nonnull."),new _definition.GraphQLNonNull(wrappedType)}return innerType}function getNamedTypeNode(typeNode){for(var namedType=typeNode;namedType.kind===Kind.LIST_TYPE||namedType.kind===Kind.NON_NULL_TYPE;)namedType=namedType.type;return namedType}function buildASTSchema(ast){function getObjectType(typeNode){var type=typeDefNamed(typeNode.name.value);return(0,_invariant2.default)(type instanceof _definition.GraphQLObjectType,"AST must provide object type."),type}function produceType(typeNode){return buildWrappedType(typeDefNamed(getNamedTypeNode(typeNode).name.value),typeNode)}function produceInputType(typeNode){return(0,_definition.assertInputType)(produceType(typeNode))}function produceOutputType(typeNode){return(0,_definition.assertOutputType)(produceType(typeNode))}function produceObjectType(typeNode){var type=produceType(typeNode);return(0,_invariant2.default)(type instanceof _definition.GraphQLObjectType,"Expected Object type."),type}function produceInterfaceType(typeNode){var type=produceType(typeNode);return(0,_invariant2.default)(type instanceof _definition.GraphQLInterfaceType,"Expected Interface type."),type}function typeDefNamed(typeName){if(innerTypeMap[typeName])return innerTypeMap[typeName];if(!nodeMap[typeName])throw new Error('Type "'+typeName+'" not found in document.');var innerTypeDef=makeSchemaDef(nodeMap[typeName]);if(!innerTypeDef)throw new Error('Nothing constructed for "'+typeName+'".');return innerTypeMap[typeName]=innerTypeDef,innerTypeDef}function makeSchemaDef(def){if(!def)throw new Error("def must be defined");switch(def.kind){case Kind.OBJECT_TYPE_DEFINITION:return makeTypeDef(def);case Kind.INTERFACE_TYPE_DEFINITION:return makeInterfaceDef(def);case Kind.ENUM_TYPE_DEFINITION:return makeEnumDef(def);case Kind.UNION_TYPE_DEFINITION:return makeUnionDef(def);case Kind.SCALAR_TYPE_DEFINITION:return makeScalarDef(def);case Kind.INPUT_OBJECT_TYPE_DEFINITION:return makeInputObjectDef(def);default:throw new Error('Type kind "'+def.kind+'" not supported.')}}function makeTypeDef(def){var typeName=def.name.value;return new _definition.GraphQLObjectType({name:typeName,description:getDescription(def),fields:function(){return makeFieldDefMap(def)},interfaces:function(){return makeImplementedInterfaces(def)}})}function makeFieldDefMap(def){return(0,_keyValMap2.default)(def.fields,function(field){return field.name.value},function(field){return{type:produceOutputType(field.type),description:getDescription(field),args:makeInputValues(field.arguments),deprecationReason:getDeprecationReason(field)}})}function makeImplementedInterfaces(def){return def.interfaces&&def.interfaces.map(function(iface){return produceInterfaceType(iface)})}function makeInputValues(values){return(0,_keyValMap2.default)(values,function(value){return value.name.value},function(value){var type=produceInputType(value.type);return{type:type,description:getDescription(value),defaultValue:(0,_valueFromAST.valueFromAST)(value.defaultValue,type)}})}function makeInterfaceDef(def){var typeName=def.name.value;return new _definition.GraphQLInterfaceType({name:typeName,description:getDescription(def),fields:function(){return makeFieldDefMap(def)},resolveType:cannotExecuteSchema})}function makeEnumDef(def){return new _definition.GraphQLEnumType({name:def.name.value,description:getDescription(def),values:(0,_keyValMap2.default)(def.values,function(enumValue){return enumValue.name.value},function(enumValue){return{description:getDescription(enumValue),deprecationReason:getDeprecationReason(enumValue)}})})}function makeUnionDef(def){return new _definition.GraphQLUnionType({name:def.name.value,description:getDescription(def),types:def.types.map(function(t){return produceObjectType(t)}),resolveType:cannotExecuteSchema})}function makeScalarDef(def){return new _definition.GraphQLScalarType({name:def.name.value,description:getDescription(def),serialize:function(){return null},parseValue:function(){return!1},parseLiteral:function(){return!1}})}function makeInputObjectDef(def){return new _definition.GraphQLInputObjectType({name:def.name.value,description:getDescription(def),fields:function(){return makeInputValues(def.fields)}})}if(!ast||ast.kind!==Kind.DOCUMENT)throw new Error("Must provide a document ast.");for(var schemaDef=void 0,typeDefs=[],nodeMap=Object.create(null),directiveDefs=[],i=0;i<ast.definitions.length;i++){var d=ast.definitions[i];switch(d.kind){case Kind.SCHEMA_DEFINITION:if(schemaDef)throw new Error("Must provide only one schema definition.");schemaDef=d;break;case Kind.SCALAR_TYPE_DEFINITION:case Kind.OBJECT_TYPE_DEFINITION:case Kind.INTERFACE_TYPE_DEFINITION:case Kind.ENUM_TYPE_DEFINITION:case Kind.UNION_TYPE_DEFINITION:case Kind.INPUT_OBJECT_TYPE_DEFINITION:var typeName=d.name.value;if(nodeMap[typeName])throw new Error('Type "'+typeName+'" was defined more than once.');typeDefs.push(d),nodeMap[typeName]=d;break;case Kind.DIRECTIVE_DEFINITION:directiveDefs.push(d)}}var queryTypeName=void 0,mutationTypeName=void 0,subscriptionTypeName=void 0;if(schemaDef?schemaDef.operationTypes.forEach(function(operationType){var typeName=operationType.type.name.value;if("query"===operationType.operation){if(queryTypeName)throw new Error("Must provide only one query type in schema.");if(!nodeMap[typeName])throw new Error('Specified query type "'+typeName+'" not found in document.');queryTypeName=typeName}else if("mutation"===operationType.operation){if(mutationTypeName)throw new Error("Must provide only one mutation type in schema.");if(!nodeMap[typeName])throw new Error('Specified mutation type "'+typeName+'" not found in document.');mutationTypeName=typeName}else if("subscription"===operationType.operation){if(subscriptionTypeName)throw new Error("Must provide only one subscription type in schema.");if(!nodeMap[typeName])throw new Error('Specified subscription type "'+typeName+'" not found in document.');subscriptionTypeName=typeName}}):(nodeMap.Query&&(queryTypeName="Query"),nodeMap.Mutation&&(mutationTypeName="Mutation"),nodeMap.Subscription&&(subscriptionTypeName="Subscription")),!queryTypeName)throw new Error("Must provide schema definition with query type or a type named Query.");var innerTypeMap={String:_scalars.GraphQLString,Int:_scalars.GraphQLInt,Float:_scalars.GraphQLFloat,Boolean:_scalars.GraphQLBoolean,ID:_scalars.GraphQLID,__Schema:_introspection.__Schema,__Directive:_introspection.__Directive,__DirectiveLocation:_introspection.__DirectiveLocation,__Type:_introspection.__Type,__Field:_introspection.__Field,__InputValue:_introspection.__InputValue,__EnumValue:_introspection.__EnumValue,__TypeKind:_introspection.__TypeKind},types=typeDefs.map(function(def){return typeDefNamed(def.name.value)}),directives=directiveDefs.map(function(directiveNode){return new _directives.GraphQLDirective({name:directiveNode.name.value,description:getDescription(directiveNode),locations:directiveNode.locations.map(function(node){return node.value}),args:directiveNode.arguments&&makeInputValues(directiveNode.arguments)})});return directives.some(function(directive){return"skip"===directive.name})||directives.push(_directives.GraphQLSkipDirective),directives.some(function(directive){return"include"===directive.name})||directives.push(_directives.GraphQLIncludeDirective),directives.some(function(directive){return"deprecated"===directive.name})||directives.push(_directives.GraphQLDeprecatedDirective),new _schema.GraphQLSchema({query:getObjectType(nodeMap[queryTypeName]),mutation:mutationTypeName?getObjectType(nodeMap[mutationTypeName]):null,subscription:subscriptionTypeName?getObjectType(nodeMap[subscriptionTypeName]):null,types:types,directives:directives})}function getDeprecationReason(node){var deprecated=(0,_values.getDirectiveValues)(_directives.GraphQLDeprecatedDirective,node);return deprecated&&deprecated.reason}function getDescription(node){var loc=node.loc;if(loc){for(var comments=[],minSpaces=void 0,token=loc.startToken.prev;token&&token.kind===_lexer.TokenKind.COMMENT&&token.next&&token.prev&&token.line+1===token.next.line&&token.line!==token.prev.line;){var value=String(token.value),spaces=leadingSpaces(value);(void 0===minSpaces||spaces<minSpaces)&&(minSpaces=spaces),comments.push(value),token=token.prev}return comments.reverse().map(function(comment){return comment.slice(minSpaces)}).join("\n")}}function leadingSpaces(str){for(var i=0;i<str.length&&" "===str[i];i++);return i}function cannotExecuteSchema(){throw new Error("Generated Schema cannot use Interface or Union types for execution.")}Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildASTSchema=buildASTSchema,exports.getDeprecationReason=getDeprecationReason,exports.getDescription=getDescription,exports.buildSchema=function(source){return buildASTSchema((0,_parser.parse)(source))};var _invariant2=_interopRequireDefault(require("../jsutils/invariant")),_keyValMap2=_interopRequireDefault(require("../jsutils/keyValMap")),_valueFromAST=require("./valueFromAST"),_lexer=require("../language/lexer"),_parser=require("../language/parser"),_values=require("../execution/values"),Kind=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(require("../language/kinds")),_schema=require("../type/schema"),_scalars=require("../type/scalars"),_definition=require("../type/definition"),_directives=require("../type/directives"),_introspection=require("../type/introspection")},{"../execution/values":90,"../jsutils/invariant":94,"../jsutils/keyValMap":98,"../language/kinds":102,"../language/lexer":103,"../language/parser":105,"../type/definition":112,"../type/directives":113,"../type/introspection":115,"../type/scalars":116,"../type/schema":117,"./valueFromAST":136}],122:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function cannotExecuteClientSchema(){throw new Error("Client Schema cannot use Interface or Union types for execution.")}Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildClientSchema=function(introspection){function getType(typeRef){if(typeRef.kind===_introspection.TypeKind.LIST){var itemRef=typeRef.ofType;if(!itemRef)throw new Error("Decorated type deeper than introspection query.");return new _definition.GraphQLList(getType(itemRef))}if(typeRef.kind===_introspection.TypeKind.NON_NULL){var nullableRef=typeRef.ofType;if(!nullableRef)throw new Error("Decorated type deeper than introspection query.");var nullableType=getType(nullableRef);return(0,_invariant2.default)(!(nullableType instanceof _definition.GraphQLNonNull),"No nesting nonnull."),new _definition.GraphQLNonNull(nullableType)}return getNamedType(typeRef.name)}function getNamedType(typeName){if(typeDefCache[typeName])return typeDefCache[typeName];var typeIntrospection=typeIntrospectionMap[typeName];if(!typeIntrospection)throw new Error("Invalid or incomplete schema, unknown type: "+typeName+". Ensure that a full introspection query is used in order to build a client schema.");var typeDef=buildType(typeIntrospection);return typeDefCache[typeName]=typeDef,typeDef}function getInputType(typeRef){var type=getType(typeRef);return(0,_invariant2.default)((0,_definition.isInputType)(type),"Introspection must provide input type for arguments."),type}function getOutputType(typeRef){var type=getType(typeRef);return(0,_invariant2.default)((0,_definition.isOutputType)(type),"Introspection must provide output type for fields."),type}function getObjectType(typeRef){var type=getType(typeRef);return(0,_invariant2.default)(type instanceof _definition.GraphQLObjectType,"Introspection must provide object type for possibleTypes."),type}function getInterfaceType(typeRef){var type=getType(typeRef);return(0,_invariant2.default)(type instanceof _definition.GraphQLInterfaceType,"Introspection must provide interface type for interfaces."),type}function buildType(type){switch(type.kind){case _introspection.TypeKind.SCALAR:return buildScalarDef(type);case _introspection.TypeKind.OBJECT:return buildObjectDef(type);case _introspection.TypeKind.INTERFACE:return buildInterfaceDef(type);case _introspection.TypeKind.UNION:return buildUnionDef(type);case _introspection.TypeKind.ENUM:return buildEnumDef(type);case _introspection.TypeKind.INPUT_OBJECT:return buildInputObjectDef(type);default:throw new Error("Invalid or incomplete schema, unknown kind: "+type.kind+". Ensure that a full introspection query is used in order to build a client schema.")}}function buildScalarDef(scalarIntrospection){return new _definition.GraphQLScalarType({name:scalarIntrospection.name,description:scalarIntrospection.description,serialize:function(id){return id},parseValue:function(){return!1},parseLiteral:function(){return!1}})}function buildObjectDef(objectIntrospection){return new _definition.GraphQLObjectType({name:objectIntrospection.name,description:objectIntrospection.description,interfaces:objectIntrospection.interfaces.map(getInterfaceType),fields:function(){return buildFieldDefMap(objectIntrospection)}})}function buildInterfaceDef(interfaceIntrospection){return new _definition.GraphQLInterfaceType({name:interfaceIntrospection.name,description:interfaceIntrospection.description,fields:function(){return buildFieldDefMap(interfaceIntrospection)},resolveType:cannotExecuteClientSchema})}function buildUnionDef(unionIntrospection){return new _definition.GraphQLUnionType({name:unionIntrospection.name,description:unionIntrospection.description,types:unionIntrospection.possibleTypes.map(getObjectType),resolveType:cannotExecuteClientSchema})}function buildEnumDef(enumIntrospection){return new _definition.GraphQLEnumType({name:enumIntrospection.name,description:enumIntrospection.description,values:(0,_keyValMap2.default)(enumIntrospection.enumValues,function(valueIntrospection){return valueIntrospection.name},function(valueIntrospection){return{description:valueIntrospection.description,deprecationReason:valueIntrospection.deprecationReason}})})}function buildInputObjectDef(inputObjectIntrospection){return new _definition.GraphQLInputObjectType({name:inputObjectIntrospection.name,description:inputObjectIntrospection.description,fields:function(){return buildInputValueDefMap(inputObjectIntrospection.inputFields)}})}function buildFieldDefMap(typeIntrospection){return(0,_keyValMap2.default)(typeIntrospection.fields,function(fieldIntrospection){return fieldIntrospection.name},function(fieldIntrospection){return{description:fieldIntrospection.description,deprecationReason:fieldIntrospection.deprecationReason,type:getOutputType(fieldIntrospection.type),args:buildInputValueDefMap(fieldIntrospection.args)}})}function buildInputValueDefMap(inputValueIntrospections){return(0,_keyValMap2.default)(inputValueIntrospections,function(inputValue){return inputValue.name},buildInputValue)}function buildInputValue(inputValueIntrospection){var type=getInputType(inputValueIntrospection.type),defaultValue=inputValueIntrospection.defaultValue?(0,_valueFromAST.valueFromAST)((0,_parser.parseValue)(inputValueIntrospection.defaultValue),type):void 0;return{name:inputValueIntrospection.name,description:inputValueIntrospection.description,type:type,defaultValue:defaultValue}}var schemaIntrospection=introspection.__schema,typeIntrospectionMap=(0,_keyMap2.default)(schemaIntrospection.types,function(type){return type.name}),typeDefCache={String:_scalars.GraphQLString,Int:_scalars.GraphQLInt,Float:_scalars.GraphQLFloat,Boolean:_scalars.GraphQLBoolean,ID:_scalars.GraphQLID,__Schema:_introspection.__Schema,__Directive:_introspection.__Directive,__DirectiveLocation:_introspection.__DirectiveLocation,__Type:_introspection.__Type,__Field:_introspection.__Field,__InputValue:_introspection.__InputValue,__EnumValue:_introspection.__EnumValue,__TypeKind:_introspection.__TypeKind},types=schemaIntrospection.types.map(function(typeIntrospection){return getNamedType(typeIntrospection.name)}),queryType=getObjectType(schemaIntrospection.queryType),mutationType=schemaIntrospection.mutationType?getObjectType(schemaIntrospection.mutationType):null,subscriptionType=schemaIntrospection.subscriptionType?getObjectType(schemaIntrospection.subscriptionType):null,directives=schemaIntrospection.directives?schemaIntrospection.directives.map(function(directiveIntrospection){var locations=directiveIntrospection.locations?directiveIntrospection.locations.slice():[].concat(directiveIntrospection.onField?[_directives.DirectiveLocation.FIELD]:[],directiveIntrospection.onOperation?[_directives.DirectiveLocation.QUERY,_directives.DirectiveLocation.MUTATION,_directives.DirectiveLocation.SUBSCRIPTION]:[],directiveIntrospection.onFragment?[_directives.DirectiveLocation.FRAGMENT_DEFINITION,_directives.DirectiveLocation.FRAGMENT_SPREAD,_directives.DirectiveLocation.INLINE_FRAGMENT]:[]);return new _directives.GraphQLDirective({name:directiveIntrospection.name,description:directiveIntrospection.description,locations:locations,args:buildInputValueDefMap(directiveIntrospection.args)})}):[];return new _schema.GraphQLSchema({query:queryType,mutation:mutationType,subscription:subscriptionType,types:types,directives:directives})};var _invariant2=_interopRequireDefault(require("../jsutils/invariant")),_keyMap2=_interopRequireDefault(require("../jsutils/keyMap")),_keyValMap2=_interopRequireDefault(require("../jsutils/keyValMap")),_valueFromAST=require("./valueFromAST"),_parser=require("../language/parser"),_schema=require("../type/schema"),_definition=require("../type/definition"),_introspection=require("../type/introspection"),_scalars=require("../type/scalars"),_directives=require("../type/directives")},{"../jsutils/invariant":94,"../jsutils/keyMap":97,"../jsutils/keyValMap":98,"../language/parser":105,"../type/definition":112,"../type/directives":113,"../type/introspection":115,"../type/scalars":116,"../type/schema":117,"./valueFromAST":136}],123:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.concatAST=function(asts){for(var batchDefinitions=[],i=0;i<asts.length;i++)for(var definitions=asts[i].definitions,j=0;j<definitions.length;j++)batchDefinitions.push(definitions[j]);return{kind:"Document",definitions:batchDefinitions}}},{}],124:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function cannotExecuteExtendedSchema(){throw new Error("Extended Schema cannot use Interface or Union types for execution.")}Object.defineProperty(exports,"__esModule",{value:!0}),exports.extendSchema=function(schema,documentAST){function getTypeFromDef(typeDef){var type=_getNamedType(typeDef.name);return(0,_invariant2.default)(type,"Missing type from schema"),type}function getTypeFromAST(node){var type=_getNamedType(node.name.value);if(!type)throw new _GraphQLError.GraphQLError('Unknown type: "'+node.name.value+'". Ensure that this type exists either in the original schema, or is added in a type definition.',[node]);return type}function getObjectTypeFromAST(node){var type=getTypeFromAST(node);return(0,_invariant2.default)(type instanceof _definition.GraphQLObjectType,"Must be Object type."),type}function getInterfaceTypeFromAST(node){var type=getTypeFromAST(node);return(0,_invariant2.default)(type instanceof _definition.GraphQLInterfaceType,"Must be Interface type."),type}function getInputTypeFromAST(node){return(0,_definition.assertInputType)(getTypeFromAST(node))}function getOutputTypeFromAST(node){return(0,_definition.assertOutputType)(getTypeFromAST(node))}function _getNamedType(typeName){var cachedTypeDef=typeDefCache[typeName];if(cachedTypeDef)return cachedTypeDef;var existingType=schema.getType(typeName);if(existingType){var typeDef=extendType(existingType);return typeDefCache[typeName]=typeDef,typeDef}var typeNode=typeDefinitionMap[typeName];if(typeNode){var _typeDef=buildType(typeNode);return typeDefCache[typeName]=_typeDef,_typeDef}}function extendType(type){return type instanceof _definition.GraphQLObjectType?extendObjectType(type):type instanceof _definition.GraphQLInterfaceType?extendInterfaceType(type):type instanceof _definition.GraphQLUnionType?extendUnionType(type):type}function extendObjectType(type){return new _definition.GraphQLObjectType({name:type.name,description:type.description,interfaces:function(){return extendImplementedInterfaces(type)},fields:function(){return extendFieldMap(type)},isTypeOf:type.isTypeOf})}function extendInterfaceType(type){return new _definition.GraphQLInterfaceType({name:type.name,description:type.description,fields:function(){return extendFieldMap(type)},resolveType:type.resolveType})}function extendUnionType(type){return new _definition.GraphQLUnionType({name:type.name,description:type.description,types:type.getTypes().map(getTypeFromDef),resolveType:type.resolveType})}function extendImplementedInterfaces(type){var interfaces=type.getInterfaces().map(getTypeFromDef),extensions=typeExtensionsMap[type.name];return extensions&&extensions.forEach(function(extension){extension.definition.interfaces.forEach(function(namedType){var interfaceName=namedType.name.value;if(interfaces.some(function(def){return def.name===interfaceName}))throw new _GraphQLError.GraphQLError('Type "'+type.name+'" already implements "'+interfaceName+'". It cannot also be implemented in this type extension.',[namedType]);interfaces.push(getInterfaceTypeFromAST(namedType))})}),interfaces}function extendFieldMap(type){var newFieldMap=Object.create(null),oldFieldMap=type.getFields();Object.keys(oldFieldMap).forEach(function(fieldName){var field=oldFieldMap[fieldName];newFieldMap[fieldName]={description:field.description,deprecationReason:field.deprecationReason,type:extendFieldType(field.type),args:(0,_keyMap2.default)(field.args,function(arg){return arg.name}),resolve:field.resolve}});var extensions=typeExtensionsMap[type.name];return extensions&&extensions.forEach(function(extension){extension.definition.fields.forEach(function(field){var fieldName=field.name.value;if(oldFieldMap[fieldName])throw new _GraphQLError.GraphQLError('Field "'+type.name+"."+fieldName+'" already exists in the schema. It cannot also be defined in this type extension.',[field]);newFieldMap[fieldName]={description:(0,_buildASTSchema.getDescription)(field),type:buildOutputFieldType(field.type),args:buildInputValues(field.arguments),deprecationReason:(0,_buildASTSchema.getDeprecationReason)(field)}})}),newFieldMap}function extendFieldType(typeDef){return typeDef instanceof _definition.GraphQLList?new _definition.GraphQLList(extendFieldType(typeDef.ofType)):typeDef instanceof _definition.GraphQLNonNull?new _definition.GraphQLNonNull(extendFieldType(typeDef.ofType)):getTypeFromDef(typeDef)}function buildType(typeNode){switch(typeNode.kind){case Kind.OBJECT_TYPE_DEFINITION:return buildObjectType(typeNode);case Kind.INTERFACE_TYPE_DEFINITION:return buildInterfaceType(typeNode);case Kind.UNION_TYPE_DEFINITION:return buildUnionType(typeNode);case Kind.SCALAR_TYPE_DEFINITION:return buildScalarType(typeNode);case Kind.ENUM_TYPE_DEFINITION:return buildEnumType(typeNode);case Kind.INPUT_OBJECT_TYPE_DEFINITION:return buildInputObjectType(typeNode)}throw new TypeError("Unknown type kind "+typeNode.kind)}function buildObjectType(typeNode){return new _definition.GraphQLObjectType({name:typeNode.name.value,description:(0,_buildASTSchema.getDescription)(typeNode),interfaces:function(){return buildImplementedInterfaces(typeNode)},fields:function(){return buildFieldMap(typeNode)}})}function buildInterfaceType(typeNode){return new _definition.GraphQLInterfaceType({name:typeNode.name.value,description:(0,_buildASTSchema.getDescription)(typeNode),fields:function(){return buildFieldMap(typeNode)},resolveType:cannotExecuteExtendedSchema})}function buildUnionType(typeNode){return new _definition.GraphQLUnionType({name:typeNode.name.value,description:(0,_buildASTSchema.getDescription)(typeNode),types:typeNode.types.map(getObjectTypeFromAST),resolveType:cannotExecuteExtendedSchema})}function buildScalarType(typeNode){return new _definition.GraphQLScalarType({name:typeNode.name.value,description:(0,_buildASTSchema.getDescription)(typeNode),serialize:function(id){return id},parseValue:function(){return!1},parseLiteral:function(){return!1}})}function buildEnumType(typeNode){return new _definition.GraphQLEnumType({name:typeNode.name.value,description:(0,_buildASTSchema.getDescription)(typeNode),values:(0,_keyValMap2.default)(typeNode.values,function(enumValue){return enumValue.name.value},function(enumValue){return{description:(0,_buildASTSchema.getDescription)(enumValue),deprecationReason:(0,_buildASTSchema.getDeprecationReason)(enumValue)}})})}function buildInputObjectType(typeNode){return new _definition.GraphQLInputObjectType({name:typeNode.name.value,description:(0,_buildASTSchema.getDescription)(typeNode),fields:function(){return buildInputValues(typeNode.fields)}})}function getDirective(directiveNode){return new _directives.GraphQLDirective({name:directiveNode.name.value,locations:directiveNode.locations.map(function(node){return node.value}),args:directiveNode.arguments&&buildInputValues(directiveNode.arguments)})}function buildImplementedInterfaces(typeNode){return typeNode.interfaces&&typeNode.interfaces.map(getInterfaceTypeFromAST)}function buildFieldMap(typeNode){return(0,_keyValMap2.default)(typeNode.fields,function(field){return field.name.value},function(field){return{type:buildOutputFieldType(field.type),description:(0,_buildASTSchema.getDescription)(field),args:buildInputValues(field.arguments),deprecationReason:(0,_buildASTSchema.getDeprecationReason)(field)}})}function buildInputValues(values){return(0,_keyValMap2.default)(values,function(value){return value.name.value},function(value){var type=buildInputFieldType(value.type);return{type:type,description:(0,_buildASTSchema.getDescription)(value),defaultValue:(0,_valueFromAST.valueFromAST)(value.defaultValue,type)}})}function buildInputFieldType(typeNode){if(typeNode.kind===Kind.LIST_TYPE)return new _definition.GraphQLList(buildInputFieldType(typeNode.type));if(typeNode.kind===Kind.NON_NULL_TYPE){var nullableType=buildInputFieldType(typeNode.type);return(0,_invariant2.default)(!(nullableType instanceof _definition.GraphQLNonNull),"Must be nullable"),new _definition.GraphQLNonNull(nullableType)}return getInputTypeFromAST(typeNode)}function buildOutputFieldType(typeNode){if(typeNode.kind===Kind.LIST_TYPE)return new _definition.GraphQLList(buildOutputFieldType(typeNode.type));if(typeNode.kind===Kind.NON_NULL_TYPE){var nullableType=buildOutputFieldType(typeNode.type);return(0,_invariant2.default)(!(nullableType instanceof _definition.GraphQLNonNull),"Must be nullable"),new _definition.GraphQLNonNull(nullableType)}return getOutputTypeFromAST(typeNode)}(0,_invariant2.default)(schema instanceof _schema.GraphQLSchema,"Must provide valid GraphQLSchema"),(0,_invariant2.default)(documentAST&&documentAST.kind===Kind.DOCUMENT,"Must provide valid Document AST");for(var typeDefinitionMap=Object.create(null),typeExtensionsMap=Object.create(null),directiveDefinitions=[],i=0;i<documentAST.definitions.length;i++){var def=documentAST.definitions[i];switch(def.kind){case Kind.OBJECT_TYPE_DEFINITION:case Kind.INTERFACE_TYPE_DEFINITION:case Kind.ENUM_TYPE_DEFINITION:case Kind.UNION_TYPE_DEFINITION:case Kind.SCALAR_TYPE_DEFINITION:case Kind.INPUT_OBJECT_TYPE_DEFINITION:var typeName=def.name.value;if(schema.getType(typeName))throw new _GraphQLError.GraphQLError('Type "'+typeName+'" already exists in the schema. It cannot also be defined in this type definition.',[def]);typeDefinitionMap[typeName]=def;break;case Kind.TYPE_EXTENSION_DEFINITION:var extendedTypeName=def.definition.name.value,existingType=schema.getType(extendedTypeName);if(!existingType)throw new _GraphQLError.GraphQLError('Cannot extend type "'+extendedTypeName+'" because it does not exist in the existing schema.',[def.definition]);if(!(existingType instanceof _definition.GraphQLObjectType))throw new _GraphQLError.GraphQLError('Cannot extend non-object type "'+extendedTypeName+'".',[def.definition]);var extensions=typeExtensionsMap[extendedTypeName];extensions?extensions.push(def):extensions=[def],typeExtensionsMap[extendedTypeName]=extensions;break;case Kind.DIRECTIVE_DEFINITION:var directiveName=def.name.value;if(schema.getDirective(directiveName))throw new _GraphQLError.GraphQLError('Directive "'+directiveName+'" already exists in the schema. It cannot be redefined.',[def]);directiveDefinitions.push(def)}}if(0===Object.keys(typeExtensionsMap).length&&0===Object.keys(typeDefinitionMap).length&&0===directiveDefinitions.length)return schema;var typeDefCache={String:_scalars.GraphQLString,Int:_scalars.GraphQLInt,Float:_scalars.GraphQLFloat,Boolean:_scalars.GraphQLBoolean,ID:_scalars.GraphQLID,__Schema:_introspection.__Schema,__Directive:_introspection.__Directive,__DirectiveLocation:_introspection.__DirectiveLocation,__Type:_introspection.__Type,__Field:_introspection.__Field,__InputValue:_introspection.__InputValue,__EnumValue:_introspection.__EnumValue,__TypeKind:_introspection.__TypeKind},queryType=getTypeFromDef(schema.getQueryType()),existingMutationType=schema.getMutationType(),mutationType=existingMutationType?getTypeFromDef(existingMutationType):null,existingSubscriptionType=schema.getSubscriptionType(),subscriptionType=existingSubscriptionType?getTypeFromDef(existingSubscriptionType):null,typeMap=schema.getTypeMap(),types=Object.keys(typeMap).map(function(typeName){return getTypeFromDef(typeMap[typeName])});return Object.keys(typeDefinitionMap).forEach(function(typeName){types.push(getTypeFromAST(typeDefinitionMap[typeName]))}),new _schema.GraphQLSchema({query:queryType,mutation:mutationType,subscription:subscriptionType,types:types,directives:function(){var existingDirectives=schema.getDirectives();(0,_invariant2.default)(existingDirectives,"schema must have default directives");var newDirectives=directiveDefinitions.map(function(directiveNode){return getDirective(directiveNode)});return existingDirectives.concat(newDirectives)}()})};var _invariant2=_interopRequireDefault(require("../jsutils/invariant")),_keyMap2=_interopRequireDefault(require("../jsutils/keyMap")),_keyValMap2=_interopRequireDefault(require("../jsutils/keyValMap")),_buildASTSchema=require("./buildASTSchema"),_valueFromAST=require("./valueFromAST"),_GraphQLError=require("../error/GraphQLError"),_schema=require("../type/schema"),_definition=require("../type/definition"),_directives=require("../type/directives"),_introspection=require("../type/introspection"),_scalars=require("../type/scalars"),Kind=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(require("../language/kinds"))},{"../error/GraphQLError":83,"../jsutils/invariant":94,"../jsutils/keyMap":97,"../jsutils/keyValMap":98,"../language/kinds":102,"../type/definition":112,"../type/directives":113,"../type/introspection":115,"../type/scalars":116,"../type/schema":117,"./buildASTSchema":121,"./valueFromAST":136}],125:[function(require,module,exports){"use strict";function findRemovedTypes(oldSchema,newSchema){var oldTypeMap=oldSchema.getTypeMap(),newTypeMap=newSchema.getTypeMap(),breakingChanges=[];return Object.keys(oldTypeMap).forEach(function(typeName){newTypeMap[typeName]||breakingChanges.push({type:BreakingChangeType.TYPE_REMOVED,description:typeName+" was removed."})}),breakingChanges}function findTypesThatChangedKind(oldSchema,newSchema){var oldTypeMap=oldSchema.getTypeMap(),newTypeMap=newSchema.getTypeMap(),breakingChanges=[];return Object.keys(oldTypeMap).forEach(function(typeName){if(newTypeMap[typeName]){var oldType=oldTypeMap[typeName],newType=newTypeMap[typeName];oldType instanceof newType.constructor||breakingChanges.push({type:BreakingChangeType.TYPE_CHANGED_KIND,description:typeName+" changed from "+typeKindName(oldType)+" to "+typeKindName(newType)+"."})}}),breakingChanges}function findArgChanges(oldSchema,newSchema){var oldTypeMap=oldSchema.getTypeMap(),newTypeMap=newSchema.getTypeMap(),breakingChanges=[],dangerousChanges=[];return Object.keys(oldTypeMap).forEach(function(typeName){var oldType=oldTypeMap[typeName],newType=newTypeMap[typeName];if((oldType instanceof _definition.GraphQLObjectType||oldType instanceof _definition.GraphQLInterfaceType)&&newType instanceof oldType.constructor){var oldTypeFields=oldType.getFields(),newTypeFields=newType.getFields();Object.keys(oldTypeFields).forEach(function(fieldName){newTypeFields[fieldName]&&(oldTypeFields[fieldName].args.forEach(function(oldArgDef){var newArgDef=newTypeFields[fieldName].args.find(function(arg){return arg.name===oldArgDef.name});newArgDef?isChangeSafeForInputObjectFieldOrFieldArg(oldArgDef.type,newArgDef.type)?void 0!==oldArgDef.defaultValue&&oldArgDef.defaultValue!==newArgDef.defaultValue&&dangerousChanges.push({type:DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE,description:oldType.name+"."+fieldName+" arg "+oldArgDef.name+" has changed defaultValue"}):breakingChanges.push({type:BreakingChangeType.ARG_CHANGED_KIND,description:oldType.name+"."+fieldName+" arg "+oldArgDef.name+" has changed type from "+oldArgDef.type.toString()+" to "+newArgDef.type.toString()}):breakingChanges.push({type:BreakingChangeType.ARG_REMOVED,description:oldType.name+"."+fieldName+" arg "+oldArgDef.name+" was removed"})}),newTypeFields[fieldName].args.forEach(function(newArgDef){!oldTypeFields[fieldName].args.find(function(arg){return arg.name===newArgDef.name})&&newArgDef.type instanceof _definition.GraphQLNonNull&&breakingChanges.push({type:BreakingChangeType.NON_NULL_ARG_ADDED,description:"A non-null arg "+newArgDef.name+" on "+newType.name+"."+fieldName+" was added"})}))})}}),{breakingChanges:breakingChanges,dangerousChanges:dangerousChanges}}function typeKindName(type){if(type instanceof _definition.GraphQLScalarType)return"a Scalar type";if(type instanceof _definition.GraphQLObjectType)return"an Object type";if(type instanceof _definition.GraphQLInterfaceType)return"an Interface type";if(type instanceof _definition.GraphQLUnionType)return"a Union type";if(type instanceof _definition.GraphQLEnumType)return"an Enum type";if(type instanceof _definition.GraphQLInputObjectType)return"an Input type";throw new TypeError("Unknown type "+type.constructor.name)}function findFieldsThatChangedType(oldSchema,newSchema){return[].concat(findFieldsThatChangedTypeOnObjectOrInterfaceTypes(oldSchema,newSchema),findFieldsThatChangedTypeOnInputObjectTypes(oldSchema,newSchema))}function findFieldsThatChangedTypeOnObjectOrInterfaceTypes(oldSchema,newSchema){var oldTypeMap=oldSchema.getTypeMap(),newTypeMap=newSchema.getTypeMap(),breakingFieldChanges=[];return Object.keys(oldTypeMap).forEach(function(typeName){var oldType=oldTypeMap[typeName],newType=newTypeMap[typeName];if((oldType instanceof _definition.GraphQLObjectType||oldType instanceof _definition.GraphQLInterfaceType)&&newType instanceof oldType.constructor){var oldTypeFieldsDef=oldType.getFields(),newTypeFieldsDef=newType.getFields();Object.keys(oldTypeFieldsDef).forEach(function(fieldName){if(fieldName in newTypeFieldsDef){var oldFieldType=oldTypeFieldsDef[fieldName].type,newFieldType=newTypeFieldsDef[fieldName].type;if(!isChangeSafeForObjectOrInterfaceField(oldFieldType,newFieldType)){var oldFieldTypeString=(0,_definition.isNamedType)(oldFieldType)?oldFieldType.name:oldFieldType.toString(),newFieldTypeString=(0,_definition.isNamedType)(newFieldType)?newFieldType.name:newFieldType.toString();breakingFieldChanges.push({type:BreakingChangeType.FIELD_CHANGED_KIND,description:typeName+"."+fieldName+" changed type from "+oldFieldTypeString+" to "+newFieldTypeString+"."})}}else breakingFieldChanges.push({type:BreakingChangeType.FIELD_REMOVED,description:typeName+"."+fieldName+" was removed."})})}}),breakingFieldChanges}function findFieldsThatChangedTypeOnInputObjectTypes(oldSchema,newSchema){var oldTypeMap=oldSchema.getTypeMap(),newTypeMap=newSchema.getTypeMap(),breakingFieldChanges=[];return Object.keys(oldTypeMap).forEach(function(typeName){var oldType=oldTypeMap[typeName],newType=newTypeMap[typeName];if(oldType instanceof _definition.GraphQLInputObjectType&&newType instanceof _definition.GraphQLInputObjectType){var oldTypeFieldsDef=oldType.getFields(),newTypeFieldsDef=newType.getFields();Object.keys(oldTypeFieldsDef).forEach(function(fieldName){if(fieldName in newTypeFieldsDef){var oldFieldType=oldTypeFieldsDef[fieldName].type,newFieldType=newTypeFieldsDef[fieldName].type;if(!isChangeSafeForInputObjectFieldOrFieldArg(oldFieldType,newFieldType)){var oldFieldTypeString=(0,_definition.isNamedType)(oldFieldType)?oldFieldType.name:oldFieldType.toString(),newFieldTypeString=(0,_definition.isNamedType)(newFieldType)?newFieldType.name:newFieldType.toString();breakingFieldChanges.push({type:BreakingChangeType.FIELD_CHANGED_KIND,description:typeName+"."+fieldName+" changed type from "+oldFieldTypeString+" to "+newFieldTypeString+"."})}}else breakingFieldChanges.push({type:BreakingChangeType.FIELD_REMOVED,description:typeName+"."+fieldName+" was removed."})}),Object.keys(newTypeFieldsDef).forEach(function(fieldName){!(fieldName in oldTypeFieldsDef)&&newTypeFieldsDef[fieldName].type instanceof _definition.GraphQLNonNull&&breakingFieldChanges.push({type:BreakingChangeType.NON_NULL_INPUT_FIELD_ADDED,description:"A non-null field "+fieldName+" on input type "+newType.name+" was added."})})}}),breakingFieldChanges}function isChangeSafeForObjectOrInterfaceField(oldType,newType){return(0,_definition.isNamedType)(oldType)?(0,_definition.isNamedType)(newType)&&oldType.name===newType.name||newType instanceof _definition.GraphQLNonNull&&isChangeSafeForObjectOrInterfaceField(oldType,newType.ofType):oldType instanceof _definition.GraphQLList?newType instanceof _definition.GraphQLList&&isChangeSafeForObjectOrInterfaceField(oldType.ofType,newType.ofType)||newType instanceof _definition.GraphQLNonNull&&isChangeSafeForObjectOrInterfaceField(oldType,newType.ofType):oldType instanceof _definition.GraphQLNonNull&&(newType instanceof _definition.GraphQLNonNull&&isChangeSafeForObjectOrInterfaceField(oldType.ofType,newType.ofType))}function isChangeSafeForInputObjectFieldOrFieldArg(oldType,newType){return(0,_definition.isNamedType)(oldType)?(0,_definition.isNamedType)(newType)&&oldType.name===newType.name:oldType instanceof _definition.GraphQLList?newType instanceof _definition.GraphQLList&&isChangeSafeForInputObjectFieldOrFieldArg(oldType.ofType,newType.ofType):oldType instanceof _definition.GraphQLNonNull&&(newType instanceof _definition.GraphQLNonNull&&isChangeSafeForInputObjectFieldOrFieldArg(oldType.ofType,newType.ofType)||!(newType instanceof _definition.GraphQLNonNull)&&isChangeSafeForInputObjectFieldOrFieldArg(oldType.ofType,newType))}function findTypesRemovedFromUnions(oldSchema,newSchema){var oldTypeMap=oldSchema.getTypeMap(),newTypeMap=newSchema.getTypeMap(),typesRemovedFromUnion=[];return Object.keys(oldTypeMap).forEach(function(typeName){var oldType=oldTypeMap[typeName],newType=newTypeMap[typeName];if(oldType instanceof _definition.GraphQLUnionType&&newType instanceof _definition.GraphQLUnionType){var typeNamesInNewUnion=Object.create(null);newType.getTypes().forEach(function(type){typeNamesInNewUnion[type.name]=!0}),oldType.getTypes().forEach(function(type){typeNamesInNewUnion[type.name]||typesRemovedFromUnion.push({type:BreakingChangeType.TYPE_REMOVED_FROM_UNION,description:type.name+" was removed from union type "+typeName+"."})})}}),typesRemovedFromUnion}function findValuesRemovedFromEnums(oldSchema,newSchema){var oldTypeMap=oldSchema.getTypeMap(),newTypeMap=newSchema.getTypeMap(),valuesRemovedFromEnums=[];return Object.keys(oldTypeMap).forEach(function(typeName){var oldType=oldTypeMap[typeName],newType=newTypeMap[typeName];if(oldType instanceof _definition.GraphQLEnumType&&newType instanceof _definition.GraphQLEnumType){var valuesInNewEnum=Object.create(null);newType.getValues().forEach(function(value){valuesInNewEnum[value.name]=!0}),oldType.getValues().forEach(function(value){valuesInNewEnum[value.name]||valuesRemovedFromEnums.push({type:BreakingChangeType.VALUE_REMOVED_FROM_ENUM,description:value.name+" was removed from enum type "+typeName+"."})})}}),valuesRemovedFromEnums}function findInterfacesRemovedFromObjectTypes(oldSchema,newSchema){var oldTypeMap=oldSchema.getTypeMap(),newTypeMap=newSchema.getTypeMap(),breakingChanges=[];return Object.keys(oldTypeMap).forEach(function(typeName){var oldType=oldTypeMap[typeName],newType=newTypeMap[typeName];if(oldType instanceof _definition.GraphQLObjectType&&newType instanceof _definition.GraphQLObjectType){var oldInterfaces=oldType.getInterfaces(),newInterfaces=newType.getInterfaces();oldInterfaces.forEach(function(oldInterface){newInterfaces.some(function(int){return int.name===oldInterface.name})||breakingChanges.push({type:BreakingChangeType.INTERFACE_REMOVED_FROM_OBJECT,description:typeName+" no longer implements interface "+oldInterface.name+"."})})}}),breakingChanges}Object.defineProperty(exports,"__esModule",{value:!0}),exports.DangerousChangeType=exports.BreakingChangeType=void 0,exports.findBreakingChanges=function(oldSchema,newSchema){return[].concat(findRemovedTypes(oldSchema,newSchema),findTypesThatChangedKind(oldSchema,newSchema),findFieldsThatChangedType(oldSchema,newSchema),findTypesRemovedFromUnions(oldSchema,newSchema),findValuesRemovedFromEnums(oldSchema,newSchema),findArgChanges(oldSchema,newSchema).breakingChanges,findInterfacesRemovedFromObjectTypes(oldSchema,newSchema))},exports.findDangerousChanges=function(oldSchema,newSchema){return[].concat(findArgChanges(oldSchema,newSchema).dangerousChanges)},exports.findRemovedTypes=findRemovedTypes,exports.findTypesThatChangedKind=findTypesThatChangedKind,exports.findArgChanges=findArgChanges,exports.findFieldsThatChangedType=findFieldsThatChangedType,exports.findFieldsThatChangedTypeOnInputObjectTypes=findFieldsThatChangedTypeOnInputObjectTypes,exports.findTypesRemovedFromUnions=findTypesRemovedFromUnions,exports.findValuesRemovedFromEnums=findValuesRemovedFromEnums,exports.findInterfacesRemovedFromObjectTypes=findInterfacesRemovedFromObjectTypes;var _definition=require("../type/definition"),BreakingChangeType=(require("../type/schema"),exports.BreakingChangeType={FIELD_CHANGED_KIND:"FIELD_CHANGED_KIND",FIELD_REMOVED:"FIELD_REMOVED",TYPE_CHANGED_KIND:"TYPE_CHANGED_KIND",TYPE_REMOVED:"TYPE_REMOVED",TYPE_REMOVED_FROM_UNION:"TYPE_REMOVED_FROM_UNION",VALUE_REMOVED_FROM_ENUM:"VALUE_REMOVED_FROM_ENUM",ARG_REMOVED:"ARG_REMOVED",ARG_CHANGED_KIND:"ARG_CHANGED_KIND",NON_NULL_ARG_ADDED:"NON_NULL_ARG_ADDED",NON_NULL_INPUT_FIELD_ADDED:"NON_NULL_INPUT_FIELD_ADDED",INTERFACE_REMOVED_FROM_OBJECT:"INTERFACE_REMOVED_FROM_OBJECT"}),DangerousChangeType=exports.DangerousChangeType={ARG_DEFAULT_VALUE_CHANGE:"ARG_DEFAULT_VALUE_CHANGE"}},{"../type/definition":112,"../type/schema":117}],126:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.findDeprecatedUsages=function(schema,ast){var errors=[],typeInfo=new _TypeInfo.TypeInfo(schema);return(0,_visitor.visit)(ast,(0,_visitor.visitWithTypeInfo)(typeInfo,{Field:function(node){var fieldDef=typeInfo.getFieldDef();if(fieldDef&&fieldDef.isDeprecated){var parentType=typeInfo.getParentType();if(parentType){var reason=fieldDef.deprecationReason;errors.push(new _GraphQLError.GraphQLError("The field "+parentType.name+"."+fieldDef.name+" is deprecated."+(reason?" "+reason:""),[node]))}}},EnumValue:function(node){var enumVal=typeInfo.getEnumValue();if(enumVal&&enumVal.isDeprecated){var type=(0,_definition.getNamedType)(typeInfo.getInputType());if(type){var reason=enumVal.deprecationReason;errors.push(new _GraphQLError.GraphQLError("The enum value "+type.name+"."+enumVal.name+" is deprecated."+(reason?" "+reason:""),[node]))}}}})),errors};var _GraphQLError=require("../error/GraphQLError"),_visitor=require("../language/visitor"),_definition=require("../type/definition"),_TypeInfo=(require("../type/schema"),require("./TypeInfo"))},{"../error/GraphQLError":83,"../language/visitor":108,"../type/definition":112,"../type/schema":117,"./TypeInfo":118}],127:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getOperationAST=function(documentAST,operationName){for(var operation=null,i=0;i<documentAST.definitions.length;i++){var definition=documentAST.definitions[i];if(definition.kind===_kinds.OPERATION_DEFINITION)if(operationName){if(definition.name&&definition.name.value===operationName)return definition}else{if(operation)return null;operation=definition}}return operation};var _kinds=require("../language/kinds")},{"../language/kinds":102}],128:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _introspectionQuery=require("./introspectionQuery");Object.defineProperty(exports,"introspectionQuery",{enumerable:!0,get:function(){return _introspectionQuery.introspectionQuery}});var _getOperationAST=require("./getOperationAST");Object.defineProperty(exports,"getOperationAST",{enumerable:!0,get:function(){return _getOperationAST.getOperationAST}});var _buildClientSchema=require("./buildClientSchema");Object.defineProperty(exports,"buildClientSchema",{enumerable:!0,get:function(){return _buildClientSchema.buildClientSchema}});var _buildASTSchema=require("./buildASTSchema");Object.defineProperty(exports,"buildASTSchema",{enumerable:!0,get:function(){return _buildASTSchema.buildASTSchema}}),Object.defineProperty(exports,"buildSchema",{enumerable:!0,get:function(){return _buildASTSchema.buildSchema}});var _extendSchema=require("./extendSchema");Object.defineProperty(exports,"extendSchema",{enumerable:!0,get:function(){return _extendSchema.extendSchema}});var _schemaPrinter=require("./schemaPrinter");Object.defineProperty(exports,"printSchema",{enumerable:!0,get:function(){return _schemaPrinter.printSchema}}),Object.defineProperty(exports,"printType",{enumerable:!0,get:function(){return _schemaPrinter.printType}}),Object.defineProperty(exports,"printIntrospectionSchema",{enumerable:!0,get:function(){return _schemaPrinter.printIntrospectionSchema}});var _typeFromAST=require("./typeFromAST");Object.defineProperty(exports,"typeFromAST",{enumerable:!0,get:function(){return _typeFromAST.typeFromAST}});var _valueFromAST=require("./valueFromAST");Object.defineProperty(exports,"valueFromAST",{enumerable:!0,get:function(){return _valueFromAST.valueFromAST}});var _astFromValue=require("./astFromValue");Object.defineProperty(exports,"astFromValue",{enumerable:!0,get:function(){return _astFromValue.astFromValue}});var _TypeInfo=require("./TypeInfo");Object.defineProperty(exports,"TypeInfo",{enumerable:!0,get:function(){return _TypeInfo.TypeInfo}});var _isValidJSValue=require("./isValidJSValue");Object.defineProperty(exports,"isValidJSValue",{enumerable:!0,get:function(){return _isValidJSValue.isValidJSValue}});var _isValidLiteralValue=require("./isValidLiteralValue");Object.defineProperty(exports,"isValidLiteralValue",{enumerable:!0,get:function(){return _isValidLiteralValue.isValidLiteralValue}});var _concatAST=require("./concatAST");Object.defineProperty(exports,"concatAST",{enumerable:!0,get:function(){return _concatAST.concatAST}});var _separateOperations=require("./separateOperations");Object.defineProperty(exports,"separateOperations",{enumerable:!0,get:function(){return _separateOperations.separateOperations}});var _typeComparators=require("./typeComparators");Object.defineProperty(exports,"isEqualType",{enumerable:!0,get:function(){return _typeComparators.isEqualType}}),Object.defineProperty(exports,"isTypeSubTypeOf",{enumerable:!0,get:function(){return _typeComparators.isTypeSubTypeOf}}),Object.defineProperty(exports,"doTypesOverlap",{enumerable:!0,get:function(){return _typeComparators.doTypesOverlap}});var _assertValidName=require("./assertValidName");Object.defineProperty(exports,"assertValidName",{enumerable:!0,get:function(){return _assertValidName.assertValidName}});var _findBreakingChanges=require("./findBreakingChanges");Object.defineProperty(exports,"BreakingChangeType",{enumerable:!0,get:function(){return _findBreakingChanges.BreakingChangeType}}),Object.defineProperty(exports,"DangerousChangeType",{enumerable:!0,get:function(){return _findBreakingChanges.DangerousChangeType}}),Object.defineProperty(exports,"findBreakingChanges",{enumerable:!0,get:function(){return _findBreakingChanges.findBreakingChanges}});var _findDeprecatedUsages=require("./findDeprecatedUsages");Object.defineProperty(exports,"findDeprecatedUsages",{enumerable:!0,get:function(){return _findDeprecatedUsages.findDeprecatedUsages}})},{"./TypeInfo":118,"./assertValidName":119,"./astFromValue":120,"./buildASTSchema":121,"./buildClientSchema":122,"./concatAST":123,"./extendSchema":124,"./findBreakingChanges":125,"./findDeprecatedUsages":126,"./getOperationAST":127,"./introspectionQuery":129,"./isValidJSValue":130,"./isValidLiteralValue":131,"./schemaPrinter":132,"./separateOperations":133,"./typeComparators":134,"./typeFromAST":135,"./valueFromAST":136}],129:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.introspectionQuery="\n query IntrospectionQuery {\n __schema {\n queryType { name }\n mutationType { name }\n subscriptionType { name }\n types {\n ...FullType\n }\n directives {\n name\n description\n locations\n args {\n ...InputValue\n }\n }\n }\n }\n\n fragment FullType on __Type {\n kind\n name\n description\n fields(includeDeprecated: true) {\n name\n description\n args {\n ...InputValue\n }\n type {\n ...TypeRef\n }\n isDeprecated\n deprecationReason\n }\n inputFields {\n ...InputValue\n }\n interfaces {\n ...TypeRef\n }\n enumValues(includeDeprecated: true) {\n name\n description\n isDeprecated\n deprecationReason\n }\n possibleTypes {\n ...TypeRef\n }\n }\n\n fragment InputValue on __InputValue {\n name\n description\n type { ...TypeRef }\n defaultValue\n }\n\n fragment TypeRef on __Type {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n }\n }\n }\n }\n }\n }\n }\n }\n"},{}],130:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function isValidJSValue(value,type){if(type instanceof _definition.GraphQLNonNull)return(0,_isNullish2.default)(value)?['Expected "'+String(type)+'", found null.']:isValidJSValue(value,type.ofType);if((0,_isNullish2.default)(value))return[];if(type instanceof _definition.GraphQLList){var itemType=type.ofType;if((0,_iterall.isCollection)(value)){var errors=[];return(0,_iterall.forEach)(value,function(item,index){errors.push.apply(errors,isValidJSValue(item,itemType).map(function(error){return"In element #"+index+": "+error}))}),errors}return isValidJSValue(value,itemType)}if(type instanceof _definition.GraphQLInputObjectType){if("object"!=typeof value||null===value)return['Expected "'+type.name+'", found not an object.'];var fields=type.getFields(),_errors=[];return Object.keys(value).forEach(function(providedField){fields[providedField]||_errors.push('In field "'+providedField+'": Unknown field.')}),Object.keys(fields).forEach(function(fieldName){var newErrors=isValidJSValue(value[fieldName],fields[fieldName].type);_errors.push.apply(_errors,newErrors.map(function(error){return'In field "'+fieldName+'": '+error}))}),_errors}(0,_invariant2.default)(type instanceof _definition.GraphQLScalarType||type instanceof _definition.GraphQLEnumType,"Must be input type");try{var parseResult=type.parseValue(value);if((0,_isNullish2.default)(parseResult)&&!type.isValidValue(value))return['Expected type "'+type.name+'", found '+JSON.stringify(value)+"."]}catch(error){return['Expected type "'+type.name+'", found '+JSON.stringify(value)+": "+error.message]}return[]}Object.defineProperty(exports,"__esModule",{value:!0}),exports.isValidJSValue=isValidJSValue;var _iterall=require("iterall"),_invariant2=_interopRequireDefault(require("../jsutils/invariant")),_isNullish2=_interopRequireDefault(require("../jsutils/isNullish")),_definition=require("../type/definition")},{"../jsutils/invariant":94,"../jsutils/isNullish":96,"../type/definition":112,iterall:166}],131:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function isValidLiteralValue(type,valueNode){if(type instanceof _definition.GraphQLNonNull)return valueNode&&valueNode.kind!==Kind.NULL?isValidLiteralValue(type.ofType,valueNode):['Expected "'+String(type)+'", found null.'];if(!valueNode||valueNode.kind===Kind.NULL)return[];if(valueNode.kind===Kind.VARIABLE)return[];if(type instanceof _definition.GraphQLList){var itemType=type.ofType;return valueNode.kind===Kind.LIST?valueNode.values.reduce(function(acc,item,index){var errors=isValidLiteralValue(itemType,item);return acc.concat(errors.map(function(error){return"In element #"+index+": "+error}))},[]):isValidLiteralValue(itemType,valueNode)}if(type instanceof _definition.GraphQLInputObjectType){if(valueNode.kind!==Kind.OBJECT)return['Expected "'+type.name+'", found not an object.'];var fields=type.getFields(),errors=[],fieldNodes=valueNode.fields;fieldNodes.forEach(function(providedFieldNode){fields[providedFieldNode.name.value]||errors.push('In field "'+providedFieldNode.name.value+'": Unknown field.')});var fieldNodeMap=(0,_keyMap2.default)(fieldNodes,function(fieldNode){return fieldNode.name.value});return Object.keys(fields).forEach(function(fieldName){var result=isValidLiteralValue(fields[fieldName].type,fieldNodeMap[fieldName]&&fieldNodeMap[fieldName].value);errors.push.apply(errors,result.map(function(error){return'In field "'+fieldName+'": '+error}))}),errors}return(0,_invariant2.default)(type instanceof _definition.GraphQLScalarType||type instanceof _definition.GraphQLEnumType,"Must be input type"),type.isValidLiteral(valueNode)?[]:['Expected type "'+type.name+'", found '+(0,_printer.print)(valueNode)+"."]}Object.defineProperty(exports,"__esModule",{value:!0}),exports.isValidLiteralValue=isValidLiteralValue;var _printer=require("../language/printer"),Kind=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(require("../language/kinds")),_definition=require("../type/definition"),_invariant2=_interopRequireDefault(require("../jsutils/invariant")),_keyMap2=_interopRequireDefault(require("../jsutils/keyMap"))},{"../jsutils/invariant":94,"../jsutils/keyMap":97,"../language/kinds":102,"../language/printer":106,"../type/definition":112}],132:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function isSpecDirective(directiveName){return"skip"===directiveName||"include"===directiveName||"deprecated"===directiveName}function isDefinedType(typename){return!isIntrospectionType(typename)&&!isBuiltInScalar(typename)}function isIntrospectionType(typename){return 0===typename.indexOf("__")}function isBuiltInScalar(typename){return"String"===typename||"Boolean"===typename||"Int"===typename||"Float"===typename||"ID"===typename}function printFilteredSchema(schema,directiveFilter,typeFilter){var directives=schema.getDirectives().filter(function(directive){return directiveFilter(directive.name)}),typeMap=schema.getTypeMap(),types=Object.keys(typeMap).filter(typeFilter).sort(function(name1,name2){return name1.localeCompare(name2)}).map(function(typeName){return typeMap[typeName]});return[printSchemaDefinition(schema)].concat(directives.map(printDirective),types.map(printType)).filter(Boolean).join("\n\n")+"\n"}function printSchemaDefinition(schema){if(!isSchemaOfCommonNames(schema)){var operationTypes=[],queryType=schema.getQueryType();queryType&&operationTypes.push(" query: "+queryType.name);var mutationType=schema.getMutationType();mutationType&&operationTypes.push(" mutation: "+mutationType.name);var subscriptionType=schema.getSubscriptionType();return subscriptionType&&operationTypes.push(" subscription: "+subscriptionType.name),"schema {\n"+operationTypes.join("\n")+"\n}"}}function isSchemaOfCommonNames(schema){var queryType=schema.getQueryType();if(queryType&&"Query"!==queryType.name)return!1;var mutationType=schema.getMutationType();if(mutationType&&"Mutation"!==mutationType.name)return!1;var subscriptionType=schema.getSubscriptionType();return!subscriptionType||"Subscription"===subscriptionType.name}function printType(type){return type instanceof _definition.GraphQLScalarType?printScalar(type):type instanceof _definition.GraphQLObjectType?printObject(type):type instanceof _definition.GraphQLInterfaceType?printInterface(type):type instanceof _definition.GraphQLUnionType?printUnion(type):type instanceof _definition.GraphQLEnumType?printEnum(type):((0,_invariant2.default)(type instanceof _definition.GraphQLInputObjectType),printInputObject(type))}function printScalar(type){return printDescription(type)+"scalar "+type.name}function printObject(type){var interfaces=type.getInterfaces(),implementedInterfaces=interfaces.length?" implements "+interfaces.map(function(i){return i.name}).join(", "):"";return printDescription(type)+"type "+type.name+implementedInterfaces+" {\n"+printFields(type)+"\n}"}function printInterface(type){return printDescription(type)+"interface "+type.name+" {\n"+printFields(type)+"\n}"}function printUnion(type){return printDescription(type)+"union "+type.name+" = "+type.getTypes().join(" | ")}function printEnum(type){return printDescription(type)+"enum "+type.name+" {\n"+printEnumValues(type.getValues())+"\n}"}function printEnumValues(values){return values.map(function(value,i){return printDescription(value," ",!i)+" "+value.name+printDeprecated(value)}).join("\n")}function printInputObject(type){var fieldMap=type.getFields(),fields=Object.keys(fieldMap).map(function(fieldName){return fieldMap[fieldName]});return printDescription(type)+"input "+type.name+" {\n"+fields.map(function(f,i){return printDescription(f," ",!i)+" "+printInputValue(f)}).join("\n")+"\n}"}function printFields(type){var fieldMap=type.getFields();return Object.keys(fieldMap).map(function(fieldName){return fieldMap[fieldName]}).map(function(f,i){return printDescription(f," ",!i)+" "+f.name+printArgs(f.args," ")+": "+String(f.type)+printDeprecated(f)}).join("\n")}function printArgs(args){var indentation=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return 0===args.length?"":args.every(function(arg){return!arg.description})?"("+args.map(printInputValue).join(", ")+")":"(\n"+args.map(function(arg,i){return printDescription(arg," "+indentation,!i)+" "+indentation+printInputValue(arg)}).join("\n")+"\n"+indentation+")"}function printInputValue(arg){var argDecl=arg.name+": "+String(arg.type);return(0,_isInvalid2.default)(arg.defaultValue)||(argDecl+=" = "+(0,_printer.print)((0,_astFromValue.astFromValue)(arg.defaultValue,arg.type))),argDecl}function printDirective(directive){return printDescription(directive)+"directive @"+directive.name+printArgs(directive.args)+" on "+directive.locations.join(" | ")}function printDeprecated(fieldOrEnumVal){var reason=fieldOrEnumVal.deprecationReason;return(0,_isNullish2.default)(reason)?"":""===reason||reason===_directives.DEFAULT_DEPRECATION_REASON?" @deprecated":" @deprecated(reason: "+(0,_printer.print)((0,_astFromValue.astFromValue)(reason,_scalars.GraphQLString))+")"}function printDescription(def){var indentation=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",firstInBlock=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!def.description)return"";for(var lines=def.description.split("\n"),description=indentation&&!firstInBlock?"\n":"",i=0;i<lines.length;i++)if(""===lines[i])description+=indentation+"#\n";else for(var sublines=breakLine(lines[i],120-indentation.length),j=0;j<sublines.length;j++)description+=indentation+"# "+sublines[j]+"\n";return description}function breakLine(line,len){if(line.length<len+5)return[line];var parts=line.split(new RegExp("((?: |^).{15,"+(len-40)+"}(?= |$))"));if(parts.length<4)return[line];for(var sublines=[parts[0]+parts[1]+parts[2]],i=3;i<parts.length;i+=2)sublines.push(parts[i].slice(1)+parts[i+1]);return sublines}Object.defineProperty(exports,"__esModule",{value:!0}),exports.printSchema=function(schema){return printFilteredSchema(schema,function(n){return!isSpecDirective(n)},isDefinedType)},exports.printIntrospectionSchema=function(schema){return printFilteredSchema(schema,isSpecDirective,isIntrospectionType)},exports.printType=printType;var _invariant2=_interopRequireDefault(require("../jsutils/invariant")),_isNullish2=_interopRequireDefault(require("../jsutils/isNullish")),_isInvalid2=_interopRequireDefault(require("../jsutils/isInvalid")),_astFromValue=require("../utilities/astFromValue"),_printer=require("../language/printer"),_definition=require("../type/definition"),_scalars=require("../type/scalars"),_directives=require("../type/directives")},{"../jsutils/invariant":94,"../jsutils/isInvalid":95,"../jsutils/isNullish":96,"../language/printer":106,"../type/definition":112,"../type/directives":113,"../type/scalars":116,"../utilities/astFromValue":120}],133:[function(require,module,exports){"use strict";function opName(operation){return operation.name?operation.name.value:""}function collectTransitiveDependencies(collected,depGraph,fromName){var immediateDeps=depGraph[fromName];immediateDeps&&Object.keys(immediateDeps).forEach(function(toName){collected[toName]||(collected[toName]=!0,collectTransitiveDependencies(collected,depGraph,toName))})}Object.defineProperty(exports,"__esModule",{value:!0}),exports.separateOperations=function(documentAST){var operations=[],fragments=Object.create(null),positions=new Map,depGraph=Object.create(null),fromName=void 0,idx=0;(0,_visitor.visit)(documentAST,{OperationDefinition:function(node){fromName=opName(node),operations.push(node),positions.set(node,idx++)},FragmentDefinition:function(node){fromName=node.name.value,fragments[fromName]=node,positions.set(node,idx++)},FragmentSpread:function(node){var toName=node.name.value;(depGraph[fromName]||(depGraph[fromName]=Object.create(null)))[toName]=!0}});var separatedDocumentASTs=Object.create(null);return operations.forEach(function(operation){var operationName=opName(operation),dependencies=Object.create(null);collectTransitiveDependencies(dependencies,depGraph,operationName);var definitions=[operation];Object.keys(dependencies).forEach(function(name){definitions.push(fragments[name])}),definitions.sort(function(n1,n2){return(positions.get(n1)||0)-(positions.get(n2)||0)}),separatedDocumentASTs[operationName]={kind:"Document",definitions:definitions}}),separatedDocumentASTs};var _visitor=require("../language/visitor")},{"../language/visitor":108}],134:[function(require,module,exports){"use strict";function isEqualType(typeA,typeB){return typeA===typeB||(typeA instanceof _definition.GraphQLNonNull&&typeB instanceof _definition.GraphQLNonNull?isEqualType(typeA.ofType,typeB.ofType):typeA instanceof _definition.GraphQLList&&typeB instanceof _definition.GraphQLList&&isEqualType(typeA.ofType,typeB.ofType))}function isTypeSubTypeOf(schema,maybeSubType,superType){return maybeSubType===superType||(superType instanceof _definition.GraphQLNonNull?maybeSubType instanceof _definition.GraphQLNonNull&&isTypeSubTypeOf(schema,maybeSubType.ofType,superType.ofType):maybeSubType instanceof _definition.GraphQLNonNull?isTypeSubTypeOf(schema,maybeSubType.ofType,superType):superType instanceof _definition.GraphQLList?maybeSubType instanceof _definition.GraphQLList&&isTypeSubTypeOf(schema,maybeSubType.ofType,superType.ofType):!(maybeSubType instanceof _definition.GraphQLList)&&!!((0,_definition.isAbstractType)(superType)&&maybeSubType instanceof _definition.GraphQLObjectType&&schema.isPossibleType(superType,maybeSubType)))}Object.defineProperty(exports,"__esModule",{value:!0}),exports.isEqualType=isEqualType,exports.isTypeSubTypeOf=isTypeSubTypeOf,exports.doTypesOverlap=function(schema,typeA,typeB){var _typeB=typeB;return typeA===_typeB||((0,_definition.isAbstractType)(typeA)?(0,_definition.isAbstractType)(_typeB)?schema.getPossibleTypes(typeA).some(function(type){return schema.isPossibleType(_typeB,type)}):schema.isPossibleType(typeA,_typeB):!!(0,_definition.isAbstractType)(_typeB)&&schema.isPossibleType(_typeB,typeA))};var _definition=require("../type/definition")},{"../type/definition":112}],135:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.typeFromAST=void 0;var _invariant2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(require("../jsutils/invariant")),Kind=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(require("../language/kinds")),_definition=require("../type/definition"),typeFromAST=exports.typeFromAST=function(schema,typeNode){var innerType=void 0;return typeNode.kind===Kind.LIST_TYPE?(innerType=typeFromAST(schema,typeNode.type))&&new _definition.GraphQLList(innerType):typeNode.kind===Kind.NON_NULL_TYPE?(innerType=typeFromAST(schema,typeNode.type))&&new _definition.GraphQLNonNull(innerType):((0,_invariant2.default)(typeNode.kind===Kind.NAMED_TYPE,"Must be a named type."),schema.getType(typeNode.name.value))}},{"../jsutils/invariant":94,"../language/kinds":102,"../type/definition":112}],136:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function valueFromAST(valueNode,type,variables){if(valueNode){if(type instanceof _definition.GraphQLNonNull){if(valueNode.kind===Kind.NULL)return;return valueFromAST(valueNode,type.ofType,variables)}if(valueNode.kind===Kind.NULL)return null;if(valueNode.kind===Kind.VARIABLE){var variableName=valueNode.name.value;if(!variables||(0,_isInvalid2.default)(variables[variableName]))return;return variables[variableName]}if(type instanceof _definition.GraphQLList){var itemType=type.ofType;if(valueNode.kind===Kind.LIST){for(var coercedValues=[],itemNodes=valueNode.values,i=0;i<itemNodes.length;i++)if(isMissingVariable(itemNodes[i],variables)){if(itemType instanceof _definition.GraphQLNonNull)return;coercedValues.push(null)}else{var itemValue=valueFromAST(itemNodes[i],itemType,variables);if((0,_isInvalid2.default)(itemValue))return;coercedValues.push(itemValue)}return coercedValues}var coercedValue=valueFromAST(valueNode,itemType,variables);if((0,_isInvalid2.default)(coercedValue))return;return[coercedValue]}if(type instanceof _definition.GraphQLInputObjectType){if(valueNode.kind!==Kind.OBJECT)return;for(var coercedObj=Object.create(null),fields=type.getFields(),fieldNodes=(0,_keyMap2.default)(valueNode.fields,function(field){return field.name.value}),fieldNames=Object.keys(fields),_i=0;_i<fieldNames.length;_i++){var fieldName=fieldNames[_i],field=fields[fieldName],fieldNode=fieldNodes[fieldName];if(fieldNode&&!isMissingVariable(fieldNode.value,variables)){var fieldValue=valueFromAST(fieldNode.value,field.type,variables);if((0,_isInvalid2.default)(fieldValue))return;coercedObj[fieldName]=fieldValue}else if((0,_isInvalid2.default)(field.defaultValue)){if(field.type instanceof _definition.GraphQLNonNull)return}else coercedObj[fieldName]=field.defaultValue}return coercedObj}(0,_invariant2.default)(type instanceof _definition.GraphQLScalarType||type instanceof _definition.GraphQLEnumType,"Must be input type");var parsed=type.parseLiteral(valueNode);if(!(0,_isNullish2.default)(parsed)||type.isValidLiteral(valueNode))return parsed}}function isMissingVariable(valueNode,variables){return valueNode.kind===Kind.VARIABLE&&(!variables||(0,_isInvalid2.default)(variables[valueNode.name.value]))}Object.defineProperty(exports,"__esModule",{value:!0}),exports.valueFromAST=valueFromAST;var _keyMap2=_interopRequireDefault(require("../jsutils/keyMap")),_invariant2=_interopRequireDefault(require("../jsutils/invariant")),_isNullish2=_interopRequireDefault(require("../jsutils/isNullish")),_isInvalid2=_interopRequireDefault(require("../jsutils/isInvalid")),Kind=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(require("../language/kinds")),_definition=require("../type/definition")},{"../jsutils/invariant":94,"../jsutils/isInvalid":95,"../jsutils/isNullish":96,"../jsutils/keyMap":97,"../language/kinds":102,"../type/definition":112}],137:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _validate=require("./validate");Object.defineProperty(exports,"validate",{enumerable:!0,get:function(){return _validate.validate}}),Object.defineProperty(exports,"ValidationContext",{enumerable:!0,get:function(){return _validate.ValidationContext}});var _specifiedRules=require("./specifiedRules");Object.defineProperty(exports,"specifiedRules",{enumerable:!0,get:function(){return _specifiedRules.specifiedRules}});var _ArgumentsOfCorrectType=require("./rules/ArgumentsOfCorrectType");Object.defineProperty(exports,"ArgumentsOfCorrectTypeRule",{enumerable:!0,get:function(){return _ArgumentsOfCorrectType.ArgumentsOfCorrectType}});var _DefaultValuesOfCorrectType=require("./rules/DefaultValuesOfCorrectType");Object.defineProperty(exports,"DefaultValuesOfCorrectTypeRule",{enumerable:!0,get:function(){return _DefaultValuesOfCorrectType.DefaultValuesOfCorrectType}});var _FieldsOnCorrectType=require("./rules/FieldsOnCorrectType");Object.defineProperty(exports,"FieldsOnCorrectTypeRule",{enumerable:!0,get:function(){return _FieldsOnCorrectType.FieldsOnCorrectType}});var _FragmentsOnCompositeTypes=require("./rules/FragmentsOnCompositeTypes");Object.defineProperty(exports,"FragmentsOnCompositeTypesRule",{enumerable:!0,get:function(){return _FragmentsOnCompositeTypes.FragmentsOnCompositeTypes}});var _KnownArgumentNames=require("./rules/KnownArgumentNames");Object.defineProperty(exports,"KnownArgumentNamesRule",{enumerable:!0,get:function(){return _KnownArgumentNames.KnownArgumentNames}});var _KnownDirectives=require("./rules/KnownDirectives");Object.defineProperty(exports,"KnownDirectivesRule",{enumerable:!0,get:function(){return _KnownDirectives.KnownDirectives}});var _KnownFragmentNames=require("./rules/KnownFragmentNames");Object.defineProperty(exports,"KnownFragmentNamesRule",{enumerable:!0,get:function(){return _KnownFragmentNames.KnownFragmentNames}});var _KnownTypeNames=require("./rules/KnownTypeNames");Object.defineProperty(exports,"KnownTypeNamesRule",{enumerable:!0,get:function(){return _KnownTypeNames.KnownTypeNames}});var _LoneAnonymousOperation=require("./rules/LoneAnonymousOperation");Object.defineProperty(exports,"LoneAnonymousOperationRule",{enumerable:!0,get:function(){return _LoneAnonymousOperation.LoneAnonymousOperation}});var _NoFragmentCycles=require("./rules/NoFragmentCycles");Object.defineProperty(exports,"NoFragmentCyclesRule",{enumerable:!0,get:function(){return _NoFragmentCycles.NoFragmentCycles}});var _NoUndefinedVariables=require("./rules/NoUndefinedVariables");Object.defineProperty(exports,"NoUndefinedVariablesRule",{enumerable:!0,get:function(){return _NoUndefinedVariables.NoUndefinedVariables}});var _NoUnusedFragments=require("./rules/NoUnusedFragments");Object.defineProperty(exports,"NoUnusedFragmentsRule",{enumerable:!0,get:function(){return _NoUnusedFragments.NoUnusedFragments}});var _NoUnusedVariables=require("./rules/NoUnusedVariables");Object.defineProperty(exports,"NoUnusedVariablesRule",{enumerable:!0,get:function(){return _NoUnusedVariables.NoUnusedVariables}});var _OverlappingFieldsCanBeMerged=require("./rules/OverlappingFieldsCanBeMerged");Object.defineProperty(exports,"OverlappingFieldsCanBeMergedRule",{enumerable:!0,get:function(){return _OverlappingFieldsCanBeMerged.OverlappingFieldsCanBeMerged}});var _PossibleFragmentSpreads=require("./rules/PossibleFragmentSpreads");Object.defineProperty(exports,"PossibleFragmentSpreadsRule",{enumerable:!0,get:function(){return _PossibleFragmentSpreads.PossibleFragmentSpreads}});var _ProvidedNonNullArguments=require("./rules/ProvidedNonNullArguments");Object.defineProperty(exports,"ProvidedNonNullArgumentsRule",{enumerable:!0,get:function(){return _ProvidedNonNullArguments.ProvidedNonNullArguments}});var _ScalarLeafs=require("./rules/ScalarLeafs");Object.defineProperty(exports,"ScalarLeafsRule",{enumerable:!0,get:function(){return _ScalarLeafs.ScalarLeafs}});var _SingleFieldSubscriptions=require("./rules/SingleFieldSubscriptions");Object.defineProperty(exports,"SingleFieldSubscriptionsRule",{enumerable:!0,get:function(){return _SingleFieldSubscriptions.SingleFieldSubscriptions}});var _UniqueArgumentNames=require("./rules/UniqueArgumentNames");Object.defineProperty(exports,"UniqueArgumentNamesRule",{enumerable:!0,get:function(){return _UniqueArgumentNames.UniqueArgumentNames}});var _UniqueDirectivesPerLocation=require("./rules/UniqueDirectivesPerLocation");Object.defineProperty(exports,"UniqueDirectivesPerLocationRule",{enumerable:!0,get:function(){return _UniqueDirectivesPerLocation.UniqueDirectivesPerLocation}});var _UniqueFragmentNames=require("./rules/UniqueFragmentNames");Object.defineProperty(exports,"UniqueFragmentNamesRule",{enumerable:!0,get:function(){return _UniqueFragmentNames.UniqueFragmentNames}});var _UniqueInputFieldNames=require("./rules/UniqueInputFieldNames");Object.defineProperty(exports,"UniqueInputFieldNamesRule",{enumerable:!0,get:function(){return _UniqueInputFieldNames.UniqueInputFieldNames}});var _UniqueOperationNames=require("./rules/UniqueOperationNames");Object.defineProperty(exports,"UniqueOperationNamesRule",{enumerable:!0,get:function(){return _UniqueOperationNames.UniqueOperationNames}});var _UniqueVariableNames=require("./rules/UniqueVariableNames");Object.defineProperty(exports,"UniqueVariableNamesRule",{enumerable:!0,get:function(){return _UniqueVariableNames.UniqueVariableNames}});var _VariablesAreInputTypes=require("./rules/VariablesAreInputTypes");Object.defineProperty(exports,"VariablesAreInputTypesRule",{enumerable:!0,get:function(){return _VariablesAreInputTypes.VariablesAreInputTypes}});var _VariablesInAllowedPosition=require("./rules/VariablesInAllowedPosition");Object.defineProperty(exports,"VariablesInAllowedPositionRule",{enumerable:!0,get:function(){return _VariablesInAllowedPosition.VariablesInAllowedPosition}})},{"./rules/ArgumentsOfCorrectType":138,"./rules/DefaultValuesOfCorrectType":139,"./rules/FieldsOnCorrectType":140,"./rules/FragmentsOnCompositeTypes":141,"./rules/KnownArgumentNames":142,"./rules/KnownDirectives":143,"./rules/KnownFragmentNames":144,"./rules/KnownTypeNames":145,"./rules/LoneAnonymousOperation":146,"./rules/NoFragmentCycles":147,"./rules/NoUndefinedVariables":148,"./rules/NoUnusedFragments":149,"./rules/NoUnusedVariables":150,"./rules/OverlappingFieldsCanBeMerged":151,"./rules/PossibleFragmentSpreads":152,"./rules/ProvidedNonNullArguments":153,"./rules/ScalarLeafs":154,"./rules/SingleFieldSubscriptions":155,"./rules/UniqueArgumentNames":156,"./rules/UniqueDirectivesPerLocation":157,"./rules/UniqueFragmentNames":158,"./rules/UniqueInputFieldNames":159,"./rules/UniqueOperationNames":160,"./rules/UniqueVariableNames":161,"./rules/VariablesAreInputTypes":162,"./rules/VariablesInAllowedPosition":163,"./specifiedRules":164,"./validate":165}],138:[function(require,module,exports){"use strict";function badValueMessage(argName,type,value,verboseErrors){return'Argument "'+argName+'" has invalid value '+value+"."+(verboseErrors?"\n"+verboseErrors.join("\n"):"")}Object.defineProperty(exports,"__esModule",{value:!0}),exports.badValueMessage=badValueMessage,exports.ArgumentsOfCorrectType=function(context){return{Argument:function(node){var argDef=context.getArgument();if(argDef){var errors=(0,_isValidLiteralValue.isValidLiteralValue)(argDef.type,node.value);errors&&errors.length>0&&context.reportError(new _error.GraphQLError(badValueMessage(node.name.value,argDef.type,(0,_printer.print)(node.value),errors),[node.value]))}return!1}}};var _error=require("../../error"),_printer=require("../../language/printer"),_isValidLiteralValue=require("../../utilities/isValidLiteralValue")},{"../../error":85,"../../language/printer":106,"../../utilities/isValidLiteralValue":131}],139:[function(require,module,exports){"use strict";function defaultForNonNullArgMessage(varName,type,guessType){return'Variable "$'+varName+'" of type "'+String(type)+'" is required and will not use the default value. Perhaps you meant to use type "'+String(guessType)+'".'}function badValueForDefaultArgMessage(varName,type,value,verboseErrors){var message=verboseErrors?"\n"+verboseErrors.join("\n"):"";return'Variable "$'+varName+'" of type "'+String(type)+'" has invalid default value '+value+"."+message}Object.defineProperty(exports,"__esModule",{value:!0}),exports.defaultForNonNullArgMessage=defaultForNonNullArgMessage,exports.badValueForDefaultArgMessage=badValueForDefaultArgMessage,exports.DefaultValuesOfCorrectType=function(context){return{VariableDefinition:function(node){var name=node.variable.name.value,defaultValue=node.defaultValue,type=context.getInputType();if(type instanceof _definition.GraphQLNonNull&&defaultValue&&context.reportError(new _error.GraphQLError(defaultForNonNullArgMessage(name,type,type.ofType),[defaultValue])),type&&defaultValue){var errors=(0,_isValidLiteralValue.isValidLiteralValue)(type,defaultValue);errors&&errors.length>0&&context.reportError(new _error.GraphQLError(badValueForDefaultArgMessage(name,type,(0,_printer.print)(defaultValue),errors),[defaultValue]))}return!1},SelectionSet:function(){return!1},FragmentDefinition:function(){return!1}}};var _error=require("../../error"),_printer=require("../../language/printer"),_definition=require("../../type/definition"),_isValidLiteralValue=require("../../utilities/isValidLiteralValue")},{"../../error":85,"../../language/printer":106,"../../type/definition":112,"../../utilities/isValidLiteralValue":131}],140:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function undefinedFieldMessage(fieldName,type,suggestedTypeNames,suggestedFieldNames){var message='Cannot query field "'+fieldName+'" on type "'+type+'".';return 0!==suggestedTypeNames.length?message+=" Did you mean to use an inline fragment on "+(0,_quotedOrList2.default)(suggestedTypeNames)+"?":0!==suggestedFieldNames.length&&(message+=" Did you mean "+(0,_quotedOrList2.default)(suggestedFieldNames)+"?"),message}function getSuggestedTypeNames(schema,type,fieldName){if((0,_definition.isAbstractType)(type)){var suggestedObjectTypes=[],interfaceUsageCount=Object.create(null);return schema.getPossibleTypes(type).forEach(function(possibleType){possibleType.getFields()[fieldName]&&(suggestedObjectTypes.push(possibleType.name),possibleType.getInterfaces().forEach(function(possibleInterface){possibleInterface.getFields()[fieldName]&&(interfaceUsageCount[possibleInterface.name]=(interfaceUsageCount[possibleInterface.name]||0)+1)}))}),Object.keys(interfaceUsageCount).sort(function(a,b){return interfaceUsageCount[b]-interfaceUsageCount[a]}).concat(suggestedObjectTypes)}return[]}function getSuggestedFieldNames(schema,type,fieldName){if(type instanceof _definition.GraphQLObjectType||type instanceof _definition.GraphQLInterfaceType){var possibleFieldNames=Object.keys(type.getFields());return(0,_suggestionList2.default)(fieldName,possibleFieldNames)}return[]}Object.defineProperty(exports,"__esModule",{value:!0}),exports.undefinedFieldMessage=undefinedFieldMessage,exports.FieldsOnCorrectType=function(context){return{Field:function(node){var type=context.getParentType();if(type&&!context.getFieldDef()){var schema=context.getSchema(),fieldName=node.name.value,suggestedTypeNames=getSuggestedTypeNames(schema,type,fieldName),suggestedFieldNames=0!==suggestedTypeNames.length?[]:getSuggestedFieldNames(0,type,fieldName);context.reportError(new _error.GraphQLError(undefinedFieldMessage(fieldName,type.name,suggestedTypeNames,suggestedFieldNames),[node]))}}}};var _error=require("../../error"),_suggestionList2=_interopRequireDefault(require("../../jsutils/suggestionList")),_quotedOrList2=_interopRequireDefault(require("../../jsutils/quotedOrList")),_definition=require("../../type/definition")},{"../../error":85,"../../jsutils/quotedOrList":99,"../../jsutils/suggestionList":100,"../../type/definition":112}],141:[function(require,module,exports){"use strict";function inlineFragmentOnNonCompositeErrorMessage(type){return'Fragment cannot condition on non composite type "'+String(type)+'".'}function fragmentOnNonCompositeErrorMessage(fragName,type){return'Fragment "'+fragName+'" cannot condition on non composite type "'+String(type)+'".'}Object.defineProperty(exports,"__esModule",{value:!0}),exports.inlineFragmentOnNonCompositeErrorMessage=inlineFragmentOnNonCompositeErrorMessage,exports.fragmentOnNonCompositeErrorMessage=fragmentOnNonCompositeErrorMessage,exports.FragmentsOnCompositeTypes=function(context){return{InlineFragment:function(node){if(node.typeCondition){var type=(0,_typeFromAST.typeFromAST)(context.getSchema(),node.typeCondition);type&&!(0,_definition.isCompositeType)(type)&&context.reportError(new _error.GraphQLError(inlineFragmentOnNonCompositeErrorMessage((0,_printer.print)(node.typeCondition)),[node.typeCondition]))}},FragmentDefinition:function(node){var type=(0,_typeFromAST.typeFromAST)(context.getSchema(),node.typeCondition);type&&!(0,_definition.isCompositeType)(type)&&context.reportError(new _error.GraphQLError(fragmentOnNonCompositeErrorMessage(node.name.value,(0,_printer.print)(node.typeCondition)),[node.typeCondition]))}}};var _error=require("../../error"),_printer=require("../../language/printer"),_definition=require("../../type/definition"),_typeFromAST=require("../../utilities/typeFromAST")},{"../../error":85,"../../language/printer":106,"../../type/definition":112,"../../utilities/typeFromAST":135}],142:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function unknownArgMessage(argName,fieldName,type,suggestedArgs){var message='Unknown argument "'+argName+'" on field "'+fieldName+'" of type "'+String(type)+'".';return suggestedArgs.length&&(message+=" Did you mean "+(0,_quotedOrList2.default)(suggestedArgs)+"?"),message}function unknownDirectiveArgMessage(argName,directiveName,suggestedArgs){var message='Unknown argument "'+argName+'" on directive "@'+directiveName+'".';return suggestedArgs.length&&(message+=" Did you mean "+(0,_quotedOrList2.default)(suggestedArgs)+"?"),message}Object.defineProperty(exports,"__esModule",{value:!0}),exports.unknownArgMessage=unknownArgMessage,exports.unknownDirectiveArgMessage=unknownDirectiveArgMessage,exports.KnownArgumentNames=function(context){return{Argument:function(node,key,parent,path,ancestors){var argumentOf=ancestors[ancestors.length-1];if(argumentOf.kind===Kind.FIELD){var fieldDef=context.getFieldDef();if(fieldDef&&!(0,_find2.default)(fieldDef.args,function(arg){return arg.name===node.name.value})){var parentType=context.getParentType();(0,_invariant2.default)(parentType),context.reportError(new _error.GraphQLError(unknownArgMessage(node.name.value,fieldDef.name,parentType.name,(0,_suggestionList2.default)(node.name.value,fieldDef.args.map(function(arg){return arg.name}))),[node]))}}else if(argumentOf.kind===Kind.DIRECTIVE){var directive=context.getDirective();directive&&((0,_find2.default)(directive.args,function(arg){return arg.name===node.name.value})||context.reportError(new _error.GraphQLError(unknownDirectiveArgMessage(node.name.value,directive.name,(0,_suggestionList2.default)(node.name.value,directive.args.map(function(arg){return arg.name}))),[node])))}}}};var _error=require("../../error"),_find2=_interopRequireDefault(require("../../jsutils/find")),_invariant2=_interopRequireDefault(require("../../jsutils/invariant")),_suggestionList2=_interopRequireDefault(require("../../jsutils/suggestionList")),_quotedOrList2=_interopRequireDefault(require("../../jsutils/quotedOrList")),Kind=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(require("../../language/kinds"))},{"../../error":85,"../../jsutils/find":93,"../../jsutils/invariant":94,"../../jsutils/quotedOrList":99,"../../jsutils/suggestionList":100,"../../language/kinds":102}],143:[function(require,module,exports){"use strict";function unknownDirectiveMessage(directiveName){return'Unknown directive "'+directiveName+'".'}function misplacedDirectiveMessage(directiveName,location){return'Directive "'+directiveName+'" may not be used on '+location+"."}function getDirectiveLocationForASTPath(ancestors){var appliedTo=ancestors[ancestors.length-1];switch(appliedTo.kind){case Kind.OPERATION_DEFINITION:switch(appliedTo.operation){case"query":return _directives.DirectiveLocation.QUERY;case"mutation":return _directives.DirectiveLocation.MUTATION;case"subscription":return _directives.DirectiveLocation.SUBSCRIPTION}break;case Kind.FIELD:return _directives.DirectiveLocation.FIELD;case Kind.FRAGMENT_SPREAD:return _directives.DirectiveLocation.FRAGMENT_SPREAD;case Kind.INLINE_FRAGMENT:return _directives.DirectiveLocation.INLINE_FRAGMENT;case Kind.FRAGMENT_DEFINITION:return _directives.DirectiveLocation.FRAGMENT_DEFINITION;case Kind.SCHEMA_DEFINITION:return _directives.DirectiveLocation.SCHEMA;case Kind.SCALAR_TYPE_DEFINITION:return _directives.DirectiveLocation.SCALAR;case Kind.OBJECT_TYPE_DEFINITION:return _directives.DirectiveLocation.OBJECT;case Kind.FIELD_DEFINITION:return _directives.DirectiveLocation.FIELD_DEFINITION;case Kind.INTERFACE_TYPE_DEFINITION:return _directives.DirectiveLocation.INTERFACE;case Kind.UNION_TYPE_DEFINITION:return _directives.DirectiveLocation.UNION;case Kind.ENUM_TYPE_DEFINITION:return _directives.DirectiveLocation.ENUM;case Kind.ENUM_VALUE_DEFINITION:return _directives.DirectiveLocation.ENUM_VALUE;case Kind.INPUT_OBJECT_TYPE_DEFINITION:return _directives.DirectiveLocation.INPUT_OBJECT;case Kind.INPUT_VALUE_DEFINITION:return ancestors[ancestors.length-3].kind===Kind.INPUT_OBJECT_TYPE_DEFINITION?_directives.DirectiveLocation.INPUT_FIELD_DEFINITION:_directives.DirectiveLocation.ARGUMENT_DEFINITION}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.unknownDirectiveMessage=unknownDirectiveMessage,exports.misplacedDirectiveMessage=misplacedDirectiveMessage,exports.KnownDirectives=function(context){return{Directive:function(node,key,parent,path,ancestors){var directiveDef=(0,_find2.default)(context.getSchema().getDirectives(),function(def){return def.name===node.name.value});if(directiveDef){var candidateLocation=getDirectiveLocationForASTPath(ancestors);candidateLocation?-1===directiveDef.locations.indexOf(candidateLocation)&&context.reportError(new _error.GraphQLError(misplacedDirectiveMessage(node.name.value,candidateLocation),[node])):context.reportError(new _error.GraphQLError(misplacedDirectiveMessage(node.name.value,node.type),[node]))}else context.reportError(new _error.GraphQLError(unknownDirectiveMessage(node.name.value),[node]))}}};var _error=require("../../error"),_find2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(require("../../jsutils/find")),Kind=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(require("../../language/kinds")),_directives=require("../../type/directives")},{"../../error":85,"../../jsutils/find":93,"../../language/kinds":102,"../../type/directives":113}],144:[function(require,module,exports){"use strict";function unknownFragmentMessage(fragName){return'Unknown fragment "'+fragName+'".'}Object.defineProperty(exports,"__esModule",{value:!0}),exports.unknownFragmentMessage=unknownFragmentMessage,exports.KnownFragmentNames=function(context){return{FragmentSpread:function(node){var fragmentName=node.name.value;context.getFragment(fragmentName)||context.reportError(new _error.GraphQLError(unknownFragmentMessage(fragmentName),[node.name]))}}};var _error=require("../../error")},{"../../error":85}],145:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function unknownTypeMessage(type,suggestedTypes){var message='Unknown type "'+String(type)+'".';return suggestedTypes.length&&(message+=" Did you mean "+(0,_quotedOrList2.default)(suggestedTypes)+"?"),message}Object.defineProperty(exports,"__esModule",{value:!0}),exports.unknownTypeMessage=unknownTypeMessage,exports.KnownTypeNames=function(context){return{ObjectTypeDefinition:function(){return!1},InterfaceTypeDefinition:function(){return!1},UnionTypeDefinition:function(){return!1},InputObjectTypeDefinition:function(){return!1},NamedType:function(node){var schema=context.getSchema(),typeName=node.name.value;schema.getType(typeName)||context.reportError(new _error.GraphQLError(unknownTypeMessage(typeName,(0,_suggestionList2.default)(typeName,Object.keys(schema.getTypeMap()))),[node]))}}};var _error=require("../../error"),_suggestionList2=_interopRequireDefault(require("../../jsutils/suggestionList")),_quotedOrList2=_interopRequireDefault(require("../../jsutils/quotedOrList"))},{"../../error":85,"../../jsutils/quotedOrList":99,"../../jsutils/suggestionList":100}],146:[function(require,module,exports){"use strict";function anonOperationNotAloneMessage(){return"This anonymous operation must be the only defined operation."}Object.defineProperty(exports,"__esModule",{value:!0}),exports.anonOperationNotAloneMessage=anonOperationNotAloneMessage,exports.LoneAnonymousOperation=function(context){var operationCount=0;return{Document:function(node){operationCount=node.definitions.filter(function(definition){return definition.kind===_kinds.OPERATION_DEFINITION}).length},OperationDefinition:function(node){!node.name&&operationCount>1&&context.reportError(new _error.GraphQLError(anonOperationNotAloneMessage(),[node]))}}};var _error=require("../../error"),_kinds=require("../../language/kinds")},{"../../error":85,"../../language/kinds":102}],147:[function(require,module,exports){"use strict";function cycleErrorMessage(fragName,spreadNames){return'Cannot spread fragment "'+fragName+'" within itself'+(spreadNames.length?" via "+spreadNames.join(", "):"")+"."}Object.defineProperty(exports,"__esModule",{value:!0}),exports.cycleErrorMessage=cycleErrorMessage,exports.NoFragmentCycles=function(context){function detectCycleRecursive(fragment){var fragmentName=fragment.name.value;visitedFrags[fragmentName]=!0;var spreadNodes=context.getFragmentSpreads(fragment.selectionSet);if(0!==spreadNodes.length){spreadPathIndexByName[fragmentName]=spreadPath.length;for(var i=0;i<spreadNodes.length;i++){var spreadNode=spreadNodes[i],spreadName=spreadNode.name.value,cycleIndex=spreadPathIndexByName[spreadName];if(void 0===cycleIndex){if(spreadPath.push(spreadNode),!visitedFrags[spreadName]){var spreadFragment=context.getFragment(spreadName);spreadFragment&&detectCycleRecursive(spreadFragment)}spreadPath.pop()}else{var cyclePath=spreadPath.slice(cycleIndex);context.reportError(new _error.GraphQLError(cycleErrorMessage(spreadName,cyclePath.map(function(s){return s.name.value})),cyclePath.concat(spreadNode)))}}spreadPathIndexByName[fragmentName]=void 0}}var visitedFrags=Object.create(null),spreadPath=[],spreadPathIndexByName=Object.create(null);return{OperationDefinition:function(){return!1},FragmentDefinition:function(node){return visitedFrags[node.name.value]||detectCycleRecursive(node),!1}}};var _error=require("../../error")},{"../../error":85}],148:[function(require,module,exports){"use strict";function undefinedVarMessage(varName,opName){return opName?'Variable "$'+varName+'" is not defined by operation "'+opName+'".':'Variable "$'+varName+'" is not defined.'}Object.defineProperty(exports,"__esModule",{value:!0}),exports.undefinedVarMessage=undefinedVarMessage,exports.NoUndefinedVariables=function(context){var variableNameDefined=Object.create(null);return{OperationDefinition:{enter:function(){variableNameDefined=Object.create(null)},leave:function(operation){context.getRecursiveVariableUsages(operation).forEach(function(_ref){var node=_ref.node,varName=node.name.value;!0!==variableNameDefined[varName]&&context.reportError(new _error.GraphQLError(undefinedVarMessage(varName,operation.name&&operation.name.value),[node,operation]))})}},VariableDefinition:function(node){variableNameDefined[node.variable.name.value]=!0}}};var _error=require("../../error")},{"../../error":85}],149:[function(require,module,exports){"use strict";function unusedFragMessage(fragName){return'Fragment "'+fragName+'" is never used.'}Object.defineProperty(exports,"__esModule",{value:!0}),exports.unusedFragMessage=unusedFragMessage,exports.NoUnusedFragments=function(context){var operationDefs=[],fragmentDefs=[];return{OperationDefinition:function(node){return operationDefs.push(node),!1},FragmentDefinition:function(node){return fragmentDefs.push(node),!1},Document:{leave:function(){var fragmentNameUsed=Object.create(null);operationDefs.forEach(function(operation){context.getRecursivelyReferencedFragments(operation).forEach(function(fragment){fragmentNameUsed[fragment.name.value]=!0})}),fragmentDefs.forEach(function(fragmentDef){var fragName=fragmentDef.name.value;!0!==fragmentNameUsed[fragName]&&context.reportError(new _error.GraphQLError(unusedFragMessage(fragName),[fragmentDef]))})}}}};var _error=require("../../error")},{"../../error":85}],150:[function(require,module,exports){"use strict";function unusedVariableMessage(varName,opName){return opName?'Variable "$'+varName+'" is never used in operation "'+opName+'".':'Variable "$'+varName+'" is never used.'}Object.defineProperty(exports,"__esModule",{value:!0}),exports.unusedVariableMessage=unusedVariableMessage,exports.NoUnusedVariables=function(context){var variableDefs=[];return{OperationDefinition:{enter:function(){variableDefs=[]},leave:function(operation){var variableNameUsed=Object.create(null),usages=context.getRecursiveVariableUsages(operation),opName=operation.name?operation.name.value:null;usages.forEach(function(_ref){var node=_ref.node;variableNameUsed[node.name.value]=!0}),variableDefs.forEach(function(variableDef){var variableName=variableDef.variable.name.value;!0!==variableNameUsed[variableName]&&context.reportError(new _error.GraphQLError(unusedVariableMessage(variableName,opName),[variableDef]))})}},VariableDefinition:function(def){variableDefs.push(def)}}};var _error=require("../../error")},{"../../error":85}],151:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function fieldsConflictMessage(responseName,reason){return'Fields "'+responseName+'" conflict because '+reasonMessage(reason)+". Use different aliases on the fields to fetch both if this was intentional."}function reasonMessage(reason){return Array.isArray(reason)?reason.map(function(_ref){return'subfields "'+_ref[0]+'" conflict because '+reasonMessage(_ref[1])}).join(" and "):reason}function findConflictsWithinSelectionSet(context,cachedFieldsAndFragmentNames,comparedFragments,parentType,selectionSet){var conflicts=[],_getFieldsAndFragment=getFieldsAndFragmentNames(context,cachedFieldsAndFragmentNames,parentType,selectionSet),fieldMap=_getFieldsAndFragment[0],fragmentNames=_getFieldsAndFragment[1];collectConflictsWithin(context,conflicts,cachedFieldsAndFragmentNames,comparedFragments,fieldMap);for(var i=0;i<fragmentNames.length;i++){collectConflictsBetweenFieldsAndFragment(context,conflicts,cachedFieldsAndFragmentNames,comparedFragments,!1,fieldMap,fragmentNames[i]);for(var j=i+1;j<fragmentNames.length;j++)collectConflictsBetweenFragments(context,conflicts,cachedFieldsAndFragmentNames,comparedFragments,!1,fragmentNames[i],fragmentNames[j])}return conflicts}function collectConflictsBetweenFieldsAndFragment(context,conflicts,cachedFieldsAndFragmentNames,comparedFragments,areMutuallyExclusive,fieldMap,fragmentName){var fragment=context.getFragment(fragmentName);if(fragment){var _getReferencedFieldsA=getReferencedFieldsAndFragmentNames(context,cachedFieldsAndFragmentNames,fragment),fieldMap2=_getReferencedFieldsA[0],fragmentNames2=_getReferencedFieldsA[1];collectConflictsBetween(context,conflicts,cachedFieldsAndFragmentNames,comparedFragments,areMutuallyExclusive,fieldMap,fieldMap2);for(var i=0;i<fragmentNames2.length;i++)collectConflictsBetweenFieldsAndFragment(context,conflicts,cachedFieldsAndFragmentNames,comparedFragments,areMutuallyExclusive,fieldMap,fragmentNames2[i])}}function collectConflictsBetweenFragments(context,conflicts,cachedFieldsAndFragmentNames,comparedFragments,areMutuallyExclusive,fragmentName1,fragmentName2){var fragment1=context.getFragment(fragmentName1),fragment2=context.getFragment(fragmentName2);if(fragment1&&fragment2&&fragment1!==fragment2&&!comparedFragments.has(fragmentName1,fragmentName2,areMutuallyExclusive)){comparedFragments.add(fragmentName1,fragmentName2,areMutuallyExclusive);var _getReferencedFieldsA2=getReferencedFieldsAndFragmentNames(context,cachedFieldsAndFragmentNames,fragment1),fieldMap1=_getReferencedFieldsA2[0],fragmentNames1=_getReferencedFieldsA2[1],_getReferencedFieldsA3=getReferencedFieldsAndFragmentNames(context,cachedFieldsAndFragmentNames,fragment2),fieldMap2=_getReferencedFieldsA3[0],fragmentNames2=_getReferencedFieldsA3[1];collectConflictsBetween(context,conflicts,cachedFieldsAndFragmentNames,comparedFragments,areMutuallyExclusive,fieldMap1,fieldMap2);for(var j=0;j<fragmentNames2.length;j++)collectConflictsBetweenFragments(context,conflicts,cachedFieldsAndFragmentNames,comparedFragments,areMutuallyExclusive,fragmentName1,fragmentNames2[j]);for(var i=0;i<fragmentNames1.length;i++)collectConflictsBetweenFragments(context,conflicts,cachedFieldsAndFragmentNames,comparedFragments,areMutuallyExclusive,fragmentNames1[i],fragmentName2)}}function findConflictsBetweenSubSelectionSets(context,cachedFieldsAndFragmentNames,comparedFragments,areMutuallyExclusive,parentType1,selectionSet1,parentType2,selectionSet2){var conflicts=[],_getFieldsAndFragment2=getFieldsAndFragmentNames(context,cachedFieldsAndFragmentNames,parentType1,selectionSet1),fieldMap1=_getFieldsAndFragment2[0],fragmentNames1=_getFieldsAndFragment2[1],_getFieldsAndFragment3=getFieldsAndFragmentNames(context,cachedFieldsAndFragmentNames,parentType2,selectionSet2),fieldMap2=_getFieldsAndFragment3[0],fragmentNames2=_getFieldsAndFragment3[1];collectConflictsBetween(context,conflicts,cachedFieldsAndFragmentNames,comparedFragments,areMutuallyExclusive,fieldMap1,fieldMap2);for(var j=0;j<fragmentNames2.length;j++)collectConflictsBetweenFieldsAndFragment(context,conflicts,cachedFieldsAndFragmentNames,comparedFragments,areMutuallyExclusive,fieldMap1,fragmentNames2[j]);for(var i=0;i<fragmentNames1.length;i++)collectConflictsBetweenFieldsAndFragment(context,conflicts,cachedFieldsAndFragmentNames,comparedFragments,areMutuallyExclusive,fieldMap2,fragmentNames1[i]);for(var _i=0;_i<fragmentNames1.length;_i++)for(var _j=0;_j<fragmentNames2.length;_j++)collectConflictsBetweenFragments(context,conflicts,cachedFieldsAndFragmentNames,comparedFragments,areMutuallyExclusive,fragmentNames1[_i],fragmentNames2[_j]);return conflicts}function collectConflictsWithin(context,conflicts,cachedFieldsAndFragmentNames,comparedFragments,fieldMap){Object.keys(fieldMap).forEach(function(responseName){var fields=fieldMap[responseName];if(fields.length>1)for(var i=0;i<fields.length;i++)for(var j=i+1;j<fields.length;j++){var conflict=findConflict(context,cachedFieldsAndFragmentNames,comparedFragments,!1,responseName,fields[i],fields[j]);conflict&&conflicts.push(conflict)}})}function collectConflictsBetween(context,conflicts,cachedFieldsAndFragmentNames,comparedFragments,parentFieldsAreMutuallyExclusive,fieldMap1,fieldMap2){Object.keys(fieldMap1).forEach(function(responseName){var fields2=fieldMap2[responseName];if(fields2)for(var fields1=fieldMap1[responseName],i=0;i<fields1.length;i++)for(var j=0;j<fields2.length;j++){var conflict=findConflict(context,cachedFieldsAndFragmentNames,comparedFragments,parentFieldsAreMutuallyExclusive,responseName,fields1[i],fields2[j]);conflict&&conflicts.push(conflict)}})}function findConflict(context,cachedFieldsAndFragmentNames,comparedFragments,parentFieldsAreMutuallyExclusive,responseName,field1,field2){var parentType1=field1[0],node1=field1[1],def1=field1[2],parentType2=field2[0],node2=field2[1],def2=field2[2],areMutuallyExclusive=parentFieldsAreMutuallyExclusive||parentType1!==parentType2&&parentType1 instanceof _definition.GraphQLObjectType&&parentType2 instanceof _definition.GraphQLObjectType,type1=def1&&def1.type,type2=def2&&def2.type;if(!areMutuallyExclusive){var name1=node1.name.value,name2=node2.name.value;if(name1!==name2)return[[responseName,name1+" and "+name2+" are different fields"],[node1],[node2]];if(!sameArguments(node1.arguments||[],node2.arguments||[]))return[[responseName,"they have differing arguments"],[node1],[node2]]}if(type1&&type2&&doTypesConflict(type1,type2))return[[responseName,"they return conflicting types "+String(type1)+" and "+String(type2)],[node1],[node2]];var selectionSet1=node1.selectionSet,selectionSet2=node2.selectionSet;return selectionSet1&&selectionSet2?subfieldConflicts(findConflictsBetweenSubSelectionSets(context,cachedFieldsAndFragmentNames,comparedFragments,areMutuallyExclusive,(0,_definition.getNamedType)(type1),selectionSet1,(0,_definition.getNamedType)(type2),selectionSet2),responseName,node1,node2):void 0}function sameArguments(arguments1,arguments2){return arguments1.length===arguments2.length&&arguments1.every(function(argument1){var argument2=(0,_find2.default)(arguments2,function(argument){return argument.name.value===argument1.name.value});return!!argument2&&sameValue(argument1.value,argument2.value)})}function sameValue(value1,value2){return!value1&&!value2||(0,_printer.print)(value1)===(0,_printer.print)(value2)}function doTypesConflict(type1,type2){return type1 instanceof _definition.GraphQLList?!(type2 instanceof _definition.GraphQLList)||doTypesConflict(type1.ofType,type2.ofType):type2 instanceof _definition.GraphQLList?!(type1 instanceof _definition.GraphQLList)||doTypesConflict(type1.ofType,type2.ofType):type1 instanceof _definition.GraphQLNonNull?!(type2 instanceof _definition.GraphQLNonNull)||doTypesConflict(type1.ofType,type2.ofType):type2 instanceof _definition.GraphQLNonNull?!(type1 instanceof _definition.GraphQLNonNull)||doTypesConflict(type1.ofType,type2.ofType):!(!(0,_definition.isLeafType)(type1)&&!(0,_definition.isLeafType)(type2))&&type1!==type2}function getFieldsAndFragmentNames(context,cachedFieldsAndFragmentNames,parentType,selectionSet){var cached=cachedFieldsAndFragmentNames.get(selectionSet);if(!cached){var nodeAndDefs=Object.create(null),fragmentNames=Object.create(null);_collectFieldsAndFragmentNames(context,parentType,selectionSet,nodeAndDefs,fragmentNames),cached=[nodeAndDefs,Object.keys(fragmentNames)],cachedFieldsAndFragmentNames.set(selectionSet,cached)}return cached}function getReferencedFieldsAndFragmentNames(context,cachedFieldsAndFragmentNames,fragment){var cached=cachedFieldsAndFragmentNames.get(fragment.selectionSet);return cached||getFieldsAndFragmentNames(context,cachedFieldsAndFragmentNames,(0,_typeFromAST.typeFromAST)(context.getSchema(),fragment.typeCondition),fragment.selectionSet)}function _collectFieldsAndFragmentNames(context,parentType,selectionSet,nodeAndDefs,fragmentNames){for(var i=0;i<selectionSet.selections.length;i++){var selection=selectionSet.selections[i];switch(selection.kind){case Kind.FIELD:var fieldName=selection.name.value,fieldDef=void 0;(parentType instanceof _definition.GraphQLObjectType||parentType instanceof _definition.GraphQLInterfaceType)&&(fieldDef=parentType.getFields()[fieldName]);var responseName=selection.alias?selection.alias.value:fieldName;nodeAndDefs[responseName]||(nodeAndDefs[responseName]=[]),nodeAndDefs[responseName].push([parentType,selection,fieldDef]);break;case Kind.FRAGMENT_SPREAD:fragmentNames[selection.name.value]=!0;break;case Kind.INLINE_FRAGMENT:var typeCondition=selection.typeCondition;_collectFieldsAndFragmentNames(context,typeCondition?(0,_typeFromAST.typeFromAST)(context.getSchema(),typeCondition):parentType,selection.selectionSet,nodeAndDefs,fragmentNames)}}}function subfieldConflicts(conflicts,responseName,node1,node2){if(conflicts.length>0)return[[responseName,conflicts.map(function(_ref3){return _ref3[0]})],conflicts.reduce(function(allFields,_ref4){var fields1=_ref4[1];return allFields.concat(fields1)},[node1]),conflicts.reduce(function(allFields,_ref5){var fields2=_ref5[2];return allFields.concat(fields2)},[node2])]}function _pairSetAdd(data,a,b,areMutuallyExclusive){var map=data[a];map||(map=Object.create(null),data[a]=map),map[b]=areMutuallyExclusive}Object.defineProperty(exports,"__esModule",{value:!0}),exports.fieldsConflictMessage=fieldsConflictMessage,exports.OverlappingFieldsCanBeMerged=function(context){var comparedFragments=new PairSet,cachedFieldsAndFragmentNames=new Map;return{SelectionSet:function(selectionSet){findConflictsWithinSelectionSet(context,cachedFieldsAndFragmentNames,comparedFragments,context.getParentType(),selectionSet).forEach(function(_ref2){var _ref2$=_ref2[0],responseName=_ref2$[0],reason=_ref2$[1],fields1=_ref2[1],fields2=_ref2[2];return context.reportError(new _error.GraphQLError(fieldsConflictMessage(responseName,reason),fields1.concat(fields2)))})}}};var _error=require("../../error"),_find2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(require("../../jsutils/find")),Kind=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(require("../../language/kinds")),_printer=require("../../language/printer"),_definition=require("../../type/definition"),_typeFromAST=require("../../utilities/typeFromAST"),PairSet=function(){function PairSet(){_classCallCheck(this,PairSet),this._data=Object.create(null)}return PairSet.prototype.has=function(a,b,areMutuallyExclusive){var first=this._data[a],result=first&&first[b];return void 0!==result&&(!1!==areMutuallyExclusive||!1===result)},PairSet.prototype.add=function(a,b,areMutuallyExclusive){_pairSetAdd(this._data,a,b,areMutuallyExclusive),_pairSetAdd(this._data,b,a,areMutuallyExclusive)},PairSet}()},{"../../error":85,"../../jsutils/find":93,"../../language/kinds":102,"../../language/printer":106,"../../type/definition":112,"../../utilities/typeFromAST":135}],152:[function(require,module,exports){"use strict";function typeIncompatibleSpreadMessage(fragName,parentType,fragType){return'Fragment "'+fragName+'" cannot be spread here as objects of type "'+String(parentType)+'" can never be of type "'+String(fragType)+'".'}function typeIncompatibleAnonSpreadMessage(parentType,fragType){return'Fragment cannot be spread here as objects of type "'+String(parentType)+'" can never be of type "'+String(fragType)+'".'}function getFragmentType(context,name){var frag=context.getFragment(name);return frag&&(0,_typeFromAST.typeFromAST)(context.getSchema(),frag.typeCondition)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.typeIncompatibleSpreadMessage=typeIncompatibleSpreadMessage,exports.typeIncompatibleAnonSpreadMessage=typeIncompatibleAnonSpreadMessage,exports.PossibleFragmentSpreads=function(context){return{InlineFragment:function(node){var fragType=context.getType(),parentType=context.getParentType();fragType&&parentType&&!(0,_typeComparators.doTypesOverlap)(context.getSchema(),fragType,parentType)&&context.reportError(new _error.GraphQLError(typeIncompatibleAnonSpreadMessage(parentType,fragType),[node]))},FragmentSpread:function(node){var fragName=node.name.value,fragType=getFragmentType(context,fragName),parentType=context.getParentType();fragType&&parentType&&!(0,_typeComparators.doTypesOverlap)(context.getSchema(),fragType,parentType)&&context.reportError(new _error.GraphQLError(typeIncompatibleSpreadMessage(fragName,parentType,fragType),[node]))}}};var _error=require("../../error"),_typeComparators=require("../../utilities/typeComparators"),_typeFromAST=require("../../utilities/typeFromAST")},{"../../error":85,"../../utilities/typeComparators":134,"../../utilities/typeFromAST":135}],153:[function(require,module,exports){"use strict";function missingFieldArgMessage(fieldName,argName,type){return'Field "'+fieldName+'" argument "'+argName+'" of type "'+String(type)+'" is required but not provided.'}function missingDirectiveArgMessage(directiveName,argName,type){return'Directive "@'+directiveName+'" argument "'+argName+'" of type "'+String(type)+'" is required but not provided.'}Object.defineProperty(exports,"__esModule",{value:!0}),exports.missingFieldArgMessage=missingFieldArgMessage,exports.missingDirectiveArgMessage=missingDirectiveArgMessage,exports.ProvidedNonNullArguments=function(context){return{Field:{leave:function(node){var fieldDef=context.getFieldDef();if(!fieldDef)return!1;var argNodes=node.arguments||[],argNodeMap=(0,_keyMap2.default)(argNodes,function(arg){return arg.name.value});fieldDef.args.forEach(function(argDef){!argNodeMap[argDef.name]&&argDef.type instanceof _definition.GraphQLNonNull&&context.reportError(new _error.GraphQLError(missingFieldArgMessage(node.name.value,argDef.name,argDef.type),[node]))})}},Directive:{leave:function(node){var directiveDef=context.getDirective();if(!directiveDef)return!1;var argNodes=node.arguments||[],argNodeMap=(0,_keyMap2.default)(argNodes,function(arg){return arg.name.value});directiveDef.args.forEach(function(argDef){!argNodeMap[argDef.name]&&argDef.type instanceof _definition.GraphQLNonNull&&context.reportError(new _error.GraphQLError(missingDirectiveArgMessage(node.name.value,argDef.name,argDef.type),[node]))})}}}};var _error=require("../../error"),_keyMap2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(require("../../jsutils/keyMap")),_definition=require("../../type/definition")},{"../../error":85,"../../jsutils/keyMap":97,"../../type/definition":112}],154:[function(require,module,exports){"use strict";function noSubselectionAllowedMessage(fieldName,type){return'Field "'+fieldName+'" must not have a selection since type "'+String(type)+'" has no subfields.'}function requiredSubselectionMessage(fieldName,type){return'Field "'+fieldName+'" of type "'+String(type)+'" must have a selection of subfields. Did you mean "'+fieldName+' { ... }"?'}Object.defineProperty(exports,"__esModule",{value:!0}),exports.noSubselectionAllowedMessage=noSubselectionAllowedMessage,exports.requiredSubselectionMessage=requiredSubselectionMessage,exports.ScalarLeafs=function(context){return{Field:function(node){var type=context.getType();type&&((0,_definition.isLeafType)((0,_definition.getNamedType)(type))?node.selectionSet&&context.reportError(new _error.GraphQLError(noSubselectionAllowedMessage(node.name.value,type),[node.selectionSet])):node.selectionSet||context.reportError(new _error.GraphQLError(requiredSubselectionMessage(node.name.value,type),[node])))}}};var _error=require("../../error"),_definition=require("../../type/definition")},{"../../error":85,"../../type/definition":112}],155:[function(require,module,exports){"use strict";function singleFieldOnlyMessage(name){return(name?'Subscription "'+name+'" ':"Anonymous Subscription ")+"must select only one top level field."}Object.defineProperty(exports,"__esModule",{value:!0}),exports.singleFieldOnlyMessage=singleFieldOnlyMessage,exports.SingleFieldSubscriptions=function(context){return{OperationDefinition:function(node){"subscription"===node.operation&&1!==node.selectionSet.selections.length&&context.reportError(new _error.GraphQLError(singleFieldOnlyMessage(node.name&&node.name.value),node.selectionSet.selections.slice(1)))}}};var _error=require("../../error")},{"../../error":85}],156:[function(require,module,exports){"use strict";function duplicateArgMessage(argName){return'There can be only one argument named "'+argName+'".'}Object.defineProperty(exports,"__esModule",{value:!0}),exports.duplicateArgMessage=duplicateArgMessage,exports.UniqueArgumentNames=function(context){var knownArgNames=Object.create(null);return{Field:function(){knownArgNames=Object.create(null)},Directive:function(){knownArgNames=Object.create(null)},Argument:function(node){var argName=node.name.value;return knownArgNames[argName]?context.reportError(new _error.GraphQLError(duplicateArgMessage(argName),[knownArgNames[argName],node.name])):knownArgNames[argName]=node.name,!1}}};var _error=require("../../error")},{"../../error":85}],157:[function(require,module,exports){"use strict";function duplicateDirectiveMessage(directiveName){return'The directive "'+directiveName+'" can only be used once at this location.'}Object.defineProperty(exports,"__esModule",{value:!0}),exports.duplicateDirectiveMessage=duplicateDirectiveMessage,exports.UniqueDirectivesPerLocation=function(context){return{enter:function(node){if(node.directives){var knownDirectives=Object.create(null);node.directives.forEach(function(directive){var directiveName=directive.name.value;knownDirectives[directiveName]?context.reportError(new _error.GraphQLError(duplicateDirectiveMessage(directiveName),[knownDirectives[directiveName],directive])):knownDirectives[directiveName]=directive})}}}};var _error=require("../../error")},{"../../error":85}],158:[function(require,module,exports){"use strict";function duplicateFragmentNameMessage(fragName){return'There can be only one fragment named "'+fragName+'".'}Object.defineProperty(exports,"__esModule",{value:!0}),exports.duplicateFragmentNameMessage=duplicateFragmentNameMessage,exports.UniqueFragmentNames=function(context){var knownFragmentNames=Object.create(null);return{OperationDefinition:function(){return!1},FragmentDefinition:function(node){var fragmentName=node.name.value;return knownFragmentNames[fragmentName]?context.reportError(new _error.GraphQLError(duplicateFragmentNameMessage(fragmentName),[knownFragmentNames[fragmentName],node.name])):knownFragmentNames[fragmentName]=node.name,!1}}};var _error=require("../../error")},{"../../error":85}],159:[function(require,module,exports){"use strict";function duplicateInputFieldMessage(fieldName){return'There can be only one input field named "'+fieldName+'".'}Object.defineProperty(exports,"__esModule",{value:!0}),exports.duplicateInputFieldMessage=duplicateInputFieldMessage,exports.UniqueInputFieldNames=function(context){var knownNameStack=[],knownNames=Object.create(null);return{ObjectValue:{enter:function(){knownNameStack.push(knownNames),knownNames=Object.create(null)},leave:function(){knownNames=knownNameStack.pop()}},ObjectField:function(node){var fieldName=node.name.value;return knownNames[fieldName]?context.reportError(new _error.GraphQLError(duplicateInputFieldMessage(fieldName),[knownNames[fieldName],node.name])):knownNames[fieldName]=node.name,!1}}};var _error=require("../../error")},{"../../error":85}],160:[function(require,module,exports){"use strict";function duplicateOperationNameMessage(operationName){return'There can be only one operation named "'+operationName+'".'}Object.defineProperty(exports,"__esModule",{value:!0}),exports.duplicateOperationNameMessage=duplicateOperationNameMessage,exports.UniqueOperationNames=function(context){var knownOperationNames=Object.create(null);return{OperationDefinition:function(node){var operationName=node.name;return operationName&&(knownOperationNames[operationName.value]?context.reportError(new _error.GraphQLError(duplicateOperationNameMessage(operationName.value),[knownOperationNames[operationName.value],operationName])):knownOperationNames[operationName.value]=operationName),!1},FragmentDefinition:function(){return!1}}};var _error=require("../../error")},{"../../error":85}],161:[function(require,module,exports){"use strict";function duplicateVariableMessage(variableName){return'There can be only one variable named "'+variableName+'".'}Object.defineProperty(exports,"__esModule",{value:!0}),exports.duplicateVariableMessage=duplicateVariableMessage,exports.UniqueVariableNames=function(context){var knownVariableNames=Object.create(null);return{OperationDefinition:function(){knownVariableNames=Object.create(null)},VariableDefinition:function(node){var variableName=node.variable.name.value;knownVariableNames[variableName]?context.reportError(new _error.GraphQLError(duplicateVariableMessage(variableName),[knownVariableNames[variableName],node.variable.name])):knownVariableNames[variableName]=node.variable.name}}};var _error=require("../../error")},{"../../error":85}],162:[function(require,module,exports){"use strict";function nonInputTypeOnVarMessage(variableName,typeName){return'Variable "$'+variableName+'" cannot be non-input type "'+typeName+'".'}Object.defineProperty(exports,"__esModule",{value:!0}),exports.nonInputTypeOnVarMessage=nonInputTypeOnVarMessage,exports.VariablesAreInputTypes=function(context){return{VariableDefinition:function(node){var type=(0,_typeFromAST.typeFromAST)(context.getSchema(),node.type);if(type&&!(0,_definition.isInputType)(type)){var variableName=node.variable.name.value;context.reportError(new _error.GraphQLError(nonInputTypeOnVarMessage(variableName,(0,_printer.print)(node.type)),[node.type]))}}}};var _error=require("../../error"),_printer=require("../../language/printer"),_definition=require("../../type/definition"),_typeFromAST=require("../../utilities/typeFromAST")},{"../../error":85,"../../language/printer":106,"../../type/definition":112,"../../utilities/typeFromAST":135}],163:[function(require,module,exports){"use strict";function badVarPosMessage(varName,varType,expectedType){return'Variable "$'+varName+'" of type "'+String(varType)+'" used in position expecting type "'+String(expectedType)+'".'}function effectiveType(varType,varDef){return!varDef.defaultValue||varType instanceof _definition.GraphQLNonNull?varType:new _definition.GraphQLNonNull(varType)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.badVarPosMessage=badVarPosMessage,exports.VariablesInAllowedPosition=function(context){var varDefMap=Object.create(null);return{OperationDefinition:{enter:function(){varDefMap=Object.create(null)},leave:function(operation){context.getRecursiveVariableUsages(operation).forEach(function(_ref){var node=_ref.node,type=_ref.type,varName=node.name.value,varDef=varDefMap[varName];if(varDef&&type){var schema=context.getSchema(),varType=(0,_typeFromAST.typeFromAST)(schema,varDef.type);varType&&!(0,_typeComparators.isTypeSubTypeOf)(schema,effectiveType(varType,varDef),type)&&context.reportError(new _error.GraphQLError(badVarPosMessage(varName,varType,type),[varDef,node]))}})}},VariableDefinition:function(node){varDefMap[node.variable.name.value]=node}}};var _error=require("../../error"),_definition=require("../../type/definition"),_typeComparators=require("../../utilities/typeComparators"),_typeFromAST=require("../../utilities/typeFromAST")},{"../../error":85,"../../type/definition":112,"../../utilities/typeComparators":134,"../../utilities/typeFromAST":135}],164:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.specifiedRules=void 0;var _UniqueOperationNames=require("./rules/UniqueOperationNames"),_LoneAnonymousOperation=require("./rules/LoneAnonymousOperation"),_SingleFieldSubscriptions=require("./rules/SingleFieldSubscriptions"),_KnownTypeNames=require("./rules/KnownTypeNames"),_FragmentsOnCompositeTypes=require("./rules/FragmentsOnCompositeTypes"),_VariablesAreInputTypes=require("./rules/VariablesAreInputTypes"),_ScalarLeafs=require("./rules/ScalarLeafs"),_FieldsOnCorrectType=require("./rules/FieldsOnCorrectType"),_UniqueFragmentNames=require("./rules/UniqueFragmentNames"),_KnownFragmentNames=require("./rules/KnownFragmentNames"),_NoUnusedFragments=require("./rules/NoUnusedFragments"),_PossibleFragmentSpreads=require("./rules/PossibleFragmentSpreads"),_NoFragmentCycles=require("./rules/NoFragmentCycles"),_UniqueVariableNames=require("./rules/UniqueVariableNames"),_NoUndefinedVariables=require("./rules/NoUndefinedVariables"),_NoUnusedVariables=require("./rules/NoUnusedVariables"),_KnownDirectives=require("./rules/KnownDirectives"),_UniqueDirectivesPerLocation=require("./rules/UniqueDirectivesPerLocation"),_KnownArgumentNames=require("./rules/KnownArgumentNames"),_UniqueArgumentNames=require("./rules/UniqueArgumentNames"),_ArgumentsOfCorrectType=require("./rules/ArgumentsOfCorrectType"),_ProvidedNonNullArguments=require("./rules/ProvidedNonNullArguments"),_DefaultValuesOfCorrectType=require("./rules/DefaultValuesOfCorrectType"),_VariablesInAllowedPosition=require("./rules/VariablesInAllowedPosition"),_OverlappingFieldsCanBeMerged=require("./rules/OverlappingFieldsCanBeMerged"),_UniqueInputFieldNames=require("./rules/UniqueInputFieldNames");exports.specifiedRules=[_UniqueOperationNames.UniqueOperationNames,_LoneAnonymousOperation.LoneAnonymousOperation,_SingleFieldSubscriptions.SingleFieldSubscriptions,_KnownTypeNames.KnownTypeNames,_FragmentsOnCompositeTypes.FragmentsOnCompositeTypes,_VariablesAreInputTypes.VariablesAreInputTypes,_ScalarLeafs.ScalarLeafs,_FieldsOnCorrectType.FieldsOnCorrectType,_UniqueFragmentNames.UniqueFragmentNames,_KnownFragmentNames.KnownFragmentNames,_NoUnusedFragments.NoUnusedFragments,_PossibleFragmentSpreads.PossibleFragmentSpreads,_NoFragmentCycles.NoFragmentCycles,_UniqueVariableNames.UniqueVariableNames,_NoUndefinedVariables.NoUndefinedVariables,_NoUnusedVariables.NoUnusedVariables,_KnownDirectives.KnownDirectives,_UniqueDirectivesPerLocation.UniqueDirectivesPerLocation,_KnownArgumentNames.KnownArgumentNames,_UniqueArgumentNames.UniqueArgumentNames,_ArgumentsOfCorrectType.ArgumentsOfCorrectType,_ProvidedNonNullArguments.ProvidedNonNullArguments,_DefaultValuesOfCorrectType.DefaultValuesOfCorrectType,_VariablesInAllowedPosition.VariablesInAllowedPosition,_OverlappingFieldsCanBeMerged.OverlappingFieldsCanBeMerged,_UniqueInputFieldNames.UniqueInputFieldNames]},{"./rules/ArgumentsOfCorrectType":138,"./rules/DefaultValuesOfCorrectType":139,"./rules/FieldsOnCorrectType":140,"./rules/FragmentsOnCompositeTypes":141,"./rules/KnownArgumentNames":142,"./rules/KnownDirectives":143,"./rules/KnownFragmentNames":144,"./rules/KnownTypeNames":145,"./rules/LoneAnonymousOperation":146,"./rules/NoFragmentCycles":147,"./rules/NoUndefinedVariables":148,"./rules/NoUnusedFragments":149,"./rules/NoUnusedVariables":150,"./rules/OverlappingFieldsCanBeMerged":151,"./rules/PossibleFragmentSpreads":152,"./rules/ProvidedNonNullArguments":153,"./rules/ScalarLeafs":154,"./rules/SingleFieldSubscriptions":155,"./rules/UniqueArgumentNames":156,"./rules/UniqueDirectivesPerLocation":157,"./rules/UniqueFragmentNames":158,"./rules/UniqueInputFieldNames":159,"./rules/UniqueOperationNames":160,"./rules/UniqueVariableNames":161,"./rules/VariablesAreInputTypes":162,"./rules/VariablesInAllowedPosition":163}],165:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function visitUsingRules(schema,typeInfo,documentAST,rules){var context=new ValidationContext(schema,documentAST,typeInfo),visitors=rules.map(function(rule){return rule(context)});return(0,_visitor.visit)(documentAST,(0,_visitor.visitWithTypeInfo)(typeInfo,(0,_visitor.visitInParallel)(visitors))),context.getErrors()}Object.defineProperty(exports,"__esModule",{value:!0}),exports.ValidationContext=void 0,exports.validate=function(schema,ast,rules,typeInfo){return(0,_invariant2.default)(schema,"Must provide schema"),(0,_invariant2.default)(ast,"Must provide document"),(0,_invariant2.default)(schema instanceof _schema.GraphQLSchema,"Schema must be an instance of GraphQLSchema. Also ensure that there are not multiple versions of GraphQL installed in your node_modules directory."),visitUsingRules(schema,typeInfo||new _TypeInfo.TypeInfo(schema),ast,rules||_specifiedRules.specifiedRules)};var _invariant2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(require("../jsutils/invariant")),_visitor=(require("../error"),require("../language/visitor")),Kind=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(require("../language/kinds")),_schema=require("../type/schema"),_TypeInfo=require("../utilities/TypeInfo"),_specifiedRules=require("./specifiedRules"),ValidationContext=exports.ValidationContext=function(){function ValidationContext(schema,ast,typeInfo){_classCallCheck(this,ValidationContext),this._schema=schema,this._ast=ast,this._typeInfo=typeInfo,this._errors=[],this._fragmentSpreads=new Map,this._recursivelyReferencedFragments=new Map,this._variableUsages=new Map,this._recursiveVariableUsages=new Map}return ValidationContext.prototype.reportError=function(error){this._errors.push(error)},ValidationContext.prototype.getErrors=function(){return this._errors},ValidationContext.prototype.getSchema=function(){return this._schema},ValidationContext.prototype.getDocument=function(){return this._ast},ValidationContext.prototype.getFragment=function(name){var fragments=this._fragments;return fragments||(this._fragments=fragments=this.getDocument().definitions.reduce(function(frags,statement){return statement.kind===Kind.FRAGMENT_DEFINITION&&(frags[statement.name.value]=statement),frags},Object.create(null))),fragments[name]},ValidationContext.prototype.getFragmentSpreads=function(node){var spreads=this._fragmentSpreads.get(node);if(!spreads){spreads=[];for(var setsToVisit=[node];0!==setsToVisit.length;)for(var set=setsToVisit.pop(),i=0;i<set.selections.length;i++){var selection=set.selections[i];selection.kind===Kind.FRAGMENT_SPREAD?spreads.push(selection):selection.selectionSet&&setsToVisit.push(selection.selectionSet)}this._fragmentSpreads.set(node,spreads)}return spreads},ValidationContext.prototype.getRecursivelyReferencedFragments=function(operation){var fragments=this._recursivelyReferencedFragments.get(operation);if(!fragments){fragments=[];for(var collectedNames=Object.create(null),nodesToVisit=[operation.selectionSet];0!==nodesToVisit.length;)for(var _node=nodesToVisit.pop(),spreads=this.getFragmentSpreads(_node),i=0;i<spreads.length;i++){var fragName=spreads[i].name.value;if(!0!==collectedNames[fragName]){collectedNames[fragName]=!0;var fragment=this.getFragment(fragName);fragment&&(fragments.push(fragment),nodesToVisit.push(fragment.selectionSet))}}this._recursivelyReferencedFragments.set(operation,fragments)}return fragments},ValidationContext.prototype.getVariableUsages=function(node){var usages=this._variableUsages.get(node);if(!usages){var newUsages=[],typeInfo=new _TypeInfo.TypeInfo(this._schema);(0,_visitor.visit)(node,(0,_visitor.visitWithTypeInfo)(typeInfo,{VariableDefinition:function(){return!1},Variable:function(variable){newUsages.push({node:variable,type:typeInfo.getInputType()})}})),usages=newUsages,this._variableUsages.set(node,usages)}return usages},ValidationContext.prototype.getRecursiveVariableUsages=function(operation){var usages=this._recursiveVariableUsages.get(operation);if(!usages){usages=this.getVariableUsages(operation);for(var fragments=this.getRecursivelyReferencedFragments(operation),i=0;i<fragments.length;i++)Array.prototype.push.apply(usages,this.getVariableUsages(fragments[i]));this._recursiveVariableUsages.set(operation,usages)}return usages},ValidationContext.prototype.getType=function(){return this._typeInfo.getType()},ValidationContext.prototype.getParentType=function(){return this._typeInfo.getParentType()},ValidationContext.prototype.getInputType=function(){return this._typeInfo.getInputType()},ValidationContext.prototype.getFieldDef=function(){return this._typeInfo.getFieldDef()},ValidationContext.prototype.getDirective=function(){return this._typeInfo.getDirective()},ValidationContext.prototype.getArgument=function(){return this._typeInfo.getArgument()},ValidationContext}()},{"../error":85,"../jsutils/invariant":94,"../language/kinds":102,"../language/visitor":108,"../type/schema":117,"../utilities/TypeInfo":118,"./specifiedRules":164}],166:[function(require,module,exports){function isIterable(obj){return!!getIteratorMethod(obj)}function isArrayLike(obj){var length=null!=obj&&obj.length;return"number"==typeof length&&length>=0&&length%1==0}function getIterator(iterable){var method=getIteratorMethod(iterable);if(method)return method.call(iterable)}function getIteratorMethod(iterable){if(null!=iterable){var method=SYMBOL_ITERATOR&&iterable[SYMBOL_ITERATOR]||iterable["@@iterator"];if("function"==typeof method)return method}}function createIterator(collection){if(null!=collection){var iterator=getIterator(collection);if(iterator)return iterator;if(isArrayLike(collection))return new ArrayLikeIterator(collection)}}function ArrayLikeIterator(obj){this._o=obj,this._i=0}function getAsyncIterator(asyncIterable){var method=getAsyncIteratorMethod(asyncIterable);if(method)return method.call(asyncIterable)}function getAsyncIteratorMethod(asyncIterable){if(null!=asyncIterable){var method=SYMBOL_ASYNC_ITERATOR&&asyncIterable[SYMBOL_ASYNC_ITERATOR]||asyncIterable["@@asyncIterator"];if("function"==typeof method)return method}}function createAsyncIterator(source){if(null!=source){var asyncIterator=getAsyncIterator(source);if(asyncIterator)return asyncIterator;var iterator=createIterator(source);if(iterator)return new AsyncFromSyncIterator(iterator)}}function AsyncFromSyncIterator(iterator){this._i=iterator}var SYMBOL_ITERATOR="function"==typeof Symbol&&Symbol.iterator,$$iterator=SYMBOL_ITERATOR||"@@iterator";exports.$$iterator=$$iterator,exports.isIterable=isIterable,exports.isArrayLike=isArrayLike,exports.isCollection=function(obj){return Object(obj)===obj&&(isArrayLike(obj)||isIterable(obj))},exports.getIterator=getIterator,exports.getIteratorMethod=getIteratorMethod,exports.createIterator=createIterator,ArrayLikeIterator.prototype[$$iterator]=function(){return this},ArrayLikeIterator.prototype.next=function(){return void 0===this._o||this._i>=this._o.length?(this._o=void 0,{value:void 0,done:!0}):{value:this._o[this._i++],done:!1}},exports.forEach=function(collection,callback,thisArg){if(null!=collection){if("function"==typeof collection.forEach)return collection.forEach(callback,thisArg);var i=0,iterator=getIterator(collection);if(iterator){for(var step;!(step=iterator.next()).done;)if(callback.call(thisArg,step.value,i++,collection),i>9999999)throw new TypeError("Near-infinite iteration.")}else if(isArrayLike(collection))for(;i<collection.length;i++)collection.hasOwnProperty(i)&&callback.call(thisArg,collection[i],i,collection)}};var SYMBOL_ASYNC_ITERATOR="function"==typeof Symbol&&Symbol.asyncIterator,$$asyncIterator=SYMBOL_ASYNC_ITERATOR||"@@asyncIterator";exports.$$asyncIterator=$$asyncIterator,exports.isAsyncIterable=function(obj){return!!getAsyncIteratorMethod(obj)},exports.getAsyncIterator=getAsyncIterator,exports.getAsyncIteratorMethod=getAsyncIteratorMethod,exports.createAsyncIterator=createAsyncIterator,AsyncFromSyncIterator.prototype[$$asyncIterator]=function(){return this},AsyncFromSyncIterator.prototype.next=function(){var step=this._i.next();return Promise.resolve(step.value).then(function(value){return{value:value,done:step.done}})},exports.forAwaitEach=function(source,callback,thisArg){function next(){return asyncIterator.next().then(function(step){if(!step.done)return Promise.resolve(callback.call(thisArg,step.value,i++,source)).then(next)})}var asyncIterator=createAsyncIterator(source);if(asyncIterator){var i=0;return next()}}},{}],167:[function(require,module,exports){(function(global){(function(){function Lexer(options){this.tokens=[],this.tokens.links={},this.options=options||marked.defaults,this.rules=block.normal,this.options.gfm&&(this.options.tables?this.rules=block.tables:this.rules=block.gfm)}function InlineLexer(links,options){if(this.options=options||marked.defaults,this.links=links,this.rules=inline.normal,this.renderer=this.options.renderer||new Renderer,this.renderer.options=this.options,!this.links)throw new Error("Tokens array requires a `links` property.");this.options.gfm?this.options.breaks?this.rules=inline.breaks:this.rules=inline.gfm:this.options.pedantic&&(this.rules=inline.pedantic)}function Renderer(options){this.options=options||{}}function Parser(options){this.tokens=[],this.token=null,this.options=options||marked.defaults,this.options.renderer=this.options.renderer||new Renderer,this.renderer=this.options.renderer,this.renderer.options=this.options}function escape(html,encode){return html.replace(encode?/&/g:/&(?!#?\w+;)/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function unescape(html){return html.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/g,function(_,n){return"colon"===(n=n.toLowerCase())?":":"#"===n.charAt(0)?"x"===n.charAt(1)?String.fromCharCode(parseInt(n.substring(2),16)):String.fromCharCode(+n.substring(1)):""})}function replace(regex,opt){return regex=regex.source,opt=opt||"",function self(name,val){return name?(val=val.source||val,val=val.replace(/(^|[^\[])\^/g,"$1"),regex=regex.replace(name,val),self):new RegExp(regex,opt)}}function noop(){}function merge(obj){for(var target,key,i=1;i<arguments.length;i++){target=arguments[i];for(key in target)Object.prototype.hasOwnProperty.call(target,key)&&(obj[key]=target[key])}return obj}function marked(src,opt,callback){if(callback||"function"==typeof opt){callback||(callback=opt,opt=null);var tokens,pending,highlight=(opt=merge({},marked.defaults,opt||{})).highlight,i=0;try{tokens=Lexer.lex(src,opt)}catch(e){return callback(e)}pending=tokens.length;var done=function(err){if(err)return opt.highlight=highlight,callback(err);var out;try{out=Parser.parse(tokens,opt)}catch(e){err=e}return opt.highlight=highlight,err?callback(err):callback(null,out)};if(!highlight||highlight.length<3)return done();if(delete opt.highlight,!pending)return done();for(;i<tokens.length;i++)!function(token){"code"!==token.type?--pending||done():highlight(token.text,token.lang,function(err,code){return err?done(err):null==code||code===token.text?--pending||done():(token.text=code,token.escaped=!0,void(--pending||done()))})}(tokens[i])}else try{return opt&&(opt=merge({},marked.defaults,opt)),Parser.parse(Lexer.lex(src,opt),opt)}catch(e){if(e.message+="\nPlease report this to https://github.com/chjj/marked.",(opt||marked.defaults).silent)return"<p>An error occured:</p><pre>"+escape(e.message+"",!0)+"</pre>";throw e}}var block={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:noop,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:noop,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:noop,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};block.bullet=/(?:[*+-]|\d+\.)/,block.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/,block.item=replace(block.item,"gm")(/bull/g,block.bullet)(),block.list=replace(block.list)(/bull/g,block.bullet)("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))")("def","\\n+(?="+block.def.source+")")(),block.blockquote=replace(block.blockquote)("def",block.def)(),block._tag="(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b",block.html=replace(block.html)("comment",/<!--[\s\S]*?-->/)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/<tag(?:"[^"]*"|'[^']*'|[^'">])*?>/)(/tag/g,block._tag)(),block.paragraph=replace(block.paragraph)("hr",block.hr)("heading",block.heading)("lheading",block.lheading)("blockquote",block.blockquote)("tag","<"+block._tag)("def",block.def)(),block.normal=merge({},block),block.gfm=merge({},block.normal,{fences:/^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\s*\1 *(?:\n+|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/}),block.gfm.paragraph=replace(block.paragraph)("(?!","(?!"+block.gfm.fences.source.replace("\\1","\\2")+"|"+block.list.source.replace("\\1","\\3")+"|")(),block.tables=merge({},block.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/}),Lexer.rules=block,Lexer.lex=function(src,options){return new Lexer(options).lex(src)},Lexer.prototype.lex=function(src){return src=src.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n"),this.token(src,!0)},Lexer.prototype.token=function(src,top,bq){for(var next,loose,cap,bull,b,item,space,i,l,src=src.replace(/^ +$/gm,"");src;)if((cap=this.rules.newline.exec(src))&&(src=src.substring(cap[0].length),cap[0].length>1&&this.tokens.push({type:"space"})),cap=this.rules.code.exec(src))src=src.substring(cap[0].length),cap=cap[0].replace(/^ {4}/gm,""),this.tokens.push({type:"code",text:this.options.pedantic?cap:cap.replace(/\n+$/,"")});else if(cap=this.rules.fences.exec(src))src=src.substring(cap[0].length),this.tokens.push({type:"code",lang:cap[2],text:cap[3]||""});else if(cap=this.rules.heading.exec(src))src=src.substring(cap[0].length),this.tokens.push({type:"heading",depth:cap[1].length,text:cap[2]});else if(top&&(cap=this.rules.nptable.exec(src))){for(src=src.substring(cap[0].length),item={type:"table",header:cap[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:cap[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:cap[3].replace(/\n$/,"").split("\n")},i=0;i<item.align.length;i++)/^ *-+: *$/.test(item.align[i])?item.align[i]="right":/^ *:-+: *$/.test(item.align[i])?item.align[i]="center":/^ *:-+ *$/.test(item.align[i])?item.align[i]="left":item.align[i]=null;for(i=0;i<item.cells.length;i++)item.cells[i]=item.cells[i].split(/ *\| */);this.tokens.push(item)}else if(cap=this.rules.lheading.exec(src))src=src.substring(cap[0].length),this.tokens.push({type:"heading",depth:"="===cap[2]?1:2,text:cap[1]});else if(cap=this.rules.hr.exec(src))src=src.substring(cap[0].length),this.tokens.push({type:"hr"});else if(cap=this.rules.blockquote.exec(src))src=src.substring(cap[0].length),this.tokens.push({type:"blockquote_start"}),cap=cap[0].replace(/^ *> ?/gm,""),this.token(cap,top,!0),this.tokens.push({type:"blockquote_end"});else if(cap=this.rules.list.exec(src)){for(src=src.substring(cap[0].length),bull=cap[2],this.tokens.push({type:"list_start",ordered:bull.length>1}),next=!1,l=(cap=cap[0].match(this.rules.item)).length,i=0;i<l;i++)space=(item=cap[i]).length,~(item=item.replace(/^ *([*+-]|\d+\.) +/,"")).indexOf("\n ")&&(space-=item.length,item=this.options.pedantic?item.replace(/^ {1,4}/gm,""):item.replace(new RegExp("^ {1,"+space+"}","gm"),"")),this.options.smartLists&&i!==l-1&&(bull===(b=block.bullet.exec(cap[i+1])[0])||bull.length>1&&b.length>1||(src=cap.slice(i+1).join("\n")+src,i=l-1)),loose=next||/\n\n(?!\s*$)/.test(item),i!==l-1&&(next="\n"===item.charAt(item.length-1),loose||(loose=next)),this.tokens.push({type:loose?"loose_item_start":"list_item_start"}),this.token(item,!1,bq),this.tokens.push({type:"list_item_end"});this.tokens.push({type:"list_end"})}else if(cap=this.rules.html.exec(src))src=src.substring(cap[0].length),this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:!this.options.sanitizer&&("pre"===cap[1]||"script"===cap[1]||"style"===cap[1]),text:cap[0]});else if(!bq&&top&&(cap=this.rules.def.exec(src)))src=src.substring(cap[0].length),this.tokens.links[cap[1].toLowerCase()]={href:cap[2],title:cap[3]};else if(top&&(cap=this.rules.table.exec(src))){for(src=src.substring(cap[0].length),item={type:"table",header:cap[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:cap[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:cap[3].replace(/(?: *\| *)?\n$/,"").split("\n")},i=0;i<item.align.length;i++)/^ *-+: *$/.test(item.align[i])?item.align[i]="right":/^ *:-+: *$/.test(item.align[i])?item.align[i]="center":/^ *:-+ *$/.test(item.align[i])?item.align[i]="left":item.align[i]=null;for(i=0;i<item.cells.length;i++)item.cells[i]=item.cells[i].replace(/^ *\| *| *\| *$/g,"").split(/ *\| */);this.tokens.push(item)}else if(top&&(cap=this.rules.paragraph.exec(src)))src=src.substring(cap[0].length),this.tokens.push({type:"paragraph",text:"\n"===cap[1].charAt(cap[1].length-1)?cap[1].slice(0,-1):cap[1]});else if(cap=this.rules.text.exec(src))src=src.substring(cap[0].length),this.tokens.push({type:"text",text:cap[0]});else if(src)throw new Error("Infinite loop on byte: "+src.charCodeAt(0));return this.tokens};var inline={escape:/^\\([\\`*{}\[\]()#+\-.!_>])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:noop,tag:/^<!--[\s\S]*?-->|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:[^_]|__)+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:noop,text:/^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/};inline._inside=/(?:\[[^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*/,inline._href=/\s*<?([\s\S]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/,inline.link=replace(inline.link)("inside",inline._inside)("href",inline._href)(),inline.reflink=replace(inline.reflink)("inside",inline._inside)(),inline.normal=merge({},inline),inline.pedantic=merge({},inline.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/}),inline.gfm=merge({},inline.normal,{escape:replace(inline.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:replace(inline.text)("]|","~]|")("|","|https?://|")()}),inline.breaks=merge({},inline.gfm,{br:replace(inline.br)("{2,}","*")(),text:replace(inline.gfm.text)("{2,}","*")()}),InlineLexer.rules=inline,InlineLexer.output=function(src,links,options){return new InlineLexer(links,options).output(src)},InlineLexer.prototype.output=function(src){for(var link,text,href,cap,out="";src;)if(cap=this.rules.escape.exec(src))src=src.substring(cap[0].length),out+=cap[1];else if(cap=this.rules.autolink.exec(src))src=src.substring(cap[0].length),"@"===cap[2]?(text=":"===cap[1].charAt(6)?this.mangle(cap[1].substring(7)):this.mangle(cap[1]),href=this.mangle("mailto:")+text):href=text=escape(cap[1]),out+=this.renderer.link(href,null,text);else if(this.inLink||!(cap=this.rules.url.exec(src))){if(cap=this.rules.tag.exec(src))!this.inLink&&/^<a /i.test(cap[0])?this.inLink=!0:this.inLink&&/^<\/a>/i.test(cap[0])&&(this.inLink=!1),src=src.substring(cap[0].length),out+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(cap[0]):escape(cap[0]):cap[0];else if(cap=this.rules.link.exec(src))src=src.substring(cap[0].length),this.inLink=!0,out+=this.outputLink(cap,{href:cap[2],title:cap[3]}),this.inLink=!1;else if((cap=this.rules.reflink.exec(src))||(cap=this.rules.nolink.exec(src))){if(src=src.substring(cap[0].length),link=(cap[2]||cap[1]).replace(/\s+/g," "),!(link=this.links[link.toLowerCase()])||!link.href){out+=cap[0].charAt(0),src=cap[0].substring(1)+src;continue}this.inLink=!0,out+=this.outputLink(cap,link),this.inLink=!1}else if(cap=this.rules.strong.exec(src))src=src.substring(cap[0].length),out+=this.renderer.strong(this.output(cap[2]||cap[1]));else if(cap=this.rules.em.exec(src))src=src.substring(cap[0].length),out+=this.renderer.em(this.output(cap[2]||cap[1]));else if(cap=this.rules.code.exec(src))src=src.substring(cap[0].length),out+=this.renderer.codespan(escape(cap[2],!0));else if(cap=this.rules.br.exec(src))src=src.substring(cap[0].length),out+=this.renderer.br();else if(cap=this.rules.del.exec(src))src=src.substring(cap[0].length),out+=this.renderer.del(this.output(cap[1]));else if(cap=this.rules.text.exec(src))src=src.substring(cap[0].length),out+=this.renderer.text(escape(this.smartypants(cap[0])));else if(src)throw new Error("Infinite loop on byte: "+src.charCodeAt(0))}else src=src.substring(cap[0].length),href=text=escape(cap[1]),out+=this.renderer.link(href,null,text);return out},InlineLexer.prototype.outputLink=function(cap,link){var href=escape(link.href),title=link.title?escape(link.title):null;return"!"!==cap[0].charAt(0)?this.renderer.link(href,title,this.output(cap[1])):this.renderer.image(href,title,escape(cap[1]))},InlineLexer.prototype.smartypants=function(text){return this.options.smartypants?text.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…"):text},InlineLexer.prototype.mangle=function(text){if(!this.options.mangle)return text;for(var ch,out="",l=text.length,i=0;i<l;i++)ch=text.charCodeAt(i),Math.random()>.5&&(ch="x"+ch.toString(16)),out+="&#"+ch+";";return out},Renderer.prototype.code=function(code,lang,escaped){if(this.options.highlight){var out=this.options.highlight(code,lang);null!=out&&out!==code&&(escaped=!0,code=out)}return lang?'<pre><code class="'+this.options.langPrefix+escape(lang,!0)+'">'+(escaped?code:escape(code,!0))+"\n</code></pre>\n":"<pre><code>"+(escaped?code:escape(code,!0))+"\n</code></pre>"},Renderer.prototype.blockquote=function(quote){return"<blockquote>\n"+quote+"</blockquote>\n"},Renderer.prototype.html=function(html){return html},Renderer.prototype.heading=function(text,level,raw){return"<h"+level+' id="'+this.options.headerPrefix+raw.toLowerCase().replace(/[^\w]+/g,"-")+'">'+text+"</h"+level+">\n"},Renderer.prototype.hr=function(){return this.options.xhtml?"<hr/>\n":"<hr>\n"},Renderer.prototype.list=function(body,ordered){var type=ordered?"ol":"ul";return"<"+type+">\n"+body+"</"+type+">\n"},Renderer.prototype.listitem=function(text){return"<li>"+text+"</li>\n"},Renderer.prototype.paragraph=function(text){return"<p>"+text+"</p>\n"},Renderer.prototype.table=function(header,body){return"<table>\n<thead>\n"+header+"</thead>\n<tbody>\n"+body+"</tbody>\n</table>\n"},Renderer.prototype.tablerow=function(content){return"<tr>\n"+content+"</tr>\n"},Renderer.prototype.tablecell=function(content,flags){var type=flags.header?"th":"td";return(flags.align?"<"+type+' style="text-align:'+flags.align+'">':"<"+type+">")+content+"</"+type+">\n"},Renderer.prototype.strong=function(text){return"<strong>"+text+"</strong>"},Renderer.prototype.em=function(text){return"<em>"+text+"</em>"},Renderer.prototype.codespan=function(text){return"<code>"+text+"</code>"},Renderer.prototype.br=function(){return this.options.xhtml?"<br/>":"<br>"},Renderer.prototype.del=function(text){return"<del>"+text+"</del>"},Renderer.prototype.link=function(href,title,text){if(this.options.sanitize){try{var prot=decodeURIComponent(unescape(href)).replace(/[^\w:]/g,"").toLowerCase()}catch(e){return""}if(0===prot.indexOf("javascript:")||0===prot.indexOf("vbscript:"))return""}var out='<a href="'+href+'"';return title&&(out+=' title="'+title+'"'),out+=">"+text+"</a>"},Renderer.prototype.image=function(href,title,text){var out='<img src="'+href+'" alt="'+text+'"';return title&&(out+=' title="'+title+'"'),out+=this.options.xhtml?"/>":">"},Renderer.prototype.text=function(text){return text},Parser.parse=function(src,options,renderer){return new Parser(options,renderer).parse(src)},Parser.prototype.parse=function(src){this.inline=new InlineLexer(src.links,this.options,this.renderer),this.tokens=src.reverse();for(var out="";this.next();)out+=this.tok();return out},Parser.prototype.next=function(){return this.token=this.tokens.pop()},Parser.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},Parser.prototype.parseText=function(){for(var body=this.token.text;"text"===this.peek().type;)body+="\n"+this.next().text;return this.inline.output(body)},Parser.prototype.tok=function(){switch(this.token.type){case"space":return"";case"hr":return this.renderer.hr();case"heading":return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,this.token.text);case"code":return this.renderer.code(this.token.text,this.token.lang,this.token.escaped);case"table":var i,row,cell,j,header="",body="";for(cell="",i=0;i<this.token.header.length;i++)({header:!0,align:this.token.align[i]}),cell+=this.renderer.tablecell(this.inline.output(this.token.header[i]),{header:!0,align:this.token.align[i]});for(header+=this.renderer.tablerow(cell),i=0;i<this.token.cells.length;i++){for(row=this.token.cells[i],cell="",j=0;j<row.length;j++)cell+=this.renderer.tablecell(this.inline.output(row[j]),{header:!1,align:this.token.align[j]});body+=this.renderer.tablerow(cell)}return this.renderer.table(header,body);case"blockquote_start":for(body="";"blockquote_end"!==this.next().type;)body+=this.tok();return this.renderer.blockquote(body);case"list_start":for(var body="",ordered=this.token.ordered;"list_end"!==this.next().type;)body+=this.tok();return this.renderer.list(body,ordered);case"list_item_start":for(body="";"list_item_end"!==this.next().type;)body+="text"===this.token.type?this.parseText():this.tok();return this.renderer.listitem(body);case"loose_item_start":for(body="";"list_item_end"!==this.next().type;)body+=this.tok();return this.renderer.listitem(body);case"html":var html=this.token.pre||this.options.pedantic?this.token.text:this.inline.output(this.token.text);return this.renderer.html(html);case"paragraph":return this.renderer.paragraph(this.inline.output(this.token.text));case"text":return this.renderer.paragraph(this.parseText())}},noop.exec=noop,marked.options=marked.setOptions=function(opt){return merge(marked.defaults,opt),marked},marked.defaults={gfm:!0,tables:!0,breaks:!1,pedantic:!1,sanitize:!1,sanitizer:null,mangle:!0,smartLists:!1,silent:!1,highlight:null,langPrefix:"lang-",smartypants:!1,headerPrefix:"",renderer:new Renderer,xhtml:!1},marked.Parser=Parser,marked.parser=Parser.parse,marked.Renderer=Renderer,marked.Lexer=Lexer,marked.lexer=Lexer.lex,marked.InlineLexer=InlineLexer,marked.inlineLexer=InlineLexer.output,marked.parse=marked,void 0!==module&&"object"==typeof exports?module.exports=marked:this.marked=marked}).call(function(){return this||("undefined"!=typeof window?window:global)}())}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],168:[function(require,module,exports){function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}function runTimeout(fun){if(cachedSetTimeout===setTimeout)return setTimeout(fun,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(fun,0);try{return cachedSetTimeout(fun,0)}catch(e){try{return cachedSetTimeout.call(null,fun,0)}catch(e){return cachedSetTimeout.call(this,fun,0)}}}function runClearTimeout(marker){if(cachedClearTimeout===clearTimeout)return clearTimeout(marker);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(marker);try{return cachedClearTimeout(marker)}catch(e){try{return cachedClearTimeout.call(null,marker)}catch(e){return cachedClearTimeout.call(this,marker)}}}function cleanUpNextTick(){draining&¤tQueue&&(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var timeout=runTimeout(cleanUpNextTick);draining=!0;for(var len=queue.length;len;){for(currentQueue=queue,queue=[];++queueIndex<len;)currentQueue&¤tQueue[queueIndex].run();queueIndex=-1,len=queue.length}currentQueue=null,draining=!1,runClearTimeout(timeout)}}function Item(fun,array){this.fun=fun,this.array=array}function noop(){}var cachedSetTimeout,cachedClearTimeout,process=module.exports={};!function(){try{cachedSetTimeout="function"==typeof setTimeout?setTimeout:defaultSetTimout}catch(e){cachedSetTimeout=defaultSetTimout}try{cachedClearTimeout="function"==typeof clearTimeout?clearTimeout:defaultClearTimeout}catch(e){cachedClearTimeout=defaultClearTimeout}}();var currentQueue,queue=[],draining=!1,queueIndex=-1;process.nextTick=function(fun){var args=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)args[i-1]=arguments[i];queue.push(new Item(fun,args)),1!==queue.length||draining||runTimeout(drainQueue)},Item.prototype.run=function(){this.fun.apply(null,this.array)},process.title="browser",process.browser=!0,process.env={},process.argv=[],process.version="",process.versions={},process.on=noop,process.addListener=noop,process.once=noop,process.off=noop,process.removeListener=noop,process.removeAllListeners=noop,process.emit=noop,process.prependListener=noop,process.prependOnceListener=noop,process.listeners=function(name){return[]},process.binding=function(name){throw new Error("process.binding is not supported")},process.cwd=function(){return"/"},process.chdir=function(dir){throw new Error("process.chdir is not supported")},process.umask=function(){return 0}},{}],169:[function(require,module,exports){(function(process){"use strict";if("production"!==process.env.NODE_ENV)var invariant=require("fbjs/lib/invariant"),warning=require("fbjs/lib/warning"),ReactPropTypesSecret=require("./lib/ReactPropTypesSecret"),loggedTypeFailures={};module.exports=function(typeSpecs,values,location,componentName,getStack){if("production"!==process.env.NODE_ENV)for(var typeSpecName in typeSpecs)if(typeSpecs.hasOwnProperty(typeSpecName)){var error;try{invariant("function"==typeof typeSpecs[typeSpecName],"%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.",componentName||"React class",location,typeSpecName),error=typeSpecs[typeSpecName](values,typeSpecName,componentName,location,null,ReactPropTypesSecret)}catch(ex){error=ex}if(warning(!error||error instanceof Error,"%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",componentName||"React class",location,typeSpecName,typeof error),error instanceof Error&&!(error.message in loggedTypeFailures)){loggedTypeFailures[error.message]=!0;var stack=getStack?getStack():"";warning(!1,"Failed %s type: %s%s",location,error.message,null!=stack?stack:"")}}}}).call(this,require("_process"))},{"./lib/ReactPropTypesSecret":173,_process:168,"fbjs/lib/invariant":65,"fbjs/lib/warning":66}],170:[function(require,module,exports){"use strict";var emptyFunction=require("fbjs/lib/emptyFunction"),invariant=require("fbjs/lib/invariant");module.exports=function(){function shim(){invariant(!1,"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")}function getShim(){return shim}shim.isRequired=shim;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};return ReactPropTypes.checkPropTypes=emptyFunction,ReactPropTypes.PropTypes=ReactPropTypes,ReactPropTypes}},{"fbjs/lib/emptyFunction":64,"fbjs/lib/invariant":65}],171:[function(require,module,exports){(function(process){"use strict";var emptyFunction=require("fbjs/lib/emptyFunction"),invariant=require("fbjs/lib/invariant"),warning=require("fbjs/lib/warning"),ReactPropTypesSecret=require("./lib/ReactPropTypesSecret"),checkPropTypes=require("./checkPropTypes");module.exports=function(isValidElement,throwOnDirectAccess){function getIteratorFn(maybeIterable){var iteratorFn=maybeIterable&&(ITERATOR_SYMBOL&&maybeIterable[ITERATOR_SYMBOL]||maybeIterable[FAUX_ITERATOR_SYMBOL]);if("function"==typeof iteratorFn)return iteratorFn}function is(x,y){return x===y?0!==x||1/x==1/y:x!==x&&y!==y}function PropTypeError(message){this.message=message,this.stack=""}function createChainableTypeChecker(validate){function checkType(isRequired,props,propName,componentName,location,propFullName,secret){if(componentName=componentName||ANONYMOUS,propFullName=propFullName||propName,secret!==ReactPropTypesSecret)if(throwOnDirectAccess)invariant(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");else if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var cacheKey=componentName+":"+propName;!manualPropTypeCallCache[cacheKey]&&manualPropTypeWarningCount<3&&(warning(!1,"You are manually calling a React.PropTypes validation function for the `%s` prop on `%s`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details.",propFullName,componentName),manualPropTypeCallCache[cacheKey]=!0,manualPropTypeWarningCount++)}return null==props[propName]?isRequired?new PropTypeError(null===props[propName]?"The "+location+" `"+propFullName+"` is marked as required in `"+componentName+"`, but its value is `null`.":"The "+location+" `"+propFullName+"` is marked as required in `"+componentName+"`, but its value is `undefined`."):null:validate(props,propName,componentName,location,propFullName)}if("production"!==process.env.NODE_ENV)var manualPropTypeCallCache={},manualPropTypeWarningCount=0;var chainedCheckType=checkType.bind(null,!1);return chainedCheckType.isRequired=checkType.bind(null,!0),chainedCheckType}function createPrimitiveTypeChecker(expectedType){return createChainableTypeChecker(function(props,propName,componentName,location,propFullName,secret){var propValue=props[propName];return getPropType(propValue)!==expectedType?new PropTypeError("Invalid "+location+" `"+propFullName+"` of type `"+getPreciseType(propValue)+"` supplied to `"+componentName+"`, expected `"+expectedType+"`."):null})}function isNode(propValue){switch(typeof propValue){case"number":case"string":case"undefined":return!0;case"boolean":return!propValue;case"object":if(Array.isArray(propValue))return propValue.every(isNode);if(null===propValue||isValidElement(propValue))return!0;var iteratorFn=getIteratorFn(propValue);if(!iteratorFn)return!1;var step,iterator=iteratorFn.call(propValue);if(iteratorFn!==propValue.entries){for(;!(step=iterator.next()).done;)if(!isNode(step.value))return!1}else for(;!(step=iterator.next()).done;){var entry=step.value;if(entry&&!isNode(entry[1]))return!1}return!0;default:return!1}}function isSymbol(propType,propValue){return"symbol"===propType||("Symbol"===propValue["@@toStringTag"]||"function"==typeof Symbol&&propValue instanceof Symbol)}function getPropType(propValue){var propType=typeof propValue;return Array.isArray(propValue)?"array":propValue instanceof RegExp?"object":isSymbol(propType,propValue)?"symbol":propType}function getPreciseType(propValue){var propType=getPropType(propValue);if("object"===propType){if(propValue instanceof Date)return"date";if(propValue instanceof RegExp)return"regexp"}return propType}function getClassName(propValue){return propValue.constructor&&propValue.constructor.name?propValue.constructor.name:ANONYMOUS}var ITERATOR_SYMBOL="function"==typeof Symbol&&Symbol.iterator,FAUX_ITERATOR_SYMBOL="@@iterator",ANONYMOUS="<<anonymous>>",ReactPropTypes={array:createPrimitiveTypeChecker("array"),bool:createPrimitiveTypeChecker("boolean"),func:createPrimitiveTypeChecker("function"),number:createPrimitiveTypeChecker("number"),object:createPrimitiveTypeChecker("object"),string:createPrimitiveTypeChecker("string"),symbol:createPrimitiveTypeChecker("symbol"),any:createChainableTypeChecker(emptyFunction.thatReturnsNull),arrayOf:function(typeChecker){return createChainableTypeChecker(function(props,propName,componentName,location,propFullName){if("function"!=typeof typeChecker)return new PropTypeError("Property `"+propFullName+"` of component `"+componentName+"` has invalid PropType notation inside arrayOf.");var propValue=props[propName];if(!Array.isArray(propValue))return new PropTypeError("Invalid "+location+" `"+propFullName+"` of type `"+getPropType(propValue)+"` supplied to `"+componentName+"`, expected an array.");for(var i=0;i<propValue.length;i++){var error=typeChecker(propValue,i,componentName,location,propFullName+"["+i+"]",ReactPropTypesSecret);if(error instanceof Error)return error}return null})},element:function(){return createChainableTypeChecker(function(props,propName,componentName,location,propFullName){var propValue=props[propName];return isValidElement(propValue)?null:new PropTypeError("Invalid "+location+" `"+propFullName+"` of type `"+getPropType(propValue)+"` supplied to `"+componentName+"`, expected a single ReactElement.")})}(),instanceOf:function(expectedClass){return createChainableTypeChecker(function(props,propName,componentName,location,propFullName){if(!(props[propName]instanceof expectedClass)){var expectedClassName=expectedClass.name||ANONYMOUS;return new PropTypeError("Invalid "+location+" `"+propFullName+"` of type `"+getClassName(props[propName])+"` supplied to `"+componentName+"`, expected instance of `"+expectedClassName+"`.")}return null})},node:function(){return createChainableTypeChecker(function(props,propName,componentName,location,propFullName){return isNode(props[propName])?null:new PropTypeError("Invalid "+location+" `"+propFullName+"` supplied to `"+componentName+"`, expected a ReactNode.")})}(),objectOf:function(typeChecker){return createChainableTypeChecker(function(props,propName,componentName,location,propFullName){if("function"!=typeof typeChecker)return new PropTypeError("Property `"+propFullName+"` of component `"+componentName+"` has invalid PropType notation inside objectOf.");var propValue=props[propName],propType=getPropType(propValue);if("object"!==propType)return new PropTypeError("Invalid "+location+" `"+propFullName+"` of type `"+propType+"` supplied to `"+componentName+"`, expected an object.");for(var key in propValue)if(propValue.hasOwnProperty(key)){var error=typeChecker(propValue,key,componentName,location,propFullName+"."+key,ReactPropTypesSecret);if(error instanceof Error)return error}return null})},oneOf:function(expectedValues){return Array.isArray(expectedValues)?createChainableTypeChecker(function(props,propName,componentName,location,propFullName){for(var propValue=props[propName],i=0;i<expectedValues.length;i++)if(is(propValue,expectedValues[i]))return null;return new PropTypeError("Invalid "+location+" `"+propFullName+"` of value `"+propValue+"` supplied to `"+componentName+"`, expected one of "+JSON.stringify(expectedValues)+".")}):("production"!==process.env.NODE_ENV&&warning(!1,"Invalid argument supplied to oneOf, expected an instance of array."),emptyFunction.thatReturnsNull)},oneOfType:function(arrayOfTypeCheckers){return Array.isArray(arrayOfTypeCheckers)?createChainableTypeChecker(function(props,propName,componentName,location,propFullName){for(var i=0;i<arrayOfTypeCheckers.length;i++)if(null==(0,arrayOfTypeCheckers[i])(props,propName,componentName,location,propFullName,ReactPropTypesSecret))return null;return new PropTypeError("Invalid "+location+" `"+propFullName+"` supplied to `"+componentName+"`.")}):("production"!==process.env.NODE_ENV&&warning(!1,"Invalid argument supplied to oneOfType, expected an instance of array."),emptyFunction.thatReturnsNull)},shape:function(shapeTypes){return createChainableTypeChecker(function(props,propName,componentName,location,propFullName){var propValue=props[propName],propType=getPropType(propValue);if("object"!==propType)return new PropTypeError("Invalid "+location+" `"+propFullName+"` of type `"+propType+"` supplied to `"+componentName+"`, expected `object`.");for(var key in shapeTypes){var checker=shapeTypes[key];if(checker){var error=checker(propValue,key,componentName,location,propFullName+"."+key,ReactPropTypesSecret);if(error)return error}}return null})}};return PropTypeError.prototype=Error.prototype,ReactPropTypes.checkPropTypes=checkPropTypes,ReactPropTypes.PropTypes=ReactPropTypes,ReactPropTypes}}).call(this,require("_process"))},{"./checkPropTypes":169,"./lib/ReactPropTypesSecret":173,_process:168,"fbjs/lib/emptyFunction":64,"fbjs/lib/invariant":65,"fbjs/lib/warning":66}],172:[function(require,module,exports){(function(process){if("production"!==process.env.NODE_ENV){var REACT_ELEMENT_TYPE="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103;module.exports=require("./factoryWithTypeCheckers")(function(object){return"object"==typeof object&&null!==object&&object.$$typeof===REACT_ELEMENT_TYPE},!0)}else module.exports=require("./factoryWithThrowingShims")()}).call(this,require("_process"))},{"./factoryWithThrowingShims":170,"./factoryWithTypeCheckers":171,_process:168}],173:[function(require,module,exports){"use strict";module.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},{}],174:[function(require,module,exports){"function"==typeof Object.create?module.exports=function(ctor,superCtor){ctor.super_=superCtor,ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:!1,writable:!0,configurable:!0}})}:module.exports=function(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype,ctor.prototype=new TempCtor,ctor.prototype.constructor=ctor}},{}],175:[function(require,module,exports){module.exports=function(arg){return arg&&"object"==typeof arg&&"function"==typeof arg.copy&&"function"==typeof arg.fill&&"function"==typeof arg.readUInt8}},{}],176:[function(require,module,exports){(function(process,global){function inspect(obj,opts){var ctx={seen:[],stylize:stylizeNoColor};return arguments.length>=3&&(ctx.depth=arguments[2]),arguments.length>=4&&(ctx.colors=arguments[3]),isBoolean(opts)?ctx.showHidden=opts:opts&&exports._extend(ctx,opts),isUndefined(ctx.showHidden)&&(ctx.showHidden=!1),isUndefined(ctx.depth)&&(ctx.depth=2),isUndefined(ctx.colors)&&(ctx.colors=!1),isUndefined(ctx.customInspect)&&(ctx.customInspect=!0),ctx.colors&&(ctx.stylize=stylizeWithColor),formatValue(ctx,obj,ctx.depth)}function stylizeWithColor(str,styleType){var style=inspect.styles[styleType];return style?"["+inspect.colors[style][0]+"m"+str+"["+inspect.colors[style][1]+"m":str}function stylizeNoColor(str,styleType){return str}function arrayToHash(array){var hash={};return array.forEach(function(val,idx){hash[val]=!0}),hash}function formatValue(ctx,value,recurseTimes){if(ctx.customInspect&&value&&isFunction(value.inspect)&&value.inspect!==exports.inspect&&(!value.constructor||value.constructor.prototype!==value)){var ret=value.inspect(recurseTimes,ctx);return isString(ret)||(ret=formatValue(ctx,ret,recurseTimes)),ret}var primitive=formatPrimitive(ctx,value);if(primitive)return primitive;var keys=Object.keys(value),visibleKeys=arrayToHash(keys);if(ctx.showHidden&&(keys=Object.getOwnPropertyNames(value)),isError(value)&&(keys.indexOf("message")>=0||keys.indexOf("description")>=0))return formatError(value);if(0===keys.length){if(isFunction(value)){var name=value.name?": "+value.name:"";return ctx.stylize("[Function"+name+"]","special")}if(isRegExp(value))return ctx.stylize(RegExp.prototype.toString.call(value),"regexp");if(isDate(value))return ctx.stylize(Date.prototype.toString.call(value),"date");if(isError(value))return formatError(value)}var base="",array=!1,braces=["{","}"];if(isArray(value)&&(array=!0,braces=["[","]"]),isFunction(value)&&(base=" [Function"+(value.name?": "+value.name:"")+"]"),isRegExp(value)&&(base=" "+RegExp.prototype.toString.call(value)),isDate(value)&&(base=" "+Date.prototype.toUTCString.call(value)),isError(value)&&(base=" "+formatError(value)),0===keys.length&&(!array||0==value.length))return braces[0]+base+braces[1];if(recurseTimes<0)return isRegExp(value)?ctx.stylize(RegExp.prototype.toString.call(value),"regexp"):ctx.stylize("[Object]","special");ctx.seen.push(value);var output;return output=array?formatArray(ctx,value,recurseTimes,visibleKeys,keys):keys.map(function(key){return formatProperty(ctx,value,recurseTimes,visibleKeys,key,array)}),ctx.seen.pop(),reduceToSingleString(output,base,braces)}function formatPrimitive(ctx,value){if(isUndefined(value))return ctx.stylize("undefined","undefined");if(isString(value)){var simple="'"+JSON.stringify(value).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return ctx.stylize(simple,"string")}return isNumber(value)?ctx.stylize(""+value,"number"):isBoolean(value)?ctx.stylize(""+value,"boolean"):isNull(value)?ctx.stylize("null","null"):void 0}function formatError(value){return"["+Error.prototype.toString.call(value)+"]"}function formatArray(ctx,value,recurseTimes,visibleKeys,keys){for(var output=[],i=0,l=value.length;i<l;++i)hasOwnProperty(value,String(i))?output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,String(i),!0)):output.push("");return keys.forEach(function(key){key.match(/^\d+$/)||output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,key,!0))}),output}function formatProperty(ctx,value,recurseTimes,visibleKeys,key,array){var name,str,desc;if((desc=Object.getOwnPropertyDescriptor(value,key)||{value:value[key]}).get?str=desc.set?ctx.stylize("[Getter/Setter]","special"):ctx.stylize("[Getter]","special"):desc.set&&(str=ctx.stylize("[Setter]","special")),hasOwnProperty(visibleKeys,key)||(name="["+key+"]"),str||(ctx.seen.indexOf(desc.value)<0?(str=isNull(recurseTimes)?formatValue(ctx,desc.value,null):formatValue(ctx,desc.value,recurseTimes-1)).indexOf("\n")>-1&&(str=array?str.split("\n").map(function(line){return" "+line}).join("\n").substr(2):"\n"+str.split("\n").map(function(line){return" "+line}).join("\n")):str=ctx.stylize("[Circular]","special")),isUndefined(name)){if(array&&key.match(/^\d+$/))return str;(name=JSON.stringify(""+key)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(name=name.substr(1,name.length-2),name=ctx.stylize(name,"name")):(name=name.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),name=ctx.stylize(name,"string"))}return name+": "+str}function reduceToSingleString(output,base,braces){var numLinesEst=0;return output.reduce(function(prev,cur){return numLinesEst++,cur.indexOf("\n")>=0&&numLinesEst++,prev+cur.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60?braces[0]+(""===base?"":base+"\n ")+" "+output.join(",\n ")+" "+braces[1]:braces[0]+base+" "+output.join(", ")+" "+braces[1]}function isArray(ar){return Array.isArray(ar)}function isBoolean(arg){return"boolean"==typeof arg}function isNull(arg){return null===arg}function isNumber(arg){return"number"==typeof arg}function isString(arg){return"string"==typeof arg}function isUndefined(arg){return void 0===arg}function isRegExp(re){return isObject(re)&&"[object RegExp]"===objectToString(re)}function isObject(arg){return"object"==typeof arg&&null!==arg}function isDate(d){return isObject(d)&&"[object Date]"===objectToString(d)}function isError(e){return isObject(e)&&("[object Error]"===objectToString(e)||e instanceof Error)}function isFunction(arg){return"function"==typeof arg}function objectToString(o){return Object.prototype.toString.call(o)}function pad(n){return n<10?"0"+n.toString(10):n.toString(10)}function timestamp(){var d=new Date,time=[pad(d.getHours()),pad(d.getMinutes()),pad(d.getSeconds())].join(":");return[d.getDate(),months[d.getMonth()],time].join(" ")}function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}var formatRegExp=/%[sdj%]/g;exports.format=function(f){if(!isString(f)){for(var objects=[],i=0;i<arguments.length;i++)objects.push(inspect(arguments[i]));return objects.join(" ")}for(var i=1,args=arguments,len=args.length,str=String(f).replace(formatRegExp,function(x){if("%%"===x)return"%";if(i>=len)return x;switch(x){case"%s":return String(args[i++]);case"%d":return Number(args[i++]);case"%j":try{return JSON.stringify(args[i++])}catch(_){return"[Circular]"}default:return x}}),x=args[i];i<len;x=args[++i])isNull(x)||!isObject(x)?str+=" "+x:str+=" "+inspect(x);return str},exports.deprecate=function(fn,msg){if(isUndefined(global.process))return function(){return exports.deprecate(fn,msg).apply(this,arguments)};if(!0===process.noDeprecation)return fn;var warned=!1;return function(){if(!warned){if(process.throwDeprecation)throw new Error(msg);process.traceDeprecation?console.trace(msg):console.error(msg),warned=!0}return fn.apply(this,arguments)}};var debugEnviron,debugs={};exports.debuglog=function(set){if(isUndefined(debugEnviron)&&(debugEnviron=process.env.NODE_DEBUG||""),set=set.toUpperCase(),!debugs[set])if(new RegExp("\\b"+set+"\\b","i").test(debugEnviron)){var pid=process.pid;debugs[set]=function(){var msg=exports.format.apply(exports,arguments);console.error("%s %d: %s",set,pid,msg)}}else debugs[set]=function(){};return debugs[set]},exports.inspect=inspect,inspect.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]},inspect.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},exports.isArray=isArray,exports.isBoolean=isBoolean,exports.isNull=isNull,exports.isNullOrUndefined=function(arg){return null==arg},exports.isNumber=isNumber,exports.isString=isString,exports.isSymbol=function(arg){return"symbol"==typeof arg},exports.isUndefined=isUndefined,exports.isRegExp=isRegExp,exports.isObject=isObject,exports.isDate=isDate,exports.isError=isError,exports.isFunction=isFunction,exports.isPrimitive=function(arg){return null===arg||"boolean"==typeof arg||"number"==typeof arg||"string"==typeof arg||"symbol"==typeof arg||void 0===arg},exports.isBuffer=require("./support/isBuffer");var months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];exports.log=function(){console.log("%s - %s",timestamp(),exports.format.apply(exports,arguments))},exports.inherits=require("inherits"),exports._extend=function(origin,add){if(!add||!isObject(add))return origin;for(var keys=Object.keys(add),i=keys.length;i--;)origin[keys[i]]=add[keys[i]];return origin}}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":175,_process:168,inherits:174}]},{},[21])(21)});
|
ajax/libs/react-native-web/0.0.0-d48f63060/exports/AppRegistry/renderApplication.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); }
/**
* Copyright (c) Nicolas Gallagher.
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
import AppContainer from './AppContainer';
import invariant from 'fbjs/lib/invariant';
import render, { hydrate } from '../render';
import styleResolver from '../StyleSheet/styleResolver';
import React from 'react';
export default function renderApplication(RootComponent, WrapperComponent, callback, options) {
var shouldHydrate = options.hydrate,
initialProps = options.initialProps,
rootTag = options.rootTag;
var renderFn = shouldHydrate ? hydrate : render;
invariant(rootTag, 'Expect to have a valid rootTag, instead got ', rootTag);
renderFn( /*#__PURE__*/React.createElement(AppContainer, {
WrapperComponent: WrapperComponent,
rootTag: rootTag
}, /*#__PURE__*/React.createElement(RootComponent, initialProps)), rootTag, callback);
}
export function getApplication(RootComponent, initialProps, WrapperComponent) {
var element = /*#__PURE__*/React.createElement(AppContainer, {
WrapperComponent: WrapperComponent,
rootTag: {}
}, /*#__PURE__*/React.createElement(RootComponent, initialProps)); // Don't escape CSS text
var getStyleElement = function getStyleElement(props) {
var sheet = styleResolver.getStyleSheet();
return /*#__PURE__*/React.createElement("style", _extends({}, props, {
dangerouslySetInnerHTML: {
__html: sheet.textContent
},
id: sheet.id
}));
};
return {
element: element,
getStyleElement: getStyleElement
};
} |
ajax/libs/6to5/3.1.1/browser-polyfill.js | kiwi89/cdnjs | (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){(function(global){"use strict";if(global._6to5Polyfill){throw new Error("only one instance of 6to5/polyfill is allowed")}global._6to5Polyfill=true;require("core-js/shim");require("regenerator-6to5/runtime")}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"core-js/shim":2,"regenerator-6to5/runtime":3}],2:[function(require,module,exports){!function(global,framework,undefined){"use strict";var OBJECT="Object",FUNCTION="Function",ARRAY="Array",STRING="String",NUMBER="Number",REGEXP="RegExp",DATE="Date",MAP="Map",SET="Set",WEAKMAP="WeakMap",WEAKSET="WeakSet",SYMBOL="Symbol",PROMISE="Promise",MATH="Math",ARGUMENTS="Arguments",PROTOTYPE="prototype",CONSTRUCTOR="constructor",TO_STRING="toString",TO_STRING_TAG=TO_STRING+"Tag",TO_LOCALE="toLocaleString",HAS_OWN="hasOwnProperty",FOR_EACH="forEach",ITERATOR="iterator",FF_ITERATOR="@@"+ITERATOR,PROCESS="process",CREATE_ELEMENT="createElement",Function=global[FUNCTION],Object=global[OBJECT],Array=global[ARRAY],String=global[STRING],Number=global[NUMBER],RegExp=global[REGEXP],Date=global[DATE],Map=global[MAP],Set=global[SET],WeakMap=global[WEAKMAP],WeakSet=global[WEAKSET],Symbol=global[SYMBOL],Math=global[MATH],TypeError=global.TypeError,setTimeout=global.setTimeout,setImmediate=global.setImmediate,clearImmediate=global.clearImmediate,process=global[PROCESS],nextTick=process&&process.nextTick,document=global.document,html=document&&document.documentElement,navigator=global.navigator,define=global.define,ArrayProto=Array[PROTOTYPE],ObjectProto=Object[PROTOTYPE],FunctionProto=Function[PROTOTYPE],Infinity=1/0,DOT=".";function isObject(it){return it!=null&&(typeof it=="object"||typeof it=="function")}function isFunction(it){return typeof it=="function"}var isNative=ctx(/./.test,/\[native code\]\s*\}\s*$/,1);var buildIn={Undefined:1,Null:1,Array:1,String:1,Arguments:1,Function:1,Error:1,Boolean:1,Number:1,Date:1,RegExp:1},toString=ObjectProto[TO_STRING];function setToStringTag(it,tag,stat){if(it&&!has(it=stat?it:it[PROTOTYPE],SYMBOL_TAG))hidden(it,SYMBOL_TAG,tag)}function cof(it){return it==undefined?it===undefined?"Undefined":"Null":toString.call(it).slice(8,-1)}function classof(it){var klass=cof(it),tag;return klass==OBJECT&&(tag=it[SYMBOL_TAG])?has(buildIn,tag)?"~"+tag:tag:klass}var call=FunctionProto.call,apply=FunctionProto.apply,REFERENCE_GET;function part(){var fn=assertFunction(this),length=arguments.length,args=Array(length),i=0,_=path._,holder=false;while(length>i)if((args[i]=arguments[i++])===_)holder=true;return function(){var that=this,_length=arguments.length,i=0,j=0,_args;if(!holder&&!_length)return invoke(fn,args,that);_args=args.slice();if(holder)for(;length>i;i++)if(_args[i]===_)_args[i]=arguments[j++];while(_length>j)_args.push(arguments[j++]);return invoke(fn,_args,that)}}function ctx(fn,that,length){assertFunction(fn);if(~length&&that===undefined)return fn;switch(length){case 1:return function(a){return fn.call(that,a)};case 2:return function(a,b){return fn.call(that,a,b)};case 3:return function(a,b,c){return fn.call(that,a,b,c)}}return function(){return fn.apply(that,arguments)}}function invoke(fn,args,that){var un=that===undefined;switch(args.length|0){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)}function construct(target,argumentsList){var proto=assertFunction(arguments.length<3?target:arguments[2])[PROTOTYPE],instance=create(isObject(proto)?proto:ObjectProto),result=apply.call(target,instance,argumentsList);return isObject(result)?result:instance}var create=Object.create,getPrototypeOf=Object.getPrototypeOf,setPrototypeOf=Object.setPrototypeOf,defineProperty=Object.defineProperty,defineProperties=Object.defineProperties,getOwnDescriptor=Object.getOwnPropertyDescriptor,getKeys=Object.keys,getNames=Object.getOwnPropertyNames,getSymbols=Object.getOwnPropertySymbols,isFrozen=Object.isFrozen,has=ctx(call,ObjectProto[HAS_OWN],2),ES5Object=Object,Dict;function toObject(it){return ES5Object(assertDefined(it))}function returnIt(it){return it}function returnThis(){return this}function get(object,key){if(has(object,key))return object[key]}function ownKeys(it){assertObject(it);return getSymbols?getNames(it).concat(getSymbols(it)):getNames(it)}var assign=Object.assign||function(target,source){var T=Object(assertDefined(target)),l=arguments.length,i=1;while(l>i){var S=ES5Object(arguments[i++]),keys=getKeys(S),length=keys.length,j=0,key;while(length>j)T[key=keys[j++]]=S[key]}return T};function keyOf(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}function array(it){return String(it).split(",")}var push=ArrayProto.push,unshift=ArrayProto.unshift,slice=ArrayProto.slice,splice=ArrayProto.splice,indexOf=ArrayProto.indexOf,forEach=ArrayProto[FOR_EACH];function createArrayMethod(type){var isMap=type==1,isFilter=type==2,isSome=type==3,isEvery=type==4,isFindIndex=type==6,noholes=type==5||isFindIndex;return function(callbackfn){var O=Object(assertDefined(this)),that=arguments[1],self=ES5Object(O),f=ctx(callbackfn,that,3),length=toLength(self.length),index=0,result=isMap?Array(length):isFilter?[]:undefined,val,res;for(;length>index;index++)if(noholes||index in self){val=self[index];res=f(val,index,O);if(type){if(isMap)result[index]=res;else if(res)switch(type){case 3:return true;case 5:return val;case 6:return index;case 2:result.push(val)}else if(isEvery)return false}}return isFindIndex?-1:isSome||isEvery?isEvery:result}}function createArrayContains(isContains){return function(el){var O=toObject(this),length=toLength(O.length),index=toIndex(arguments[1],length);if(isContains&&el!=el){for(;length>index;index++)if(sameNaN(O[index]))return isContains||index}else for(;length>index;index++)if(isContains||index in O){if(O[index]===el)return isContains||index}return!isContains&&-1}}function generic(A,B){return typeof A=="function"?A:B}var MAX_SAFE_INTEGER=9007199254740991,ceil=Math.ceil,floor=Math.floor,max=Math.max,min=Math.min,random=Math.random,trunc=Math.trunc||function(it){return(it>0?floor:ceil)(it)};function sameNaN(number){return number!=number}function toInteger(it){return isNaN(it)?0:trunc(it)}function toLength(it){return it>0?min(toInteger(it),MAX_SAFE_INTEGER):0}function toIndex(index,length){var index=toInteger(index);return index<0?max(index+length,0):min(index,length)}function createReplacer(regExp,replace,isStatic){var replacer=isObject(replace)?function(part){return replace[part]}:replace;return function(it){return String(isStatic?it:this).replace(regExp,replacer)}}function createPointAt(toString){return function(pos){var s=String(assertDefined(this)),i=toInteger(pos),l=s.length,a,b;if(i<0||i>=l)return toString?"":undefined;a=s.charCodeAt(i);return a<55296||a>56319||i+1===l||(b=s.charCodeAt(i+1))<56320||b>57343?toString?s.charAt(i):a:toString?s.slice(i,i+2):(a-55296<<10)+(b-56320)+65536}}var REDUCE_ERROR="Reduce of empty object with no initial value";function assert(condition,msg1,msg2){if(!condition)throw TypeError(msg2?msg1+msg2:msg1)}function assertDefined(it){if(it==undefined)throw TypeError("Function called on null or undefined");return it}function assertFunction(it){assert(isFunction(it),it," is not a function!");return it}function assertObject(it){assert(isObject(it),it," is not an object!");return it}function assertInstance(it,Constructor,name){assert(it instanceof Constructor,name,": use the 'new' operator!")}function descriptor(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 defineProperty(object,key,descriptor(bitmap,value))}:simpleSet}function uid(key){return SYMBOL+"("+key+")_"+(++sid+random())[TO_STRING](36)}function getWellKnownSymbol(name,setter){return Symbol&&Symbol[name]||(setter?Symbol:safeSymbol)(SYMBOL+DOT+name)}var DESC=!!function(){try{return defineProperty({},DOT,ObjectProto)}catch(e){}}(),sid=0,hidden=createDefiner(1),set=Symbol?simpleSet:hidden,safeSymbol=Symbol||uid;function assignHidden(target,src){for(var key in src)hidden(target,key,src[key]);return target}var SYMBOL_UNSCOPABLES=getWellKnownSymbol("unscopables"),ArrayUnscopables=ArrayProto[SYMBOL_UNSCOPABLES]||{},SYMBOL_SPECIES=getWellKnownSymbol("species");function setSpecies(C){if(framework||!isNative(C))defineProperty(C,SYMBOL_SPECIES,{configurable:true,get:returnThis})}var SYMBOL_ITERATOR=getWellKnownSymbol(ITERATOR),SYMBOL_TAG=getWellKnownSymbol(TO_STRING_TAG),SUPPORT_FF_ITER=FF_ITERATOR in ArrayProto,ITER=safeSymbol("iter"),KEY=1,VALUE=2,Iterators={},IteratorPrototype={},NATIVE_ITERATORS=SYMBOL_ITERATOR in ArrayProto,BUGGY_ITERATORS="keys"in ArrayProto&&!("next"in[].keys());setIterator(IteratorPrototype,returnThis);function setIterator(O,value){hidden(O,SYMBOL_ITERATOR,value);SUPPORT_FF_ITER&&hidden(O,FF_ITERATOR,value)}function createIterator(Constructor,NAME,next,proto){Constructor[PROTOTYPE]=create(proto||IteratorPrototype,{next:descriptor(1,next)});setToStringTag(Constructor,NAME+" Iterator")}function defineIterator(Constructor,NAME,value,DEFAULT){var proto=Constructor[PROTOTYPE],iter=get(proto,SYMBOL_ITERATOR)||get(proto,FF_ITERATOR)||DEFAULT&&get(proto,DEFAULT)||value;if(framework){setIterator(proto,iter);if(iter!==value){var iterProto=getPrototypeOf(iter.call(new Constructor));setToStringTag(iterProto,NAME+" Iterator",true);has(proto,FF_ITERATOR)&&setIterator(iterProto,returnThis)}}Iterators[NAME]=iter;Iterators[NAME+" Iterator"]=returnThis;return iter}function defineStdIterators(Base,NAME,Constructor,next,DEFAULT,IS_SET){function createIter(kind){return function(){return new Constructor(this,kind)}}createIterator(Constructor,NAME,next);var entries=createIter(KEY+VALUE),values=createIter(VALUE);if(DEFAULT==VALUE)values=defineIterator(Base,NAME,values,"values");else entries=defineIterator(Base,NAME,entries,"entries");if(DEFAULT){$define(PROTO+FORCED*BUGGY_ITERATORS,NAME,{entries:entries,keys:IS_SET?values:createIter(KEY),values:values})}}function iterResult(done,value){return{value:value,done:!!done}}function isIterable(it){var O=Object(it),Symbol=global[SYMBOL],hasExt=(Symbol&&Symbol[ITERATOR]||FF_ITERATOR)in O;return hasExt||SYMBOL_ITERATOR in O||has(Iterators,classof(O))}function getIterator(it){var Symbol=global[SYMBOL],ext=it[Symbol&&Symbol[ITERATOR]||FF_ITERATOR],getIter=ext||it[SYMBOL_ITERATOR]||Iterators[classof(it)];return assertObject(getIter.call(it))}function stepCall(fn,value,entries){return entries?invoke(fn,value):fn(value)}function forOf(iterable,entries,fn,that){var iterator=getIterator(iterable),f=ctx(fn,that,entries?2:1),step;while(!(step=iterator.next()).done)if(stepCall(f,step.value,entries)===false)return}var NODE=cof(process)==PROCESS,core={},path=framework?global:core,old=global.core,exportGlobal,FORCED=1,GLOBAL=2,STATIC=4,PROTO=8,BIND=16,WRAP=32;function $define(type,name,source){var key,own,out,exp,isGlobal=type&GLOBAL,target=isGlobal?global:type&STATIC?global[name]:(global[name]||ObjectProto)[PROTOTYPE],exports=isGlobal?core:core[name]||(core[name]={});if(isGlobal)source=name;for(key in source){own=!(type&FORCED)&&target&&key in target&&(!isFunction(target[key])||isNative(target[key]));out=(own?target:source)[key];if(type&BIND&&own)exp=ctx(out,global);else if(type&WRAP&&!framework&&target[key]==out){exp=function(param){return this instanceof out?new out(param):out(param)};exp[PROTOTYPE]=out[PROTOTYPE]}else exp=type&PROTO&&isFunction(out)?ctx(call,out):out;if(exports[key]!=out)hidden(exports,key,exp);if(framework&&target&&!own){if(isGlobal)target[key]=out;else delete target[key]&&hidden(target,key,out)}}}if(typeof module!="undefined"&&module.exports)module.exports=core;else if(isFunction(define)&&define.amd)define(function(){return core});else exportGlobal=true;if(exportGlobal||framework){core.noConflict=function(){global.core=old;return core};global.core=core}$define(GLOBAL+FORCED,{global:global});!function(TAG,SymbolRegistry,AllSymbols,setter){if(!isNative(Symbol)){Symbol=function(description){assert(!(this instanceof Symbol),SYMBOL+" is not a "+CONSTRUCTOR);var tag=uid(description);AllSymbols[tag]=true;DESC&&setter&&defineProperty(ObjectProto,tag,{configurable:true,set:function(value){hidden(this,tag,value)}});return set(create(Symbol[PROTOTYPE]),TAG,tag)};hidden(Symbol[PROTOTYPE],TO_STRING,function(){return this[TAG]})}$define(GLOBAL+WRAP,{Symbol:Symbol});var symbolStatics={"for":function(key){return has(SymbolRegistry,key+="")?SymbolRegistry[key]:SymbolRegistry[key]=Symbol(key)},iterator:SYMBOL_ITERATOR,keyFor:part.call(keyOf,SymbolRegistry),species:SYMBOL_SPECIES,toStringTag:SYMBOL_TAG=getWellKnownSymbol(TO_STRING_TAG,true),unscopables:SYMBOL_UNSCOPABLES,pure:safeSymbol,set:set,useSetter:function(){setter=true},useSimple:function(){setter=false}};forEach.call(array("hasInstance,isConcatSpreadable,match,replace,search,split,toPrimitive"),function(it){symbolStatics[it]=getWellKnownSymbol(it)});$define(STATIC,SYMBOL,symbolStatics);setToStringTag(Symbol,SYMBOL);$define(STATIC+FORCED*!isNative(Symbol),OBJECT,{getOwnPropertyNames:function(it){var names=getNames(toObject(it)),result=[],key,i=0;while(names.length>i)has(AllSymbols,key=names[i++])||result.push(key);return result},getOwnPropertySymbols:function(it){var names=getNames(toObject(it)),result=[],key,i=0;while(names.length>i)has(AllSymbols,key=names[i++])&&result.push(key);return result}})}(safeSymbol("tag"),{},{},true);!function(RegExpProto,isFinite,tmp,NAME){var RangeError=global.RangeError,isInteger=Number.isInteger||function(it){return!isObject(it)&&isFinite(it)&&floor(it)===it},sign=Math.sign||function sign(x){return(x=+x)==0||x!=x?x:x<0?-1:1},E=Math.E,pow=Math.pow,abs=Math.abs,exp=Math.exp,log=Math.log,sqrt=Math.sqrt,fcc=String.fromCharCode,at=createPointAt(true);var objectStatic={assign:assign,is:function(x,y){return x===y?x!==0||1/x===1/y:x!=x&&y!=y}};"__proto__"in ObjectProto&&function(buggy,set){try{set=ctx(call,getOwnDescriptor(ObjectProto,"__proto__").set,2);set({},ArrayProto)}catch(e){buggy=true}objectStatic.setPrototypeOf=setPrototypeOf=setPrototypeOf||function(O,proto){assertObject(O);assert(proto===null||isObject(proto),proto,": can't set as prototype!");if(buggy)O.__proto__=proto;else set(O,proto);return O}}();$define(STATIC,OBJECT,objectStatic);function asinh(x){return!isFinite(x=+x)||x==0?x:x<0?-asinh(-x):log(x+sqrt(x*x+1))}function expm1(x){return(x=+x)==0?x:x>-1e-6&&x<1e-6?x+x*x/2:exp(x)-1}$define(STATIC,NUMBER,{EPSILON:pow(2,-52),isFinite:function(it){return typeof it=="number"&&isFinite(it)},isInteger:isInteger,isNaN:sameNaN,isSafeInteger:function(number){return isInteger(number)&&abs(number)<=MAX_SAFE_INTEGER},MAX_SAFE_INTEGER:MAX_SAFE_INTEGER,MIN_SAFE_INTEGER:-MAX_SAFE_INTEGER,parseFloat:parseFloat,parseInt:parseInt});$define(STATIC,MATH,{acosh:function(x){return(x=+x)<1?NaN:isFinite(x)?log(x/E+sqrt(x+1)*sqrt(x-1)/E)+1:x},asinh:asinh,atanh:function(x){return(x=+x)==0?x:log((1+x)/(1-x))/2},cbrt:function(x){return sign(x=+x)*pow(abs(x),1/3)},clz32:function(x){return(x>>>=0)?32-x[TO_STRING](2).length:32},cosh:function(x){return(exp(x=+x)+exp(-x))/2},expm1:expm1,fround:function(x){return new Float32Array([x])[0]},hypot:function(value1,value2){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)},imul:function(x,y){var UInt16=65535,xn=+x,yn=+y,xl=UInt16&xn,yl=UInt16&yn;return 0|xl*yl+((UInt16&xn>>>16)*yl+xl*(UInt16&yn>>>16)<<16>>>0)},log1p:function(x){return(x=+x)>-1e-8&&x<1e-8?x-x*x/2:log(1+x)},log10:function(x){return log(x)/Math.LN10},log2:function(x){return log(x)/Math.LN2},sign:sign,sinh:function(x){return abs(x=+x)<1?(expm1(x)-expm1(-x))/2:(exp(x-1)-exp(-x-1))*(E/2)},tanh:function(x){var a=expm1(x=+x),b=expm1(-x);return a==Infinity?1:b==Infinity?-1:(a-b)/(exp(x)+exp(-x))},trunc:trunc});setToStringTag(Math,MATH,true);function assertNotRegExp(it){if(cof(it)==REGEXP)throw TypeError()}$define(STATIC,STRING,{fromCodePoint:function(x){var res=[],len=arguments.length,i=0,code;while(len>i){code=+arguments[i++];if(toIndex(code,1114111)!==code)throw RangeError(code+" is not a valid code point");res.push(code<65536?fcc(code):fcc(((code-=65536)>>10)+55296,code%1024+56320))}return res.join("")},raw:function(callSite){var raw=toObject(callSite.raw),len=toLength(raw.length),sln=arguments.length,res=[],i=0;while(len>i){res.push(String(raw[i++]));if(i<sln)res.push(String(arguments[i]))}return res.join("")}});$define(PROTO,STRING,{codePointAt:createPointAt(false),endsWith:function(searchString){assertNotRegExp(searchString);var that=String(assertDefined(this)),endPosition=arguments[1],len=toLength(that.length),end=endPosition===undefined?len:min(toLength(endPosition),len);searchString+="";return that.slice(end-searchString.length,end)===searchString},includes:function(searchString){assertNotRegExp(searchString);return!!~String(assertDefined(this)).indexOf(searchString,arguments[1])},repeat:function(count){var str=String(assertDefined(this)),res="",n=toInteger(count);if(0>n||n==Infinity)throw RangeError("Count can't be negative");for(;n>0;(n>>>=1)&&(str+=str))if(n&1)res+=str;return res},startsWith:function(searchString){assertNotRegExp(searchString);var that=String(assertDefined(this)),index=toLength(min(arguments[1],that.length));searchString+="";return that.slice(index,index+searchString.length)===searchString}});defineStdIterators(String,STRING,function(iterated){set(this,ITER,{o:String(iterated),i:0})},function(){var iter=this[ITER],O=iter.o,index=iter.i,point;if(index>=O.length)return iterResult(1);point=at.call(O,index);iter.i+=point.length;return iterResult(0,point)});$define(STATIC,ARRAY,{from:function(arrayLike){var O=Object(assertDefined(arrayLike)),result=new(generic(this,Array)),mapfn=arguments[1],that=arguments[2],mapping=mapfn!==undefined,f=mapping?ctx(mapfn,that,2):undefined,index=0,length;if(isIterable(O))for(var iter=getIterator(O),step;!(step=iter.next()).done;index++){result[index]=mapping?f(step.value,index):step.value}else for(length=toLength(O.length);length>index;index++){result[index]=mapping?f(O[index],index):O[index]}result.length=index;return result},of:function(){var index=0,length=arguments.length,result=new(generic(this,Array))(length);while(length>index)result[index]=arguments[index++];result.length=length;return result}});$define(PROTO,ARRAY,{copyWithin:function(target,start){var O=Object(assertDefined(this)),len=toLength(O.length),to=toIndex(target,len),from=toIndex(start,len),end=arguments[2],fin=end===undefined?len:toIndex(end,len),count=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},fill:function(value){var O=Object(assertDefined(this)),length=toLength(O.length),index=toIndex(arguments[1],length),end=arguments[2],endPos=end===undefined?length:toIndex(end,length);while(endPos>index)O[index++]=value;return O},find:createArrayMethod(5),findIndex:createArrayMethod(6)});defineStdIterators(Array,ARRAY,function(iterated,kind){set(this,ITER,{o:toObject(iterated),i:0,k:kind})},function(){var iter=this[ITER],O=iter.o,kind=iter.k,index=iter.i++;if(!O||index>=O.length)return iter.o=undefined,iterResult(1);if(kind==KEY)return iterResult(0,index);if(kind==VALUE)return iterResult(0,O[index]);return iterResult(0,[index,O[index]])},VALUE);Iterators[ARGUMENTS]=Iterators[ARRAY];setToStringTag(global.JSON,"JSON",true);function wrapObjectMethod(key,MODE){var fn=Object[key],exp=core[OBJECT][key],f=0,o={};if(!exp||isNative(exp)){o[key]=MODE==1?function(it){return isObject(it)?fn(it):it}:MODE==2?function(it){return isObject(it)?fn(it):true}:MODE==3?function(it){return isObject(it)?fn(it):false}:MODE==4?function(it,key){return fn(toObject(it),key)}:function(it){return fn(toObject(it))};try{fn(DOT)}catch(e){f=1}$define(STATIC+FORCED*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");wrapObjectMethod("keys");wrapObjectMethod("getOwnPropertyNames");if(framework){tmp[SYMBOL_TAG]=DOT;if(cof(tmp)!=DOT)hidden(ObjectProto,TO_STRING,function(){return"[object "+classof(this)+"]"});NAME in FunctionProto||defineProperty(FunctionProto,NAME,{configurable:true,get:function(){var match=String(this).match(/^\s*function ([^ (]*)/),name=match?match[1]:"";has(this,NAME)||defineProperty(this,NAME,descriptor(5,name));return name},set:function(value){has(this,NAME)||defineProperty(this,NAME,descriptor(0,value))}});if(DESC&&!function(){try{return RegExp(/a/g,"i")=="/a/i"}catch(e){}}()){var _RegExp=RegExp;RegExp=function RegExp(pattern,flags){return new _RegExp(cof(pattern)==REGEXP&&flags!==undefined?pattern.source:pattern,flags)};forEach.call(getNames(_RegExp),function(key){key in RegExp||defineProperty(RegExp,key,{configurable:true,get:function(){return _RegExp[key]},set:function(it){_RegExp[key]=it}})});RegExpProto[CONSTRUCTOR]=RegExp;RegExp[PROTOTYPE]=RegExpProto;hidden(global,REGEXP,RegExp)}if(/./g.flags!="g")defineProperty(RegExpProto,"flags",{configurable:true,get:createReplacer(/^.*\/(\w*)$/,"$1")});forEach.call(array("find,findIndex,fill,copyWithin,entries,keys,values"),function(it){ArrayUnscopables[it]=true});SYMBOL_UNSCOPABLES in ArrayProto||hidden(ArrayProto,SYMBOL_UNSCOPABLES,ArrayUnscopables)}setSpecies(RegExp);setSpecies(Array)}(RegExp[PROTOTYPE],isFinite,{},"name");isFunction(setImmediate)&&isFunction(clearImmediate)||function(ONREADYSTATECHANGE){var postMessage=global.postMessage,addEventListener=global.addEventListener,MessageChannel=global.MessageChannel,counter=0,queue={},defer,channel,port;setImmediate=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};clearImmediate=function(id){delete queue[id]};function run(id){if(has(queue,id)){var fn=queue[id];delete queue[id];fn()}}function listner(event){run(event.data)}if(NODE){defer=function(id){nextTick(part.call(run,id))}}else if(addEventListener&&isFunction(postMessage)&&!global.importScripts){defer=function(id){postMessage(id,"*")};addEventListener("message",listner,false)}else if(isFunction(MessageChannel)){channel=new MessageChannel;port=channel.port2;channel.port1.onmessage=listner;defer=ctx(port.postMessage,port,1)}else if(document&&ONREADYSTATECHANGE in document[CREATE_ELEMENT]("script")){defer=function(id){html.appendChild(document[CREATE_ELEMENT]("script"))[ONREADYSTATECHANGE]=function(){html.removeChild(this);run(id)}}}else{defer=function(id){setTimeout(part.call(run,id),0)}}}("onreadystatechange");$define(GLOBAL+BIND,{setImmediate:setImmediate,clearImmediate:clearImmediate});!function(Promise,test){isFunction(Promise)&&isFunction(Promise.resolve)&&Promise.resolve(test=new Promise(function(){}))==test||function(asap,DEF){function isThenable(o){var then;if(isObject(o))then=o.then;return isFunction(then)?then:false}function notify(def){var chain=def.chain;chain.length&&asap(function(){var msg=def.msg,ok=def.state==1,i=0;while(chain.length>i)!function(react){var cb=ok?react.ok:react.fail,ret,then;try{if(cb){ret=cb===true?msg:cb(msg);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(msg)}catch(err){react.rej(err)}}(chain[i++]);chain.length=0})}function resolve(msg){var def=this,then,wrapper;if(def.done)return;def.done=true;def=def.def||def;try{if(then=isThenable(msg)){wrapper={def:def,done:false};then.call(msg,ctx(resolve,wrapper,1),ctx(reject,wrapper,1))}else{def.msg=msg;def.state=1;notify(def)}}catch(err){reject.call(wrapper||{def:def,done:false},err)}}function reject(msg){var def=this;if(def.done)return;def.done=true;def=def.def||def;def.msg=msg;def.state=2;notify(def)}function getConstructor(C){var S=assertObject(C)[SYMBOL_SPECIES];return S!=undefined?S:C}Promise=function(executor){assertFunction(executor);assertInstance(this,Promise,PROMISE);var def={chain:[],state:0,done:false,msg:undefined};hidden(this,DEF,def);try{executor(ctx(resolve,def,1),ctx(reject,def,1))}catch(err){reject.call(def,err)}};assignHidden(Promise[PROTOTYPE],{then:function(onFulfilled,onRejected){var S=assertObject(assertObject(this)[CONSTRUCTOR])[SYMBOL_SPECIES];var react={ok:isFunction(onFulfilled)?onFulfilled:true,fail:isFunction(onRejected)?onRejected:false},P=react.P=new(S!=undefined?S:Promise)(function(resolve,reject){react.res=assertFunction(resolve);react.rej=assertFunction(reject)}),def=this[DEF];def.chain.push(react);def.state&¬ify(def);return P},"catch":function(onRejected){return this.then(undefined,onRejected)}});assignHidden(Promise,{all:function(iterable){var Promise=getConstructor(this),values=[];return new Promise(function(resolve,reject){forOf(iterable,false,push,values);var remaining=values.length,results=Array(remaining);if(remaining)forEach.call(values,function(promise,index){Promise.resolve(promise).then(function(value){results[index]=value;--remaining||resolve(results)},reject)});else resolve(results)})},race:function(iterable){var Promise=getConstructor(this);return new Promise(function(resolve,reject){forOf(iterable,false,function(promise){Promise.resolve(promise).then(resolve,reject)})})},reject:function(r){return new(getConstructor(this))(function(resolve,reject){reject(r)})},resolve:function(x){return isObject(x)&&DEF in x&&getPrototypeOf(x)===this[PROTOTYPE]?x:new(getConstructor(this))(function(resolve,reject){resolve(x)})}})}(nextTick||setImmediate,safeSymbol("def"));setToStringTag(Promise,PROMISE);setSpecies(Promise);$define(GLOBAL+FORCED*!isNative(Promise),{Promise:Promise})}(global[PROMISE]);!function(){var UID=safeSymbol("uid"),O1=safeSymbol("O1"),WEAK=safeSymbol("weak"),LEAK=safeSymbol("leak"),LAST=safeSymbol("last"),FIRST=safeSymbol("first"),SIZE=DESC?safeSymbol("size"):"size",uid=0,tmp={};function getCollection(C,NAME,methods,commonMethods,isMap,isWeak){var ADDER=isMap?"set":"add",proto=C&&C[PROTOTYPE],O={};function initFromIterable(that,iterable){if(iterable!=undefined)forOf(iterable,isMap,that[ADDER],that);return that}function fixSVZ(key,chain){var method=proto[key];if(framework)proto[key]=function(a,b){var result=method.call(this,a===0?0:a,b);return chain?this:result}}if(!isNative(C)||!(isWeak||!BUGGY_ITERATORS&&has(proto,FOR_EACH)&&has(proto,"entries"))){C=isWeak?function(iterable){assertInstance(this,C,NAME);set(this,UID,uid++);initFromIterable(this,iterable)}:function(iterable){var that=this;assertInstance(that,C,NAME);set(that,O1,create(null));set(that,SIZE,0);set(that,LAST,undefined);set(that,FIRST,undefined);initFromIterable(that,iterable)};assignHidden(assignHidden(C[PROTOTYPE],methods),commonMethods);isWeak||defineProperty(C[PROTOTYPE],"size",{get:function(){return assertDefined(this[SIZE])}})}else{var Native=C,inst=new C,chain=inst[ADDER](isWeak?{}:-0,1),buggyZero;if(!NATIVE_ITERATORS||!C.length){C=function(iterable){assertInstance(this,C,NAME);return initFromIterable(new Native,iterable)};C[PROTOTYPE]=proto;if(framework)proto[CONSTRUCTOR]=C}isWeak||inst[FOR_EACH](function(val,key){buggyZero=1/key===-Infinity});if(buggyZero){fixSVZ("delete");fixSVZ("has");isMap&&fixSVZ("get")}if(buggyZero||chain!==inst)fixSVZ(ADDER,true)}setToStringTag(C,NAME);setSpecies(C);O[NAME]=C;$define(GLOBAL+WRAP+FORCED*!isNative(C),O);isWeak||defineStdIterators(C,NAME,function(iterated,kind){set(this,ITER,{o:iterated,k:kind})},function(){var iter=this[ITER],kind=iter.k,entry=iter.l;while(entry&&entry.r)entry=entry.p;if(!iter.o||!(iter.l=entry=entry?entry.n:iter.o[FIRST])){return iter.o=undefined,iterResult(1)}if(kind==KEY)return iterResult(0,entry.k);if(kind==VALUE)return iterResult(0,entry.v);return iterResult(0,[entry.k,entry.v])},isMap?KEY+VALUE:VALUE,!isMap);return C}function fastKey(it,create){if(!isObject(it))return(typeof it=="string"?"S":"P")+it;if(isFrozen(it))return"F";if(!has(it,UID)){if(!create)return"E";hidden(it,UID,++uid)}return"O"+it[UID]}function getEntry(that,key){var index=fastKey(key),entry;if(index!="F")return that[O1][index];for(entry=that[FIRST];entry;entry=entry.n){if(entry.k==key)return entry}}function def(that,key,value){var entry=getEntry(that,key),prev,index;if(entry)entry.v=value;else{that[LAST]=entry={i:index=fastKey(key,true),k:key,v:value,p:prev=that[LAST],n:undefined,r:false};if(!that[FIRST])that[FIRST]=entry;if(prev)prev.n=entry;that[SIZE]++;if(index!="F")that[O1][index]=entry}return that}var collectionMethods={clear:function(){for(var that=this,data=that[O1],entry=that[FIRST];entry;entry=entry.n){entry.r=true;entry.p=entry.n=undefined;delete data[entry.i]}that[FIRST]=that[LAST]=undefined;that[SIZE]=0},"delete":function(key){var that=this,entry=getEntry(that,key);if(entry){var next=entry.n,prev=entry.p;delete that[O1][entry.i];entry.r=true;if(prev)prev.n=next;if(next)next.p=prev;if(that[FIRST]==entry)that[FIRST]=next;if(that[LAST]==entry)that[LAST]=prev;that[SIZE]--}return!!entry},forEach:function(callbackfn){var f=ctx(callbackfn,arguments[1],3),entry;while(entry=entry?entry.n:this[FIRST]){f(entry.v,entry.k,this);while(entry&&entry.r)entry=entry.p}},has:function(key){return!!getEntry(this,key)}};Map=getCollection(Map,MAP,{get:function(key){var entry=getEntry(this,key);return entry&&entry.v},set:function(key,value){return def(this,key===0?0:key,value)}},collectionMethods,true);Set=getCollection(Set,SET,{add:function(value){return def(this,value=value===0?0:value,value)}},collectionMethods);function defWeak(that,key,value){if(isFrozen(assertObject(key)))leakStore(that).set(key,value);else{has(key,WEAK)||hidden(key,WEAK,{});key[WEAK][that[UID]]=value}return that}function leakStore(that){return that[LEAK]||hidden(that,LEAK,new Map)[LEAK]}var weakMethods={"delete":function(key){if(!isObject(key))return false;if(isFrozen(key))return leakStore(this)["delete"](key);return has(key,WEAK)&&has(key[WEAK],this[UID])&&delete key[WEAK][this[UID]]},has:function(key){if(!isObject(key))return false;if(isFrozen(key))return leakStore(this).has(key);return has(key,WEAK)&&has(key[WEAK],this[UID])}};WeakMap=getCollection(WeakMap,WEAKMAP,{get:function(key){if(isObject(key)){if(isFrozen(key))return leakStore(this).get(key);if(has(key,WEAK))return key[WEAK][this[UID]]}},set:function(key,value){return defWeak(this,key,value)}},weakMethods,true,true);if(framework&&DESC&&new WeakMap([[Object.freeze(tmp),7]]).get(tmp)!=7){forEach.call(array("delete,has,get,set"),function(key){var method=WeakMap[PROTOTYPE][key];WeakMap[PROTOTYPE][key]=function(a,b){if(isObject(a)&&isFrozen(a)){var result=leakStore(this)[key](a,b);return key=="set"?this:result
}return method.call(this,a,b)}})}WeakSet=getCollection(WeakSet,WEAKSET,{add:function(value){return defWeak(this,value,true)}},weakMethods,false,true)}();!function(){function Enumerate(iterated){var keys=[],key;for(key in iterated)keys.push(key);set(this,ITER,{o:iterated,a:keys,i:0})}createIterator(Enumerate,OBJECT,function(){var iter=this[ITER],keys=iter.a,key;do{if(iter.i>=keys.length)return iterResult(1)}while(!((key=keys[iter.i++])in iter.o));return iterResult(0,key)});function wrap(fn){return function(it){assertObject(it);try{return fn.apply(undefined,arguments),true}catch(e){return false}}}function reflectGet(target,propertyKey){var receiver=arguments.length<3?target:arguments[2],desc=getOwnDescriptor(assertObject(target),propertyKey),proto;if(desc)return desc.get?desc.get.call(receiver):desc.value;return isObject(proto=getPrototypeOf(target))?reflectGet(proto,propertyKey,receiver):undefined}function reflectSet(target,propertyKey,V){var receiver=arguments.length<4?target:arguments[3],desc=getOwnDescriptor(assertObject(target),propertyKey),proto;if(desc){if(desc.writable===false)return false;if(desc.set)return desc.set.call(receiver,V),true}if(isObject(proto=getPrototypeOf(target)))return reflectSet(proto,propertyKey,V,receiver);desc=getOwnDescriptor(receiver,propertyKey)||descriptor(0);desc.value=V;return defineProperty(receiver,propertyKey,desc),true}var isExtensible=Object.isExtensible||returnIt;var reflect={apply:ctx(call,apply,3),construct:construct,defineProperty:wrap(defineProperty),deleteProperty:function(target,propertyKey){var desc=getOwnDescriptor(assertObject(target),propertyKey);return desc&&!desc.configurable?false:delete target[propertyKey]},enumerate:function(target){return new Enumerate(assertObject(target))},get:reflectGet,getOwnPropertyDescriptor:function(target,propertyKey){return getOwnDescriptor(assertObject(target),propertyKey)},getPrototypeOf:function(target){return getPrototypeOf(assertObject(target))},has:function(target,propertyKey){return propertyKey in target},isExtensible:function(target){return!!isExtensible(assertObject(target))},ownKeys:ownKeys,preventExtensions:wrap(Object.preventExtensions||returnIt),set:reflectSet};if(setPrototypeOf)reflect.setPrototypeOf=function(target,proto){return setPrototypeOf(assertObject(target),proto),true};$define(GLOBAL,{Reflect:{}});$define(STATIC,"Reflect",reflect)}();!function(){$define(PROTO,ARRAY,{includes:createArrayContains(true)});$define(PROTO,STRING,{at:createPointAt(true)});function createObjectToArray(isEntries){return function(object){var O=toObject(object),keys=getKeys(object),length=keys.length,i=0,result=Array(length),key;if(isEntries)while(length>i)result[i]=[key=keys[i++],O[key]];else while(length>i)result[i]=O[keys[i++]];return result}}$define(STATIC,OBJECT,{values:createObjectToArray(false),entries:createObjectToArray(true)});$define(STATIC,REGEXP,{escape:createReplacer(/([\\\-[\]{}()*+?.,^$|])/g,"\\$1",true)})}();!function(REFERENCE){REFERENCE_GET=getWellKnownSymbol(REFERENCE+"Get",true);var REFERENCE_SET=getWellKnownSymbol(REFERENCE+SET,true),REFERENCE_DELETE=getWellKnownSymbol(REFERENCE+"Delete",true);$define(STATIC,SYMBOL,{referenceGet:REFERENCE_GET,referenceSet:REFERENCE_SET,referenceDelete:REFERENCE_DELETE});hidden(FunctionProto,REFERENCE_GET,returnThis);function setMapMethods(Constructor){if(Constructor){var MapProto=Constructor[PROTOTYPE];hidden(MapProto,REFERENCE_GET,MapProto.get);hidden(MapProto,REFERENCE_SET,MapProto.set);hidden(MapProto,REFERENCE_DELETE,MapProto["delete"])}}setMapMethods(Map);setMapMethods(WeakMap)}("reference");!function(NodeList){if(framework&&NodeList&&!(SYMBOL_ITERATOR in NodeList[PROTOTYPE])){hidden(NodeList[PROTOTYPE],SYMBOL_ITERATOR,Iterators[ARRAY])}Iterators.NodeList=Iterators[ARRAY]}(global.NodeList);!function(arrayStatics){function setArrayStatics(keys,length){forEach.call(array(keys),function(key){if(key in ArrayProto)arrayStatics[key]=ctx(call,ArrayProto[key],length)})}setArrayStatics("pop,reverse,shift,keys,values,entries",1);setArrayStatics("indexOf,every,some,forEach,map,filter,find,findIndex,includes",3);setArrayStatics("join,slice,concat,push,splice,unshift,sort,lastIndexOf,"+"reduce,reduceRight,copyWithin,fill,turn");$define(STATIC,ARRAY,arrayStatics)}({})}(typeof self!="undefined"&&self.Math===Math?self:Function("return this")(),true)},{}],3:[function(require,module,exports){(function(global){!function(global){"use strict";var hasOwn=Object.prototype.hasOwnProperty;var undefined;var iteratorSymbol=typeof Symbol==="function"&&Symbol.iterator||"@@iterator";var inModule=typeof module==="object";var runtime=global.regeneratorRuntime;if(runtime){if(inModule){module.exports=runtime}return}runtime=global.regeneratorRuntime=inModule?module.exports:{};function wrap(innerFn,outerFn,self,tryList){return new Generator(innerFn,outerFn,self||null,tryList||[])}runtime.wrap=wrap;function tryCatch(fn,obj,arg){try{return{type:"normal",arg:fn.call(obj,arg)}}catch(err){return{type:"throw",arg:err}}}var GenStateSuspendedStart="suspendedStart";var GenStateSuspendedYield="suspendedYield";var GenStateExecuting="executing";var GenStateCompleted="completed";var ContinueSentinel={};function 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||(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,tryList){return new Promise(function(resolve,reject){var generator=wrap(innerFn,outerFn,self,tryList);var callNext=step.bind(generator.next);var callThrow=step.bind(generator["throw"]);function step(arg){var record=tryCatch(this,null,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 Generator(innerFn,outerFn,self,tryList){var generator=outerFn?Object.create(outerFn.prototype):this;var context=new Context(tryList);var state=GenStateSuspendedStart;function invoke(method,arg){if(state===GenStateExecuting){throw new Error("Generator is already running")}if(state===GenStateCompleted){return doneResult()}while(true){var delegate=context.delegate;if(delegate){var record=tryCatch(delegate.iterator[method],delegate.iterator,arg);if(record.type==="throw"){context.delegate=null;method="throw";arg=record.arg;continue}method="next";arg=undefined;var info=record.arg;if(info.done){context[delegate.resultName]=info.value;context.next=delegate.nextLoc}else{state=GenStateSuspendedYield;return info}context.delegate=null}if(method==="next"){if(state===GenStateSuspendedStart&&typeof arg!=="undefined"){throw new TypeError("attempt to send "+JSON.stringify(arg)+" to newborn generator")}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)){method="next";arg=undefined}}else if(method==="return"){context.abrupt("return",arg)}state=GenStateExecuting;var record=tryCatch(innerFn,self,context);if(record.type==="normal"){state=context.done?GenStateCompleted:GenStateSuspendedYield;var info={value:record.arg,done:context.done};if(record.arg===ContinueSentinel){if(context.delegate&&method==="next"){arg=undefined}}else{return info}}else if(record.type==="throw"){state=GenStateCompleted;if(method==="next"){context.dispatchException(record.arg)}else{arg=record.arg}}}}generator.next=invoke.bind(generator,"next");generator["throw"]=invoke.bind(generator,"throw");generator["return"]=invoke.bind(generator,"return");return generator}Gp[iteratorSymbol]=function(){return this};Gp.toString=function(){return"[object Generator]"};function pushTryEntry(triple){var entry={tryLoc:triple[0]};if(1 in triple){entry.catchLoc=triple[1]}if(2 in triple){entry.finallyLoc=triple[2]}this.tryEntries.push(entry)}function resetTryEntry(entry,i){var record=entry.completion||{};record.type=i===0?"normal":"return";delete record.arg;entry.completion=record}function Context(tryList){this.tryEntries=[{tryLoc:"root"}];tryList.forEach(pushTryEntry,this);this.reset()}runtime.keys=function(object){var keys=[];for(var key in object){keys.push(key)}keys.reverse();return function next(){while(keys.length){var key=keys.pop();if(key in object){next.value=key;next.done=false;return next}}next.done=true;return next}};function values(iterable){if(iterable){var iteratorMethod=iterable[iteratorSymbol];if(iteratorMethod){return iteratorMethod.call(iterable)}if(typeof iterable.next==="function"){return iterable}if(!isNaN(iterable.length)){var i=-1,next=function next(){while(++i<iterable.length){if(hasOwn.call(iterable,i)){next.value=iterable[i];next.done=false;return next}}next.value=undefined;next.done=true;return next};return next.next=next}}return{next:doneResult}}runtime.values=values;function doneResult(){return{value:undefined,done:true}}Context.prototype={constructor:Context,reset:function(){this.prev=0;this.next=0;this.sent=undefined;this.done=false;this.delegate=null;this.tryEntries.forEach(resetTryEntry);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"){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")}}}},_findFinallyEntry:function(finallyLoc){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc<=this.prev&&hasOwn.call(entry,"finallyLoc")&&(entry.finallyLoc===finallyLoc||this.prev<entry.finallyLoc)){return entry}}},abrupt:function(type,arg){var entry=this._findFinallyEntry();var record=entry?entry.completion:{};record.type=type;record.arg=arg;if(entry){this.next=entry.finallyLoc}else{this.complete(record)}return ContinueSentinel},complete:function(record){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"}return ContinueSentinel},finish:function(finallyLoc){var entry=this._findFinallyEntry(finallyLoc);return this.complete(entry.completion)},"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,i)}return thrown}}throw new Error("illegal catch attempt")},delegateYield:function(iterable,resultName,nextLoc){this.delegate={iterator:values(iterable),resultName:resultName,nextLoc:nextLoc};return ContinueSentinel}}}(typeof global==="object"?global:typeof window==="object"?window:this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}]},{},[1]); |
packages/material-ui-icons/src/DirectionsBoatRounded.js | Kagami/material-ui | import React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<React.Fragment><path fill="none" d="M0 0h24v24H0V0z" /><path d="M20 21c-1.29 0-2.58-.41-3.74-1.14-.16-.1-.37-.1-.53 0-2.31 1.47-5.16 1.47-7.47 0-.16-.1-.37-.1-.53 0C6.58 20.59 5.29 21 4 21H3c-.55 0-1 .45-1 1s.45 1 1 1h1c1.38 0 2.74-.35 4-.99 2.52 1.29 5.48 1.29 8 0 1.26.65 2.62.99 4 .99h1c.55 0 1-.45 1-1s-.45-1-1-1h-1zM3.95 19H4c1.42 0 2.7-.7 3.66-1.64.19-.18.5-.18.69 0C9.3 18.3 10.58 19 12 19s2.7-.7 3.66-1.64c.19-.19.49-.19.69 0C17.3 18.3 18.58 19 20 19h.05l1.89-6.68c.08-.26.06-.54-.06-.78s-.34-.42-.6-.5L20 10.62V6c0-1.1-.9-2-2-2h-3V2c0-.55-.45-1-1-1h-4c-.55 0-1 .45-1 1v2H6c-1.1 0-2 .9-2 2v4.62l-1.29.42c-.26.08-.48.26-.6.5s-.15.52-.06.78L3.95 19zM7 6h10c.55 0 1 .45 1 1v2.97L12.62 8.2c-.41-.13-.84-.13-1.25 0L6 9.97V7c0-.55.45-1 1-1z" /></React.Fragment>
, 'DirectionsBoatRounded');
|
src/Grid/Grid.spec.js | dsslimshaddy/material-ui | // @flow
import React from 'react';
import { assert } from 'chai';
import forOwn from 'lodash/forOwn';
import { createShallow, getClasses } from '../test-utils';
import Hidden from '../Hidden';
import Grid from './Grid';
describe('<Grid />', () => {
let shallow;
let classes;
before(() => {
const shallowInner = createShallow({ dive: true });
// Render deeper to bypass the GridWrapper.
shallow = node => {
return shallowInner(node).find('Grid').shallow({
context: shallowInner.context,
});
};
classes = getClasses(<Grid />);
});
it('should render', () => {
const wrapper = shallow(<Grid className="woofGrid" />);
assert.strictEqual(wrapper.name(), 'div');
assert.strictEqual(wrapper.hasClass('woofGrid'), true, 'should have the user class');
});
describe('prop: container', () => {
it('should apply the container class', () => {
const wrapper = shallow(<Grid container />);
assert.strictEqual(wrapper.hasClass(classes.typeContainer), true);
});
});
describe('prop: item', () => {
it('should apply the item class', () => {
const wrapper = shallow(<Grid item />);
assert.strictEqual(wrapper.hasClass(classes.typeItem), true);
});
});
describe('prop: component', () => {
it('should change the component', () => {
const wrapper = shallow(<Grid component="span" />);
assert.strictEqual(wrapper.name(), 'span');
});
});
describe('prop: xs', () => {
it('should apply the flex-grow class', () => {
const wrapper = shallow(<Grid item xs />);
assert.strictEqual(wrapper.hasClass(classes['grid-xs']), true);
});
it('should apply the flex size class', () => {
const wrapper = shallow(<Grid item xs={3} />);
assert.strictEqual(wrapper.hasClass(classes['grid-xs-3']), true);
});
});
describe('prop: spacing', () => {
it('should have a default spacing', () => {
const wrapper = shallow(<Grid container />);
assert.strictEqual(wrapper.hasClass(classes['spacing-xs-16']), true);
});
});
describe('prop: other', () => {
it('should spread the other properties to the root element', () => {
const handleClick = () => {};
const wrapper = shallow(<Grid component="span" onClick={handleClick} />);
assert.strictEqual(wrapper.props().onClick, handleClick);
});
});
describe('hidden', () => {
const hiddenProps = {
onlyHidden: 'xs',
xsUpHidden: true,
smUpHidden: true,
mdUpHidden: true,
lgUpHidden: true,
xlUpHidden: true,
xsDownHidden: true,
smDownHidden: true,
mdDownHidden: true,
lgDownHidden: true,
xlDownHidden: true,
};
forOwn(hiddenProps, (value, key) => {
it(`should render ${key} with Hidden`, () => {
const wrapper = shallow(<Grid hidden={{ [key]: value }} />);
assert.strictEqual(wrapper.type(), Hidden);
});
});
});
});
|
src/esm/components/navigation/header-nav/components/button.js | KissKissBankBank/kitten | import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
var _excluded = ["a11yText", "icon", "backgroundColor", "backgroundColorHover", "color", "colorHover", "text", "href", "type", "hiddenText", "as", "style", "className", "smallPadding"];
import React from 'react';
import classNames from 'classnames';
import PropTypes from 'prop-types';
import COLORS from '../../../../constants/colors-config';
import { VisuallyHidden } from '../../../accessibility/visually-hidden';
export var Button = function Button(_ref) {
var a11yText = _ref.a11yText,
icon = _ref.icon,
backgroundColor = _ref.backgroundColor,
backgroundColorHover = _ref.backgroundColorHover,
color = _ref.color,
colorHover = _ref.colorHover,
text = _ref.text,
href = _ref.href,
type = _ref.type,
_ref$hiddenText = _ref.hiddenText;
_ref$hiddenText = _ref$hiddenText === void 0 ? {} : _ref$hiddenText;
var min = _ref$hiddenText.min,
max = _ref$hiddenText.max,
as = _ref.as,
style = _ref.style,
className = _ref.className,
smallPadding = _ref.smallPadding,
props = _objectWithoutPropertiesLoose(_ref, _excluded);
var hiddenMin = min ? "k-u-hidden@" + min + "-up" : '';
var hiddenMax = max ? "k-u-hidden@" + max + "-down" : '';
var textClassName = ("k-HeaderNav__Button__text " + hiddenMin + " " + hiddenMax).trim();
var ButtonComponent = 'a';
var buttonProps = {
href: href
};
if (!!as) {
if (as === 'button') {
ButtonComponent = as;
buttonProps = {
type: 'button'
};
} else {
ButtonComponent = as;
buttonProps = {};
}
} else if (type === 'button') {
ButtonComponent = 'button';
buttonProps = {
type: type
};
}
return /*#__PURE__*/React.createElement(ButtonComponent, _extends({}, props, buttonProps, {
className: classNames('k-HeaderNav__Button', className, {
'k-HeaderNav__Button--hasIcon': !!icon,
'k-HeaderNav__Button--hasText': !!text,
'k-HeaderNav__Button--smallPadding': smallPadding
}),
style: _extends({
'--HeaderMenu-Button-backgroundColor': backgroundColor,
'--HeaderMenu-Button-backgroundColorHover': backgroundColorHover,
'--HeaderMenu-Button-color': color,
'--HeaderMenu-Button-colorHover': colorHover
}, style)
}), text && /*#__PURE__*/React.createElement("span", {
className: textClassName
}), icon && /*#__PURE__*/React.cloneElement(icon, {
'aria-hidden': true
}), icon && a11yText && /*#__PURE__*/React.createElement(VisuallyHidden, null, a11yText), text && /*#__PURE__*/React.createElement("span", {
className: textClassName
}, text));
};
Button.propTypes = {
icon: PropTypes.node,
backgroundColor: PropTypes.string,
backgroundColorHover: PropTypes.string,
color: PropTypes.string,
colorHover: PropTypes.string,
text: PropTypes.node,
href: PropTypes.string,
a11yText: PropTypes.string,
type: PropTypes.oneOf(['button']),
hiddenText: PropTypes.shape({
min: PropTypes.string,
max: PropTypes.string
}),
smallPadding: PropTypes.bool
};
Button.defaultProps = {
icon: null,
backgroundColor: 'transparent',
backgroundColorHover: 'transparent',
color: COLORS.font1,
colorHover: COLORS.primary1,
text: null,
smallPadding: false
}; |
ajax/libs/rxjs/2.2.22/rx.js | coupang/cdnjs | // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
;(function (undefined) {
var objectTypes = {
'boolean': false,
'function': true,
'object': true,
'number': false,
'string': false,
'undefined': false
};
var root = (objectTypes[typeof window] && window) || this,
freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports,
freeModule = objectTypes[typeof module] && module && !module.nodeType && module,
moduleExports = freeModule && freeModule.exports === freeExports && freeExports,
freeGlobal = objectTypes[typeof global] && global;
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) {
root = freeGlobal;
}
var Rx = {
internals: {},
config: {
Promise: root.Promise // Detect if promise exists
},
helpers: { }
};
// Defaults
var noop = Rx.helpers.noop = function () { },
identity = Rx.helpers.identity = function (x) { return x; },
defaultNow = Rx.helpers.defaultNow = Date.now,
defaultComparer = Rx.helpers.defaultComparer = function (x, y) { return isEqual(x, y); },
defaultSubComparer = Rx.helpers.defaultSubComparer = function (x, y) { return x > y ? 1 : (x < y ? -1 : 0); },
defaultKeySerializer = Rx.helpers.defaultKeySerializer = function (x) { return x.toString(); },
defaultError = Rx.helpers.defaultError = function (err) { throw err; },
isPromise = Rx.helpers.isPromise = function (p) { return !!p && typeof p.then === 'function' && p.then !== Rx.Observable.prototype.then; },
asArray = Rx.helpers.asArray = function () { return Array.prototype.slice.call(arguments); },
not = Rx.helpers.not = function (a) { return !a; };
// Errors
var sequenceContainsNoElements = 'Sequence contains no elements.';
var argumentOutOfRange = 'Argument out of range';
var objectDisposed = 'Object has been disposed';
function checkDisposed() { if (this.isDisposed) { throw new Error(objectDisposed); } }
// Shim in iterator support
var $iterator$ = (typeof Symbol === 'object' && Symbol.iterator) ||
'_es6shim_iterator_';
// Firefox ships a partial implementation using the name @@iterator.
// https://bugzilla.mozilla.org/show_bug.cgi?id=907077#c14
// So use that name if we detect it.
if (root.Set && typeof new root.Set()['@@iterator'] === 'function') {
$iterator$ = '@@iterator';
}
var doneEnumerator = { done: true, value: undefined };
/** `Object#toString` result shortcuts */
var argsClass = '[object Arguments]',
arrayClass = '[object Array]',
boolClass = '[object Boolean]',
dateClass = '[object Date]',
errorClass = '[object Error]',
funcClass = '[object Function]',
numberClass = '[object Number]',
objectClass = '[object Object]',
regexpClass = '[object RegExp]',
stringClass = '[object String]';
var toString = Object.prototype.toString,
hasOwnProperty = Object.prototype.hasOwnProperty,
supportsArgsClass = toString.call(arguments) == argsClass, // For less <IE9 && FF<4
suportNodeClass,
errorProto = Error.prototype,
objectProto = Object.prototype,
propertyIsEnumerable = objectProto.propertyIsEnumerable;
try {
suportNodeClass = !(toString.call(document) == objectClass && !({ 'toString': 0 } + ''));
} catch(e) {
suportNodeClass = true;
}
var shadowedProps = [
'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf'
];
var nonEnumProps = {};
nonEnumProps[arrayClass] = nonEnumProps[dateClass] = nonEnumProps[numberClass] = { 'constructor': true, 'toLocaleString': true, 'toString': true, 'valueOf': true };
nonEnumProps[boolClass] = nonEnumProps[stringClass] = { 'constructor': true, 'toString': true, 'valueOf': true };
nonEnumProps[errorClass] = nonEnumProps[funcClass] = nonEnumProps[regexpClass] = { 'constructor': true, 'toString': true };
nonEnumProps[objectClass] = { 'constructor': true };
var support = {};
(function () {
var ctor = function() { this.x = 1; },
props = [];
ctor.prototype = { 'valueOf': 1, 'y': 1 };
for (var key in new ctor) { props.push(key); }
for (key in arguments) { }
// Detect if `name` or `message` properties of `Error.prototype` are enumerable by default.
support.enumErrorProps = propertyIsEnumerable.call(errorProto, 'message') || propertyIsEnumerable.call(errorProto, 'name');
// Detect if `prototype` properties are enumerable by default.
support.enumPrototypes = propertyIsEnumerable.call(ctor, 'prototype');
// Detect if `arguments` object indexes are non-enumerable
support.nonEnumArgs = key != 0;
// Detect if properties shadowing those on `Object.prototype` are non-enumerable.
support.nonEnumShadows = !/valueOf/.test(props);
}(1));
function isObject(value) {
// check if the value is the ECMAScript language type of Object
// http://es5.github.io/#x8
// and avoid a V8 bug
// https://code.google.com/p/v8/issues/detail?id=2291
var type = typeof value;
return value && (type == 'function' || type == 'object') || false;
}
function keysIn(object) {
var result = [];
if (!isObject(object)) {
return result;
}
if (support.nonEnumArgs && object.length && isArguments(object)) {
object = slice.call(object);
}
var skipProto = support.enumPrototypes && typeof object == 'function',
skipErrorProps = support.enumErrorProps && (object === errorProto || object instanceof Error);
for (var key in object) {
if (!(skipProto && key == 'prototype') &&
!(skipErrorProps && (key == 'message' || key == 'name'))) {
result.push(key);
}
}
if (support.nonEnumShadows && object !== objectProto) {
var ctor = object.constructor,
index = -1,
length = shadowedProps.length;
if (object === (ctor && ctor.prototype)) {
var className = object === stringProto ? stringClass : object === errorProto ? errorClass : toString.call(object),
nonEnum = nonEnumProps[className];
}
while (++index < length) {
key = shadowedProps[index];
if (!(nonEnum && nonEnum[key]) && hasOwnProperty.call(object, key)) {
result.push(key);
}
}
}
return result;
}
function internalFor(object, callback, keysFunc) {
var index = -1,
props = keysFunc(object),
length = props.length;
while (++index < length) {
var key = props[index];
if (callback(object[key], key, object) === false) {
break;
}
}
return object;
}
function internalForIn(object, callback) {
return internalFor(object, callback, keysIn);
}
function isNode(value) {
// IE < 9 presents DOM nodes as `Object` objects except they have `toString`
// methods that are `typeof` "string" and still can coerce nodes to strings
return typeof value.toString != 'function' && typeof (value + '') == 'string';
}
function isArguments(value) {
return (value && typeof value == 'object') ? toString.call(value) == argsClass : false;
}
// fallback for browsers that can't detect `arguments` objects by [[Class]]
if (!supportsArgsClass) {
isArguments = function(value) {
return (value && typeof value == 'object') ? hasOwnProperty.call(value, 'callee') : false;
};
}
function isFunction(value) {
return typeof value == 'function';
}
// fallback for older versions of Chrome and Safari
if (isFunction(/x/)) {
isFunction = function(value) {
return typeof value == 'function' && toString.call(value) == funcClass;
};
}
var isEqual = Rx.internals.isEqual = function (x, y) {
return deepEquals(x, y, [], []);
};
/** @private
* Used for deep comparison
**/
function deepEquals(a, b, stackA, stackB) {
// exit early for identical values
if (a === b) {
// treat `+0` vs. `-0` as not equal
return a !== 0 || (1 / a == 1 / b);
}
var type = typeof a,
otherType = typeof b;
// exit early for unlike primitive values
if (a === a && (a == null || b == null ||
(type != 'function' && type != 'object' && otherType != 'function' && otherType != 'object'))) {
return false;
}
// compare [[Class]] names
var className = toString.call(a),
otherClass = toString.call(b);
if (className == argsClass) {
className = objectClass;
}
if (otherClass == argsClass) {
otherClass = objectClass;
}
if (className != otherClass) {
return false;
}
switch (className) {
case boolClass:
case dateClass:
// coerce dates and booleans to numbers, dates to milliseconds and booleans
// to `1` or `0` treating invalid dates coerced to `NaN` as not equal
return +a == +b;
case numberClass:
// treat `NaN` vs. `NaN` as equal
return (a != +a)
? b != +b
// but treat `-0` vs. `+0` as not equal
: (a == 0 ? (1 / a == 1 / b) : a == +b);
case regexpClass:
case stringClass:
// coerce regexes to strings (http://es5.github.io/#x15.10.6.4)
// treat string primitives and their corresponding object instances as equal
return a == String(b);
}
var isArr = className == arrayClass;
if (!isArr) {
// exit for functions and DOM nodes
if (className != objectClass || (!support.nodeClass && (isNode(a) || isNode(b)))) {
return false;
}
// in older versions of Opera, `arguments` objects have `Array` constructors
var ctorA = !support.argsObject && isArguments(a) ? Object : a.constructor,
ctorB = !support.argsObject && isArguments(b) ? Object : b.constructor;
// non `Object` object instances with different constructors are not equal
if (ctorA != ctorB &&
!(hasOwnProperty.call(a, 'constructor') && hasOwnProperty.call(b, 'constructor')) &&
!(isFunction(ctorA) && ctorA instanceof ctorA && isFunction(ctorB) && ctorB instanceof ctorB) &&
('constructor' in a && 'constructor' in b)
) {
return false;
}
}
// assume cyclic structures are equal
// the algorithm for detecting cyclic structures is adapted from ES 5.1
// section 15.12.3, abstract operation `JO` (http://es5.github.io/#x15.12.3)
var initedStack = !stackA;
stackA || (stackA = []);
stackB || (stackB = []);
var length = stackA.length;
while (length--) {
if (stackA[length] == a) {
return stackB[length] == b;
}
}
var size = 0;
result = true;
// add `a` and `b` to the stack of traversed objects
stackA.push(a);
stackB.push(b);
// recursively compare objects and arrays (susceptible to call stack limits)
if (isArr) {
// compare lengths to determine if a deep comparison is necessary
length = a.length;
size = b.length;
result = size == length;
if (result) {
// deep compare the contents, ignoring non-numeric properties
while (size--) {
var index = length,
value = b[size];
if (!(result = deepEquals(a[size], value, stackA, stackB))) {
break;
}
}
}
}
else {
// deep compare objects using `forIn`, instead of `forOwn`, to avoid `Object.keys`
// which, in this case, is more costly
internalForIn(b, function(value, key, b) {
if (hasOwnProperty.call(b, key)) {
// count the number of properties.
size++;
// deep compare each property value.
return (result = hasOwnProperty.call(a, key) && deepEquals(a[key], value, stackA, stackB));
}
});
if (result) {
// ensure both objects have the same number of properties
internalForIn(a, function(value, key, a) {
if (hasOwnProperty.call(a, key)) {
// `size` will be `-1` if `a` has more properties than `b`
return (result = --size > -1);
}
});
}
}
stackA.pop();
stackB.pop();
return result;
}
var slice = Array.prototype.slice;
function argsOrArray(args, idx) {
return args.length === 1 && Array.isArray(args[idx]) ?
args[idx] :
slice.call(args);
}
var hasProp = {}.hasOwnProperty;
/** @private */
var inherits = this.inherits = Rx.internals.inherits = function (child, parent) {
function __() { this.constructor = child; }
__.prototype = parent.prototype;
child.prototype = new __();
};
/** @private */
var addProperties = Rx.internals.addProperties = function (obj) {
var sources = slice.call(arguments, 1);
for (var i = 0, len = sources.length; i < len; i++) {
var source = sources[i];
for (var prop in source) {
obj[prop] = source[prop];
}
}
};
// Rx Utils
var addRef = Rx.internals.addRef = function (xs, r) {
return new AnonymousObservable(function (observer) {
return new CompositeDisposable(r.getDisposable(), xs.subscribe(observer));
});
};
// Collection polyfills
function arrayInitialize(count, factory) {
var a = new Array(count);
for (var i = 0; i < count; i++) {
a[i] = factory();
}
return a;
}
// Collections
var IndexedItem = function (id, value) {
this.id = id;
this.value = value;
};
IndexedItem.prototype.compareTo = function (other) {
var c = this.value.compareTo(other.value);
if (c === 0) {
c = this.id - other.id;
}
return c;
};
// Priority Queue for Scheduling
var PriorityQueue = Rx.internals.PriorityQueue = function (capacity) {
this.items = new Array(capacity);
this.length = 0;
};
var priorityProto = PriorityQueue.prototype;
priorityProto.isHigherPriority = function (left, right) {
return this.items[left].compareTo(this.items[right]) < 0;
};
priorityProto.percolate = function (index) {
if (index >= this.length || index < 0) {
return;
}
var parent = index - 1 >> 1;
if (parent < 0 || parent === index) {
return;
}
if (this.isHigherPriority(index, parent)) {
var temp = this.items[index];
this.items[index] = this.items[parent];
this.items[parent] = temp;
this.percolate(parent);
}
};
priorityProto.heapify = function (index) {
if (index === undefined) {
index = 0;
}
if (index >= this.length || index < 0) {
return;
}
var left = 2 * index + 1,
right = 2 * index + 2,
first = index;
if (left < this.length && this.isHigherPriority(left, first)) {
first = left;
}
if (right < this.length && this.isHigherPriority(right, first)) {
first = right;
}
if (first !== index) {
var temp = this.items[index];
this.items[index] = this.items[first];
this.items[first] = temp;
this.heapify(first);
}
};
priorityProto.peek = function () { return this.items[0].value; };
priorityProto.removeAt = function (index) {
this.items[index] = this.items[--this.length];
delete this.items[this.length];
this.heapify();
};
priorityProto.dequeue = function () {
var result = this.peek();
this.removeAt(0);
return result;
};
priorityProto.enqueue = function (item) {
var index = this.length++;
this.items[index] = new IndexedItem(PriorityQueue.count++, item);
this.percolate(index);
};
priorityProto.remove = function (item) {
for (var i = 0; i < this.length; i++) {
if (this.items[i].value === item) {
this.removeAt(i);
return true;
}
}
return false;
};
PriorityQueue.count = 0;
/**
* Represents a group of disposable resources that are disposed together.
* @constructor
*/
var CompositeDisposable = Rx.CompositeDisposable = function () {
this.disposables = argsOrArray(arguments, 0);
this.isDisposed = false;
this.length = this.disposables.length;
};
var CompositeDisposablePrototype = CompositeDisposable.prototype;
/**
* Adds a disposable to the CompositeDisposable or disposes the disposable if the CompositeDisposable is disposed.
* @param {Mixed} item Disposable to add.
*/
CompositeDisposablePrototype.add = function (item) {
if (this.isDisposed) {
item.dispose();
} else {
this.disposables.push(item);
this.length++;
}
};
/**
* Removes and disposes the first occurrence of a disposable from the CompositeDisposable.
* @param {Mixed} item Disposable to remove.
* @returns {Boolean} true if found; false otherwise.
*/
CompositeDisposablePrototype.remove = function (item) {
var shouldDispose = false;
if (!this.isDisposed) {
var idx = this.disposables.indexOf(item);
if (idx !== -1) {
shouldDispose = true;
this.disposables.splice(idx, 1);
this.length--;
item.dispose();
}
}
return shouldDispose;
};
/**
* Disposes all disposables in the group and removes them from the group.
*/
CompositeDisposablePrototype.dispose = function () {
if (!this.isDisposed) {
this.isDisposed = true;
var currentDisposables = this.disposables.slice(0);
this.disposables = [];
this.length = 0;
for (var i = 0, len = currentDisposables.length; i < len; i++) {
currentDisposables[i].dispose();
}
}
};
/**
* Removes and disposes all disposables from the CompositeDisposable, but does not dispose the CompositeDisposable.
*/
CompositeDisposablePrototype.clear = function () {
var currentDisposables = this.disposables.slice(0);
this.disposables = [];
this.length = 0;
for (var i = 0, len = currentDisposables.length; i < len; i++) {
currentDisposables[i].dispose();
}
};
/**
* Determines whether the CompositeDisposable contains a specific disposable.
* @param {Mixed} item Disposable to search for.
* @returns {Boolean} true if the disposable was found; otherwise, false.
*/
CompositeDisposablePrototype.contains = function (item) {
return this.disposables.indexOf(item) !== -1;
};
/**
* Converts the existing CompositeDisposable to an array of disposables
* @returns {Array} An array of disposable objects.
*/
CompositeDisposablePrototype.toArray = function () {
return this.disposables.slice(0);
};
/**
* Provides a set of static methods for creating Disposables.
*
* @constructor
* @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once.
*/
var Disposable = Rx.Disposable = function (action) {
this.isDisposed = false;
this.action = action || noop;
};
/** Performs the task of cleaning up resources. */
Disposable.prototype.dispose = function () {
if (!this.isDisposed) {
this.action();
this.isDisposed = true;
}
};
/**
* Creates a disposable object that invokes the specified action when disposed.
* @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once.
* @return {Disposable} The disposable object that runs the given action upon disposal.
*/
var disposableCreate = Disposable.create = function (action) { return new Disposable(action); };
/**
* Gets the disposable that does nothing when disposed.
*/
var disposableEmpty = Disposable.empty = { dispose: noop };
var BooleanDisposable = (function () {
function BooleanDisposable (isSingle) {
this.isSingle = isSingle;
this.isDisposed = false;
this.current = null;
}
var booleanDisposablePrototype = BooleanDisposable.prototype;
/**
* Gets the underlying disposable.
* @return The underlying disposable.
*/
booleanDisposablePrototype.getDisposable = function () {
return this.current;
};
/**
* Sets the underlying disposable.
* @param {Disposable} value The new underlying disposable.
*/
booleanDisposablePrototype.setDisposable = function (value) {
if (this.current && this.isSingle) {
throw new Error('Disposable has already been assigned');
}
var shouldDispose = this.isDisposed, old;
if (!shouldDispose) {
old = this.current;
this.current = value;
}
if (old) {
old.dispose();
}
if (shouldDispose && value) {
value.dispose();
}
};
/**
* Disposes the underlying disposable as well as all future replacements.
*/
booleanDisposablePrototype.dispose = function () {
var old;
if (!this.isDisposed) {
this.isDisposed = true;
old = this.current;
this.current = null;
}
if (old) {
old.dispose();
}
};
return BooleanDisposable;
}());
/**
* Represents a disposable resource which only allows a single assignment of its underlying disposable resource.
* If an underlying disposable resource has already been set, future attempts to set the underlying disposable resource will throw an Error.
*/
var SingleAssignmentDisposable = Rx.SingleAssignmentDisposable = (function (super_) {
inherits(SingleAssignmentDisposable, super_);
function SingleAssignmentDisposable() {
super_.call(this, true);
}
return SingleAssignmentDisposable;
}(BooleanDisposable));
/**
* Represents a disposable resource whose underlying disposable resource can be replaced by another disposable resource, causing automatic disposal of the previous underlying disposable resource.
*/
var SerialDisposable = Rx.SerialDisposable = (function (super_) {
inherits(SerialDisposable, super_);
function SerialDisposable() {
super_.call(this, false);
}
return SerialDisposable;
}(BooleanDisposable));
/**
* Represents a disposable resource that only disposes its underlying disposable resource when all dependent disposable objects have been disposed.
*/
var RefCountDisposable = Rx.RefCountDisposable = (function () {
function InnerDisposable(disposable) {
this.disposable = disposable;
this.disposable.count++;
this.isInnerDisposed = false;
}
InnerDisposable.prototype.dispose = function () {
if (!this.disposable.isDisposed) {
if (!this.isInnerDisposed) {
this.isInnerDisposed = true;
this.disposable.count--;
if (this.disposable.count === 0 && this.disposable.isPrimaryDisposed) {
this.disposable.isDisposed = true;
this.disposable.underlyingDisposable.dispose();
}
}
}
};
/**
* Initializes a new instance of the RefCountDisposable with the specified disposable.
* @constructor
* @param {Disposable} disposable Underlying disposable.
*/
function RefCountDisposable(disposable) {
this.underlyingDisposable = disposable;
this.isDisposed = false;
this.isPrimaryDisposed = false;
this.count = 0;
}
/**
* Disposes the underlying disposable only when all dependent disposables have been disposed
*/
RefCountDisposable.prototype.dispose = function () {
if (!this.isDisposed) {
if (!this.isPrimaryDisposed) {
this.isPrimaryDisposed = true;
if (this.count === 0) {
this.isDisposed = true;
this.underlyingDisposable.dispose();
}
}
}
};
/**
* Returns a dependent disposable that when disposed decreases the refcount on the underlying disposable.
* @returns {Disposable} A dependent disposable contributing to the reference count that manages the underlying disposable's lifetime.
*/
RefCountDisposable.prototype.getDisposable = function () {
return this.isDisposed ? disposableEmpty : new InnerDisposable(this);
};
return RefCountDisposable;
})();
function ScheduledDisposable(scheduler, disposable) {
this.scheduler = scheduler;
this.disposable = disposable;
this.isDisposed = false;
}
ScheduledDisposable.prototype.dispose = function () {
var parent = this;
this.scheduler.schedule(function () {
if (!parent.isDisposed) {
parent.isDisposed = true;
parent.disposable.dispose();
}
});
};
var ScheduledItem = Rx.internals.ScheduledItem = function (scheduler, state, action, dueTime, comparer) {
this.scheduler = scheduler;
this.state = state;
this.action = action;
this.dueTime = dueTime;
this.comparer = comparer || defaultSubComparer;
this.disposable = new SingleAssignmentDisposable();
}
ScheduledItem.prototype.invoke = function () {
this.disposable.setDisposable(this.invokeCore());
};
ScheduledItem.prototype.compareTo = function (other) {
return this.comparer(this.dueTime, other.dueTime);
};
ScheduledItem.prototype.isCancelled = function () {
return this.disposable.isDisposed;
};
ScheduledItem.prototype.invokeCore = function () {
return this.action(this.scheduler, this.state);
};
/** Provides a set of static properties to access commonly used schedulers. */
var Scheduler = Rx.Scheduler = (function () {
/**
* @constructor
* @private
*/
function Scheduler(now, schedule, scheduleRelative, scheduleAbsolute) {
this.now = now;
this._schedule = schedule;
this._scheduleRelative = scheduleRelative;
this._scheduleAbsolute = scheduleAbsolute;
}
function invokeRecImmediate(scheduler, pair) {
var state = pair.first, action = pair.second, group = new CompositeDisposable(),
recursiveAction = function (state1) {
action(state1, function (state2) {
var isAdded = false, isDone = false,
d = scheduler.scheduleWithState(state2, function (scheduler1, state3) {
if (isAdded) {
group.remove(d);
} else {
isDone = true;
}
recursiveAction(state3);
return disposableEmpty;
});
if (!isDone) {
group.add(d);
isAdded = true;
}
});
};
recursiveAction(state);
return group;
}
function invokeRecDate(scheduler, pair, method) {
var state = pair.first, action = pair.second, group = new CompositeDisposable(),
recursiveAction = function (state1) {
action(state1, function (state2, dueTime1) {
var isAdded = false, isDone = false,
d = scheduler[method].call(scheduler, state2, dueTime1, function (scheduler1, state3) {
if (isAdded) {
group.remove(d);
} else {
isDone = true;
}
recursiveAction(state3);
return disposableEmpty;
});
if (!isDone) {
group.add(d);
isAdded = true;
}
});
};
recursiveAction(state);
return group;
}
function invokeAction(scheduler, action) {
action();
return disposableEmpty;
}
var schedulerProto = Scheduler.prototype;
/**
* Returns a scheduler that wraps the original scheduler, adding exception handling for scheduled actions.
* @param {Function} handler Handler that's run if an exception is caught. The exception will be rethrown if the handler returns false.
* @returns {Scheduler} Wrapper around the original scheduler, enforcing exception handling.
*/
schedulerProto.catchException = schedulerProto['catch'] = function (handler) {
return new CatchScheduler(this, handler);
};
/**
* Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be scheduled using window.setInterval for the base implementation.
* @param {Number} period Period for running the work periodically.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort).
*/
schedulerProto.schedulePeriodic = function (period, action) {
return this.schedulePeriodicWithState(null, period, function () {
action();
});
};
/**
* Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be scheduled using window.setInterval for the base implementation.
* @param {Mixed} state Initial state passed to the action upon the first iteration.
* @param {Number} period Period for running the work periodically.
* @param {Function} action Action to be executed, potentially updating the state.
* @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort).
*/
schedulerProto.schedulePeriodicWithState = function (state, period, action) {
var s = state, id = setInterval(function () {
s = action(s);
}, period);
return disposableCreate(function () {
clearInterval(id);
});
};
/**
* Schedules an action to be executed.
* @param {Function} action Action to execute.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.schedule = function (action) {
return this._schedule(action, invokeAction);
};
/**
* Schedules an action to be executed.
* @param state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithState = function (state, action) {
return this._schedule(state, action);
};
/**
* Schedules an action to be executed after the specified relative due time.
* @param {Function} action Action to execute.
* @param {Number} dueTime Relative time after which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithRelative = function (dueTime, action) {
return this._scheduleRelative(action, dueTime, invokeAction);
};
/**
* Schedules an action to be executed after dueTime.
* @param state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @param {Number} dueTime Relative time after which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithRelativeAndState = function (state, dueTime, action) {
return this._scheduleRelative(state, dueTime, action);
};
/**
* Schedules an action to be executed at the specified absolute due time.
* @param {Function} action Action to execute.
* @param {Number} dueTime Absolute time at which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithAbsolute = function (dueTime, action) {
return this._scheduleAbsolute(action, dueTime, invokeAction);
};
/**
* Schedules an action to be executed at dueTime.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @param {Number}dueTime Absolute time at which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithAbsoluteAndState = function (state, dueTime, action) {
return this._scheduleAbsolute(state, dueTime, action);
};
/**
* Schedules an action to be executed recursively.
* @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursive = function (action) {
return this.scheduleRecursiveWithState(action, function (_action, self) {
_action(function () {
self(_action);
});
});
};
/**
* Schedules an action to be executed recursively.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in recursive invocation state.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithState = function (state, action) {
return this.scheduleWithState({ first: state, second: action }, function (s, p) {
return invokeRecImmediate(s, p);
});
};
/**
* Schedules an action to be executed recursively after a specified relative due time.
* @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action at the specified relative time.
* @param {Number}dueTime Relative time after which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithRelative = function (dueTime, action) {
return this.scheduleRecursiveWithRelativeAndState(action, dueTime, function (_action, self) {
_action(function (dt) {
self(_action, dt);
});
});
};
/**
* Schedules an action to be executed recursively after a specified relative due time.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state.
* @param {Number}dueTime Relative time after which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithRelativeAndState = function (state, dueTime, action) {
return this._scheduleRelative({ first: state, second: action }, dueTime, function (s, p) {
return invokeRecDate(s, p, 'scheduleWithRelativeAndState');
});
};
/**
* Schedules an action to be executed recursively at a specified absolute due time.
* @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action at the specified absolute time.
* @param {Number}dueTime Absolute time at which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithAbsolute = function (dueTime, action) {
return this.scheduleRecursiveWithAbsoluteAndState(action, dueTime, function (_action, self) {
_action(function (dt) {
self(_action, dt);
});
});
};
/**
* Schedules an action to be executed recursively at a specified absolute due time.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state.
* @param {Number}dueTime Absolute time at which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithAbsoluteAndState = function (state, dueTime, action) {
return this._scheduleAbsolute({ first: state, second: action }, dueTime, function (s, p) {
return invokeRecDate(s, p, 'scheduleWithAbsoluteAndState');
});
};
/** Gets the current time according to the local machine's system clock. */
Scheduler.now = defaultNow;
/**
* Normalizes the specified TimeSpan value to a positive value.
* @param {Number} timeSpan The time span value to normalize.
* @returns {Number} The specified TimeSpan value if it is zero or positive; otherwise, 0
*/
Scheduler.normalize = function (timeSpan) {
if (timeSpan < 0) {
timeSpan = 0;
}
return timeSpan;
};
return Scheduler;
}());
var normalizeTime = Scheduler.normalize;
var SchedulePeriodicRecursive = Rx.internals.SchedulePeriodicRecursive = (function () {
function tick(command, recurse) {
recurse(0, this._period);
try {
this._state = this._action(this._state);
} catch (e) {
this._cancel.dispose();
throw e;
}
}
function SchedulePeriodicRecursive(scheduler, state, period, action) {
this._scheduler = scheduler;
this._state = state;
this._period = period;
this._action = action;
}
SchedulePeriodicRecursive.prototype.start = function () {
var d = new SingleAssignmentDisposable();
this._cancel = d;
d.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0, this._period, tick.bind(this)));
return d;
};
return SchedulePeriodicRecursive;
}());
/**
* Gets a scheduler that schedules work immediately on the current thread.
*/
var immediateScheduler = Scheduler.immediate = (function () {
function scheduleNow(state, action) { return action(this, state); }
function scheduleRelative(state, dueTime, action) {
var dt = normalizeTime(dt);
while (dt - this.now() > 0) { }
return action(this, state);
}
function scheduleAbsolute(state, dueTime, action) {
return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
}
return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
}());
/**
* Gets a scheduler that schedules work as soon as possible on the current thread.
*/
var currentThreadScheduler = Scheduler.currentThread = (function () {
var queue;
function runTrampoline (q) {
var item;
while (q.length > 0) {
item = q.dequeue();
if (!item.isCancelled()) {
// Note, do not schedule blocking work!
while (item.dueTime - Scheduler.now() > 0) {
}
if (!item.isCancelled()) {
item.invoke();
}
}
}
}
function scheduleNow(state, action) {
return this.scheduleWithRelativeAndState(state, 0, action);
}
function scheduleRelative(state, dueTime, action) {
var dt = this.now() + Scheduler.normalize(dueTime),
si = new ScheduledItem(this, state, action, dt),
t;
if (!queue) {
queue = new PriorityQueue(4);
queue.enqueue(si);
try {
runTrampoline(queue);
} catch (e) {
throw e;
} finally {
queue = null;
}
} else {
queue.enqueue(si);
}
return si.disposable;
}
function scheduleAbsolute(state, dueTime, action) {
return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
}
var currentScheduler = new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
currentScheduler.scheduleRequired = function () { return queue === null; };
currentScheduler.ensureTrampoline = function (action) {
if (queue === null) {
return this.schedule(action);
} else {
return action();
}
};
return currentScheduler;
}());
var scheduleMethod, clearMethod = noop;
(function () {
var reNative = RegExp('^' +
String(toString)
.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
.replace(/toString| for [^\]]+/g, '.*?') + '$'
);
var setImmediate = typeof (setImmediate = freeGlobal && moduleExports && freeGlobal.setImmediate) == 'function' &&
!reNative.test(setImmediate) && setImmediate,
clearImmediate = typeof (clearImmediate = freeGlobal && moduleExports && freeGlobal.clearImmediate) == 'function' &&
!reNative.test(clearImmediate) && clearImmediate;
function postMessageSupported () {
// Ensure not in a worker
if (!root.postMessage || root.importScripts) { return false; }
var isAsync = false,
oldHandler = root.onmessage;
// Test for async
root.onmessage = function () { isAsync = true; };
root.postMessage('','*');
root.onmessage = oldHandler;
return isAsync;
}
// Use in order, nextTick, setImmediate, postMessage, MessageChannel, script readystatechanged, setTimeout
if (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]') {
scheduleMethod = process.nextTick;
} else if (typeof setImmediate === 'function') {
scheduleMethod = setImmediate;
clearMethod = clearImmediate;
} else if (postMessageSupported()) {
var MSG_PREFIX = 'ms.rx.schedule' + Math.random(),
tasks = {},
taskId = 0;
function onGlobalPostMessage(event) {
// Only if we're a match to avoid any other global events
if (typeof event.data === 'string' && event.data.substring(0, MSG_PREFIX.length) === MSG_PREFIX) {
var handleId = event.data.substring(MSG_PREFIX.length),
action = tasks[handleId];
action();
delete tasks[handleId];
}
}
if (root.addEventListener) {
root.addEventListener('message', onGlobalPostMessage, false);
} else {
root.attachEvent('onmessage', onGlobalPostMessage, false);
}
scheduleMethod = function (action) {
var currentId = taskId++;
tasks[currentId] = action;
root.postMessage(MSG_PREFIX + currentId, '*');
};
} else if (!!root.MessageChannel) {
var channel = new root.MessageChannel(),
channelTasks = {},
channelTaskId = 0;
channel.port1.onmessage = function (event) {
var id = event.data,
action = channelTasks[id];
action();
delete channelTasks[id];
};
scheduleMethod = function (action) {
var id = channelTaskId++;
channelTasks[id] = action;
channel.port2.postMessage(id);
};
} else if ('document' in root && 'onreadystatechange' in root.document.createElement('script')) {
scheduleMethod = function (action) {
var scriptElement = root.document.createElement('script');
scriptElement.onreadystatechange = function () {
action();
scriptElement.onreadystatechange = null;
scriptElement.parentNode.removeChild(scriptElement);
scriptElement = null;
};
root.document.documentElement.appendChild(scriptElement);
};
} else {
scheduleMethod = function (action) { return setTimeout(action, 0); };
clearMethod = clearTimeout;
}
}());
/**
* Gets a scheduler that schedules work via a timed callback based upon platform.
*/
var timeoutScheduler = Scheduler.timeout = (function () {
function scheduleNow(state, action) {
var scheduler = this,
disposable = new SingleAssignmentDisposable();
var id = scheduleMethod(function () {
if (!disposable.isDisposed) {
disposable.setDisposable(action(scheduler, state));
}
});
return new CompositeDisposable(disposable, disposableCreate(function () {
clearMethod(id);
}));
}
function scheduleRelative(state, dueTime, action) {
var scheduler = this,
dt = Scheduler.normalize(dueTime);
if (dt === 0) {
return scheduler.scheduleWithState(state, action);
}
var disposable = new SingleAssignmentDisposable();
var id = setTimeout(function () {
if (!disposable.isDisposed) {
disposable.setDisposable(action(scheduler, state));
}
}, dt);
return new CompositeDisposable(disposable, disposableCreate(function () {
clearTimeout(id);
}));
}
function scheduleAbsolute(state, dueTime, action) {
return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
}
return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
})();
/** @private */
var CatchScheduler = (function (_super) {
function localNow() {
return this._scheduler.now();
}
function scheduleNow(state, action) {
return this._scheduler.scheduleWithState(state, this._wrap(action));
}
function scheduleRelative(state, dueTime, action) {
return this._scheduler.scheduleWithRelativeAndState(state, dueTime, this._wrap(action));
}
function scheduleAbsolute(state, dueTime, action) {
return this._scheduler.scheduleWithAbsoluteAndState(state, dueTime, this._wrap(action));
}
inherits(CatchScheduler, _super);
/** @private */
function CatchScheduler(scheduler, handler) {
this._scheduler = scheduler;
this._handler = handler;
this._recursiveOriginal = null;
this._recursiveWrapper = null;
_super.call(this, localNow, scheduleNow, scheduleRelative, scheduleAbsolute);
}
/** @private */
CatchScheduler.prototype._clone = function (scheduler) {
return new CatchScheduler(scheduler, this._handler);
};
/** @private */
CatchScheduler.prototype._wrap = function (action) {
var parent = this;
return function (self, state) {
try {
return action(parent._getRecursiveWrapper(self), state);
} catch (e) {
if (!parent._handler(e)) { throw e; }
return disposableEmpty;
}
};
};
/** @private */
CatchScheduler.prototype._getRecursiveWrapper = function (scheduler) {
if (this._recursiveOriginal !== scheduler) {
this._recursiveOriginal = scheduler;
var wrapper = this._clone(scheduler);
wrapper._recursiveOriginal = scheduler;
wrapper._recursiveWrapper = wrapper;
this._recursiveWrapper = wrapper;
}
return this._recursiveWrapper;
};
/** @private */
CatchScheduler.prototype.schedulePeriodicWithState = function (state, period, action) {
var self = this, failed = false, d = new SingleAssignmentDisposable();
d.setDisposable(this._scheduler.schedulePeriodicWithState(state, period, function (state1) {
if (failed) { return null; }
try {
return action(state1);
} catch (e) {
failed = true;
if (!self._handler(e)) { throw e; }
d.dispose();
return null;
}
}));
return d;
};
return CatchScheduler;
}(Scheduler));
/**
* Represents a notification to an observer.
*/
var Notification = Rx.Notification = (function () {
function Notification(kind, hasValue) {
this.hasValue = hasValue == null ? false : hasValue;
this.kind = kind;
}
var NotificationPrototype = Notification.prototype;
/**
* Invokes the delegate corresponding to the notification or the observer's method corresponding to the notification and returns the produced result.
*
* @memberOf Notification
* @param {Any} observerOrOnNext Delegate to invoke for an OnNext notification or Observer to invoke the notification on..
* @param {Function} onError Delegate to invoke for an OnError notification.
* @param {Function} onCompleted Delegate to invoke for an OnCompleted notification.
* @returns {Any} Result produced by the observation.
*/
NotificationPrototype.accept = function (observerOrOnNext, onError, onCompleted) {
if (arguments.length === 1 && typeof observerOrOnNext === 'object') {
return this._acceptObservable(observerOrOnNext);
}
return this._accept(observerOrOnNext, onError, onCompleted);
};
/**
* Returns an observable sequence with a single notification.
*
* @memberOf Notification
* @param {Scheduler} [scheduler] Scheduler to send out the notification calls on.
* @returns {Observable} The observable sequence that surfaces the behavior of the notification upon subscription.
*/
NotificationPrototype.toObservable = function (scheduler) {
var notification = this;
scheduler || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.schedule(function () {
notification._acceptObservable(observer);
if (notification.kind === 'N') {
observer.onCompleted();
}
});
});
};
return Notification;
})();
/**
* Creates an object that represents an OnNext notification to an observer.
* @param {Any} value The value contained in the notification.
* @returns {Notification} The OnNext notification containing the value.
*/
var notificationCreateOnNext = Notification.createOnNext = (function () {
function _accept (onNext) {
return onNext(this.value);
}
function _acceptObservable(observer) {
return observer.onNext(this.value);
}
function toString () {
return 'OnNext(' + this.value + ')';
}
return function (value) {
var notification = new Notification('N', true);
notification.value = value;
notification._accept = _accept;
notification._acceptObservable = _acceptObservable;
notification.toString = toString;
return notification;
};
}());
/**
* Creates an object that represents an OnError notification to an observer.
* @param {Any} error The exception contained in the notification.
* @returns {Notification} The OnError notification containing the exception.
*/
var notificationCreateOnError = Notification.createOnError = (function () {
function _accept (onNext, onError) {
return onError(this.exception);
}
function _acceptObservable(observer) {
return observer.onError(this.exception);
}
function toString () {
return 'OnError(' + this.exception + ')';
}
return function (exception) {
var notification = new Notification('E');
notification.exception = exception;
notification._accept = _accept;
notification._acceptObservable = _acceptObservable;
notification.toString = toString;
return notification;
};
}());
/**
* Creates an object that represents an OnCompleted notification to an observer.
* @returns {Notification} The OnCompleted notification.
*/
var notificationCreateOnCompleted = Notification.createOnCompleted = (function () {
function _accept (onNext, onError, onCompleted) {
return onCompleted();
}
function _acceptObservable(observer) {
return observer.onCompleted();
}
function toString () {
return 'OnCompleted()';
}
return function () {
var notification = new Notification('C');
notification._accept = _accept;
notification._acceptObservable = _acceptObservable;
notification.toString = toString;
return notification;
};
}());
var Enumerator = Rx.internals.Enumerator = function (next) {
this._next = next;
};
Enumerator.prototype.next = function () {
return this._next();
};
Enumerator.prototype[$iterator$] = function () { return this; }
var Enumerable = Rx.internals.Enumerable = function (iterator) {
this._iterator = iterator;
};
Enumerable.prototype[$iterator$] = function () {
return this._iterator();
};
Enumerable.prototype.concat = function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var e;
try {
e = sources[$iterator$]();
} catch(err) {
observer.onError();
return;
}
var isDisposed,
subscription = new SerialDisposable();
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
var currentItem;
if (isDisposed) { return; }
try {
currentItem = e.next();
} catch (ex) {
observer.onError(ex);
return;
}
if (currentItem.done) {
observer.onCompleted();
return;
}
// Check if promise
var currentValue = currentItem.value;
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
var d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(currentValue.subscribe(
observer.onNext.bind(observer),
observer.onError.bind(observer),
function () { self(); })
);
});
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
isDisposed = true;
}));
});
};
Enumerable.prototype.catchException = function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var e;
try {
e = sources[$iterator$]();
} catch(err) {
observer.onError();
return;
}
var isDisposed,
lastException,
subscription = new SerialDisposable();
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
if (isDisposed) { return; }
var currentItem;
try {
currentItem = e.next();
} catch (ex) {
observer.onError(ex);
return;
}
if (currentItem.done) {
if (lastException) {
observer.onError(lastException);
} else {
observer.onCompleted();
}
return;
}
// Check if promise
var currentValue = currentItem.value;
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
var d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(currentValue.subscribe(
observer.onNext.bind(observer),
function (exn) {
lastException = exn;
self();
},
observer.onCompleted.bind(observer)));
});
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
isDisposed = true;
}));
});
};
var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) {
if (repeatCount == null) { repeatCount = -1; }
return new Enumerable(function () {
var left = repeatCount;
return new Enumerator(function () {
if (left === 0) { return doneEnumerator; }
if (left > 0) { left--; }
return { done: false, value: value };
});
});
};
var enumerableFor = Enumerable.forEach = function (source, selector, thisArg) {
selector || (selector = identity);
return new Enumerable(function () {
var index = -1;
return new Enumerator(
function () {
return ++index < source.length ?
{ done: false, value: selector.call(thisArg, source[index], index, source) } :
doneEnumerator;
});
});
};
/**
* Supports push-style iteration over an observable sequence.
*/
var Observer = Rx.Observer = function () { };
/**
* Creates a notification callback from an observer.
*
* @param observer Observer object.
* @returns The action that forwards its input notification to the underlying observer.
*/
Observer.prototype.toNotifier = function () {
var observer = this;
return function (n) {
return n.accept(observer);
};
};
/**
* Hides the identity of an observer.
* @returns An observer that hides the identity of the specified observer.
*/
Observer.prototype.asObserver = function () {
return new AnonymousObserver(this.onNext.bind(this), this.onError.bind(this), this.onCompleted.bind(this));
};
/**
* Checks access to the observer for grammar violations. This includes checking for multiple OnError or OnCompleted calls, as well as reentrancy in any of the observer methods.
* If a violation is detected, an Error is thrown from the offending observer method call.
*
* @returns An observer that checks callbacks invocations against the observer grammar and, if the checks pass, forwards those to the specified observer.
*/
Observer.prototype.checked = function () { return new CheckedObserver(this); };
/**
* Creates an observer from the specified OnNext, along with optional OnError, and OnCompleted actions.
*
* @static
* @memberOf Observer
* @param {Function} [onNext] Observer's OnNext action implementation.
* @param {Function} [onError] Observer's OnError action implementation.
* @param {Function} [onCompleted] Observer's OnCompleted action implementation.
* @returns {Observer} The observer object implemented using the given actions.
*/
var observerCreate = Observer.create = function (onNext, onError, onCompleted) {
onNext || (onNext = noop);
onError || (onError = defaultError);
onCompleted || (onCompleted = noop);
return new AnonymousObserver(onNext, onError, onCompleted);
};
/**
* Creates an observer from a notification callback.
*
* @static
* @memberOf Observer
* @param {Function} handler Action that handles a notification.
* @returns The observer object that invokes the specified handler using a notification corresponding to each message it receives.
*/
Observer.fromNotifier = function (handler) {
return new AnonymousObserver(function (x) {
return handler(notificationCreateOnNext(x));
}, function (exception) {
return handler(notificationCreateOnError(exception));
}, function () {
return handler(notificationCreateOnCompleted());
});
};
/**
* Schedules the invocation of observer methods on the given scheduler.
* @param {Scheduler} scheduler Scheduler to schedule observer messages on.
* @returns {Observer} Observer whose messages are scheduled on the given scheduler.
*/
Observer.notifyOn = function (scheduler) {
return new ObserveOnObserver(scheduler, this);
};
/**
* Abstract base class for implementations of the Observer class.
* This base class enforces the grammar of observers where OnError and OnCompleted are terminal messages.
*/
var AbstractObserver = Rx.internals.AbstractObserver = (function (_super) {
inherits(AbstractObserver, _super);
/**
* Creates a new observer in a non-stopped state.
*
* @constructor
*/
function AbstractObserver() {
this.isStopped = false;
_super.call(this);
}
/**
* Notifies the observer of a new element in the sequence.
*
* @memberOf AbstractObserver
* @param {Any} value Next element in the sequence.
*/
AbstractObserver.prototype.onNext = function (value) {
if (!this.isStopped) {
this.next(value);
}
};
/**
* Notifies the observer that an exception has occurred.
*
* @memberOf AbstractObserver
* @param {Any} error The error that has occurred.
*/
AbstractObserver.prototype.onError = function (error) {
if (!this.isStopped) {
this.isStopped = true;
this.error(error);
}
};
/**
* Notifies the observer of the end of the sequence.
*/
AbstractObserver.prototype.onCompleted = function () {
if (!this.isStopped) {
this.isStopped = true;
this.completed();
}
};
/**
* Disposes the observer, causing it to transition to the stopped state.
*/
AbstractObserver.prototype.dispose = function () {
this.isStopped = true;
};
AbstractObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.error(e);
return true;
}
return false;
};
return AbstractObserver;
}(Observer));
/**
* Class to create an Observer instance from delegate-based implementations of the on* methods.
*/
var AnonymousObserver = Rx.AnonymousObserver = (function (_super) {
inherits(AnonymousObserver, _super);
/**
* Creates an observer from the specified OnNext, OnError, and OnCompleted actions.
* @param {Any} onNext Observer's OnNext action implementation.
* @param {Any} onError Observer's OnError action implementation.
* @param {Any} onCompleted Observer's OnCompleted action implementation.
*/
function AnonymousObserver(onNext, onError, onCompleted) {
_super.call(this);
this._onNext = onNext;
this._onError = onError;
this._onCompleted = onCompleted;
}
/**
* Calls the onNext action.
* @param {Any} value Next element in the sequence.
*/
AnonymousObserver.prototype.next = function (value) {
this._onNext(value);
};
/**
* Calls the onError action.
* @param {Any} error The error that has occurred.
*/
AnonymousObserver.prototype.error = function (exception) {
this._onError(exception);
};
/**
* Calls the onCompleted action.
*/
AnonymousObserver.prototype.completed = function () {
this._onCompleted();
};
return AnonymousObserver;
}(AbstractObserver));
var CheckedObserver = (function (_super) {
inherits(CheckedObserver, _super);
function CheckedObserver(observer) {
_super.call(this);
this._observer = observer;
this._state = 0; // 0 - idle, 1 - busy, 2 - done
}
var CheckedObserverPrototype = CheckedObserver.prototype;
CheckedObserverPrototype.onNext = function (value) {
this.checkAccess();
try {
this._observer.onNext(value);
} catch (e) {
throw e;
} finally {
this._state = 0;
}
};
CheckedObserverPrototype.onError = function (err) {
this.checkAccess();
try {
this._observer.onError(err);
} catch (e) {
throw e;
} finally {
this._state = 2;
}
};
CheckedObserverPrototype.onCompleted = function () {
this.checkAccess();
try {
this._observer.onCompleted();
} catch (e) {
throw e;
} finally {
this._state = 2;
}
};
CheckedObserverPrototype.checkAccess = function () {
if (this._state === 1) { throw new Error('Re-entrancy detected'); }
if (this._state === 2) { throw new Error('Observer completed'); }
if (this._state === 0) { this._state = 1; }
};
return CheckedObserver;
}(Observer));
var ScheduledObserver = Rx.internals.ScheduledObserver = (function (_super) {
inherits(ScheduledObserver, _super);
function ScheduledObserver(scheduler, observer) {
_super.call(this);
this.scheduler = scheduler;
this.observer = observer;
this.isAcquired = false;
this.hasFaulted = false;
this.queue = [];
this.disposable = new SerialDisposable();
}
ScheduledObserver.prototype.next = function (value) {
var self = this;
this.queue.push(function () {
self.observer.onNext(value);
});
};
ScheduledObserver.prototype.error = function (exception) {
var self = this;
this.queue.push(function () {
self.observer.onError(exception);
});
};
ScheduledObserver.prototype.completed = function () {
var self = this;
this.queue.push(function () {
self.observer.onCompleted();
});
};
ScheduledObserver.prototype.ensureActive = function () {
var isOwner = false, parent = this;
if (!this.hasFaulted && this.queue.length > 0) {
isOwner = !this.isAcquired;
this.isAcquired = true;
}
if (isOwner) {
this.disposable.setDisposable(this.scheduler.scheduleRecursive(function (self) {
var work;
if (parent.queue.length > 0) {
work = parent.queue.shift();
} else {
parent.isAcquired = false;
return;
}
try {
work();
} catch (ex) {
parent.queue = [];
parent.hasFaulted = true;
throw ex;
}
self();
}));
}
};
ScheduledObserver.prototype.dispose = function () {
_super.prototype.dispose.call(this);
this.disposable.dispose();
};
return ScheduledObserver;
}(AbstractObserver));
/** @private */
var ObserveOnObserver = (function (_super) {
inherits(ObserveOnObserver, _super);
/** @private */
function ObserveOnObserver() {
_super.apply(this, arguments);
}
/** @private */
ObserveOnObserver.prototype.next = function (value) {
_super.prototype.next.call(this, value);
this.ensureActive();
};
/** @private */
ObserveOnObserver.prototype.error = function (e) {
_super.prototype.error.call(this, e);
this.ensureActive();
};
/** @private */
ObserveOnObserver.prototype.completed = function () {
_super.prototype.completed.call(this);
this.ensureActive();
};
return ObserveOnObserver;
})(ScheduledObserver);
var observableProto;
/**
* Represents a push-style collection.
*/
var Observable = Rx.Observable = (function () {
function Observable(subscribe) {
this._subscribe = subscribe;
}
observableProto = Observable.prototype;
/**
* Subscribes an observer to the observable sequence.
*
* @example
* 1 - source.subscribe();
* 2 - source.subscribe(observer);
* 3 - source.subscribe(function (x) { console.log(x); });
* 4 - source.subscribe(function (x) { console.log(x); }, function (err) { console.log(err); });
* 5 - source.subscribe(function (x) { console.log(x); }, function (err) { console.log(err); }, function () { console.log('done'); });
* @param {Mixed} [observerOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler.
*/
observableProto.subscribe = observableProto.forEach = function (observerOrOnNext, onError, onCompleted) {
var subscriber = typeof observerOrOnNext === 'object' ?
observerOrOnNext :
observerCreate(observerOrOnNext, onError, onCompleted);
return this._subscribe(subscriber);
};
return Observable;
})();
/**
* Wraps the source sequence in order to run its observer callbacks on the specified scheduler.
*
* This only invokes observer callbacks on a scheduler. In case the subscription and/or unsubscription actions have side-effects
* that require to be run on a scheduler, use subscribeOn.
*
* @param {Scheduler} scheduler Scheduler to notify observers on.
* @returns {Observable} The source sequence whose observations happen on the specified scheduler.
*/
observableProto.observeOn = function (scheduler) {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(new ObserveOnObserver(scheduler, observer));
});
};
/**
* Wraps the source sequence in order to run its subscription and unsubscription logic on the specified scheduler. This operation is not commonly used;
* see the remarks section for more information on the distinction between subscribeOn and observeOn.
* This only performs the side-effects of subscription and unsubscription on the specified scheduler. In order to invoke observer
* callbacks on a scheduler, use observeOn.
* @param {Scheduler} scheduler Scheduler to perform subscription and unsubscription actions on.
* @returns {Observable} The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler.
*/
observableProto.subscribeOn = function (scheduler) {
var source = this;
return new AnonymousObservable(function (observer) {
var m = new SingleAssignmentDisposable(), d = new SerialDisposable();
d.setDisposable(m);
m.setDisposable(scheduler.schedule(function () {
d.setDisposable(new ScheduledDisposable(scheduler, source.subscribe(observer)));
}));
return d;
});
};
/**
* Converts a Promise to an Observable sequence
* @param {Promise} An ES6 Compliant promise.
* @returns {Observable} An Observable sequence which wraps the existing promise success and failure.
*/
var observableFromPromise = Observable.fromPromise = function (promise) {
return new AnonymousObservable(function (observer) {
promise.then(
function (value) {
observer.onNext(value);
observer.onCompleted();
},
function (reason) {
observer.onError(reason);
});
return function () {
if (promise && promise.abort) {
promise.abort();
}
}
});
};
/*
* Converts an existing observable sequence to an ES6 Compatible Promise
* @example
* var promise = Rx.Observable.return(42).toPromise(RSVP.Promise);
*
* // With config
* Rx.config.Promise = RSVP.Promise;
* var promise = Rx.Observable.return(42).toPromise();
* @param {Function} [promiseCtor] The constructor of the promise. If not provided, it looks for it in Rx.config.Promise.
* @returns {Promise} An ES6 compatible promise with the last value from the observable sequence.
*/
observableProto.toPromise = function (promiseCtor) {
promiseCtor || (promiseCtor = Rx.config.Promise);
if (!promiseCtor) {
throw new Error('Promise type not provided nor in Rx.config.Promise');
}
var source = this;
return new promiseCtor(function (resolve, reject) {
// No cancellation can be done
var value, hasValue = false;
source.subscribe(function (v) {
value = v;
hasValue = true;
}, function (err) {
reject(err);
}, function () {
if (hasValue) {
resolve(value);
}
});
});
};
/**
* Creates a list from an observable sequence.
* @returns An observable sequence containing a single element with a list containing all the elements of the source sequence.
*/
observableProto.toArray = function () {
var self = this;
return new AnonymousObservable(function(observer) {
var arr = [];
return self.subscribe(
arr.push.bind(arr),
observer.onError.bind(observer),
function () {
observer.onNext(arr);
observer.onCompleted();
});
});
};
/**
* Creates an observable sequence from a specified subscribe method implementation.
*
* @example
* var res = Rx.Observable.create(function (observer) { return function () { } );
* var res = Rx.Observable.create(function (observer) { return Rx.Disposable.empty; } );
* var res = Rx.Observable.create(function (observer) { } );
*
* @param {Function} subscribe Implementation of the resulting observable sequence's subscribe method, returning a function that will be wrapped in a Disposable.
* @returns {Observable} The observable sequence with the specified implementation for the Subscribe method.
*/
Observable.create = Observable.createWithDisposable = function (subscribe) {
return new AnonymousObservable(subscribe);
};
/**
* Returns an observable sequence that invokes the specified factory function whenever a new observer subscribes.
*
* @example
* var res = Rx.Observable.defer(function () { return Rx.Observable.fromArray([1,2,3]); });
* @param {Function} observableFactory Observable factory function to invoke for each observer that subscribes to the resulting sequence or Promise.
* @returns {Observable} An observable sequence whose observers trigger an invocation of the given observable factory function.
*/
var observableDefer = Observable.defer = function (observableFactory) {
return new AnonymousObservable(function (observer) {
var result;
try {
result = observableFactory();
} catch (e) {
return observableThrow(e).subscribe(observer);
}
isPromise(result) && (result = observableFromPromise(result));
return result.subscribe(observer);
});
};
/**
* Returns an empty observable sequence, using the specified scheduler to send out the single OnCompleted message.
*
* @example
* var res = Rx.Observable.empty();
* var res = Rx.Observable.empty(Rx.Scheduler.timeout);
* @param {Scheduler} [scheduler] Scheduler to send the termination call on.
* @returns {Observable} An observable sequence with no elements.
*/
var observableEmpty = Observable.empty = function (scheduler) {
scheduler || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.schedule(function () {
observer.onCompleted();
});
});
};
/**
* Converts an array to an observable sequence, using an optional scheduler to enumerate the array.
*
* @example
* var res = Rx.Observable.fromArray([1,2,3]);
* var res = Rx.Observable.fromArray([1,2,3], Rx.Scheduler.timeout);
* @param {Scheduler} [scheduler] Scheduler to run the enumeration of the input sequence on.
* @returns {Observable} The observable sequence whose elements are pulled from the given enumerable sequence.
*/
var observableFromArray = Observable.fromArray = function (array, scheduler) {
scheduler || (scheduler = currentThreadScheduler);
return new AnonymousObservable(function (observer) {
var count = 0;
return scheduler.scheduleRecursive(function (self) {
if (count < array.length) {
observer.onNext(array[count++]);
self();
} else {
observer.onCompleted();
}
});
});
};
/**
* Converts an iterable into an Observable sequence
*
* @example
* var res = Rx.Observable.fromIterable(new Map());
* var res = Rx.Observable.fromIterable(new Set(), Rx.Scheduler.timeout);
* @param {Scheduler} [scheduler] Scheduler to run the enumeration of the input sequence on.
* @returns {Observable} The observable sequence whose elements are pulled from the given generator sequence.
*/
Observable.fromIterable = function (iterable, scheduler) {
scheduler || (scheduler = currentThreadScheduler);
return new AnonymousObservable(function (observer) {
var iterator;
try {
iterator = iterable[$iterator$]();
} catch (e) {
observer.onError(e);
return;
}
return scheduler.scheduleRecursive(function (self) {
var next;
try {
next = iterator.next();
} catch (err) {
observer.onError(err);
return;
}
if (next.done) {
observer.onCompleted();
} else {
observer.onNext(next.value);
self();
}
});
});
};
/**
* Generates an observable sequence by running a state-driven loop producing the sequence's elements, using the specified scheduler to send out observer messages.
*
* @example
* var res = Rx.Observable.generate(0, function (x) { return x < 10; }, function (x) { return x + 1; }, function (x) { return x; });
* var res = Rx.Observable.generate(0, function (x) { return x < 10; }, function (x) { return x + 1; }, function (x) { return x; }, Rx.Scheduler.timeout);
* @param {Mixed} initialState Initial state.
* @param {Function} condition Condition to terminate generation (upon returning false).
* @param {Function} iterate Iteration step function.
* @param {Function} resultSelector Selector function for results produced in the sequence.
* @param {Scheduler} [scheduler] Scheduler on which to run the generator loop. If not provided, defaults to Scheduler.currentThread.
* @returns {Observable} The generated sequence.
*/
Observable.generate = function (initialState, condition, iterate, resultSelector, scheduler) {
scheduler || (scheduler = currentThreadScheduler);
return new AnonymousObservable(function (observer) {
var first = true, state = initialState;
return scheduler.scheduleRecursive(function (self) {
var hasResult, result;
try {
if (first) {
first = false;
} else {
state = iterate(state);
}
hasResult = condition(state);
if (hasResult) {
result = resultSelector(state);
}
} catch (exception) {
observer.onError(exception);
return;
}
if (hasResult) {
observer.onNext(result);
self();
} else {
observer.onCompleted();
}
});
});
};
/**
* Returns a non-terminating observable sequence, which can be used to denote an infinite duration (e.g. when using reactive joins).
* @returns {Observable} An observable sequence whose observers will never get called.
*/
var observableNever = Observable.never = function () {
return new AnonymousObservable(function () {
return disposableEmpty;
});
};
/**
* Generates an observable sequence of integral numbers within a specified range, using the specified scheduler to send out observer messages.
*
* @example
* var res = Rx.Observable.range(0, 10);
* var res = Rx.Observable.range(0, 10, Rx.Scheduler.timeout);
* @param {Number} start The value of the first integer in the sequence.
* @param {Number} count The number of sequential integers to generate.
* @param {Scheduler} [scheduler] Scheduler to run the generator loop on. If not specified, defaults to Scheduler.currentThread.
* @returns {Observable} An observable sequence that contains a range of sequential integral numbers.
*/
Observable.range = function (start, count, scheduler) {
scheduler || (scheduler = currentThreadScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.scheduleRecursiveWithState(0, function (i, self) {
if (i < count) {
observer.onNext(start + i);
self(i + 1);
} else {
observer.onCompleted();
}
});
});
};
/**
* Generates an observable sequence that repeats the given element the specified number of times, using the specified scheduler to send out observer messages.
*
* @example
* var res = Rx.Observable.repeat(42);
* var res = Rx.Observable.repeat(42, 4);
* 3 - res = Rx.Observable.repeat(42, 4, Rx.Scheduler.timeout);
* 4 - res = Rx.Observable.repeat(42, null, Rx.Scheduler.timeout);
* @param {Mixed} value Element to repeat.
* @param {Number} repeatCount [Optiona] Number of times to repeat the element. If not specified, repeats indefinitely.
* @param {Scheduler} scheduler Scheduler to run the producer loop on. If not specified, defaults to Scheduler.immediate.
* @returns {Observable} An observable sequence that repeats the given element the specified number of times.
*/
Observable.repeat = function (value, repeatCount, scheduler) {
scheduler || (scheduler = currentThreadScheduler);
if (repeatCount == null) {
repeatCount = -1;
}
return observableReturn(value, scheduler).repeat(repeatCount);
};
/**
* Returns an observable sequence that contains a single element, using the specified scheduler to send out observer messages.
* There is an alias called 'returnValue' for browsers <IE9.
*
* @example
* var res = Rx.Observable.return(42);
* var res = Rx.Observable.return(42, Rx.Scheduler.timeout);
* @param {Mixed} value Single element in the resulting observable sequence.
* @param {Scheduler} scheduler Scheduler to send the single element on. If not specified, defaults to Scheduler.immediate.
* @returns {Observable} An observable sequence containing the single specified element.
*/
var observableReturn = Observable['return'] = Observable.returnValue = function (value, scheduler) {
scheduler || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.schedule(function () {
observer.onNext(value);
observer.onCompleted();
});
});
};
/**
* Returns an observable sequence that terminates with an exception, using the specified scheduler to send out the single onError message.
* There is an alias to this method called 'throwException' for browsers <IE9.
*
* @example
* var res = Rx.Observable.throwException(new Error('Error'));
* var res = Rx.Observable.throwException(new Error('Error'), Rx.Scheduler.timeout);
* @param {Mixed} exception An object used for the sequence's termination.
* @param {Scheduler} scheduler Scheduler to send the exceptional termination call on. If not specified, defaults to Scheduler.immediate.
* @returns {Observable} The observable sequence that terminates exceptionally with the specified exception object.
*/
var observableThrow = Observable['throw'] = Observable.throwException = function (exception, scheduler) {
scheduler || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.schedule(function () {
observer.onError(exception);
});
});
};
/**
* Constructs an observable sequence that depends on a resource object, whose lifetime is tied to the resulting observable sequence's lifetime.
*
* @example
* var res = Rx.Observable.using(function () { return new AsyncSubject(); }, function (s) { return s; });
* @param {Function} resourceFactory Factory function to obtain a resource object.
* @param {Function} observableFactory Factory function to obtain an observable sequence that depends on the obtained resource.
* @returns {Observable} An observable sequence whose lifetime controls the lifetime of the dependent resource object.
*/
Observable.using = function (resourceFactory, observableFactory) {
return new AnonymousObservable(function (observer) {
var disposable = disposableEmpty, resource, source;
try {
resource = resourceFactory();
if (resource) {
disposable = resource;
}
source = observableFactory(resource);
} catch (exception) {
return new CompositeDisposable(observableThrow(exception).subscribe(observer), disposable);
}
return new CompositeDisposable(source.subscribe(observer), disposable);
});
};
/**
* Propagates the observable sequence or Promise that reacts first.
* @param {Observable} rightSource Second observable sequence or Promise.
* @returns {Observable} {Observable} An observable sequence that surfaces either of the given sequences, whichever reacted first.
*/
observableProto.amb = function (rightSource) {
var leftSource = this;
return new AnonymousObservable(function (observer) {
var choice,
leftChoice = 'L', rightChoice = 'R',
leftSubscription = new SingleAssignmentDisposable(),
rightSubscription = new SingleAssignmentDisposable();
isPromise(rightSource) && (rightSource = observableFromPromise(rightSource));
function choiceL() {
if (!choice) {
choice = leftChoice;
rightSubscription.dispose();
}
}
function choiceR() {
if (!choice) {
choice = rightChoice;
leftSubscription.dispose();
}
}
leftSubscription.setDisposable(leftSource.subscribe(function (left) {
choiceL();
if (choice === leftChoice) {
observer.onNext(left);
}
}, function (err) {
choiceL();
if (choice === leftChoice) {
observer.onError(err);
}
}, function () {
choiceL();
if (choice === leftChoice) {
observer.onCompleted();
}
}));
rightSubscription.setDisposable(rightSource.subscribe(function (right) {
choiceR();
if (choice === rightChoice) {
observer.onNext(right);
}
}, function (err) {
choiceR();
if (choice === rightChoice) {
observer.onError(err);
}
}, function () {
choiceR();
if (choice === rightChoice) {
observer.onCompleted();
}
}));
return new CompositeDisposable(leftSubscription, rightSubscription);
});
};
/**
* Propagates the observable sequence or Promise that reacts first.
*
* @example
* var = Rx.Observable.amb(xs, ys, zs);
* @returns {Observable} An observable sequence that surfaces any of the given sequences, whichever reacted first.
*/
Observable.amb = function () {
var acc = observableNever(),
items = argsOrArray(arguments, 0);
function func(previous, current) {
return previous.amb(current);
}
for (var i = 0, len = items.length; i < len; i++) {
acc = func(acc, items[i]);
}
return acc;
};
function observableCatchHandler(source, handler) {
return new AnonymousObservable(function (observer) {
var d1 = new SingleAssignmentDisposable(), subscription = new SerialDisposable();
subscription.setDisposable(d1);
d1.setDisposable(source.subscribe(observer.onNext.bind(observer), function (exception) {
var d, result;
try {
result = handler(exception);
} catch (ex) {
observer.onError(ex);
return;
}
isPromise(result) && (result = observableFromPromise(result));
d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(result.subscribe(observer));
}, observer.onCompleted.bind(observer)));
return subscription;
});
}
/**
* Continues an observable sequence that is terminated by an exception with the next observable sequence.
* @example
* 1 - xs.catchException(ys)
* 2 - xs.catchException(function (ex) { return ys(ex); })
* @param {Mixed} handlerOrSecond Exception handler function that returns an observable sequence given the error that occurred in the first sequence, or a second observable sequence used to produce results when an error occurred in the first sequence.
* @returns {Observable} An observable sequence containing the first sequence's elements, followed by the elements of the handler sequence in case an exception occurred.
*/
observableProto['catch'] = observableProto.catchException = function (handlerOrSecond) {
return typeof handlerOrSecond === 'function' ?
observableCatchHandler(this, handlerOrSecond) :
observableCatch([this, handlerOrSecond]);
};
/**
* Continues an observable sequence that is terminated by an exception with the next observable sequence.
*
* @example
* 1 - res = Rx.Observable.catchException(xs, ys, zs);
* 2 - res = Rx.Observable.catchException([xs, ys, zs]);
* @returns {Observable} An observable sequence containing elements from consecutive source sequences until a source sequence terminates successfully.
*/
var observableCatch = Observable.catchException = Observable['catch'] = function () {
var items = argsOrArray(arguments, 0);
return enumerableFor(items).catchException();
};
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences or Promises produces an element.
* This can be in the form of an argument list of observables or an array.
*
* @example
* 1 - obs = observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; });
* 2 - obs = observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; });
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
observableProto.combineLatest = function () {
var args = slice.call(arguments);
if (Array.isArray(args[0])) {
args[0].unshift(this);
} else {
args.unshift(this);
}
return combineLatest.apply(this, args);
};
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences or Promises produces an element.
*
* @example
* 1 - obs = Rx.Observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; });
* 2 - obs = Rx.Observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; });
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
var combineLatest = Observable.combineLatest = function () {
var args = slice.call(arguments), resultSelector = args.pop();
if (Array.isArray(args[0])) {
args = args[0];
}
return new AnonymousObservable(function (observer) {
var falseFactory = function () { return false; },
n = args.length,
hasValue = arrayInitialize(n, falseFactory),
hasValueAll = false,
isDone = arrayInitialize(n, falseFactory),
values = new Array(n);
function next(i) {
var res;
hasValue[i] = true;
if (hasValueAll || (hasValueAll = hasValue.every(identity))) {
try {
res = resultSelector.apply(null, values);
} catch (ex) {
observer.onError(ex);
return;
}
observer.onNext(res);
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
observer.onCompleted();
}
}
function done (i) {
isDone[i] = true;
if (isDone.every(identity)) {
observer.onCompleted();
}
}
var subscriptions = new Array(n);
for (var idx = 0; idx < n; idx++) {
(function (i) {
var source = args[i], sad = new SingleAssignmentDisposable();
isPromise(source) && (source = observableFromPromise(source));
sad.setDisposable(source.subscribe(function (x) {
values[i] = x;
next(i);
}, observer.onError.bind(observer), function () {
done(i);
}));
subscriptions[i] = sad;
}(idx));
}
return new CompositeDisposable(subscriptions);
});
};
/**
* Concatenates all the observable sequences. This takes in either an array or variable arguments to concatenate.
*
* @example
* 1 - concatenated = xs.concat(ys, zs);
* 2 - concatenated = xs.concat([ys, zs]);
* @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order.
*/
observableProto.concat = function () {
var items = slice.call(arguments, 0);
items.unshift(this);
return observableConcat.apply(this, items);
};
/**
* Concatenates all the observable sequences.
*
* @example
* 1 - res = Rx.Observable.concat(xs, ys, zs);
* 2 - res = Rx.Observable.concat([xs, ys, zs]);
* @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order.
*/
var observableConcat = Observable.concat = function () {
var sources = argsOrArray(arguments, 0);
return enumerableFor(sources).concat();
};
/**
* Concatenates an observable sequence of observable sequences.
* @returns {Observable} An observable sequence that contains the elements of each observed inner sequence, in sequential order.
*/
observableProto.concatObservable = observableProto.concatAll =function () {
return this.merge(1);
};
/**
* Merges an observable sequence of observable sequences into an observable sequence, limiting the number of concurrent subscriptions to inner sequences.
* Or merges two observable sequences into a single observable sequence.
*
* @example
* 1 - merged = sources.merge(1);
* 2 - merged = source.merge(otherSource);
* @param {Mixed} [maxConcurrentOrOther] Maximum number of inner observable sequences being subscribed to concurrently or the second observable sequence.
* @returns {Observable} The observable sequence that merges the elements of the inner sequences.
*/
observableProto.merge = function (maxConcurrentOrOther) {
if (typeof maxConcurrentOrOther !== 'number') {
return observableMerge(this, maxConcurrentOrOther);
}
var sources = this;
return new AnonymousObservable(function (observer) {
var activeCount = 0,
group = new CompositeDisposable(),
isStopped = false,
q = [],
subscribe = function (xs) {
var subscription = new SingleAssignmentDisposable();
group.add(subscription);
// Check for promises support
if (isPromise(xs)) { xs = observableFromPromise(xs); }
subscription.setDisposable(xs.subscribe(observer.onNext.bind(observer), observer.onError.bind(observer), function () {
var s;
group.remove(subscription);
if (q.length > 0) {
s = q.shift();
subscribe(s);
} else {
activeCount--;
if (isStopped && activeCount === 0) {
observer.onCompleted();
}
}
}));
};
group.add(sources.subscribe(function (innerSource) {
if (activeCount < maxConcurrentOrOther) {
activeCount++;
subscribe(innerSource);
} else {
q.push(innerSource);
}
}, observer.onError.bind(observer), function () {
isStopped = true;
if (activeCount === 0) {
observer.onCompleted();
}
}));
return group;
});
};
/**
* Merges all the observable sequences into a single observable sequence.
* The scheduler is optional and if not specified, the immediate scheduler is used.
*
* @example
* 1 - merged = Rx.Observable.merge(xs, ys, zs);
* 2 - merged = Rx.Observable.merge([xs, ys, zs]);
* 3 - merged = Rx.Observable.merge(scheduler, xs, ys, zs);
* 4 - merged = Rx.Observable.merge(scheduler, [xs, ys, zs]);
* @returns {Observable} The observable sequence that merges the elements of the observable sequences.
*/
var observableMerge = Observable.merge = function () {
var scheduler, sources;
if (!arguments[0]) {
scheduler = immediateScheduler;
sources = slice.call(arguments, 1);
} else if (arguments[0].now) {
scheduler = arguments[0];
sources = slice.call(arguments, 1);
} else {
scheduler = immediateScheduler;
sources = slice.call(arguments, 0);
}
if (Array.isArray(sources[0])) {
sources = sources[0];
}
return observableFromArray(sources, scheduler).mergeObservable();
};
/**
* Merges an observable sequence of observable sequences into an observable sequence.
* @returns {Observable} The observable sequence that merges the elements of the inner sequences.
*/
observableProto.mergeObservable = observableProto.mergeAll =function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var group = new CompositeDisposable(),
isStopped = false,
m = new SingleAssignmentDisposable();
group.add(m);
m.setDisposable(sources.subscribe(function (innerSource) {
var innerSubscription = new SingleAssignmentDisposable();
group.add(innerSubscription);
// Check if Promise or Observable
if (isPromise(innerSource)) {
innerSource = observableFromPromise(innerSource);
}
innerSubscription.setDisposable(innerSource.subscribe(function (x) {
observer.onNext(x);
}, observer.onError.bind(observer), function () {
group.remove(innerSubscription);
if (isStopped && group.length === 1) { observer.onCompleted(); }
}));
}, observer.onError.bind(observer), function () {
isStopped = true;
if (group.length === 1) { observer.onCompleted(); }
}));
return group;
});
};
/**
* Continues an observable sequence that is terminated normally or by an exception with the next observable sequence.
* @param {Observable} second Second observable sequence used to produce results after the first sequence terminates.
* @returns {Observable} An observable sequence that concatenates the first and second sequence, even if the first sequence terminates exceptionally.
*/
observableProto.onErrorResumeNext = function (second) {
if (!second) {
throw new Error('Second observable is required');
}
return onErrorResumeNext([this, second]);
};
/**
* Continues an observable sequence that is terminated normally or by an exception with the next observable sequence.
*
* @example
* 1 - res = Rx.Observable.onErrorResumeNext(xs, ys, zs);
* 1 - res = Rx.Observable.onErrorResumeNext([xs, ys, zs]);
* @returns {Observable} An observable sequence that concatenates the source sequences, even if a sequence terminates exceptionally.
*/
var onErrorResumeNext = Observable.onErrorResumeNext = function () {
var sources = argsOrArray(arguments, 0);
return new AnonymousObservable(function (observer) {
var pos = 0, subscription = new SerialDisposable(),
cancelable = immediateScheduler.scheduleRecursive(function (self) {
var current, d;
if (pos < sources.length) {
current = sources[pos++];
isPromise(current) && (current = observableFromPromise(current));
d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(current.subscribe(observer.onNext.bind(observer), function () {
self();
}, function () {
self();
}));
} else {
observer.onCompleted();
}
});
return new CompositeDisposable(subscription, cancelable);
});
};
/**
* Returns the values from the source observable sequence only after the other observable sequence produces a value.
* @param {Observable | Promise} other The observable sequence or Promise that triggers propagation of elements of the source sequence.
* @returns {Observable} An observable sequence containing the elements of the source sequence starting from the point the other sequence triggered propagation.
*/
observableProto.skipUntil = function (other) {
var source = this;
return new AnonymousObservable(function (observer) {
var isOpen = false;
var disposables = new CompositeDisposable(source.subscribe(function (left) {
isOpen && observer.onNext(left);
}, observer.onError.bind(observer), function () {
isOpen && observer.onCompleted();
}));
isPromise(other) && (other = observableFromPromise(other));
var rightSubscription = new SingleAssignmentDisposable();
disposables.add(rightSubscription);
rightSubscription.setDisposable(other.subscribe(function () {
isOpen = true;
rightSubscription.dispose();
}, observer.onError.bind(observer), function () {
rightSubscription.dispose();
}));
return disposables;
});
};
/**
* Transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.
* @returns {Observable} The observable sequence that at any point in time produces the elements of the most recent inner observable sequence that has been received.
*/
observableProto['switch'] = observableProto.switchLatest = function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var hasLatest = false,
innerSubscription = new SerialDisposable(),
isStopped = false,
latest = 0,
subscription = sources.subscribe(function (innerSource) {
var d = new SingleAssignmentDisposable(), id = ++latest;
hasLatest = true;
innerSubscription.setDisposable(d);
// Check if Promise or Observable
if (isPromise(innerSource)) {
innerSource = observableFromPromise(innerSource);
}
d.setDisposable(innerSource.subscribe(function (x) {
if (latest === id) {
observer.onNext(x);
}
}, function (e) {
if (latest === id) {
observer.onError(e);
}
}, function () {
if (latest === id) {
hasLatest = false;
if (isStopped) {
observer.onCompleted();
}
}
}));
}, observer.onError.bind(observer), function () {
isStopped = true;
if (!hasLatest) {
observer.onCompleted();
}
});
return new CompositeDisposable(subscription, innerSubscription);
});
};
/**
* Returns the values from the source observable sequence until the other observable sequence produces a value.
* @param {Observable | Promise} other Observable sequence or Promise that terminates propagation of elements of the source sequence.
* @returns {Observable} An observable sequence containing the elements of the source sequence up to the point the other sequence interrupted further propagation.
*/
observableProto.takeUntil = function (other) {
var source = this;
return new AnonymousObservable(function (observer) {
isPromise(other) && (other = observableFromPromise(other));
return new CompositeDisposable(
source.subscribe(observer),
other.subscribe(observer.onCompleted.bind(observer), observer.onError.bind(observer), noop)
);
});
};
function zipArray(second, resultSelector) {
var first = this;
return new AnonymousObservable(function (observer) {
var index = 0, len = second.length;
return first.subscribe(function (left) {
if (index < len) {
var right = second[index++], result;
try {
result = resultSelector(left, right);
} catch (e) {
observer.onError(e);
return;
}
observer.onNext(result);
} else {
observer.onCompleted();
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
}
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences or an array have produced an element at a corresponding index.
* The last element in the arguments must be a function to invoke for each series of elements at corresponding indexes in the sources.
*
* @example
* 1 - res = obs1.zip(obs2, fn);
* 1 - res = x1.zip([1,2,3], fn);
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
observableProto.zip = function () {
if (Array.isArray(arguments[0])) {
return zipArray.apply(this, arguments);
}
var parent = this, sources = slice.call(arguments), resultSelector = sources.pop();
sources.unshift(parent);
return new AnonymousObservable(function (observer) {
var n = sources.length,
queues = arrayInitialize(n, function () { return []; }),
isDone = arrayInitialize(n, function () { return false; });
function next(i) {
var res, queuedValues;
if (queues.every(function (x) { return x.length > 0; })) {
try {
queuedValues = queues.map(function (x) { return x.shift(); });
res = resultSelector.apply(parent, queuedValues);
} catch (ex) {
observer.onError(ex);
return;
}
observer.onNext(res);
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
observer.onCompleted();
}
};
function done(i) {
isDone[i] = true;
if (isDone.every(function (x) { return x; })) {
observer.onCompleted();
}
}
var subscriptions = new Array(n);
for (var idx = 0; idx < n; idx++) {
(function (i) {
var source = sources[i], sad = new SingleAssignmentDisposable();
isPromise(source) && (source = observableFromPromise(source));
sad.setDisposable(source.subscribe(function (x) {
queues[i].push(x);
next(i);
}, observer.onError.bind(observer), function () {
done(i);
}));
subscriptions[i] = sad;
})(idx);
}
return new CompositeDisposable(subscriptions);
});
};
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
* @param arguments Observable sources.
* @param {Function} resultSelector Function to invoke for each series of elements at corresponding indexes in the sources.
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
Observable.zip = function () {
var args = slice.call(arguments, 0),
first = args.shift();
return first.zip.apply(first, args);
};
/**
* Merges the specified observable sequences into one observable sequence by emitting a list with the elements of the observable sequences at corresponding indexes.
* @param arguments Observable sources.
* @returns {Observable} An observable sequence containing lists of elements at corresponding indexes.
*/
Observable.zipArray = function () {
var sources = argsOrArray(arguments, 0);
return new AnonymousObservable(function (observer) {
var n = sources.length,
queues = arrayInitialize(n, function () { return []; }),
isDone = arrayInitialize(n, function () { return false; });
function next(i) {
if (queues.every(function (x) { return x.length > 0; })) {
var res = queues.map(function (x) { return x.shift(); });
observer.onNext(res);
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
observer.onCompleted();
return;
}
};
function done(i) {
isDone[i] = true;
if (isDone.every(identity)) {
observer.onCompleted();
return;
}
}
var subscriptions = new Array(n);
for (var idx = 0; idx < n; idx++) {
(function (i) {
subscriptions[i] = new SingleAssignmentDisposable();
subscriptions[i].setDisposable(sources[i].subscribe(function (x) {
queues[i].push(x);
next(i);
}, observer.onError.bind(observer), function () {
done(i);
}));
})(idx);
}
var compositeDisposable = new CompositeDisposable(subscriptions);
compositeDisposable.add(disposableCreate(function () {
for (var qIdx = 0, qLen = queues.length; qIdx < qLen; qIdx++) {
queues[qIdx] = [];
}
}));
return compositeDisposable;
});
};
/**
* Hides the identity of an observable sequence.
* @returns {Observable} An observable sequence that hides the identity of the source sequence.
*/
observableProto.asObservable = function () {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(observer);
});
};
/**
* Projects each element of an observable sequence into zero or more buffers which are produced based on element count information.
*
* @example
* var res = xs.bufferWithCount(10);
* var res = xs.bufferWithCount(10, 1);
* @param {Number} count Length of each buffer.
* @param {Number} [skip] Number of elements to skip between creation of consecutive buffers. If not provided, defaults to the count.
* @returns {Observable} An observable sequence of buffers.
*/
observableProto.bufferWithCount = function (count, skip) {
if (typeof skip !== 'number') {
skip = count;
}
return this.windowWithCount(count, skip).selectMany(function (x) {
return x.toArray();
}).where(function (x) {
return x.length > 0;
});
};
/**
* Dematerializes the explicit notification values of an observable sequence as implicit notifications.
* @returns {Observable} An observable sequence exhibiting the behavior corresponding to the source sequence's notification values.
*/
observableProto.dematerialize = function () {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(function (x) {
return x.accept(observer);
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Returns an observable sequence that contains only distinct contiguous elements according to the keySelector and the comparer.
*
* var obs = observable.distinctUntilChanged();
* var obs = observable.distinctUntilChanged(function (x) { return x.id; });
* var obs = observable.distinctUntilChanged(function (x) { return x.id; }, function (x, y) { return x === y; });
*
* @param {Function} [keySelector] A function to compute the comparison key for each element. If not provided, it projects the value.
* @param {Function} [comparer] Equality comparer for computed key values. If not provided, defaults to an equality comparer function.
* @returns {Observable} An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence.
*/
observableProto.distinctUntilChanged = function (keySelector, comparer) {
var source = this;
keySelector || (keySelector = identity);
comparer || (comparer = defaultComparer);
return new AnonymousObservable(function (observer) {
var hasCurrentKey = false, currentKey;
return source.subscribe(function (value) {
var comparerEquals = false, key;
try {
key = keySelector(value);
} catch (exception) {
observer.onError(exception);
return;
}
if (hasCurrentKey) {
try {
comparerEquals = comparer(currentKey, key);
} catch (exception) {
observer.onError(exception);
return;
}
}
if (!hasCurrentKey || !comparerEquals) {
hasCurrentKey = true;
currentKey = key;
observer.onNext(value);
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Invokes an action for each element in the observable sequence and invokes an action upon graceful or exceptional termination of the observable sequence.
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
*
* @example
* var res = observable.doAction(observer);
* var res = observable.doAction(onNext);
* var res = observable.doAction(onNext, onError);
* var res = observable.doAction(onNext, onError, onCompleted);
* @param {Mixed} observerOrOnNext Action to invoke for each element in the observable sequence or an observer.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function.
* @returns {Observable} The source sequence with the side-effecting behavior applied.
*/
observableProto['do'] = observableProto.doAction = function (observerOrOnNext, onError, onCompleted) {
var source = this, onNextFunc;
if (typeof observerOrOnNext === 'function') {
onNextFunc = observerOrOnNext;
} else {
onNextFunc = observerOrOnNext.onNext.bind(observerOrOnNext);
onError = observerOrOnNext.onError.bind(observerOrOnNext);
onCompleted = observerOrOnNext.onCompleted.bind(observerOrOnNext);
}
return new AnonymousObservable(function (observer) {
return source.subscribe(function (x) {
try {
onNextFunc(x);
} catch (e) {
observer.onError(e);
}
observer.onNext(x);
}, function (exception) {
if (!onError) {
observer.onError(exception);
} else {
try {
onError(exception);
} catch (e) {
observer.onError(e);
}
observer.onError(exception);
}
}, function () {
if (!onCompleted) {
observer.onCompleted();
} else {
try {
onCompleted();
} catch (e) {
observer.onError(e);
}
observer.onCompleted();
}
});
});
};
/**
* Invokes a specified action after the source observable sequence terminates gracefully or exceptionally.
*
* @example
* var res = observable.finallyAction(function () { console.log('sequence ended'; });
* @param {Function} finallyAction Action to invoke after the source observable sequence terminates.
* @returns {Observable} Source sequence with the action-invoking termination behavior applied.
*/
observableProto['finally'] = observableProto.finallyAction = function (action) {
var source = this;
return new AnonymousObservable(function (observer) {
var subscription;
try {
subscription = source.subscribe(observer);
} catch (e) {
action();
throw e;
}
return disposableCreate(function () {
try {
subscription.dispose();
} catch (e) {
throw e;
} finally {
action();
}
});
});
};
/**
* Ignores all elements in an observable sequence leaving only the termination messages.
* @returns {Observable} An empty observable sequence that signals termination, successful or exceptional, of the source sequence.
*/
observableProto.ignoreElements = function () {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(noop, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Materializes the implicit notifications of an observable sequence as explicit notification values.
* @returns {Observable} An observable sequence containing the materialized notification values from the source sequence.
*/
observableProto.materialize = function () {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(function (value) {
observer.onNext(notificationCreateOnNext(value));
}, function (e) {
observer.onNext(notificationCreateOnError(e));
observer.onCompleted();
}, function () {
observer.onNext(notificationCreateOnCompleted());
observer.onCompleted();
});
});
};
/**
* Repeats the observable sequence a specified number of times. If the repeat count is not specified, the sequence repeats indefinitely.
*
* @example
* var res = repeated = source.repeat();
* var res = repeated = source.repeat(42);
* @param {Number} [repeatCount] Number of times to repeat the sequence. If not provided, repeats the sequence indefinitely.
* @returns {Observable} The observable sequence producing the elements of the given sequence repeatedly.
*/
observableProto.repeat = function (repeatCount) {
return enumerableRepeat(this, repeatCount).concat();
};
/**
* Repeats the source observable sequence the specified number of times or until it successfully terminates. If the retry count is not specified, it retries indefinitely.
*
* @example
* var res = retried = retry.repeat();
* var res = retried = retry.repeat(42);
* @param {Number} [retryCount] Number of times to retry the sequence. If not provided, retry the sequence indefinitely.
* @returns {Observable} An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully.
*/
observableProto.retry = function (retryCount) {
return enumerableRepeat(this, retryCount).catchException();
};
/**
* Applies an accumulator function over an observable sequence and returns each intermediate result. The optional seed value is used as the initial accumulator value.
* For aggregation behavior with no intermediate results, see Observable.aggregate.
* @example
* var res = source.scan(function (acc, x) { return acc + x; });
* var res = source.scan(0, function (acc, x) { return acc + x; });
* @param {Mixed} [seed] The initial accumulator value.
* @param {Function} accumulator An accumulator function to be invoked on each element.
* @returns {Observable} An observable sequence containing the accumulated values.
*/
observableProto.scan = function () {
var hasSeed = false, seed, accumulator, source = this;
if (arguments.length === 2) {
hasSeed = true;
seed = arguments[0];
accumulator = arguments[1];
} else {
accumulator = arguments[0];
}
return new AnonymousObservable(function (observer) {
var hasAccumulation, accumulation, hasValue;
return source.subscribe (
function (x) {
try {
if (!hasValue) {
hasValue = true;
}
if (hasAccumulation) {
accumulation = accumulator(accumulation, x);
} else {
accumulation = hasSeed ? accumulator(seed, x) : x;
hasAccumulation = true;
}
} catch (e) {
observer.onError(e);
return;
}
observer.onNext(accumulation);
},
observer.onError.bind(observer),
function () {
if (!hasValue && hasSeed) {
observer.onNext(seed);
}
observer.onCompleted();
}
);
});
};
/**
* Bypasses a specified number of elements at the end of an observable sequence.
* @description
* This operator accumulates a queue with a length enough to store the first `count` elements. As more elements are
* received, elements are taken from the front of the queue and produced on the result sequence. This causes elements to be delayed.
* @param count Number of elements to bypass at the end of the source sequence.
* @returns {Observable} An observable sequence containing the source sequence elements except for the bypassed ones at the end.
*/
observableProto.skipLast = function (count) {
var source = this;
return new AnonymousObservable(function (observer) {
var q = [];
return source.subscribe(function (x) {
q.push(x);
if (q.length > count) {
observer.onNext(q.shift());
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Prepends a sequence of values to an observable sequence with an optional scheduler and an argument list of values to prepend.
*
* var res = source.startWith(1, 2, 3);
* var res = source.startWith(Rx.Scheduler.timeout, 1, 2, 3);
*
* @memberOf Observable#
* @returns {Observable} The source sequence prepended with the specified values.
*/
observableProto.startWith = function () {
var values, scheduler, start = 0;
if (!!arguments.length && 'now' in Object(arguments[0])) {
scheduler = arguments[0];
start = 1;
} else {
scheduler = immediateScheduler;
}
values = slice.call(arguments, start);
return enumerableFor([observableFromArray(values, scheduler), this]).concat();
};
/**
* Returns a specified number of contiguous elements from the end of an observable sequence, using an optional scheduler to drain the queue.
*
* @example
* var res = source.takeLast(5);
* var res = source.takeLast(5, Rx.Scheduler.timeout);
*
* @description
* This operator accumulates a buffer with a length enough to store elements count elements. Upon completion of
* the source sequence, this buffer is drained on the result sequence. This causes the elements to be delayed.
* @param {Number} count Number of elements to take from the end of the source sequence.
* @param {Scheduler} [scheduler] Scheduler used to drain the queue upon completion of the source sequence.
* @returns {Observable} An observable sequence containing the specified number of elements from the end of the source sequence.
*/
observableProto.takeLast = function (count, scheduler) {
return this.takeLastBuffer(count).selectMany(function (xs) { return observableFromArray(xs, scheduler); });
};
/**
* Returns an array with the specified number of contiguous elements from the end of an observable sequence.
*
* @description
* This operator accumulates a buffer with a length enough to store count elements. Upon completion of the
* source sequence, this buffer is produced on the result sequence.
* @param {Number} count Number of elements to take from the end of the source sequence.
* @returns {Observable} An observable sequence containing a single array with the specified number of elements from the end of the source sequence.
*/
observableProto.takeLastBuffer = function (count) {
var source = this;
return new AnonymousObservable(function (observer) {
var q = [];
return source.subscribe(function (x) {
q.push(x);
if (q.length > count) {
q.shift();
}
}, observer.onError.bind(observer), function () {
observer.onNext(q);
observer.onCompleted();
});
});
};
/**
* Projects each element of an observable sequence into zero or more windows which are produced based on element count information.
*
* var res = xs.windowWithCount(10);
* var res = xs.windowWithCount(10, 1);
* @param {Number} count Length of each window.
* @param {Number} [skip] Number of elements to skip between creation of consecutive windows. If not specified, defaults to the count.
* @returns {Observable} An observable sequence of windows.
*/
observableProto.windowWithCount = function (count, skip) {
var source = this;
if (count <= 0) {
throw new Error(argumentOutOfRange);
}
if (arguments.length === 1) {
skip = count;
}
if (skip <= 0) {
throw new Error(argumentOutOfRange);
}
return new AnonymousObservable(function (observer) {
var m = new SingleAssignmentDisposable(),
refCountDisposable = new RefCountDisposable(m),
n = 0,
q = [],
createWindow = function () {
var s = new Subject();
q.push(s);
observer.onNext(addRef(s, refCountDisposable));
};
createWindow();
m.setDisposable(source.subscribe(function (x) {
var s;
for (var i = 0, len = q.length; i < len; i++) {
q[i].onNext(x);
}
var c = n - count + 1;
if (c >= 0 && c % skip === 0) {
s = q.shift();
s.onCompleted();
}
n++;
if (n % skip === 0) {
createWindow();
}
}, function (exception) {
while (q.length > 0) {
q.shift().onError(exception);
}
observer.onError(exception);
}, function () {
while (q.length > 0) {
q.shift().onCompleted();
}
observer.onCompleted();
}));
return refCountDisposable;
});
};
/**
* Returns the elements of the specified sequence or the specified value in a singleton sequence if the sequence is empty.
*
* var res = obs = xs.defaultIfEmpty();
* 2 - obs = xs.defaultIfEmpty(false);
*
* @memberOf Observable#
* @param defaultValue The value to return if the sequence is empty. If not provided, this defaults to null.
* @returns {Observable} An observable sequence that contains the specified default value if the source is empty; otherwise, the elements of the source itself.
*/
observableProto.defaultIfEmpty = function (defaultValue) {
var source = this;
if (defaultValue === undefined) {
defaultValue = null;
}
return new AnonymousObservable(function (observer) {
var found = false;
return source.subscribe(function (x) {
found = true;
observer.onNext(x);
}, observer.onError.bind(observer), function () {
if (!found) {
observer.onNext(defaultValue);
}
observer.onCompleted();
});
});
};
/**
* Returns an observable sequence that contains only distinct elements according to the keySelector and the comparer.
* Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large.
*
* @example
* var res = obs = xs.distinct();
* 2 - obs = xs.distinct(function (x) { return x.id; });
* 2 - obs = xs.distinct(function (x) { return x.id; }, function (x) { return x.toString(); });
* @param {Function} [keySelector] A function to compute the comparison key for each element.
* @param {Function} [keySerializer] Used to serialize the given object into a string for object comparison.
* @returns {Observable} An observable sequence only containing the distinct elements, based on a computed key value, from the source sequence.
*/
observableProto.distinct = function (keySelector, keySerializer) {
var source = this;
keySelector || (keySelector = identity);
keySerializer || (keySerializer = defaultKeySerializer);
return new AnonymousObservable(function (observer) {
var hashSet = {};
return source.subscribe(function (x) {
var key, serializedKey, otherKey, hasMatch = false;
try {
key = keySelector(x);
serializedKey = keySerializer(key);
} catch (exception) {
observer.onError(exception);
return;
}
for (otherKey in hashSet) {
if (serializedKey === otherKey) {
hasMatch = true;
break;
}
}
if (!hasMatch) {
hashSet[serializedKey] = null;
observer.onNext(x);
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Groups the elements of an observable sequence according to a specified key selector function and comparer and selects the resulting elements by using a specified function.
*
* @example
* var res = observable.groupBy(function (x) { return x.id; });
* 2 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; });
* 3 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; }, function (x) { return x.toString(); });
* @param {Function} keySelector A function to extract the key for each element.
* @param {Function} [elementSelector] A function to map each source element to an element in an observable group.
* @param {Function} [keySerializer] Used to serialize the given object into a string for object comparison.
* @returns {Observable} A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
*/
observableProto.groupBy = function (keySelector, elementSelector, keySerializer) {
return this.groupByUntil(keySelector, elementSelector, function () {
return observableNever();
}, keySerializer);
};
/**
* Groups the elements of an observable sequence according to a specified key selector function.
* A duration selector function is used to control the lifetime of groups. When a group expires, it receives an OnCompleted notification. When a new element with the same
* key value as a reclaimed group occurs, the group will be reborn with a new lifetime request.
*
* @example
* var res = observable.groupByUntil(function (x) { return x.id; }, null, function () { return Rx.Observable.never(); });
* 2 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; }, function () { return Rx.Observable.never(); });
* 3 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; }, function () { return Rx.Observable.never(); }, function (x) { return x.toString(); });
* @param {Function} keySelector A function to extract the key for each element.
* @param {Function} durationSelector A function to signal the expiration of a group.
* @param {Function} [keySerializer] Used to serialize the given object into a string for object comparison.
* @returns {Observable}
* A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
* If a group's lifetime expires, a new group with the same key value can be created once an element with such a key value is encoutered.
*
*/
observableProto.groupByUntil = function (keySelector, elementSelector, durationSelector, keySerializer) {
var source = this;
elementSelector || (elementSelector = identity);
keySerializer || (keySerializer = defaultKeySerializer);
return new AnonymousObservable(function (observer) {
var map = {},
groupDisposable = new CompositeDisposable(),
refCountDisposable = new RefCountDisposable(groupDisposable);
groupDisposable.add(source.subscribe(function (x) {
var duration, durationGroup, element, fireNewMapEntry, group, key, serializedKey, md, writer, w;
try {
key = keySelector(x);
serializedKey = keySerializer(key);
} catch (e) {
for (w in map) {
map[w].onError(e);
}
observer.onError(e);
return;
}
fireNewMapEntry = false;
try {
writer = map[serializedKey];
if (!writer) {
writer = new Subject();
map[serializedKey] = writer;
fireNewMapEntry = true;
}
} catch (e) {
for (w in map) {
map[w].onError(e);
}
observer.onError(e);
return;
}
if (fireNewMapEntry) {
group = new GroupedObservable(key, writer, refCountDisposable);
durationGroup = new GroupedObservable(key, writer);
try {
duration = durationSelector(durationGroup);
} catch (e) {
for (w in map) {
map[w].onError(e);
}
observer.onError(e);
return;
}
observer.onNext(group);
md = new SingleAssignmentDisposable();
groupDisposable.add(md);
var expire = function () {
if (serializedKey in map) {
delete map[serializedKey];
writer.onCompleted();
}
groupDisposable.remove(md);
};
md.setDisposable(duration.take(1).subscribe(noop, function (exn) {
for (w in map) {
map[w].onError(exn);
}
observer.onError(exn);
}, function () {
expire();
}));
}
try {
element = elementSelector(x);
} catch (e) {
for (w in map) {
map[w].onError(e);
}
observer.onError(e);
return;
}
writer.onNext(element);
}, function (ex) {
for (var w in map) {
map[w].onError(ex);
}
observer.onError(ex);
}, function () {
for (var w in map) {
map[w].onCompleted();
}
observer.onCompleted();
}));
return refCountDisposable;
});
};
/**
* Projects each element of an observable sequence into a new form by incorporating the element's index.
* @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source.
*/
observableProto.select = observableProto.map = function (selector, thisArg) {
var parent = this;
return new AnonymousObservable(function (observer) {
var count = 0;
return parent.subscribe(function (value) {
var result;
try {
result = selector.call(thisArg, value, count++, parent);
} catch (exception) {
observer.onError(exception);
return;
}
observer.onNext(result);
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Retrieves the value of a specified property from all elements in the Observable sequence.
* @param {String} property The property to pluck.
* @returns {Observable} Returns a new Observable sequence of property values.
*/
observableProto.pluck = function (property) {
return this.select(function (x) { return x[property]; });
};
function selectMany(selector) {
return this.select(function (x, i) {
var result = selector(x, i);
return isPromise(result) ? observableFromPromise(result) : result;
}).mergeObservable();
}
/**
* One of the Following:
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
*
* @example
* var res = source.selectMany(function (x) { return Rx.Observable.range(0, x); });
* Or:
* Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
*
* var res = source.selectMany(function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
* Or:
* Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
*
* var res = source.selectMany(Rx.Observable.fromArray([1,2,3]));
* @param selector A transform function to apply to each element or an observable sequence to project each element from the
* source sequence onto which could be either an observable or Promise.
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
*/
observableProto.selectMany = observableProto.flatMap = function (selector, resultSelector) {
if (resultSelector) {
return this.selectMany(function (x, i) {
var selectorResult = selector(x, i),
result = isPromise(selectorResult) ? observableFromPromise(selectorResult) : selectorResult;
return result.select(function (y) {
return resultSelector(x, y, i);
});
});
}
if (typeof selector === 'function') {
return selectMany.call(this, selector);
}
return selectMany.call(this, function () {
return selector;
});
};
/**
* Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then
* transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.
* @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences
* and that at any point in time produces the elements of the most recent inner observable sequence that has been received.
*/
observableProto.selectSwitch = observableProto.flatMapLatest = function (selector, thisArg) {
return this.select(selector, thisArg).switchLatest();
};
/**
* Bypasses a specified number of elements in an observable sequence and then returns the remaining elements.
* @param {Number} count The number of elements to skip before returning the remaining elements.
* @returns {Observable} An observable sequence that contains the elements that occur after the specified index in the input sequence.
*/
observableProto.skip = function (count) {
if (count < 0) {
throw new Error(argumentOutOfRange);
}
var observable = this;
return new AnonymousObservable(function (observer) {
var remaining = count;
return observable.subscribe(function (x) {
if (remaining <= 0) {
observer.onNext(x);
} else {
remaining--;
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Bypasses elements in an observable sequence as long as a specified condition is true and then returns the remaining elements.
* The element's index is used in the logic of the predicate function.
*
* var res = source.skipWhile(function (value) { return value < 10; });
* var res = source.skipWhile(function (value, index) { return value < 10 || index < 10; });
* @param {Function} predicate A function to test each element for a condition; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate.
*/
observableProto.skipWhile = function (predicate, thisArg) {
var source = this;
return new AnonymousObservable(function (observer) {
var i = 0, running = false;
return source.subscribe(function (x) {
if (!running) {
try {
running = !predicate.call(thisArg, x, i++, source);
} catch (e) {
observer.onError(e);
return;
}
}
if (running) {
observer.onNext(x);
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Returns a specified number of contiguous elements from the start of an observable sequence, using the specified scheduler for the edge case of take(0).
*
* var res = source.take(5);
* var res = source.take(0, Rx.Scheduler.timeout);
* @param {Number} count The number of elements to return.
* @param {Scheduler} [scheduler] Scheduler used to produce an OnCompleted message in case <paramref name="count count</paramref> is set to 0.
* @returns {Observable} An observable sequence that contains the specified number of elements from the start of the input sequence.
*/
observableProto.take = function (count, scheduler) {
if (count < 0) {
throw new Error(argumentOutOfRange);
}
if (count === 0) {
return observableEmpty(scheduler);
}
var observable = this;
return new AnonymousObservable(function (observer) {
var remaining = count;
return observable.subscribe(function (x) {
if (remaining > 0) {
remaining--;
observer.onNext(x);
if (remaining === 0) {
observer.onCompleted();
}
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Returns elements from an observable sequence as long as a specified condition is true.
* The element's index is used in the logic of the predicate function.
*
* @example
* var res = source.takeWhile(function (value) { return value < 10; });
* var res = source.takeWhile(function (value, index) { return value < 10 || index < 10; });
* @param {Function} predicate A function to test each element for a condition; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes.
*/
observableProto.takeWhile = function (predicate, thisArg) {
var observable = this;
return new AnonymousObservable(function (observer) {
var i = 0, running = true;
return observable.subscribe(function (x) {
if (running) {
try {
running = predicate.call(thisArg, x, i++, observable);
} catch (e) {
observer.onError(e);
return;
}
if (running) {
observer.onNext(x);
} else {
observer.onCompleted();
}
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Filters the elements of an observable sequence based on a predicate by incorporating the element's index.
*
* @example
* var res = source.where(function (value) { return value < 10; });
* var res = source.where(function (value, index) { return value < 10 || index < 10; });
* @param {Function} predicate A function to test each source element for a condition; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence that contains elements from the input sequence that satisfy the condition.
*/
observableProto.where = observableProto.filter = function (predicate, thisArg) {
var parent = this;
return new AnonymousObservable(function (observer) {
var count = 0;
return parent.subscribe(function (value) {
var shouldRun;
try {
shouldRun = predicate.call(thisArg, value, count++, parent);
} catch (exception) {
observer.onError(exception);
return;
}
if (shouldRun) {
observer.onNext(value);
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
var AnonymousObservable = Rx.AnonymousObservable = (function (_super) {
inherits(AnonymousObservable, _super);
// Fix subscriber to check for undefined or function returned to decorate as Disposable
function fixSubscriber(subscriber) {
if (typeof subscriber === 'undefined') {
subscriber = disposableEmpty;
} else if (typeof subscriber === 'function') {
subscriber = disposableCreate(subscriber);
}
return subscriber;
}
function AnonymousObservable(subscribe) {
if (!(this instanceof AnonymousObservable)) {
return new AnonymousObservable(subscribe);
}
function s(observer) {
var autoDetachObserver = new AutoDetachObserver(observer);
if (currentThreadScheduler.scheduleRequired()) {
currentThreadScheduler.schedule(function () {
try {
autoDetachObserver.setDisposable(fixSubscriber(subscribe(autoDetachObserver)));
} catch (e) {
if (!autoDetachObserver.fail(e)) {
throw e;
}
}
});
} else {
try {
autoDetachObserver.setDisposable(fixSubscriber(subscribe(autoDetachObserver)));
} catch (e) {
if (!autoDetachObserver.fail(e)) {
throw e;
}
}
}
return autoDetachObserver;
}
_super.call(this, s);
}
return AnonymousObservable;
}(Observable));
/** @private */
var AutoDetachObserver = (function (_super) {
inherits(AutoDetachObserver, _super);
function AutoDetachObserver(observer) {
_super.call(this);
this.observer = observer;
this.m = new SingleAssignmentDisposable();
}
var AutoDetachObserverPrototype = AutoDetachObserver.prototype;
AutoDetachObserverPrototype.next = function (value) {
var noError = false;
try {
this.observer.onNext(value);
noError = true;
} catch (e) {
throw e;
} finally {
if (!noError) {
this.dispose();
}
}
};
AutoDetachObserverPrototype.error = function (exn) {
try {
this.observer.onError(exn);
} catch (e) {
throw e;
} finally {
this.dispose();
}
};
AutoDetachObserverPrototype.completed = function () {
try {
this.observer.onCompleted();
} catch (e) {
throw e;
} finally {
this.dispose();
}
};
AutoDetachObserverPrototype.setDisposable = function (value) { this.m.setDisposable(value); };
AutoDetachObserverPrototype.getDisposable = function (value) { return this.m.getDisposable(); };
/* @private */
AutoDetachObserverPrototype.disposable = function (value) {
return arguments.length ? this.getDisposable() : setDisposable(value);
};
AutoDetachObserverPrototype.dispose = function () {
_super.prototype.dispose.call(this);
this.m.dispose();
};
return AutoDetachObserver;
}(AbstractObserver));
/** @private */
var GroupedObservable = (function (_super) {
inherits(GroupedObservable, _super);
function subscribe(observer) {
return this.underlyingObservable.subscribe(observer);
}
/**
* @constructor
* @private
*/
function GroupedObservable(key, underlyingObservable, mergedDisposable) {
_super.call(this, subscribe);
this.key = key;
this.underlyingObservable = !mergedDisposable ?
underlyingObservable :
new AnonymousObservable(function (observer) {
return new CompositeDisposable(mergedDisposable.getDisposable(), underlyingObservable.subscribe(observer));
});
}
return GroupedObservable;
}(Observable));
/** @private */
var InnerSubscription = function (subject, observer) {
this.subject = subject;
this.observer = observer;
};
/**
* @private
* @memberOf InnerSubscription
*/
InnerSubscription.prototype.dispose = function () {
if (!this.subject.isDisposed && this.observer !== null) {
var idx = this.subject.observers.indexOf(this.observer);
this.subject.observers.splice(idx, 1);
this.observer = null;
}
};
/**
* Represents an object that is both an observable sequence as well as an observer.
* Each notification is broadcasted to all subscribed observers.
*/
var Subject = Rx.Subject = (function (_super) {
function subscribe(observer) {
checkDisposed.call(this);
if (!this.isStopped) {
this.observers.push(observer);
return new InnerSubscription(this, observer);
}
if (this.exception) {
observer.onError(this.exception);
return disposableEmpty;
}
observer.onCompleted();
return disposableEmpty;
}
inherits(Subject, _super);
/**
* Creates a subject.
* @constructor
*/
function Subject() {
_super.call(this, subscribe);
this.isDisposed = false,
this.isStopped = false,
this.observers = [];
}
addProperties(Subject.prototype, Observer, {
/**
* Indicates whether the subject has observers subscribed to it.
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () {
return this.observers.length > 0;
},
/**
* Notifies all subscribed observers about the end of the sequence.
*/
onCompleted: function () {
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
this.isStopped = true;
for (var i = 0, len = os.length; i < len; i++) {
os[i].onCompleted();
}
this.observers = [];
}
},
/**
* Notifies all subscribed observers about the exception.
* @param {Mixed} error The exception to send to all observers.
*/
onError: function (exception) {
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
this.isStopped = true;
this.exception = exception;
for (var i = 0, len = os.length; i < len; i++) {
os[i].onError(exception);
}
this.observers = [];
}
},
/**
* Notifies all subscribed observers about the arrival of the specified element in the sequence.
* @param {Mixed} value The value to send to all observers.
*/
onNext: function (value) {
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
for (var i = 0, len = os.length; i < len; i++) {
os[i].onNext(value);
}
}
},
/**
* Unsubscribe all observers and release resources.
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
}
});
/**
* Creates a subject from the specified observer and observable.
* @param {Observer} observer The observer used to send messages to the subject.
* @param {Observable} observable The observable used to subscribe to messages sent from the subject.
* @returns {Subject} Subject implemented using the given observer and observable.
*/
Subject.create = function (observer, observable) {
return new AnonymousSubject(observer, observable);
};
return Subject;
}(Observable));
/**
* Represents the result of an asynchronous operation.
* The last value before the OnCompleted notification, or the error received through OnError, is sent to all subscribed observers.
*/
var AsyncSubject = Rx.AsyncSubject = (function (_super) {
function subscribe(observer) {
checkDisposed.call(this);
if (!this.isStopped) {
this.observers.push(observer);
return new InnerSubscription(this, observer);
}
var ex = this.exception,
hv = this.hasValue,
v = this.value;
if (ex) {
observer.onError(ex);
} else if (hv) {
observer.onNext(v);
observer.onCompleted();
} else {
observer.onCompleted();
}
return disposableEmpty;
}
inherits(AsyncSubject, _super);
/**
* Creates a subject that can only receive one value and that value is cached for all future observations.
* @constructor
*/
function AsyncSubject() {
_super.call(this, subscribe);
this.isDisposed = false;
this.isStopped = false;
this.value = null;
this.hasValue = false;
this.observers = [];
this.exception = null;
}
addProperties(AsyncSubject.prototype, Observer, {
/**
* Indicates whether the subject has observers subscribed to it.
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () {
checkDisposed.call(this);
return this.observers.length > 0;
},
/**
* Notifies all subscribed observers about the end of the sequence, also causing the last received value to be sent out (if any).
*/
onCompleted: function () {
var o, i, len;
checkDisposed.call(this);
if (!this.isStopped) {
this.isStopped = true;
var os = this.observers.slice(0),
v = this.value,
hv = this.hasValue;
if (hv) {
for (i = 0, len = os.length; i < len; i++) {
o = os[i];
o.onNext(v);
o.onCompleted();
}
} else {
for (i = 0, len = os.length; i < len; i++) {
os[i].onCompleted();
}
}
this.observers = [];
}
},
/**
* Notifies all subscribed observers about the exception.
* @param {Mixed} error The exception to send to all observers.
*/
onError: function (exception) {
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
this.isStopped = true;
this.exception = exception;
for (var i = 0, len = os.length; i < len; i++) {
os[i].onError(exception);
}
this.observers = [];
}
},
/**
* Sends a value to the subject. The last value received before successful termination will be sent to all subscribed and future observers.
* @param {Mixed} value The value to store in the subject.
*/
onNext: function (value) {
checkDisposed.call(this);
if (!this.isStopped) {
this.value = value;
this.hasValue = true;
}
},
/**
* Unsubscribe all observers and release resources.
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
this.exception = null;
this.value = null;
}
});
return AsyncSubject;
}(Observable));
/** @private */
var AnonymousSubject = (function (_super) {
inherits(AnonymousSubject, _super);
function subscribe(observer) {
return this.observable.subscribe(observer);
}
/**
* @private
* @constructor
*/
function AnonymousSubject(observer, observable) {
_super.call(this, subscribe);
this.observer = observer;
this.observable = observable;
}
addProperties(AnonymousSubject.prototype, Observer, {
/**
* @private
* @memberOf AnonymousSubject#
*/
onCompleted: function () {
this.observer.onCompleted();
},
/**
* @private
* @memberOf AnonymousSubject#
*/
onError: function (exception) {
this.observer.onError(exception);
},
/**
* @private
* @memberOf AnonymousSubject#
*/
onNext: function (value) {
this.observer.onNext(value);
}
});
return AnonymousSubject;
}(Observable));
if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
root.Rx = Rx;
define(function() {
return Rx;
});
} else if (freeExports && freeModule) {
// in Node.js or RingoJS
if (moduleExports) {
(freeModule.exports = Rx).Rx = Rx;
} else {
freeExports.Rx = Rx;
}
} else {
// in a browser or Rhino
root.Rx = Rx;
}
}.call(this)); |
node_modules/bs-recipes/recipes/webpack.react-transform-hmr/app/js/main.js | medaymenourabi/HikingZoneFront | import React from 'react';
import { render } from 'react-dom';
// It's important to not define HelloWorld component right in this file
// because in that case it will do full page reload on change
import HelloWorld from './HelloWorld.jsx';
render(<HelloWorld />, document.getElementById('react-root'));
|
threeforce/node_modules/react-bootstrap/es/utils/ValidComponentChildren.js | wolfiex/VisACC | // TODO: This module should be ElementChildren, and should use named exports.
import React from 'react';
/**
* Iterates through children that are typically specified as `props.children`,
* but only maps 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)} func.
* @param {*} context Context for func.
* @return {object} Object containing the ordered map of results.
*/
function map(children, func, context) {
var index = 0;
return React.Children.map(children, function (child) {
if (!React.isValidElement(child)) {
return child;
}
return func.call(context, child, index++);
});
}
/**
* Iterates through 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)} func.
* @param {*} context Context for context.
*/
function forEach(children, func, context) {
var index = 0;
React.Children.forEach(children, function (child) {
if (!React.isValidElement(child)) {
return;
}
func.call(context, child, index++);
});
}
/**
* Count the number of "valid components" in the Children container.
*
* @param {?*} children Children tree container.
* @returns {number}
*/
function count(children) {
var result = 0;
React.Children.forEach(children, function (child) {
if (!React.isValidElement(child)) {
return;
}
++result;
});
return result;
}
/**
* Finds 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)} func.
* @param {*} context Context for func.
* @returns {array} of children that meet the func return statement
*/
function filter(children, func, context) {
var index = 0;
var result = [];
React.Children.forEach(children, function (child) {
if (!React.isValidElement(child)) {
return;
}
if (func.call(context, child, index++)) {
result.push(child);
}
});
return result;
}
function find(children, func, context) {
var index = 0;
var result = undefined;
React.Children.forEach(children, function (child) {
if (result) {
return;
}
if (!React.isValidElement(child)) {
return;
}
if (func.call(context, child, index++)) {
result = child;
}
});
return result;
}
function every(children, func, context) {
var index = 0;
var result = true;
React.Children.forEach(children, function (child) {
if (!result) {
return;
}
if (!React.isValidElement(child)) {
return;
}
if (!func.call(context, child, index++)) {
result = false;
}
});
return result;
}
function some(children, func, context) {
var index = 0;
var result = false;
React.Children.forEach(children, function (child) {
if (result) {
return;
}
if (!React.isValidElement(child)) {
return;
}
if (func.call(context, child, index++)) {
result = true;
}
});
return result;
}
function toArray(children) {
var result = [];
React.Children.forEach(children, function (child) {
if (!React.isValidElement(child)) {
return;
}
result.push(child);
});
return result;
}
export default {
map: map,
forEach: forEach,
count: count,
find: find,
filter: filter,
every: every,
some: some,
toArray: toArray
}; |
fields/types/boolean/BooleanFilter.js | qwales1/keystone | import React from 'react';
import { SegmentedControl } from 'elemental';
const VALUE_OPTIONS = [
{ label: 'Is Checked', value: true },
{ label: 'Is NOT Checked', value: false },
];
function getDefaultValue () {
return {
value: true,
};
}
var BooleanFilter = React.createClass({
propTypes: {
filter: React.PropTypes.shape({
value: React.PropTypes.bool,
}),
},
statics: {
getDefaultValue: getDefaultValue,
},
getDefaultProps () {
return {
filter: getDefaultValue(),
};
},
updateValue (value) {
this.props.onChange({ value });
},
render () {
return <SegmentedControl equalWidthSegments options={VALUE_OPTIONS} value={this.props.filter.value} onChange={this.updateValue} />;
},
});
module.exports = BooleanFilter;
|
ajax/libs/forerunnerdb/1.3.435/fdb-core+views.min.js | dada0423/cdnjs | !function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){var d=a("./core");a("../lib/View");"undefined"!=typeof window&&(window.ForerunnerDB=d),b.exports=d},{"../lib/View":31,"./core":2}],2:[function(a,b,c){var d=a("../lib/Core");a("../lib/Shim.IE8");"undefined"!=typeof window&&(window.ForerunnerDB=d),b.exports=d},{"../lib/Core":7,"../lib/Shim.IE8":30}],3:[function(a,b,c){"use strict";var d=a("./Shared"),e=function(a){var b;this._primaryKey="_id",this._keyArr=[],this._data=[],this._objLookup={},this._count=0;for(b in a)a.hasOwnProperty(b)&&this._keyArr.push({key:b,dir:a[b]})};d.addModule("ActiveBucket",e),d.mixin(e.prototype,"Mixin.Sorting"),d.synthesize(e.prototype,"primaryKey"),e.prototype.qs=function(a,b,c,d){if(!b.length)return 0;for(var e,f,g,h=-1,i=0,j=b.length-1;j>=i&&(e=Math.floor((i+j)/2),h!==e);)f=b[e],void 0!==f&&(g=d(this,a,c,f),g>0&&(i=e+1),0>g&&(j=e-1)),h=e;return g>0?e+1:e},e.prototype._sortFunc=function(a,b,c,d){var e,f,g,h=c.split(".:."),i=d.split(".:."),j=a._keyArr,k=j.length;for(e=0;k>e;e++)if(f=j[e],g=typeof b[f.key],"number"===g&&(h[e]=Number(h[e]),i[e]=Number(i[e])),h[e]!==i[e]){if(1===f.dir)return a.sortAsc(h[e],i[e]);if(-1===f.dir)return a.sortDesc(h[e],i[e])}},e.prototype.insert=function(a){var b,c;return b=this.documentKey(a),c=this._data.indexOf(b),-1===c?(c=this.qs(a,this._data,b,this._sortFunc),this._data.splice(c,0,b)):this._data.splice(c,0,b),this._objLookup[a[this._primaryKey]]=b,this._count++,c},e.prototype.remove=function(a){var b,c;return b=this._objLookup[a[this._primaryKey]],b?(c=this._data.indexOf(b),c>-1?(this._data.splice(c,1),delete this._objLookup[a[this._primaryKey]],this._count--,!0):!1):!1},e.prototype.index=function(a){var b,c;return b=this.documentKey(a),c=this._data.indexOf(b),-1===c&&(c=this.qs(a,this._data,b,this._sortFunc)),c},e.prototype.documentKey=function(a){var b,c,d="",e=this._keyArr,f=e.length;for(b=0;f>b;b++)c=e[b],d&&(d+=".:."),d+=a[c.key];return d+=".:."+a[this._primaryKey]},e.prototype.count=function(){return this._count},d.finishModule("ActiveBucket"),b.exports=e},{"./Shared":29}],4:[function(a,b,c){"use strict";var d=a("./Shared"),e=a("./Path"),f=function(a,b,c){this.init.apply(this,arguments)};f.prototype.init=function(a,b,c,d){this._store=[],this._keys=[],void 0!==b&&this.index(b),void 0!==c&&this.compareFunc(c),void 0!==d&&this.hashFunc(d),void 0!==a&&this.data(a)},d.addModule("BinaryTree",f),d.mixin(f.prototype,"Mixin.ChainReactor"),d.mixin(f.prototype,"Mixin.Sorting"),d.mixin(f.prototype,"Mixin.Common"),d.synthesize(f.prototype,"compareFunc"),d.synthesize(f.prototype,"hashFunc"),d.synthesize(f.prototype,"indexDir"),d.synthesize(f.prototype,"keys"),d.synthesize(f.prototype,"index",function(a){return void 0!==a&&this.keys(this.extractKeys(a)),this.$super.call(this,a)}),f.prototype.extractKeys=function(a){var b,c=[];for(b in a)a.hasOwnProperty(b)&&c.push({key:b,val:a[b]});return c},f.prototype.data=function(a){return void 0!==a?(this._data=a,this._hashFunc&&(this._hash=this._hashFunc(a)),this):this._data},f.prototype.push=function(a){return void 0!==a?(this._store.push(a),this):!1},f.prototype.pull=function(a){if(void 0!==a){var b=this._store.indexOf(a);if(b>-1)return this._store.splice(b,1),this}return!1},f.prototype._compareFunc=function(a,b){var c,d,e=0;for(c=0;c<this._keys.length;c++)if(d=this._keys[c],1===d.val?e=this.sortAsc(a[d.key],b[d.key]):-1===d.val&&(e=this.sortDesc(a[d.key],b[d.key])),0!==e)return e;return e},f.prototype._hashFunc=function(a){return a[this._keys[0].key]},f.prototype.insert=function(a){var b,c,d,e;if(a instanceof Array){for(c=[],d=[],e=0;e<a.length;e++)this.insert(a[e])?c.push(a[e]):d.push(a[e]);return{inserted:c,failed:d}}return this._data?(b=this._compareFunc(this._data,a),0===b?(this.push(a),this._left?this._left.insert(a):this._left=new f(a,this._index,this._compareFunc,this._hashFunc),!0):-1===b?(this._right?this._right.insert(a):this._right=new f(a,this._index,this._compareFunc,this._hashFunc),!0):1===b?(this._left?this._left.insert(a):this._left=new f(a,this._index,this._compareFunc,this._hashFunc),!0):!1):(this.data(a),!0)},f.prototype.lookup=function(a,b){var c=this._compareFunc(this._data,a);return b=b||[],0===c&&(this._left&&this._left.lookup(a,b),b.push(this._data),this._right&&this._right.lookup(a,b)),-1===c&&this._right&&this._right.lookup(a,b),1===c&&this._left&&this._left.lookup(a,b),b},f.prototype.inOrder=function(a,b){switch(b=b||[],this._left&&this._left.inOrder(a,b),a){case"hash":b.push(this._hash);break;case"data":b.push(this._data);break;default:b.push({key:this._data,arr:this._store})}return this._right&&this._right.inOrder(a,b),b},f.prototype.findRange=function(a,b,c,d,f,g){f=f||[],g=g||new e(b),this._left&&this._left.findRange(a,b,c,d,f,g);var h=g.value(this._data),i=this.sortAsc(h,c),j=this.sortAsc(h,d);if(!(0!==i&&1!==i||0!==j&&-1!==j))switch(a){case"hash":f.push(this._hash);break;case"data":f.push(this._data);break;default:f.push({key:this._data,arr:this._store})}return this._right&&this._right.findRange(a,b,c,d,f,g),f},f.prototype.match=function(a,b){var c,d,f,g=new e,h=[],i=0;for(c=g.parseArr(this._index,{verbose:!0}),d=g.parseArr(a,{ignore:/\$/,verbose:!0}),f=0;f<c.length;f++)d[f]===c[f]&&(i++,h.push(d[f]));return{matchedKeys:h,totalKeyCount:d.length,score:i}},d.finishModule("BinaryTree"),b.exports=f},{"./Path":26,"./Shared":29}],5:[function(a,b,c){"use strict";var d,e,f,g,h,i,j,k,l,m;d=a("./Shared");var n=function(a){this.init.apply(this,arguments)};n.prototype.init=function(a,b){this._primaryKey="_id",this._primaryIndex=new g("primary"),this._primaryCrc=new g("primaryCrc"),this._crcLookup=new g("crcLookup"),this._name=a,this._data=[],this._metrics=new f,this._options=b||{changeTimestamp:!1},this._metaData={},this._deferQueue={insert:[],update:[],remove:[],upsert:[]},this._deferThreshold={insert:100,update:100,remove:100,upsert:100},this._deferTime={insert:1,update:1,remove:1,upsert:1},this.subsetOf(this)},d.addModule("Collection",n),d.mixin(n.prototype,"Mixin.Common"),d.mixin(n.prototype,"Mixin.Events"),d.mixin(n.prototype,"Mixin.ChainReactor"),d.mixin(n.prototype,"Mixin.CRUD"),d.mixin(n.prototype,"Mixin.Constants"),d.mixin(n.prototype,"Mixin.Triggers"),d.mixin(n.prototype,"Mixin.Sorting"),d.mixin(n.prototype,"Mixin.Matching"),d.mixin(n.prototype,"Mixin.Updating"),d.mixin(n.prototype,"Mixin.Tags"),f=a("./Metrics"),g=a("./KeyValueStore"),h=a("./Path"),i=a("./IndexHashMap"),j=a("./IndexBinaryTree"),k=a("./Crc"),e=d.modules.Db,l=a("./Overload"),m=a("./ReactorIO"),n.prototype.crc=k,d.synthesize(n.prototype,"state"),d.synthesize(n.prototype,"name"),d.synthesize(n.prototype,"metaData"),d.synthesize(n.prototype,"capped"),d.synthesize(n.prototype,"cappedSize"),n.prototype.data=function(){return this._data},n.prototype.drop=function(a){var b;if(this.isDropped())return a&&a(!1,!0),!0;if(this._db&&this._db._collection&&this._name){if(this.debug()&&console.log(this.logIdentifier()+" Dropping"),this._state="dropped",this.emit("drop",this),delete this._db._collection[this._name],this._collate)for(b in this._collate)this._collate.hasOwnProperty(b)&&this.collateRemove(b);return delete this._primaryKey,delete this._primaryIndex,delete this._primaryCrc,delete this._crcLookup,delete this._name,delete this._data,delete this._metrics,a&&a(!1,!0),!0}return a&&a(!1,!0),!1},n.prototype.primaryKey=function(a){if(void 0!==a){if(this._primaryKey!==a){var b=this._primaryKey;this._primaryKey=a,this._primaryIndex.primaryKey(a),this.rebuildPrimaryKeyIndex(),this.chainSend("primaryKey",a,{oldData:b})}return this}return this._primaryKey},n.prototype._onInsert=function(a,b){this.emit("insert",a,b)},n.prototype._onUpdate=function(a){this.emit("update",a)},n.prototype._onRemove=function(a){this.emit("remove",a)},n.prototype._onChange=function(){this._options.changeTimestamp&&(this._metaData.lastChange=new Date)},d.synthesize(n.prototype,"db",function(a){return a&&"_id"===this.primaryKey()&&(this.primaryKey(a.primaryKey()),this.debug(a.debug())),this.$super.apply(this,arguments)}),d.synthesize(n.prototype,"mongoEmulation"),n.prototype.setData=function(a,b,c){if(this.isDropped())throw this.logIdentifier()+" Cannot operate in a dropped state!";if(a){var d=this._metrics.create("setData");d.start(),b=this.options(b),this.preSetData(a,b,c),b.$decouple&&(a=this.decouple(a)),a instanceof Array||(a=[a]),d.time("transformIn"),a=this.transformIn(a),d.time("transformIn");var e=[].concat(this._data);this._dataReplace(a),d.time("Rebuild Primary Key Index"),this.rebuildPrimaryKeyIndex(b),d.time("Rebuild Primary Key Index"),d.time("Rebuild All Other Indexes"),this._rebuildIndexes(),d.time("Rebuild All Other Indexes"),d.time("Resolve chains"),this.chainSend("setData",a,{oldData:e}),d.time("Resolve chains"),d.stop(),this._onChange(),this.emit("setData",this._data,e)}return c&&c(!1),this},n.prototype.rebuildPrimaryKeyIndex=function(a){a=a||{$ensureKeys:void 0,$violationCheck:void 0};var b,c,d,e,f=a&&void 0!==a.$ensureKeys?a.$ensureKeys:!0,g=a&&void 0!==a.$violationCheck?a.$violationCheck:!0,h=this._primaryIndex,i=this._primaryCrc,j=this._crcLookup,k=this._primaryKey;for(h.truncate(),i.truncate(),j.truncate(),b=this._data,c=b.length;c--;){if(d=b[c],f&&this.ensurePrimaryKey(d),g){if(!h.uniqueSet(d[k],d))throw this.logIdentifier()+" Call to setData on collection failed because your data violates the primary key unique constraint. One or more documents are using the same primary key: "+d[this._primaryKey]}else h.set(d[k],d);e=this.jStringify(d),i.set(d[k],e),j.set(e,d)}},n.prototype.ensurePrimaryKey=function(a){void 0===a[this._primaryKey]&&(a[this._primaryKey]=this.objectId())},n.prototype.truncate=function(){if(this.isDropped())throw this.logIdentifier()+" Cannot operate in a dropped state!";return this.emit("truncate",this._data),this._data.length=0,this._primaryIndex=new g("primary"),this._primaryCrc=new g("primaryCrc"),this._crcLookup=new g("crcLookup"),this._onChange(),this.deferEmit("change",{type:"truncate"}),this},n.prototype.upsert=function(a,b){if(this.isDropped())throw this.logIdentifier()+" Cannot operate in a dropped state!";if(a){var c,d,e=this._deferQueue.upsert,f=this._deferThreshold.upsert,g={};if(a instanceof Array){if(a.length>f)return this._deferQueue.upsert=e.concat(a),this.processQueue("upsert",b),{};for(g=[],d=0;d<a.length;d++)g.push(this.upsert(a[d]));return b&&b(),g}switch(a[this._primaryKey]?(c={},c[this._primaryKey]=a[this._primaryKey],this._primaryIndex.lookup(c)[0]?g.op="update":g.op="insert"):g.op="insert",g.op){case"insert":g.result=this.insert(a);break;case"update":g.result=this.update(c,a)}return g}return b&&b(),{}},n.prototype.filter=function(a,b,c){return this.find(a,c).filter(b)},n.prototype.filterUpdate=function(a,b,c){var d,e,f,g,h=this.find(a,c),i=[],j=this.primaryKey();for(g=0;g<h.length;g++)d=h[g],f=b(d),f&&(e={},e[j]=d[j],i.push(this.update(e,f)));return i},n.prototype.update=function(a,b,c){if(this.isDropped())throw this.logIdentifier()+" Cannot operate in a dropped state!";b=this.decouple(b),this.mongoEmulation()&&(this.convertToFdb(a),this.convertToFdb(b)),b=this.transformIn(b),this.debug()&&console.log(this.logIdentifier()+" Updating some data");var d,e,f=this,g=this._metrics.create("update"),h=function(d){var e,h,i,j=f.decouple(d);return f.willTrigger(f.TYPE_UPDATE,f.PHASE_BEFORE)||f.willTrigger(f.TYPE_UPDATE,f.PHASE_AFTER)?(e=f.decouple(d),h={type:"update",query:f.decouple(a),update:f.decouple(b),options:f.decouple(c),op:g},i=f.updateObject(e,h.update,h.query,h.options,""),f.processTrigger(h,f.TYPE_UPDATE,f.PHASE_BEFORE,d,e)!==!1?(i=f.updateObject(d,e,h.query,h.options,""),f.processTrigger(h,f.TYPE_UPDATE,f.PHASE_AFTER,j,e)):i=!1):i=f.updateObject(d,b,a,c,""),f._updateIndexes(j,d),i};return g.start(),g.time("Retrieve documents to update"),d=this.find(a,{$decouple:!1}),g.time("Retrieve documents to update"),d.length&&(g.time("Update documents"),e=d.filter(h),g.time("Update documents"),e.length&&(g.time("Resolve chains"),this.chainSend("update",{query:a,update:b,dataSet:e},c),g.time("Resolve chains"),this._onUpdate(e),this._onChange(),this.deferEmit("change",{type:"update",data:e}))),g.stop(),e||[]},n.prototype._replaceObj=function(a,b){var c;this._removeFromIndexes(a);for(c in a)a.hasOwnProperty(c)&&delete a[c];for(c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);if(!this._insertIntoIndexes(a))throw this.logIdentifier()+" Primary key violation in update! Key violated: "+a[this._primaryKey];return this},n.prototype.updateById=function(a,b){var c={};return c[this._primaryKey]=a,this.update(c,b)},n.prototype.updateObject=function(a,b,c,d,e,f){b=this.decouple(b),e=e||"","."===e.substr(0,1)&&(e=e.substr(1,e.length-1));var g,i,j,k,l,m,n,o,p,q=!1,r=!1;for(p in b)if(b.hasOwnProperty(p)){if(g=!1,"$"===p.substr(0,1))switch(p){case"$key":case"$index":case"$data":case"$min":case"$max":g=!0;break;case"$each":for(g=!0,k=b.$each.length,j=0;k>j;j++)r=this.updateObject(a,b.$each[j],c,d,e),r&&(q=!0);q=q||r;break;default:g=!0,r=this.updateObject(a,b[p],c,d,e,p),q=q||r}if(this._isPositionalKey(p)&&(g=!0,p=p.substr(0,p.length-2),m=new h(e+"."+p),a[p]&&a[p]instanceof Array&&a[p].length)){for(i=[],j=0;j<a[p].length;j++)this._match(a[p][j],m.value(c)[0],d,"",{})&&i.push(j);for(j=0;j<i.length;j++)r=this.updateObject(a[p][i[j]],b[p+".$"],c,d,e+"."+p,f),q=q||r}if(!g)if(f||"object"!=typeof b[p])switch(f){case"$inc":var s=!0;b[p]>0?b.$max&&a[p]>=b.$max&&(s=!1):b[p]<0&&b.$min&&a[p]<=b.$min&&(s=!1),s&&(this._updateIncrement(a,p,b[p]),q=!0);break;case"$cast":switch(b[p]){case"array":a[p]instanceof Array||(this._updateProperty(a,p,b.$data||[]),q=!0);break;case"object":(!(a[p]instanceof Object)||a[p]instanceof Array)&&(this._updateProperty(a,p,b.$data||{}),q=!0);break;case"number":"number"!=typeof a[p]&&(this._updateProperty(a,p,Number(a[p])),q=!0);break;case"string":"string"!=typeof a[p]&&(this._updateProperty(a,p,String(a[p])),q=!0);break;default:throw this.logIdentifier()+" Cannot update cast to unknown type: "+b[p]}break;case"$push":if(void 0===a[p]&&this._updateProperty(a,p,[]),!(a[p]instanceof Array))throw this.logIdentifier()+" Cannot push to a key that is not an array! ("+p+")";if(void 0!==b[p].$position&&b[p].$each instanceof Array)for(l=b[p].$position,k=b[p].$each.length,j=0;k>j;j++)this._updateSplicePush(a[p],l+j,b[p].$each[j]);else if(b[p].$each instanceof Array)for(k=b[p].$each.length,j=0;k>j;j++)this._updatePush(a[p],b[p].$each[j]);else this._updatePush(a[p],b[p]);q=!0;break;case"$pull":if(a[p]instanceof Array){for(i=[],j=0;j<a[p].length;j++)this._match(a[p][j],b[p],d,"",{})&&i.push(j);for(k=i.length;k--;)this._updatePull(a[p],i[k]),q=!0}break;case"$pullAll":if(a[p]instanceof Array){if(!(b[p]instanceof Array))throw this.logIdentifier()+" Cannot pullAll without being given an array of values to pull! ("+p+")";if(i=a[p],k=i.length,k>0)for(;k--;){for(l=0;l<b[p].length;l++)i[k]===b[p][l]&&(this._updatePull(a[p],k),k--,q=!0);if(0>k)break}}break;case"$addToSet":if(void 0===a[p]&&this._updateProperty(a,p,[]),!(a[p]instanceof Array))throw this.logIdentifier()+" Cannot addToSet on a key that is not an array! ("+p+")";var t,u,v,w,x=a[p],y=x.length,z=!0,A=d&&d.$addToSet;for(b[p].$key?(v=!1,w=new h(b[p].$key),u=w.value(b[p])[0],delete b[p].$key):A&&A.key?(v=!1,w=new h(A.key),u=w.value(b[p])[0]):(u=this.jStringify(b[p]),v=!0),t=0;y>t;t++)if(v){if(this.jStringify(x[t])===u){z=!1;break}}else if(u===w.value(x[t])[0]){z=!1;break}z&&(this._updatePush(a[p],b[p]),q=!0);break;case"$splicePush":if(void 0===a[p]&&this._updateProperty(a,p,[]),!(a[p]instanceof Array))throw this.logIdentifier()+" Cannot splicePush with a key that is not an array! ("+p+")";if(l=b.$index,void 0===l)throw this.logIdentifier()+" Cannot splicePush without a $index integer value!";delete b.$index,l>a[p].length&&(l=a[p].length),this._updateSplicePush(a[p],l,b[p]),q=!0;break;case"$move":if(!(a[p]instanceof Array))throw this.logIdentifier()+" Cannot move on a key that is not an array! ("+p+")";for(j=0;j<a[p].length;j++)if(this._match(a[p][j],b[p],d,"",{})){var B=b.$index;if(void 0===B)throw this.logIdentifier()+" Cannot move without a $index integer value!";delete b.$index,this._updateSpliceMove(a[p],j,B),q=!0;break}break;case"$mul":this._updateMultiply(a,p,b[p]),q=!0;break;case"$rename":this._updateRename(a,p,b[p]),q=!0;break;case"$overwrite":this._updateOverwrite(a,p,b[p]),q=!0;break;case"$unset":this._updateUnset(a,p),q=!0;break;case"$clear":this._updateClear(a,p),q=!0;break;case"$pop":if(!(a[p]instanceof Array))throw this.logIdentifier()+" Cannot pop from a key that is not an array! ("+p+")";this._updatePop(a[p],b[p])&&(q=!0);break;case"$toggle":this._updateProperty(a,p,!a[p]),q=!0;break;default:a[p]!==b[p]&&(this._updateProperty(a,p,b[p]),q=!0)}else if(null!==a[p]&&"object"==typeof a[p])if(n=a[p]instanceof Array,o=b[p]instanceof Array,n||o)if(!o&&n)for(j=0;j<a[p].length;j++)r=this.updateObject(a[p][j],b[p],c,d,e+"."+p,f),q=q||r;else a[p]!==b[p]&&(this._updateProperty(a,p,b[p]),q=!0);else r=this.updateObject(a[p],b[p],c,d,e+"."+p,f),q=q||r;else a[p]!==b[p]&&(this._updateProperty(a,p,b[p]),q=!0)}return q},n.prototype._isPositionalKey=function(a){return".$"===a.substr(a.length-2,2)},n.prototype.remove=function(a,b,c){if(this.isDropped())throw this.logIdentifier()+" Cannot operate in a dropped state!";var d,e,f,g,h,i,j,k,l=this;if("function"==typeof b&&(c=b,b={}),this.mongoEmulation()&&this.convertToFdb(a),a instanceof Array){for(g=[],f=0;f<a.length;f++)g.push(this.remove(a[f],{noEmit:!0}));return(!b||b&&!b.noEmit)&&this._onRemove(g),c&&c(!1,g),g}if(g=[],d=this.find(a,{$decouple:!1}),d.length){h=function(a){l._removeFromIndexes(a),e=l._data.indexOf(a),l._dataRemoveAtIndex(e),g.push(a)};for(var m=0;m<d.length;m++)j=d[m],l.willTrigger(l.TYPE_REMOVE,l.PHASE_BEFORE)||l.willTrigger(l.TYPE_REMOVE,l.PHASE_AFTER)?(i={type:"remove"},k=l.decouple(j),l.processTrigger(i,l.TYPE_REMOVE,l.PHASE_BEFORE,k,k)!==!1&&(h(j),l.processTrigger(i,l.TYPE_REMOVE,l.PHASE_AFTER,k,k))):h(j);g.length&&(l.chainSend("remove",{query:a,dataSet:g},b),(!b||b&&!b.noEmit)&&this._onRemove(g),this._onChange(),this.deferEmit("change",{type:"remove",data:g}))}return c&&c(!1,g),g},n.prototype.removeById=function(a){var b={};return b[this._primaryKey]=a,this.remove(b)},n.prototype.processQueue=function(a,b,c){var d,e,f=this,g=this._deferQueue[a],h=this._deferThreshold[a],i=this._deferTime[a];if(c=c||{deferred:!0},g.length){if(g.length)switch(d=g.length>h?g.splice(0,h):g.splice(0,g.length),e=f[a](d),a){case"insert":c.inserted=c.inserted||[],c.failed=c.failed||[],c.inserted=c.inserted.concat(e.inserted),c.failed=c.failed.concat(e.failed)}setTimeout(function(){f.processQueue.call(f,a,b,c)},i)}else b&&b(c);this.isProcessingQueue()||this.emit("queuesComplete")},n.prototype.isProcessingQueue=function(){var a;for(a in this._deferQueue)if(this._deferQueue.hasOwnProperty(a)&&this._deferQueue[a].length)return!0;return!1},n.prototype.insert=function(a,b,c){if(this.isDropped())throw this.logIdentifier()+" Cannot operate in a dropped state!";return"function"==typeof b?(c=b,b=this._data.length):void 0===b&&(b=this._data.length),a=this.transformIn(a),this._insertHandle(a,b,c)},n.prototype._insertHandle=function(a,b,c){var d,e,f,g=this._deferQueue.insert,h=this._deferThreshold.insert,i=[],j=[];if(a instanceof Array){if(a.length>h)return this._deferQueue.insert=g.concat(a),void this.processQueue("insert",c);for(f=0;f<a.length;f++)d=this._insert(a[f],b+f),d===!0?i.push(a[f]):j.push({doc:a[f],reason:d})}else d=this._insert(a,b),d===!0?i.push(a):j.push({doc:a,reason:d});return e={deferred:!1,inserted:i,failed:j},this._onInsert(i,j),c&&c(e),this._onChange(),this.deferEmit("change",{type:"insert",data:i}),e},n.prototype._insert=function(a,b){if(a){var c,d,e,f,g=this,h=this.capped(),i=this.cappedSize();if(this.ensurePrimaryKey(a),c=this.insertIndexViolation(a),e=function(a){g._insertIntoIndexes(a),b>g._data.length&&(b=g._data.length),g._dataInsertAtIndex(b,a),h&&g._data.length>i&&g.removeById(g._data[0][g._primaryKey]),g.chainSend("insert",a,{index:b})},c)return"Index violation in index: "+c;if(g.willTrigger(g.TYPE_INSERT,g.PHASE_BEFORE)||g.willTrigger(g.TYPE_INSERT,g.PHASE_AFTER)){if(d={type:"insert"},g.processTrigger(d,g.TYPE_INSERT,g.PHASE_BEFORE,{},a)===!1)return!1;e(a),g.willTrigger(g.TYPE_INSERT,g.PHASE_AFTER)&&(f=g.decouple(a),g.processTrigger(d,g.TYPE_INSERT,g.PHASE_AFTER,{},f))}else e(a);return!0}return"No document passed to insert"},n.prototype._dataInsertAtIndex=function(a,b){this._data.splice(a,0,b)},n.prototype._dataRemoveAtIndex=function(a){this._data.splice(a,1)},n.prototype._dataReplace=function(a){for(;this._data.length;)this._data.pop();this._data=this._data.concat(a)},n.prototype._insertIntoIndexes=function(a){var b,c,d=this._indexByName,e=this.jStringify(a);c=this._primaryIndex.uniqueSet(a[this._primaryKey],a),this._primaryCrc.uniqueSet(a[this._primaryKey],e),this._crcLookup.uniqueSet(e,a);for(b in d)d.hasOwnProperty(b)&&d[b].insert(a);return c},n.prototype._removeFromIndexes=function(a){var b,c=this._indexByName,d=this.jStringify(a);this._primaryIndex.unSet(a[this._primaryKey]),this._primaryCrc.unSet(a[this._primaryKey]),this._crcLookup.unSet(d);for(b in c)c.hasOwnProperty(b)&&c[b].remove(a)},n.prototype._updateIndexes=function(a,b){this._removeFromIndexes(a),this._insertIntoIndexes(b)},n.prototype._rebuildIndexes=function(){var a,b=this._indexByName;for(a in b)b.hasOwnProperty(a)&&b[a].rebuild()},n.prototype.subset=function(a,b){var c=this.find(a,b);return(new n).subsetOf(this).primaryKey(this._primaryKey).setData(c)},d.synthesize(n.prototype,"subsetOf"),n.prototype.isSubsetOf=function(a){return this._subsetOf===a},n.prototype.distinct=function(a,b,c){if(this.isDropped())throw this.logIdentifier()+" Cannot operate in a dropped state!";var d,e,f=this.find(b,c),g=new h(a),i={},j=[];for(e=0;e<f.length;e++)d=g.value(f[e])[0],d&&!i[d]&&(i[d]=!0,j.push(d));return j},n.prototype.findById=function(a,b){var c={};return c[this._primaryKey]=a,this.find(c,b)[0]},n.prototype.peek=function(a,b){var c,d,e=this._data,f=e.length,g=new n,h=typeof a;if("string"===h){for(c=0;f>c;c++)d=this.jStringify(e[c]),d.indexOf(a)>-1&&g.insert(e[c]);return g.find({},b)}return this.find(a,b)},n.prototype.explain=function(a,b){var c=this.find(a,b);return c.__fdbOp._data},n.prototype.options=function(a){return a=a||{},a.$decouple=void 0!==a.$decouple?a.$decouple:!0,a.$explain=void 0!==a.$explain?a.$explain:!1,a},n.prototype.find=function(a,b,c){return this.mongoEmulation()&&this.convertToFdb(a),c?(c("Callbacks for the find() operation are not yet implemented!",[]),[]):this._find.apply(this,arguments)},n.prototype._find=function(a,b){if(this.isDropped())throw this.logIdentifier()+" Cannot operate in a dropped state!";a=a||{},b=this.options(b);var c,d,e,f,g,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H=this._metrics.create("find"),I=this.primaryKey(),J=this,K=!0,L={},M=[],N=[],O=[],P={},Q={},R=function(c){return J._match(c,a,b,"and",P)};if(H.start(),a){if(H.time("analyseQuery"),c=this._analyseQuery(J.decouple(a),b,H),H.time("analyseQuery"),H.data("analysis",c),c.hasJoin&&c.queriesJoin){for(H.time("joinReferences"),g=0;g<c.joinsOn.length;g++)k=c.joinsOn[g],j=new h(c.joinQueries[k]),i=j.value(a)[0],L[c.joinsOn[g]]=this._db.collection(c.joinsOn[g]).subset(i),delete a[c.joinQueries[k]];H.time("joinReferences")}if(c.indexMatch.length&&(!b||b&&!b.$skipIndex)?(H.data("index.potential",c.indexMatch),H.data("index.used",c.indexMatch[0].index),H.time("indexLookup"),e=c.indexMatch[0].lookup||[],H.time("indexLookup"),c.indexMatch[0].keyData.totalKeyCount===c.indexMatch[0].keyData.score&&(K=!1)):H.flag("usedIndex",!1),K&&(e&&e.length?(d=e.length,H.time("tableScan: "+d),e=e.filter(R)):(d=this._data.length,H.time("tableScan: "+d),e=this._data.filter(R)),H.time("tableScan: "+d)),b.$orderBy&&(H.time("sort"),e=this.sort(b.$orderBy,e),H.time("sort")),void 0!==b.$page&&void 0!==b.$limit&&(Q.page=b.$page,Q.pages=Math.ceil(e.length/b.$limit),Q.records=e.length,b.$page&&b.$limit>0&&(H.data("cursor",Q),e.splice(0,b.$page*b.$limit))),b.$skip&&(Q.skip=b.$skip,e.splice(0,b.$skip),H.data("skip",b.$skip)),b.$limit&&e&&e.length>b.$limit&&(Q.limit=b.$limit,e.length=b.$limit,H.data("limit",b.$limit)),b.$decouple&&(H.time("decouple"),e=this.decouple(e),H.time("decouple"),H.data("flag.decouple",!0)),b.$join){for(f=0;f<b.$join.length;f++)for(k in b.$join[f])if(b.$join[f].hasOwnProperty(k))for(w=k,l=L[k]?L[k]:this._db.collection(k),m=b.$join[f][k],x=0;x<e.length;x++){o={},q=!1,r=!1,v="";for(n in m)if(m.hasOwnProperty(n))if("$"===n.substr(0,1))switch(n){case"$where":m[n].query&&(o=m[n].query),m[n].options&&(p=m[n].options);break;case"$as":w=m[n];break;case"$multi":q=m[n];break;case"$require":r=m[n];break;case"$prefix":v=m[n]}else o[n]=J._resolveDynamicQuery(m[n],e[x]);if(s=l.find(o,p),!r||r&&s[0])if("$root"===w){if(q!==!1)throw this.logIdentifier()+' Cannot combine [$as: "$root"] with [$joinMulti: true] in $join clause!';t=s[0],u=e[x];for(C in t)t.hasOwnProperty(C)&&void 0===u[v+C]&&(u[v+C]=t[C])}else e[x][w]=q===!1?s[0]:s;else M.push(e[x])}H.data("flag.join",!0)}if(M.length){for(H.time("removalQueue"),z=0;z<M.length;z++)y=e.indexOf(M[z]),y>-1&&e.splice(y,1);H.time("removalQueue")}if(b.$transform){for(H.time("transform"),z=0;z<e.length;z++)e.splice(z,1,b.$transform(e[z]));H.time("transform"),H.data("flag.transform",!0)}this._transformEnabled&&this._transformOut&&(H.time("transformOut"),e=this.transformOut(e),H.time("transformOut")),H.data("results",e.length)}else e=[];H.time("scanFields");for(z in b)b.hasOwnProperty(z)&&0!==z.indexOf("$")&&(1===b[z]?N.push(z):0===b[z]&&O.push(z));if(H.time("scanFields"),N.length||O.length){for(H.data("flag.limitFields",!0),H.data("limitFields.on",N),H.data("limitFields.off",O),H.time("limitFields"),z=0;z<e.length;z++){G=e[z];for(A in G)G.hasOwnProperty(A)&&(N.length&&A!==I&&-1===N.indexOf(A)&&delete G[A],O.length&&O.indexOf(A)>-1&&delete G[A])}H.time("limitFields")}if(b.$elemMatch){H.data("flag.elemMatch",!0),H.time("projection-elemMatch");for(z in b.$elemMatch)if(b.$elemMatch.hasOwnProperty(z))for(D=new h(z),A=0;A<e.length;A++)if(E=D.value(e[A])[0],E&&E.length)for(B=0;B<E.length;B++)if(J._match(E[B],b.$elemMatch[z],b,"",{})){D.set(e[A],z,[E[B]]);break}H.time("projection-elemMatch")}if(b.$elemsMatch){H.data("flag.elemsMatch",!0),H.time("projection-elemsMatch");for(z in b.$elemsMatch)if(b.$elemsMatch.hasOwnProperty(z))for(D=new h(z),A=0;A<e.length;A++)if(E=D.value(e[A])[0],E&&E.length){for(F=[],B=0;B<E.length;B++)J._match(E[B],b.$elemsMatch[z],b,"",{})&&F.push(E[B]);D.set(e[A],z,F)}H.time("projection-elemsMatch")}return H.stop(),e.__fdbOp=H,e.$cursor=Q,e},n.prototype._resolveDynamicQuery=function(a,b){var c,d,e,f,g=this;if("string"==typeof a)return"$$."===a.substr(0,3)?new h(a.substr(3,a.length-3)).value(b)[0]:new h(a).value(b)[0];c={};for(f in a)if(a.hasOwnProperty(f))switch(d=typeof a[f],e=a[f],d){case"string":"$$."===e.substr(0,3)?c[f]=new h(e.substr(3,e.length-3)).value(b)[0]:c[f]=e;break;case"object":c[f]=g._resolveDynamicQuery(e,b);break;default:c[f]=e}return c},n.prototype.findOne=function(){return this.find.apply(this,arguments)[0]},n.prototype.indexOf=function(a,b){var c,d=this.find(a,{$decouple:!1})[0];return d?!b||b&&!b.$orderBy?this._data.indexOf(d):(b.$decouple=!1,c=this.find(a,b),c.indexOf(d)):-1},n.prototype.indexOfDocById=function(a,b){var c,d;return c="object"!=typeof a?this._primaryIndex.get(a):this._primaryIndex.get(a[this._primaryKey]),c?!b||b&&!b.$orderBy?this._data.indexOf(c):(b.$decouple=!1,d=this.find({},b),d.indexOf(c)):-1},n.prototype.removeByIndex=function(a){var b,c;return b=this._data[a],void 0!==b?(b=this.decouple(b),c=b[this.primaryKey()],this.removeById(c)):!1},n.prototype.transform=function(a){return void 0!==a?("object"==typeof a?(void 0!==a.enabled&&(this._transformEnabled=a.enabled),void 0!==a.dataIn&&(this._transformIn=a.dataIn),void 0!==a.dataOut&&(this._transformOut=a.dataOut)):this._transformEnabled=a!==!1,this):{enabled:this._transformEnabled,dataIn:this._transformIn,dataOut:this._transformOut}},n.prototype.transformIn=function(a){if(this._transformEnabled&&this._transformIn){if(a instanceof Array){var b,c=[];for(b=0;b<a.length;b++)c[b]=this._transformIn(a[b]);return c}return this._transformIn(a)}return a},n.prototype.transformOut=function(a){if(this._transformEnabled&&this._transformOut){if(a instanceof Array){var b,c=[];for(b=0;b<a.length;b++)c[b]=this._transformOut(a[b]);return c}return this._transformOut(a)}return a},n.prototype.sort=function(a,b){b=b||[];var c,d,e=[];for(c in a)a.hasOwnProperty(c)&&(d={},d[c]=a[c],d.___fdbKey=String(c),e.push(d));return e.length<2?this._sort(a,b):this._bucketSort(e,b)},n.prototype._bucketSort=function(a,b){var c,d,e,f,g,h,i=a.shift(),j=[];if(a.length>0){for(b=this._sort(i,b),d=this.bucket(i.___fdbKey,b),e=d.order,g=d.buckets,h=0;h<e.length;h++)f=e[h],c=[].concat(a),j=j.concat(this._bucketSort(c,g[f]));return j}return this._sort(i,b)},n.prototype._sort=function(a,b){var c,d=this,e=new h,f=e.parse(a,!0)[0];if(e.path(f.path),1===f.value)c=function(a,b){var c=e.value(a)[0],f=e.value(b)[0];return d.sortAsc(c,f)};else{if(-1!==f.value)throw this.logIdentifier()+" $orderBy clause has invalid direction: "+f.value+", accepted values are 1 or -1 for ascending or descending!";c=function(a,b){var c=e.value(a)[0],f=e.value(b)[0];return d.sortDesc(c,f)}}return b.sort(c)},n.prototype.bucket=function(a,b){var c,d,e,f=[],g={};for(c=0;c<b.length;c++)e=String(b[c][a]),d!==e&&(f.push(e),d=e),g[e]=g[e]||[],g[e].push(b[c]);return{buckets:g,order:f}},n.prototype._analyseQuery=function(a,b,c){var d,e,f,g,i,j,k,l,m,n,o,p={queriesOn:[this._name],indexMatch:[],hasJoin:!1,queriesJoin:!1,joinQueries:{},query:a,options:b},q=[],r=[];if(c.time("checkIndexes"),m=new h,n=m.countKeys(a)){void 0!==a[this._primaryKey]&&(c.time("checkIndexMatch: Primary Key"),p.indexMatch.push({lookup:this._primaryIndex.lookup(a,b),keyData:{matchedKeys:[this._primaryKey],totalKeyCount:n,score:1},index:this._primaryIndex}),c.time("checkIndexMatch: Primary Key"));for(o in this._indexById)if(this._indexById.hasOwnProperty(o)&&(j=this._indexById[o],k=j.name(),c.time("checkIndexMatch: "+k),i=j.match(a,b),i.score>0&&(l=j.lookup(a,b),p.indexMatch.push({lookup:l,keyData:i,index:j})),c.time("checkIndexMatch: "+k),i.score===n))break;c.time("checkIndexes"),p.indexMatch.length>1&&(c.time("findOptimalIndex"),p.indexMatch.sort(function(a,b){return a.keyData.score>b.keyData.score?-1:a.keyData.score<b.keyData.score?1:a.keyData.score===b.keyData.score?a.lookup.length-b.lookup.length:void 0}),c.time("findOptimalIndex"))}if(b.$join){for(p.hasJoin=!0,d=0;d<b.$join.length;d++)for(e in b.$join[d])b.$join[d].hasOwnProperty(e)&&(q.push(e),"$as"in b.$join[d][e]?r.push(b.$join[d][e].$as):r.push(e));for(g=0;g<r.length;g++)f=this._queryReferencesCollection(a,r[g],""),f&&(p.joinQueries[q[g]]=f,p.queriesJoin=!0);p.joinsOn=q,p.queriesOn=p.queriesOn.concat(q)}return p},n.prototype._queryReferencesCollection=function(a,b,c){var d;for(d in a)if(a.hasOwnProperty(d)){if(d===b)return c&&(c+="."),c+d;if("object"==typeof a[d])return c&&(c+="."),c+=d,this._queryReferencesCollection(a[d],b,c)}return!1},n.prototype.count=function(a,b){return a?this.find(a,b).length:this._data.length},n.prototype.findSub=function(a,b,c,d){var e,f,g,i=new h(b),j=this.find(a),k=j.length,l=this._db.collection("__FDB_temp_"+this.objectId()),m={parents:k,subDocTotal:0,subDocs:[],pathFound:!1,err:""};for(d=d||{},e=0;k>e;e++)if(f=i.value(j[e])[0]){if(l.setData(f),g=l.find(c,d),d.returnFirst&&g.length)return g[0];d.$split?m.subDocs.push(g):m.subDocs=m.subDocs.concat(g),m.subDocTotal+=g.length,
m.pathFound=!0}return l.drop(),d.$stats?m:m.subDocs},n.prototype.findSubOne=function(a,b,c,d){return this.findSub(a,b,c,d)[0]},n.prototype.insertIndexViolation=function(a){var b,c,d,e=this._indexByName;if(this._primaryIndex.get(a[this._primaryKey]))b=this._primaryIndex;else for(c in e)if(e.hasOwnProperty(c)&&(d=e[c],d.unique()&&d.violation(a))){b=d;break}return b?b.name():!1},n.prototype.ensureIndex=function(a,b){if(this.isDropped())throw this.logIdentifier()+" Cannot operate in a dropped state!";this._indexByName=this._indexByName||{},this._indexById=this._indexById||{};var c,d={start:(new Date).getTime()};if(b)switch(b.type){case"hashed":c=new i(a,b,this);break;case"btree":c=new j(a,b,this);break;default:c=new i(a,b,this)}else c=new i(a,b,this);return this._indexByName[c.name()]?{err:"Index with that name already exists"}:this._indexById[c.id()]?{err:"Index with those keys already exists"}:(c.rebuild(),this._indexByName[c.name()]=c,this._indexById[c.id()]=c,d.end=(new Date).getTime(),d.total=d.end-d.start,this._lastOp={type:"ensureIndex",stats:{time:d}},{index:c,id:c.id(),name:c.name(),state:c.state()})},n.prototype.index=function(a){return this._indexByName?this._indexByName[a]:void 0},n.prototype.lastOp=function(){return this._metrics.list()},n.prototype.diff=function(a){var b,c,d,e,f={insert:[],update:[],remove:[]},g=this.primaryKey();if(g!==a.primaryKey())throw this.logIdentifier()+" Diffing requires that both collections have the same primary key!";for(b=a._data;b&&!(b instanceof Array);)a=b,b=a._data;for(e=b.length,c=0;e>c;c++)d=b[c],this._primaryIndex.get(d[g])?this._primaryCrc.get(d[g])!==a._primaryCrc.get(d[g])&&f.update.push(d):f.insert.push(d);for(b=this._data,e=b.length,c=0;e>c;c++)d=b[c],a._primaryIndex.get(d[g])||f.remove.push(d);return f},n.prototype.collateAdd=new l({"object, string":function(a,b){var c=this;c.collateAdd(a,function(d){var e,f;switch(d.type){case"insert":b?(e={$push:{}},e.$push[b]=c.decouple(d.data),c.update({},e)):c.insert(d.data);break;case"update":b?(e={},f={},e[b]=d.data.query,f[b+".$"]=d.data.update,c.update(e,f)):c.update(d.data.query,d.data.update);break;case"remove":b?(e={$pull:{}},e.$pull[b]={},e.$pull[b][c.primaryKey()]=d.data.dataSet[0][a.primaryKey()],c.update({},e)):c.remove(d.data)}})},"object, function":function(a,b){if("string"==typeof a&&(a=this._db.collection(a,{autoCreate:!1,throwError:!1})),a)return this._collate=this._collate||{},this._collate[a.name()]=new m(a,this,b),this;throw"Cannot collate from a non-existent collection!"}}),n.prototype.collateRemove=function(a){if("object"==typeof a&&(a=a.name()),a)return this._collate[a].drop(),delete this._collate[a],this;throw"No collection name passed to collateRemove() or collection not found!"},e.prototype.collection=new l({"":function(){return this.$main.call(this,{name:this.objectId()})},object:function(a){return a instanceof n?"droppped"!==a.state()?a:this.$main.call(this,{name:a.name()}):this.$main.call(this,a)},string:function(a){return this.$main.call(this,{name:a})},"string, string":function(a,b){return this.$main.call(this,{name:a,primaryKey:b})},"string, object":function(a,b){return b.name=a,this.$main.call(this,b)},"string, string, object":function(a,b,c){return c.name=a,c.primaryKey=b,this.$main.call(this,c)},$main:function(a){var b=a.name;if(b){if(!this._collection[b]){if(a&&a.autoCreate===!1&&a&&a.throwError!==!1)throw this.logIdentifier()+" Cannot get collection "+b+" because it does not exist and auto-create has been disabled!";this.debug()&&console.log(this.logIdentifier()+" Creating collection "+b)}if(this._collection[b]=this._collection[b]||new n(b,a).db(this),this._collection[b].mongoEmulation(this.mongoEmulation()),void 0!==a.primaryKey&&this._collection[b].primaryKey(a.primaryKey),void 0!==a.capped){if(void 0===a.size)throw this.logIdentifier()+" Cannot create a capped collection without specifying a size!";this._collection[b].capped(a.capped),this._collection[b].cappedSize(a.size)}return this._collection[b]}if(!a||a&&a.throwError!==!1)throw this.logIdentifier()+" Cannot get collection with undefined name!"}}),e.prototype.collectionExists=function(a){return Boolean(this._collection[a])},e.prototype.collections=function(a){var b,c,d=[],e=this._collection;a&&(a instanceof RegExp||(a=new RegExp(a)));for(c in e)e.hasOwnProperty(c)&&(b=e[c],a?a.exec(c)&&d.push({name:c,count:b.count(),linked:void 0!==b.isLinked?b.isLinked():!1}):d.push({name:c,count:b.count(),linked:void 0!==b.isLinked?b.isLinked():!1}));return d.sort(function(a,b){return a.name.localeCompare(b.name)}),d},d.finishModule("Collection"),b.exports=n},{"./Crc":8,"./IndexBinaryTree":10,"./IndexHashMap":11,"./KeyValueStore":12,"./Metrics":13,"./Overload":25,"./Path":26,"./ReactorIO":27,"./Shared":29}],6:[function(a,b,c){"use strict";var d,e,f,g;d=a("./Shared");var h=function(){this.init.apply(this,arguments)};h.prototype.init=function(a){var b=this;b._name=a,b._data=new g("__FDB__cg_data_"+b._name),b._collections=[],b._view=[]},d.addModule("CollectionGroup",h),d.mixin(h.prototype,"Mixin.Common"),d.mixin(h.prototype,"Mixin.ChainReactor"),d.mixin(h.prototype,"Mixin.Constants"),d.mixin(h.prototype,"Mixin.Triggers"),d.mixin(h.prototype,"Mixin.Tags"),g=a("./Collection"),e=d.modules.Db,f=d.modules.Db.prototype.init,h.prototype.on=function(){this._data.on.apply(this._data,arguments)},h.prototype.off=function(){this._data.off.apply(this._data,arguments)},h.prototype.emit=function(){this._data.emit.apply(this._data,arguments)},h.prototype.primaryKey=function(a){return void 0!==a?(this._primaryKey=a,this):this._primaryKey},d.synthesize(h.prototype,"state"),d.synthesize(h.prototype,"db"),d.synthesize(h.prototype,"name"),h.prototype.addCollection=function(a){if(a&&-1===this._collections.indexOf(a)){if(this._collections.length){if(this._primaryKey!==a.primaryKey())throw this.logIdentifier()+" All collections in a collection group must have the same primary key!"}else this.primaryKey(a.primaryKey());this._collections.push(a),a._groups=a._groups||[],a._groups.push(this),a.chain(this),a.on("drop",function(){if(a._groups&&a._groups.length){var b,c=[];for(b=0;b<a._groups.length;b++)c.push(a._groups[b]);for(b=0;b<c.length;b++)a._groups[b].removeCollection(a)}delete a._groups}),this._data.insert(a.find())}return this},h.prototype.removeCollection=function(a){if(a){var b,c=this._collections.indexOf(a);-1!==c&&(a.unChain(this),this._collections.splice(c,1),a._groups=a._groups||[],b=a._groups.indexOf(this),-1!==b&&a._groups.splice(b,1),a.off("drop")),0===this._collections.length&&delete this._primaryKey}return this},h.prototype._chainHandler=function(a){switch(a.type){case"setData":a.data=this.decouple(a.data),this._data.remove(a.options.oldData),this._data.insert(a.data);break;case"insert":a.data=this.decouple(a.data),this._data.insert(a.data);break;case"update":this._data.update(a.data.query,a.data.update,a.options);break;case"remove":this._data.remove(a.data.query,a.options)}},h.prototype.insert=function(){this._collectionsRun("insert",arguments)},h.prototype.update=function(){this._collectionsRun("update",arguments)},h.prototype.updateById=function(){this._collectionsRun("updateById",arguments)},h.prototype.remove=function(){this._collectionsRun("remove",arguments)},h.prototype._collectionsRun=function(a,b){for(var c=0;c<this._collections.length;c++)this._collections[c][a].apply(this._collections[c],b)},h.prototype.find=function(a,b){return this._data.find(a,b)},h.prototype.removeById=function(a){for(var b=0;b<this._collections.length;b++)this._collections[b].removeById(a)},h.prototype.subset=function(a,b){var c=this.find(a,b);return(new g).subsetOf(this).primaryKey(this._primaryKey).setData(c)},h.prototype.drop=function(a){if(!this.isDropped()){var b,c,d;if(this._debug&&console.log(this.logIdentifier()+" Dropping"),this._state="dropped",this._collections&&this._collections.length)for(c=[].concat(this._collections),b=0;b<c.length;b++)this.removeCollection(c[b]);if(this._view&&this._view.length)for(d=[].concat(this._view),b=0;b<d.length;b++)this._removeView(d[b]);this.emit("drop",this),a&&a(!1,!0)}return!0},e.prototype.init=function(){this._collectionGroup={},f.apply(this,arguments)},e.prototype.collectionGroup=function(a){return a?a instanceof h?a:(this._collectionGroup[a]=this._collectionGroup[a]||new h(a).db(this),this._collectionGroup[a]):this._collectionGroup},e.prototype.collectionGroups=function(){var a,b=[];for(a in this._collectionGroup)this._collectionGroup.hasOwnProperty(a)&&b.push({name:a});return b},b.exports=h},{"./Collection":5,"./Shared":29}],7:[function(a,b,c){"use strict";var d,e,f,g,h=[];d=a("./Shared"),g=a("./Overload");var i=function(a){this.init.apply(this,arguments)};i.prototype.init=function(a){this._db={},this._debug={},this._name=a||"ForerunnerDB",h.push(this)},i.prototype.instantiatedCount=function(){return h.length},i.prototype.instances=function(a){return void 0!==a?h[a]:h},i.prototype.namedInstances=function(a){var b,c;{if(void 0===a){for(c=[],b=0;b<h.length;b++)c.push(h[b].name);return c}for(b=0;b<h.length;b++)if(h[b].name===a)return h[b]}},i.prototype.moduleLoaded=new g({string:function(a){if(void 0!==a){a=a.replace(/ /g,"");var b,c=a.split(",");for(b=0;b<c.length;b++)if(!d.modules[c[b]])return!1;return!0}return!1},"string, function":function(a,b){if(void 0!==a){a=a.replace(/ /g,"");var c,e=a.split(",");for(c=0;c<e.length;c++)if(!d.modules[e[c]])return!1;b&&b()}},"array, function":function(a,b){var c,e;for(e=0;e<a.length;e++)if(c=a[e],void 0!==c){c=c.replace(/ /g,"");var f,g=c.split(",");for(f=0;f<g.length;f++)if(!d.modules[g[f]])return!1}b&&b()},"string, function, function":function(a,b,c){if(void 0!==a){a=a.replace(/ /g,"");var e,f=a.split(",");for(e=0;e<f.length;e++)if(!d.modules[f[e]])return c(),!1;b()}}}),i.prototype.version=function(a,b){return void 0!==a?0===d.version.indexOf(a)?(b&&b(),!0):!1:d.version},i.moduleLoaded=i.prototype.moduleLoaded,i.version=i.prototype.version,i.instances=i.prototype.instances,i.instantiatedCount=i.prototype.instantiatedCount,i.shared=d,i.prototype.shared=d,d.addModule("Core",i),d.mixin(i.prototype,"Mixin.Common"),d.mixin(i.prototype,"Mixin.Constants"),e=a("./Db.js"),f=a("./Metrics.js"),d.synthesize(i.prototype,"name"),d.synthesize(i.prototype,"mongoEmulation"),i.prototype._isServer=!1,i.prototype.isClient=function(){return!this._isServer},i.prototype.isServer=function(){return this._isServer},i.prototype.isClient=function(){return!this._isServer},i.prototype.isServer=function(){return this._isServer},i.prototype.collection=function(){throw"ForerunnerDB's instantiation has changed since version 1.3.36 to support multiple database instances. Please see the readme.md file for the minor change you have to make to get your project back up and running, or see the issue related to this change at https://github.com/Irrelon/ForerunnerDB/issues/44"},b.exports=i},{"./Db.js":9,"./Metrics.js":13,"./Overload":25,"./Shared":29}],8:[function(a,b,c){"use strict";var d=function(){var a,b,c,d=[];for(b=0;256>b;b++){for(a=b,c=0;8>c;c++)a=1&a?3988292384^a>>>1:a>>>1;d[b]=a}return d}();b.exports=function(a){var b,c=-1;for(b=0;b<a.length;b++)c=c>>>8^d[255&(c^a.charCodeAt(b))];return(-1^c)>>>0}},{}],9:[function(a,b,c){"use strict";var d,e,f,g,h,i;d=a("./Shared"),i=a("./Overload");var j=function(a,b){this.init.apply(this,arguments)};j.prototype.init=function(a,b){this.core(b),this._primaryKey="_id",this._name=a,this._collection={},this._debug={}},d.addModule("Db",j),j.prototype.moduleLoaded=new i({string:function(a){if(void 0!==a){a=a.replace(/ /g,"");var b,c=a.split(",");for(b=0;b<c.length;b++)if(!d.modules[c[b]])return!1;return!0}return!1},"string, function":function(a,b){if(void 0!==a){a=a.replace(/ /g,"");var c,e=a.split(",");for(c=0;c<e.length;c++)if(!d.modules[e[c]])return!1;b&&b()}},"string, function, function":function(a,b,c){if(void 0!==a){a=a.replace(/ /g,"");var e,f=a.split(",");for(e=0;e<f.length;e++)if(!d.modules[f[e]])return c(),!1;b()}}}),j.prototype.version=function(a,b){return void 0!==a?0===d.version.indexOf(a)?(b&&b(),!0):!1:d.version},j.moduleLoaded=j.prototype.moduleLoaded,j.version=j.prototype.version,j.shared=d,j.prototype.shared=d,d.addModule("Db",j),d.mixin(j.prototype,"Mixin.Common"),d.mixin(j.prototype,"Mixin.ChainReactor"),d.mixin(j.prototype,"Mixin.Constants"),d.mixin(j.prototype,"Mixin.Tags"),e=d.modules.Core,f=a("./Collection.js"),g=a("./Metrics.js"),h=a("./Crc.js"),j.prototype._isServer=!1,d.synthesize(j.prototype,"core"),d.synthesize(j.prototype,"primaryKey"),d.synthesize(j.prototype,"state"),d.synthesize(j.prototype,"name"),d.synthesize(j.prototype,"mongoEmulation"),j.prototype.isClient=function(){return!this._isServer},j.prototype.isServer=function(){return this._isServer},j.prototype.crc=h,j.prototype.isClient=function(){return!this._isServer},j.prototype.isServer=function(){return this._isServer},j.prototype.arrayToCollection=function(a){return(new f).setData(a)},j.prototype.on=function(a,b){return this._listeners=this._listeners||{},this._listeners[a]=this._listeners[a]||[],this._listeners[a].push(b),this},j.prototype.off=function(a,b){if(a in this._listeners){var c=this._listeners[a],d=c.indexOf(b);d>-1&&c.splice(d,1)}return this},j.prototype.emit=function(a,b){if(this._listeners=this._listeners||{},a in this._listeners){var c,d=this._listeners[a],e=d.length;for(c=0;e>c;c++)d[c].apply(this,Array.prototype.slice.call(arguments,1))}return this},j.prototype.peek=function(a){var b,c,d=[],e=typeof a;for(b in this._collection)this._collection.hasOwnProperty(b)&&(c=this._collection[b],d="string"===e?d.concat(c.peek(a)):d.concat(c.find(a)));return d},j.prototype.peek=function(a){var b,c,d=[],e=typeof a;for(b in this._collection)this._collection.hasOwnProperty(b)&&(c=this._collection[b],d="string"===e?d.concat(c.peek(a)):d.concat(c.find(a)));return d},j.prototype.peekCat=function(a){var b,c,d,e={},f=typeof a;for(b in this._collection)this._collection.hasOwnProperty(b)&&(c=this._collection[b],"string"===f?(d=c.peek(a),d&&d.length&&(e[c.name()]=d)):(d=c.find(a),d&&d.length&&(e[c.name()]=d)));return e},j.prototype.drop=new i({"":function(){if(!this.isDropped()){var a,b=this.collections(),c=b.length;for(this._state="dropped",a=0;c>a;a++)this.collection(b[a].name).drop(),delete this._collection[b[a].name];this.emit("drop",this),delete this._core._db[this._name]}return!0},"function":function(a){if(!this.isDropped()){var b,c=this.collections(),d=c.length,e=0,f=function(){e++,e===d&&a&&a()};for(this._state="dropped",b=0;d>b;b++)this.collection(c[b].name).drop(f),delete this._collection[c[b].name];this.emit("drop",this),delete this._core._db[this._name]}return!0},"boolean":function(a){if(!this.isDropped()){var b,c=this.collections(),d=c.length;for(this._state="dropped",b=0;d>b;b++)this.collection(c[b].name).drop(a),delete this._collection[c[b].name];this.emit("drop",this),delete this._core._db[this._name]}return!0},"boolean, function":function(a,b){if(!this.isDropped()){var c,d=this.collections(),e=d.length,f=0,g=function(){f++,f===e&&b&&b()};for(this._state="dropped",c=0;e>c;c++)this.collection(d[c].name).drop(a,g),delete this._collection[d[c].name];this.emit("drop",this),delete this._core._db[this._name]}return!0}}),e.prototype.db=function(a){return a instanceof j?a:(a||(a=this.objectId()),this._db[a]=this._db[a]||new j(a,this),this._db[a].mongoEmulation(this.mongoEmulation()),this._db[a])},e.prototype.databases=function(a){var b,c,d,e=[];a&&(a instanceof RegExp||(a=new RegExp(a)));for(d in this._db)this._db.hasOwnProperty(d)&&(c=!0,a&&(a.exec(d)||(c=!1)),c&&(b={name:d,children:[]},this.shared.moduleExists("Collection")&&b.children.push({module:"collection",moduleName:"Collections",count:this._db[d].collections().length}),this.shared.moduleExists("CollectionGroup")&&b.children.push({module:"collectionGroup",moduleName:"Collection Groups",count:this._db[d].collectionGroups().length}),this.shared.moduleExists("Document")&&b.children.push({module:"document",moduleName:"Documents",count:this._db[d].documents().length}),this.shared.moduleExists("Grid")&&b.children.push({module:"grid",moduleName:"Grids",count:this._db[d].grids().length}),this.shared.moduleExists("Overview")&&b.children.push({module:"overview",moduleName:"Overviews",count:this._db[d].overviews().length}),this.shared.moduleExists("View")&&b.children.push({module:"view",moduleName:"Views",count:this._db[d].views().length}),e.push(b)));return e.sort(function(a,b){return a.name.localeCompare(b.name)}),e},d.finishModule("Db"),b.exports=j},{"./Collection.js":5,"./Crc.js":8,"./Metrics.js":13,"./Overload":25,"./Shared":29}],10:[function(a,b,c){"use strict";var d=a("./Shared"),e=a("./Path"),f=a("./BinaryTree"),g=new f,h=function(){};g.inOrder("hash");var i=function(){this.init.apply(this,arguments)};i.prototype.init=function(a,b,c){this._btree=new(h.create(2,this.sortAsc)),this._size=0,this._id=this._itemKeyHash(a,a),this.unique(b&&b.unique?b.unique:!1),void 0!==a&&this.keys(a),void 0!==c&&this.collection(c),this.name(b&&b.name?b.name:this._id)},d.addModule("IndexBinaryTree",i),d.mixin(i.prototype,"Mixin.ChainReactor"),d.mixin(i.prototype,"Mixin.Sorting"),i.prototype.id=function(){return this._id},i.prototype.state=function(){return this._state},i.prototype.size=function(){return this._size},d.synthesize(i.prototype,"data"),d.synthesize(i.prototype,"name"),d.synthesize(i.prototype,"collection"),d.synthesize(i.prototype,"type"),d.synthesize(i.prototype,"unique"),i.prototype.keys=function(a){return void 0!==a?(this._keys=a,this._keyCount=(new e).parse(this._keys).length,this):this._keys},i.prototype.rebuild=function(){if(this._collection){var a,b=this._collection.subset({},{$decouple:!1,$orderBy:this._keys}),c=b.find(),d=c.length;for(this._btree=new(h.create(2,this.sortAsc)),this._unique&&(this._uniqueLookup={}),a=0;d>a;a++)this.insert(c[a])}this._state={name:this._name,keys:this._keys,indexSize:this._size,built:new Date,updated:new Date,ok:!0}},i.prototype.insert=function(a,b){var c,d,e=this._unique,f=this._itemKeyHash(a,this._keys);e&&(c=this._itemHash(a,this._keys),this._uniqueLookup[c]=a),d=this._btree.get(f),void 0===d&&(d=[],this._btree.put(f,d)),d.push(a),this._size++},i.prototype.remove=function(a,b){var c,d,e,f=this._unique,g=this._itemKeyHash(a,this._keys);f&&(c=this._itemHash(a,this._keys),delete this._uniqueLookup[c]),d=this._btree.get(g),void 0!==d&&(e=d.indexOf(a),e>-1&&(1===d.length?this._btree.del(g):d.splice(e,1),this._size--))},i.prototype.violation=function(a){var b=this._itemHash(a,this._keys);return Boolean(this._uniqueLookup[b])},i.prototype.hashViolation=function(a){return Boolean(this._uniqueLookup[a])},i.prototype.lookup=function(a){return this._data[this._itemHash(a,this._keys)]||[]},i.prototype.match=function(a,b){var c,d=new e,f=d.parseArr(this._keys),g=d.parseArr(a),h=[],i=0;for(c=0;c<f.length;c++){if(g[c]!==f[c])return{matchedKeys:[],totalKeyCount:g.length,score:0};i++,h.push(g[c])}return{matchedKeys:h,totalKeyCount:g.length,score:i}},i.prototype._itemHash=function(a,b){var c,d,f=new e,g="";for(c=f.parse(b),d=0;d<c.length;d++)g&&(g+="_"),g+=f.value(a,c[d].path).join(":");return g},i.prototype._itemKeyHash=function(a,b){var c,d,f=new e,g="";for(c=f.parse(b),d=0;d<c.length;d++)g&&(g+="_"),g+=f.keyValue(a,c[d].path);return g},i.prototype._itemHashArr=function(a,b){var c,d,f,g,h,i=new e,j=[];for(c=i.parse(b),g=0;g<c.length;g++)for(d=i.value(a,c[g].path),f=0;f<d.length;f++)if(0===g)j.push(d[f]);else for(h=0;h<j.length;h++)j[h]=j[h]+"_"+d[f];return j},d.finishModule("IndexBinaryTree"),b.exports=i},{"./BinaryTree":4,"./Path":26,"./Shared":29}],11:[function(a,b,c){"use strict";var d=a("./Shared"),e=a("./Path"),f=function(){this.init.apply(this,arguments)};f.prototype.init=function(a,b,c){this._crossRef={},this._size=0,this._id=this._itemKeyHash(a,a),this.data({}),this.unique(b&&b.unique?b.unique:!1),void 0!==a&&this.keys(a),void 0!==c&&this.collection(c),this.name(b&&b.name?b.name:this._id)},d.addModule("IndexHashMap",f),d.mixin(f.prototype,"Mixin.ChainReactor"),f.prototype.id=function(){return this._id},f.prototype.state=function(){return this._state},f.prototype.size=function(){return this._size},d.synthesize(f.prototype,"data"),d.synthesize(f.prototype,"name"),d.synthesize(f.prototype,"collection"),d.synthesize(f.prototype,"type"),d.synthesize(f.prototype,"unique"),f.prototype.keys=function(a){return void 0!==a?(this._keys=a,this._keyCount=(new e).parse(this._keys).length,this):this._keys},f.prototype.rebuild=function(){if(this._collection){var a,b=this._collection.subset({},{$decouple:!1,$orderBy:this._keys}),c=b.find(),d=c.length;for(this._data={},this._unique&&(this._uniqueLookup={}),a=0;d>a;a++)this.insert(c[a])}this._state={name:this._name,keys:this._keys,indexSize:this._size,built:new Date,updated:new Date,ok:!0}},f.prototype.insert=function(a,b){var c,d,e,f=this._unique;for(f&&(c=this._itemHash(a,this._keys),this._uniqueLookup[c]=a),d=this._itemHashArr(a,this._keys),e=0;e<d.length;e++)this.pushToPathValue(d[e],a)},f.prototype.update=function(a,b){},f.prototype.remove=function(a,b){var c,d,e,f=this._unique;for(f&&(c=this._itemHash(a,this._keys),delete this._uniqueLookup[c]),d=this._itemHashArr(a,this._keys),e=0;e<d.length;e++)this.pullFromPathValue(d[e],a)},f.prototype.violation=function(a){var b=this._itemHash(a,this._keys);return Boolean(this._uniqueLookup[b])},f.prototype.hashViolation=function(a){return Boolean(this._uniqueLookup[a])},f.prototype.pushToPathValue=function(a,b){var c=this._data[a]=this._data[a]||[];-1===c.indexOf(b)&&(c.push(b),this._size++,this.pushToCrossRef(b,c))},f.prototype.pullFromPathValue=function(a,b){var c,d=this._data[a];c=d.indexOf(b),c>-1&&(d.splice(c,1),this._size--,this.pullFromCrossRef(b,d)),d.length||delete this._data[a]},f.prototype.pull=function(a){var b,c,d=a[this._collection.primaryKey()],e=this._crossRef[d],f=e.length;for(b=0;f>b;b++)c=e[b],this._pullFromArray(c,a);this._size--,delete this._crossRef[d]},f.prototype._pullFromArray=function(a,b){for(var c=a.length;c--;)a[c]===b&&a.splice(c,1)},f.prototype.pushToCrossRef=function(a,b){var c,d=a[this._collection.primaryKey()];this._crossRef[d]=this._crossRef[d]||[],c=this._crossRef[d],-1===c.indexOf(b)&&c.push(b)},f.prototype.pullFromCrossRef=function(a,b){var c=a[this._collection.primaryKey()];delete this._crossRef[c]},f.prototype.lookup=function(a){return this._data[this._itemHash(a,this._keys)]||[]},f.prototype.match=function(a,b){var c,d=new e,f=d.parseArr(this._keys),g=d.parseArr(a),h=[],i=0;for(c=0;c<f.length;c++){if(g[c]!==f[c])return{matchedKeys:[],totalKeyCount:g.length,score:0};i++,h.push(g[c])}return{matchedKeys:h,totalKeyCount:g.length,score:i}},f.prototype._itemHash=function(a,b){var c,d,f=new e,g="";for(c=f.parse(b),d=0;d<c.length;d++)g&&(g+="_"),g+=f.value(a,c[d].path).join(":");return g},f.prototype._itemKeyHash=function(a,b){var c,d,f=new e,g="";for(c=f.parse(b),d=0;d<c.length;d++)g&&(g+="_"),g+=f.keyValue(a,c[d].path);return g},f.prototype._itemHashArr=function(a,b){var c,d,f,g,h,i=new e,j=[];for(c=i.parse(b),g=0;g<c.length;g++)for(d=i.value(a,c[g].path),f=0;f<d.length;f++)if(0===g)j.push(d[f]);else for(h=0;h<j.length;h++)j[h]=j[h]+"_"+d[f];return j},d.finishModule("IndexHashMap"),b.exports=f},{"./Path":26,"./Shared":29}],12:[function(a,b,c){"use strict";var d=a("./Shared"),e=function(a){this.init.apply(this,arguments)};e.prototype.init=function(a){this._name=a,this._data={},this._primaryKey="_id"},d.addModule("KeyValueStore",e),d.mixin(e.prototype,"Mixin.ChainReactor"),d.synthesize(e.prototype,"name"),e.prototype.primaryKey=function(a){return void 0!==a?(this._primaryKey=a,this):this._primaryKey},e.prototype.truncate=function(){return this._data={},this},e.prototype.set=function(a,b){return this._data[a]=b?b:!0,this},e.prototype.get=function(a){return this._data[a]},e.prototype.lookup=function(a){var b,c,d,e,f=a[this._primaryKey];if(f instanceof Array){for(c=f.length,e=[],b=0;c>b;b++)d=this._data[f[b]],d&&e.push(d);return e}if(f instanceof RegExp){e=[];for(b in this._data)this._data.hasOwnProperty(b)&&f.test(b)&&e.push(this._data[b]);return e}if("object"!=typeof f)return d=this._data[f],void 0!==d?[d]:[];if(f.$ne){e=[];for(b in this._data)this._data.hasOwnProperty(b)&&b!==f.$ne&&e.push(this._data[b]);return e}if(f.$in&&f.$in instanceof Array){e=[];for(b in this._data)this._data.hasOwnProperty(b)&&f.$in.indexOf(b)>-1&&e.push(this._data[b]);return e}if(f.$nin&&f.$nin instanceof Array){e=[];for(b in this._data)this._data.hasOwnProperty(b)&&-1===f.$nin.indexOf(b)&&e.push(this._data[b]);return e}if(f.$or&&f.$or instanceof Array){for(e=[],b=0;b<f.$or.length;b++)e=e.concat(this.lookup(f.$or[b]));return e}},e.prototype.unSet=function(a){return delete this._data[a],this},e.prototype.uniqueSet=function(a,b){return void 0===this._data[a]?(this._data[a]=b,!0):!1},d.finishModule("KeyValueStore"),b.exports=e},{"./Shared":29}],13:[function(a,b,c){"use strict";var d=a("./Shared"),e=a("./Operation"),f=function(){this.init.apply(this,arguments)};f.prototype.init=function(){this._data=[]},d.addModule("Metrics",f),d.mixin(f.prototype,"Mixin.ChainReactor"),f.prototype.create=function(a){var b=new e(a);return this._enabled&&this._data.push(b),b},f.prototype.start=function(){return this._enabled=!0,this},f.prototype.stop=function(){return this._enabled=!1,this},f.prototype.clear=function(){return this._data=[],this},f.prototype.list=function(){return this._data},d.finishModule("Metrics"),b.exports=f},{"./Operation":24,"./Shared":29}],14:[function(a,b,c){"use strict";var d={preSetData:function(){},postSetData:function(){}};b.exports=d},{}],15:[function(a,b,c){"use strict";var d={chain:function(a){this.debug&&this.debug()&&(a._reactorIn&&a._reactorOut?console.log(a._reactorIn.logIdentifier()+' Adding target "'+a._reactorOut.instanceIdentifier()+'" to the chain reactor target list'):console.log(this.logIdentifier()+' Adding target "'+a.instanceIdentifier()+'" to the chain reactor target list')),this._chain=this._chain||[];var b=this._chain.indexOf(a);-1===b&&this._chain.push(a)},unChain:function(a){if(this.debug&&this.debug()&&(a._reactorIn&&a._reactorOut?console.log(a._reactorIn.logIdentifier()+' Removing target "'+a._reactorOut.instanceIdentifier()+'" from the chain reactor target list'):console.log(this.logIdentifier()+' Removing target "'+a.instanceIdentifier()+'" from the chain reactor target list')),this._chain){var b=this._chain.indexOf(a);b>-1&&this._chain.splice(b,1)}},chainSend:function(a,b,c){if(this._chain){var d,e,f=this._chain,g=f.length;for(e=0;g>e;e++){if(d=f[e],d._state&&(!d._state||d.isDropped()))throw console.log("Reactor Data:",a,b,c),console.log("Reactor Node:",d),"Chain reactor attempting to send data to target reactor node that is in a dropped state!";this.debug&&this.debug()&&(d._reactorIn&&d._reactorOut?console.log(d._reactorIn.logIdentifier()+' Sending data down the chain reactor pipe to "'+d._reactorOut.instanceIdentifier()+'"'):console.log(this.logIdentifier()+' Sending data down the chain reactor pipe to "'+d.instanceIdentifier()+'"')),d.chainReceive(this,a,b,c)}}},chainReceive:function(a,b,c,d){var e={sender:a,type:b,data:c,options:d};this.debug&&this.debug()&&console.log(this.logIdentifier()+"Received data from parent reactor node"),(!this._chainHandler||this._chainHandler&&!this._chainHandler(e))&&this.chainSend(e.type,e.data,e.options)}};b.exports=d},{}],16:[function(a,b,c){"use strict";var d,e=0,f=a("./Overload"),g=a("./Serialiser"),h=new g;d={serialiser:h,store:function(a,b){if(void 0!==a){if(void 0!==b)return this._store=this._store||{},this._store[a]=b,this;if(this._store)return this._store[a]}},unStore:function(a){return void 0!==a&&delete this._store[a],this},decouple:function(a,b){if(void 0!==a){if(b){var c,d=this.jStringify(a),e=[];for(c=0;b>c;c++)e.push(this.jParse(d));return e}return this.jParse(this.jStringify(a))}},jParse:function(a){return h.parse(a)},jStringify:function(a){return h.stringify(a)},objectId:function(a){var b,c=Math.pow(10,17);if(a){var d,f=0,g=a.length;for(d=0;g>d;d++)f+=a.charCodeAt(d)*c;b=f.toString(16)}else e++,b=(e+(Math.random()*c+Math.random()*c+Math.random()*c+Math.random()*c)).toString(16);return b},debug:new f([function(){return this._debug&&this._debug.all},function(a){return void 0!==a?"boolean"==typeof a?(this._debug=this._debug||{},this._debug.all=a,this.chainSend("debug",this._debug),this):this._debug&&this._debug[a]||this._db&&this._db._debug&&this._db._debug[a]||this._debug&&this._debug.all:this._debug&&this._debug.all},function(a,b){return void 0!==a?void 0!==b?(this._debug=this._debug||{},this._debug[a]=b,this.chainSend("debug",this._debug),this):this._debug&&this._debug[b]||this._db&&this._db._debug&&this._db._debug[a]:this._debug&&this._debug.all}]),classIdentifier:function(){return"ForerunnerDB."+this.className},instanceIdentifier:function(){return"["+this.className+"]"+this.name()},logIdentifier:function(){return this.classIdentifier()+": "+this.instanceIdentifier()},convertToFdb:function(a){var b,c,d,e;for(e in a)if(a.hasOwnProperty(e)&&(d=a,e.indexOf(".")>-1)){for(e=e.replace(".$","[|$|]"),c=e.split(".");b=c.shift();)b=b.replace("[|$|]",".$"),c.length?d[b]={}:d[b]=a[e],d=d[b];delete a[e]}},isDropped:function(){return"dropped"===this._state}},b.exports=d},{"./Overload":25,"./Serialiser":28}],17:[function(a,b,c){"use strict";var d={TYPE_INSERT:0,TYPE_UPDATE:1,TYPE_REMOVE:2,PHASE_BEFORE:0,PHASE_AFTER:1};b.exports=d},{}],18:[function(a,b,c){"use strict";var d=a("./Overload"),e={on:new d({"string, function":function(a,b){return this._listeners=this._listeners||{},this._listeners[a]=this._listeners[a]||{},this._listeners[a]["*"]=this._listeners[a]["*"]||[],this._listeners[a]["*"].push(b),this},"string, *, function":function(a,b,c){return this._listeners=this._listeners||{},this._listeners[a]=this._listeners[a]||{},this._listeners[a][b]=this._listeners[a][b]||[],this._listeners[a][b].push(c),this}}),once:new d({"string, function":function(a,b){var c=this,d=function(){c.off(a,d),b.apply(c,arguments)};return this.on(a,d)},"string, *, function":function(a,b,c){var d=this,e=function(){d.off(a,b,e),c.apply(d,arguments)};return this.on(a,b,e)}}),off:new d({string:function(a){return this._listeners&&this._listeners[a]&&a in this._listeners&&delete this._listeners[a],this},"string, function":function(a,b){var c,d;return"string"==typeof b?this._listeners&&this._listeners[a]&&this._listeners[a][b]&&delete this._listeners[a][b]:this._listeners&&a in this._listeners&&(c=this._listeners[a]["*"],d=c.indexOf(b),d>-1&&c.splice(d,1)),this},"string, *, function":function(a,b,c){if(this._listeners&&a in this._listeners&&b in this.listeners[a]){var d=this._listeners[a][b],e=d.indexOf(c);e>-1&&d.splice(e,1)}},"string, *":function(a,b){this._listeners&&a in this._listeners&&b in this._listeners[a]&&delete this._listeners[a][b]}}),emit:function(a,b){if(this._listeners=this._listeners||{},a in this._listeners){var c,d,e,f,g,h,i;if(this._listeners[a]["*"])for(f=this._listeners[a]["*"],d=f.length,c=0;d>c;c++)e=f[c],"function"==typeof e&&e.apply(this,Array.prototype.slice.call(arguments,1));if(b instanceof Array&&b[0]&&b[0][this._primaryKey])for(g=this._listeners[a],d=b.length,c=0;d>c;c++)if(g[b[c][this._primaryKey]])for(h=g[b[c][this._primaryKey]].length,i=0;h>i;i++)e=g[b[c][this._primaryKey]][i],"function"==typeof e&&g[b[c][this._primaryKey]][i].apply(this,Array.prototype.slice.call(arguments,1))}return this},deferEmit:function(a,b){var c,d=this;return this._noEmitDefer||this._db&&(!this._db||this._db._noEmitDefer)?this.emit.apply(this,arguments):(c=arguments,this._deferTimeout=this._deferTimeout||{},this._deferTimeout[a]&&clearTimeout(this._deferTimeout[a]),this._deferTimeout[a]=setTimeout(function(){d.debug()&&console.log(d.logIdentifier()+" Emitting "+c[0]),d.emit.apply(d,c)},1)),this}};b.exports=e},{"./Overload":25}],19:[function(a,b,c){"use strict";var d={_match:function(a,b,c,d,e){var f,g,h,i,j,k,l=d,m=typeof a,n=typeof b,o=!0;if(e=e||{},c=c||{},
e.$rootQuery||(e.$rootQuery=b),e.$rootData=e.$rootData||{},"string"!==m&&"number"!==m||"string"!==n&&"number"!==n){for(k in b)if(b.hasOwnProperty(k)){if(f=!1,j=k.substr(0,2),"//"===j)continue;if(0===j.indexOf("$")&&(i=this._matchOp(k,a,b[k],c,e),i>-1)){if(i){if("or"===d)return!0}else o=i;f=!0}if(!f&&b[k]instanceof RegExp)if(f=!0,"object"===m&&void 0!==a[k]&&b[k].test(a[k])){if("or"===d)return!0}else o=!1;if(!f)if("object"==typeof b[k])if(void 0!==a[k])if(a[k]instanceof Array&&!(b[k]instanceof Array)){for(g=!1,h=0;h<a[k].length&&!(g=this._match(a[k][h],b[k],c,l,e));h++);if(g){if("or"===d)return!0}else o=!1}else if(!(a[k]instanceof Array)&&b[k]instanceof Array){for(g=!1,h=0;h<b[k].length&&!(g=this._match(a[k],b[k][h],c,l,e));h++);if(g){if("or"===d)return!0}else o=!1}else if("object"==typeof a)if(g=this._match(a[k],b[k],c,l,e)){if("or"===d)return!0}else o=!1;else if(g=this._match(void 0,b[k],c,l,e)){if("or"===d)return!0}else o=!1;else if(b[k]&&void 0!==b[k].$exists)if(g=this._match(void 0,b[k],c,l,e)){if("or"===d)return!0}else o=!1;else o=!1;else if(a&&a[k]===b[k]){if("or"===d)return!0}else if(a&&a[k]&&a[k]instanceof Array&&b[k]&&"object"!=typeof b[k]){for(g=!1,h=0;h<a[k].length&&!(g=this._match(a[k][h],b[k],c,l,e));h++);if(g){if("or"===d)return!0}else o=!1}else o=!1;if("and"===d&&!o)return!1}}else"number"===m?a!==b&&(o=!1):a.localeCompare(b)&&(o=!1);return o},_matchOp:function(a,b,c,d,e){switch(a){case"$gt":return b>c;case"$gte":return b>=c;case"$lt":return c>b;case"$lte":return c>=b;case"$exists":return void 0===b!==c;case"$ne":return b!=c;case"$nee":return b!==c;case"$or":for(var f=0;f<c.length;f++)if(this._match(b,c[f],d,"and",e))return!0;return!1;case"$and":for(var g=0;g<c.length;g++)if(!this._match(b,c[g],d,"and",e))return!1;return!0;case"$in":if(c instanceof Array){var h,i=c,j=i.length;for(h=0;j>h;h++){if(i[h]instanceof RegExp&&i[h].test(b))return!0;if(i[h]===b)return!0}return!1}throw this.logIdentifier()+" Cannot use an $in operator on a non-array key: "+a;case"$nin":if(c instanceof Array){var k,l=c,m=l.length;for(k=0;m>k;k++)if(l[k]===b)return!1;return!0}throw this.logIdentifier()+" Cannot use a $nin operator on a non-array key: "+a;case"$distinct":e.$rootData["//distinctLookup"]=e.$rootData["//distinctLookup"]||{};for(var n in c)if(c.hasOwnProperty(n))return e.$rootData["//distinctLookup"][n]=e.$rootData["//distinctLookup"][n]||{},e.$rootData["//distinctLookup"][n][b[n]]?!1:(e.$rootData["//distinctLookup"][n][b[n]]=!0,!0);break;case"$count":var o,p,q;for(o in c)if(c.hasOwnProperty(o)&&(p=b[o],q="object"==typeof p&&p instanceof Array?p.length:0,!this._match(q,c[o],d,"and",e)))return!1;return!0}return-1}};b.exports=d},{}],20:[function(a,b,c){"use strict";var d={sortAsc:function(a,b){return"string"==typeof a&&"string"==typeof b?a.localeCompare(b):a>b?1:b>a?-1:0},sortDesc:function(a,b){return"string"==typeof a&&"string"==typeof b?b.localeCompare(a):a>b?-1:b>a?1:0}};b.exports=d},{}],21:[function(a,b,c){"use strict";var d,e={};d={tagAdd:function(a){var b,c=this,d=e[a]=e[a]||[];for(b=0;b<d.length;b++)if(d[b]===c)return!0;return d.push(c),c.on&&c.on("drop",function(){c.tagRemove(a)}),!0},tagRemove:function(a){var b,c=e[a];if(c)for(b=0;b<c.length;b++)if(c[b]===this)return c.splice(b,1),!0;return!1},tagLookup:function(a){return e[a]||[]},tagDrop:function(a,b){var c,d,e,f=this.tagLookup(a);if(c=function(){d--,b&&0===d&&b(!1)},f.length)for(d=f.length,e=f.length-1;e>=0;e--)f[e].drop(c);return!0}},b.exports=d},{}],22:[function(a,b,c){"use strict";var d=a("./Overload"),e={addTrigger:function(a,b,c,d){var e,f=this;return e=f._triggerIndexOf(a,b,c),-1===e?(f._trigger=f._trigger||{},f._trigger[b]=f._trigger[b]||{},f._trigger[b][c]=f._trigger[b][c]||[],f._trigger[b][c].push({id:a,method:d,enabled:!0}),!0):!1},removeTrigger:function(a,b,c){var d,e=this;return d=e._triggerIndexOf(a,b,c),d>-1&&e._trigger[b][c].splice(d,1),!1},enableTrigger:new d({string:function(a){var b,c,d,e,f,g=this,h=g._trigger,i=!1;if(h)for(f in h)if(h.hasOwnProperty(f)&&(b=h[f]))for(d in b)if(b.hasOwnProperty(d))for(c=b[d],e=0;e<c.length;e++)c[e].id===a&&(c[e].enabled=!0,i=!0);return i},number:function(a){var b,c,d,e=this,f=e._trigger[a],g=!1;if(f)for(c in f)if(f.hasOwnProperty(c))for(b=f[c],d=0;d<b.length;d++)b[d].enabled=!0,g=!0;return g},"number, number":function(a,b){var c,d,e=this,f=e._trigger[a],g=!1;if(f&&(c=f[b]))for(d=0;d<c.length;d++)c[d].enabled=!0,g=!0;return g},"string, number, number":function(a,b,c){var d=this,e=d._triggerIndexOf(a,b,c);return e>-1?(d._trigger[b][c][e].enabled=!0,!0):!1}}),disableTrigger:new d({string:function(a){var b,c,d,e,f,g=this,h=g._trigger,i=!1;if(h)for(f in h)if(h.hasOwnProperty(f)&&(b=h[f]))for(d in b)if(b.hasOwnProperty(d))for(c=b[d],e=0;e<c.length;e++)c[e].id===a&&(c[e].enabled=!1,i=!0);return i},number:function(a){var b,c,d,e=this,f=e._trigger[a],g=!1;if(f)for(c in f)if(f.hasOwnProperty(c))for(b=f[c],d=0;d<b.length;d++)b[d].enabled=!1,g=!0;return g},"number, number":function(a,b){var c,d,e=this,f=e._trigger[a],g=!1;if(f&&(c=f[b]))for(d=0;d<c.length;d++)c[d].enabled=!1,g=!0;return g},"string, number, number":function(a,b,c){var d=this,e=d._triggerIndexOf(a,b,c);return e>-1?(d._trigger[b][c][e].enabled=!1,!0):!1}}),willTrigger:function(a,b){if(this._trigger&&this._trigger[a]&&this._trigger[a][b]&&this._trigger[a][b].length){var c,d=this._trigger[a][b];for(c=0;c<d.length;c++)if(d[c].enabled)return!0}return!1},processTrigger:function(a,b,c,d,e){var f,g,h,i,j,k=this;if(k._trigger&&k._trigger[b]&&k._trigger[b][c]){for(f=k._trigger[b][c],h=f.length,g=0;h>g;g++)if(i=f[g],i.enabled){if(this.debug()){var l,m;switch(b){case this.TYPE_INSERT:l="insert";break;case this.TYPE_UPDATE:l="update";break;case this.TYPE_REMOVE:l="remove";break;default:l=""}switch(c){case this.PHASE_BEFORE:m="before";break;case this.PHASE_AFTER:m="after";break;default:m=""}}if(j=i.method.call(k,a,d,e),j===!1)return!1;if(void 0!==j&&j!==!0&&j!==!1)throw"ForerunnerDB.Mixin.Triggers: Trigger error: "+j}return!0}},_triggerIndexOf:function(a,b,c){var d,e,f,g=this;if(g._trigger&&g._trigger[b]&&g._trigger[b][c])for(d=g._trigger[b][c],e=d.length,f=0;e>f;f++)if(d[f].id===a)return f;return-1}};b.exports=e},{"./Overload":25}],23:[function(a,b,c){"use strict";var d={_updateProperty:function(a,b,c){a[b]=c,this.debug()&&console.log(this.logIdentifier()+' Setting non-data-bound document property "'+b+'"')},_updateIncrement:function(a,b,c){a[b]+=c},_updateSpliceMove:function(a,b,c){a.splice(c,0,a.splice(b,1)[0]),this.debug()&&console.log(this.logIdentifier()+' Moving non-data-bound document array index from "'+b+'" to "'+c+'"')},_updateSplicePush:function(a,b,c){a.length>b?a.splice(b,0,c):a.push(c)},_updatePush:function(a,b){a.push(b)},_updatePull:function(a,b){a.splice(b,1)},_updateMultiply:function(a,b,c){a[b]*=c},_updateRename:function(a,b,c){a[c]=a[b],delete a[b]},_updateOverwrite:function(a,b,c){a[b]=c},_updateUnset:function(a,b){delete a[b]},_updateClear:function(a,b){var c,d=a[b];if(d&&"object"==typeof d)for(c in d)d.hasOwnProperty(c)&&this._updateUnset(d,c)},_updatePop:function(a,b){var c,d=!1;if(a.length>0)if(b>0){for(c=0;b>c;c++)a.pop();d=!0}else if(0>b){for(c=0;c>b;c--)a.shift();d=!0}return d}};b.exports=d},{}],24:[function(a,b,c){"use strict";var d=a("./Shared"),e=a("./Path"),f=function(a){this.pathSolver=new e,this.counter=0,this.init.apply(this,arguments)};f.prototype.init=function(a){this._data={operation:a,index:{potential:[],used:!1},steps:[],time:{startMs:0,stopMs:0,totalMs:0,process:{}},flag:{},log:[]}},d.addModule("Operation",f),d.mixin(f.prototype,"Mixin.ChainReactor"),f.prototype.start=function(){this._data.time.startMs=(new Date).getTime()},f.prototype.log=function(a){if(a){var b=this._log.length>0?this._data.log[this._data.log.length-1].time:0,c={event:a,time:(new Date).getTime(),delta:0};return this._data.log.push(c),b&&(c.delta=c.time-b),this}return this._data.log},f.prototype.time=function(a){if(void 0!==a){var b=this._data.time.process,c=b[a]=b[a]||{};return c.startMs?(c.stopMs=(new Date).getTime(),c.totalMs=c.stopMs-c.startMs,c.stepObj.totalMs=c.totalMs,delete c.stepObj):(c.startMs=(new Date).getTime(),c.stepObj={name:a},this._data.steps.push(c.stepObj)),this}return this._data.time},f.prototype.flag=function(a,b){return void 0===a||void 0===b?void 0!==a?this._data.flag[a]:this._data.flag:void(this._data.flag[a]=b)},f.prototype.data=function(a,b,c){return void 0!==b?(this.pathSolver.set(this._data,a,b),this):this.pathSolver.get(this._data,a)},f.prototype.pushData=function(a,b,c){this.pathSolver.push(this._data,a,b)},f.prototype.stop=function(){this._data.time.stopMs=(new Date).getTime(),this._data.time.totalMs=this._data.time.stopMs-this._data.time.startMs},d.finishModule("Operation"),b.exports=f},{"./Path":26,"./Shared":29}],25:[function(a,b,c){"use strict";var d=function(a){if(a){var b,c,d,e,f,g,h=this;if(!(a instanceof Array)){d={};for(b in a)if(a.hasOwnProperty(b))if(e=b.replace(/ /g,""),-1===e.indexOf("*"))d[e]=a[b];else for(g=this.generateSignaturePermutations(e),f=0;f<g.length;f++)d[g[f]]||(d[g[f]]=a[b]);a=d}return function(){var d,e,f,g=[];if(a instanceof Array){for(c=a.length,b=0;c>b;b++)if(a[b].length===arguments.length)return h.callExtend(this,"$main",a,a[b],arguments)}else{for(b=0;b<arguments.length&&(e=typeof arguments[b],"object"===e&&arguments[b]instanceof Array&&(e="array"),1!==arguments.length||"undefined"!==e);b++)g.push(e);if(d=g.join(","),a[d])return h.callExtend(this,"$main",a,a[d],arguments);for(b=g.length;b>=0;b--)if(d=g.slice(0,b).join(","),a[d+",..."])return h.callExtend(this,"$main",a,a[d+",..."],arguments)}throw f="function"==typeof this.name?this.name():"Unknown",'ForerunnerDB.Overload "'+f+'": Overloaded method does not have a matching signature for the passed arguments: '+this.jStringify(g)}}return function(){}};d.prototype.generateSignaturePermutations=function(a){var b,c,d=[],e=["string","object","number","function","undefined"];if(a.indexOf("*")>-1)for(c=0;c<e.length;c++)b=a.replace("*",e[c]),d=d.concat(this.generateSignaturePermutations(b));else d.push(a);return d},d.prototype.callExtend=function(a,b,c,d,e){var f,g;return a&&c[b]?(f=a[b],a[b]=c[b],g=d.apply(a,e),a[b]=f,g):d.apply(a,e)},b.exports=d},{}],26:[function(a,b,c){"use strict";var d=a("./Shared"),e=function(a){this.init.apply(this,arguments)};e.prototype.init=function(a){a&&this.path(a)},d.addModule("Path",e),d.mixin(e.prototype,"Mixin.Common"),d.mixin(e.prototype,"Mixin.ChainReactor"),e.prototype.path=function(a){return void 0!==a?(this._path=this.clean(a),this._pathParts=this._path.split("."),this):this._path},e.prototype.hasObjectPaths=function(a,b){var c,d=!0;for(c in a)if(a.hasOwnProperty(c)){if(void 0===b[c])return!1;if("object"==typeof a[c]&&(d=this.hasObjectPaths(a[c],b[c]),!d))return!1}return d},e.prototype.countKeys=function(a){var b,c=0;for(b in a)a.hasOwnProperty(b)&&void 0!==a[b]&&("object"!=typeof a[b]?c++:c+=this.countKeys(a[b]));return c},e.prototype.countObjectPaths=function(a,b){var c,d,e={},f=0,g=0;for(d in b)b.hasOwnProperty(d)&&("object"==typeof b[d]?(c=this.countObjectPaths(a[d],b[d]),e[d]=c.matchedKeys,g+=c.totalKeyCount,f+=c.matchedKeyCount):(g++,a&&a[d]&&"object"!=typeof a[d]?(e[d]=!0,f++):e[d]=!1));return{matchedKeys:e,matchedKeyCount:f,totalKeyCount:g}},e.prototype.parse=function(a,b){var c,d,e,f=[],g="";for(d in a)if(a.hasOwnProperty(d))if(g=d,"object"==typeof a[d])if(b)for(c=this.parse(a[d],b),e=0;e<c.length;e++)f.push({path:g+"."+c[e].path,value:c[e].value});else for(c=this.parse(a[d]),e=0;e<c.length;e++)f.push({path:g+"."+c[e].path});else b?f.push({path:g,value:a[d]}):f.push({path:g});return f},e.prototype.parseArr=function(a,b){return b=b||{},this._parseArr(a,"",[],b)},e.prototype._parseArr=function(a,b,c,d){var e,f="";b=b||"",c=c||[];for(e in a)a.hasOwnProperty(e)&&(!d.ignore||d.ignore&&!d.ignore.test(e))&&(f=b?b+"."+e:e,"object"==typeof a[e]?(d.verbose&&c.push(f),this._parseArr(a[e],f,c,d)):c.push(f));return c},e.prototype.value=function(a,b){if(void 0!==a&&"object"==typeof a){var c,d,e,f,g,h,i,j=[];for(void 0!==b&&(b=this.clean(b),c=b.split(".")),d=c||this._pathParts,e=d.length,f=a,h=0;e>h;h++){if(f=f[d[h]],g instanceof Array){for(i=0;i<g.length;i++)j=j.concat(this.value(g,i+"."+d[h]));return j}if(!f||"object"!=typeof f)break;g=f}return[f]}return[]},e.prototype.set=function(a,b,c){if(void 0!==a&&void 0!==b){var d,e;b=this.clean(b),d=b.split("."),e=d.shift(),d.length?(a[e]=a[e]||{},this.set(a[e],d.join("."),c)):a[e]=c}return a},e.prototype.get=function(a,b){return this.value(a,b)[0]},e.prototype.push=function(a,b,c){if(void 0!==a&&void 0!==b){var d,e;if(b=this.clean(b),d=b.split("."),e=d.shift(),d.length)a[e]=a[e]||{},this.set(a[e],d.join("."),c);else{if(a[e]=a[e]||[],!(a[e]instanceof Array))throw"ForerunnerDB.Path: Cannot push to a path whose endpoint is not an array!";a[e].push(c)}}return a},e.prototype.keyValue=function(a,b){var c,d,e,f,g,h,i;for(void 0!==b&&(b=this.clean(b),c=b.split(".")),d=c||this._pathParts,e=d.length,f=a,i=0;e>i;i++){if(f=f[d[i]],!f||"object"!=typeof f){h=d[i]+":"+f;break}g=f}return h},e.prototype.set=function(a,b,c){if(void 0!==a&&void 0!==b){var d,e;b=this.clean(b),d=b.split("."),e=d.shift(),d.length?(a[e]=a[e]||{},this.set(a[e],d.join("."),c)):a[e]=c}return a},e.prototype.clean=function(a){return"."===a.substr(0,1)&&(a=a.substr(1,a.length-1)),a},d.finishModule("Path"),b.exports=e},{"./Shared":29}],27:[function(a,b,c){"use strict";var d=a("./Shared"),e=function(a,b,c){if(!(a&&b&&c))throw"ForerunnerDB.ReactorIO: ReactorIO requires in, out and process arguments to instantiate!";if(this._reactorIn=a,this._reactorOut=b,this._chainHandler=c,!a.chain||!b.chainReceive)throw"ForerunnerDB.ReactorIO: ReactorIO requires passed in and out objects to implement the ChainReactor mixin!";a.chain(this),this.chain(b)};d.addModule("ReactorIO",e),e.prototype.drop=function(){return this.isDropped()||(this._state="dropped",this._reactorIn&&this._reactorIn.unChain(this),this._reactorOut&&this.unChain(this._reactorOut),delete this._reactorIn,delete this._reactorOut,delete this._chainHandler,this.emit("drop",this)),!0},d.synthesize(e.prototype,"state"),d.mixin(e.prototype,"Mixin.Common"),d.mixin(e.prototype,"Mixin.ChainReactor"),d.mixin(e.prototype,"Mixin.Events"),d.finishModule("ReactorIO"),b.exports=e},{"./Shared":29}],28:[function(a,b,c){"use strict";var d=function(){this.init.apply(this,arguments)};d.prototype.init=function(){this._encoder=[],this._decoder={},this.registerEncoder("$date",function(a){return a instanceof Date?a.toISOString():void 0}),this.registerDecoder("$date",function(a){return new Date(a)})},d.prototype.registerEncoder=function(a,b){this._encoder.push(function(c){var d,e=b(c);return void 0!==e&&(d={},d[a]=e),d})},d.prototype.registerDecoder=function(a,b){this._decoder[a]=b},d.prototype._encode=function(a){for(var b,c=this._encoder.length;c--&&!b;)b=this._encoder[c](a);return b},d.prototype.parse=function(a){return this._parse(JSON.parse(a))},d.prototype._parse=function(a,b){var c;if("object"==typeof a&&null!==a){b=a instanceof Array?b||[]:b||{};for(c in a)if(a.hasOwnProperty(c)){if("$"===c.substr(0,1)&&this._decoder[c])return this._decoder[c](a[c]);b[c]=this._parse(a[c],b[c])}}else b=a;return b},d.prototype.stringify=function(a){return JSON.stringify(this._stringify(a))},d.prototype._stringify=function(a,b){var c,d;if("object"==typeof a&&null!==a){if(c=this._encode(a))return c;b=a instanceof Array?b||[]:b||{};for(d in a)a.hasOwnProperty(d)&&(b[d]=this._stringify(a[d],b[d]))}else b=a;return b},b.exports=d},{}],29:[function(a,b,c){"use strict";var d=a("./Overload"),e={version:"1.3.435",modules:{},plugins:{},_synth:{},addModule:function(a,b){this.modules[a]=b,this.emit("moduleLoad",[a,b])},finishModule:function(a){if(!this.modules[a])throw"ForerunnerDB.Shared: finishModule called on a module that has not been registered with addModule(): "+a;this.modules[a]._fdbFinished=!0,this.modules[a].prototype?this.modules[a].prototype.className=a:this.modules[a].className=a,this.emit("moduleFinished",[a,this.modules[a]])},moduleFinished:function(a,b){this.modules[a]&&this.modules[a]._fdbFinished?b&&b(a,this.modules[a]):this.on("moduleFinished",b)},moduleExists:function(a){return Boolean(this.modules[a])},mixin:new d({"object, string":function(a,b){var c;if("string"==typeof b&&(c=this.mixins[b],!c))throw"ForerunnerDB.Shared: Cannot find mixin named: "+b;return this.$main.call(this,a,c)},"object, *":function(a,b){return this.$main.call(this,a,b)},$main:function(a,b){if(b&&"object"==typeof b)for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}}),synthesize:function(a,b,c){if(this._synth[b]=this._synth[b]||function(a){return void 0!==a?(this["_"+b]=a,this):this["_"+b]},c){var d=this;a[b]=function(){var a,e=this.$super;return this.$super=d._synth[b],a=c.apply(this,arguments),this.$super=e,a}}else a[b]=this._synth[b]},overload:d,mixins:{"Mixin.Common":a("./Mixin.Common"),"Mixin.Events":a("./Mixin.Events"),"Mixin.ChainReactor":a("./Mixin.ChainReactor"),"Mixin.CRUD":a("./Mixin.CRUD"),"Mixin.Constants":a("./Mixin.Constants"),"Mixin.Triggers":a("./Mixin.Triggers"),"Mixin.Sorting":a("./Mixin.Sorting"),"Mixin.Matching":a("./Mixin.Matching"),"Mixin.Updating":a("./Mixin.Updating"),"Mixin.Tags":a("./Mixin.Tags")}};e.mixin(e,"Mixin.Events"),b.exports=e},{"./Mixin.CRUD":14,"./Mixin.ChainReactor":15,"./Mixin.Common":16,"./Mixin.Constants":17,"./Mixin.Events":18,"./Mixin.Matching":19,"./Mixin.Sorting":20,"./Mixin.Tags":21,"./Mixin.Triggers":22,"./Mixin.Updating":23,"./Overload":25}],30:[function(a,b,c){Array.prototype.filter||(Array.prototype.filter=function(a){if(void 0===this||null===this)throw new TypeError;var b=Object(this),c=b.length>>>0;if("function"!=typeof a)throw new TypeError;for(var d=[],e=arguments.length>=2?arguments[1]:void 0,f=0;c>f;f++)if(f in b){var g=b[f];a.call(e,g,f,b)&&d.push(g)}return d}),"function"!=typeof Object.create&&(Object.create=function(){var a=function(){};return function(b){if(arguments.length>1)throw Error("Second argument not supported");if("object"!=typeof b)throw TypeError("Argument must be an object");a.prototype=b;var c=new a;return a.prototype=null,c}}()),Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){var c;if(null===this)throw new TypeError('"this" is null or not defined');var d=Object(this),e=d.length>>>0;if(0===e)return-1;var f=+b||0;if(Math.abs(f)===1/0&&(f=0),f>=e)return-1;for(c=Math.max(f>=0?f:e-Math.abs(f),0);e>c;){if(c in d&&d[c]===a)return c;c++}return-1}),b.exports={}},{}],31:[function(a,b,c){"use strict";var d,e,f,g,h,i,j,k;d=a("./Shared");var l=function(a,b,c){this.init.apply(this,arguments)};l.prototype.init=function(a,b,c){var d=this;this._name=a,this._listeners={},this._querySettings={},this._debug={},this.query(b,!1),this.queryOptions(c,!1),this._collectionDroppedWrap=function(){d._collectionDropped.apply(d,arguments)},this._privateData=new f(this.name()+"_internalPrivate")},d.addModule("View",l),d.mixin(l.prototype,"Mixin.Common"),d.mixin(l.prototype,"Mixin.ChainReactor"),d.mixin(l.prototype,"Mixin.Constants"),d.mixin(l.prototype,"Mixin.Triggers"),d.mixin(l.prototype,"Mixin.Tags"),f=a("./Collection"),g=a("./CollectionGroup"),k=a("./ActiveBucket"),j=a("./ReactorIO"),h=f.prototype.init,e=d.modules.Db,i=e.prototype.init,d.synthesize(l.prototype,"state"),d.synthesize(l.prototype,"name"),d.synthesize(l.prototype,"cursor",function(a){return void 0===a?this._cursor||{}:void this.$super.apply(this,arguments)}),l.prototype.insert=function(){this._from.insert.apply(this._from,arguments)},l.prototype.update=function(){this._from.update.apply(this._from,arguments)},l.prototype.updateById=function(){this._from.updateById.apply(this._from,arguments)},l.prototype.remove=function(){this._from.remove.apply(this._from,arguments)},l.prototype.find=function(a,b){return this.publicData().find(a,b)},l.prototype.findOne=function(a,b){return this.publicData().findOne(a,b)},l.prototype.findById=function(a,b){return this.publicData().findById(a,b)},l.prototype.findSub=function(a,b,c,d){return this.publicData().findSub(a,b,c,d)},l.prototype.findSubOne=function(a,b,c,d){return this.publicData().findSubOne(a,b,c,d)},l.prototype.data=function(){return this._privateData},l.prototype.from=function(a,b){var c=this;if(void 0!==a){this._from&&(this._from.off("drop",this._collectionDroppedWrap),delete this._from),"string"==typeof a&&(a=this._db.collection(a)),"View"===a.className&&(a=a.privateData(),this.debug()&&console.log(this.logIdentifier()+' Using internal private data "'+a.instanceIdentifier()+'" for IO graph linking')),this._from=a,this._from.on("drop",this._collectionDroppedWrap),this._io=new j(a,this,function(a){var b,d,e,f,g,h,i;if(c&&!c.isDropped()&&c._querySettings.query){if("insert"===a.type){if(b=a.data,b instanceof Array)for(f=[],i=0;i<b.length;i++)c._privateData._match(b[i],c._querySettings.query,c._querySettings.options,"and",{})&&(f.push(b[i]),g=!0);else c._privateData._match(b,c._querySettings.query,c._querySettings.options,"and",{})&&(f=b,g=!0);return g&&this.chainSend("insert",f),!0}if("update"===a.type){if(d=c._privateData.diff(c._from.subset(c._querySettings.query,c._querySettings.options)),d.insert.length||d.remove.length){if(d.insert.length&&this.chainSend("insert",d.insert),d.update.length)for(h=c._privateData.primaryKey(),i=0;i<d.update.length;i++)e={},e[h]=d.update[i][h],this.chainSend("update",{query:e,update:d.update[i]});if(d.remove.length){h=c._privateData.primaryKey();var j=[],k={query:{$or:j}};for(i=0;i<d.remove.length;i++)j.push({_id:d.remove[i][h]});this.chainSend("remove",k)}return!0}return!1}}return!1});var d=a.find(this._querySettings.query,this._querySettings.options);return this._privateData.primaryKey(a.primaryKey()),this._privateData.setData(d,{},b),this._querySettings.options&&this._querySettings.options.$orderBy?this.rebuildActiveBucket(this._querySettings.options.$orderBy):this.rebuildActiveBucket(),this}return this._from},l.prototype._collectionDropped=function(a){a&&delete this._from},l.prototype.ensureIndex=function(){return this._privateData.ensureIndex.apply(this._privateData,arguments)},l.prototype._chainHandler=function(a){var b,c,d,e,f,g,h,i;switch(this.debug()&&console.log(this.logIdentifier()+" Received chain reactor data"),a.type){case"setData":this.debug()&&console.log(this.logIdentifier()+' Setting data in underlying (internal) view collection "'+this._privateData.name()+'"');var j=this._from.find(this._querySettings.query,this._querySettings.options);this._privateData.setData(j);break;case"insert":if(this.debug()&&console.log(this.logIdentifier()+' Inserting some data into underlying (internal) view collection "'+this._privateData.name()+'"'),a.data=this.decouple(a.data),a.data instanceof Array||(a.data=[a.data]),this._querySettings.options&&this._querySettings.options.$orderBy)for(b=a.data,c=b.length,d=0;c>d;d++)e=this._activeBucket.insert(b[d]),this._privateData._insertHandle(a.data,e);else e=this._privateData._data.length,this._privateData._insertHandle(a.data,e);break;case"update":if(this.debug()&&console.log(this.logIdentifier()+' Updating some data in underlying (internal) view collection "'+this._privateData.name()+'"'),g=this._privateData.primaryKey(),f=this._privateData.update(a.data.query,a.data.update,a.data.options),this._querySettings.options&&this._querySettings.options.$orderBy)for(c=f.length,d=0;c>d;d++)h=f[d],this._activeBucket.remove(h),i=this._privateData._data.indexOf(h),e=this._activeBucket.insert(h),i!==e&&this._privateData._updateSpliceMove(this._privateData._data,i,e);break;case"remove":this.debug()&&console.log(this.logIdentifier()+' Removing some data from underlying (internal) view collection "'+this._privateData.name()+'"'),this._privateData.remove(a.data.query,a.options)}},l.prototype.on=function(){return this._privateData.on.apply(this._privateData,arguments)},l.prototype.off=function(){return this._privateData.off.apply(this._privateData,arguments)},l.prototype.emit=function(){return this._privateData.emit.apply(this._privateData,arguments)},l.prototype.distinct=function(a,b,c){var d=this.publicData();return d.distinct.apply(d,arguments)},l.prototype.primaryKey=function(){return this.publicData().primaryKey()},l.prototype.drop=function(a){return this.isDropped()?!1:(this._from&&(this._from.off("drop",this._collectionDroppedWrap),this._from._removeView(this)),(this.debug()||this._db&&this._db.debug())&&console.log(this.logIdentifier()+" Dropping"),this._state="dropped",this._io&&this._io.drop(),this._privateData&&this._privateData.drop(),this._publicData&&this._publicData!==this._privateData&&this._publicData.drop(),this._db&&this._name&&delete this._db._view[this._name],this.emit("drop",this),a&&a(!1,!0),delete this._chain,delete this._from,delete this._privateData,delete this._io,delete this._listeners,delete this._querySettings,delete this._db,!0)},d.synthesize(l.prototype,"db",function(a){return a&&(this.privateData().db(a),this.publicData().db(a),this.debug(a.debug()),this.privateData().debug(a.debug()),this.publicData().debug(a.debug())),this.$super.apply(this,arguments)}),l.prototype.queryData=function(a,b,c){return void 0!==a&&(this._querySettings.query=a),void 0!==b&&(this._querySettings.options=b),void 0!==a||void 0!==b?((void 0===c||c===!0)&&this.refresh(),this):this._querySettings},l.prototype.queryAdd=function(a,b,c){this._querySettings.query=this._querySettings.query||{};var d,e=this._querySettings.query;if(void 0!==a)for(d in a)a.hasOwnProperty(d)&&(void 0===e[d]||void 0!==e[d]&&b!==!1)&&(e[d]=a[d]);(void 0===c||c===!0)&&this.refresh()},l.prototype.queryRemove=function(a,b){var c,d=this._querySettings.query;if(d){if(void 0!==a)for(c in a)a.hasOwnProperty(c)&&delete d[c];(void 0===b||b===!0)&&this.refresh()}},l.prototype.query=function(a,b){return void 0!==a?(this._querySettings.query=a,(void 0===b||b===!0)&&this.refresh(),this):this._querySettings.query},l.prototype.orderBy=function(a){if(void 0!==a){var b=this.queryOptions()||{};return b.$orderBy=a,this.queryOptions(b),this}return(this.queryOptions()||{}).$orderBy},l.prototype.page=function(a){if(void 0!==a){var b=this.queryOptions()||{};return a!==b.$page&&(b.$page=a,this.queryOptions(b)),this}return(this.queryOptions()||{}).$page},l.prototype.pageFirst=function(){return this.page(0)},l.prototype.pageLast=function(){var a=this.cursor().pages,b=void 0!==a?a:0;return this.page(b-1)},l.prototype.pageScan=function(a){if(void 0!==a){var b=this.cursor().pages,c=this.queryOptions()||{},d=void 0!==c.$page?c.$page:0;return d+=a,0>d&&(d=0),d>=b&&(d=b-1),this.page(d)}},l.prototype.queryOptions=function(a,b){return void 0!==a?(this._querySettings.options=a,void 0===a.$decouple&&(a.$decouple=!0),void 0===b||b===!0?this.refresh():this.rebuildActiveBucket(a.$orderBy),this):this._querySettings.options},l.prototype.rebuildActiveBucket=function(a){if(a){var b=this._privateData._data,c=b.length;this._activeBucket=new k(a),this._activeBucket.primaryKey(this._privateData.primaryKey());for(var d=0;c>d;d++)this._activeBucket.insert(b[d])}else delete this._activeBucket},l.prototype.refresh=function(){if(this._from){var a,b=this.publicData();this._privateData.remove(),a=this._from.find(this._querySettings.query,this._querySettings.options),this.cursor(a.$cursor),this._privateData.insert(a),this._privateData._data.$cursor=a.$cursor,b._data.$cursor=a.$cursor}return this._querySettings.options&&this._querySettings.options.$orderBy?this.rebuildActiveBucket(this._querySettings.options.$orderBy):this.rebuildActiveBucket(),this},l.prototype.count=function(){return this.publicData()?this.publicData().count.apply(this.publicData(),arguments):0},l.prototype.subset=function(){return this.publicData().subset.apply(this._privateData,arguments)},l.prototype.transform=function(a){var b=this;return void 0!==a?("object"==typeof a?(void 0!==a.enabled&&(this._transformEnabled=a.enabled),void 0!==a.dataIn&&(this._transformIn=a.dataIn),void 0!==a.dataOut&&(this._transformOut=a.dataOut)):this._transformEnabled=a!==!1,this._transformEnabled?(this._publicData||(this._publicData=new f("__FDB__view_publicData_"+this._name),this._publicData.db(this._privateData._db),this._publicData.transform({enabled:!0,dataIn:this._transformIn,dataOut:this._transformOut}),this._transformIo=new j(this._privateData,this._publicData,function(a){var c=a.data;switch(a.type){case"primaryKey":b._publicData.primaryKey(c),this.chainSend("primaryKey",c);break;case"setData":b._publicData.setData(c),this.chainSend("setData",c);break;case"insert":b._publicData.insert(c),this.chainSend("insert",c);break;case"update":b._publicData.update(c.query,c.update,c.options),this.chainSend("update",c);break;case"remove":b._publicData.remove(c.query,a.options),this.chainSend("remove",c)}})),this._publicData.primaryKey(this.privateData().primaryKey()),this._publicData.setData(this.privateData().find())):this._publicData&&(this._publicData.drop(),delete this._publicData,this._transformIo&&(this._transformIo.drop(),delete this._transformIo)),this):{enabled:this._transformEnabled,dataIn:this._transformIn,dataOut:this._transformOut}},l.prototype.filter=function(a,b,c){return this.publicData().filter(a,b,c)},l.prototype.privateData=function(){return this._privateData},l.prototype.publicData=function(){return this._transformEnabled?this._publicData:this._privateData},f.prototype.init=function(){this._view=[],h.apply(this,arguments)},f.prototype.view=function(a,b,c){if(this._db&&this._db._view){if(this._db._view[a])throw this.logIdentifier()+" Cannot create a view using this collection because a view with this name already exists: "+a;var d=new l(a,b,c).db(this._db).from(this);return this._view=this._view||[],this._view.push(d),d}},f.prototype._addView=g.prototype._addView=function(a){return void 0!==a&&this._view.push(a),this},f.prototype._removeView=g.prototype._removeView=function(a){if(void 0!==a){var b=this._view.indexOf(a);b>-1&&this._view.splice(b,1)}return this},e.prototype.init=function(){this._view={},i.apply(this,arguments)},e.prototype.view=function(a){return a instanceof l?a:(this._view[a]||(this.debug()||this._db&&this._db.debug())&&console.log(this.logIdentifier()+" Creating view "+a),this._view[a]=this._view[a]||new l(a).db(this),this._view[a])},e.prototype.viewExists=function(a){return Boolean(this._view[a])},e.prototype.views=function(){var a,b,c=[];for(b in this._view)this._view.hasOwnProperty(b)&&(a=this._view[b],c.push({name:b,count:a.count(),linked:void 0!==a.isLinked?a.isLinked():!1}));return c},d.finishModule("View"),b.exports=l},{"./ActiveBucket":3,"./Collection":5,"./CollectionGroup":6,"./ReactorIO":27,"./Shared":29}]},{},[1]); |
src/demos/building-a-geospatial-app/1-starting-with-map/src/app.js | uber-common/vis-academy | /* global window */
import React, { Component } from 'react';
import MapGL from 'react-map-gl';
import {MapStylePicker} from './controls';
export default class App extends Component {
state = {
style: 'mapbox://styles/mapbox/light-v9',
viewport: {
width: window.innerWidth,
height: window.innerHeight,
longitude: -74,
latitude: 40.7,
zoom: 11,
maxZoom: 16
}
}
componentDidMount() {
window.addEventListener('resize', this._resize);
this._resize();
}
componentWillUnmount() {
window.removeEventListener('resize', this._resize);
}
onStyleChange = (style) => {
this.setState({style});
}
_onViewportChange = (viewport) => {
this.setState({
viewport: { ...this.state.viewport, ...viewport }
});
}
_resize = () => {
this._onViewportChange({
width: window.innerWidth,
height: window.innerHeight
});
}
render() {
return (
<div>
<MapStylePicker onStyleChange={this.onStyleChange} currentStyle={this.state.style}/>
<MapGL
{...this.state.viewport}
mapStyle={this.state.style}
onViewportChange={viewport => this._onViewportChange(viewport)}
>
</MapGL>
</div>
);
}
}
|
client/src/components/Explorer/ExplorerPanel.js | mikedingjan/wagtail | import PropTypes from 'prop-types';
import React from 'react';
import FocusTrap from 'focus-trap-react';
import { STRINGS, MAX_EXPLORER_PAGES } from '../../config/wagtailConfig';
import Button from '../Button/Button';
import LoadingSpinner from '../LoadingSpinner/LoadingSpinner';
import Transition, { PUSH, POP } from '../Transition/Transition';
import ExplorerHeader from './ExplorerHeader';
import ExplorerItem from './ExplorerItem';
import PageCount from './PageCount';
/**
* The main panel of the page explorer menu, with heading,
* menu items, and special states.
*/
class ExplorerPanel extends React.Component {
constructor(props) {
super(props);
this.state = {
transition: PUSH,
paused: false,
};
this.onItemClick = this.onItemClick.bind(this);
this.onHeaderClick = this.onHeaderClick.bind(this);
this.clickOutside = this.clickOutside.bind(this);
}
componentWillReceiveProps(newProps) {
const { path } = this.props;
const isPush = newProps.path.length > path.length;
this.setState({
transition: isPush ? PUSH : POP,
});
}
componentDidMount() {
document.querySelector('[data-explorer-menu-item]').classList.add('submenu-active');
document.body.classList.add('explorer-open');
document.addEventListener('mousedown', this.clickOutside);
document.addEventListener('touchend', this.clickOutside);
}
componentWillUnmount() {
document.querySelector('[data-explorer-menu-item]').classList.remove('submenu-active');
document.body.classList.remove('explorer-open');
document.removeEventListener('mousedown', this.clickOutside);
document.removeEventListener('touchend', this.clickOutside);
}
clickOutside(e) {
const { onClose } = this.props;
const explorer = document.querySelector('[data-explorer-menu]');
const toggle = document.querySelector('[data-explorer-menu-item]');
const isInside = explorer.contains(e.target) || toggle.contains(e.target);
if (!isInside) {
onClose();
}
if (toggle.contains(e.target)) {
this.setState({
paused: true,
});
}
}
onItemClick(id, e) {
const { pushPage } = this.props;
e.preventDefault();
e.stopPropagation();
pushPage(id);
}
onHeaderClick(e) {
const { path, popPage } = this.props;
const hasBack = path.length > 1;
if (hasBack) {
e.preventDefault();
e.stopPropagation();
popPage();
}
}
renderChildren() {
const { page, nodes } = this.props;
let children;
if (!page.isFetching && !page.children.items) {
children = (
<div key="empty" className="c-explorer__placeholder">
{STRINGS.NO_RESULTS}
</div>
);
} else {
children = (
<div key="children">
{page.children.items.map((id) => (
<ExplorerItem
key={id}
item={nodes[id]}
onClick={this.onItemClick.bind(null, id)}
/>
))}
</div>
);
}
return (
<div className="c-explorer__drawer">
{children}
{page.isFetching ? (
<div key="fetching" className="c-explorer__placeholder">
<LoadingSpinner />
</div>
) : null}
{page.isError ? (
<div key="error" className="c-explorer__placeholder">
{STRINGS.SERVER_ERROR}
</div>
) : null}
</div>
);
}
render() {
const { page, onClose, path } = this.props;
const { transition, paused } = this.state;
return (
<FocusTrap
tag="div"
role="dialog"
className="explorer"
paused={paused || !page || page.isFetching}
focusTrapOptions={{
initialFocus: '.c-explorer__header',
onDeactivate: onClose,
}}
>
<Button className="c-explorer__close u-hidden" onClick={onClose}>
{STRINGS.CLOSE_EXPLORER}
</Button>
<Transition name={transition} className="c-explorer" component="nav" label={STRINGS.PAGE_EXPLORER}>
<div key={path.length} className="c-transition-group">
<ExplorerHeader
depth={path.length}
page={page}
onClick={this.onHeaderClick}
/>
{this.renderChildren()}
{page.isError || page.children.items && page.children.count > MAX_EXPLORER_PAGES ? (
<PageCount page={page} />
) : null}
</div>
</Transition>
</FocusTrap>
);
}
}
ExplorerPanel.propTypes = {
nodes: PropTypes.object.isRequired,
path: PropTypes.array.isRequired,
page: PropTypes.shape({
isFetching: PropTypes.bool,
children: PropTypes.shape({
count: PropTypes.number,
items: PropTypes.array,
}),
}).isRequired,
onClose: PropTypes.func.isRequired,
popPage: PropTypes.func.isRequired,
pushPage: PropTypes.func.isRequired,
};
export default ExplorerPanel;
|
src/ElementPortal.js | zapier/react-element-portal | import PropTypes from 'prop-types';
import React from 'react';
import ReactDOM from 'react-dom';
import createReactClass from 'create-react-class';
const { push, slice } = Array.prototype;
const noop = () => {};
const toNodesArray = (x) => (
x instanceof NodeList
? slice.call(x)
: Array.isArray(x)
? x
: x != null
? [x]
: null
);
const removeNodeAttributes = (node, attrs) => {
if (attrs === true) {
while (node.attributes.length > 0) {
node.removeAttribute(node.attributes[0].name);
}
}
else {
attrs.forEach(attr => {
node.removeAttribute(attr);
});
}
};
const ElementPortal = createReactClass({
propTypes: {
selector: PropTypes.string,
nodes: PropTypes.oneOfType([
PropTypes.instanceOf(HTMLElement),
PropTypes.instanceOf(NodeList),
PropTypes.arrayOf(PropTypes.instanceOf(HTMLElement))
]),
component: PropTypes.elementType,
mapNodeToProps: PropTypes.func,
resetAttributes: PropTypes.oneOfType([
PropTypes.bool,
PropTypes.arrayOf(PropTypes.string)
])
},
componentDidMount() {
this.renderToNodes();
},
componentDidUpdate() {
this.renderToNodes();
},
renderToNodes() {
const { nodes, selector } = this.props;
const collectedNodes = [];
push.apply(collectedNodes, toNodesArray(document.querySelectorAll(selector)));
push.apply(collectedNodes, toNodesArray(nodes));
if (collectedNodes.length) {
collectedNodes.forEach(this.renderNode);
}
},
renderNode(node) {
const mapNodeToProps = this.props.mapNodeToProps || noop;
if (this.props.resetAttributes) {
removeNodeAttributes(node, this.props.resetAttributes);
}
const children = this.props.component
? React.createElement(this.props.component, mapNodeToProps(node))
: React.Children.only(this.props.children);
ReactDOM.unstable_renderSubtreeIntoContainer(
this,
children,
node
);
},
render() {
return null;
}
});
export default ElementPortal;
|
node_modules/cordova-windows/node_modules/winjs/js/ui.min.js | luismpsilva/spl-invent | /*! Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License.txt in the project root for license information. */
!function(){var a="undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:{};!function(b){"function"==typeof define&&define.amd?define(["./base"],b):(a.msWriteProfilerMark&&msWriteProfilerMark("WinJS.4.4 4.4.0.winjs.2015.10.2 ui.js,StartTM"),b("object"==typeof exports&&"string"!=typeof exports.nodeName?require("./base"):a.WinJS),a.msWriteProfilerMark&&msWriteProfilerMark("WinJS.4.4 4.4.0.winjs.2015.10.2 ui.js,StopTM"))}(function(b){var c=b.Utilities._require,d=b.Utilities._define;d("WinJS/VirtualizedDataSource/_VirtualizedDataSourceImpl",["exports","../Core/_Global","../Core/_Base","../Core/_BaseUtils","../Core/_ErrorFromName","../Core/_Events","../Core/_Log","../Core/_Resources","../Core/_WriteProfilerMark","../Promise","../Scheduler","../_Signal","../Utilities/_UI"],function(a,b,c,d,e,f,g,h,i,j,k,l,m){"use strict";c.Namespace._moduleDefine(a,"WinJS.UI",{VirtualizedDataSource:c.Namespace._lazy(function(){function a(a,c){function f(a){var b="WinJS.UI.VirtualizedDataSource:"+pd+":"+a+",StartTM";i(b),g.log&&g.log(b,"winjs vds","perf")}function u(a){var b="WinJS.UI.VirtualizedDataSource:"+pd+":"+a+",StopTM";i(b),g.log&&g.log(b,"winjs vds","perf")}function v(a){return"number"==typeof a&&a>=0}function w(a){return v(a)&&a===Math.floor(a)}function x(a){if(null===a)a=void 0;else if(void 0!==a&&!w(a))throw new e("WinJS.UI.ListDataSource.InvalidIndexReturned",s.invalidIndexReturned);return a}function y(a){if(null===a)a=void 0;else if(void 0!==a&&!w(a)&&a!==p.unknown)throw new e("WinJS.UI.ListDataSource.InvalidCountReturned",s.invalidCountReturned);return a}function z(){var a=(nc++).toString(),b={handle:a,item:null,itemNew:null,fetchListeners:null,cursorCount:0,bindingMap:null};return Nc[a]=b,b}function A(){return z()}function B(a,b){a.prev=b.prev,a.next=b,a.prev.next=a,b.prev=a}function C(a){a.lastInSequence&&(delete a.lastInSequence,a.prev.lastInSequence=!0),a.firstInSequence&&(delete a.firstInSequence,a.next.firstInSequence=!0),a.prev.next=a.next,a.next.prev=a.prev}function D(a){for(;!a.firstInSequence;)a=a.prev;return a}function E(a){for(;!a.lastInSequence;)a=a.next;return a}function F(a,b,c){return b.prev.next=c.next,c.next.prev=b.prev,b.prev=a.prev,c.next=a,b.prev.next=b,a.prev=c,!0}function G(a,b,c){return b.prev.next=c.next,c.next.prev=b.prev,b.prev=a,c.next=a.next,a.next=b,c.next.prev=c,!0}function H(a){delete a.lastInSequence,delete a.next.firstInSequence}function I(a){var b=a.next;a.lastInSequence=!0,b.firstInSequence=!0,b===Lc&&na(Lc,void 0)}function J(a,b,c,d){B(a,b);var e=a.prev;e.lastInSequence&&(c?delete e.lastInSequence:a.firstInSequence=!0,d?delete b.firstInSequence:a.lastInSequence=!0)}function K(a,b){a.key=b,Oc[a.key]=a}function L(a,b,c){+b===b&&(a.index=b,c[b]=a,Ac||(a.firstInSequence&&a.prev&&a.prev.index===b-1&&H(a.prev),a.lastInSequence&&a.next&&a.next.index===b+1&&H(a)))}function M(a,b){var c=b===Pc?A():z();return B(c,a),c}function N(a,b,c){var d=M(a,c);return d.firstInSequence=!0,d.lastInSequence=!0,L(d,b,c),d}function O(a,b){return N(a,b,Pc)}function P(a,b){var c=M(a,b);return delete a.firstInSequence,c.prev.index===c.index-1?delete c.prev.lastInSequence:c.firstInSequence=!0,L(c,a.index-1,b),c}function Q(a,b){var c=M(a.next,b);return delete a.lastInSequence,c.next.index===c.index+1?delete c.next.firstInSequence:c.lastInSequence=!0,L(c,a.index+1,b),c}function R(a,b,c,d){J(a,b,c,d),Oc[a.key]=a,void 0!==a.index&&(Pc[a.index]=a)}function S(a){C(a),a.key&&delete Oc[a.key],void 0!==a.index&&Pc[a.index]===a&&delete Pc[a.index];var b=a.bindingMap;for(var c in b){var d=b[c].handle;d&&Nc[d]===a&&delete Nc[d]}Nc[a.handle]===a&&delete Nc[a.handle]}function T(a){return!Nc[a.handle]}function U(a,b,c,d,e){var f=e?null:b[a-1];if(f&&(f.next!==d||d.firstInSequence))f=f.next;else if(f=b[a+1],!f){f=c.next;for(var g;;){if(f.firstInSequence&&(g=f),!(a>=f.index)||f===d)break;f=f.next}f!==d||d.firstInSequence||(f=g&&void 0===g.index?g:void 0)}return f}function V(a){return!a.item&&!a.itemNew&&a!==Lc}function W(a,b){Object.defineProperty(a,"handle",{value:b,writable:!1,enumerable:!1,configurable:!0})}function X(a,b,c){W(a,c),Object.defineProperty(a,"index",{get:function(){for(;b.slotMergedWith;)b=b.slotMergedWith;return b.index},enumerable:!1,configurable:!0})}function Y(a){if(void 0===a)return a;var b=JSON.stringify(a);if(void 0===b)throw new e("WinJS.UI.ListDataSource.ObjectIsNotValidJson",s.objectIsNotValidJson);return b}function Z(b){return a.itemSignature?a.itemSignature(b.data):Y(b.data)}function $(b){var c=b.itemNew;b.itemNew=null,c&&(c=Object.create(c),X(c,b,b.handle),a.compareByIdentity||(b.signature=Z(c))),b.item=c,delete b.indexRequested,delete b.keyRequested}function _(a){return a.bindingMap||a.cursorCount>0}function aa(a){return _(a)||a.fetchListeners||a.directFetchListeners}function ba(a){return aa(a)||!a.firstInSequence&&_(a.prev)||!a.lastInSequence&&_(a.next)||!id&&(!a.firstInSequence&&a.prev!==Kc&&!(a.prev.item||a.prev.itemNew))|(!a.lastInSequence&&a.next!==Lc&&!(a.next.item||a.next.itemNew))}function ca(a){I(a),S(a)}function da(){if(!vc){(!Rc||T(Rc))&&(Rc=Lc.prev);for(var a=Rc.prev,b=Rc.next,c=0,d=function(a){a===Lc||ba(a)||(hc>=c?c++:ca(a))};a||b;){if(a){var e=a;a=e.prev,e!==Kc&&d(e)}if(b){var f=b;b=f.next,f!==Mc&&d(f)}}Qc=0}}function ea(a){aa(a)||(Qc++,vc||Uc||(Rc=a,Qc>hc&&!Sc&&(Sc=!0,k.schedule(function(){Sc=!1,da()},k.Priority.idle,null,"WinJS.UI.VirtualizedDataSource.releaseSlotIfUnrequested"))))}function fa(a){for(var b in lc)a(lc[b])}function ga(a,b){for(var c in a.bindingMap)b(a.bindingMap[c].bindingRecord,c)}function ha(a){return a.notificationsSent||(a.notificationsSent=!0,a.notificationHandler.beginNotifications&&a.notificationHandler.beginNotifications()),a.notificationHandler}function ia(){sc||yc||fa(function(a){a.notificationsSent&&(a.notificationsSent=!1,a.notificationHandler.endNotifications&&a.notificationHandler.endNotifications())})}function ja(a,b){var c=a.bindingMap;if(c){var d=c[b];if(d){var e=d.handle;if(e)return e}}return a.handle}function ka(a,b){return a&&a.handle!==b&&(a=Object.create(a),W(a,b)),a}function la(a){var b=Jc;Jc=a,fa(function(a){a.notificationHandler&&a.notificationHandler.countChanged&&ha(a).countChanged(Jc,b)})}function ma(a,b){ga(a,function(c,d){c.notificationHandler.indexChanged&&ha(c).indexChanged(ja(a,d),a.index,b)})}function na(a,b){var c=a.index;if(void 0!==c&&Pc[c]===a&&delete Pc[c],+b===b)L(a,b,Pc);else{if(+c!==c)return;delete a.index}ma(a,c)}function oa(a,b,c,d,e){var f={};if((d||!b.lastInSequence)&&(e||!c.firstInSequence))if(b===Kc)if(c===Lc)for(var g in lc)f[g]=lc[g];else for(var g in c.bindingMap)f[g]=lc[g];else if(c===Lc||c.bindingMap)for(var g in b.bindingMap)(c===Lc||c.bindingMap[g])&&(f[g]=lc[g]);for(var g in a.bindingMap)f[g]=lc[g];return f}function pa(a){var b,c=a.prev,d=a.next,e=oa(a,c,d);for(b in e){var f=e[b];f.notificationHandler&&ha(f).inserted(f.itemPromiseFromKnownSlot(a),c.lastInSequence||c===Kc?null:ja(c,b),d.firstInSequence||d===Lc?null:ja(d,b))}}function qa(a){var b=a.item;$(a),ga(a,function(c,d){var e=ja(a,d);ha(c).changed(ka(a.item,e),ka(b,e))})}function ra(a,b,c,d,e){var f,g=b.prev;if(b===a){if(!a.firstInSequence||!c)return;b=a.next}else if(g===a){if(!a.lastInSequence||!d)return;g=a.prev}if(!e){var h=oa(a,g,b,c,d);for(f in h){var i=h[f];ha(i).moved(i.itemPromiseFromKnownSlot(a),(g.lastInSequence||g===a.prev)&&!c||g===Kc?null:ja(g,f),(b.firstInSequence||b===a.next)&&!d||b===Lc?null:ja(b,f))}fa(function(b){b.adjustCurrentSlot(a)})}C(a),J(a,b,c,d)}function sa(a,b){Ba(a,!0),ga(a,function(c,d){ha(c).removed(ja(a,d),b)}),fa(function(b){b.adjustCurrentSlot(a)}),S(a)}function ta(a){for(;!a.firstInSequence;)a=a.prev;var b;do{b=a.lastInSequence;var c=a.next;sa(a,!0),a=c}while(!b)}function ua(a){var b;if(!a)return b;for(var c=0;!a.firstInSequence;)c++,a=a.prev;return"number"==typeof a.indexNew?a.indexNew+c:"number"==typeof a.index?a.index+c:b}function va(a,b){for(a=a.next;a;a=a.next)if(a.firstInSequence){var c=void 0!==a.indexNew?a.indexNew:a.index;void 0!==c&&(a.indexNew=c+b)}zc+=b,Ac=!0,Uc?wb():Cc++}function wa(a,b){if(a.firstInSequence){var c;if(0>b)c=a.indexNew,void 0!==c?delete a.indexNew:c=a.index,a.lastInSequence||(a=a.next,void 0!==c&&(a.indexNew=c));else if(!a.lastInSequence){var d=a.next;c=d.indexNew,void 0!==c?delete d.indexNew:c=d.index,void 0!==c&&(a.indexNew=c)}}va(a,b)}function xa(a,b){for(var c=Kc;c!==Lc;c=c.next){var d=c.indexNew;if(void 0!==d&&d>=a){va(c,b);break}}}function ya(){var a,b,c;for(a=Kc;;a=a.next){if(a.firstInSequence){if(b=a,void 0!==a.indexNew){if(c=a.indexNew,delete a.indexNew,isNaN(c))break}else c=a.index;a!==Kc&&a.prev.index===c-1&&H(a.prev)}if(a.lastInSequence)for(var d=c,e=b;e!==a.next;e=e.next)d!==e.index&&na(e,d),+d===d&&d++;if(a===Lc)break}for(;a!==Mc;a=a.next)void 0!==a.index&&a!==Lc&&na(a,void 0);Ac=!1,zc&&+Jc===Jc&&(pc?pc.reset():la(Jc+zc),zc=0)}function za(a,b,c,d,e){if(a.item)return new j(function(b){e?e(b,a.item):b(a.item)});var f={listBindingID:d,retained:!1};return a[b]||(a[b]={}),a[b][c]=f,f.promise=new j(function(a,b){f.complete=e?function(b){e(a,b)}:a,f.error=b},function(){for(;a.slotMergedWith;)a=a.slotMergedWith;var d=a[b];if(d){if(delete d[c],Object.keys(d).length>0)return;delete a[b]}ea(a)}),f.promise}function Aa(a,b){for(var c in b)b[c].complete(a)}function Ba(a,b){var c=a.fetchListeners,d=a.directFetchListeners;if(c||d){$(a);var e=a.item,f=function(a){b?Aa(e,a):Gc.push(function(){Aa(e,a)})};d&&(a.directFetchListeners=null,f(d)),c&&(a.fetchListeners=null,f(c)),ea(a)}}function Ca(){var a=Gc;Gc=[];for(var b=0,c=a.length;c>b;b++)a[b]()}function Da(a,b){var c=a.directFetchListeners;if(c){a.directFetchListeners=null;for(var d in c)c[d].error(b);ea(a)}}function Ea(a){return a.firstInSequence&&P(a,Pc),a.lastInSequence&&Q(a,Pc),a.itemNew&&$(a),ab(),a}function Fa(a){if(!a.firstInSequence){var b=a.prev;return b===Kc?null:Ea(b)}return Ea(P(a,Pc))}function Ga(a){if(!a.lastInSequence){var b=a.next;return b===Lc?null:Ea(b)}return Ea(Q(a,Pc))}function Ha(a){return a?za(a,"directFetchListeners",(oc++).toString()):j.wrap(null)}function Ia(a){if("string"!=typeof a||!a)throw new e("WinJS.UI.ListDataSource.KeyIsInvalid",s.keyIsInvalid)}function Ja(a){var b=O(Mc);return K(b,a),b.keyRequested=!0,b}function Ka(a,b){Ia(a);var c=Oc[a];return c||(c=Ja(a),c.hints=b),Ea(c)}function La(a){if("number"!=typeof a||0>a)throw new e("WinJS.UI.ListDataSource.IndexIsInvalid",s.indexIsInvalid);if(Lc.index<=a)return null;var b=Pc[a];if(!b){var c=U(a,Pc,Kc,Lc);if(!c)return null;c===Lc&&a>=Lc&&na(Lc,void 0),b=c.prev.index===a-1?Q(c.prev,Pc):c.index===a+1?P(c,Pc):O(c,a)}return b.item||(b.indexRequested=!0),Ea(b)}function Ma(a){var b=O(Mc);return b.description=a,Ea(b)}function Na(a){if(jc=a,ic!==jc){var c=function(){kc=!1,ic!==jc&&(ic=jc,qd.dispatchEvent(t,ic))};jc===o.failure?c():kc||(kc=!0,b.setTimeout(c,40))}}function Oa(a){var b=a.fetchID;return b&&Fc[b]}function Pa(a,b){a.fetchID=b}function Qa(){var a=Ec;return Ec++,Fc[a]=!0,a}function Ra(a,b,c){var d=Qa();Pa(a,d);for(var e=a;!e.firstInSequence&&b>0;)e=e.prev,b--,Pa(e,d);for(var f=a;!f.lastInSequence&&c>0;)f=f.next,c--,Pa(f,d);return d}function Sa(a){var b=a.items,c=a.offset,d=a.totalCount,e=a.absoluteIndex,f=a.atStart,g=a.atEnd;if(v(e)){if(v(d)){var h=b.length;e-c+h===d&&(g=!0)}c===e&&(f=!0)}f&&(b.unshift(Hc),a.offset++),g&&b.push(Ic)}function Ta(a,b,c){return delete Fc[c],b!==Cc||T(a)?(ab(),!1):!0}function Ua(a,b,c,d){var g=Cc;c.then(function(c){if(!c.items||!c.items.length)return j.wrapError(new e(q.doesNotExist));var h="itemsFetched id="+b+" count="+c.items.length;f(h),Ta(a,g,b)&&(+d===d&&(c.absoluteIndex=d),Sa(c),qb(a,c.items,c.offset,c.totalCount,c.absoluteIndex)),u(h)}).then(null,function(c){Ta(a,g,b)&&rb(a,c)})}function Va(a,b,c,d){var g=Cc;d.then(function(d){if(!d.items||!d.items.length)return j.wrapError(new e(q.doesNotExist));var h="itemsFetched id="+c+" count="+d.items.length;f(h),Ta(b,g,c)&&(d.absoluteIndex=a,Sa(d),sb(a,b,d.items,d.offset,d.totalCount,d.absoluteIndex)),u(h)}).then(null,function(){Ta(b,g,c)&&tb(a,b,g)})}function Wa(a,b){var c=Ra(a,0,b-1);jd?Ua(a,c,jd(c,b),0):Ua(a,c,id(c,0,0,b-1),0)}function Xa(a,b){var c=Ra(a,b-1,0);Ua(a,c,kd(c,b))}function Ya(a,b,c){var d=Ra(a,b,c);Ua(a,d,hd(d,a.key,b,c,a.hints))}function Za(a,b,c){var d=a.index;if(b>d&&(b=d),id){var e=Ra(a,b,c);Ua(a,e,id(e,d,b,c),d)}else if(a.key)Ya(a,b,c);else{var f,g,h=Kc,i=d+1;for(f=a.prev;f!==Kc;f=f.prev)if(void 0!==f.index&&f.key){g=d-f.index,i>g&&(i=g,h=f);break}for(f=a.next;f!==Lc;f=f.next)if(void 0!==f.index&&f.key){g=f.index-d,i>g&&(i=g,h=f);break}if(h===Kc){var e=Ra(a,0,d+1);Va(0,a,e,jd(e,d+1))}else{var j=Math.max(h.index-d,0),k=Math.max(d-h.index,0),e=Ra(h,j,k);Va(h.index,a,e,hd(e,h.key,j,k,a.hints))}}}function $a(a,b,c){var d=Ra(a,b,c);Ua(a,d,ld(d,a.description,b,c))}function _a(){if(!Uc){for(var a,b,c,d,e,f,g,h,i=!1,j=!1,k=Kc.next;k!==Mc;){var l=k.next;if(k!==Lc&&V(k)&&(j=!0,a?b++:(a=k,b=1),Oa(k)&&(i=!0),k.keyRequested&&!c&&(c=k,d=b-1),void 0===k.description||e||(e=k,f=b-1),k.indexRequested&&!g&&(g=k,h=b-1),k.lastInSequence||l===Mc||!V(l))){if(i)i=!1;else{if(qc=!1,!a.firstInSequence&&a.prev.key&&hd?Ya(a.prev,0,b):!k.lastInSequence&&l.key&&hd?Ya(l,b,0):a.prev!==Kc||a.firstInSequence||!jd&&!id?l===Lc&&!k.lastInSequence&&kd?Xa(k,b):c?Ya(c,d,b-1-d):e?$a(e,f,b-1-f):g?Za(g,h,b-1-h):"number"==typeof a.index?Za(a,b-1,0):ta(a):Wa(a,b),qc)return void ab();if(Uc)return}a=g=c=null}k=l}Na(j?o.waiting:o.ready)}}function ab(){Dc||(Dc=!0,k.schedule(function(){Dc=!1,_a(),ia()},k.Priority.max,null,"WinJS.UI.ListDataSource._fetch"))}function bb(b){var c=b.itemNew;if(!c)return!1;var d=b.item;for(var e in d)switch(e){case"data":break;default:if(d[e]!==c[e])return!0}return a.compareByIdentity?d.data!==c.data:b.signature!==Z(c)}function cb(a){aa(a)?bb(a)?qa(a):a.itemNew=null:a.item=null}function db(a){a.item?cb(a):Ba(a)}function eb(a,b){a.key||K(a,b.key),a.itemNew=b,db(a)}function fb(a,b,c){var d=b.bindingMap;if(d)for(var e in c)if(d[e]){var f=b.fetchListeners;for(var g in f){var h=f[g];h.listBindingID===e&&h.retained&&(delete f[g],h.complete(null))}var i=d[e].bindingRecord;ha(i).removed(ja(b,e),!0,ja(a,e)),b.bindingMap&&delete b.bindingMap[e]}}function gb(a,b){if(a.index!==b.index){var c=b.index;b.index=a.index,ma(b,c)}b.slotMergedWith=a;var d=b.bindingMap;for(var e in d){a.bindingMap||(a.bindingMap={});var f=d[e];f.handle||(f.handle=b.handle),Nc[f.handle]=a,a.bindingMap[e]=f}fa(function(c){c.adjustCurrentSlot(b,a)});var g=b.itemNew||b.item;if(g&&(g=Object.create(g),X(g,a,a.handle),eb(a,g)),a.item)b.directFetchListeners&&Gc.push(function(){Aa(a.item,b.directFetchListeners)}),b.fetchListeners&&Gc.push(function(){Aa(a.item,b.fetchListeners)});else{var h;for(h in b.directFetchListeners)a.directFetchListeners||(a.directFetchListeners={}),a.directFetchListeners[h]=b.directFetchListeners[h];for(h in b.fetchListeners)a.fetchListeners||(a.fetchListeners={}),a.fetchListeners[h]=b.fetchListeners[h]}a.itemNew&&Ba(a),b.handle=(nc++).toString(),I(b),S(b)}function hb(a,b,c){b&&b.key&&(c||(c=b.itemNew||b.item),delete b.key,delete Oc[c.key],b.itemNew=null,b.item=null),c&&eb(a,c),b&&gb(a,b)}function ib(a){if("object"!=typeof a)throw new e("WinJS.UI.ListDataSource.InvalidItemReturned",s.invalidItemReturned);if(a===Hc)return Kc;if(a===Ic)return Lc;if(a.key)return d.validation&&Ia(a.key),Oc[a.key];throw new e("WinJS.UI.ListDataSource.InvalidKeyReturned",s.invalidKeyReturned)}function jb(a,b){var c=ib(b);c===a&&(c=null),c&&fb(a,c,a.bindingMap),hb(a,c,b)}function kb(a,b,c,d){if(b&&a.key&&a.key!==b.key)return wb(),!1;var e=Pc[c];if(e)if(e===a)e=null;else{if(e.key&&(a.key||b&&e.key!==b.key))return wb(),!1;if(!a.key&&e.bindingMap)return!1}var f;if(b)if(f=Oc[b.key],f===a)f=null;else if(f&&f.bindingMap)return!1;return e?(fb(a,e,a.bindingMap),delete Pc[c],na(a,c),a.prev.index===c-1&&H(a.prev),a.next.index===c+1&&H(a),d.slotNext=e.slotNext,b||(b=e.itemNew||e.item,b&&(f=Oc[b.key]))):na(a,c),f&&e!==f&&fb(a,f,a.bindingMap),hb(a,f,b),e&&e!==f&&gb(a,e),!0}function lb(a,b,c){if(b.key&&a.key&&b.key!==a.key)return wb(),!1;for(var d in a.bindingMap)c[d]=!0;return fb(a,b,c),hb(a,b),!0}function mb(a,b){for(var c={};a;){var d=a.firstInSequence?null:a.prev;if(b.firstInSequence||b.prev!==Kc){if(b=b.firstInSequence?P(b,Pc):b.prev,!lb(b,a,c))return}else sa(a,!0);a=d}}function nb(a,b){for(var c={};a;){var d=a.lastInSequence?null:a.next;if(b.lastInSequence||b.next!==Lc){if(b=b.lastInSequence?Q(b,Pc):b.next,!lb(b,a,c))return}else sa(a,!0);a=d}}function ob(a){for(var b=0;b<a.length;b++){var c=a[b];mb(c.slotBeforeSequence,c.slotFirstInSequence),nb(c.slotAfterSequence,c.slotLastInSequence)}}function pb(a,b){function c(b){for(var c=Lc.prev;!(c.index<a)&&c!==b;){var e=c.prev;void 0!==c.index&&sa(c,!0),c=e}d=0}for(var d=0,e=Lc.prev;!(e.index<a)||d>0;){var f=e.prev;if(e===Kc){c(Kc);break}if(e.key){if(e.index>=a)return wb(),!1;if(!(e.index>=b))return hd?Ya(e,0,d):Za(e,0,d),!1;c(e)}else e.indexRequested||e.firstInSequence?c(f):d++;e=f}return!0}function qb(a,b,c,d,e){var g="WinJS.UI.ListDataSource.processResults";return f(g),e=x(e),d=y(d),vc?void u(g):(Ac&&ya(),!v(d)&&d!==p.unknown||d===Jc||Lc.firstInSequence?(qc=!0,function(){var f,g,h,i,j=b.length;if("number"!=typeof e)for(f=0;j>f;f++)if(h=ib(b[f]),h&&void 0!==h.index){e=h.index+c-f;break}"number"==typeof e&&b[j-1]===Ic?d=e-c+j-1:!v(d)||void 0!==e&&null!==e||(e=d-(j-1)+c),v(d)&&!pb(d,e-c)&&(d=void 0);var k=new Array(j);for(f=0;j>f;f++){var l=null;if(h=ib(b[f])){if(f>0&&!h.firstInSequence&&h.prev.key&&h.prev.key!==b[f-1].key||"number"==typeof e&&void 0!==h.index&&h.index!==e-c+f)return void wb();(h===Kc||h===Lc||h.bindingMap)&&(l=h)}if("number"==typeof e&&(h=Pc[e-c+f])){if(h.key&&h.key!==b[f].key)return void wb();!l&&h.bindingMap&&(l=h)}if(f===c){if(a.key&&a.key!==b[f].key||"number"==typeof a.index&&"number"==typeof e&&a.index!==e)return void wb();l||(l=a)}k[f]=l}for(f=0;j>f;f++)h=k[f],h&&void 0!==h.index&&h!==Kc&&h!==Lc&&jb(h,b[f]);var m,n,o=[],p=!0;for(f=0;j>f;f++)if(h=k[f],h&&h!==Lc){var q=f;if(void 0===h.index){var r={};kb(h,b[f],e-c+f,r);var s,t=h,u=h;for(g=f-1;!t.firstInSequence&&(s=b[g],s!==Hc);g--){var w=e-c+g;if(0>w)break;if(!kb(t.prev,s,w,r))break;t=t.prev,g>=0&&(k[g]=t)}for(g=f+1;!u.lastInSequence&&(s=b[g],s!==Ic&&g!==d||u.next===Lc)&&(u.next===Lc||kb(u.next,s,e-c+g,r))&&(u=u.next,j>g&&(k[g]=u),q=g,u!==Lc);g++);if(m=t.firstInSequence?null:t.prev,n=u.lastInSequence?null:u.next,m&&I(m),n&&I(u),"number"==typeof e){if(u===Lc)m&&G(Lc,D(m),m);else{var x=r.slotNext;x||(x=U(u.index,Pc,Kc,Lc,!0)),F(x,t,u)}t.prev.index===t.index-1&&H(t.prev),u.next.index===u.index+1&&H(u)}else p||(i=k[f-1],i&&(t.prev!==i&&(u===Lc?(m&&G(Lc,D(m),m),F(t,D(i),i)):G(i,t,u)),H(i)));if(p=!1,Tc)return;o.push({slotBeforeSequence:m,slotFirstInSequence:t,slotLastInSequence:u,slotAfterSequence:n})}f!==c||h===a||T(a)||(m=a.firstInSequence?null:a.prev,n=a.lastInSequence?null:a.next,fb(h,a,h.bindingMap),gb(h,a),o.push({slotBeforeSequence:m,slotFirstInSequence:h,slotLastInSequence:h,slotAfterSequence:n})),f=q}for(v(d)&&Lc.index!==d&&na(Lc,d),ob(o),f=0;j>f;f++)if(h=k[f]){for(g=f-1;g>=0;g--){var y=k[g+1];jb(k[g]=y.firstInSequence?P(k[g+1],Pc):y.prev,b[g])}for(g=f+1;j>g;g++)i=k[g-1],h=k[g],h?h.firstInSequence&&(h.prev!==i&&G(i,h,E(h)),H(i)):jb(k[g]=i.lastInSequence?Q(i,Pc):i.next,b[g]);break}delete a.description}(),Tc||(void 0!==d&&d!==Jc&&la(d),ab()),ia(),Ca(),void u(g)):(wb(),void u(g)))}function rb(a,b){switch(b.name){case q.noResponse:Na(o.failure),Da(a,b);break;case q.doesNotExist:a.indexRequested?pb(a.index):(a.keyRequested||a.description)&&ta(a),ia(),wb()}}function sb(a,b,c,d,f,g){g=x(g),f=y(f);var h=a-d,i=c.length;if(b.index>=h&&b.index<h+i)qb(b,c,b.index-h,f,b.index);else if(d===i-1&&a<b.index||v(f)&&f<=b.index)rb(b,new e(q.doesNotExist));else if(b.index<h){var j=Ra(b,0,h-b.index);Va(h,b,j,hd(j,c[0].key,h-b.index,0))}else{var k=h+i-1,j=Ra(b,b.index-k,0);Va(k,b,j,hd(j,c[i-1].key,0,b.index-k))}}function tb(a,b,c){switch(c.name){case q.doesNotExist:a===Kc.index?(pb(0),rb(b,c)):wb();break;default:rb(b,c)}}function ub(){for(var a=0;a<nd.length&&"beginRefresh"!==nd[a].kind;a++);for(var b=a;b<nd.length&&"beginRefresh"!==nd[b].kind;b++);if(b>a&&b+(b-a)<nd.length){for(var c=!0,d=b-a,e=0;d>e;e++)if(nd[a+e].kind!==nd[b+e].kind){c=!1;break}if(c&&g.log){g.log(s.refreshCycleIdentified,"winjs vds","error");for(var e=a;b>e;e++)g.log(""+(e-a)+": "+JSON.stringify(nd[e]),"winjs vds","error")}return c}}function vb(){return++md>h&&ub()?void Na(o.failure):(nd[++od%nd.length]={kind:"beginRefresh"},Zc={firstInSequence:!0,lastInSequence:!0,index:-1},$c={firstInSequence:!0,lastInSequence:!0},Zc.next=$c,$c.prev=Zc,Xc=!1,Yc=void 0,_c={},ad={},bd={},bd[-1]=Zc,void(cd={}))}function wb(){if(!Tc){if(Tc=!0,Na(o.waiting),xc)return xc=!1,void Zb();if(!vc){var a=++Cc;Uc=!0,Wc=0,k.schedule(function(){if(Cc===a){Tc=!1,vb();for(var b=Kc.next;b!==Mc;){var c=b.next;ba(b)||b===Lc||ca(b),b=c}Eb()}},k.Priority.high,null,"WinJS.VirtualizedDataSource.beginRefresh")}}}function xb(){return Vc=Vc||new l,wb(),Vc.promise}function yb(a,b){return delete Fc[b],a!==Cc?!1:(Wc--,!0)}function zb(a,b,c,d,g){var h=Cc;Wc++,d.then(function(b){if(!b.items||!b.items.length)return j.wrapError(new e(q.doesNotExist));var d="itemsFetched id="+c+" count="+b.items.length;f(d),yb(h,c)&&(Sa(b),Kb(a,b.items,b.offset,b.totalCount,"number"==typeof g?g:b.absoluteIndex)),u(d)}).then(null,function(d){yb(h,c)&&Lb(a,b,d)})}function Ab(a,b,c,d){if(hd)zb(a.key,!1,b,hd(b,a.key,c,d,a.hints));else{var e=10,f=a.index;bd[f]&&bd[f].firstInSequence?zb(a.key,!1,b,id(b,f-1,Math.min(c+e,f)-1,d+1+e),f-1):bd[f]&&bd[f].lastInSequence?zb(a.key,!1,b,id(b,f+1,Math.min(c+e,f)+1,d-1+e),f+1):zb(a.key,!1,b,id(b,f,Math.min(c+e,f),d+e),f)}}function Bb(a){jd?zb(null,!0,a,jd(a,1),0):id&&zb(null,!0,a,id(a,0,0,0),0)}function Cb(a){return Fc[_c[a]]}function Db(a,b){for(var c,d,e,f=3,g=Cc,h=0,i=a;i!==Mc;i=i.next){if(!c&&i.key&&!cd[i.key]&&!Cb(i.key)){var j=ad[i.key];(!j||j.firstInSequence||j.lastInSequence)&&(c=i,d=j,e=Qa())}if(c){var k=Cb(i.key);if(cd[i.key]||ad[i.key]||k||(i.key&&(_c[i.key]=e),h++),i.lastInSequence||i.next===Lc||k){if(Ab(c,e,!d||d.firstInSequence?f:0,h-1+f),!b)break;c=null,h=0}}else i.key&&V(i)&&!cd[i.key]&&(ad[i.key]||(e=Qa(),zb(i.key,!1,e,hd(e,i.key,1,1,i.hints))))}0!==Wc||Xc||Cc!==g||Bb(Qa())}function Eb(){var a=Cc;do dd=!1,ed=!0,Db(Kc.next,!0),ed=!1;while(0===Wc&&dd&&Cc===a&&Uc);0===Wc&&Cc===a&&Ub()}function Fb(a){var b=Cc;if(a){var c=Oc[a];c||(c=Kc.next);do fd=!1,gd=!0,Db(c,!1),gd=!1;while(fd&&Cc===b&&Uc)}ed?dd=!0:0===Wc&&Cc===b&&Eb()}function Gb(a){if("object"==typeof a&&a){if(a===Hc)return Zc;if(a===Ic)return $c;if(a.key)return ad[a.key];throw new e("WinJS.UI.ListDataSource.InvalidKeyReturned",s.invalidKeyReturned)}throw new e("WinJS.UI.ListDataSource.InvalidItemReturned",s.invalidItemReturned)}function Hb(a,b){for(;void 0===a.index;){if(L(a,b,bd),a.firstInSequence)return!0;a=a.prev,b--}return a.index!==b?(wb(),!1):!0}function Ib(a,b){a.key=b.key,ad[a.key]=a,a.item=b}function Jb(){for(var a=$c;!a.firstInSequence;)if(a=a.prev,a===Zc)return null;return a}function Kb(a,b,c,d,e){e=x(e),d=y(d);var f=!1;Xc=!0;var g=e-c,h=b[0];h.key===a&&(f=!0);var i=Gb(h);if(i){if(+g===g&&!Hb(i,g))return}else{if(bd[g])return void wb();var j;if(void 0!==e&&(j=bd[g-1])){if(!j.lastInSequence)return void wb();i=Q(j,bd)}else{var k=+g===g?U(g,bd,Zc,$c):Jb(Zc,$c);if(!k)return void wb();i=N(k,g,bd)}Ib(i,b[0])}for(var l=b.length,m=1;l>m;m++){h=b[m],h.key===a&&(f=!0);var n=Gb(h);if(n){if(void 0!==i.index&&!Hb(n,i.index+1))return;if(n!==i.next){if(!i.lastInSequence||!n.firstInSequence)return void wb();var o=E(n);if(o!==$c)G(i,n,o);else{var q=D(i);if(q===Zc)return void wb();F(n,q,i)}H(i)}else i.lastInSequence&&H(i)}else{if(!i.lastInSequence)return void wb();n=Q(i,bd),Ib(n,h)}i=n}if(f||(cd[a]=!0),!v(d)&&!$c.firstInSequence){var r=$c.prev.index;void 0!==r&&(d=r+1)}if(v(d)||d===p.unknown){if(v(Yc)){if(d!==Yc)return void wb()}else Yc=d;v(Yc)&&!bd[Yc]&&L($c,Yc,bd)}gd?fd=!0:Fb(a)}function Lb(a,b,c){switch(c.name){case q.noResponse:Na(o.failure);break;case q.doesNotExist:b?(L($c,0,bd),Yc=0,Ub()):(cd[a]=!0,gd?fd=!0:Fb(a))}}function Mb(a){return a===Zc?Kc:a===$c?Lc:Oc[a.key]}function Nb(a){return a===Kc?Zc:a===Lc?$c:ad[a.key]}function Ob(a){H(a),a.next.mergedForRefresh=!0}function Pb(a,b){K(b,a.key),b.itemNew=a.item}function Qb(a,b,c){var d=A();Pb(a,d),J(d,b,c,!c);var e=a.index;return+e!==e&&(e=c?d.prev.index+1:b.next.index-1),L(d,e,Pc),d}function Rb(a,b,c){a?(fb(a,b,a.bindingMap),hb(a,b,c.item)):(Pb(c,b),b.indexRequested&&db(b))}function Sb(a,b,c){return b.key?!1:(a?(c.mergeWithPrev=!b.firstInSequence,c.mergeWithNext=!b.lastInSequence):c.stationary=!0,Rb(a,b,c),!0)}function Tb(a){var b;if(a.indexRequested)b=a.index;else{var c=Nb(a);c&&(b=c.index)}return b}function Ub(){md=0,nd=new Array(100),od=-1,Ac=!0,_c={};var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s=[],t=[];for(o=0,h=Zc;h;h=h.next)h.sequenceNumber=o,h.firstInSequence&&(j=h),h.lastInSequence&&(t[o]={first:j,last:h,matchingItems:0},o++);for(Rc=null,Qc=0,c=Kc.next;c!==Mc;)h=ad[c.key],e=c.next,c!==Lc&&(ba(c)?c.key&&!h?sa(c,!1):0===Yc||c.indexRequested&&c.index>=Yc?sa(c,!0):c.item||c.keyRequested?c.itemNew=h.item:c.key&&(c.keyRequested||(delete Oc[c.key],delete c.key),c.itemNew=null):ca(c)),c=e;for(c=Kc.next;c!==Lc;)e=c.next,c.indexRequested&&(h=bd[c.index],h&&Rb(Mb(h),c,h)),c=e;var u,v,w,x,y,z=0,A=[];for(k=0,c=Kc;c!==Mc;c=c.next){if(c.firstInSequence)for(j=c,w=null,a=0;o>a;a++)A[a]=0;if(c.indexRequested&&(w=c),h=Nb(c),h&&A[h.sequenceNumber]++,c.lastInSequence){for(v=0,a=z;o>a;a++)v<A[a]&&(v=A[a],u=a);l={first:j,last:c,sequenceNew:v>0?t[u]:void 0,matchingItems:v},w&&(l.indexRequested=!0,l.stationarySlot=w),s[k]=l,c===Lc&&(x=k,y=l),k++,void 0!==t[u].first.index&&(z=u)}}s[0].sequenceNew!==t[0]&&(I(Kc),s[0].first=Kc.next,s.unshift({first:Kc,last:Kc,sequenceNew:t[0],matchingItems:1}),x++,k++);var B=!Lc.firstInSequence;for(y.sequenceNew!==t[o-1]&&(I(Lc.prev),y.last=Lc.prev,x++,s.splice(x,0,{first:Lc,last:Lc,sequenceNew:t[o-1],matchingItems:1}),k++,y=s[x]),a=0;k>a;a++)p=s[a].sequenceNew,p&&p.matchingItems<s[a].matchingItems&&(p.matchingItems=s[a].matchingItems,p.sequenceOld=s[a]);for(t[o-1].sequenceOld=y,y.stationarySlot=Lc,t[0].sequenceOld=s[0],s[0].stationarySlot=Kc,a=0;x>=a;a++)l=s[a],l.sequenceNew&&(n=l.sequenceNew.sequenceOld)===m&&m.last!==Lc?(Ob(n.last),n.last=l.last,delete s[a]):m=l;for(m=null,a=x;a>=0;a--)l=s[a],l&&(l.sequenceNew&&(n=l.sequenceNew.sequenceOld)===m&&l.last!==Lc?(Ob(l.last),n.first=l.first,delete s[a]):m=l);B&&delete Lc.mergedForRefresh;var C=[];for(a=x+1;k>a;a++)if(l=s[a],l&&(!l.sequenceNew||l.sequenceNew.sequenceOld!==l)){var D=!0,E=null,J=null,K=0;for(h=Nb(l.first),h&&(E=J=h,K=1),c=l.first;c!==l.last;c=c.next){var L=Nb(c.next);if(h&&L&&(h.lastInSequence||h.next!==L)){D=!1;break}h&&!E&&(E=J=h),L&&E&&(J=L,K++),h=L}if(D&&E&&void 0!==E.index){var M;E.firstInSequence||(f=Mb(E.prev),f&&(M=f.index));var N;if(J.lastInSequence||(g=Mb(J.next),g&&(N=g.index)),(!g||g.lastInSequence||g.mergedForRefresh)&&(void 0===M||void 0===N||N-M-1>=K)){for(l.locationJustDetermined=!0,h=E;h.locationJustDetermined=!0,h!==J;h=h.next);var j=Mb(E),O=Mb(J);C.push({slotBeforeSequence:j.firstInSequence?null:j.prev,slotFirstInSequence:j,slotLastInSequence:O,slotAfterSequence:O.lastInSequence?null:O.next})}}}for(a=0;k>a;a++)if(l=s[a],l&&!l.indexRequested&&!l.locationJustDetermined&&(!l.sequenceNew||l.sequenceNew.sequenceOld!==l)){l.sequenceNew=null,c=l.first;var P;do{if(P=c===l.last,e=c.next,c!==Kc&&c!==Lc&&c!==Mc&&!c.item&&!c.keyRequested)if(sa(c,!0),l.first===c){if(l.last===c){delete s[a];break}l.first=c.next}else l.last===c&&(l.last=c.prev);c=e}while(!P)}for(a=0;o>a;a++){for(p=t[a],h=p.first;!Mb(h)&&!h.lastInSequence;h=h.next);if(h.lastInSequence&&!Mb(h))p.firstInner=p.lastInner=null;else{for(p.firstInner=h,h=p.last;!Mb(h);h=h.prev);p.lastInner=h}}for(a=0;o>a;a++)if(p=t[a],p&&p.firstInner&&(l=p.sequenceOld)){var Q=0;for(c=l.first;!0&&(h=Nb(c),h&&h.sequenceNumber===p.firstInner.sequenceNumber&&(h.ordinal=Q),!c.lastInSequence);c=c.next,Q++);var R=[];for(h=p.firstInner;!0;h=h.next){if(Q=h.ordinal,void 0!==Q){for(var S=0,T=R.length-1;T>=S;){var U=Math.floor(.5*(S+T));R[U].ordinal<Q?S=U+1:T=U-1}R[S]=h,S>0&&(h.predecessor=R[S-1])}if(h===p.lastInner)break}var W=[],X=R.length;for(h=R[X-1],b=X;b--;)h.stationary=!0,W[b]=h,h=h.predecessor;l.stationarySlot=Mb(W[0]),h=W[0],c=Mb(h),d=c.prev;for(var Y=c.firstInSequence;!h.firstInSequence;)if(h=h.prev,i=Mb(h),!i||h.locationJustDetermined)for(;!Y&&d!==Kc&&(c=d,d=c.prev,Y=c.firstInSequence,!Sb(i,c,h)););for(b=0;X-1>b;b++){h=W[b],c=Mb(h);var i,Z=W[b+1],_=null,aa=Mb(Z);for(e=c.next,h=h.next;h!==Z&&!_&&c!==aa;h=h.next)if(i=Mb(h),!i||h.locationJustDetermined)for(;e!==aa;){if(e.mergedForRefresh){_=h.prev;break}if(c=e,e=c.next,Sb(i,c,h))break}if(_)for(d=aa.prev,h=Z.prev;h!==_&&aa!==c;h=h.prev)if(i=Mb(h),!i||h.locationJustDetermined)for(;d!==c&&(aa=d,d=aa.prev,!Sb(i,aa,h)););for(;e!==aa;)c=e,e=c.next,c!==Kc&&V(c)&&!c.keyRequested&&sa(c)}for(h=W[X-1],c=Mb(h),e=c.next,Y=c.lastInSequence;!h.lastInSequence;)if(h=h.next,i=Mb(h),!i||h.locationJustDetermined)for(;!Y&&e!==Lc&&(c=e,e=c.next,Y=c.lastInSequence,!Sb(i,c,h)););}for(a=0;o>a;a++)if(p=t[a],p.firstInner)for(d=null,h=p.firstInner;!0;h=h.next){if(c=Mb(h)){if(!h.stationary){var da,ea=!1,fa=!1;if(d)da=d.next,ea=!0;else{var ga;for(ga=p.firstInner;!ga.stationary&&ga!==p.lastInner;ga=ga.next);if(ga.stationary)da=Mb(ga),fa=!0;else if(q=h.index,0===q)da=Kc.next,ea=!0;else if(void 0===q)da=Mc;else{da=Kc.next;for(var ha=null;;){if(da.firstInSequence&&(ha=da),q<da.index&&ha||da===Lc)break;da=da.next}!da.firstInSequence&&ha&&(da=ha)}}c.mergedForRefresh&&(delete c.mergedForRefresh,c.lastInSequence||(c.next.mergedForRefresh=!0)),ea=ea||h.mergeWithPrev,fa=fa||h.mergeWithNext;var ja=h.locationJustDetermined;ra(c,da,ea,fa,ja),ja&&fa&&(da.mergedForRefresh=!0)}d=c}if(h===p.lastInner)break}for(a=0;o>a;a++)if(p=t[a],p.firstInner)for(d=null,h=p.firstInner;!0;h=h.next){if(c=Mb(h),!c){var ka;if(d)ka=d.next;else{var ma;for(ma=p.firstInner;!Mb(ma);ma=ma.next);ka=Mb(ma)}c=Qb(h,ka,!!d);var L=Nb(ka);ka.mergedForRefresh||L&&L.locationJustDetermined||($(c),pa(c))}if(d=c,h===p.lastInner)break}Pc=[];var oa=-1;for(c=Kc,r=0;c!==Mc;r++){var e=c.next;if(c.firstInSequence&&(j=c,r=0),void 0===oa){var qa=Tb(c);void 0!==qa&&(oa=qa-r)}if(void 0!==oa&&!c.lastInSequence){var ta=Tb(c.next);if(void 0!==ta&&ta!==oa+r+1){I(c);for(var ua=!0,va=c.next,wa=!1;!wa&&va!==Lc;){var xa=va.next;wa=va.lastInSequence,ra(va,xa,!ua,!1),ua=!1,va=xa}}}if(c.lastInSequence){q=oa;for(var ya=j;ya!==e;){var za=ya.next;if(q>=Yc&&ya!==Lc)sa(ya,!0);else{var Aa=Pc[q];q!==ya.index?(delete Pc[q],na(ya,q)):+q===q&&Pc[q]!==ya&&(Pc[q]=ya),ya.itemNew&&db(ya),Aa&&(ya.key?(fb(ya,Aa,ya.bindingMap),gb(ya,Aa),+q===q&&(Pc[q]=ya)):(fb(Aa,ya,Aa.bindingMap),gb(Aa,ya),+q===q&&(Pc[q]=Aa))),+q===q&&q++}ya=za}oa=void 0}c=e}var Ba,Da=-2;for(c=Kc,r=0;c!==Mc;r++){var e=c.next;if(c.firstInSequence&&(j=c,r=0),delete c.mergedForRefresh,c.lastInSequence)if(void 0===j.index){f=j.prev;var Ea;f&&(Ea=Nb(f))&&!Ea.lastInSequence&&(h=Nb(c))&&h.prev===Ea?(G(f,j,c),H(f)):c===Lc||Ba||F(Mc,j,c)}else{if(Da<c.index&&!Ba)Da=c.index;else{for(g=Kc.next;g.index<c.index;g=g.next);for(var va=j;va!==e;){var xa=va.next;h=Nb(va),ra(va,g,g.prev.index===va.index-1,g.index===va.index+1,h&&h.locationJustDetermined),va=xa}}f=j.prev,f&&f.index===j.index-1&&H(f)}c===Lc&&(Ba=!0),c=e}Ac=!1,ob(C),void 0!==Yc&&Yc!==Jc&&la(Yc),ia();var Fa=[];for(a=0;o>a;a++){p=t[a];var Ga=[];c=null,r=0;var Ha;for(h=p.first;!0&&(h===Zc?Ga.push(Hc):h===$c?Ga.push(Ic):(Ga.push(h.item),c||(c=Mb(h),Ha=r)),!h.lastInSequence);h=h.next,r++);c&&Fa.push({slot:c,results:Ga,offset:Ha})}for(vb(),Uc=!1,Ca(),a=0;a<Fa.length;a++){var Ia=Fa[a];qb(Ia.slot,Ia.results,Ia.offset,Jc,Ia.slot.index)}if(Vc){var Ja=Vc;Vc=null,Ja.complete()}ab()}function Vb(a,b,c,d,e,f,g){var h=uc.prev,i={prev:h,next:uc,applyEdit:a,editType:b,complete:c,error:d,keyUpdate:e};h.next=i,uc.prev=i,vc=!0,(Tc||Uc)&&(Cc++,Uc=!1,Tc=!0),uc.next===i&&Zb(),i.failed||(f(),i.undo=g),
sc||$b()}function Wb(){tc=!1;var a=uc.next.next;uc.next=a,a.prev=uc}function Xb(){for(;uc.prev!==uc;){var a=uc.prev;a.error&&a.error(new e(r.canceled)),a.undo&&!Tc&&a.undo(),uc.prev=a.prev}uc.next=uc,sc=!1,$b()}function Yb(b){function c(){xc||(f?wc=!0:Zb())}function d(a){if(a){var d;if(g&&g.key!==a.key){var e=a.key;if(b.undo){if(d=g.slot){var h=d.key;h&&delete Oc[h],K(d,e),d.itemNew=a,d.item?(qa(d),ia()):Ba(d)}}else g.key=e}else b.editType===rd.change&&(d.itemNew=a,f||cb(d))}Wb(),b.complete&&b.complete(a),c()}function e(a){switch(a.Name){case r.noResponse:return Na(o.failure),xc=!0,void(tc=!1);case r.notPermitted:break;case r.noLongerMeaningful:wb()}b.failed=!0,Wb(),Xb(),b.error&&b.error(a),c()}if(!tc){var f=!0,g=b.keyUpdate;a.beginEdits&&!rc&&(rc=!0,a.beginEdits()),tc=!0,b.applyEdit().then(d,e),f=!1}}function Zb(){for(;uc.next!==uc;)if(wc=!1,Yb(uc.next),!wc)return;_b()}function $b(){ya(),ia(),Ca(),uc.next===uc&&_b()}function _b(){vc=!1,a.endEdits&&rc&&!sc&&(rc=!1,a.endEdits()),Tc?(Tc=!1,wb()):ab()}function ac(a){return Ia(a),Oc[a]||Ja(a)}function bc(a,b,c,d,e){var f=A();return J(f,c,d,e),a&&K(f,a),f.itemNew=b,wa(f,1),sc||yc||(f.firstInSequence||"number"!=typeof f.prev.index?f.lastInSequence||"number"!=typeof f.next.index||L(f,f.next.index-1,Pc):L(f,f.prev.index+1,Pc)),$(f),pa(f),f}function cc(a,b,c,d,e){var f={key:a};return new j(function(a,g){Vb(e,rd.insert,a,g,f,function(){if(c){var a={key:f.key,data:b};f.slot=bc(f.key,a,c,d,!d)}},function(){var a=f.slot;a&&(wa(a,-1),sa(a,!1))})})}function dc(a,b,c,d){return new j(function(e,f){var g,h,i,j;Vb(d,rd.move,e,f,null,function(){h=a.next,i=a.firstInSequence,j=a.lastInSequence;var d=a.prev;g="number"!=typeof a.index&&(i||!d.item)&&(j||!h.item),wa(a,-1),ra(a,b,c,!c),wa(a,1),g&&(I(d),i||mb(d,a),j||nb(h,a))},function(){g?wb():(wa(a,-1),ra(a,h,!i,!j),wa(a,1))})})}function ec(){function a(){yc||(ya(),ia(),Ca())}this.invalidateAll=function(){return 0===Jc?(this.reload(),j.wrap()):xb()},this.reload=function(){pc&&pc.cancel(),Vc&&Vc.cancel();for(var a=Kc.next;a!==Mc;a=a.next){var b=a.fetchListeners;for(var c in b)b[c].promise.cancel();var d=a.directFetchListeners;for(var c in d)d[c].promise.cancel()}fc(),fa(function(a){a.notificationHandler&&a.notificationHandler.reload()})},this.beginNotifications=function(){yc=!0},this.inserted=function(b,c,d,e){if(vc)wb();else{var f=b.key,g=Oc[c],h=Oc[d],i="string"==typeof c,j="string"==typeof d;if(i?h&&!h.firstInSequence&&(g=h.prev):j&&g&&!g.lastInSequence&&(h=g.next),(i||j)&&!g&&!h&&Kc.next===Lc)return void wb();if(Oc[f])return void wb();if(g&&h&&(g.next!==h||g.lastInSequence||h.firstInSequence))return void wb();if(g&&(g.keyRequested||g.indexRequested)||h&&(h.keyRequested||h.indexRequested))return void wb();if(g||h)bc(f,b,h?h:g.next,!!g,!!h);else if(Kc.next===Lc)bc(f,b,Kc.next,!0,!0);else{if(void 0===e)return void wb();xa(e,1)}a()}},this.changed=function(b){if(vc)wb();else{var c=b.key,d=Oc[c];d&&(d.keyRequested?wb():(d.itemNew=b,d.item&&(qa(d),a())))}},this.moved=function(b,c,d,e,f){if(vc)wb();else{var g=b.key,h=Oc[g],i=Oc[c],j=Oc[d];h&&h.keyRequested||i&&i.keyRequested||j&&j.keyRequested?wb():h?i&&j&&(i.next!==j||i.lastInSequence||j.firstInSequence)?wb():i||j?(wa(h,-1),ra(h,j?j:i.next,!!i,!!j),wa(h,1),a()):(wa(h,-1),sa(h,!1),void 0!==e&&(f>e&&f--,xa(f,1)),a()):i||j?(void 0!==e&&(xa(e,-1),f>e&&f--),this.inserted(b,c,d,f)):void 0!==e&&(xa(e,-1),f>e&&f--,xa(f,1),a())}},this.removed=function(b,c){if(vc)wb();else{var d;d="string"==typeof b?Oc[b]:Pc[c],d?d.keyRequested?wb():(wa(d,-1),sa(d,!1),a()):void 0!==c&&(xa(c,-1),a())}},this.endNotifications=function(){yc=!1,a()}}function fc(){Na(o.ready),pc=null,rc=!1,sc=!1,tc=!1,uc={},uc.next=uc,uc.prev=uc,vc=!1,xc=!1,zc=0,Ac=!1,Bc=0,Fc={},Gc=[],Jc=p.unknown,Kc={firstInSequence:!0,lastInSequence:!0,index:-1},Lc={firstInSequence:!0,lastInSequence:!0},Mc={firstInSequence:!0,lastInSequence:!0},Kc.next=Lc,Lc.prev=Kc,Lc.next=Mc,Mc.prev=Lc,Nc={},Oc={},Pc={},Pc[-1]=Kc,Qc=0,Rc=null,Sc=!1,Tc=!1,Uc=!1,Vc=null}var gc,hc,ic,jc,kc,lc,mc,nc,oc,pc,qc,rc,sc,tc,uc,vc,wc,xc,yc,zc,Ac,Bc,Cc,Dc,Ec,Fc,Gc,Hc,Ic,Jc,Kc,Lc,Mc,Nc,Oc,Pc,Qc,Rc,Sc,Tc,Uc,Vc,Wc,Xc,Yc,Zc,$c,_c,ad,bd,cd,dd,ed,fd,gd,hd,id,jd,kd,ld,md=0,nd=new Array(100),od=-1;a.itemsFromKey&&(hd=function(b,c,d,e,g){var h="fetchItemsFromKey id="+b+" key="+c+" countBefore="+d+" countAfter="+e;f(h),nd[++od%nd.length]={kind:"itemsFromKey",key:c,countBefore:d,countAfter:e};var i=a.itemsFromKey(c,d,e,g);return u(h),i}),a.itemsFromIndex&&(id=function(b,c,d,e){var g="fetchItemsFromIndex id="+b+" index="+c+" countBefore="+d+" countAfter="+e;f(g),nd[++od%nd.length]={kind:"itemsFromIndex",index:c,countBefore:d,countAfter:e};var h=a.itemsFromIndex(c,d,e);return u(g),h}),a.itemsFromStart&&(jd=function(b,c){var d="fetchItemsFromStart id="+b+" count="+c;f(d),nd[++od%nd.length]={kind:"itemsFromStart",count:c};var e=a.itemsFromStart(c);return u(d),e}),a.itemsFromEnd&&(kd=function(b,c){var d="fetchItemsFromEnd id="+b+" count="+c;f(d),nd[++od%nd.length]={kind:"itemsFromEnd",count:c};var e=a.itemsFromEnd(c);return u(d),e}),a.itemsFromDescription&&(ld=function(b,c,d,e){var g="fetchItemsFromDescription id="+b+" desc="+c+" countBefore="+d+" countAfter="+e;f(g),nd[++od%nd.length]={kind:"itemsFromDescription",description:c,countBefore:d,countAfter:e};var h=a.itemsFromDescription(c,d,e);return u(g),h});var pd=++n,qd=this,rd={insert:"insert",change:"change",move:"move",remove:"remove"};if(!a)throw new e("WinJS.UI.ListDataSource.ListDataAdapterIsInvalid",s.listDataAdapterIsInvalid);hc=a.compareByIdentity?0:200,c&&"number"==typeof c.cacheSize&&(hc=c.cacheSize),a.setNotificationHandler&&(gc=new ec,a.setNotificationHandler(gc)),ic=o.ready,kc=!1,lc={},mc=0,nc=1,oc=0,Cc=0,Dc=!1,Ec=1,Hc={},Ic={},fc(),this.createListBinding=function(a){function b(a){a&&a.cursorCount++}function c(a){a&&0===--a.cursorCount&&ea(a)}function d(a){b(a),c(m),m=a}function e(a,b){a===m&&(b||(b=!m||m.lastInSequence||m.next===Lc?null:m.next),d(b))}function f(a){var b=a.bindingMap,c=b[l].handle;delete a.bindingMap[l];var d=!0,e=!0;for(var f in b)if(d=!1,c&&b[f].handle===c){e=!1;break}c&&e&&delete Nc[c],d&&(a.bindingMap=null,ea(a))}function g(a,b){a.bindingMap||(a.bindingMap={});var c=a.bindingMap[l];if(c?c.count++:a.bindingMap[l]={bindingRecord:lc[l],count:1},a.fetchListeners){var d=a.fetchListeners[b];d&&(d.retained=!0)}}function h(a){var b=Nc[a];if(b){var c=b.bindingMap[l];if(0===--c.count){var d=b.fetchListeners;for(var e in d){var g=d[e];g.listBindingID===l&&(g.retained=!1)}f(b)}}}function i(b){var c=ja(b,l),d=(oc++).toString(),e=za(b,"fetchListeners",d,l,function(a,b){a(ka(b,c))});return X(e,b,c),a&&(e.retain=function(){return o._retainItem(b,d),e},e.release=function(){o._releaseItem(c)}),e}function k(b){var c;return!n&&b?c=i(b):(n?(c=new j(function(){}),c.cancel()):c=j.wrap(null),W(c,null),a&&(c.retain=function(){return c},c.release=function(){})),d(b),c}var l=(mc++).toString(),m=null,n=!1;lc[l]={notificationHandler:a,notificationsSent:!1,adjustCurrentSlot:e,itemPromiseFromKnownSlot:i};var o={_retainItem:function(a,b){g(a,b)},_releaseItem:function(a){h(a)},jumpToItem:function(a){return k(a?Nc[a.handle]:null)},current:function(){return k(m)},previous:function(){return k(m?Fa(m):null)},next:function(){return k(m?Ga(m):null)},releaseItem:function(a){this._releaseItem(a.handle)},release:function(){n=!0,c(m),m=null;for(var a=Kc.next;a!==Mc;){var b=a.next,d=a.fetchListeners;for(var e in d){var g=d[e];g.listBindingID===l&&(g.promise.cancel(),delete d[e])}a.bindingMap&&a.bindingMap[l]&&f(a),a=b}delete lc[l]}};return(jd||id)&&(o.first=function(){return k(Ga(Kc))}),kd&&(o.last=function(){return k(Fa(Lc))}),hd&&(o.fromKey=function(a,b){return k(Ka(a,b))}),(id||jd&&hd)&&(o.fromIndex=function(a){return k(La(a))}),ld&&(o.fromDescription=function(a){return k(Ma(a))}),o},this.invalidateAll=function(){return xb()};var sd=function(a,b){var c=new l;a.then(function(a){c.complete(a)},function(a){c.error(a)});var d=c.promise.then(null,function(c){return"WinJS.UI.VirtualizedDataSource.resetCount"===c.name?(pc=null,a=b.getCount()):j.wrapError(c)}),f=0,g={get:function(){return f++,new j(function(a,b){d.then(a,b)},function(){0===--f&&(c.promise.cancel(),a.cancel(),g===pc&&(pc=null))})},reset:function(){c.error(new e("WinJS.UI.VirtualizedDataSource.resetCount"))},cancel:function(){c.promise.cancel(),a.cancel(),g===pc&&(pc=null)}};return g};this.getCount=function(){if(a.getCount){var b=this;return j.wrap().then(function(){if(sc||vc)return Jc;var c;if(!pc){var d;c=a.getCount();var e;c.then(function(){pc===d&&(pc=null),e=!0},function(){pc===d&&(pc=null),e=!0}),zc=0,e||(d=pc=sd(c,b))}return pc?pc.get():c}).then(function(a){if(!w(a)&&void 0!==a)throw new e("WinJS.UI.ListDataSource.InvalidRequestedCountReturned",s.invalidRequestedCountReturned);return a!==Jc&&(Jc===p.unknown?Jc=a:(la(a),ia())),0===a&&(Kc.next!==Lc||Lc.next!==Mc?wb():Kc.lastInSequence&&(H(Kc),Lc.index=0)),a}).then(null,function(a){return a.name===m.CountError.noResponse?(Na(o.failure),Jc):j.wrapError(a)})}return j.wrap(Jc)},hd&&(this.itemFromKey=function(a,b){return Ha(Ka(a,b))}),(id||jd&&hd)&&(this.itemFromIndex=function(a){return Ha(La(a))}),ld&&(this.itemFromDescription=function(a){return Ha(Ma(a))}),this.beginEdits=function(){sc=!0},a.insertAtStart&&(this.insertAtStart=function(b,c){return cc(b,c,Kc.lastInSequence?null:Kc.next,!0,function(){return a.insertAtStart(b,c)})}),a.insertBefore&&(this.insertBefore=function(b,c,d){var e=ac(d);return cc(b,c,e,!1,function(){return a.insertBefore(b,c,d,ua(e))})}),a.insertAfter&&(this.insertAfter=function(b,c,d){var e=ac(d);return cc(b,c,e?e.next:null,!0,function(){return a.insertAfter(b,c,d,ua(e))})}),a.insertAtEnd&&(this.insertAtEnd=function(b,c){return cc(b,c,Lc.firstInSequence?null:Lc,!1,function(){return a.insertAtEnd(b,c)})}),a.change&&(this.change=function(b,c){var d=ac(b);return new j(function(e,f){var g;Vb(function(){return a.change(b,c,ua(d))},rd.change,e,f,null,function(){g=d.item,d.itemNew={key:b,data:c},g?qa(d):Ba(d)},function(){g?(d.itemNew=g,qa(d)):wb()})})}),a.moveToStart&&(this.moveToStart=function(b){var c=ac(b);return dc(c,Kc.next,!0,function(){return a.moveToStart(b,ua(c))})}),a.moveBefore&&(this.moveBefore=function(b,c){var d=ac(b),e=ac(c);return dc(d,e,!1,function(){return a.moveBefore(b,c,ua(d),ua(e))})}),a.moveAfter&&(this.moveAfter=function(b,c){var d=ac(b),e=ac(c);return dc(d,e.next,!0,function(){return a.moveAfter(b,c,ua(d),ua(e))})}),a.moveToEnd&&(this.moveToEnd=function(b){var c=ac(b);return dc(c,Lc,!1,function(){return a.moveToEnd(b,ua(c))})}),a.remove&&(this.remove=function(b){Ia(b);var c=Oc[b];return new j(function(d,e){var f,g,h;Vb(function(){return a.remove(b,ua(c))},rd.remove,d,e,null,function(){c&&(f=c.next,g=c.firstInSequence,h=c.lastInSequence,wa(c,-1),sa(c,!1))},function(){c&&(R(c,f,!g,!h),wa(c,1),pa(c))})})}),this.endEdits=function(){sc=!1,$b()}}var h=100,n=1,o=m.DataSourceStatus,p=m.CountResult,q=m.FetchError,r=m.EditError,s={get listDataAdapterIsInvalid(){return"Invalid argument: listDataAdapter must be an object or an array."},get indexIsInvalid(){return"Invalid argument: index must be a non-negative integer."},get keyIsInvalid(){return"Invalid argument: key must be a string."},get invalidItemReturned(){return"Error: data adapter returned item that is not an object."},get invalidKeyReturned(){return"Error: data adapter returned item with undefined or null key."},get invalidIndexReturned(){return"Error: data adapter should return undefined, null or a non-negative integer for the index."},get invalidCountReturned(){return"Error: data adapter should return undefined, null, CountResult.unknown, or a non-negative integer for the count."},get invalidRequestedCountReturned(){return"Error: data adapter should return CountResult.unknown, CountResult.failure, or a non-negative integer for the count."},get refreshCycleIdentified(){return"refresh cycle found, likely data inconsistency"}},t="statuschanged",u=c.Class.define(function(){},{_baseDataSourceConstructor:a,_isVirtualizedDataSource:!0},{supportedForProcessing:!1});return c.Class.mix(u,f.eventMixin),u})})}),d("WinJS/VirtualizedDataSource/_GroupDataSource",["exports","../Core/_Base","../Core/_ErrorFromName","../Promise","../Scheduler","../Utilities/_UI","./_VirtualizedDataSourceImpl"],function(a,b,c,d,e,f,g){"use strict";b.Namespace._moduleDefine(a,"WinJS.UI",{_GroupDataSource:b.Namespace._lazy(function(){function a(){return new c(f.FetchError.doesNotExist)}function h(a){return a&&a.firstReached&&a.lastReached}var i=101,j=b.Class.define(function(a){this._groupDataAdapter=a},{beginNotifications:function(){},inserted:function(a,b,c){this._groupDataAdapter._inserted(a,b,c)},changed:function(a,b){this._groupDataAdapter._changed(a,b)},moved:function(a,b,c){this._groupDataAdapter._moved(a,b,c)},removed:function(a,b){this._groupDataAdapter._removed(a,b)},countChanged:function(a,b){0===a&&0!==b&&this._groupDataAdapter.invalidateGroups()},indexChanged:function(a,b,c){this._groupDataAdapter._indexChanged(a,b,c)},endNotifications:function(){this._groupDataAdapter._endNotifications()},reload:function(){this._groupDataAdapter._reload()}},{supportedForProcessing:!1}),k=b.Class.define(function(a,b,c,d){this._listBinding=a.createListBinding(new j(this)),this._groupKey=b,this._groupData=c,this._initializeState(),this._batchSize=i,this._count=null,d&&("number"==typeof d.groupCountEstimate&&(this._count=d.groupCountEstimate<0?null:Math.max(d.groupCountEstimate,1)),"number"==typeof d.batchSize&&(this._batchSize=d.batchSize+1)),this._listBinding.last&&(this.itemsFromEnd=function(a){var b=this;return this._fetchItems(function(){return b._lastGroup},function(a){if(a)return!1;var c=b._count;return+c!==c?!0:c>0?!0:void 0},function(){b._fetchBatch(b._listBinding.last(),b._batchSize-1,0)},a-1,0)})},{setNotificationHandler:function(a){this._listDataNotificationHandler=a},compareByIdentity:!0,itemsFromKey:function(a,b,c,d){var e=this;return this._fetchItems(function(){return e._keyMap[a]},function(){var a=e._lastGroup;return a?+a.index!==a.index?!0:void 0:!0},function(){d=d||{};var a="string"==typeof d.groupMemberKey&&e._listBinding.fromKey?e._listBinding.fromKey(d.groupMemberKey):"number"==typeof d.groupMemberIndex&&e._listBinding.fromIndex?e._listBinding.fromIndex(d.groupMemberIndex):void 0!==d.groupMemberDescription&&e._listBinding.fromDescription?e._listBinding.fromDescription(d.groupMemberDescription):e._listBinding.first(),b=Math.floor(.5*(e._batchSize-1));e._fetchBatch(a,b,e._batchSize-1-b)},b,c)},itemsFromIndex:function(a,b,c){var d=this;return this._fetchItems(function(){return d._indexMap[a]},function(){var b=d._lastGroup;return b?+b.index!==b.index?!0:a<=b.index?!0:void 0:!0},function(){d._fetchNextIndex()},b,c)},getCount:function(){if(this._lastGroup&&"number"==typeof this._lastGroup.index)return d.wrap(this._count);var a=this,b=new d(function(b){var c={initialBatch:function(){a._fetchNextIndex()},getGroup:function(){return null},countBefore:0,countAfter:0,complete:function(c){c&&(a._count=0);var d=a._count;return"number"==typeof d?(b(d),!0):!1}};a._fetchQueue.push(c),a._itemBatch||a._continueFetch(c)});return"number"==typeof this._count?d.wrap(this._count):b},invalidateGroups:function(){this._beginRefresh(),this._initializeState()},_initializeState:function(){this._count=null,this._indexMax=null,this._keyMap={},this._indexMap={},this._lastGroup=null,this._handleMap={},this._fetchQueue=[],this._itemBatch=null,this._itemsToFetch=0,this._indicesChanged=!1},_releaseItem:function(a){delete this._handleMap[a.handle],this._listBinding.releaseItem(a)},_processBatch:function(){for(var a=null,b=null,c=null,d=0,f=!0,g=0;g<this._batchSize;g++){var h=this._itemBatch[g],i=h?this._groupKey(h):null;if(h&&(f=!1),b&&null!==i&&i===b.key)d++,b.lastItem===a?(b.lastItem.handle!==b.firstItem.handle&&this._releaseItem(b.lastItem),b.lastItem=h,this._handleMap[h.handle]=b,b.size++):b.firstItem===h&&(b.firstItem.handle!==b.lastItem.handle&&this._releaseItem(b.firstItem),b.firstItem=c,this._handleMap[c.handle]=b,b.size+=d);else{var j=null;if(b&&(b.lastReached=!0,"number"==typeof b.index&&(j=b.index+1)),h){var k=this._keyMap[i];if(k||(k={key:i,data:this._groupData(h),firstItem:h,lastItem:h,size:1},this._keyMap[k.key]=k,this._handleMap[h.handle]=k),g>0&&(k.firstReached=!0,b||(j=0)),"number"!=typeof k.index&&"number"==typeof j){for(var l=k;l;l=this._nextGroup(l))l.index=j,this._indexMap[j]=l,j++;this._indexMax=j,"number"==typeof this._count&&!this._lastGroup&&this._count<=this._indexMax&&(this._count=this._indexMax+1)}c=h,d=0,b=k}else b&&(this._lastGroup=b,"number"==typeof b.index&&(this._count=b.index+1),this._listDataNotificationHandler.invalidateAll(),b=null)}a=h}var m;for(m=this._fetchQueue[0];m&&m.complete(f);m=this._fetchQueue[0])this._fetchQueue.splice(0,1);if(m){var n=this;e.schedule(function(){n._continueFetch(m)},e.Priority.normal,null,"WinJS.UI._GroupDataSource._continueFetch")}else this._itemBatch=null},_processPromise:function(a,b){a.retain(),this._itemBatch[b]=a;var c=this;a.then(function(a){c._itemBatch[b]=a,0===--c._itemsToFetch&&c._processBatch()})},_fetchBatch:function(a,b){this._itemBatch=new Array(this._batchSize),this._itemsToFetch=this._batchSize,this._processPromise(a,b);var c;for(this._listBinding.jumpToItem(a),c=b-1;c>=0;c--)this._processPromise(this._listBinding.previous(),c);for(this._listBinding.jumpToItem(a),c=b+1;c<this._batchSize;c++)this._processPromise(this._listBinding.next(),c)},_fetchAdjacent:function(a,b){this._fetchBatch(this._listBinding.fromKey?this._listBinding.fromKey(a.key):this._listBinding.fromIndex(a.index),b?0:this._batchSize-1,b?this._batchSize-1:0)},_fetchNextIndex:function(){var a=this._indexMap[this._indexMax-1];a?this._fetchAdjacent(a.lastItem,!0):this._fetchBatch(this._listBinding.first(),1,this._batchSize-2)},_continueFetch:function(a){if(a.initialBatch)a.initialBatch(),a.initialBatch=null;else{var b=a.getGroup();if(b){var c,d;b.firstReached?b.lastReached?a.countBefore>0&&0!==b.index&&!h(c=this._previousGroup(b))?this._fetchAdjacent(c&&c.lastReached?c.firstItem:b.firstItem,!1):(d=this._nextGroup(b),this._fetchAdjacent(d&&d.firstReached?d.lastItem:b.lastItem,!0)):this._fetchAdjacent(b.lastItem,!0):this._fetchAdjacent(b.firstItem,!1)}else this._fetchNextIndex()}},_fetchComplete:function(a,b,c,d,e){if(h(a)){var g=this._previousGroup(a);if(d||h(g)||0===a.index||0===b){var i=this._nextGroup(a);if(d||h(i)||this._lastGroup===a||0===c){for(var j=0,k=a;b>j&&(g=this._previousGroup(k),h(g));)k=g,j++;for(var l=0,m=a;c>l&&(i=this._nextGroup(m),h(i));)m=i,l++;for(var n=j+1+l,o=new Array(n),p=0;n>p;p++){var q={key:k.key,data:k.data,firstItemKey:k.firstItem.key,groupSize:k.size},r=k.firstItem.index;"number"==typeof r&&(q.firstItemIndexHint=r),o[p]=q,k=this._nextGroup(k)}var s={items:o,offset:j};return s.totalCount="number"==typeof this._count?this._count:f.CountResult.unknown,"number"==typeof a.index&&(s.absoluteIndex=a.index),m===this._lastGroup&&(s.atEnd=!0),e(s),!0}}}return!1},_fetchItems:function(b,c,e,f,g){var h=this;return new d(function(d,i){function j(e){var j=b();return j?h._fetchComplete(j,f,g,l,d,i):l&&!c(e)?(i(a()),!0):m>2?(i(a()),!0):(e?m++:m=0,!1)}var k=b(),l=!k,m=0;if(!j()){var n={initialBatch:l?e:null,getGroup:b,countBefore:f,countAfter:g,complete:j};h._fetchQueue.push(n),h._itemBatch||h._continueFetch(n)}})},_previousGroup:function(a){return a&&a.firstReached?(this._listBinding.jumpToItem(a.firstItem),this._handleMap[this._listBinding.previous().handle]):null},_nextGroup:function(a){return a&&a.lastReached?(this._listBinding.jumpToItem(a.lastItem),this._handleMap[this._listBinding.next().handle]):null},_invalidateIndices:function(a){this._count=null,this._lastGroup=null,"number"==typeof a.index&&(this._indexMax=a.index>0?a.index:null);for(var b=a;b&&"number"==typeof b.index;b=this._nextGroup(b))delete this._indexMap[b.index],b.index=null},_releaseGroup:function(a){this._invalidateIndices(a),delete this._keyMap[a.key],this._lastGroup===a&&(this._lastGroup=null),a.firstItem!==a.lastItem&&this._releaseItem(a.firstItem),this._releaseItem(a.lastItem)},_beginRefresh:function(){if(this._fetchQueue=[],this._itemBatch){for(var a=0;a<this._batchSize;a++){var b=this._itemBatch[a];b&&(b.cancel&&b.cancel(),this._listBinding.releaseItem(b))}this._itemBatch=null}this._itemsToFetch=0,this._listDataNotificationHandler.invalidateAll()},_processInsertion:function(a,b,c){var d=this._handleMap[b],e=this._handleMap[c],f=null;d&&(d.lastReached&&b===d.lastItem.handle&&(f=this._groupKey(a))!==d.key?this._lastGroup===d&&(this._lastGroup=null,this._count=null):this._releaseGroup(d),this._beginRefresh()),e&&e!==d&&(this._invalidateIndices(e),e.firstReached&&c===e.firstItem.handle&&(null!==f?f:this._groupKey(a))!==e.key||this._releaseGroup(e),this._beginRefresh())},_processRemoval:function(a){var b=this._handleMap[a];if(!b||a!==b.firstItem.handle&&a!==b.lastItem.handle){if(this._itemBatch)for(var c=0;c<this._batchSize;c++){var d=this._itemBatch[c];if(d&&d.handle===a){this._beginRefresh();break}}}else this._releaseGroup(b),this._beginRefresh()},_inserted:function(a,b,c){var d=this;a.then(function(a){d._processInsertion(a,b,c)})},_changed:function(a,b){var c=this._handleMap[a.handle];if(c&&a.handle===c.firstItem.handle&&(this._releaseGroup(c),this._beginRefresh()),this._groupKey(a)!==this._groupKey(b)){this._listBinding.jumpToItem(a);var d=this._listBinding.previous().handle;this._listBinding.jumpToItem(a);var e=this._listBinding.next().handle;this._processRemoval(a.handle),this._processInsertion(a,d,e)}},_moved:function(a,b,c){this._processRemoval(a.handle);var d=this;a.then(function(a){d._processInsertion(a,b,c)})},_removed:function(a,b){b||this._processRemoval(a)},_indexChanged:function(a,b,c){"number"==typeof c&&(this._indicesChanged=!0)},_endNotifications:function(){if(this._indicesChanged){this._indicesChanged=!1;for(var a in this._keyMap){var b=this._keyMap[a];if(b.firstReached&&b.lastReached){var c=b.lastItem.index+1-b.firstItem.index;isNaN(c)||(b.size=c)}}this._beginRefresh()}},_reload:function(){this._initializeState(),this._listDataNotificationHandler.reload()}},{supportedForProcessing:!1});return b.Class.derive(g.VirtualizedDataSource,function(a,b,c,d){var e=new k(a,b,c,d);this._baseDataSourceConstructor(e),this.extensions={invalidateGroups:function(){e.invalidateGroups()}}},{},{supportedForProcessing:!1})})})}),d("WinJS/VirtualizedDataSource/_GroupedItemDataSource",["../Core/_Base","./_GroupDataSource"],function(a,b){"use strict";a.Namespace.define("WinJS.UI",{computeDataSourceGroups:function(a,c,d,e){function f(a){if(a){var b=Object.create(a);return b.groupKey=c(a),d&&(b.groupData=d(a)),b}return null}function g(a){var b=Object.create(a);return b.then=function(b,c,d){return a.then(function(a){return b(f(a))},c,d)},b}var h=Object.create(a);h.createListBinding=function(b){var c;b?(c=Object.create(b),c.inserted=function(a,c,d){return b.inserted(g(a),c,d)},c.changed=function(a,c){return b.changed(f(a),f(c))},c.moved=function(a,c,d){return b.moved(g(a),c,d)}):c=null;for(var d=a.createListBinding(c),e=Object.create(d),h=["first","last","fromDescription","jumpToItem","current"],i=0,j=h.length;j>i;i++)!function(a){d[a]&&(e[a]=function(){return g(d[a].apply(d,arguments))})}(h[i]);return d.fromKey&&(e.fromKey=function(a){return g(d.fromKey(a))}),d.fromIndex&&(e.fromIndex=function(a){return g(d.fromIndex(a))}),e.prev=function(){return g(d.prev())},e.next=function(){return g(d.next())},e};for(var i=["itemFromKey","itemFromIndex","itemFromDescription","insertAtStart","insertBefore","insertAfter","insertAtEnd","change","moveToStart","moveBefore","moveAfter","moveToEnd"],j=0,k=i.length;k>j;j++)!function(b){a[b]&&(h[b]=function(){return g(a[b].apply(a,arguments))})}(i[j]);["addEventListener","removeEventListener","dispatchEvent"].forEach(function(b){a[b]&&(h[b]=function(){return a[b].apply(a,arguments)})});var l=null;return Object.defineProperty(h,"groups",{get:function(){return l||(l=new b._GroupDataSource(a,c,d,e)),l},enumerable:!0,configurable:!0}),h}})}),d("WinJS/VirtualizedDataSource/_StorageDataSource",["exports","../Core/_WinRT","../Core/_Global","../Core/_Base","../Core/_ErrorFromName","../Core/_WriteProfilerMark","../Animations","../Promise","../Utilities/_UI","./_VirtualizedDataSourceImpl"],function(a,b,c,d,e,f,g,h,i,j){"use strict";d.Namespace._moduleDefine(a,"WinJS.UI",{StorageDataSource:d.Namespace._lazy(function(){var a=d.Class.define(function(a,c){f("WinJS.UI.StorageDataSource:constructor,StartTM");var d,e=b.Windows.Storage.FileProperties.ThumbnailMode.singleItem,g=256,h=b.Windows.Storage.FileProperties.ThumbnailOptions.useCurrentScale,i=!0;if("Pictures"===a?(e=b.Windows.Storage.FileProperties.ThumbnailMode.picturesView,d=b.Windows.Storage.KnownFolders.picturesLibrary,g=190):"Music"===a?(e=b.Windows.Storage.FileProperties.ThumbnailMode.musicView,d=b.Windows.Storage.KnownFolders.musicLibrary,g=256):"Documents"===a?(e=b.Windows.Storage.FileProperties.ThumbnailMode.documentsView,d=b.Windows.Storage.KnownFolders.documentsLibrary,g=40):"Videos"===a&&(e=b.Windows.Storage.FileProperties.ThumbnailMode.videosView,d=b.Windows.Storage.KnownFolders.videosLibrary,g=190),d){var j=new b.Windows.Storage.Search.QueryOptions;j.folderDepth=b.Windows.Storage.Search.FolderDepth.deep,j.indexerOption=b.Windows.Storage.Search.IndexerOption.useIndexerWhenAvailable,this._query=d.createFileQueryWithOptions(j)}else this._query=a;if(c){if("number"==typeof c.mode&&(e=c.mode),"number"==typeof c.requestedThumbnailSize)g=Math.max(1,Math.min(c.requestedThumbnailSize,1024));else switch(e){case b.Windows.Storage.FileProperties.ThumbnailMode.picturesView:case b.Windows.Storage.FileProperties.ThumbnailMode.videosView:g=190;break;case b.Windows.Storage.FileProperties.ThumbnailMode.documentsView:case b.Windows.Storage.FileProperties.ThumbnailMode.listView:g=40;break;case b.Windows.Storage.FileProperties.ThumbnailMode.musicView:case b.Windows.Storage.FileProperties.ThumbnailMode.singleItem:g=256}"number"==typeof c.thumbnailOptions&&(h=c.thumbnailOptions),"boolean"==typeof c.waitForFileLoad&&(i=!c.waitForFileLoad)}this._loader=new b.Windows.Storage.BulkAccess.FileInformationFactory(this._query,e,g,h,i),this.compareByIdentity=!1,this.firstDataRequest=!0,f("WinJS.UI.StorageDataSource:constructor,StopTM")},{setNotificationHandler:function(a){this._notificationHandler=a,this._query.addEventListener("contentschanged",function(){a.invalidateAll()}),this._query.addEventListener("optionschanged",function(){a.invalidateAll()})},itemsFromEnd:function(a){var b=this;return f("WinJS.UI.StorageDataSource:itemsFromEnd,info"),this.getCount().then(function(c){return 0===c?h.wrapError(new e(i.FetchError.doesNotExist)):b.itemsFromIndex(c-1,Math.min(c-1,a-1),1)})},itemsFromIndex:function(a,b,c){function d(a){k._notificationHandler.changed(k._item(a.target))}b+c>64&&(b=Math.min(b,32),c=64-(b+1));var g=a-b,j=b+1+c,k=this;k.firstDataRequest&&(k.firstDataRequest=!1,j=Math.max(j,32));var l="WinJS.UI.StorageDataSource:itemsFromIndex("+g+"-"+(g+j-1)+")";return f(l+",StartTM"),this._loader.getItemsAsync(g,j).then(function(c){var m=c.size;if(b>=m)return h.wrapError(new e(i.FetchError.doesNotExist));var n=new Array(m),o=new Array(m);c.getMany(0,o);for(var p=0;m>p;p++)n[p]=k._item(o[p]),o[p].addEventListener("propertiesupdated",d);var q={items:n,offset:b,absoluteIndex:a};return j>m&&(q.totalCount=g+m),f(l+",StopTM"),q})},itemsFromDescription:function(a,b,c){var d=this;return f("WinJS.UI.StorageDataSource:itemsFromDescription,info"),this._query.findStartIndexAsync(a).then(function(a){return d.itemsFromIndex(a,b,c)})},getCount:function(){return f("WinJS.UI.StorageDataSource:getCount,info"),this._query.getItemCountAsync()},itemSignature:function(a){return a.folderRelativeId},_item:function(a){return{key:a.path||a.folderRelativeId,data:a}}},{supportedForProcessing:!1});return d.Class.derive(j.VirtualizedDataSource,function(b,c){this._baseDataSourceConstructor(new a(b,c))},{},{loadThumbnail:function(a,d){var e,i,j=!1;return new h(function(k){var l=d?!0:!1,m=function(m){if(m){var n=c.URL.createObjectURL(m,{oneTimeOnly:!0});i=i?i.then(function(b){return a.loadImage(n,b)}):a.loadImage(n,d).then(function(b){return a.isOnScreen().then(function(a){var c;return a&&l?c=g.fadeIn(b).then(function(){return b}):(b.style.opacity=1,c=h.wrap(b)),c})}),m.type===b.Windows.Storage.FileProperties.ThumbnailType.icon||m.returnedSmallerCachedSize||(f("WinJS.UI.StorageDataSource:loadThumbnail complete,info"),a.data.removeEventListener("thumbnailupdated",e),j=!1,i=i.then(function(a){e=null,i=null,k(a)}))}};e=function(a){j&&m(a.target.thumbnail)},a.data.addEventListener("thumbnailupdated",e),j=!0,m(a.data.thumbnail)},function(){a.data.removeEventListener("thumbnailupdated",e),j=!1,e=null,i&&(i.cancel(),i=null)})},supportedForProcessing:!1})})})}),d("WinJS/VirtualizedDataSource",["./VirtualizedDataSource/_VirtualizedDataSourceImpl","./VirtualizedDataSource/_GroupDataSource","./VirtualizedDataSource/_GroupedItemDataSource","./VirtualizedDataSource/_StorageDataSource"],function(){}),d("WinJS/Vui",["require","exports","./Core/_Global","./Utilities/_ElementUtilities"],function(a,b,c,d){function e(a){if(!a.defaultPrevented){var b=a.target,c=f[b.tagName];if(c)switch(a.state){case j.active:b[g.vuiData]||d.hasClass(b,h.active)?(d.removeClass(b,h.disambiguation),c.reactivate(b,a.label)):(d.addClass(b,h.active),c.activate(b,a.label));break;case j.disambiguation:d.addClass(b,h.active),d.addClass(b,h.disambiguation),c.disambiguate(b,a.label);break;case j.inactive:d.removeClass(b,h.active),d.removeClass(b,h.disambiguation),c.deactivate(b)}}}var f,g={vuiData:"_winVuiData"},h={active:"win-vui-active",disambiguation:"win-vui-disambiguation"},i={ListeningModeStateChanged:"ListeningStateChanged"},j={active:"active",disambiguation:"disambiguation",inactive:"inactive"};!function(a){a.BUTTON={activate:function(a,b){var c={nodes:[],width:a.style.width,height:a.style.height},e=d._getComputedStyle(a);for(a.style.width=e.width,a.style.height=e.height;a.childNodes.length;)c.nodes.push(a.removeChild(a.childNodes[0]));a[g.vuiData]=c,a.textContent=b},disambiguate:function(a,b){a.textContent=b},reactivate:function(a,b){a.textContent=b},deactivate:function(a){a.innerHTML="";var b=a[g.vuiData];a.style.width=b.width,a.style.height=b.height,b.nodes.forEach(function(b){return a.appendChild(b)}),delete a[g.vuiData]}}}(f||(f={})),c.document&&c.document.addEventListener(i.ListeningModeStateChanged,e)}),d("WinJS/_Accents",["require","exports","./Core/_Global","./Core/_WinRT","./Core/_Base","./Core/_BaseUtils","./Utilities/_ElementUtilities"],function(a,b,c,d,e,f,g){function h(a,b){t.push({selector:a,props:b}),i()}function i(){0!==t.length&&-1===u&&(u=f._setImmediate(function(){u=-1,m();var a=s?o.lightThemeSelector:o.darkThemeSelector,b=o.hoverSelector+" "+a,d=c.document.createElement("style");d.id=o.accentStyleId,d.textContent=t.map(function(c){var d=" "+c.props.map(function(a){return a.name+": "+r[a.value]+";"}).join("\n "),e=c.selector.split(",").map(function(a){return l(a)}),f=e.join(",\n"),g=f+" {\n"+d+"\n}",h=c.props.some(function(a){return 0!==a.value});if(h){var i=" "+c.props.map(function(a){return a.name+": "+r[a.value?a.value+3:a.value]+";"}).join("\n "),j=[];e.forEach(function(c){if(-1!==c.indexOf(o.hoverSelector)&&-1===c.indexOf(b)){j.push(c.replace(o.hoverSelector,b));var d=c.replace(o.hoverSelector,"").trim();-1!==p.indexOf(d[0])&&j.push(c.replace(o.hoverSelector+" ",b))}else j.push(a+" "+c),-1!==p.indexOf(c[0])&&j.push(a+c);g+="\n"+j.join(",\n")+" {\n"+i+"\n}"})}return g}).join("\n"),c.document.head.appendChild(d)}))}function j(){var a=(d.Windows.UI.ViewManagement.UIColorType,q.getColorValue(d.Windows.UI.ViewManagement.UIColorType.accent)),b=k(a,1);r[0]!==b&&(r.length=0,r.push(b,k(a,s?.6:.4),k(a,s?.8:.6),k(a,s?.9:.7),k(a,s?.4:.6),k(a,s?.6:.8),k(a,s?.7:.9)),i())}function k(a,b){return"rgba("+a.r+","+a.g+","+a.b+","+b+")"}function l(a){return a.replace(/ /g," ").replace(/ /g," ").trim();
}function m(){var a=c.document.head.querySelector("#"+o.accentStyleId);a&&a.parentNode.removeChild(a)}function n(){t.length=0,m()}var o={accentStyleId:"WinJSAccentsStyle",themeDetectionTag:"winjs-themedetection-tag",hoverSelector:"html.win-hoverable",lightThemeSelector:".win-ui-light",darkThemeSelector:".win-ui-dark"},p=[".","#",":"],q=null,r=[],s=!1,t=[],u=-1;!function(a){a[a.accent=0]="accent",a[a.listSelectRest=1]="listSelectRest",a[a.listSelectHover=2]="listSelectHover",a[a.listSelectPress=3]="listSelectPress",a[a._listSelectRestInverse=4]="_listSelectRestInverse",a[a._listSelectHoverInverse=5]="_listSelectHoverInverse",a[a._listSelectPressInverse=6]="_listSelectPressInverse"}(b.ColorTypes||(b.ColorTypes={}));var v=b.ColorTypes;b.createAccentRule=h;var w=c.document.createElement(o.themeDetectionTag);c.document.head.appendChild(w);var x=g._getComputedStyle(w);s="0"===x.opacity,w.parentElement.removeChild(w);try{q=new d.Windows.UI.ViewManagement.UISettings,q.addEventListener("colorvalueschanged",j),j()}catch(y){r.push("rgb(0, 120, 215)","rgba(0, 120, 215, "+(s?"0.6":"0.4")+")","rgba(0, 120, 215, "+(s?"0.8":"0.6")+")","rgba(0, 120, 215, "+(s?"0.9":"0.7")+")","rgba(0, 120, 215, "+(s?"0.4":"0.6")+")","rgba(0, 120, 215, "+(s?"0.6":"0.8")+")","rgba(0, 120, 215, "+(s?"0.7":"0.9")+")")}var z={ColorTypes:v,createAccentRule:h,_colors:r,_reset:n,_isDarkTheme:s};e.Namespace.define("WinJS.UI._Accents",z)}),d("require-style",{load:function(a){throw new Error("Dynamic load not allowed: "+a)}}),d("require-style!less/styles-intrinsic",[],function(){}),d("require-style!less/colors-intrinsic",[],function(){}),d("WinJS/Controls/IntrinsicControls",["../Utilities/_Hoverable","../_Accents","require-style!less/styles-intrinsic","require-style!less/colors-intrinsic"],function(a,b){"use strict";b.createAccentRule(".win-link, .win-progress-bar, .win-progress-ring, .win-ring",[{name:"color",value:b.ColorTypes.accent}]),b.createAccentRule("::selection, .win-button.win-button-primary, .win-dropdown option:checked, select[multiple].win-dropdown option:checked",[{name:"background-color",value:b.ColorTypes.accent}]),b.createAccentRule(".win-textbox:focus, .win-textarea:focus, .win-textbox:focus:hover, .win-textarea:focus:hover",[{name:"border-color",value:b.ColorTypes.accent}]),b.createAccentRule(".win-textbox::-ms-clear:hover:not(:active), .win-textbox::-ms-reveal:hover:not(:active)",[{name:"color",value:b.ColorTypes.accent}]),b.createAccentRule(".win-checkbox:checked::-ms-check, .win-textbox::-ms-clear:active, .win-textbox::-ms-reveal:active",[{name:"background-color",value:b.ColorTypes.accent}]),b.createAccentRule(".win-progress-bar::-webkit-progress-value, .win-progress-ring::-webkit-progress-value, .win-ring::-webkit-progress-value",[{name:"background-color",value:b.ColorTypes.accent}]),b.createAccentRule(".win-progress-bar:not(:indeterminate)::-moz-progress-bar, .win-progress-ring:not(:indeterminate)::-moz-progress-bar, .win-ring:not(:indeterminate)::-moz-progress-bar",[{name:"background-color",value:b.ColorTypes.accent}]),b.createAccentRule(".win-checkbox:indeterminate::-ms-check, .win-checkbox:hover:indeterminate::-ms-check, .win-radio:checked::-ms-check",[{name:"border-color",value:b.ColorTypes.accent}]),b.createAccentRule(".win-slider::-ms-thumb, .win-slider::-ms-fill-lower",[{name:"background",value:b.ColorTypes.accent}]),b.createAccentRule(".win-slider::-webkit-slider-thumb",[{name:"background",value:b.ColorTypes.accent}]),b.createAccentRule(".win-slider::-moz-range-thumb",[{name:"background",value:b.ColorTypes.accent}])}),d("WinJS/Controls/ElementResizeInstrument/_ElementResizeInstrument",["require","exports","../../Core/_BaseUtils","../../Core/_Base","../../Core/_Global","../../Core/_Log","../../Core/_ErrorFromName","../../Core/_Events","../../Promise","../../Utilities/_ElementUtilities"],function(a,b,c,d,e,f,g,h,i,j){"use strict";var k="display: block;position:absolute;top: 0;left: 0;height: 100%;width: 100%;overflow: hidden;pointer-events: none;z-index: -1;",l="win-resizeinstrument",m="about:blank",n={resize:"resize",_ready:"_ready"},o="resize",p="msHighContrastAdjust"in document.documentElement.style,q=function(){function a(){var a=this;this._disposed=!1,this._elementLoaded=!1,this._running=!1,this._objectWindowResizeHandlerBound=this._objectWindowResizeHandler.bind(this);var b=e.document.createElement("OBJECT");b.setAttribute("style",k),p?b.style.visibility="hidden":b.data=m,b.type="text/html",b.winControl=this,j.addClass(b,l),j.addClass(b,"win-disposable"),this._element=b,this._elementLoadPromise=new i(function(c){b.onload=function(){a._disposed||(a._elementLoaded=!0,a._objWindow.addEventListener(o,a._objectWindowResizeHandlerBound),c())}})}return Object.defineProperty(a.prototype,"element",{get:function(){return this._element},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"_objWindow",{get:function(){return this._elementLoaded&&this._element.contentDocument&&this._element.contentDocument.defaultView||null},enumerable:!0,configurable:!0}),a.prototype.addedToDom=function(){var a=this;if(!this._disposed){var b=this.element;if(!e.document.body.contains(b))throw new g("WinJS.UI._ElementResizeInstrument","ElementResizeInstrument initialization failed");f.log&&"static"===j._getComputedStyle(b.parentElement).position&&f.log("_ElementResizeInstrument can only detect size changes that are made to it's nearest positioned ancestor. Its parent element is not currently positioned."),!this._elementLoaded&&p&&(b.data="about:blank"),this._elementLoadPromise.then(function(){a._running=!0,a.dispatchEvent(n._ready,null);var b=i.timeout(50),c=function(){a.removeEventListener(n.resize,c),b.cancel()};a.addEventListener(n.resize,c),b.then(function(){a._objectWindowResizeHandler()})})}},a.prototype.dispose=function(){this._disposed||(this._disposed=!0,this._elementLoadPromise.cancel(),this._objWindow&&this._objWindow.removeEventListener.call(this._objWindow,o,this._objectWindowResizeHandlerBound),this._running=!1)},a.prototype.addEventListener=function(a,b,c){},a.prototype.dispatchEvent=function(a,b){return!1},a.prototype.removeEventListener=function(a,b,c){},a.prototype._objectWindowResizeHandler=function(){var a=this;this._running&&this._batchResizeEvents(function(){a._fireResizeEvent()})},a.prototype._batchResizeEvents=function(a){this._pendingResizeAnimationFrameId&&c._cancelAnimationFrame(this._pendingResizeAnimationFrameId),this._pendingResizeAnimationFrameId=c._requestAnimationFrame(function(){a()})},a.prototype._fireResizeEvent=function(){this._disposed||this.dispatchEvent(n.resize,null)},a.EventNames=n,a}();b._ElementResizeInstrument=q,d.Class.mix(q,h.eventMixin)}),d("WinJS/Controls/ElementResizeInstrument",["require","exports"],function(a,b){function c(){return d||a(["./ElementResizeInstrument/_ElementResizeInstrument"],function(a){d=a}),d._ElementResizeInstrument}var d=null,e=Object.create({},{_ElementResizeInstrument:{get:function(){return c()}}});return e}),d("WinJS/Controls/ItemContainer/_Constants",["exports","../../Core/_Base"],function(a,b){"use strict";var c={};c._listViewClass="win-listview",c._viewportClass="win-viewport",c._rtlListViewClass="win-rtl",c._horizontalClass="win-horizontal",c._verticalClass="win-vertical",c._scrollableClass="win-surface",c._itemsContainerClass="win-itemscontainer",c._listHeaderContainerClass="win-headercontainer",c._listFooterContainerClass="win-footercontainer",c._padderClass="win-itemscontainer-padder",c._proxyClass="_win-proxy",c._itemClass="win-item",c._itemBoxClass="win-itembox",c._itemsBlockClass="win-itemsblock",c._containerClass="win-container",c._containerEvenClass="win-container-even",c._containerOddClass="win-container-odd",c._backdropClass="win-backdrop",c._footprintClass="win-footprint",c._groupsClass="win-groups",c._selectedClass="win-selected",c._selectionBorderClass="win-selectionborder",c._selectionBackgroundClass="win-selectionbackground",c._selectionCheckmarkClass="win-selectioncheckmark",c._selectionCheckmarkBackgroundClass="win-selectioncheckmarkbackground",c._pressedClass="win-pressed",c._headerClass="win-groupheader",c._headerContainerClass="win-groupheadercontainer",c._groupLeaderClass="win-groupleader",c._progressClass="win-progress",c._revealedClass="win-revealed",c._itemFocusClass="win-focused",c._itemFocusOutlineClass="win-focusedoutline",c._zoomingXClass="win-zooming-x",c._zoomingYClass="win-zooming-y",c._listLayoutClass="win-listlayout",c._gridLayoutClass="win-gridlayout",c._headerPositionTopClass="win-headerpositiontop",c._headerPositionLeftClass="win-headerpositionleft",c._structuralNodesClass="win-structuralnodes",c._singleItemsBlockClass="win-single-itemsblock",c._uniformGridLayoutClass="win-uniformgridlayout",c._uniformListLayoutClass="win-uniformlistlayout",c._cellSpanningGridLayoutClass="win-cellspanninggridlayout",c._laidOutClass="win-laidout",c._nonDraggableClass="win-nondraggable",c._nonSelectableClass="win-nonselectable",c._dragOverClass="win-dragover",c._dragSourceClass="win-dragsource",c._clipClass="win-clip",c._selectionModeClass="win-selectionmode",c._noCSSGrid="win-nocssgrid",c._hidingSelectionMode="win-hidingselectionmode",c._hidingSelectionModeAnimationTimeout=250,c._INVALID_INDEX=-1,c._UNINITIALIZED=-1,c._LEFT_MSPOINTER_BUTTON=0,c._RIGHT_MSPOINTER_BUTTON=2,c._TAP_END_THRESHOLD=10,c._DEFAULT_PAGES_TO_LOAD=5,c._DEFAULT_PAGE_LOAD_THRESHOLD=2,c._MIN_AUTOSCROLL_RATE=150,c._MAX_AUTOSCROLL_RATE=1500,c._AUTOSCROLL_THRESHOLD=100,c._AUTOSCROLL_DELAY=50,c._DEFERRED_ACTION=250,c._DEFERRED_SCROLL_END=250,c._SELECTION_CHECKMARK="",c._LISTVIEW_PROGRESS_DELAY=2e3;var d={uninitialized:0,low:1,medium:2,high:3},e={rebuild:0,remeasure:1,relayout:2,realize:3};c._ScrollToPriority=d,c._ViewChange=e,b.Namespace._moduleDefine(a,"WinJS.UI",c)}),d("WinJS/Controls/ItemContainer/_ItemEventsHandler",["exports","../../Core/_Global","../../Core/_WinRT","../../Core/_Base","../../Core/_BaseUtils","../../Core/_WriteProfilerMark","../../Animations","../../Animations/_TransitionAnimation","../../Promise","../../Utilities/_ElementUtilities","../../Utilities/_UI","./_Constants"],function(a,b,c,d,e,f,g,h,i,j,k,l){"use strict";var m=e._browserStyleEquivalents.transform;d.Namespace._moduleDefine(a,"WinJS.UI",{_ItemEventsHandler:d.Namespace._lazy(function(){function a(a,c){var d=b.document.createElement("div");return d.className=a,c||d.setAttribute("aria-hidden",!0),d}var g=j._MSPointerEvent.MSPOINTER_TYPE_TOUCH||"touch",h=d.Class.define(function(a){this._site=a,this._work=[],this._animations={}},{dispose:function(){this._disposed||(this._disposed=!0,j._removeEventListener(b,"pointerup",this._resetPointerDownStateBound),j._removeEventListener(b,"pointercancel",this._resetPointerDownStateBound))},onPointerDown:function(a){f("WinJS.UI._ItemEventsHandler:MSPointerDown,StartTM");var d,h,i=this._site,m=a.pointerType===g;if(i.pressedElement=a.target,c.Windows.UI.Input.PointerPoint){var n=this._getCurrentPoint(a),o=n.properties;m||o.isInverted||o.isEraser||o.isMiddleButtonPressed?d=h=!1:(h=o.isRightButtonPressed,d=!h&&o.isLeftButtonPressed)}else d=a.button===l._LEFT_MSPOINTER_BUTTON,h=a.button===l._RIGHT_MSPOINTER_BUTTON;this._DragStartBound=this._DragStartBound||this.onDragStart.bind(this),this._PointerEnterBound=this._PointerEnterBound||this.onPointerEnter.bind(this),this._PointerLeaveBound=this._PointerLeaveBound||this.onPointerLeave.bind(this);var p=this._isInteractive(a.target),q=i.indexForItemElement(a.target),r=i.indexForHeaderElement(a.target),s=!p&&q!==l._INVALID_INDEX;if((m||d)&&this._site.pressedEntity.index===l._INVALID_INDEX&&!p&&(r===l._INVALID_INDEX?this._site.pressedEntity={type:k.ObjectType.item,index:q}:this._site.pressedEntity={type:k.ObjectType.groupHeader,index:r},this._site.pressedEntity.index!==l._INVALID_INDEX)){this._site.pressedPosition=j._getCursorPos(a);var t=i.verifySelectionAllowed(this._site.pressedEntity);this._canSelect=t.canSelect,this._canTapSelect=t.canTapSelect,this._site.pressedEntity.type===k.ObjectType.item?(this._site.pressedItemBox=i.itemBoxAtIndex(this._site.pressedEntity.index),this._site.pressedContainer=i.containerAtIndex(this._site.pressedEntity.index),this._site.animatedElement=this._site.pressedContainer,this._site.pressedHeader=null,this._togglePressed(!0,a),this._site.pressedContainer.addEventListener("dragstart",this._DragStartBound),m||(j._addEventListener(this._site.pressedContainer,"pointerenter",this._PointerEnterBound,!1),j._addEventListener(this._site.pressedContainer,"pointerleave",this._PointerLeaveBound,!1))):(this._site.pressedHeader=this._site.headerFromElement(a.target),e.isPhone?(this._site.animatedElement=this._site.pressedHeader,this._togglePressed(!0,a)):(this._site.pressedItemBox=null,this._site.pressedContainer=null,this._site.animatedElement=null)),this._resetPointerDownStateBound||(this._resetPointerDownStateBound=this._resetPointerDownStateForPointerId.bind(this)),m||(j._addEventListener(b,"pointerup",this._resetPointerDownStateBound,!1),j._addEventListener(b,"pointercancel",this._resetPointerDownStateBound,!1)),this._pointerId=a.pointerId,this._pointerRightButton=h}if(s&&m)try{j._setPointerCapture(i.canvasProxy,a.pointerId)}catch(u){return void f("WinJS.UI._ItemEventsHandler:MSPointerDown,StopTM")}this._site.pressedEntity.type===k.ObjectType.item&&this._selectionAllowed()&&this._multiSelection()&&this._site.pressedEntity.index!==l._INVALID_INDEX&&i.selection._getFocused().index!==l._INVALID_INDEX&&i.selection._pivot===l._INVALID_INDEX&&(i.selection._pivot=i.selection._getFocused().index),f("WinJS.UI._ItemEventsHandler:MSPointerDown,StopTM")},onPointerEnter:function(a){this._site.pressedContainer&&this._pointerId===a.pointerId&&this._togglePressed(!0,a)},onPointerLeave:function(a){this._site.pressedContainer&&this._pointerId===a.pointerId&&this._togglePressed(!1,a)},onDragStart:function(){this._resetPressedContainer()},_resetPressedContainer:function(){(this._site.pressedContainer||this._site.pressedHeader)&&this._site.animatedElement&&(this._togglePressed(!1),this._site.pressedContainer&&(this._site.pressedContainer.style[m.scriptName]="",this._site.pressedContainer.removeEventListener("dragstart",this._DragStartBound),j._removeEventListener(this._site.pressedContainer,"pointerenter",this._PointerEnterBound,!1),j._removeEventListener(this._site.pressedContainer,"pointerleave",this._PointerLeaveBound,!1)))},onClick:function(a){if(!this._skipClick){var b={type:k.ObjectType.item,index:this._site.indexForItemElement(a.target)};if(b.index===l._INVALID_INDEX&&(b.index=this._site.indexForHeaderElement(a.target),b.index!==l._INVALID_INDEX&&(b.type=k.ObjectType.groupHeader)),b.index!==l._INVALID_INDEX&&(j.hasClass(a.target,this._site.accessibleItemClass)||j.hasClass(a.target,l._headerClass))){var c=this._site.verifySelectionAllowed(b);c.canTapSelect&&this.handleTap(b),this._site.fireInvokeEvent(b,a.target)}}},onPointerUp:function(a){f("WinJS.UI._ItemEventsHandler:MSPointerUp,StartTM");var b=this._site;this._skipClick=!0;var c=this;e._yieldForEvents(function(){c._skipClick=!1});try{j._releasePointerCapture(b.canvasProxy,a.pointerId)}catch(d){}var h=a.pointerType===g,i=this._releasedElement(a),m=b.indexForItemElement(i),n=i&&j.hasClass(i,l._headerContainerClass)?b.indexForHeaderElement(b.pressedHeader):b.indexForHeaderElement(i);if(this._pointerId===a.pointerId){var o;if(o=n===l._INVALID_INDEX?{type:k.ObjectType.item,index:m}:{type:k.ObjectType.groupHeader,index:n},this._resetPressedContainer(),this._site.pressedEntity.type===k.ObjectType.item&&o.type===k.ObjectType.item&&this._site.pressedContainer&&this._site.pressedEntity.index===o.index)if(a.shiftKey||(b.selection._pivot=l._INVALID_INDEX),a.shiftKey){if(this._selectionAllowed()&&this._multiSelection()&&b.selection._pivot!==l._INVALID_INDEX){var p=Math.min(this._site.pressedEntity.index,b.selection._pivot),q=Math.max(this._site.pressedEntity.index,b.selection._pivot),r=this._pointerRightButton||a.ctrlKey||b.tapBehavior===k.TapBehavior.toggleSelect;b.selectRange(p,q,r)}}else a.ctrlKey&&this.toggleSelectionIfAllowed(this._site.pressedEntity.index);if(this._site.pressedHeader||this._site.pressedContainer){var s=j._getCursorPos(a),t=Math.abs(s.left-this._site.pressedPosition.left)<=l._TAP_END_THRESHOLD&&Math.abs(s.top-this._site.pressedPosition.top)<=l._TAP_END_THRESHOLD;this._pointerRightButton||a.ctrlKey||a.shiftKey||!(h&&t||!h&&this._site.pressedEntity.index===o.index&&this._site.pressedEntity.type===o.type)||(o.type===k.ObjectType.groupHeader?(this._site.pressedHeader=b.headerAtIndex(o.index),this._site.pressedItemBox=null,this._site.pressedContainer=null):(this._site.pressedItemBox=b.itemBoxAtIndex(o.index),this._site.pressedContainer=b.containerAtIndex(o.index),this._site.pressedHeader=null),this._canTapSelect&&this.handleTap(this._site.pressedEntity),this._site.fireInvokeEvent(this._site.pressedEntity,this._site.pressedItemBox||this._site.pressedHeader))}this._site.pressedEntity.index!==l._INVALID_INDEX&&b.changeFocus(this._site.pressedEntity,!0,!1,!0),this.resetPointerDownState()}f("WinJS.UI._ItemEventsHandler:MSPointerUp,StopTM")},onPointerCancel:function(a){this._pointerId===a.pointerId&&(f("WinJS.UI._ItemEventsHandler:MSPointerCancel,info"),this.resetPointerDownState())},onLostPointerCapture:function(a){this._pointerId===a.pointerId&&(f("WinJS.UI._ItemEventsHandler:MSLostPointerCapture,info"),this.resetPointerDownState())},onContextMenu:function(a){this._shouldSuppressContextMenu(a.target)&&a.preventDefault()},onMSHoldVisual:function(a){this._shouldSuppressContextMenu(a.target)&&a.preventDefault()},onDataChanged:function(){this.resetPointerDownState()},toggleSelectionIfAllowed:function(a){this._selectionAllowed(a)&&this._toggleItemSelection(a)},handleTap:function(a){if(a.type!==k.ObjectType.groupHeader){var b=this._site,c=b.selection;this._selectionAllowed(a.index)&&this._selectOnTap()&&(b.tapBehavior===k.TapBehavior.toggleSelect?this._toggleItemSelection(a.index):b.selectionMode!==k.SelectionMode.multi&&c._isIncluded(a.index)||c.set(a.index))}},_toggleItemSelection:function(a){var b=this._site,c=b.selection,d=c._isIncluded(a);b.selectionMode===k.SelectionMode.single?d?c.clear():c.set(a):d?c.remove(a):c.add(a)},_getCurrentPoint:function(a){return c.Windows.UI.Input.PointerPoint.getCurrentPoint(a.pointerId)},_containedInElementWithClass:function(a,b){if(a.parentNode)for(var c=a.parentNode.querySelectorAll("."+b+", ."+b+" *"),d=0,e=c.length;e>d;d++)if(c[d]===a)return!0;return!1},_isSelected:function(a){return this._site.selection._isIncluded(a)},_isInteractive:function(a){return this._containedInElementWithClass(a,"win-interactive")},_shouldSuppressContextMenu:function(a){var b=this._site.containerFromElement(a);return this._selectionAllowed()&&b&&!this._isInteractive(a)},_togglePressed:function(a,b){var c=this._site.pressedEntity.type===k.ObjectType.groupHeader;(c||!j.hasClass(this._site.pressedItemBox,l._nonSelectableClass))&&(this._staticMode(c)||(a?j.addClass(this._site.animatedElement,l._pressedClass):j.removeClass(this._site.animatedElement,l._pressedClass)))},_resetPointerDownStateForPointerId:function(a){this._pointerId===a.pointerId&&this.resetPointerDownState()},resetPointerDownState:function(){this._site.pressedElement=null,j._removeEventListener(b,"pointerup",this._resetPointerDownStateBound),j._removeEventListener(b,"pointercancel",this._resetPointerDownStateBound),this._resetPressedContainer(),this._site.pressedContainer=null,this._site.animatedElement=null,this._site.pressedHeader=null,this._site.pressedItemBox=null,this._site.pressedEntity={type:k.ObjectType.item,index:l._INVALID_INDEX},this._pointerId=null},_releasedElement:function(a){return b.document.elementFromPoint(a.clientX,a.clientY)},_applyUIInBatches:function(a){function b(){c._work.length>0?(c._flushUIBatches(),c._paintedThisFrame=e._requestAnimationFrame(b.bind(c))):c._paintedThisFrame=null}var c=this;this._work.push(a),this._paintedThisFrame||b()},_flushUIBatches:function(){if(this._work.length>0){var a=this._work;this._work=[];for(var b=0;b<a.length;b++)a[b]()}},_selectionAllowed:function(a){var b=void 0!==a?this._site.itemAtIndex(a):null,c=!(b&&j.hasClass(b,l._nonSelectableClass));return c&&this._site.selectionMode!==k.SelectionMode.none},_multiSelection:function(){return this._site.selectionMode===k.SelectionMode.multi},_selectOnTap:function(){return this._site.tapBehavior===k.TapBehavior.toggleSelect||this._site.tapBehavior===k.TapBehavior.directSelect},_staticMode:function(a){return a?this._site.headerTapBehavior===k.GroupHeaderTapBehavior.none:this._site.tapBehavior===k.TapBehavior.none&&this._site.selectionMode===k.SelectionMode.none}},{setAriaSelected:function(a,b){var c="true"===a.getAttribute("aria-selected");b!==c&&a.setAttribute("aria-selected",b)},renderSelection:function(b,c,d,e,f){if(!h._selectionTemplate){h._selectionTemplate=[],h._selectionTemplate.push(a(l._selectionBackgroundClass)),h._selectionTemplate.push(a(l._selectionBorderClass)),h._selectionTemplate.push(a(l._selectionCheckmarkBackgroundClass));var g=a(l._selectionCheckmarkClass);g.textContent=l._SELECTION_CHECKMARK,h._selectionTemplate.push(g)}if(d!==j._isSelectionRendered(b)){if(d){b.insertBefore(h._selectionTemplate[0].cloneNode(!0),b.firstElementChild);for(var i=1,k=h._selectionTemplate.length;k>i;i++)b.appendChild(h._selectionTemplate[i].cloneNode(!0))}else for(var m=b.querySelectorAll(j._selectionPartsSelector),i=0,k=m.length;k>i;i++)b.removeChild(m[i]);j[d?"addClass":"removeClass"](b,l._selectedClass),f&&j[d?"addClass":"removeClass"](f,l._selectedClass)}e&&h.setAriaSelected(c,d)}});return h})})}),d("WinJS/Controls/ListView/_SelectionManager",["exports","../../Core/_Global","../../Core/_Base","../../Promise","../../_Signal","../../Utilities/_UI","../ItemContainer/_Constants"],function(a,b,c,d,e,f,g){"use strict";c.Namespace._moduleDefine(a,"WinJS.UI",{_ItemSet:c.Namespace._lazy(function(){var b=c.Class.define(function(a,b,c){this._listView=a,this._ranges=b,this._itemsCount=c});return b.prototype={getRanges:function(){for(var a=[],b=0,c=this._ranges.length;c>b;b++){var d=this._ranges[b];a.push({firstIndex:d.firstIndex,lastIndex:d.lastIndex,firstKey:d.firstKey,lastKey:d.lastKey})}return a},getItems:function(){return a.getItemsFromRanges(this._listView._itemsManager.dataSource,this._ranges)},isEverything:function(){return this.count()===this._itemsCount},count:function(){for(var a=0,b=0,c=this._ranges.length;c>b;b++){var d=this._ranges[b];a+=d.lastIndex-d.firstIndex+1}return a},getIndices:function(){for(var a=[],b=0,c=this._ranges.length;c>b;b++)for(var d=this._ranges[b],e=d.firstIndex;e<=d.lastIndex;e++)a.push(e);return a}},b}),getItemsFromRanges:function(a,b){function c(){for(var a=[],c=0,e=b.length;e>c;c++)for(var f=b[c],g=f.firstIndex;g<=f.lastIndex;g++)a.push(g);return d.wrap(a)}var e=a.createListBinding(),f=[];return c().then(function(a){for(var b=0;b<a.length;b++)f.push(e.fromIndex(a[b]));return d.join(f).then(function(a){return e.release(),a})})},_Selection:c.Namespace._lazy(function(){function b(a){return a&&0===a.firstIndex&&a.lastIndex===Number.MAX_VALUE}return c.Class.derive(a._ItemSet,function(a,b){this._listView=a,this._itemsCount=-1,this._ranges=[],b&&this.set(b)},{clear:function(){return this._releaseRanges(this._ranges),this._ranges=[],d.wrap()},set:function(a){if(b(a))return this.selectAll();this._releaseRanges(this._ranges),this._ranges=[];var c=this;return this._execute("_set",a).then(function(){return c._ranges.sort(function(a,b){return a.firstIndex-b.firstIndex}),c._ensureKeys()}).then(function(){return c._ensureCount()})},add:function(a){if(b(a))return this.selectAll();var c=this;return this._execute("_add",a).then(function(){return c._ensureKeys()}).then(function(){return c._ensureCount()})},remove:function(a){var b=this;return this._execute("_remove",a).then(function(){return b._ensureKeys()})},selectAll:function(){var a=this;return a._ensureCount().then(function(){if(a._itemsCount){var b={firstIndex:0,lastIndex:a._itemsCount-1};return a._retainRange(b),a._releaseRanges(a._ranges),a._ranges=[b],a._ensureKeys()}})},_execute:function(a,b){function c(a,b,c){var d={};return d["first"+a]=b,d["last"+a]=c,d}function e(b){var c=f._getListBinding(),e=d.join([c.fromKey(b.firstKey),c.fromKey(b.lastKey)]).then(function(c){return c[0]&&c[1]&&(b.firstIndex=c[0].index,b.lastIndex=c[1].index,f[a](b)),b});i.push(e)}for(var f=this,g=!!f._getListBinding().fromKey,h=Array.isArray(b)?b:[b],i=[d.wrap()],j=0,k=h.length;k>j;j++){var l=h[j];"number"==typeof l?this[a](c("Index",l,l)):l&&(g&&void 0!==l.key?e(c("Key",l.key,l.key)):g&&void 0!==l.firstKey&&void 0!==l.lastKey?e(c("Key",l.firstKey,l.lastKey)):void 0!==l.index&&"number"==typeof l.index?this[a](c("Index",l.index,l.index)):void 0!==l.firstIndex&&void 0!==l.lastIndex&&"number"==typeof l.firstIndex&&"number"==typeof l.lastIndex&&this[a](c("Index",l.firstIndex,l.lastIndex)))}return d.join(i)},_set:function(a){this._retainRange(a),this._ranges.push(a)},_add:function(a){for(var b,c,d,e=this,f=null,g=function(a,b){b.lastIndex>a.lastIndex&&(a.lastIndex=b.lastIndex,a.lastKey=b.lastKey,a.lastPromise&&a.lastPromise.release(),a.lastPromise=e._getListBinding().fromIndex(a.lastIndex).retain())},h=0,i=this._ranges.length;i>h;h++){if(b=this._ranges[h],a.firstIndex<b.firstIndex){d=f&&a.firstIndex<f.lastIndex+1,d?(c=h-1,g(f,a)):(this._insertRange(h,a),c=h);break}if(a.firstIndex===b.firstIndex){g(b,a),c=h;break}f=b}if(void 0===c){var j=this._ranges.length?this._ranges[this._ranges.length-1]:null,k=j&&a.firstIndex<j.lastIndex+1;k?g(j,a):(this._retainRange(a),this._ranges.push(a))}else{for(f=null,h=c+1,i=this._ranges.length;i>h;h++){if(b=this._ranges[h],a.lastIndex<b.firstIndex){d=f&&f.lastIndex>a.lastIndex,d&&g(this._ranges[c],f),this._removeRanges(c+1,h-c-1);break}if(a.lastIndex===b.firstIndex){g(this._ranges[c],b),this._removeRanges(c+1,h-c);break}f=b}h>=i&&(g(this._ranges[c],this._ranges[i-1]),this._removeRanges(c+1,i-c-1))}},_remove:function(a){function b(a){return c._getListBinding().fromIndex(a).retain()}for(var c=this,d=[],e=0,f=this._ranges.length;f>e;e++){var g=this._ranges[e];g.lastIndex<a.firstIndex||g.firstIndex>a.lastIndex?d.push(g):g.firstIndex<a.firstIndex&&g.lastIndex>=a.firstIndex&&g.lastIndex<=a.lastIndex?(d.push({firstIndex:g.firstIndex,firstKey:g.firstKey,firstPromise:g.firstPromise,lastIndex:a.firstIndex-1,lastPromise:b(a.firstIndex-1)}),g.lastPromise.release()):g.lastIndex>a.lastIndex&&g.firstIndex>=a.firstIndex&&g.firstIndex<=a.lastIndex?(d.push({firstIndex:a.lastIndex+1,firstPromise:b(a.lastIndex+1),lastIndex:g.lastIndex,lastKey:g.lastKey,lastPromise:g.lastPromise}),g.firstPromise.release()):g.firstIndex<a.firstIndex&&g.lastIndex>a.lastIndex?(d.push({firstIndex:g.firstIndex,firstKey:g.firstKey,firstPromise:g.firstPromise,lastIndex:a.firstIndex-1,lastPromise:b(a.firstIndex-1)}),d.push({firstIndex:a.lastIndex+1,firstPromise:b(a.lastIndex+1),lastIndex:g.lastIndex,lastKey:g.lastKey,lastPromise:g.lastPromise})):(g.firstPromise.release(),g.lastPromise.release())}this._ranges=d},_ensureKeys:function(){for(var a=[d.wrap()],b=this,c=function(a,b){var c=a+"Key";if(b[c])return d.wrap();var e=b[a+"Promise"];return e.then(function(a){a&&(b[c]=a.key)}),e},e=0,f=this._ranges.length;f>e;e++){var g=this._ranges[e];a.push(c("first",g)),a.push(c("last",g))}return d.join(a).then(function(){b._ranges=b._ranges.filter(function(a){return a.firstKey&&a.lastKey})}),d.join(a)},_mergeRanges:function(a,b){a.lastIndex=b.lastIndex,a.lastKey=b.lastKey},_isIncluded:function(a){if(this.isEverything())return!0;for(var b=0,c=this._ranges.length;c>b;b++){var d=this._ranges[b];if(d.firstIndex<=a&&a<=d.lastIndex)return!0}return!1},_ensureCount:function(){var a=this;return this._listView._itemsCount().then(function(b){a._itemsCount=b})},_insertRange:function(a,b){this._retainRange(b),this._ranges.splice(a,0,b)},_removeRanges:function(a,b){for(var c=0;b>c;c++)this._releaseRange(this._ranges[a+c]);this._ranges.splice(a,b)},_retainRange:function(a){a.firstPromise||(a.firstPromise=this._getListBinding().fromIndex(a.firstIndex).retain()),a.lastPromise||(a.lastPromise=this._getListBinding().fromIndex(a.lastIndex).retain())},_retainRanges:function(){for(var a=0,b=this._ranges.length;b>a;a++)this._retainRange(this._ranges[a])},_releaseRange:function(a){a.firstPromise.release(),a.lastPromise.release()},_releaseRanges:function(a){for(var b=0,c=a.length;c>b;++b)this._releaseRange(a[b])},_getListBinding:function(){return this._listView._itemsManager._listBinding}},{supportedForProcessing:!1})}),_SelectionManager:c.Namespace._lazy(function(){var c=function(b){this._listView=b,this._selected=new a._Selection(this._listView),this._pivot=g._INVALID_INDEX,this._focused={type:f.ObjectType.item,index:0},this._pendingChange=d.wrap()};return c.prototype={count:function(){return this._selected.count()},getIndices:function(){return this._selected.getIndices()},getItems:function(){return this._selected.getItems()},getRanges:function(){return this._selected.getRanges()},isEverything:function(){return this._selected.isEverything()},set:function(b){var c=this,f=new e;return this._synchronize(f).then(function(){var e=new a._Selection(c._listView);return e.set(b).then(function(){c._set(e),f.complete()},function(a){return e.clear(),f.complete(),d.wrapError(a)})})},clear:function(){var b=this,c=new e;return this._synchronize(c).then(function(){var e=new a._Selection(b._listView);return e.clear().then(function(){b._set(e),c.complete()},function(a){return e.clear(),c.complete(),d.wrapError(a)})})},add:function(a){var b=this,c=new e;return this._synchronize(c).then(function(){var e=b._cloneSelection();return e.add(a).then(function(){b._set(e),c.complete()},function(a){return e.clear(),c.complete(),d.wrapError(a)})})},remove:function(a){var b=this,c=new e;return this._synchronize(c).then(function(){var e=b._cloneSelection();return e.remove(a).then(function(){b._set(e),c.complete()},function(a){return e.clear(),c.complete(),d.wrapError(a)})})},selectAll:function(){var b=this,c=new e;return this._synchronize(c).then(function(){var e=new a._Selection(b._listView);return e.selectAll().then(function(){b._set(e),c.complete()},function(a){return e.clear(),c.complete(),d.wrapError(a)})})},_synchronize:function(a){var b=this;return this._listView._versionManager.unlocked.then(function(){var c=b._pendingChange;return b._pendingChange=d.join([c,a.promise]).then(function(){}),c})},_reset:function(){this._pivot=g._INVALID_INDEX,this._setFocused({type:f.ObjectType.item,index:0},this._keyboardFocused()),this._pendingChange.cancel(),this._pendingChange=d.wrap(),this._selected.clear(),this._selected=new a._Selection(this._listView)},_dispose:function(){this._selected.clear(),this._selected=null,this._listView=null},_set:function(a){var b=this;return this._fireSelectionChanging(a).then(function(c){return c?(b._selected.clear(),b._selected=a,b._listView._updateSelection(),b._fireSelectionChanged()):a.clear(),c})},_fireSelectionChanging:function(a){var c=b.document.createEvent("CustomEvent"),e=d.wrap();c.initCustomEvent("selectionchanging",!0,!0,{newSelection:a,preventTapBehavior:function(){},setPromise:function(a){e=a}});var f=this._listView._element.dispatchEvent(c);return e.then(function(){return f})},_fireSelectionChanged:function(){var a=b.document.createEvent("CustomEvent");a.initCustomEvent("selectionchanged",!0,!1,null),this._listView._element.dispatchEvent(a)},_getFocused:function(){return{type:this._focused.type,index:this._focused.index}},_setFocused:function(a,b){this._focused={type:a.type,index:a.index},this._focusedByKeyboard=b},_keyboardFocused:function(){return this._focusedByKeyboard},_updateCount:function(a){this._selected._itemsCount=a},_isIncluded:function(a){return this._selected._isIncluded(a)},_cloneSelection:function(){var b=new a._Selection(this._listView);
return b._ranges=this._selected.getRanges(),b._itemsCount=this._selected._itemsCount,b._retainRanges(),b}},c.supportedForProcessing=!1,c})})}),d("WinJS/Controls/ListView/_BrowseMode",["exports","../../Core/_Global","../../Core/_Base","../../Core/_BaseUtils","../../Animations","../../Promise","../../Utilities/_ElementUtilities","../../Utilities/_UI","../ItemContainer/_Constants","../ItemContainer/_ItemEventsHandler","./_SelectionManager"],function(a,b,c,d,e,f,g,h,i,j,k){"use strict";var l=d._browserStyleEquivalents.transform.scriptName;c.Namespace._moduleDefine(a,"WinJS.UI",{_SelectionMode:c.Namespace._lazy(function(){function a(a,b,c){return Math.max(a,Math.min(b,c))}function e(a,c,d){var e=b.document.createEvent("CustomEvent");return e.initCustomEvent("keyboardnavigating",!0,!0,{oldFocus:c.index,oldFocusType:c.type,newFocus:d.index,newFocusType:d.type}),a.dispatchEvent(e)}var m=c.Class.define(function(a){this.inboundFocusHandled=!1,this._pressedContainer=null,this._pressedItemBox=null,this._pressedHeader=null,this._pressedEntity={type:h.ObjectType.item,index:i._INVALID_INDEX},this._pressedPosition=null,this.initialize(a)},{_dispose:function(){this._itemEventsHandler&&this._itemEventsHandler.dispose(),this._setNewFocusItemOffsetPromise&&this._setNewFocusItemOffsetPromise.cancel()},initialize:function(a){function b(b,c){var d=function(c){return a._view.getAdjacent(c,b)};return d.clampToBounds=c,d}this.site=a,this._keyboardNavigationHandlers={},this._keyboardAcceleratorHandlers={};var c=this.site,d=this;this._itemEventsHandler=new j._ItemEventsHandler(Object.create({containerFromElement:function(a){return c._view.items.containerFrom(a)},indexForItemElement:function(a){return c._view.items.index(a)},indexForHeaderElement:function(a){return c._groups.index(a)},itemBoxAtIndex:function(a){return c._view.items.itemBoxAt(a)},itemAtIndex:function(a){return c._view.items.itemAt(a)},headerAtIndex:function(a){return c._groups.group(a).header},headerFromElement:function(a){return c._groups.headerFrom(a)},containerAtIndex:function(a){return c._view.items.containerAt(a)},isZombie:function(){return c._isZombie()},getItemPosition:function(a){return c._getItemPosition(a)},rtl:function(){return c._rtl()},fireInvokeEvent:function(a,b){return d._fireInvokeEvent(a,b)},verifySelectionAllowed:function(a){return d._verifySelectionAllowed(a)},changeFocus:function(a,b,d,e,f){return c._changeFocus(a,b,d,e,f)},selectRange:function(a,b,c){return d._selectRange(a,b,c)}},{pressedEntity:{enumerable:!0,get:function(){return d._pressedEntity},set:function(a){d._pressedEntity=a}},pressedContainerScaleTransform:{enumerable:!0,get:function(){return d._pressedContainerScaleTransform},set:function(a){d._pressedContainerScaleTransform=a}},pressedContainer:{enumerable:!0,get:function(){return d._pressedContainer},set:function(a){d._pressedContainer=a}},pressedItemBox:{enumerable:!0,get:function(){return d._pressedItemBox},set:function(a){d._pressedItemBox=a}},pressedHeader:{enumerable:!0,get:function(){return d._pressedHeader},set:function(a){return d._pressedHeader=a}},pressedPosition:{enumerable:!0,get:function(){return d._pressedPosition},set:function(a){d._pressedPosition=a}},pressedElement:{enumerable:!0,set:function(a){d._pressedElement=a}},eventHandlerRoot:{enumerable:!0,get:function(){return c._viewport}},selectionMode:{enumerable:!0,get:function(){return c._selectionMode}},accessibleItemClass:{enumerable:!0,get:function(){return i._itemClass}},canvasProxy:{enumerable:!0,get:function(){return c._canvasProxy}},tapBehavior:{enumerable:!0,get:function(){return c._tap}},headerTapBehavior:{enumerable:!0,get:function(){return c._groupHeaderTap}},draggable:{enumerable:!0,get:function(){return c.itemsDraggable||c.itemsReorderable}},selection:{enumerable:!0,get:function(){return c._selection}},customFootprintParent:{enumerable:!0,get:function(){return null}}}));var e=g.Key;this._keyboardNavigationHandlers[e.upArrow]=b(e.upArrow),this._keyboardNavigationHandlers[e.downArrow]=b(e.downArrow),this._keyboardNavigationHandlers[e.leftArrow]=b(e.leftArrow),this._keyboardNavigationHandlers[e.rightArrow]=b(e.rightArrow),this._keyboardNavigationHandlers[e.pageUp]=b(e.pageUp,!0),this._keyboardNavigationHandlers[e.pageDown]=b(e.pageDown,!0),this._keyboardNavigationHandlers[e.home]=function(a){return!d.site._header||a.type!==h.ObjectType.groupHeader&&a.type!==h.ObjectType.footer?f.wrap({type:a.type!==h.ObjectType.footer?a.type:h.ObjectType.groupHeader,index:0}):f.wrap({type:h.ObjectType.header,index:0})},this._keyboardNavigationHandlers[e.end]=function(a){if(!d.site._footer||a.type!==h.ObjectType.groupHeader&&a.type!==h.ObjectType.header){if(a.type===h.ObjectType.groupHeader||a.type===h.ObjectType.header)return f.wrap({type:h.ObjectType.groupHeader,index:c._groups.length()-1});var b=d.site._view.lastItemIndex();return b>=0?f.wrap({type:a.type,index:b}):f.cancel}return f.wrap({type:h.ObjectType.footer,index:0})},this._keyboardAcceleratorHandlers[e.a]=function(){d.site._multiSelection()&&d._selectAll()}},staticMode:function(){return this.site._tap===h.TapBehavior.none&&this.site._selectionMode===h.SelectionMode.none},itemUnrealized:function(a,b){if(this._pressedEntity.type!==h.ObjectType.groupHeader&&(this._pressedEntity.index===a&&this._resetPointerDownState(),this._itemBeingDragged(a)))for(var c=this._draggedItemBoxes.length-1;c>=0;c--)this._draggedItemBoxes[c]===b&&(g.removeClass(b,i._dragSourceClass),this._draggedItemBoxes.splice(c,1))},_fireInvokeEvent:function(a,c){function d(d,f){var g=d.createListBinding(),h=g.fromIndex(a.index),i=f?"groupheaderinvoked":"iteminvoked";h.done(function(){g.release()});var j=b.document.createEvent("CustomEvent");j.initCustomEvent(i,!0,!0,f?{groupHeaderPromise:h,groupHeaderIndex:a.index}:{itemPromise:h,itemIndex:a.index}),c.dispatchEvent(j)&&e.site._defaultInvoke(a)}if(c){var e=this;a.type===h.ObjectType.groupHeader?this.site._groupHeaderTap===h.GroupHeaderTapBehavior.invoke&&a.index!==i._INVALID_INDEX&&d(this.site.groupDataSource,!0):this.site._tap===h.TapBehavior.none||a.index===i._INVALID_INDEX||this.site._isInSelectionMode()||d(this.site.itemDataSource,!1)}},_verifySelectionAllowed:function(a){if(a.type===h.ObjectType.groupHeader)return{canSelect:!1,canTapSelect:!1};var c=a.index,d=this.site,e=this.site._view.items.itemAt(c);if(!d._selectionAllowed()||!d._selectOnTap()||e&&g.hasClass(e,i._nonSelectableClass))return{canSelect:!1,canTapSelect:!1};var j=d._selection._isIncluded(c),k=!d._multiSelection(),l=d._selection._cloneSelection();j?k?l.clear():l.remove(c):k?l.set(c):l.add(c);var m,n=b.document.createEvent("CustomEvent"),o=f.wrap(),p=!1,q=!1;n.initCustomEvent("selectionchanging",!0,!0,{newSelection:l,preventTapBehavior:function(){q=!0},setPromise:function(a){o=a}});var r=d._element.dispatchEvent(n);o.then(function(){p=!0,m=l._isIncluded(c),l.clear()});var s=r&&p&&(j||m);return{canSelect:s,canTapSelect:s&&!q}},_containedInElementWithClass:function(a,b){if(a.parentNode)for(var c=a.parentNode.querySelectorAll("."+b+", ."+b+" *"),d=0,e=c.length;e>d;d++)if(c[d]===a)return!0;return!1},_isDraggable:function(a){return!this._containedInElementWithClass(a,i._nonDraggableClass)},_isInteractive:function(a){return this._containedInElementWithClass(a,"win-interactive")},_resetPointerDownState:function(){this._itemEventsHandler.resetPointerDownState()},onPointerDown:function(a){this._itemEventsHandler.onPointerDown(a)},onclick:function(a){this._itemEventsHandler.onClick(a)},onPointerUp:function(a){this._itemEventsHandler.onPointerUp(a)},onPointerCancel:function(a){this._itemEventsHandler.onPointerCancel(a)},onLostPointerCapture:function(a){this._itemEventsHandler.onLostPointerCapture(a)},onContextMenu:function(a){this._itemEventsHandler.onContextMenu(a)},onMSHoldVisual:function(a){this._itemEventsHandler.onMSHoldVisual(a)},onDataChanged:function(a){this._itemEventsHandler.onDataChanged(a)},_removeTransform:function(a,b){b&&-1!==a.style[l].indexOf(b)&&(a.style[l]=a.style[l].replace(b,""))},_selectAll:function(){var a=[];this.site._view.items.each(function(b,c){c&&g.hasClass(c,i._nonSelectableClass)&&a.push(b)}),this.site._selection.selectAll(),a.length>0&&this.site._selection.remove(a)},_selectRange:function(a,b,c){for(var d=[],e=-1,f=a;b>=f;f++){var h=this.site._view.items.itemAt(f);h&&g.hasClass(h,i._nonSelectableClass)?-1!==e&&(d.push({firstIndex:e,lastIndex:f-1}),e=-1):-1===e&&(e=f)}-1!==e&&d.push({firstIndex:e,lastIndex:b}),d.length>0&&this.site._selection[c?"add":"set"](d)},onDragStart:function(a){if(this._pressedEntity={type:h.ObjectType.item,index:this.site._view.items.index(a.target)},this.site._selection._pivot=i._INVALID_INDEX,this._pressedEntity.index===i._INVALID_INDEX||!this.site.itemsDraggable&&!this.site.itemsReorderable||this.site._view.animating||!this._isDraggable(a.target)||this._pressedElement&&this._isInteractive(this._pressedElement))a.preventDefault();else{this._dragging=!0,this._dragDataTransfer=a.dataTransfer,this._pressedPosition=g._getCursorPos(a),this._dragInfo=null,this._lastEnteredElement=a.target,this.site._selection._isIncluded(this._pressedEntity.index)?this._dragInfo=this.site.selection:(this._draggingUnselectedItem=!0,this._dragInfo=new k._Selection(this.site,[{firstIndex:this._pressedEntity.index,lastIndex:this._pressedEntity.index}]));var c=this.site.itemsReorderable,e=b.document.createEvent("CustomEvent");if(e.initCustomEvent("itemdragstart",!0,!1,{dataTransfer:a.dataTransfer,dragInfo:this._dragInfo}),a.dataTransfer.setData("text",""),a.dataTransfer.setDragImage){var f=this.site._view.items.itemDataAt(this._pressedEntity.index);if(f&&f.container){var j=f.container.getBoundingClientRect();a.dataTransfer.setDragImage(f.container,a.clientX-j.left,a.clientY-j.top)}}this.site.element.dispatchEvent(e),this.site.itemsDraggable&&!this.site.itemsReorderable&&(this._firedDragEnter||this._fireDragEnterEvent(a.dataTransfer)&&(c=!0,this._dragUnderstood=!0)),c&&(this._addedDragOverClass=!0,g.addClass(this.site._element,i._dragOverClass)),this._draggedItemBoxes=[];var l=this,m=a.target;m.addEventListener("dragend",function n(a){m.removeEventListener("dragend",n),l.onDragEnd(a)}),d._yieldForDomModification(function(){if(l._dragging)for(var a=l._dragInfo.getIndices(),b=0,c=a.length;c>b;b++){var d=l.site._view.items.itemDataAt(a[b]);d&&d.itemBox&&l._addDragSourceClass(d.itemBox)}})}},onDragEnter:function(a){var c=this._dragUnderstood;this._lastEnteredElement=a.target,this._exitEventTimer&&(b.clearTimeout(this._exitEventTimer),this._exitEventTimer=0),this._firedDragEnter||this._fireDragEnterEvent(a.dataTransfer)&&(c=!0),(c||this._dragging&&this.site.itemsReorderable)&&(a.preventDefault(),this._dragUnderstood=!0,this._addedDragOverClass||(this._addedDragOverClass=!0,g.addClass(this.site._element,i._dragOverClass))),this._pointerLeftRegion=!1},onDragLeave:function(a){a.target===this._lastEnteredElement&&(this._pointerLeftRegion=!0,this._handleExitEvent())},fireDragUpdateEvent:function(){var a=b.document.createEvent("CustomEvent");a.initCustomEvent("itemdragchanged",!0,!1,{dataTransfer:this._dragDataTransfer,dragInfo:this._dragInfo}),this.site.element.dispatchEvent(a)},_fireDragEnterEvent:function(a){var c=b.document.createEvent("CustomEvent");c.initCustomEvent("itemdragenter",!0,!0,{dataTransfer:a});var d=!this.site.element.dispatchEvent(c);return this._firedDragEnter=!0,d},_fireDragBetweenEvent:function(a,c,d){var e=b.document.createEvent("CustomEvent");return e.initCustomEvent("itemdragbetween",!0,!0,{index:a,insertAfterIndex:c,dataTransfer:d}),this.site.element.dispatchEvent(e)},_fireDropEvent:function(a,c,d){var e=b.document.createEvent("CustomEvent");return e.initCustomEvent("itemdragdrop",!0,!0,{index:a,insertAfterIndex:c,dataTransfer:d}),this.site.element.dispatchEvent(e)},_handleExitEvent:function(){this._exitEventTimer&&(b.clearTimeout(this._exitEventTimer),this._exitEventTimer=0);var a=this;this._exitEventTimer=b.setTimeout(function(){if(!a.site._disposed&&a._pointerLeftRegion){if(a.site._layout.dragLeave&&a.site._layout.dragLeave(),a._pointerLeftRegion=!1,a._dragUnderstood=!1,a._lastEnteredElement=null,a._lastInsertPoint=null,a._dragBetweenDisabled=!1,a._firedDragEnter){var c=b.document.createEvent("CustomEvent");c.initCustomEvent("itemdragleave",!0,!1,{}),a.site.element.dispatchEvent(c),a._firedDragEnter=!1}a._addedDragOverClass&&(a._addedDragOverClass=!1,g.removeClass(a.site._element,i._dragOverClass)),a._exitEventTimer=0,a._stopAutoScroll()}},40)},_getEventPositionInElementSpace:function(a,b){var c={left:0,top:0};try{c=a.getBoundingClientRect()}catch(d){}var e=g._getComputedStyle(a,null),f=parseInt(e.paddingLeft),h=parseInt(e.paddingTop),i=parseInt(e.borderLeftWidth),j=parseInt(e.borderTopWidth),k=b.clientX,l=b.clientY,m={x:+k===k?k-c.left-f-i:0,y:+l===l?l-c.top-h-j:0};return this.site._rtl()&&(m.x=c.right-c.left-m.x),m},_getPositionInCanvasSpace:function(a){var b=this.site._horizontal()?this.site.scrollPosition:0,c=this.site._horizontal()?0:this.site.scrollPosition,d=this._getEventPositionInElementSpace(this.site.element,a);return{x:d.x+b,y:d.y+c}},_itemBeingDragged:function(a){return this._dragging?this._draggingUnselectedItem&&this._dragInfo._isIncluded(a)||!this._draggingUnselectedItem&&this.site._isSelected(a):!1},_addDragSourceClass:function(a){this._draggedItemBoxes.push(a),g.addClass(a,i._dragSourceClass),a.parentNode&&g.addClass(a.parentNode,i._footprintClass)},renderDragSourceOnRealizedItem:function(a,b){this._itemBeingDragged(a)&&this._addDragSourceClass(b)},onDragOver:function(b){if(this._dragUnderstood){this._pointerLeftRegion=!1,b.preventDefault();var c=this._getPositionInCanvasSpace(b),d=this._getEventPositionInElementSpace(this.site.element,b);if(this._checkAutoScroll(d.x,d.y),this.site._layout.hitTest)if(this._autoScrollFrame)this._lastInsertPoint&&(this.site._layout.dragLeave(),this._lastInsertPoint=null);else{var e=this.site._view.hitTest(c.x,c.y);e.insertAfterIndex=a(-1,this.site._cachedCount-1,e.insertAfterIndex),this._lastInsertPoint&&this._lastInsertPoint.insertAfterIndex===e.insertAfterIndex&&this._lastInsertPoint.index===e.index||(this._dragBetweenDisabled=!this._fireDragBetweenEvent(e.index,e.insertAfterIndex,b.dataTransfer),this._dragBetweenDisabled?this.site._layout.dragLeave():this.site._layout.dragOver(c.x,c.y,this._dragInfo)),this._lastInsertPoint=e}}},_clearDragProperties:function(){if(this._addedDragOverClass&&(this._addedDragOverClass=!1,g.removeClass(this.site._element,i._dragOverClass)),this._draggedItemBoxes){for(var a=0,b=this._draggedItemBoxes.length;b>a;a++)g.removeClass(this._draggedItemBoxes[a],i._dragSourceClass),this._draggedItemBoxes[a].parentNode&&g.removeClass(this._draggedItemBoxes[a].parentNode,i._footprintClass);this._draggedItemBoxes=[]}this.site._layout.dragLeave(),this._dragging=!1,this._dragInfo=null,this._draggingUnselectedItem=!1,this._dragDataTransfer=null,this._lastInsertPoint=null,this._resetPointerDownState(),this._lastEnteredElement=null,this._dragBetweenDisabled=!1,this._firedDragEnter=!1,this._dragUnderstood=!1,this._stopAutoScroll()},onDragEnd:function(){var a=b.document.createEvent("CustomEvent");a.initCustomEvent("itemdragend",!0,!1,{}),this.site.element.dispatchEvent(a),this._clearDragProperties()},_findFirstAvailableInsertPoint:function(a,b,c){for(var d=a.getIndices(),e=-1,f=this.site._cachedCount,g=d.length,h=-1,i=b,j=0;g>j;j++)if(d[j]===i){e=j,h=j;break}for(;e>=0&&i>=0;)c?(i++,g>e&&d[e+1]===i&&f>i?e++:i>=f?(c=!1,i=b,e=h):e=-1):(i--,e>0&&d[e-1]===i?e--:e=-1);return i},_reorderItems:function(a,b,c,d,e){var f=this.site,g=function(a){c?f._selection.remove({key:a[0].key}):f._selection.set({firstKey:a[0].key,lastKey:a[a.length-1].key}),e&&f.ensureVisible(f._selection._getFocused())};b.getItems().then(function(b){var c=f.itemDataSource;if(-1===a){c.beginEdits();for(var e=b.length-1;e>=0;e--)c.moveToStart(b[e].key);c.endEdits(),g(b)}else{var h=c.createListBinding();h.fromIndex(a).then(function(a){if(h.release(),c.beginEdits(),d)for(var e=0,f=b.length;f>e;e++)c.moveBefore(b[e].key,a.key);else for(var e=b.length-1;e>=0;e--)c.moveAfter(b[e].key,a.key);c.endEdits(),g(b)})}})},onDrop:function(b){if(this._draggedItemBoxes)for(var c=0,d=this._draggedItemBoxes.length;d>c;c++)this._draggedItemBoxes[c].parentNode&&g.removeClass(this._draggedItemBoxes[c].parentNode,i._footprintClass);if(!this._dragBetweenDisabled){var e=this._getPositionInCanvasSpace(b),f=this.site._view.hitTest(e.x,e.y),h=a(-1,this.site._cachedCount-1,f.insertAfterIndex),j=!0;if(this._lastInsertPoint&&this._lastInsertPoint.insertAfterIndex===h&&this._lastInsertPoint.index===f.index||(j=this._fireDragBetweenEvent(f.index,h,b.dataTransfer)),j&&(this._lastInsertPoint=null,this.site._layout.dragLeave(),this._fireDropEvent(f.index,h,b.dataTransfer)&&this._dragging&&this.site.itemsReorderable)){if(this._dragInfo.isEverything()||this.site._groupsEnabled())return;h=this._findFirstAvailableInsertPoint(this._dragInfo,h,!1),this._reorderItems(h,this._dragInfo,this._draggingUnselectedItem)}}this._clearDragProperties(),b.preventDefault()},_checkAutoScroll:function(a,c){var e=this.site._getViewportLength(),f=this.site._horizontal(),h=f?a:c,j=this.site._viewport[f?"scrollWidth":"scrollHeight"],k=Math.floor(this.site.scrollPosition),l=0;if(h<i._AUTOSCROLL_THRESHOLD?l=h-i._AUTOSCROLL_THRESHOLD:h>e-i._AUTOSCROLL_THRESHOLD&&(l=h-(e-i._AUTOSCROLL_THRESHOLD)),l=Math.round(l/i._AUTOSCROLL_THRESHOLD*(i._MAX_AUTOSCROLL_RATE-i._MIN_AUTOSCROLL_RATE)),(0===k&&0>l||k>=j-e&&l>0)&&(l=0),0===l)this._autoScrollDelay&&(b.clearTimeout(this._autoScrollDelay),this._autoScrollDelay=0);else if(!this._autoScrollDelay&&!this._autoScrollFrame){var m=this;this._autoScrollDelay=b.setTimeout(function(){if(m._autoScrollRate){m._lastDragTimeout=d._now();var a=function(){if(!m._autoScrollRate&&m._autoScrollFrame||m.site._disposed)m._stopAutoScroll();else{var b=d._now(),c=m._autoScrollRate*((b-m._lastDragTimeout)/1e3);c=0>c?Math.min(-1,c):Math.max(1,c);var e={};e[m.site._scrollProperty]=m.site._viewportScrollPosition+c,g.setScrollPosition(m.site._viewport,e),m._lastDragTimeout=b,m._autoScrollFrame=d._requestAnimationFrame(a)}};m._autoScrollFrame=d._requestAnimationFrame(a)}},i._AUTOSCROLL_DELAY)}this._autoScrollRate=l},_stopAutoScroll:function(){this._autoScrollDelay&&(b.clearTimeout(this._autoScrollDelay),this._autoScrollDelay=0),this._autoScrollRate=0,this._autoScrollFrame=0},onKeyDown:function(a){function b(a,b,g){function k(j){var k=!0,m=!1;if(g?a.index=Math.max(0,Math.min(j,a.index)):(a.index<0||a.index>j)&&(m=!0),!m&&(l.index!==a.index||l.type!==a.type)){var o=e(d._element,l,a);o&&(k=!1,c._setNewFocusItemOffsetPromise&&c._setNewFocusItemOffsetPromise.cancel(),d._batchViewUpdates(i._ViewChange.realize,i._ScrollToPriority.high,function(){return c._setNewFocusItemOffsetPromise=d._getItemOffset(l,!0).then(function(e){e=d._convertFromCanvasCoordinates(e);var g=e.end<=d.scrollPosition||e.begin>=d.scrollPosition+d._getViewportLength()-1;return c._setNewFocusItemOffsetPromise=d._getItemOffset(a).then(function(e){c._setNewFocusItemOffsetPromise=null;var h={position:d.scrollPosition,direction:"right"};return g&&(d._selection._setFocused(a,!0),e=d._convertFromCanvasCoordinates(e),a.index>l.index?(h.direction="right",h.position=e.end-d._getViewportLength()):(h.direction="left",h.position=e.begin)),d._changeFocus(a,b,n,g,!0),g?h:f.cancel},function(c){return d._changeFocus(a,b,n,!0,!0),f.wrapError(c)}),c._setNewFocusItemOffsetPromise},function(c){return d._changeFocus(a,b,n,!0,!0),f.wrapError(c)}),c._setNewFocusItemOffsetPromise},!0))}return k&&(d._selection._setFocused(l,!0),d.ensureVisible(l)),m?{type:h.ObjectType.item,index:i._INVALID_INDEX}:a}return a.type===h.ObjectType.item?f.wrap(j.lastItemIndex()).then(k):a.type===h.ObjectType.groupHeader?f.wrap(d._groups.length()-1).then(k):f.wrap(0).then(k)}var c=this,d=this.site,j=d._view,l=d._selection._getFocused(),m=!0,n=a.ctrlKey,o=g.Key,p=a.keyCode,q=d._rtl();if(!this._isInteractive(a.target)){if(a.ctrlKey&&!a.altKey&&!a.shiftKey&&this._keyboardAcceleratorHandlers[p]&&this._keyboardAcceleratorHandlers[p](),d.itemsReorderable&&!a.ctrlKey&&a.altKey&&a.shiftKey&&l.type===h.ObjectType.item&&(p===o.leftArrow||p===o.rightArrow||p===o.upArrow||p===o.downArrow)){var r=d._selection,s=l.index,t=!1,u=!0;if(!r.isEverything()){if(!r._isIncluded(s)){var v=d._view.items.itemAt(s);v&&g.hasClass(v,i._nonDraggableClass)?u=!1:(t=!0,r=new k._Selection(this.site,[{firstIndex:s,lastIndex:s}]))}if(u){var w=s;p===o.rightArrow?w+=q?-1:1:p===o.leftArrow?w+=q?1:-1:p===o.upArrow?w--:w++;var x=w>s,y=x;x&&w>=this.site._cachedCount&&(y=!1,w=this.site._cachedCount-1),w=this._findFirstAvailableInsertPoint(r,w,y),w=Math.min(Math.max(-1,w),this.site._cachedCount-1);var z=w-(x||-1===w?0:1),A=w,B=this.site._groupsEnabled();if(B){var C=this.site._groups,D=w>-1?C.groupFromItem(w):0;x?C.group(D).startIndex===w&&z--:D<C.length()-1&&w===C.group(D+1).startIndex-1&&z++}if(this._fireDragBetweenEvent(A,z,null)&&this._fireDropEvent(A,z,null)){if(B)return;this._reorderItems(w,r,t,!x,!0)}}}}else if(a.altKey)m=!1;else if(this._keyboardNavigationHandlers[p])this._keyboardNavigationHandlers[p](l).then(function(e){if(e.index!==l.index||e.type!==l.type){var f=c._keyboardNavigationHandlers[p].clampToBounds;e.type!==h.ObjectType.groupHeader&&a.shiftKey&&d._selectionAllowed()&&d._multiSelection()?(d._selection._pivot===i._INVALID_INDEX&&(d._selection._pivot=l.index),b(e,!0,f).then(function(b){if(b.index!==i._INVALID_INDEX){var e=Math.min(b.index,d._selection._pivot),f=Math.max(b.index,d._selection._pivot),g=a.ctrlKey||d._tap===h.TapBehavior.toggleSelect;c._selectRange(e,f,g)}})):(d._selection._pivot=i._INVALID_INDEX,b(e,!1,f))}else m=!1});else if(a.ctrlKey||p!==o.enter)l.type!==h.ObjectType.groupHeader&&(a.ctrlKey&&p===o.enter||p===o.space)?(this._itemEventsHandler.toggleSelectionIfAllowed(l.index),d._changeFocus(l,!0,n,!1,!0)):p===o.escape&&d._selection.count()>0?(d._selection._pivot=i._INVALID_INDEX,d._selection.clear()):m=!1;else{var E=l.type===h.ObjectType.groupHeader?d._groups.group(l.index).header:d._view.items.itemBoxAt(l.index);if(E){l.type===h.ObjectType.groupHeader?(this._pressedHeader=E,this._pressedItemBox=null,this._pressedContainer=null):(this._pressedItemBox=E,this._pressedContainer=d._view.items.containerAt(l.index),this._pressedHeader=null);var F=this._verifySelectionAllowed(l);F.canTapSelect&&this._itemEventsHandler.handleTap(l),this._fireInvokeEvent(l,E)}}this._keyDownHandled=m,m&&(a.stopPropagation(),a.preventDefault())}p===o.tab&&(this.site._keyboardFocusInbound=!0)},onKeyUp:function(a){this._keyDownHandled&&(a.stopPropagation(),a.preventDefault())},onTabEntered:function(a){if(0!==this.site._groups.length()||this.site._hasHeaderOrFooter){var b=this.site,c=b._selection._getFocused(),d=a.detail,f=!b._hasKeyboardFocus||a.target===b._viewport;if(f)if(this.inboundFocusHandled=!0,c.index=c.index===i._INVALID_INDEX?0:c.index,d||!this.site._supportsGroupHeaderKeyboarding&&!this.site._hasHeaderOrFooter){var g={type:h.ObjectType.item};c.type===h.ObjectType.groupHeader?(g.index=b._groupFocusCache.getIndexForGroup(c.index),e(b._element,c,g)?b._changeFocus(g,!0,!1,!1,!0):b._changeFocus(c,!0,!1,!1,!0)):(g.index=c.type!==h.ObjectType.item?b._groupFocusCache.getLastFocusedItemIndex():c.index,b._changeFocus(g,!0,!1,!1,!0)),a.preventDefault()}else{var g={type:h.ObjectType.groupHeader};this.site._hasHeaderOrFooter?this.site._lastFocusedElementInGroupTrack.type===h.ObjectType.groupHeader&&this.site._supportsGroupHeaderKeyboarding?(g.index=b._groups.groupFromItem(c.index),e(b._element,c,g)?b._changeFocus(g,!0,!1,!1,!0):b._changeFocus(c,!0,!1,!1,!0)):(g.type=this.site._lastFocusedElementInGroupTrack.type,g.index=0,b._changeFocus(g,!0,!1,!1,!0)):c.type!==h.ObjectType.groupHeader&&this.site._supportsGroupHeaderKeyboarding?(g.index=b._groups.groupFromItem(c.index),e(b._element,c,g)?b._changeFocus(g,!0,!1,!1,!0):b._changeFocus(c,!0,!1,!1,!0)):(g.index=c.index,b._changeFocus(g,!0,!1,!1,!0)),a.preventDefault()}}},onTabExiting:function(a){if(this.site._hasHeaderOrFooter||this.site._supportsGroupHeaderKeyboarding&&0!==this.site._groups.length()){var b=this.site,c=b._selection._getFocused(),d=a.detail;if(d){var f=null;if(c.type===h.ObjectType.item){var g=this.site._lastFocusedElementInGroupTrack.type;if(g!==h.ObjectType.header&&g!==h.ObjectType.footer&&this.site._supportsGroupHeaderKeyboarding)var f={type:h.ObjectType.groupHeader,index:b._groups.groupFromItem(c.index)};else var f={type:g===h.ObjectType.item?h.ObjectType.header:g,index:0}}f&&e(b._element,c,f)&&(b._changeFocus(f,!0,!1,!1,!0),a.preventDefault())}else if(!d&&c.type!==h.ObjectType.item){var i=0;i=c.type===h.ObjectType.groupHeader?b._groupFocusCache.getIndexForGroup(c.index):c.type===h.ObjectType.header?0:b._view.lastItemIndex();var f={type:h.ObjectType.item,index:i};e(b._element,c,f)&&(b._changeFocus(f,!0,!1,!1,!0),a.preventDefault())}}}});return m})})}),d("WinJS/Controls/ListView/_ErrorMessages",["exports","../../Core/_Base","../../Core/_Resources"],function(a,b,c){"use strict";b.Namespace._moduleDefine(a,null,{modeIsInvalid:{get:function(){return"Invalid argument: mode must be one of following values: 'none', 'single' or 'multi'."}},loadingBehaviorIsDeprecated:{get:function(){return"Invalid configuration: loadingBehavior is deprecated. The control will default this property to 'randomAccess'. Please refer to the 'ListView loading behaviors' SDK Sample for guidance on how to implement incremental load behavior."}},pagesToLoadIsDeprecated:{get:function(){return"Invalid configuration: pagesToLoad is deprecated. The control will not use this property. Please refer to the 'ListView loading behaviors' SDK Sample for guidance on how to implement incremental load behavior."}},pagesToLoadThresholdIsDeprecated:{get:function(){return"Invalid configuration: pagesToLoadThreshold is deprecated. The control will not use this property. Please refer to the 'ListView loading behaviors' SDK Sample for guidance on how to implement incremental load behavior."}},automaticallyLoadPagesIsDeprecated:{get:function(){return"Invalid configuration: automaticallyLoadPages is deprecated. The control will default this property to false. Please refer to the 'ListView loading behaviors' SDK Sample for guidance on how to implement incremental load behavior."}},invalidTemplate:{get:function(){return"Invalid template: Templates must be created before being passed to the ListView, and must contain a valid tree of elements."}},loadMorePagesIsDeprecated:{get:function(){return"loadMorePages is deprecated. Invoking this function will not have any effect. Please refer to the 'ListView loading behaviors' SDK Sample for guidance on how to implement incremental load behavior."}},disableBackdropIsDeprecated:{get:function(){return"Invalid configuration: disableBackdrop is deprecated. Style: .win-listview .win-container.win-backdrop { background-color:transparent; } instead."}},backdropColorIsDeprecated:{get:function(){return"Invalid configuration: backdropColor is deprecated. Style: .win-listview .win-container.win-backdrop { rgba(155,155,155,0.23); } instead."}},itemInfoIsDeprecated:{get:function(){return"GridLayout.itemInfo may be altered or unavailable in future versions. Instead, use CellSpanningLayout."}},groupInfoIsDeprecated:{get:function(){return"GridLayout.groupInfo may be altered or unavailable in future versions. Instead, use CellSpanningLayout."}},resetItemIsDeprecated:{get:function(){return"resetItem may be altered or unavailable in future versions. Instead, mark the element as disposable using WinJS.Utilities.markDisposable."}},resetGroupHeaderIsDeprecated:{get:function(){return"resetGroupHeader may be altered or unavailable in future versions. Instead, mark the header element as disposable using WinJS.Utilities.markDisposable."}},maxRowsIsDeprecated:{get:function(){return"GridLayout.maxRows may be altered or unavailable in future versions. Instead, use the maximumRowsOrColumns property."}},swipeOrientationDeprecated:{get:function(){return"Invalid configuration: swipeOrientation is deprecated. The control will default this property to 'none'"}},swipeBehaviorDeprecated:{get:function(){return"Invalid configuration: swipeBehavior is deprecated. The control will default this property to 'none'"}}})}),d("WinJS/Controls/ListView/_GroupFocusCache",["exports","../../Core/_Base"],function(a,b){"use strict";b.Namespace._moduleDefine(a,"WinJS.UI",{_GroupFocusCache:b.Namespace._lazy(function(){return b.Class.define(function(a){this._listView=a,this.clear()},{updateCache:function(a,b,c){this._lastFocusedItemKey=b,this._lastFocusedItemIndex=c,c=""+c,this._itemToIndex[b]=c,this._groupToItem[a]=b},deleteItem:function(a){if(a===this._lastFocusedItemKey&&(this._lastFocusedItemKey=null,this._lastFocusedItemIndex=0),this._itemToIndex[a])for(var b=this,c=Object.keys(this._groupToItem),d=0,e=c.length;e>d;d++){var f=c[d];if(b._groupToItem[f]===a){b.deleteGroup(f);break}}},deleteGroup:function(a){var b=this._groupToItem[a];b&&delete this._itemToIndex[b],delete this._groupToItem[a]},updateItemIndex:function(a,b){a===this._lastFocusedItemKey&&(this._lastFocusedItemIndex=b),this._itemToIndex[a]&&(this._itemToIndex[a]=""+b)},getIndexForGroup:function(a){var b=this._listView._groups.group(a).key,c=this._groupToItem[b];return c&&this._itemToIndex[c]?+this._itemToIndex[c]:this._listView._groups.fromKey(b).group.startIndex},clear:function(){this._groupToItem={},this._itemToIndex={},this._lastFocusedItemIndex=0,this._lastFocusedItemKey=null},getLastFocusedItemIndex:function(){return this._lastFocusedItemIndex}})}),_UnsupportedGroupFocusCache:b.Namespace._lazy(function(){return b.Class.define(null,{updateCache:function(a,b,c){this._lastFocusedItemKey=b,this._lastFocusedItemIndex=c},deleteItem:function(a){a===this._lastFocusedItemKey&&(this._lastFocusedItemKey=null,this._lastFocusedItemIndex=0)},deleteGroup:function(){},updateItemIndex:function(a,b){a===this._lastFocusedItemKey&&(this._lastFocusedItemIndex=b)},getIndexForGroup:function(){return 0},clear:function(){this._lastFocusedItemIndex=0,this._lastFocusedItemKey=null},getLastFocusedItemIndex:function(){return this._lastFocusedItemIndex}})})})}),d("WinJS/Controls/ListView/_GroupsContainer",["exports","../../Core/_Base","../../Promise","../../Utilities/_Dispose","../../Utilities/_ElementUtilities","../../Utilities/_ItemsManager","../../Utilities/_UI","../ItemContainer/_Constants"],function(a,b,c,d,e,f,g,h){"use strict";b.Namespace._moduleDefine(a,"WinJS.UI",{_GroupsContainerBase:b.Namespace._lazy(function(){return b.Class.define(function(){},{index:function(a){var b=this.headerFrom(a);if(b)for(var c=0,d=this.groups.length;d>c;c++)if(b===this.groups[c].header)return c;return h._INVALID_INDEX},headerFrom:function(a){for(;a&&!e.hasClass(a,h._headerClass);)a=a.parentNode;return a},requestHeader:function(a){this._waitingHeaderRequests=this._waitingHeaderRequests||{},this._waitingHeaderRequests[a]||(this._waitingHeaderRequests[a]=[]);var b=this;return new c(function(c){var d=b.groups[a];d&&d.header?c(d.header):b._waitingHeaderRequests[a].push(c)})},notify:function(a,b){if(this._waitingHeaderRequests&&this._waitingHeaderRequests[a]){for(var c=this._waitingHeaderRequests[a],d=0,e=c.length;e>d;d++)c[d](b);this._waitingHeaderRequests[a]=[]}},groupFromImpl:function(a,b,c){if(a>b)return null;var d=a+Math.floor((b-a)/2),e=this.groups[d];return c(e,d)?this.groupFromImpl(a,d-1,c):b>d&&!c(this.groups[d+1],d+1)?this.groupFromImpl(d+1,b,c):d},groupFrom:function(a){if(this.groups.length>0){var b=this.groups.length-1,c=this.groups[b];return a(c,b)?this.groupFromImpl(0,this.groups.length-1,a):b}return null},groupFromItem:function(a){return this.groupFrom(function(b){return a<b.startIndex})},groupFromOffset:function(a){return this.groupFrom(function(b){return a<b.offset})},group:function(a){return this.groups[a]},length:function(){return this.groups.length},cleanUp:function(){if(this.listBinding){for(var a=0,b=this.groups.length;b>a;a++){
var c=this.groups[a];c.userData&&this.listBinding.releaseItem(c.userData)}this.listBinding.release()}},_dispose:function(){this.cleanUp()},synchronizeGroups:function(){var a=this;return this.pendingChanges=[],this.ignoreChanges=!0,this.groupDataSource.invalidateAll().then(function(){return c.join(a.pendingChanges)}).then(function(){return a._listView._ifZombieDispose()?c.cancel:void 0}).then(function(){a.ignoreChanges=!1},function(b){return a.ignoreChanges=!1,c.wrapError(b)})},fromKey:function(a){for(var b=0,c=this.groups.length;c>b;b++){var d=this.groups[b];if(d.key===a)return{group:d,index:b}}return null},fromHandle:function(a){for(var b=0,c=this.groups.length;c>b;b++){var d=this.groups[b];if(d.handle===a)return{group:d,index:b}}return null}})}),_UnvirtualizedGroupsContainer:b.Namespace._lazy(function(){return b.Class.derive(a._GroupsContainerBase,function(a,b){this._listView=a,this.groupDataSource=b,this.groups=[],this.pendingChanges=[],this.dirty=!0;var c=this,f={beginNotifications:function(){c._listView._versionManager.beginNotifications()},endNotifications:function(){c._listView._versionManager.endNotifications(),c._listView._ifZombieDispose()||!c.ignoreChanges&&c._listView._groupsChanged&&c._listView._scheduleUpdate()},indexChanged:function(){c._listView._versionManager.receivedNotification(),c._listView._ifZombieDispose()||this.scheduleUpdate()},itemAvailable:function(){},countChanged:function(a){c._listView._versionManager.receivedNotification(),c._listView._writeProfilerMark("groupCountChanged("+a+"),info"),c._listView._ifZombieDispose()||this.scheduleUpdate()},changed:function(a){if(c._listView._versionManager.receivedNotification(),!c._listView._ifZombieDispose()){var b=c.fromKey(a.key);b&&(c._listView._writeProfilerMark("groupChanged("+b.index+"),info"),b.group.userData=a,b.group.startIndex=a.firstItemIndexHint,this.markToRemove(b.group)),this.scheduleUpdate()}},removed:function(a){if(c._listView._versionManager.receivedNotification(),c._listView._groupRemoved(a),!c._listView._ifZombieDispose()){var b=c.fromHandle(a);if(b){c._listView._writeProfilerMark("groupRemoved("+b.index+"),info"),c.groups.splice(b.index,1);var d=c.groups.indexOf(b.group,b.index);d>-1&&c.groups.splice(d,1),this.markToRemove(b.group)}this.scheduleUpdate()}},inserted:function(a,b,d){if(c._listView._versionManager.receivedNotification(),!c._listView._ifZombieDispose()){c._listView._writeProfilerMark("groupInserted,info");var e=this;a.retain().then(function(f){var g;if(g=b||d||c.groups.length?e.findIndex(b,d):0,-1!==g){var h={key:f.key,startIndex:f.firstItemIndexHint,userData:f,handle:a.handle};c.groups.splice(g,0,h)}e.scheduleUpdate()}),c.pendingChanges.push(a)}},moved:function(a,b,d){if(c._listView._versionManager.receivedNotification(),!c._listView._ifZombieDispose()){c._listView._writeProfilerMark("groupMoved,info");var e=this;a.then(function(f){var g=e.findIndex(b,d),h=c.fromKey(f.key);if(h)c.groups.splice(h.index,1),-1!==g&&(h.index<g&&g--,h.group.key=f.key,h.group.userData=f,h.group.startIndex=f.firstItemIndexHint,c.groups.splice(g,0,h.group));else if(-1!==g){var i={key:f.key,startIndex:f.firstItemIndexHint,userData:f,handle:a.handle};c.groups.splice(g,0,i),a.retain()}e.scheduleUpdate()}),c.pendingChanges.push(a)}},reload:function(){c._listView._versionManager.receivedNotification(),c._listView._ifZombieDispose()||c._listView._processReload()},markToRemove:function(a){if(a.header){var b=a.header;a.header=null,a.left=-1,a.width=-1,a.decorator=null,a.tabIndex=-1,b.tabIndex=-1,c._listView._groupsToRemove[e._uniqueID(b)]={group:a,header:b}}},scheduleUpdate:function(){c.dirty=!0,c.ignoreChanges||(c._listView._groupsChanged=!0)},findIndex:function(a,b){var d,e=-1;return a&&(d=c.fromHandle(a),d&&(e=d.index+1)),-1===e&&b&&(d=c.fromHandle(b),d&&(e=d.index)),e},removeElements:function(a){if(a.header){var b=a.header.parentNode;b&&(d.disposeSubTree(a.header),b.removeChild(a.header)),a.header=null,a.left=-1,a.width=-1}}};this.listBinding=this.groupDataSource.createListBinding(f)},{initialize:function(){this.initializePromise&&this.initializePromise.cancel(),this._listView._writeProfilerMark("GroupsContainer_initialize,StartTM");var a=this;return this.initializePromise=this.groupDataSource.getCount().then(function(b){for(var d=[],e=0;b>e;e++)d.push(a.listBinding.fromIndex(e).retain());return c.join(d)}).then(function(b){a.groups=[];for(var c=0,d=b.length;d>c;c++){var e=b[c];a.groups.push({key:e.key,startIndex:e.firstItemIndexHint,handle:e.handle,userData:e})}a._listView._writeProfilerMark("GroupsContainer_initialize groups("+b.length+"),info"),a._listView._writeProfilerMark("GroupsContainer_initialize,StopTM")},function(b){return a._listView._writeProfilerMark("GroupsContainer_initialize,StopTM"),c.wrapError(b)}),this.initializePromise},renderGroup:function(a){if(this._listView.groupHeaderTemplate){var b=this.groups[a];return c.wrap(this._listView._groupHeaderRenderer(c.wrap(b.userData))).then(f._normalizeRendererReturn)}return c.wrap(null)},setDomElement:function(a,b){this.groups[a].header=b,this.notify(a,b)},removeElements:function(){for(var a=this._listView._groupsToRemove||{},b=Object.keys(a),c=!1,e=this._listView._selection._getFocused(),f=0,h=b.length;h>f;f++){var i=a[b[f]],j=i.header,k=i.group;if(c||e.type!==g.ObjectType.groupHeader||k.userData.index!==e.index||(this._listView._unsetFocusOnItem(),c=!0),j){var l=j.parentNode;l&&(d._disposeElement(j),l.removeChild(j))}}c&&this._listView._setFocusOnItem(e),this._listView._groupsToRemove={}},resetGroups:function(){for(var a=this.groups.slice(0),b=0,c=a.length;c>b;b++){var d=a[b];this.listBinding&&d.userData&&this.listBinding.releaseItem(d.userData)}this.groups.length=0,this.dirty=!0}})}),_NoGroups:b.Namespace._lazy(function(){return b.Class.derive(a._GroupsContainerBase,function(a){this._listView=a,this.groups=[{startIndex:0}],this.dirty=!0},{synchronizeGroups:function(){return c.wrap()},addItem:function(){return c.wrap(this.groups[0])},resetGroups:function(){this.groups=[{startIndex:0}],delete this.pinnedItem,delete this.pinnedOffset,this.dirty=!0},renderGroup:function(){return c.wrap(null)},ensureFirstGroup:function(){return c.wrap(this.groups[0])},groupOf:function(){return c.wrap(this.groups[0])},removeElements:function(){}})})})}),d("WinJS/Controls/ListView/_Helpers",["exports","../../Core/_Base","../ItemContainer/_Constants"],function(a,b,c){"use strict";function d(a){return Array.prototype.slice.call(a)}function e(a,b){if("string"==typeof a)return e([a],b);var c=new Array(Math.floor(b/a.length)+1).join(a.join(""));return c+=a.slice(0,b%a.length).join("")}function f(a,b){var d,f=c._containerEvenClass,g=c._containerOddClass,h=b%2===0?[f,g]:[g,f],i=["<div class='win-container "+h[0]+" win-backdrop'></div>","<div class='win-container "+h[1]+" win-backdrop'></div>"];return d=e(i,a)}b.Namespace._moduleDefine(a,"WinJS.UI",{_nodeListToArray:d,_repeat:e,_stripedContainers:f})}),d("WinJS/Controls/ListView/_ItemsContainer",["exports","../../Core/_Base","../../Promise","../../Utilities/_ElementUtilities","../ItemContainer/_Constants"],function(a,b,c,d,e){"use strict";b.Namespace._moduleDefine(a,"WinJS.UI",{_ItemsContainer:b.Namespace._lazy(function(){var a=function(a){this.site=a,this._itemData={},this.waitingItemRequests={}};return a.prototype={requestItem:function(a){this.waitingItemRequests[a]||(this.waitingItemRequests[a]=[]);var b=this,d=new c(function(c){var d=b._itemData[a];d&&!d.detached&&d.element?c(d.element):b.waitingItemRequests[a].push(c)});return d},removeItem:function(a){delete this._itemData[a]},removeItems:function(){this._itemData={},this.waitingItemRequests={}},setItemAt:function(a,b){this._itemData[a]=b,b.detached||this.notify(a,b)},notify:function(a,b){if(this.waitingItemRequests[a]){for(var c=this.waitingItemRequests[a],d=0;d<c.length;d++)c[d](b.element);this.waitingItemRequests[a]=[]}},elementAvailable:function(a){var b=this._itemData[a];b.detached=!1,this.notify(a,b)},itemAt:function(a){var b=this._itemData[a];return b?b.element:null},itemDataAt:function(a){return this._itemData[a]},containerAt:function(a){var b=this._itemData[a];return b?b.container:null},itemBoxAt:function(a){var b=this._itemData[a];return b?b.itemBox:null},itemBoxFrom:function(a){for(;a&&!d.hasClass(a,e._itemBoxClass);)a=a.parentNode;return a},containerFrom:function(a){for(;a&&!d.hasClass(a,e._containerClass);)a=a.parentNode;return a},index:function(a){var b=this.containerFrom(a);if(b)for(var c in this._itemData)if(this._itemData[c].container===b)return parseInt(c,10);return e._INVALID_INDEX},each:function(a){for(var b in this._itemData)if(this._itemData.hasOwnProperty(b)){var c=this._itemData[b];a(parseInt(b,10),c.element,c)}},eachIndex:function(a){for(var b in this._itemData)if(a(parseInt(b,10)))break},count:function(){return Object.keys(this._itemData).length}},a})})}),d("WinJS/Controls/ListView/_Layouts",["exports","../../Core/_Global","../../Core/_Base","../../Core/_BaseUtils","../../Core/_ErrorFromName","../../Core/_Resources","../../Core/_WriteProfilerMark","../../Animations/_TransitionAnimation","../../Promise","../../Scheduler","../../_Signal","../../Utilities/_Dispose","../../Utilities/_ElementUtilities","../../Utilities/_SafeHtml","../../Utilities/_UI","../ItemContainer/_Constants","./_ErrorMessages"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q){"use strict";function r(a){return"_win-dynamic-"+a+"-"+L++}function s(){var a,b,c,d=K.sheet.cssRules,e=M.length;for(a=0;e>a;a++)for(c="."+M[a]+" ",b=d.length-1;b>=0;b--)-1!==d[b].selectorText.indexOf(c)&&K.sheet.deleteRule(b);M=[]}function t(a,b,c,d){s();var e="."+p._listViewClass+" ."+a+" "+c+" { "+d+"}",f="_addDynamicCssRule:"+a+",info";b?b._writeProfilerMark(f):g("WinJS.UI.ListView:Layout"+f),K.sheet.insertRule(e,0)}function u(a){M.push(a)}function v(a,b,c){return Math.max(a,Math.min(b,c))}function w(a,b){return m.convertToPixels(a,m._getComputedStyle(a,null)[b])}function x(a,b){return w(b,"margin"+a)+w(b,"border"+a+"Width")+w(b,"padding"+a)}function y(a){return x("Top",a)+x("Bottom",a)}function z(a){return x("Left",a)+x("Right",a)}function A(a,b){if(a.items)for(var c=0,d=a.items.length;d>c;c++)b(a.items[c],c);else for(var e=0,f=0;e<a.itemsBlocks.length;e++)for(var g=a.itemsBlocks[e],c=0,d=g.items.length;d>c;c++)b(g.items[c],f++)}function B(a,b){if(0>b)return null;if(a.items)return b<a.items.length?a.items[b]:null;var c=a.itemsBlocks[0].items.length,d=Math.floor(b/c),e=b%c;return d<a.itemsBlocks.length&&e<a.itemsBlocks[d].items.length?a.itemsBlocks[d].items[e]:null}function C(a,b){for(var c,d=0,e=b.length;e>d;d++)if(b[d].itemsContainer.element===a){c=b[d].itemsContainer;break}return c}function D(a){var b,c;return a.itemsBlocks?(b=a.itemsBlocks.length,c=b>0?a.itemsBlocks[0].items.length*(b-1)+a.itemsBlocks[b-1].items.length:0):c=a.items.length,c}function E(a){if(!S){var c=b.document.createElement("div");c.style.width="500px",c.style.visibility="hidden";var d=b.document.createElement("div");d.style.cssText+="width: 500px; height: 200px; display: -webkit-flex; display: flex",n.setInnerHTMLUnsafe(d,"<div style='height: 100%; display: -webkit-flex; display: flex; flex-flow: column wrap; align-content: flex-start; -webkit-flex-flow: column wrap; -webkit-align-content: flex-start'><div style='width: 100px; height: 100px'></div><div style='width: 100px; height: 100px'></div><div style='width: 100px; height: 100px'></div></div>"),c.appendChild(d),a.viewport.insertBefore(c,a.viewport.firstChild);var e=c.offsetWidth>0,f=200;e&&(S={supportsCSSGrid:!!("-ms-grid-row"in b.document.documentElement.style),nestedFlexTooLarge:d.firstElementChild.offsetWidth>f,nestedFlexTooSmall:d.firstElementChild.offsetWidth<f}),a.readyToMeasure(),a.viewport.removeChild(c)}return S}function F(a){return i.is(a)?{realizedRangeComplete:a,layoutComplete:a}:"object"==typeof a&&a&&a.layoutComplete?a:{realizedRangeComplete:i.wrap(),layoutComplete:i.wrap()}}function G(a){return{left:w(a,"marginLeft"),right:w(a,"marginRight"),top:w(a,"marginTop"),bottom:w(a,"marginBottom")}}var H=m.Key,I=m._uniqueID,J={get itemInfoIsInvalid(){return"Invalid argument: An itemInfo function must be provided which returns an object with numeric width and height properties."},get groupInfoResultIsInvalid(){return"Invalid result: groupInfo result for cell spanning groups must include the following numeric properties: cellWidth and cellHeight."}},K=b.document.createElement("style");b.document.head.appendChild(K);var L=0,M=[],N=d._browserStyleEquivalents,O=N.transform,P=d._browserStyleEquivalents.transition.scriptName,Q=O.cssName+" cubic-bezier(0.1, 0.9, 0.2, 1) 167ms",R=12,S=null;c.Namespace._moduleDefine(a,"WinJS.UI",{Layout:c.Class.define(function(){}),_LayoutCommon:c.Namespace._lazy(function(){return c.Class.derive(a.Layout,null,{groupHeaderPosition:{enumerable:!0,get:function(){return this._groupHeaderPosition},set:function(a){this._groupHeaderPosition=a,this._invalidateLayout()}},initialize:function(a,b){a._writeProfilerMark("Layout:initialize,info"),this._inListMode||m.addClass(a.surface,p._gridLayoutClass),this._backdropColorClassName&&m.addClass(a.surface,this._backdropColorClassName),this._disableBackdropClassName&&m.addClass(a.surface,this._disableBackdropClassName),this._groups=[],this._groupMap={},this._oldGroupHeaderPosition=null,this._usingStructuralNodes=!1,this._site=a,this._groupsEnabled=b,this._resetAnimationCaches(!0)},orientation:{enumerable:!0,get:function(){return this._orientation},set:function(a){this._orientation=a,this._horizontal="horizontal"===a,this._invalidateLayout()}},uninitialize:function(){function a(a){var b,c=a.length;for(b=0;c>b;b++)a[b].cleanUp(!0)}var b="Layout:uninitialize,info";this._elementsToMeasure={},this._site?(this._site._writeProfilerMark(b),m.removeClass(this._site.surface,p._gridLayoutClass),m.removeClass(this._site.surface,p._headerPositionTopClass),m.removeClass(this._site.surface,p._headerPositionLeftClass),m.removeClass(this._site.surface,p._structuralNodesClass),m.removeClass(this._site.surface,p._singleItemsBlockClass),m.removeClass(this._site.surface,p._noCSSGrid),this._site.surface.style.cssText="",this._groups&&(a(this._groups),this._groups=null,this._groupMap=null),this._layoutPromise&&(this._layoutPromise.cancel(),this._layoutPromise=null),this._resetMeasurements(),this._oldGroupHeaderPosition=null,this._usingStructuralNodes=!1,this._envInfo=null,this._backdropColorClassName&&(m.removeClass(this._site.surface,this._backdropColorClassName),u(this._backdropColorClassName),this._backdropColorClassName=null),this._disableBackdropClassName&&(m.removeClass(this._site.surface,this._disableBackdropClassName),u(this._disableBackdropClassName),this._disableBackdropClassName=null),this._site=null,this._groupsEnabled=null,this._animationsRunning&&this._animationsRunning.cancel(),this._animatingItemsBlocks={}):g("WinJS.UI.ListView:"+b)},numberOfItemsPerItemsBlock:{get:function(){function b(){var a,b=c._site.groupCount;for(a=0;b>a;a++)if(c._isCellSpanning(a))return!1;return!0}var c=this;return c._measureItem(0).then(function(){return c._sizes.viewportContentSize!==c._getViewportCrossSize()&&c._viewportSizeChanged(c._getViewportCrossSize()),b()?c._envInfo.nestedFlexTooLarge||c._envInfo.nestedFlexTooSmall?(c._usingStructuralNodes=!0,Number.MAX_VALUE):(c._usingStructuralNodes=a._LayoutCommon._barsPerItemsBlock>0,a._LayoutCommon._barsPerItemsBlock*c._itemsPerBar):(c._usingStructuralNodes=!1,null)})}},layout:function(a,b,c,d){function e(a){function b(a){if(l._usingStructuralNodes){var b=[];return a.itemsBlocks.forEach(function(a){b=b.concat(a.items.slice(0))}),b}return a.items.slice(0)}return{element:a.element,items:b(a)}}function f(){function c(a,b){var c=a.enableCellSpanning?T.CellSpanningGroup:T.UniformGroup;return new c(l,b)}var d,f=l._groups.length>0?l._getRealizationRange():null,g=[],h=[],j={},k={},m=0,n=a.length;for(d=0;n>d;d++){var o=null,p=l._getGroupInfo(d),q=l._site.groupFromIndex(d).key,r=l._groupMap[q],s=r instanceof T.CellSpanningGroup,t=p.enableCellSpanning;if(r)if(s!==t)j[q]=!0;else{var u=Math.max(0,b.firstIndex-r.startIndex),v=l._rangeForGroup(r,f);v&&u<=v.lastIndex&&(o={firstIndex:Math.max(u,v.firstIndex),lastIndex:v.lastIndex})}var w,x=c(p,a[d].itemsContainer.element);w=x.prepareLayoutWithCopyOfTree?x.prepareLayoutWithCopyOfTree(e(a[d].itemsContainer),o,r,{groupInfo:p,startIndex:m}):x.prepareLayout(D(a[d].itemsContainer),o,r,{groupInfo:p,startIndex:m}),h.push(w),m+=x.count,g.push(x),k[q]=x}return i.join(h).then(function(){for(var a=0,b=0,c=g.length;c>b;b++){var d=g[b];d.offset=a,a+=l._getGroupSize(d)}Object.keys(l._groupMap).forEach(function(a){var b=!j[a];l._groupMap[a].cleanUp(b)}),l._groups=g,l._groupMap=k})}function g(a,c,d){var e,f=l._groups[a],g=Math.max(0,b.firstIndex-f.startIndex),h=l._rangeForGroup(f,c);return d?void f.layoutRealizedRange(g,h):(h||(e=f.startIndex+f.count-1<c.firstIndex),f.layoutUnrealizedRange(g,h,e))}function h(){if(0!==l._groups.length){var c,d=l._getRealizationRange(),e=a.length,f=n.groupIndexFromItemIndex(b.firstIndex);for(c=f;e>c;c++)g(c,d,!0),l._layoutGroup(c)}}function j(){if(0===l._groups.length)return i.wrap();var a=l._getRealizationRange(),c=n.groupIndexFromItemIndex(a.firstIndex-1),d=n.groupIndexFromItemIndex(a.lastIndex+1),e=n.groupIndexFromItemIndex(b.firstIndex),f=[],h=l._groups.length,j=!1,k=c,m=Math.max(e,d);for(m=Math.max(k+1,m);!j;)j=!0,k>=e&&(f.push(g(k,a,!1)),j=!1,k--),h>m&&(f.push(g(m,a,!1)),j=!1,m++);return i.join(f)}var k,l=this,n=l._site,o="Layout.layout",q=o+":realizedRange";return l._site._writeProfilerMark(o+",StartTM"),l._site._writeProfilerMark(q+",StartTM"),k=l._measureItem(0).then(function(){return m[l._usingStructuralNodes?"addClass":"removeClass"](l._site.surface,p._structuralNodesClass),m[l._envInfo.nestedFlexTooLarge||l._envInfo.nestedFlexTooSmall?"addClass":"removeClass"](l._site.surface,p._singleItemsBlockClass),l._sizes.viewportContentSize!==l._getViewportCrossSize()&&l._viewportSizeChanged(l._getViewportCrossSize()),l._cacheRemovedElements(c,l._cachedItemRecords,l._cachedInsertedItemRecords,l._cachedRemovedItems,!1),l._cacheRemovedElements(d,l._cachedHeaderRecords,l._cachedInsertedHeaderRecords,l._cachedRemovedHeaders,!0),f()}).then(function(){l._syncDomWithGroupHeaderPosition(a);var b=0;if(l._groups.length>0){var e=l._groups[l._groups.length-1];b=e.offset+l._getGroupSize(e)}l._horizontal?(l._groupsEnabled&&l._groupHeaderPosition===U.left?n.surface.style.cssText+=";height:"+l._sizes.surfaceContentSize+"px;-ms-grid-columns: ("+l._sizes.headerContainerWidth+"px auto)["+a.length+"]":n.surface.style.height=l._sizes.surfaceContentSize+"px",(l._envInfo.nestedFlexTooLarge||l._envInfo.nestedFlexTooSmall)&&(n.surface.style.width=b+"px")):(l._groupsEnabled&&l._groupHeaderPosition===U.top?n.surface.style.cssText+=";width:"+l._sizes.surfaceContentSize+"px;-ms-grid-rows: ("+l._sizes.headerContainerHeight+"px auto)["+a.length+"]":n.surface.style.width=l._sizes.surfaceContentSize+"px",(l._envInfo.nestedFlexTooLarge||l._envInfo.nestedFlexTooSmall)&&(n.surface.style.height=b+"px")),h(),l._layoutAnimations(c,d),l._site._writeProfilerMark(q+":complete,info"),l._site._writeProfilerMark(q+",StopTM")},function(a){return l._site._writeProfilerMark(q+":canceled,info"),l._site._writeProfilerMark(q+",StopTM"),i.wrapError(a)}),l._layoutPromise=k.then(function(){return j().then(function(){l._site._writeProfilerMark(o+":complete,info"),l._site._writeProfilerMark(o+",StopTM")},function(a){return l._site._writeProfilerMark(o+":canceled,info"),l._site._writeProfilerMark(o+",StopTM"),i.wrapError(a)})}),{realizedRangeComplete:k,layoutComplete:l._layoutPromise}},itemsFromRange:function(a,b){return this._rangeContainsItems(a,b)?{firstIndex:this._firstItemFromRange(a),lastIndex:this._lastItemFromRange(b)}:{firstIndex:0,lastIndex:-1}},getAdjacent:function(b,c){function d(){var a={type:b.type,index:b.index-g.startIndex},c=g.getAdjacent(a,h);if("boundary"===c){var d=e._groups[f-1],i=e._groups[f+1],j=e._groups.length-1;if(h===H.leftArrow){if(0===f)return b;if(d instanceof T.UniformGroup&&g instanceof T.UniformGroup){var k=e._indexToCoordinate(a.index),l=e._horizontal?k.row:k.column,m=Math.floor((d.count-1)/e._itemsPerBar),n=m*e._itemsPerBar;return{type:o.ObjectType.item,index:d.startIndex+Math.min(d.count-1,n+l)}}return{type:o.ObjectType.item,index:g.startIndex-1}}if(h===H.rightArrow){if(f===j)return b;if(g instanceof T.UniformGroup&&i instanceof T.UniformGroup){var k=e._indexToCoordinate(a.index),l=e._horizontal?k.row:k.column;return{type:o.ObjectType.item,index:i.startIndex+Math.min(i.count-1,l)}}return{type:o.ObjectType.item,index:i.startIndex}}return b}return c.index+=g.startIndex,c}var e=this,f=e._site.groupIndexFromItemIndex(b.index),g=e._groups[f],h=e._adjustedKeyForOrientationAndBars(e._adjustedKeyForRTL(c),g instanceof T.CellSpanningGroup);if(b.type||(b.type=o.ObjectType.item),b.type===o.ObjectType.item||c!==H.pageUp&&c!==H.pageDown){if(b.type===o.ObjectType.header&&h===H.rightArrow)return{type:e._groupsEnabled?o.ObjectType.groupHeader:o.ObjectType.footer,index:0};if(b.type===o.ObjectType.footer&&h===H.leftArrow)return{type:e._groupsEnabled?o.ObjectType.groupHeader:o.ObjectType.header,index:0};if(b.type===o.ObjectType.groupHeader){if(h===H.leftArrow){var i=b.index-1;return i=e._site.header?i:Math.max(0,i),{type:i>-1?o.ObjectType.groupHeader:o.ObjectType.header,index:i>-1?i:0}}if(h===H.rightArrow){var i=b.index+1;return i=e._site.header?i:Math.min(e._groups.length-1,b.index+1),{type:i>=e._groups.length?o.ObjectType.header:o.ObjectType.groupHeader,index:i>=e._groups.length?0:i}}return b}}else{var j=0;j=b.type===o.ObjectType.groupHeader?e._groups[b.index].startIndex:b.type===o.ObjectType.header?0:e._groups[e._groups.length-1].count-1,b={type:o.ObjectType.item,index:j}}switch(e._adjustedKeyForRTL(c)){case H.upArrow:case H.leftArrow:case H.downArrow:case H.rightArrow:return d();default:return a._LayoutCommon.prototype._getAdjacentForPageKeys.call(e,b,c)}},hitTest:function(a,b){var c,d=this._sizes;a-=d.layoutOriginX,b-=d.layoutOriginY;var e=this._groupFromOffset(this._horizontal?a:b),f=this._groups[e];return this._horizontal?a-=f.offset:b-=f.offset,this._groupsEnabled&&(this._groupHeaderPosition===U.left?a-=d.headerContainerWidth:b-=d.headerContainerHeight),c=f.hitTest(a,b),c.index+=f.startIndex,c.insertAfterIndex+=f.startIndex,c},setupAnimations:function(){if(0===this._groups.length)return void this._resetAnimationCaches();if(!Object.keys(this._cachedItemRecords).length){this._site._writeProfilerMark("Animation:setupAnimations,StartTM");for(var a=this._getRealizationRange(),b=this._site.tree,c=0,d="horizontal"===this.orientation,e=0,f=b.length;f>e;e++){var g=b[e],h=!1,i=this._groups[e],j=i instanceof T.CellSpanningGroup,k=i?i.offset:0;if(A(g.itemsContainer,function(b,d){if(a.firstIndex<=c&&a.lastIndex>=c&&(h=!0,!this._cachedItemRecords[c])){var f=this._getItemPositionForAnimations(c,e,d),g=f.row,i=f.column,k=f.left,l=f.top;this._cachedItemRecords[c]={oldRow:g,oldColumn:i,oldLeft:k,oldTop:l,width:f.width,height:f.height,element:b,inCellSpanningGroup:j}}c++}.bind(this)),h){var l=e;if(!this._cachedHeaderRecords[l]){var m=this._getHeaderPositionForAnimations(l);this._cachedHeaderRecords[l]={oldLeft:m.left,oldTop:m.top,width:m.width,height:m.height,element:g.header}}this._cachedGroupRecords[I(g.itemsContainer.element)]||(this._cachedGroupRecords[I(g.itemsContainer.element)]={oldLeft:d?k:0,left:d?k:0,oldTop:d?0:k,top:d?0:k,element:g.itemsContainer.element})}}this._site._writeProfilerMark("Animation:setupAnimations,StopTM")}},_layoutAnimations:function(a,b){if(Object.keys(this._cachedItemRecords).length||Object.keys(this._cachedGroupRecords).length||Object.keys(this._cachedHeaderRecords).length){this._site._writeProfilerMark("Animation:layoutAnimation,StartTM"),this._updateAnimationCache(a,b);for(var c=this._getRealizationRange(),d=this._site.tree,e=0,f="horizontal"===this.orientation,g=0,h=d.length;h>g;g++){var i=d[g],j=this._groups[g],k=j instanceof T.CellSpanningGroup,l=j?j.offset:0,n=0,o=0,q=this._cachedGroupRecords[I(i.itemsContainer.element)];q&&(f?n=q.oldLeft-l:o=q.oldTop-l),A(i.itemsContainer,function(a,b){if(c.firstIndex<=e&&c.lastIndex>=e){var d=this._cachedItemRecords[e];if(d){var f=this._getItemPositionForAnimations(e,g,b),h=f.row,i=f.column,j=f.left,l=f.top;if(d.inCellSpanningGroup=d.inCellSpanningGroup||k,d.oldRow!==h||d.oldColumn!==i||d.oldTop!==l||d.oldLeft!==j){d.row=h,d.column=i,d.left=j,d.top=l;var q=d.oldLeft-d.left-n,r=d.oldTop-d.top-o;if(q=(this._site.rtl?-1:1)*q,d.xOffset=q,d.yOffset=r,0!==q||0!==r){var s=d.element;d.needsToResetTransform=!0,s.style[P]="",s.style[O.scriptName]="translate("+q+"px,"+r+"px)"}var t=a.parentNode;m.hasClass(t,p._itemsBlockClass)&&(this._animatingItemsBlocks[I(t)]=t)}}else this._cachedInsertedItemRecords[e]=a,a.style[P]="",a.style.opacity=0}e++}.bind(this));var r=g,s=this._cachedHeaderRecords[r];if(s){var t=this._getHeaderPositionForAnimations(r);if(s.height=t.height,s.width=t.width,s.oldLeft!==t.left||s.oldTop!==t.top){s.left=t.left,s.top=t.top;var u=s.oldLeft-s.left,v=s.oldTop-s.top;if(u=(this._site.rtl?-1:1)*u,0!==u||0!==v){s.needsToResetTransform=!0;var w=s.element;w.style[P]="",w.style[O.scriptName]="translate("+u+"px,"+v+"px)"}}}if(q&&(f&&q.left!==l||!f&&q.top!==l)){var x=q.element;if(0===n&&0===o)q.needsToResetTransform&&(q.needsToResetTransform=!1,x.style[O.scriptName]="");else{var y=(this._site.rtl?-1:1)*n,z=o;q.needsToResetTransform=!0,x.style[P]="",x.style[O.scriptName]="translate("+y+"px, "+z+"px)"}}}if(this._inListMode||1===this._itemsPerBar)for(var B=Object.keys(this._animatingItemsBlocks),C=0,D=B.length;D>C;C++)this._animatingItemsBlocks[B[C]].style.overflow="visible";this._site._writeProfilerMark("Animation:layoutAnimation,StopTM")}},executeAnimations:function(){function b(){if(e(),H)f();else{if(ba._itemsPerBar>1)for(var a=ba._itemsPerBar*ba._sizes.containerCrossSize+ba._getHeaderSizeContentAdjustment()+ba._sizes.containerMargins[U?"top":v.rtl?"right":"left"]+(U?ba._sizes.layoutOriginY:ba._sizes.layoutOriginX),b=0,c=y.length;c>b;b++){var d=y[b];d[V]>d[W]?(N=Math.max(N,d[X]+d[U?"height":"width"]),R=Math.max(R,a-d[Y]),J=!0,T.push(d)):d[V]<d[W]&&(Q=Math.max(Q,a-d[X]),S=Math.max(S,d[Y]+d[U?"height":"width"]),T.push(d),J=!0)}v.rtl&&!U&&(N*=-1,R*=-1,Q*=-1,S*=-1),J?j(ba._itemsPerBar):q()}}function c(b){F=i.join(G),F.done(function(){G=[],t&&(a.Layout._debugAnimations?d._requestAnimationFrame(function(){b()}):b())})}function e(){if(x.length){v._writeProfilerMark("Animation:setupRemoveAnimation,StartTM"),B+=60,E+=60;var a=120;u&&(a*=10),G.push(h.executeTransition(x,[{property:"opacity",delay:A,duration:a,timing:"linear",to:0,skipStylesReset:!0}])),v._writeProfilerMark("Animation:setupRemoveAnimation,StopTM")}}function f(){v._writeProfilerMark("Animation:cellSpanningFadeOutMove,StartTM");for(var a=[],b=0,d=y.length;d>b;b++){var e=y[b],f=e.element;a.push(f)}for(var b=0,d=z.length;d>b;b++){var e=z[b],f=e.element;a.push(f)}var i=120;u&&(i*=10),G.push(h.executeTransition(a,{property:"opacity",delay:A,duration:i,timing:"linear",to:0})),c(g),v._writeProfilerMark("Animation:cellSpanningFadeOutMove,StopTM")}function g(){v._writeProfilerMark("Animation:cellSpanningFadeInMove,StartTM"),E=0;for(var a=[],b=0,c=y.length;c>b;b++){var d=y[b],e=d.element;e.style[O.scriptName]="",a.push(e)}for(var b=0,c=z.length;c>b;b++){var d=z[b],e=d.element;e.style[O.scriptName]="",a.push(e)}var f=120;u&&(f*=10),G.push(h.executeTransition(a,{property:"opacity",delay:E,duration:f,timing:"linear",to:1})),v._writeProfilerMark("Animation:cellSpanningFadeInMove,StopTM"),r()}function j(a){v._writeProfilerMark("Animation:setupReflowAnimation,StartTM");for(var b={},d=0,e=T.length;e>d;d++){var f=T[d],g=f.xOffset,i=f.yOffset;f[V]>f[W]?U?i-=N:g-=N:f[V]<f[W]&&(U?i+=Q:g+=Q);var j=f.element;K=Math.min(K,U?g:i),L=Math.max(L,U?g:i);var k=j.parentNode;m.hasClass(k,"win-itemscontainer")||(k=k.parentNode);var l=b[I(k)];if(!l){var n=D(C(k,v.tree));b[I(k)]=l=Math.ceil(n/a)-1}T[d][U?"column":"row"]===l&&(M[I(k)]=k);var q=80;u&&(q*=10),G.push(h.executeTransition(j,{property:O.cssName,delay:B,duration:q,timing:"cubic-bezier(0.1, 0.9, 0.2, 1)",to:"translate("+g+"px,"+i+"px)"}))}for(var r=Object.keys(M),d=0,e=r.length;e>d;d++){var s=M[r[d]];v.rtl&&U?(s.style.paddingLeft=-1*K+"px",s.style.marginLeft=K+"px"):(s.style[U?"paddingRight":"paddingBottom"]=L+"px",s.style[U?"marginRight":"marginBottom"]="-"+L+"px")}for(var t=Object.keys(Z),d=0,e=t.length;e>d;d++)Z[t[d]].classList.add(p._clipClass);c(o),v._writeProfilerMark("Animation:setupReflowAnimation,StopTM")}function n(){for(var a=Object.keys(M),b=0,c=a.length;c>b;b++){var d=M[a[b]];v.rtl&&U?(d.style.paddingLeft="",d.style.marginLeft=""):(d.style[U?"paddingRight":"paddingBottom"]="",d.style[U?"marginRight":"marginBottom"]="")}M={};for(var e=Object.keys(Z),b=0,c=e.length;c>b;b++){var f=Z[e[b]];f.style.overflow="",f.classList.remove(p._clipClass)}}function o(){v._writeProfilerMark("Animation:prepareReflowedItems,StartTM");for(var b=0,c=T.length;c>b;b++){var e=T[b],f=0,g=0;e[V]>e[W]?U?g=R:f=R:e[V]<e[W]&&(U?g=-1*S:f=-1*S),e.element.style[P]="",e.element.style[O.scriptName]="translate("+f+"px,"+g+"px)"}v._writeProfilerMark("Animation:prepareReflowedItems,StopTM"),a.Layout._debugAnimations?d._requestAnimationFrame(function(){q(!0)}):q(!0)}function q(a){var b=200;if(a&&(b=150,B=0,E=0),u&&(b*=10),y.length>0||z.length>0){v._writeProfilerMark("Animation:setupMoveAnimation,StartTM");for(var c=[],d=0,e=z.length;e>d;d++){var f=z[d].element;c.push(f)}for(var d=0,e=y.length;e>d;d++){var f=y[d].element;c.push(f)}G.push(h.executeTransition(c,{property:O.cssName,delay:B,duration:b,timing:"cubic-bezier(0.1, 0.9, 0.2, 1)",to:""})),E+=80,v._writeProfilerMark("Animation:setupMoveAnimation,StopTM")}r()}function r(){if(w.length>0){v._writeProfilerMark("Animation:setupInsertAnimation,StartTM");var a=120;u&&(a*=10),G.push(h.executeTransition(w,[{property:"opacity",delay:E,duration:a,timing:"linear",to:1}])),v._writeProfilerMark("Animation:setupInsertAnimation,StopTM")}c(s)}function s(){v._writeProfilerMark("Animation:cleanupAnimations,StartTM"),n();for(var a=0,b=x.length;b>a;a++){var c=x[a];c.parentNode&&(l._disposeElement(c),c.parentNode.removeChild(c))}v._writeProfilerMark("Animation:cleanupAnimations,StopTM"),ba._animationsRunning=null,t.complete()}var t=new k;if(this._filterInsertedElements(),this._filterMovedElements(),this._filterRemovedElements(),0===this._insertedElements.length&&0===this._removedElements.length&&0===this._itemMoveRecords.length&&0===this._moveRecords.length)return this._resetAnimationCaches(!0),t.complete(),t.promise;this._animationsRunning=t.promise;for(var u=a.Layout._debugAnimations||a.Layout._slowAnimations,v=this._site,w=this._insertedElements,x=this._removedElements,y=this._itemMoveRecords,z=this._moveRecords,A=0,B=0,E=0,F=null,G=[],H=!1,J=!1,K=0,L=0,M={},N=0,Q=0,R=0,S=0,T=[],U="horizontal"===this.orientation,V=U?"oldColumn":"oldRow",W=U?"column":"row",X=U?"oldTop":"oldLeft",Y=U?"top":"left",Z=this._animatingItemsBlocks,$=0,_=y.length;_>$;$++){var aa=y[$];if(aa.inCellSpanningGroup){H=!0;break}}var ba=this;return a.Layout._debugAnimations?d._requestAnimationFrame(function(){b()}):b(),this._resetAnimationCaches(!0),t.promise.then(null,function(){n();for(var a=0,b=z.length;b>a;a++){var c=z[a].element;c.style[O.scriptName]="",c.style.opacity=1}for(var a=0,b=y.length;b>a;a++){var c=y[a].element;c.style[O.scriptName]="",c.style.opacity=1}for(var a=0,b=w.length;b>a;a++)w[a].style.opacity=1;for(var a=0,b=x.length;b>a;a++){var c=x[a];c.parentNode&&(l._disposeElement(c),c.parentNode.removeChild(c))}this._animationsRunning=null,t=null,F&&F.cancel()}.bind(this)),t.promise},dragOver:function(a,b,c){var d=this.hitTest(a,b),e=this._groups?this._site.groupIndexFromItemIndex(d.index):0,f=this._site.tree[e].itemsContainer,g=D(f),h=this._groups?this._groups[e].startIndex:0,i=this._getVisibleRange();d.index-=h,d.insertAfterIndex-=h,i.firstIndex=Math.max(i.firstIndex-h-1,0),
i.lastIndex=Math.min(i.lastIndex-h+1,g);var j=Math.max(Math.min(g-1,d.insertAfterIndex),-1),k=Math.min(j+1,g);if(c){for(var l=j;l>=i.firstIndex;l--){if(!c._isIncluded(l+h)){j=l;break}l===i.firstIndex&&(j=-1)}for(var l=k;l<i.lastIndex;l++){if(!c._isIncluded(l+h)){k=l;break}l===i.lastIndex-1&&(k=g)}}var m=B(f,k),n=B(f,j);if(this._animatedDragItems)for(var l=0,o=this._animatedDragItems.length;o>l;l++){var p=this._animatedDragItems[l];p&&(p.style[P]=this._site.animationsDisabled?"":Q,p.style[O.scriptName]="")}this._animatedDragItems=[];var q="horizontal"===this.orientation,r=this._inListMode||1===this._itemsPerBar;this._groups&&this._groups[e]instanceof T.CellSpanningGroup&&(r=1===this._groups[e]._slotsPerColumn);var s=0,t=0;!q&&!r||q&&r?s=this._site.rtl?-R:R:t=R,m&&(m.style[P]=this._site.animationsDisabled?"":Q,m.style[O.scriptName]="translate("+s+"px, "+t+"px)",this._animatedDragItems.push(m)),n&&(n.style[P]=this._site.animationsDisabled?"":Q,n.style[O.scriptName]="translate("+-s+"px, -"+t+"px)",this._animatedDragItems.push(n))},dragLeave:function(){if(this._animatedDragItems)for(var a=0,b=this._animatedDragItems.length;b>a;a++)this._animatedDragItems[a].style[P]=this._site.animationsDisabled?"":Q,this._animatedDragItems[a].style[O.scriptName]="";this._animatedDragItems=[]},_setMaxRowsOrColumns:function(a){a===this._maxRowsOrColumns||this._inListMode||(this._sizes&&this._sizes.containerSizeLoaded&&(this._itemsPerBar=Math.floor(this._sizes.maxItemsContainerContentSize/this._sizes.containerCrossSize),a&&(this._itemsPerBar=Math.min(this._itemsPerBar,a)),this._itemsPerBar=Math.max(1,this._itemsPerBar)),this._maxRowsOrColumns=a,this._invalidateLayout())},_getItemPosition:function(a){if(this._groupsEnabled){var b=Math.min(this._groups.length-1,this._site.groupIndexFromItemIndex(a)),c=this._groups[b],d=a-c.startIndex;return this._getItemPositionForAnimations(a,b,d)}return this._getItemPositionForAnimations(a,0,a)},_getRealizationRange:function(){var a=this._site.realizedRange;return{firstIndex:this._firstItemFromRange(a.firstPixel),lastIndex:this._lastItemFromRange(a.lastPixel)}},_getVisibleRange:function(){var a=this._site.visibleRange;return{firstIndex:this._firstItemFromRange(a.firstPixel),lastIndex:this._lastItemFromRange(a.lastPixel)}},_resetAnimationCaches:function(a){if(!a){this._resetStylesForRecords(this._cachedGroupRecords),this._resetStylesForRecords(this._cachedItemRecords),this._resetStylesForRecords(this._cachedHeaderRecords),this._resetStylesForInsertedRecords(this._cachedInsertedItemRecords),this._resetStylesForInsertedRecords(this._cachedInsertedHeaderRecords),this._resetStylesForRemovedRecords(this._cachedRemovedItems),this._resetStylesForRemovedRecords(this._cachedRemovedHeaders);for(var b=Object.keys(this._animatingItemsBlocks),c=0,d=b.length;d>c;c++){var e=this._animatingItemsBlocks[b[c]];e.style.overflow="",e.classList.remove(p._clipClass)}}this._cachedGroupRecords={},this._cachedItemRecords={},this._cachedHeaderRecords={},this._cachedInsertedItemRecords={},this._cachedInsertedHeaderRecords={},this._cachedRemovedItems=[],this._cachedRemovedHeaders=[],this._animatingItemsBlocks={}},_cacheRemovedElements:function(a,b,c,d,e){var f="left";this._site.rtl&&(f="right");var g,h;e?(g=this._sizes.headerContainerOuterX,h=this._sizes.headerContainerOuterY):(g=this._sizes.containerMargins[f],h=this._sizes.containerMargins.top);for(var i=0,j=a.length;j>i;i++){var k=a[i];if(-1===k.newIndex){var l=k.element,m=b[k.oldIndex];m&&(m.element=l,delete b[k.oldIndex],l.style.position="absolute",l.style[P]="",l.style.top=m.oldTop-h+"px",l.style[f]=m.oldLeft-g+"px",l.style.width=m.width+"px",l.style.height=m.height+"px",l.style[O.scriptName]="",this._site.surface.appendChild(l),d.push(m)),c[k.oldIndex]&&delete c[k.oldIndex]}}},_cacheInsertedElements:function(a,b,c){for(var d={},e=0,f=a.length;f>e;e++){var g=a[e],h=b[g.oldIndex];if(h&&delete b[g.oldIndex],h||-1===g.oldIndex||g.moved){var i=c[g.newIndex];i&&delete c[g.newIndex];var j=g.element;d[g.newIndex]=j,j.style[P]="",j.style[O.scriptName]="",j.style.opacity=0}}for(var k=Object.keys(b),e=0,f=k.length;f>e;e++)d[k[e]]=b[k[e]];return d},_resetStylesForRecords:function(a){for(var b=Object.keys(a),c=0,d=b.length;d>c;c++){var e=a[b[c]];e.needsToResetTransform&&(e.element.style[O.scriptName]="",e.needsToResetTransform=!1)}},_resetStylesForInsertedRecords:function(a){for(var b=Object.keys(a),c=0,d=b.length;d>c;c++){var e=a[b[c]];e.style.opacity=1}},_resetStylesForRemovedRecords:function(a){for(var b=0,c=a.length;c>b;b++){var d=a[b].element;d.parentNode&&(l._disposeElement(d),d.parentNode.removeChild(d))}},_updateAnimationCache:function(a,b){function c(a,b){for(var c={},e=0,f=a.length;f>e;e++){var g=a[e],h=b[g.oldIndex];h&&(c[g.newIndex]=h,h.element=g.element,delete b[g.oldIndex])}for(var i=Object.keys(b),e=0,f=i.length;f>e;e++){var j=i[e],k=b[j];(!k.element||d[I(k.element)])&&(c[j]=k)}return c}this._resetStylesForRecords(this._cachedItemRecords),this._resetStylesForRecords(this._cachedHeaderRecords),this._resetStylesForInsertedRecords(this._cachedInsertedItemRecords),this._resetStylesForInsertedRecords(this._cachedInsertedHeaderRecords);for(var d={},e=this._getRealizationRange(),f=this._site.tree,g=0,h=0,i=f.length;i>g;g++)A(f[g].itemsContainer,function(a){e.firstIndex<=h&&e.lastIndex>=h&&(d[I(a)]=!0),h++});this._cachedItemRecords=c(a,this._cachedItemRecords),this._cachedHeaderRecords=c(b,this._cachedHeaderRecords),this._cachedInsertedItemRecords=this._cacheInsertedElements(a,this._cachedInsertedItemRecords,this._cachedItemRecords),this._cachedInsertedHeaderRecords=this._cacheInsertedElements(b,this._cachedInsertedHeaderRecords,this._cachedHeaderRecords)},_filterRemovedElements:function(){function a(a,g){for(var h=0,i=a.length;i>h;h++){var j=a[h],k=j.element;j[c]+j[d]-1<e||j[c]>f||!b._site.viewport.contains(k)?k.parentNode&&(l._disposeElement(k),k.parentNode.removeChild(k)):g.push(k)}}if(this._removedElements=[],this._site.animationsDisabled)return this._resetStylesForRemovedRecords(this._cachedRemovedItems),void this._resetStylesForRemovedRecords(this._cachedRemovedHeaders);var b=this,c="horizontal"===this.orientation?"oldLeft":"oldTop",d="horizontal"===this.orientation?"width":"height",e=this._site.scrollbarPos,f=e+this._site.viewportSize[d]-1;a(this._cachedRemovedItems,this._removedElements),a(this._cachedRemovedHeaders,this._removedElements)},_filterInsertedElements:function(){function a(a,d){for(var e=Object.keys(a),f=0,g=e.length;g>f;f++){var h=e[f],i=a[h];h<c.firstIndex||h>c.lastIndex||b._site.viewport.contains(i.element)?i.style.opacity=1:d.push(i)}}if(this._insertedElements=[],this._site.animationsDisabled)return this._resetStylesForInsertedRecords(this._cachedInsertedItemRecords),void this._resetStylesForInsertedRecords(this._cachedInsertedHeaderRecords);var b=this,c=this._getVisibleRange();a(this._cachedInsertedItemRecords,this._insertedElements),a(this._cachedInsertedHeaderRecords,this._insertedElements)},_filterMovedElements:function(){var a=this,b="horizontal"===this.orientation?"oldLeft":"oldTop",c="horizontal"===this.orientation?"left":"top",d="horizontal"===this.orientation?"width":"height",e=this._getRealizationRange(),f=this._site.scrollbarPos,g=f+this._site.viewportSize[d]-1;if(this._itemMoveRecords=[],this._moveRecords=[],!this._site.animationsDisabled)for(var h=this._site.tree,i=0,j=0,k=h.length;k>j;j++){var l=h[j],m=!1;A(l.itemsContainer,function(){if(e.firstIndex<=i&&e.lastIndex>=i){var h=this._cachedItemRecords[i];if(h){var j=(h[b]+h[d]-1>=f&&h[b]<=g||h[c]+h[d]-1>=f&&h[c]<=g)&&a._site.viewport.contains(h.element);j&&(m=!0,h.needsToResetTransform&&(this._itemMoveRecords.push(h),delete this._cachedItemRecords[i]))}}i++}.bind(this));var n=j,o=this._cachedHeaderRecords[n];o&&m&&o.needsToResetTransform&&(this._moveRecords.push(o),delete this._cachedHeaderRecords[n]);var p=this._cachedGroupRecords[I(l.itemsContainer.element)];p&&m&&p.needsToResetTransform&&(this._moveRecords.push(p),delete this._cachedGroupRecords[I(l.itemsContainer.element)])}this._resetStylesForRecords(this._cachedGroupRecords),this._resetStylesForRecords(this._cachedItemRecords),this._resetStylesForRecords(this._cachedHeaderRecords)},_getItemPositionForAnimations:function(a,b,c){var d=this._groups[b],e=d.getItemPositionForAnimations(c),f=this._groups[b]?this._groups[b].offset:0,g=this._groupsEnabled&&this._groupHeaderPosition===U.left?this._sizes.headerContainerWidth:0,h=this._groupsEnabled&&this._groupHeaderPosition===U.top?this._sizes.headerContainerHeight:0;return e.left+=this._sizes.layoutOriginX+g+this._sizes.itemsContainerOuterX,e.top+=this._sizes.layoutOriginY+h+this._sizes.itemsContainerOuterY,e[this._horizontal?"left":"top"]+=f,e},_getHeaderPositionForAnimations:function(a){var b;if(this._groupsEnabled){var c=this._sizes.headerContainerWidth-this._sizes.headerContainerOuterWidth,d=this._sizes.headerContainerHeight-this._sizes.headerContainerOuterHeight;this._groupHeaderPosition!==U.left||this._horizontal?this._groupHeaderPosition===U.top&&this._horizontal&&(c=this._groups[a].getItemsContainerSize()-this._sizes.headerContainerOuterWidth):d=this._groups[a].getItemsContainerSize()-this._sizes.headerContainerOuterHeight;var e=this._horizontal?this._groups[a].offset:0,f=this._horizontal?0:this._groups[a].offset;b={top:this._sizes.layoutOriginY+f+this._sizes.headerContainerOuterY,left:this._sizes.layoutOriginX+e+this._sizes.headerContainerOuterX,height:d,width:c}}else b={top:0,left:0,height:0,width:0};return b},_rangeContainsItems:function(a,b){if(0===this._groups.length)return!1;var c=this._groups[this._groups.length-1],d=this._sizes.layoutOrigin+c.offset+this._getGroupSize(c)-1;return b>=0&&d>=a},_itemFromOffset:function(a,b){function c(a){if(!b.wholeItem){var c=e._horizontal?e._site.rtl?"right":"left":"top",d=e._horizontal?e._site.rtl?"left":"right":"bottom";return b.last?a-e._sizes.containerMargins[c]:a+e._sizes.containerMargins[d]}return a}function d(a){return b.last?a-e._getHeaderSizeGroupAdjustment()-e._sizes.itemsContainerOuterStart:a}var e=this;if(0===this._groups.length)return 0;b=b||{},a-=this._sizes.layoutOrigin,a=c(a);var f=this._groupFromOffset(d(a)),g=this._groups[f];return a-=g.offset,a-=this._getHeaderSizeGroupAdjustment(),g.startIndex+g.itemFromOffset(a,b)},_firstItemFromRange:function(a,b){return b=b||{},b.last=0,this._itemFromOffset(a,b)},_lastItemFromRange:function(a,b){return b=b||{},b.last=1,this._itemFromOffset(a,b)},_adjustedKeyForRTL:function(a){return this._site.rtl&&(a===H.leftArrow?a=H.rightArrow:a===H.rightArrow&&(a=H.leftArrow)),a},_adjustedKeyForOrientationAndBars:function(a,b){var c=a;if(b)return a;if(!this._horizontal)switch(c){case H.leftArrow:c=H.upArrow;break;case H.rightArrow:c=H.downArrow;break;case H.upArrow:c=H.leftArrow;break;case H.downArrow:c=H.rightArrow}return 1===this._itemsPerBar&&(c===H.upArrow?c=H.leftArrow:c===H.downArrow&&(c=H.rightArrow)),c},_getAdjacentForPageKeys:function(a,b){var c,d=this._sizes.containerMargins,e="horizontal"===this.orientation?d.left+d.right:d.top+d.bottom,f=this._site.viewportSize["horizontal"===this.orientation?"width":"height"],g=this._site.scrollbarPos,h=g+f-1-d["horizontal"===this.orientation?"right":"bottom"],i=this._firstItemFromRange(g,{wholeItem:!0}),j=this._lastItemFromRange(h,{wholeItem:!1}),k=this._getItemPosition(a.index),l=!1;if((a.index<i||a.index>j)&&(l=!0,g="horizontal"===this.orientation?k.left-e:k.top-e,h=g+f-1,i=this._firstItemFromRange(g,{wholeItem:!0}),j=this._lastItemFromRange(h,{wholeItem:!1})),b===H.pageUp){if(!l&&i!==a.index)return{type:o.ObjectType.item,index:i};var m;m="horizontal"===this.orientation?k.left+k.width+e+d.left:k.top+k.height+e+d.bottom;var n=this._firstItemFromRange(m-f,{wholeItem:!0});c=a.index===n?Math.max(0,a.index-this._itemsPerBar):n}else{if(!l&&j!==a.index)return{type:o.ObjectType.item,index:j};var p;p="horizontal"===this.orientation?k.left-e-d.right:k.top-e-d.bottom;var q=Math.max(0,this._lastItemFromRange(p+f-1,{wholeItem:!0}));c=a.index===q?a.index+this._itemsPerBar:q}return{type:o.ObjectType.item,index:c}},_isCellSpanning:function(a){var b=this._site.groupFromIndex(a),c=this._groupInfo;return c?!!("function"==typeof c?c(b):c).enableCellSpanning:!1},_getGroupInfo:function(a){var b=this._site.groupFromIndex(a),c=this._groupInfo,d=this._sizes.containerMargins,f={enableCellSpanning:!1};if(c="function"==typeof c?c(b):c){if(c.enableCellSpanning&&(+c.cellWidth!==c.cellWidth||+c.cellHeight!==c.cellHeight))throw new e("WinJS.UI.GridLayout.GroupInfoResultIsInvalid",J.groupInfoResultIsInvalid);f={enableCellSpanning:!!c.enableCellSpanning,cellWidth:c.cellWidth+d.left+d.right,cellHeight:c.cellHeight+d.top+d.bottom}}return f},_getItemInfo:function(a){var b;if(this._itemInfo&&"function"==typeof this._itemInfo)b=this._itemInfo(a);else{if(!this._useDefaultItemInfo)throw new e("WinJS.UI.GridLayout.ItemInfoIsInvalid",J.itemInfoIsInvalid);b=this._defaultItemInfo(a)}return i.as(b).then(function(a){if(!a||+a.width!==a.width||+a.height!==a.height)throw new e("WinJS.UI.GridLayout.ItemInfoIsInvalid",J.itemInfoIsInvalid);return a})},_defaultItemInfo:function(a){var b=this;return this._site.renderItem(this._site.itemFromIndex(a)).then(function(c){return b._elementsToMeasure[a]={element:c},b._measureElements()}).then(function(){var c=b._elementsToMeasure[a],d={width:c.width,height:c.height};return delete b._elementsToMeasure[a],d},function(c){return delete b._elementsToMeasure[a],i.wrapError(c)})},_getGroupSize:function(a){var b=0;return this._groupsEnabled&&(this._horizontal&&this._groupHeaderPosition===U.top?b=this._sizes.headerContainerMinWidth:this._horizontal||this._groupHeaderPosition!==U.left||(b=this._sizes.headerContainerMinHeight)),Math.max(b,a.getItemsContainerSize()+this._getHeaderSizeGroupAdjustment())},_groupFromOffset:function(a){return a<this._groups[0].offset?0:this._groupFrom(function(b){return a<b.offset})},_groupFromImpl:function(a,b,c){if(a>b)return null;var d=a+Math.floor((b-a)/2),e=this._groups[d];return c(e,d)?this._groupFromImpl(a,d-1,c):b>d&&!c(this._groups[d+1],d+1)?this._groupFromImpl(d+1,b,c):d},_groupFrom:function(a){if(this._groups.length>0){var b=this._groups.length-1,c=this._groups[b];return a(c,b)?this._groupFromImpl(0,this._groups.length-1,a):b}return null},_invalidateLayout:function(){this._site&&this._site.invalidateLayout()},_resetMeasurements:function(){this._measuringPromise&&(this._measuringPromise.cancel(),this._measuringPromise=null),this._containerSizeClassName&&(m.removeClass(this._site.surface,this._containerSizeClassName),u(this._containerSizeClassName),this._containerSizeClassName=null),this._sizes=null,this._resetAnimationCaches()},_measureElements:function(){if(!this._measuringElements){var a=this;a._measuringElements=j.schedulePromiseHigh(null,"WinJS.UI.GridLayout._measuringElements").then(function(){a._site._writeProfilerMark("_measureElements,StartTM");var c=a._createMeasuringSurface(),d=b.document.createElement("div"),e=a._site,f=a._measuringElements,g=a._elementsToMeasure,h=!1;d.className=p._itemsContainerClass+" "+p._laidOutClass,d.style.cssText+=";display: -ms-grid;-ms-grid-column: 1;-ms-grid-row: 1";var i,j,k=Object.keys(g);for(j=0,i=k.length;i>j;j++){var l=g[k[j]].element;l.style["-ms-grid-column"]=j+1,l.style["-ms-grid-row"]=j+1,d.appendChild(l)}for(c.appendChild(d),e.viewport.insertBefore(c,e.viewport.firstChild),f.then(null,function(){h=!0}),j=0,i=k.length;i>j&&!h;j++){var n=g[k[j]],o=n.element.querySelector("."+p._itemClass);n.width=m.getTotalWidth(o),n.height=m.getTotalHeight(o)}c.parentNode&&c.parentNode.removeChild(c),f===a._measuringElements&&(a._measuringElements=null),e._writeProfilerMark("_measureElements,StopTM")},function(b){return a._measuringElements=null,i.wrapError(b)})}return this._measuringElements},_ensureEnvInfo:function(){return this._envInfo||(this._envInfo=E(this._site),this._envInfo&&!this._envInfo.supportsCSSGrid&&m.addClass(this._site.surface,p._noCSSGrid)),!!this._envInfo},_createMeasuringSurface:function(){var a=b.document.createElement("div");return a.style.cssText="visibility: hidden;-ms-grid-columns: auto;-ms-grid-rows: auto;-ms-flex-align: start;-webkit-align-items: flex-start;align-items: flex-start",a.className=p._scrollableClass+" "+(this._inListMode?p._listLayoutClass:p._gridLayoutClass),this._envInfo.supportsCSSGrid||m.addClass(a,p._noCSSGrid),this._groupsEnabled&&(this._groupHeaderPosition===U.top?m.addClass(a,p._headerPositionTopClass):m.addClass(a,p._headerPositionLeftClass)),a},_measureItem:function(a){function c(a,e){var e,h=!!e,j={},k=f.rtl?"right":"left";return f.itemCount.then(function(b){return!b||d._groupsEnabled&&!f.groupCount?i.cancel:(e=e||f.itemFromIndex(a),j.container=f.renderItem(e),d._groupsEnabled&&(j.headerContainer=f.renderHeader(d._site.groupFromIndex(f.groupIndexFromItemIndex(a)))),i.join(j))}).then(function(j){function l(){var a=d._horizontal,b=d._groupsEnabled,c=!1;g.then(null,function(){c=!0});var e=G(C),h=f.rtl?f.viewport.offsetWidth-(C.offsetLeft+C.offsetWidth):C.offsetLeft,i=C.offsetTop,l={viewportContentSize:0,surfaceContentSize:0,maxItemsContainerContentSize:0,surfaceOuterHeight:y(o),surfaceOuterWidth:z(o),layoutOriginX:h-e[k],layoutOriginY:i-e.top,itemsContainerOuterHeight:y(q),itemsContainerOuterWidth:z(q),itemsContainerOuterX:x(f.rtl?"Right":"Left",q),itemsContainerOuterY:x("Top",q),itemsContainerMargins:G(q),itemBoxOuterHeight:y(s),itemBoxOuterWidth:z(s),containerOuterHeight:y(j.container),containerOuterWidth:z(j.container),emptyContainerContentHeight:m.getContentHeight(r),emptyContainerContentWidth:m.getContentWidth(r),containerMargins:G(j.container),containerWidth:0,containerHeight:0,containerSizeLoaded:!1};f.header&&(l[a?"layoutOriginX":"layoutOriginY"]+=m[a?"getTotalWidth":"getTotalHeight"](f.header)),b&&(l.headerContainerOuterX=x(f.rtl?"Right":"Left",j.headerContainer),l.headerContainerOuterY=x("Top",j.headerContainer),l.headerContainerOuterWidth=z(j.headerContainer),l.headerContainerOuterHeight=y(j.headerContainer),l.headerContainerWidth=m.getTotalWidth(j.headerContainer),l.headerContainerHeight=m.getTotalHeight(j.headerContainer),l.headerContainerMinWidth=w(j.headerContainer,"minWidth")+l.headerContainerOuterWidth,l.headerContainerMinHeight=w(j.headerContainer,"minHeight")+l.headerContainerOuterHeight);var n={sizes:l,viewportContentWidth:m.getContentWidth(f.viewport),viewportContentHeight:m.getContentHeight(f.viewport),containerContentWidth:m.getContentWidth(j.container),containerContentHeight:m.getContentHeight(j.container),containerWidth:m.getTotalWidth(j.container),containerHeight:m.getTotalHeight(j.container)};return n.viewportCrossSize=n[a?"viewportContentHeight":"viewportContentWidth"],f.readyToMeasure(),c?null:n}function n(){o.parentNode&&o.parentNode.removeChild(o)}var o=d._createMeasuringSurface(),q=b.document.createElement("div"),r=b.document.createElement("div"),s=j.container.querySelector("."+p._itemBoxClass),t=f.groupIndexFromItemIndex(a);r.className=p._containerClass,q.className=p._itemsContainerClass+" "+p._laidOutClass;var u=1,v=1,A=2,B=2,C=q,D=!1;d._inListMode&&d._groupsEnabled&&(d._horizontal&&d._groupHeaderPosition===U.top?(u=2,B=1,A=1,C=j.headerContainer,D=!0):d._horizontal||d._groupHeaderPosition!==U.left||(v=2,B=1,A=1,C=j.headerContainer,D=!0)),q.style.cssText+=";display: "+(d._inListMode?(d._horizontal?"flex":"block")+"; overflow: hidden":"inline-block")+";vertical-align:top;-ms-grid-column: "+v+";-ms-grid-row: "+u,d._inListMode||(j.container.style.display="inline-block"),d._groupsEnabled&&(j.headerContainer.style.cssText+=";display: inline-block;-ms-grid-column: "+B+";-ms-grid-row: "+A,m.addClass(j.headerContainer,p._laidOutClass+" "+p._groupLeaderClass),(d._groupHeaderPosition===U.top&&d._horizontal||d._groupHeaderPosition===U.left&&!d._horizontal)&&m.addClass(q,p._groupLeaderClass)),D&&o.appendChild(j.headerContainer),q.appendChild(j.container),q.appendChild(r),o.appendChild(q),!D&&d._groupsEnabled&&o.appendChild(j.headerContainer),f.viewport.insertBefore(o,f.viewport.firstChild);var E=l();if(!E)return n(),i.cancel;if(d._horizontal&&0===E.viewportContentHeight||!d._horizontal&&0===E.viewportContentWidth)return n(),i.cancel;if(!(h||d._isCellSpanning(t)||0!==E.containerContentWidth&&0!==E.containerContentHeight))return n(),e.then(function(){return c(a,e)});var F=d._sizes=E.sizes;if(Object.defineProperties(F,{surfaceOuterCrossSize:{get:function(){return d._horizontal?F.surfaceOuterHeight:F.surfaceOuterWidth},enumerable:!0},layoutOrigin:{get:function(){return d._horizontal?F.layoutOriginX:F.layoutOriginY},enumerable:!0},itemsContainerOuterSize:{get:function(){return d._horizontal?F.itemsContainerOuterWidth:F.itemsContainerOuterHeight},enumerable:!0},itemsContainerOuterCrossSize:{get:function(){return d._horizontal?F.itemsContainerOuterHeight:F.itemsContainerOuterWidth},enumerable:!0},itemsContainerOuterStart:{get:function(){return d._horizontal?F.itemsContainerOuterX:F.itemsContainerOuterY},enumerable:!0},itemsContainerOuterCrossStart:{get:function(){return d._horizontal?F.itemsContainerOuterY:F.itemsContainerOuterX},enumerable:!0},containerCrossSize:{get:function(){return d._horizontal?F.containerHeight:F.containerWidth},enumerable:!0},containerSize:{get:function(){return d._horizontal?F.containerWidth:F.containerHeight},enumerable:!0}}),!d._isCellSpanning(t)){if(d._inListMode){var H=E.viewportCrossSize-F.surfaceOuterCrossSize-d._getHeaderSizeContentAdjustment()-F.itemsContainerOuterCrossSize;d._horizontal?(F.containerHeight=H,F.containerWidth=E.containerWidth):(F.containerHeight=E.containerHeight,F.containerWidth=H)}else F.containerWidth=E.containerWidth,F.containerHeight=E.containerHeight;F.containerSizeLoaded=!0}d._createContainerStyleRule(),d._viewportSizeChanged(E.viewportCrossSize),n()})}var d=this,e="Layout:measureItem",f=d._site,g=d._measuringPromise;if(!g){f._writeProfilerMark(e+",StartTM");var h=new k;d._measuringPromise=g=h.promise.then(function(){return d._ensureEnvInfo()?c(a):i.cancel}).then(function(){f._writeProfilerMark(e+":complete,info"),f._writeProfilerMark(e+",StopTM")},function(a){return d._measuringPromise=null,f._writeProfilerMark(e+":canceled,info"),f._writeProfilerMark(e+",StopTM"),i.wrapError(a)}),h.complete()}return g},_getHeaderSizeGroupAdjustment:function(){if(this._groupsEnabled){if(this._horizontal&&this._groupHeaderPosition===U.left)return this._sizes.headerContainerWidth;if(!this._horizontal&&this._groupHeaderPosition===U.top)return this._sizes.headerContainerHeight}return 0},_getHeaderSizeContentAdjustment:function(){if(this._groupsEnabled){if(this._horizontal&&this._groupHeaderPosition===U.top)return this._sizes.headerContainerHeight;if(!this._horizontal&&this._groupHeaderPosition===U.left)return this._sizes.headerContainerWidth}return 0},_getViewportCrossSize:function(){return this._site.viewportSize[this._horizontal?"height":"width"]},_viewportSizeChanged:function(a){var b=this._sizes;b.viewportContentSize=a,b.surfaceContentSize=a-b.surfaceOuterCrossSize,b.maxItemsContainerContentSize=b.surfaceContentSize-b.itemsContainerOuterCrossSize-this._getHeaderSizeContentAdjustment(),b.containerSizeLoaded&&!this._inListMode?(this._itemsPerBar=Math.floor(b.maxItemsContainerContentSize/b.containerCrossSize),this.maximumRowsOrColumns&&(this._itemsPerBar=Math.min(this._itemsPerBar,this.maximumRowsOrColumns)),this._itemsPerBar=Math.max(1,this._itemsPerBar)):(this._inListMode&&(b[this._horizontal?"containerHeight":"containerWidth"]=b.maxItemsContainerContentSize),this._itemsPerBar=1),this._resetAnimationCaches()},_createContainerStyleRule:function(){var a=this._sizes;if(!this._containerSizeClassName&&a.containerSizeLoaded&&(0===a.emptyContainerContentHeight||0===a.emptyContainerContentWidth)){var b=a.containerWidth-a.containerOuterWidth+"px",c=a.containerHeight-a.containerOuterHeight+"px";this._inListMode&&(this._horizontal?c="calc(100% - "+(a.containerMargins.top+a.containerMargins.bottom)+"px)":b="auto"),this._containerSizeClassName||(this._containerSizeClassName=r("containersize"),m.addClass(this._site.surface,this._containerSizeClassName));var d="."+p._containerClass,e="width:"+b+";height:"+c+";";t(this._containerSizeClassName,this._site,d,e)}},_ensureContainerSize:function(a){var b=this._sizes;if(b.containerSizeLoaded||this._ensuringContainerSize)return this._ensuringContainerSize?this._ensuringContainerSize:i.wrap();var c;if(this._itemInfo&&"function"==typeof this._itemInfo||!this._useDefaultItemInfo)c=this._getItemInfo();else{var d=b.containerMargins;c=i.wrap({width:a.groupInfo.cellWidth-d.left-d.right,height:a.groupInfo.cellHeight-d.top-d.bottom})}var e=this;return this._ensuringContainerSize=c.then(function(a){b.containerSizeLoaded=!0,b.containerWidth=a.width+b.itemBoxOuterWidth+b.containerOuterWidth,b.containerHeight=a.height+b.itemBoxOuterHeight+b.containerOuterHeight,e._inListMode?e._itemsPerBar=1:(e._itemsPerBar=Math.floor(b.maxItemsContainerContentSize/b.containerCrossSize),e.maximumRowsOrColumns&&(e._itemsPerBar=Math.min(e._itemsPerBar,e.maximumRowsOrColumns)),e._itemsPerBar=Math.max(1,e._itemsPerBar)),e._createContainerStyleRule()}),c.done(function(){e._ensuringContainerSize=null},function(){e._ensuringContainerSize=null}),c},_indexToCoordinate:function(a,b){b=b||this._itemsPerBar;var c=Math.floor(a/b);return this._horizontal?{column:c,row:a-c*b}:{row:c,column:a-c*b}},_rangeForGroup:function(a,b){var c=a.startIndex,d=c+a.count-1;return!b||b.firstIndex>d||b.lastIndex<c?null:{firstIndex:Math.max(0,b.firstIndex-c),lastIndex:Math.min(a.count-1,b.lastIndex-c)}},_syncDomWithGroupHeaderPosition:function(a){if(this._groupsEnabled&&this._oldGroupHeaderPosition!==this._groupHeaderPosition){var b,c=a.length;if(this._oldGroupHeaderPosition===U.top)if(m.removeClass(this._site.surface,p._headerPositionTopClass),this._horizontal)for(b=0;c>b;b++)a[b].header.style.maxWidth="",m.removeClass(a[b].itemsContainer.element,p._groupLeaderClass);else this._site.surface.style.msGridRows="";else if(this._oldGroupHeaderPosition===U.left){if(m.removeClass(this._site.surface,p._headerPositionLeftClass),!this._horizontal)for(b=0;c>b;b++)a[b].header.style.maxHeight="",m.removeClass(a[b].itemsContainer.element,p._groupLeaderClass);this._site.surface.style.msGridColumns=""}if(this._groupHeaderPosition===U.top){if(m.addClass(this._site.surface,p._headerPositionTopClass),this._horizontal)for(b=0;c>b;b++)m.addClass(a[b].itemsContainer.element,p._groupLeaderClass)}else if(m.addClass(this._site.surface,p._headerPositionLeftClass),!this._horizontal)for(b=0;c>b;b++)m.addClass(a[b].itemsContainer.element,p._groupLeaderClass);this._oldGroupHeaderPosition=this._groupHeaderPosition}},_layoutGroup:function(a){var b=this._groups[a],c=this._site.tree[a],d=c.header,e=c.itemsContainer.element,f=this._sizes,g=b.getItemsContainerCrossSize();if(this._groupsEnabled){if(this._horizontal)if(this._groupHeaderPosition===U.top){var h=f.headerContainerMinWidth-f.headerContainerOuterWidth,i=b.getItemsContainerSize()-f.headerContainerOuterWidth;d.style.maxWidth=Math.max(h,i)+"px",this._envInfo.supportsCSSGrid?(d.style.msGridColumn=a+1,e.style.msGridColumn=a+1):(d.style.height=f.headerContainerHeight-f.headerContainerOuterHeight+"px",e.style.height=g-f.itemsContainerOuterHeight+"px",e.style.marginBottom=f.itemsContainerMargins.bottom+(f.maxItemsContainerContentSize-g+f.itemsContainerOuterHeight)+"px"),m.addClass(e,p._groupLeaderClass)}else this._envInfo.supportsCSSGrid?(d.style.msGridColumn=2*a+1,e.style.msGridColumn=2*a+2):(d.style.width=f.headerContainerWidth-f.headerContainerOuterWidth+"px",d.style.height=g-f.headerContainerOuterHeight+"px",e.style.height=g-f.itemsContainerOuterHeight+"px");else if(this._groupHeaderPosition===U.left){var j=f.headerContainerMinHeight-f.headerContainerOuterHeight,k=b.getItemsContainerSize()-f.headerContainerOuterHeight;d.style.maxHeight=Math.max(j,k)+"px",this._envInfo.supportsCSSGrid?(d.style.msGridRow=a+1,e.style.msGridRow=a+1):(d.style.width=f.headerContainerWidth-f.headerContainerOuterWidth+"px",e.style.width=g-f.itemsContainerOuterWidth+"px",e.style["margin"+(this._site.rtl?"Left":"Right")]=f.itemsContainerMargins[this._site.rtl?"left":"right"]+(f.maxItemsContainerContentSize-g+f.itemsContainerOuterWidth)+"px"),m.addClass(e,p._groupLeaderClass)}else d.style.msGridRow=2*a+1,this._inListMode?d.style.height=f.headerContainerHeight-f.headerContainerOuterHeight+"px":this._envInfo.supportsCSSGrid?e.style.msGridRow=2*a+2:(d.style.height=f.headerContainerHeight-f.headerContainerOuterHeight+"px",d.style.width=g-f.headerContainerOuterWidth+"px",e.style.width=g-f.itemsContainerOuterWidth+"px");m.addClass(d,p._laidOutClass+" "+p._groupLeaderClass)}m.addClass(e,p._laidOutClass)}},{_barsPerItemsBlock:4})}),_LegacyLayout:c.Namespace._lazy(function(){return c.Class.derive(a._LayoutCommon,null,{disableBackdrop:{get:function(){return this._backdropDisabled||!1},set:function(a){if(m._deprecated(q.disableBackdropIsDeprecated),a=!!a,this._backdropDisabled!==a&&(this._backdropDisabled=a,this._disableBackdropClassName&&(u(this._disableBackdropClassName),this._site&&m.removeClass(this._site.surface,this._disableBackdropClassName),this._disableBackdropClassName=null),this._disableBackdropClassName=r("disablebackdrop"),this._site&&m.addClass(this._site.surface,this._disableBackdropClassName),a)){var b=".win-container.win-backdrop",c="background-color:transparent;";t(this._disableBackdropClassName,this._site,b,c)}}},backdropColor:{get:function(){return this._backdropColor||"rgba(155,155,155,0.23)"},set:function(a){if(m._deprecated(q.backdropColorIsDeprecated),a&&this._backdropColor!==a){this._backdropColor=a,this._backdropColorClassName&&(u(this._backdropColorClassName),this._site&&m.removeClass(this._site.surface,this._backdropColorClassName),this._backdropColorClassName=null),this._backdropColorClassName=r("backdropcolor"),this._site&&m.addClass(this._site.surface,this._backdropColorClassName);var b=".win-container.win-backdrop",c="background-color:"+a+";";t(this._backdropColorClassName,this._site,b,c)}}}})}),GridLayout:c.Namespace._lazy(function(){return c.Class.derive(a._LegacyLayout,function(a){a=a||{},this.itemInfo=a.itemInfo,this.groupInfo=a.groupInfo,this._maxRowsOrColumns=0,this._useDefaultItemInfo=!0,this._elementsToMeasure={},this._groupHeaderPosition=a.groupHeaderPosition||U.top,this.orientation=a.orientation||"horizontal",a.maxRows&&(this.maxRows=+a.maxRows),a.maximumRowsOrColumns&&(this.maximumRowsOrColumns=+a.maximumRowsOrColumns)},{maximumRowsOrColumns:{get:function(){return this._maxRowsOrColumns},set:function(a){this._setMaxRowsOrColumns(a)}},maxRows:{get:function(){return this.maximumRowsOrColumns},set:function(a){m._deprecated(q.maxRowsIsDeprecated),this.maximumRowsOrColumns=a}},itemInfo:{enumerable:!0,get:function(){return this._itemInfo},set:function(a){a&&m._deprecated(q.itemInfoIsDeprecated),this._itemInfo=a,this._invalidateLayout()}},groupInfo:{enumerable:!0,get:function(){return this._groupInfo},set:function(a){a&&m._deprecated(q.groupInfoIsDeprecated),this._groupInfo=a,this._invalidateLayout()}}})})});var T=c.Namespace.defineWithParent(null,null,{UniformGroupBase:c.Namespace._lazy(function(){return c.Class.define(null,{cleanUp:function(){},itemFromOffset:function(a,b){b=b||{};var c=this._layout._sizes;a-=c.itemsContainerOuterStart,b.wholeItem&&(a+=(b.last?-1:1)*(c.containerSize-1));var d=this.count-1,e=Math.floor(d/this._layout._itemsPerBar),f=v(0,e,Math.floor(a/c.containerSize)),g=(f+b.last)*this._layout._itemsPerBar-b.last;return v(0,this.count-1,g)},hitTest:function(a,b){var c=this._layout._horizontal,d=this._layout._itemsPerBar,e=this._layout._inListMode||1===d,f=c?a:b,g=c?b:a,h=this._layout._sizes;f-=h.itemsContainerOuterStart,g-=h.itemsContainerOuterCrossStart;var i,j=Math.floor(f/h.containerSize),k=v(0,d-1,Math.floor(g/h.containerCrossSize)),l=Math.max(-1,j*d+k);if(i=!c&&e||c&&!e?(b-h.containerHeight/2)/h.containerHeight:(a-h.containerWidth/2)/h.containerWidth,e)return i=Math.floor(i),
{index:l,insertAfterIndex:i>=0&&l>=0?i:-1};i=v(-1,d-1,i);var m;return m=0>i?j*d-1:j*d+Math.floor(i),{index:v(-1,this.count-1,l),insertAfterIndex:v(-1,this.count-1,m)}},getAdjacent:function(a,b){var c,d=a.index,e=Math.floor(d/this._layout._itemsPerBar),f=d%this._layout._itemsPerBar;switch(b){case H.upArrow:c=0===f?"boundary":d-1;break;case H.downArrow:var g=d===this.count-1,h=this._layout._itemsPerBar>1&&f===this._layout._itemsPerBar-1;c=g||h?"boundary":d+1;break;case H.leftArrow:c=0===e&&this._layout._itemsPerBar>1?"boundary":d-this._layout._itemsPerBar;break;case H.rightArrow:var i=this.count-1,j=Math.floor(i/this._layout._itemsPerBar);c=e===j?"boundary":Math.min(d+this._layout._itemsPerBar,this.count-1)}return"boundary"===c?c:{type:o.ObjectType.item,index:c}},getItemsContainerSize:function(){var a=this._layout._sizes,b=Math.ceil(this.count/this._layout._itemsPerBar);return b*a.containerSize+a.itemsContainerOuterSize},getItemsContainerCrossSize:function(){var a=this._layout._sizes;return this._layout._itemsPerBar*a.containerCrossSize+a.itemsContainerOuterCrossSize},getItemPositionForAnimations:function(a){var b=this._layout._sizes,c=this._layout._site.rtl?"right":"left",d=this._layout._sizes.containerMargins,e=this._layout._indexToCoordinate(a),f={row:e.row,column:e.column,top:d.top+e.row*b.containerHeight,left:d[c]+e.column*b.containerWidth,height:b.containerHeight-b.containerMargins.top-b.containerMargins.bottom,width:b.containerWidth-b.containerMargins.left-b.containerMargins.right};return f}})}),UniformGroup:c.Namespace._lazy(function(){return c.Class.derive(T.UniformGroupBase,function(a,b){this._layout=a,this._itemsContainer=b,m.addClass(this._itemsContainer,a._inListMode?p._uniformListLayoutClass:p._uniformGridLayoutClass)},{cleanUp:function(a){a||(m.removeClass(this._itemsContainer,p._uniformGridLayoutClass),m.removeClass(this._itemsContainer,p._uniformListLayoutClass),this._itemsContainer.style.height=this._itemsContainer.style.width=""),this._itemsContainer=null,this._layout=null,this.groupInfo=null,this.startIndex=null,this.offset=null,this.count=null},prepareLayout:function(a,b,c,d){return this.groupInfo=d.groupInfo,this.startIndex=d.startIndex,this.count=a,this._layout._ensureContainerSize(this)},layoutRealizedRange:function(){var a=this._layout._sizes;this._itemsContainer.style[this._layout._horizontal?"width":"height"]=this.getItemsContainerSize()-a.itemsContainerOuterSize+"px",this._itemsContainer.style[this._layout._horizontal?"height":"width"]=this._layout._inListMode?a.maxItemsContainerContentSize+"px":this._layout._itemsPerBar*a.containerCrossSize+"px"},layoutUnrealizedRange:function(){return i.wrap()}})}),UniformFlowGroup:c.Namespace._lazy(function(){return c.Class.derive(T.UniformGroupBase,function(a,b){this._layout=a,this._itemsContainer=b.element,m.addClass(this._itemsContainer,a._inListMode?p._uniformListLayoutClass:p._uniformGridLayoutClass)},{cleanUp:function(a){a||(m.removeClass(this._itemsContainer,p._uniformListLayoutClass),m.removeClass(this._itemsContainer,p._uniformGridLayoutClass),this._itemsContainer.style.height="")},layout:function(){this._layout._site._writeProfilerMark("Layout:_UniformFlowGroup:setItemsContainerHeight,info"),this._itemsContainer.style.height=this.count*this._layout._sizes.containerHeight+"px"}})}),CellSpanningGroup:c.Namespace._lazy(function(){return c.Class.define(function(a,b){this._layout=a,this._itemsContainer=b,m.addClass(this._itemsContainer,p._cellSpanningGridLayoutClass),this.resetMap()},{cleanUp:function(a){a||(this._cleanContainers(),m.removeClass(this._itemsContainer,p._cellSpanningGridLayoutClass),this._itemsContainer.style.cssText=""),this._itemsContainer=null,this._layoutPromise&&(this._layoutPromise.cancel(),this._layoutPromise=null),this.resetMap(),this._slotsPerColumn=null,this._offScreenSlotsPerColumn=null,this._items=null,this._layout=null,this._containersToHide=null,this.groupInfo=null,this.startIndex=null,this.offset=null,this.count=null},prepareLayoutWithCopyOfTree:function(a,b,c,d){var e,f=this;if(this._containersToHide={},b)for(e=b.firstIndex;e<=b.lastIndex;e++)this._containersToHide[I(c._items[e])]=c._items[e];this.groupInfo=d.groupInfo,this.startIndex=d.startIndex,this.count=a.items.length,this._items=a.items,this._slotsPerColumn=Math.floor(this._layout._sizes.maxItemsContainerContentSize/this.groupInfo.cellHeight),this._layout.maximumRowsOrColumns&&(this._slotsPerColumn=Math.min(this._slotsPerColumn,this._layout.maximumRowsOrColumns)),this._slotsPerColumn=Math.max(this._slotsPerColumn,1),this.resetMap();var g=new Array(this.count);for(e=0;e<this.count;e++)g[e]=this._layout._getItemInfo(this.startIndex+e);return i.join(g).then(function(a){a.forEach(function(a,b){f.addItemToMap(b,a)})})},layoutRealizedRange:function(a,b){if(b){var c,d=Math.max(a,b.firstIndex);for(c=d;c<=b.lastIndex;c++)this._layoutItem(c),delete this._containersToHide[I(this._items[c])]}Object.keys(this._containersToHide).forEach(function(a){m.removeClass(this._containersToHide[a],p._laidOutClass)}.bind(this)),this._containersToHide={},this._itemsContainer.style.cssText+=";width:"+(this.getItemsContainerSize()-this._layout._sizes.itemsContainerOuterSize)+"px;height:"+this._layout._sizes.maxItemsContainerContentSize+"px;-ms-grid-columns: ("+this.groupInfo.cellWidth+"px)["+this.getColumnCount()+"];-ms-grid-rows: ("+this.groupInfo.cellHeight+"px)["+(this._slotsPerColumn+this._offScreenSlotsPerColumn)+"]"},layoutUnrealizedRange:function(a,b,c){var d,e=this;return e._layoutPromise=new i(function(f){function g(){d=null,f()}function h(a){return j.schedule(a,j.Priority.normal,null,"WinJS.UI.GridLayout.CellSpanningGroup.LayoutUnrealizedRange")}if(b){var i=!1,k=b.firstIndex-1,l=Math.max(a,b.lastIndex+1);l=Math.max(k+1,l),d=h(function n(b){for(;!i;){if(b.shouldYield)return void b.setWork(n);i=!0,k>=a&&(e._layoutItem(k),k--,i=!1),l<e.count&&(e._layoutItem(l),l++,i=!1)}g()})}else if(c){var m=e.count-1;d=h(function o(b){for(;m>=a;m--){if(b.shouldYield)return void b.setWork(o);e._layoutItem(m)}g()})}else{var m=a;d=h(function p(a){for(;m<e.count;m++){if(a.shouldYield)return void a.setWork(p);e._layoutItem(m)}g()})}},function(){d&&d.cancel(),d=null}),e._layoutPromise},itemFromOffset:function(a,b){b=b||{};var c=this._layout._sizes,d=c.containerMargins;a-=c.itemsContainerOuterX,a-=(b.last?1:-1)*d[b.last?"left":"right"];var e=this.indexFromOffset(a,b.wholeItem,b.last).item;return v(0,this.count-1,e)},getAdjacent:function(a,b){var c,d;c=d=a.index;var e,f,g;g=this.lastAdjacent===c?this.lastInMapIndex:this.findItem(c);do{var h=Math.floor(g/this._slotsPerColumn),i=g-h*this._slotsPerColumn,j=Math.floor((this.occupancyMap.length-1)/this._slotsPerColumn);switch(b){case H.upArrow:if(!(i>0))return{type:o.ObjectType.item,index:d};g--;break;case H.downArrow:if(!(i+1<this._slotsPerColumn))return{type:o.ObjectType.item,index:d};g++;break;case H.leftArrow:g=h>0?g-this._slotsPerColumn:-1;break;case H.rightArrow:g=j>h?g+this._slotsPerColumn:this.occupancyMap.length}f=g>=0&&g<this.occupancyMap.length,f&&(e=this.occupancyMap[g]?this.occupancyMap[g].index:void 0)}while(f&&(c===e||void 0===e));return this.lastAdjacent=e,this.lastInMapIndex=g,f?{type:o.ObjectType.item,index:e}:"boundary"},hitTest:function(a,b){var c=this._layout._sizes,d=0;if(a-=c.itemsContainerOuterX,b-=c.itemsContainerOuterY,this.occupancyMap.length>0){for(var e=this.indexFromOffset(a,!1,0),f=Math.min(this._slotsPerColumn-1,Math.floor(b/this.groupInfo.cellHeight)),g=e.index,h=g;f-->0;)g++,this.occupancyMap[g]&&(h=g);this.occupancyMap[h]||h--,d=this.occupancyMap[h].index}var i=this.getItemSize(d),j=i.column*this.groupInfo.cellWidth,k=i.row*this.groupInfo.cellHeight,l=1===this._slotsPerColumn,m=d;return(l&&a<j+i.contentWidth/2||!l&&b<k+i.contentHeight/2)&&m--,{type:o.ObjectType.item,index:v(0,this.count-1,d),insertAfterIndex:v(-1,this.count-1,m)}},getItemsContainerSize:function(){var a=this._layout._sizes;return this.getColumnCount()*this.groupInfo.cellWidth+a.itemsContainerOuterSize},getItemsContainerCrossSize:function(){var a=this._layout._sizes;return a.maxItemsContainerContentSize+a.itemsContainerOuterCrossSize},getItemPositionForAnimations:function(a){var b=this._layout._site.rtl?"right":"left",c=this._layout._sizes.containerMargins,d=this.getItemSize(a),e=this.groupInfo,f={row:d.row,column:d.column,top:c.top+d.row*e.cellHeight,left:c[b]+d.column*e.cellWidth,height:d.contentHeight,width:d.contentWidth};return f},_layoutItem:function(a){var b=this.getItemSize(a);return this._items[a].style.cssText+=";-ms-grid-row:"+(b.row+1)+";-ms-grid-column:"+(b.column+1)+";-ms-grid-row-span:"+b.rows+";-ms-grid-column-span:"+b.columns+";height:"+b.contentHeight+"px;width:"+b.contentWidth+"px",m.addClass(this._items[a],p._laidOutClass),this._items[a]},_cleanContainers:function(){var a,b=this._items,c=b.length;for(a=0;c>a;a++)b[a].style.cssText="",m.removeClass(b[a],p._laidOutClass)},getColumnCount:function(){return Math.ceil(this.occupancyMap.length/this._slotsPerColumn)},getOccupancyMapItemCount:function(){var a=-1;return this.occupancyMap.forEach(function(b){b.index>a&&(a=b.index)}),a+1},coordinateToIndex:function(a,b){return a*this._slotsPerColumn+b},markSlotAsFull:function(a,b){for(var c=this._layout._indexToCoordinate(a,this._slotsPerColumn),d=c.row+b.rows,e=c.row;d>e&&e<this._slotsPerColumn;e++)for(var f=c.column,g=c.column+b.columns;g>f;f++)this.occupancyMap[this.coordinateToIndex(f,e)]=b;this._offScreenSlotsPerColumn=Math.max(this._offScreenSlotsPerColumn,d-this._slotsPerColumn)},isSlotEmpty:function(a,b,c){for(var d=b,e=b+a.rows;e>d;d++)for(var f=c,g=c+a.columns;g>f;f++)if(d>=this._slotsPerColumn||void 0!==this.occupancyMap[this.coordinateToIndex(f,d)])return!1;return!0},findEmptySlot:function(a,b,c){var d=this._layout._indexToCoordinate(a,this._slotsPerColumn),e=d.row,f=Math.floor((this.occupancyMap.length-1)/this._slotsPerColumn);if(c){for(var g=d.column+1;f>=g;g++)if(this.isSlotEmpty(b,0,g))return this.coordinateToIndex(g,0)}else for(var g=d.column;f>=g;g++){for(var h=e;h<this._slotsPerColumn;h++)if(this.isSlotEmpty(b,h,g))return this.coordinateToIndex(g,h);e=0}return(f+1)*this._slotsPerColumn},findItem:function(a){for(var b=a,c=this.occupancyMap.length;c>b;b++){var d=this.occupancyMap[b];if(d&&d.index===a)return b}return b},getItemSize:function(a){var b=this.findItem(a),c=this.occupancyMap[b],d=this._layout._indexToCoordinate(b,this._slotsPerColumn);return a===c.index?{row:d.row,column:d.column,contentWidth:c.contentWidth,contentHeight:c.contentHeight,columns:c.columns,rows:c.rows}:null},resetMap:function(){this.occupancyMap=[],this.lastAdded=0,this._offScreenSlotsPerColumn=0},addItemToMap:function(a,b){function c(a,b){var c=d.findEmptySlot(d.lastAdded,a,b);d.lastAdded=c,d.markSlotAsFull(c,a)}var d=this,e=d.groupInfo,f=d._layout._sizes.containerMargins,g={index:a,contentWidth:b.width,contentHeight:b.height,columns:Math.max(1,Math.ceil((b.width+f.left+f.right)/e.cellWidth)),rows:Math.max(1,Math.ceil((b.height+f.top+f.bottom)/e.cellHeight))};c(g,b.newColumn)},indexFromOffset:function(a,b,c){var d=0,e=0,f=this.groupInfo,g=0;if(this.occupancyMap.length>0){if(e=this.getOccupancyMapItemCount()-1,d=Math.ceil((this.occupancyMap.length-1)/this._slotsPerColumn)*f.cellWidth,d>a){for(var h=this._slotsPerColumn,g=(Math.max(0,Math.floor(a/f.cellWidth))+c)*this._slotsPerColumn-c;!this.occupancyMap[g]&&h-->0;)g+=c>0?-1:1;return{index:g,item:this.occupancyMap[g].index}}g=this.occupancyMap.length-1}return{index:g,item:e+(Math.max(0,Math.floor((a-d)/f.cellWidth))+c)*this._slotsPerColumn-c}}})})});c.Namespace._moduleDefine(a,"WinJS.UI",{ListLayout:c.Namespace._lazy(function(){return c.Class.derive(a._LegacyLayout,function(a){a=a||{},this._itemInfo={},this._groupInfo={},this._groupHeaderPosition=a.groupHeaderPosition||U.top,this._inListMode=!0,this.orientation=a.orientation||"vertical"},{initialize:function(b,c){m.addClass(b.surface,p._listLayoutClass),a._LegacyLayout.prototype.initialize.call(this,b,c)},uninitialize:function(){this._site&&m.removeClass(this._site.surface,p._listLayoutClass),a._LegacyLayout.prototype.uninitialize.call(this)},layout:function(b,c,d,e){return this._groupsEnabled||this._horizontal?a._LegacyLayout.prototype.layout.call(this,b,c,d,e):this._layoutNonGroupedVerticalList(b,c,d,e)},_layoutNonGroupedVerticalList:function(a,b,c,d){var e=this,f="Layout:_layoutNonGroupedVerticalList";return e._site._writeProfilerMark(f+",StartTM"),this._layoutPromise=e._measureItem(0).then(function(){m[e._usingStructuralNodes?"addClass":"removeClass"](e._site.surface,p._structuralNodesClass),m[e._envInfo.nestedFlexTooLarge||e._envInfo.nestedFlexTooSmall?"addClass":"removeClass"](e._site.surface,p._singleItemsBlockClass),e._sizes.viewportContentSize!==e._getViewportCrossSize()&&e._viewportSizeChanged(e._getViewportCrossSize()),e._cacheRemovedElements(c,e._cachedItemRecords,e._cachedInsertedItemRecords,e._cachedRemovedItems,!1),e._cacheRemovedElements(d,e._cachedHeaderRecords,e._cachedInsertedHeaderRecords,e._cachedRemovedHeaders,!0);var b=a[0].itemsContainer,g=new T.UniformFlowGroup(e,b);e._groups=[g],g.groupInfo={enableCellSpanning:!1},g.startIndex=0,g.count=D(b),g.offset=0,g.layout(),e._site._writeProfilerMark(f+":setSurfaceWidth,info"),e._site.surface.style.width=e._sizes.surfaceContentSize+"px",e._layoutAnimations(c,d),e._site._writeProfilerMark(f+":complete,info"),e._site._writeProfilerMark(f+",StopTM")},function(a){return e._site._writeProfilerMark(f+":canceled,info"),e._site._writeProfilerMark(f+",StopTM"),i.wrapError(a)}),{realizedRangeComplete:this._layoutPromise,layoutComplete:this._layoutPromise}},numberOfItemsPerItemsBlock:{get:function(){var b=this;return this._measureItem(0).then(function(){return b._envInfo.nestedFlexTooLarge||b._envInfo.nestedFlexTooSmall?(b._usingStructuralNodes=!0,Number.MAX_VALUE):(b._usingStructuralNodes=a.ListLayout._numberOfItemsPerItemsBlock>0,a.ListLayout._numberOfItemsPerItemsBlock)})}}},{_numberOfItemsPerItemsBlock:10})}),CellSpanningLayout:c.Namespace._lazy(function(){return c.Class.derive(a._LayoutCommon,function(a){a=a||{},this._itemInfo=a.itemInfo,this._groupInfo=a.groupInfo,this._groupHeaderPosition=a.groupHeaderPosition||U.top,this._horizontal=!0,this._cellSpanning=!0},{maximumRowsOrColumns:{get:function(){return this._maxRowsOrColumns},set:function(a){this._setMaxRowsOrColumns(a)}},itemInfo:{enumerable:!0,get:function(){return this._itemInfo},set:function(a){this._itemInfo=a,this._invalidateLayout()}},groupInfo:{enumerable:!0,get:function(){return this._groupInfo},set:function(a){this._groupInfo=a,this._invalidateLayout()}},orientation:{enumerable:!0,get:function(){return"horizontal"}}})}),_LayoutWrapper:c.Namespace._lazy(function(){return c.Class.define(function(a){this.defaultAnimations=!0,this.initialize=function(b,c){a.initialize(b,c)},this.hitTest=function(b,c){return a.hitTest(b,c)},a.uninitialize&&(this.uninitialize=function(){a.uninitialize()}),"numberOfItemsPerItemsBlock"in a&&Object.defineProperty(this,"numberOfItemsPerItemsBlock",{get:function(){return a.numberOfItemsPerItemsBlock}}),a._getItemPosition&&(this._getItemPosition=function(b){return a._getItemPosition(b)}),a.itemsFromRange&&(this.itemsFromRange=function(b,c){return a.itemsFromRange(b,c)}),a.getAdjacent&&(this.getAdjacent=function(b,c){return a.getAdjacent(b,c)}),a.dragOver&&(this.dragOver=function(b,c,d){return a.dragOver(b,c,d)}),a.dragLeave&&(this.dragLeave=function(){return a.dragLeave()});var b={enumerable:!0,get:function(){return"vertical"}};if(void 0!==a.orientation&&(b.get=function(){return a.orientation},b.set=function(b){a.orientation=b}),Object.defineProperty(this,"orientation",b),(a.setupAnimations||a.executeAnimations)&&(this.defaultAnimations=!1,this.setupAnimations=function(){return a.setupAnimations()},this.executeAnimations=function(){return a.executeAnimations()}),a.layout)if(this.defaultAnimations){var c=this;this.layout=function(b,d,e,f){var g,h=F(a.layout(b,d,[],[]));return h.realizedRangeComplete.then(function(){g=!0}),g&&c._layoutAnimations(e,f),h}}else this.layout=function(b,c,d,e){return F(a.layout(b,c,d,e))}},{uninitialize:function(){},numberOfItemsPerItemsBlock:{get:function(){}},layout:function(a,b,c,d){return this.defaultAnimations&&this._layoutAnimations(c,d),F()},itemsFromRange:function(){return{firstIndex:0,lastIndex:Number.MAX_VALUE}},getAdjacent:function(a,b){switch(b){case H.pageUp:case H.upArrow:case H.leftArrow:return{type:a.type,index:a.index-1};case H.downArrow:case H.rightArrow:case H.pageDown:return{type:a.type,index:a.index+1}}},dragOver:function(){},dragLeave:function(){},setupAnimations:function(){},executeAnimations:function(){},_getItemPosition:function(){},_layoutAnimations:function(){}})})});var U={left:"left",top:"top"};c.Namespace._moduleDefine(a,"WinJS.UI",{HeaderPosition:U,_getMargins:G})}),d("WinJS/Controls/ListView/_VirtualizeContentsView",["exports","../../Core/_Global","../../Core/_Base","../../Core/_BaseUtils","../../Promise","../../_Signal","../../Scheduler","../../Utilities/_Dispose","../../Utilities/_ElementUtilities","../../Utilities/_SafeHtml","../../Utilities/_UI","../ItemContainer/_Constants","../ItemContainer/_ItemEventsHandler","./_Helpers","./_ItemsContainer"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o){"use strict";function p(a,b){i._setAttribute(a,"aria-flowto",b.id),i._setAttribute(b,"x-ms-aria-flowfrom",a.id)}c.Namespace._moduleDefine(a,"WinJS.UI",{_VirtualizeContentsView:c.Namespace._lazy(function(){function a(b){for(var c,d=b.job._workItems;d.length&&!b.shouldYield;)(c=d.shift())();b.setWork(a),d.length||b.job.pause()}function q(b,c){var d=g.schedule(a,b,null,c);return d._workItems=[],d.addWork=function(a,b){b?this._workItems.unshift(a):this._workItems.push(a),this.resume()},d.clearWork=function(){this._workItems.length=0},d.dispose=function(){this.cancel(),this._workItems.length=0},d}function r(a){return a._zooming||a._pinching}function s(a,b){return a._isZombie()?e.wrap():r(a)?(+b!==b&&(b=v._waitForSeZoTimeoutDuration),e.timeout(v._waitForSeZoIntervalDuration).then(function(){return b-=v._waitForSeZoIntervalDuration,0>=b?!0:s(a,b)})):e.wrap()}function t(a){if("number"==typeof a){var b=a;a=function(){return{position:b,direction:"right"}}}return a}function u(){}var v=c.Class.define(function(a){this._listView=a,this._forceRelayout=!1,this.maxLeadingPages=d._isiOS?v._iOSMaxLeadingPages:v._defaultPagesToPrefetch,this.maxTrailingPages=d._isiOS?v._iOSMaxTrailingPages:v._defaultPagesToPrefetch,this.items=new o._ItemsContainer(a),this.firstIndexDisplayed=-1,this.lastIndexDisplayed=-1,this.begin=0,this.end=0,this._realizePass=1,this._firstLayoutPass=!0,this._runningAnimations=null,this._renderCompletePromise=e.wrap(),this._state=new w(this),this._createLayoutSignal(),this._createTreeBuildingSignal(),this._layoutWork=null,this._onscreenJob=q(g.Priority.aboveNormal,"on-screen items"),this._frontOffscreenJob=q(g.Priority.normal,"front off-screen items"),this._backOffscreenJob=q(g.Priority.belowNormal,"back off-screen items"),this._scrollbarPos=0,this._direction="right",this._scrollToFunctor=t(0)},{_dispose:function(){this.cleanUp(),this.items=null,this._renderCompletePromise&&this._renderCompletePromise.cancel(),this._renderCompletePromise=null,this._onscreenJob.dispose(),this._frontOffscreenJob.dispose(),this._backOffscreenJob.dispose()},_createItem:function(a,b,c,d){this._listView._writeProfilerMark("createItem("+a+") "+this._getBoundingRectString(a)+",info");var f=this;f._listView._itemsManager._itemFromItemPromiseThrottled(b).done(function(b){b?c(a,b,f._listView._itemsManager._recordFromElement(b)):d(a)},function(b){return d(a),e.wrapError(b)})},_addItem:function(a,b,c,d){if(this._realizePass===d){var e=this._listView._itemsManager._recordFromElement(c);delete this._pendingItemPromises[e.itemPromise.handle],this.items.setItemAt(b,{itemBox:null,container:null,element:c,detached:!0,itemsManagerRecord:e})}},lastItemIndex:function(){return this.containers?this.containers.length-1:-1},_setSkipRealizationForChange:function(a){a?this._realizationLevel!==v._realizationLevel.realize&&(this._realizationLevel=v._realizationLevel.skip):this._realizationLevel=v._realizationLevel.realize},_realizeItems:function(a,b,c,d,h,j,k,n,o,p){function q(a,b){C.push(e._cancelBlocker(b.renderComplete)),u(a)}function r(a,b){function c(a,b){a.updatedDraggableAttribute||!G._listView.itemsDraggable&&!G._listView.itemsReorderable||a.itemsManagerRecord.renderComplete.done(function(){G._realizePass===h&&(i.hasClass(b,l._nonDraggableClass)||(a.itemBox.draggable=!0),a.updatedDraggableAttribute=!0)})}if(G._listView._writeProfilerMark("_realizeItems_appendedItemsToDom,StartTM"),!G._listView._isZombie()){var d,e=0,f=-1,g=-1;for(d=a;b>=d;d++){var j=G.items.itemDataAt(d);if(j){var n=j.element,o=j.itemBox;o||(o=G._listView._itemBoxTemplate.cloneNode(!0),j.itemBox=o,o.appendChild(n),i.addClass(n,l._itemClass),G._listView._setupAriaSelectionObserver(n),G._listView._isSelected(d)&&m._ItemEventsHandler.renderSelection(o,n,!0,!0),G._listView._currentMode().renderDragSourceOnRealizedItem(d,o)),c(j,n);var p=G.getContainer(d);o.parentNode!==p&&(j.container=p,G._appendAndRestoreFocus(p,o),e++,0>f&&(f=d),g=d,G._listView._isSelected(d)&&i.addClass(p,l._selectedClass),i.removeClass(p,l._backdropClass),G.items.elementAvailable(d))}}G._listView._writeProfilerMark("_realizeItems_appendedItemsToDom,StopTM"),e>0&&(G._listView._writeProfilerMark("_realizeItems_appendedItemsToDom:"+e+" ("+f+"-"+g+"),info"),G._reportElementsLevel(k))}}function s(a,b,c,d){function e(a,b){var c=G.items.itemDataAt(a);if(c){var d=c.itemBox;return d&&d.parentNode?b?(i.addClass(d.parentNode,l._backdropClass),d.parentNode.removeChild(d),!0):!1:!0}return!0}if(!p){for(var f=!1;a>=c;)f=e(a,f),a--;for(f=!1;d>=b;)f=e(b,f),b++}}function t(a,b,c,d,f){function g(a){var b=G.items.itemDataAt(a);if(b){var d=b.itemsManagerRecord;d.readyComplete||G._realizePass!==h||c.addWork(function(){G._listView._isZombie()||d.pendingReady&&G._realizePass===h&&(G._listView._writeProfilerMark("pendingReady("+a+"),info"),d.pendingReady())},f)}}for(var i=[],j=a;b>=j;j++){var k=G.items.itemDataAt(j);k&&i.push(k.itemsManagerRecord.itemPromise)}e.join(i).then(function(){if("right"===d)for(var c=a;b>=c;c++)g(c);else for(var c=b;c>=a;c--)g(c)})}function u(a){if(G._realizePass===h){if(a>=n&&o>=a){if(0===--z){if(r(n,o),s(n,o,b,c),G._firstLayoutPass){t(n,o,G._frontOffscreenJob,"right"===k?"left":"right",!0);var d=g.schedulePromiseHigh(null,"WinJS.UI.ListView.entranceAnimation").then(function(){if(!G._listView._isZombie()){G._listView._writeProfilerMark("entranceAnimation,StartTM");var a=G._listView._animateListEntrance(!G._firstEntranceAnimated);return G._firstEntranceAnimated=!0,a}});G._runningAnimations=e.join([G._runningAnimations,d]),G._runningAnimations.done(function(){G._listView._writeProfilerMark("entranceAnimation,StopTM"),G._realizePass===h&&(G._runningAnimations=null,D.complete())}),G._firstLayoutPass=!1,G._listView._isCurrentZoomView&&g.requestDrain(G._onscreenJob.priority)}else t(n,o,G._frontOffscreenJob,k),D.complete();G._updateHeaders(G._listView._canvas,n,o+1).done(function(){E.complete()})}}else n>a?(--B,B%y===0&&r(b,n-1),B||(G._updateHeaders(G._listView._canvas,b,n).done(function(){"right"!==k&&F.complete()}),t(b,n-1,"right"!==k?G._frontOffscreenJob:G._backOffscreenJob,"left"))):a>o&&(--A,A%y===0&&r(o+1,c-1),A||(G._updateHeaders(G._listView._canvas,o+1,c).then(function(){"right"===k&&F.complete()}),t(o+1,c-1,"right"===k?G._frontOffscreenJob:G._backOffscreenJob,"right")));x--,0===x&&(G._renderCompletePromise=e.join(C).then(null,function(a){var b=Array.isArray(a)&&a.some(function(a){return a&&!(a instanceof Error&&"Canceled"===a.name)});return b?e.wrapError(a):void 0}),(G._headerRenderPromises||e.wrap()).done(function(){g.schedule(function(){G._listView._isZombie()?L.cancel():L.complete()},Math.min(G._onscreenJob.priority,G._backOffscreenJob.priority),null,"WinJS.UI.ListView._allItemsRealized")}))}}function v(b,c,d){if(G._realizePass===h){var c=d.element;G._addItem(a,b,c,h),q(b,d)}}var w="_realizeItems("+b+"-"+(c-1)+") visible("+n+"-"+o+")";this._listView._writeProfilerMark(w+",StartTM"),k=k||"right";var x=c-b,y=o-n+1,z=y,A=c-o-1,B=n-b,C=[],D=new f,E=new f,F=new f,G=this;if(x>0){var H=0,I=0,J=0;G.firstIndexDisplayed=n,G.lastIndexDisplayed=o;var K=G._listView._isCurrentZoomView;G._highPriorityRealize&&(G._firstLayoutPass||G._hasAnimationInViewportPending)?(G._highPriorityRealize=!1,G._onscreenJob.priority=g.Priority.high,G._frontOffscreenJob.priority=g.Priority.normal,G._backOffscreenJob.priority=g.Priority.belowNormal):G._highPriorityRealize?(G._highPriorityRealize=!1,G._onscreenJob.priority=g.Priority.high,G._frontOffscreenJob.priority=g.Priority.high-1,G._backOffscreenJob.priority=g.Priority.high-1):K?(G._onscreenJob.priority=g.Priority.aboveNormal,G._frontOffscreenJob.priority=g.Priority.normal,G._backOffscreenJob.priority=g.Priority.belowNormal):(G._onscreenJob.priority=g.Priority.belowNormal,G._frontOffscreenJob.priority=g.Priority.idle,G._backOffscreenJob.priority=g.Priority.idle);var L=new f,M=G._listView._versionManager.cancelOnNotification(L.promise),N=function(a,b){b.startStage1&&b.stage0.then(function(){G._realizePass===h&&b.startStage1&&a.addWork(b.startStage1)})},O=function(a,b){var c=G.items.itemDataAt(b);if(!c){var d=G._listView._itemsManager._itemPromiseAtIndex(b);G._pendingItemPromises[d.handle]=d,delete G._previousRealizationPendingItemPromises[d.handle],a.addWork(function(){if(!G._listView._isZombie()&&(H++,G._createItem(b,d,v,u),!G._listView._isZombie()&&G._realizePass===h&&d.handle)){var c=G._listView._itemsManager._recordFromHandle(d.handle);N(a,c)}})}},P=function(a,b,c){for(var d=b;c>=d;d++)O(a,d)},Q=function(a,b,c){for(var d=c;d>=b;d--)O(a,d)},R=function(a,b,c){for(var d=b;c>=d;d++){var e=G.items.itemDataAt(d);if(e){var f=e.itemsManagerRecord;q(d,f),I++,N(a,f)}}};this._previousRealizationPendingItemPromises=this._pendingItemPromises||{},this._pendingItemPromises={};var S;"left"===k?(Q(G._onscreenJob,n,o),Q(G._frontOffscreenJob,b,n-1),S=b>n-1):(P(G._onscreenJob,n,o),P(G._frontOffscreenJob,o+1,c-1),S=o+1>c-1);for(var T=0,U=Object.keys(this._previousRealizationPendingItemPromises),V=U.length;V>T;T++){var W=U[T];G._listView._itemsManager.releaseItemPromise(this._previousRealizationPendingItemPromises[W])}this._previousRealizationPendingItemPromises={},R(G._onscreenJob,n,o),"left"===k?R(G._frontOffscreenJob,b,n-1):R(G._frontOffscreenJob,o+1,c-1);var X=z===o-n+1;return G._firstLayoutPass?G._listView._canvas.style.opacity=0:X?G._listView._showProgressBar(G._listView._element,"50%","50%"):G._listView._hideProgressBar(),G._frontOffscreenJob.pause(),G._backOffscreenJob.pause(),E.promise.done(function(){G._frontOffscreenJob.resume(),S&&F.complete()},function(){L.cancel()}),F.promise.done(function(){G._listView._writeProfilerMark("frontItemsRealized,info"),"left"===k?(P(G._backOffscreenJob,o+1,c-1),R(G._backOffscreenJob,o+1,c-1)):(Q(G._backOffscreenJob,b,n-1),R(G._backOffscreenJob,b,n-1)),G._backOffscreenJob.resume()}),L.promise.done(function(){G._listView._versionManager.clearCancelOnNotification(M),G._listView._writeProfilerMark(w+" complete(created:"+H+" updated:"+I+"),info")},function(a){return G._listView._versionManager.clearCancelOnNotification(M),G._onscreenJob.clearWork(),G._frontOffscreenJob.clearWork(),G._backOffscreenJob.clearWork(),D.cancel(),E.cancel(),G._listView._writeProfilerMark(w+" canceled(created:"+H+" updated:"+I+" clean:"+J+"),info"),e.wrapError(a)}),G._listView._writeProfilerMark(w+",StopTM"),{viewportItemsRealized:E.promise,allItemsRealized:L.promise,loadingCompleted:e.join([L.promise,D.promise]).then(function(){for(var a=[],d=b;c>d;d++){var f=G.items.itemDataAt(d);f&&a.push(f.itemsManagerRecord.itemReadyPromise)}return e._cancelBlocker(e.join(a))})}}return G._listView._writeProfilerMark(w+",StopTM"),{viewportItemsRealized:e.wrap(),allItemsRealized:e.wrap(),loadingCompleted:e.wrap()}},_setAnimationInViewportState:function(a){if(this._hasAnimationInViewportPending=!1,a&&a.length>0)for(var b=this._listView._getViewportLength(),c=this._listView._layout.itemsFromRange(this._scrollbarPos,this._scrollbarPos+b-1),d=0,e=a.length;e>d;d++){var f=a[d];if(f.newIndex>=c.firstIndex&&f.newIndex<=c.lastIndex&&f.newIndex!==f.oldIndex){this._hasAnimationInViewportPending=!0;break}}},_addHeader:function(a,b){var c=this;return this._listView._groups.renderGroup(b).then(function(a){if(a){a.element.tabIndex=0;var d=c._getHeaderContainer(b);a.element.parentNode!==d&&(d.appendChild(a.element),i.addClass(a.element,l._headerClass)),c._listView._groups.setDomElement(b,a.element)}})},_updateHeaders:function(a,b,c){function d(b){var c=g._listView._groups.group(b);if(c&&!c.header){var d=c.headerPromise;return d||(d=c.headerPromise=g._addHeader(a,b),d.done(function(){c.headerPromise=null},function(){c.headerPromise=null})),d}return e.wrap()}function f(){g._headerRenderPromises=null}var g=this;this._listView._groups.removeElements();var h=this._listView._groups.groupFromItem(b),i=h,j=this._listView._groups.groupFromItem(c-1),k=[];if(null!==i)for(;j>=i;i++)k.push(d(i));return this._headerRenderPromises=e.join(k,this._headerRenderPromises).then(f,f),this._headerRenderPromises||e.wrap()},_unrealizeItem:function(a){var b,c=this._listView;this._listView._writeProfilerMark("_unrealizeItem("+a+"),info");var d=c._selection._getFocused();d.type===k.ObjectType.item&&d.index===a&&(c._unsetFocusOnItem(),b=!0);var e=this.items.itemDataAt(a),f=e.element,g=e.itemBox;g&&g.parentNode&&(i.removeClass(g.parentNode,l._selectedClass),i.removeClass(g.parentNode,l._footprintClass),i.addClass(g.parentNode,l._backdropClass),g.parentNode.removeChild(g)),e.container=null,c._currentMode().itemUnrealized&&c._currentMode().itemUnrealized(a,g),this.items.removeItem(a),e.removed||c._itemsManager.releaseItem(f),h._disposeElement(f),b&&c._setFocusOnItem(c._selection._getFocused())},_unrealizeGroup:function(a){var b,c=a.header,d=this._listView._selection._getFocused();d.type===k.ObjectType.groupHeader&&this._listView._groups.group(d.index)===a&&(this._listView._unsetFocusOnItem(),b=!0),c.parentNode&&c.parentNode.removeChild(c),h._disposeElement(c),a.header=null,a.left=-1,a.top=-1,b&&this._listView._setFocusOnItem(this._listView._selection._getFocused())},_unrealizeItems:function(a){var b=this,c=0;this.items.eachIndex(function(d){return d<b.begin||d>=b.end?(b._unrealizeItem(d),a&&++c>=a):void 0});var d=this._listView._groups,e=d.groupFromItem(this.begin);if(null!==e)for(var f=d.groupFromItem(this.end-1),g=0,h=d.length();h>g;g++){var i=d.group(g);(e>g||g>f)&&i.header&&this._unrealizeGroup(i)}},_unrealizeExcessiveItems:function(){var a=this.items.count(),b=this.end-this.begin,c=b+this._listView._maxDeferredItemCleanup;this._listView._writeProfilerMark("_unrealizeExcessiveItems realized("+a+") approved("+c+"),info"),a>c&&this._unrealizeItems(a-c)},_lazilyUnrealizeItems:function(){this._listView._writeProfilerMark("_lazilyUnrealizeItems,StartTM");var a=this;return s(this._listView).then(function(){function b(){a._listView._writeProfilerMark("_lazilyUnrealizeItems,StopTM")}if(a._listView._isZombie())return void b();var c=[];a.items.eachIndex(function(b){(b<a.begin||b>=a.end)&&c.push(b)}),a._listView._writeProfilerMark("_lazilyUnrealizeItems itemsToUnrealize("+c.length+"),info");var d=[],f=a._listView._groups,h=f.groupFromItem(a.begin);if(null!==h)for(var i=f.groupFromItem(a.end-1),j=0,k=f.length();k>j;j++){var l=f.group(j);(h>j||j>i)&&l.header&&d.push(l)}if(c.length||d.length){var m,n=new e(function(b){function e(f){if(!a._listView._isZombie()){for(var g=-1,h=-1,i=0,j=r(a._listView);c.length&&!j&&!f.shouldYield;){var k=c.shift();a._unrealizeItem(k),i++,0>g&&(g=k),h=k}for(a._listView._writeProfilerMark("unrealizeWorker removeItems:"+i+" ("+g+"-"+h+"),info");d.length&&!j&&!f.shouldYield;)a._unrealizeGroup(d.shift());c.length||d.length?j?f.setPromise(s(a._listView).then(function(){return e;
})):f.setWork(e):b()}}m=g.schedule(e,g.Priority.belowNormal,null,"WinJS.UI.ListView._lazilyUnrealizeItems")});return n.then(b,function(b){return m.cancel(),a._listView._writeProfilerMark("_lazilyUnrealizeItems canceled,info"),a._listView._writeProfilerMark("_lazilyUnrealizeItems,StopTM"),e.wrapError(b)})}return b(),e.wrap()})},_getBoundingRectString:function(a){var b;if(a>=0&&a<this.containers.length){var c=this._listView._layout._getItemPosition(a);c&&(b="["+c.left+"; "+c.top+"; "+c.width+"; "+c.height+" ]")}return b||""},_clearDeferTimeout:function(){this.deferTimeout&&(this.deferTimeout.cancel(),this.deferTimeout=null),-1!==this.deferredActionCancelToken&&(this._listView._versionManager.clearCancelOnNotification(this.deferredActionCancelToken),this.deferredActionCancelToken=-1)},_setupAria:function(a){function b(){d._listView._writeProfilerMark("aria work,StopTM")}function c(a){var b=d._listView._groups,c=b.group(a+1);return c?Math.min(c.startIndex-1,d.end-1):d.end-1}if(!this._listView._isZombie()){var d=this;return this._listView._createAriaMarkers(),this._listView._itemsCount().then(function(f){if(!(f>0&&-1!==d.firstIndexDisplayed&&-1!==d.lastIndexDisplayed))return e.wrap();d._listView._writeProfilerMark("aria work,StartTM");var h,j,k,l,m,n,o=d._listView._ariaStartMarker,q=d._listView._ariaEndMarker,t=d.begin,u=d.items.itemAt(d.begin);return u?(i._ensureId(u),d._listView._groupsEnabled()?(j=d._listView._groups,k=l=j.groupFromItem(d.begin),m=j.group(l),n=c(l),i._ensureId(m.header),i._setAttribute(m.header,"role",d._listView._headerRole),i._setAttribute(m.header,"x-ms-aria-flowfrom",o.id),p(m.header,u),i._setAttribute(m.header,"tabindex",d._listView._tabIndex)):i._setAttribute(u,"x-ms-aria-flowfrom",o.id),new e(function(e){var o=a;h=g.schedule(function v(a){if(d._listView._isZombie())return void b();for(;t<d.end;t++){if(!o&&r(d._listView))return void a.setPromise(s(d._listView).then(function(a){return o=a,v}));if(a.shouldYield)return void a.setWork(v);u=d.items.itemAt(t);var g=d.items.itemAt(t+1);if(g&&i._ensureId(g),i._setAttribute(u,"role",d._listView._itemRole),i._setAttribute(u,"aria-setsize",f),i._setAttribute(u,"aria-posinset",t+1),i._setAttribute(u,"tabindex",d._listView._tabIndex),d._listView._groupsEnabled())if(t!==n&&g)p(u,g);else{var h=j.group(l+1);h&&h.header&&g?(i._setAttribute(h.header,"tabindex",d._listView._tabIndex),i._setAttribute(h.header,"role",d._listView._headerRole),i._ensureId(h.header),p(u,h.header),p(h.header,g)):i._setAttribute(u,"aria-flowto",q.id),l++,m=h,n=c(l)}else g?p(u,g):i._setAttribute(u,"aria-flowto",q.id);if(!g)break}d._listView._fireAccessibilityAnnotationCompleteEvent(d.begin,t,k,l-1),b(),e()},g.Priority.belowNormal,null,"WinJS.UI.ListView._setupAria")},function(){h.cancel(),b()})):void b()})}},_setupDeferredActions:function(){function a(){b._listView._isZombie()||(b.deferTimeout=null,b._listView._versionManager.clearCancelOnNotification(b.deferredActionCancelToken),b.deferredActionCancelToken=-1)}this._listView._writeProfilerMark("_setupDeferredActions,StartTM");var b=this;this._clearDeferTimeout(),this.deferTimeout=this._lazilyRemoveRedundantItemsBlocks().then(function(){return e.timeout(l._DEFERRED_ACTION)}).then(function(){return s(b._listView)}).then(function(a){return b._setupAria(a)}).then(a,function(b){return a(),e.wrapError(b)}),this.deferredActionCancelToken=this._listView._versionManager.cancelOnNotification(this.deferTimeout),this._listView._writeProfilerMark("_setupDeferredActions,StopTM")},_updateAriaMarkers:function(a,b,c){function d(){return f.items.itemAt(b)}function e(){for(var a=c;a>=b;a--)if(f.items.itemAt(a))return f.items.itemAt(a);return null}var f=this;if(!this._listView._isZombie()){this._listView._createAriaMarkers();var g,h,j=this._listView._ariaStartMarker,k=this._listView._ariaEndMarker;if(-1!==b&&-1!==c&&c>=b&&(g=d(),h=e()),!a&&g&&h){if(i._ensureId(g),i._ensureId(h),this._listView._groupsEnabled()){var l=this._listView._groups,m=l.group(l.groupFromItem(b));m.header&&(i._ensureId(m.header),b===m.startIndex?i._setAttribute(j,"aria-flowto",m.header.id):i._setAttribute(j,"aria-flowto",g.id))}else i._setAttribute(j,"aria-flowto",g.id);i._setAttribute(k,"x-ms-aria-flowfrom",h.id)}else p(j,k),this._listView._fireAccessibilityAnnotationCompleteEvent(-1,-1)}},updateAriaForAnnouncement:function(a,b){if(a!==this._listView.header&&a!==this._listView.footer){var c=-1,d=k.ObjectType.item;i.hasClass(a,l._headerClass)?(c=this._listView._groups.index(a),d=k.ObjectType.groupHeader,i._setAttribute(a,"role",this._listView._headerRole),i._setAttribute(a,"tabindex",this._listView._tabIndex)):(c=this.items.index(a),i._setAttribute(a,"aria-setsize",b),i._setAttribute(a,"aria-posinset",c+1),i._setAttribute(a,"role",this._listView._itemRole),i._setAttribute(a,"tabindex",this._listView._tabIndex)),d===k.ObjectType.groupHeader?this._listView._fireAccessibilityAnnotationCompleteEvent(-1,-1,c,c):this._listView._fireAccessibilityAnnotationCompleteEvent(c,c,-1,-1)}},_reportElementsLevel:function(a){function b(a,b){for(var c=0,e=a;b>=e;e++){var f=d.itemDataAt(e);f&&f.container&&c++}return c}var c,d=this.items;c="right"===a?Math.floor(100*b(this.firstIndexDisplayed,this.end-1)/(this.end-this.firstIndexDisplayed)):Math.floor(100*b(this.begin,this.lastIndexDisplayed)/(this.lastIndexDisplayed-this.begin+1)),this._listView._writeProfilerMark("elementsLevel level("+c+"),info")},_createHeaderContainer:function(a){return this._createSurfaceChild(l._headerContainerClass,a)},_createItemsContainer:function(a){var c=this._createSurfaceChild(l._itemsContainerClass,a),d=b.document.createElement("div");return d.className=l._padderClass,c.appendChild(d),c},_ensureContainerInDOM:function(a){var b=this.containers[a];return b&&!this._listView._canvas.contains(b)?(this._forceItemsBlocksInDOM(a,a+1),!0):!1},_ensureItemsBlocksInDOM:function(a,b){if(this._expandedRange){var c=this._expandedRange.first.index,d=this._expandedRange.last.index+1;c>=a&&b>c?b=Math.max(b,d):d>a&&b>=d&&(a=Math.min(a,c))}this._forceItemsBlocksInDOM(a,b)},_removeRedundantItemsBlocks:function(){-1!==this.begin&&-1!==this.end&&this._forceItemsBlocksInDOM(this.begin,this.end)},_lazilyRemoveRedundantItemsBlocks:function(){this._listView._writeProfilerMark("_lazilyRemoveRedundantItemsBlocks,StartTM");var a=this;return s(this._listView).then(function(){function b(){a._listView._writeProfilerMark("_lazilyRemoveRedundantItemsBlocks,StopTM")}if(a._listView._isZombie())return void b();if(a._expandedRange&&-1!==a.begin&&-1!==a.end&&(a._expandedRange.first.index<a.begin||a._expandedRange.last.index+1>a.end)){var c,d=new e(function(b){function d(c){if(!a._listView._isZombie()){for(var e=r(a._listView);a._expandedRange.first.index<a.begin&&!e&&!c.shouldYield;){var f=Math.min(a.begin,a._expandedRange.first.index+a._blockSize*v._blocksToRelease);a._forceItemsBlocksInDOM(f,a.end)}for(;a._expandedRange.last.index+1>a.end&&!e&&!c.shouldYield;){var g=Math.max(a.end,a._expandedRange.last.index-a._blockSize*v._blocksToRelease);a._forceItemsBlocksInDOM(a.begin,g)}a._expandedRange.first.index<a.begin||a._expandedRange.last.index+1>a.end?e?c.setPromise(s(a._listView).then(function(){return d})):c.setWork(d):b()}}c=g.schedule(d,g.Priority.belowNormal,null,"WinJS.UI.ListView._lazilyRemoveRedundantItemsBlocks")});return d.then(b,function(b){return c.cancel(),a._listView._writeProfilerMark("_lazilyRemoveRedundantItemsBlocks canceled,info"),a._listView._writeProfilerMark("_lazilyRemoveRedundantItemsBlocks,StopTM"),e.wrapError(b)})}return b(),e.wrap()})},_forceItemsBlocksInDOM:function(a,b){function c(a,b){var c=a.element.firstElementChild;c.style[q]=b}function d(a){for(var b=0;b<n.tree.length;b++)for(var c=n.tree[b].itemsContainer,d=0,e=c.itemsBlocks.length;e>d;d++)if(a(c,c.itemsBlocks[d]))return}function e(a){n._listView._writeProfilerMark("_itemsBlockExtent,StartTM"),n._listView._itemsBlockExtent=i[n._listView._horizontal()?"getTotalWidth":"getTotalHeight"](a.element),n._listView._writeProfilerMark("_itemsBlockExtent("+n._listView._itemsBlockExtent+"),info"),n._listView._writeProfilerMark("_itemsBlockExtent,StopTM")}function f(){return-1===n._listView._itemsBlockExtent&&d(function(a,b){return b.items.length===n._blockSize&&b.element.parentNode===a.element?(e(b),!0):!1}),-1===n._listView._itemsBlockExtent&&d(function(a,b){return b.items.length===n._blockSize?(a.element.appendChild(b.element),e(b),a.element.removeChild(b.element),!0):!1}),n._listView._itemsBlockExtent}function g(a,b,c){function d(b){var c=a.itemsBlocks[b];c&&c.element.parentNode===a.element&&(a.element.removeChild(c.element),p++)}if(Array.isArray(b))b.forEach(d);else for(var e=b;c>e;e++)d(e)}function h(a,b,c){for(var d=a.element.firstElementChild,e=d,f=b;c>f;f++){var g=a.itemsBlocks[f];g&&(g.element.parentNode!==a.element&&(a.element.insertBefore(g.element,e.nextElementSibling),o++),e=g.element)}}function j(a){if(a<n.tree.length){n._listView._writeProfilerMark("collapseGroup("+a+"),info");var b=n.tree[a].itemsContainer;g(b,0,b.itemsBlocks.length),c(b,"")}}function k(a){if(a<n.tree.length){n._listView._writeProfilerMark("expandGroup("+a+"),info");var b=n.tree[a].itemsContainer;h(b,0,b.itemsBlocks.length),c(b,"")}}function l(a,b){function c(a,b){for(var c=[],d=a;b>=d;d++)c.push(d);return c}var d=b[0],e=b[1],f=a[0],g=a[1];return f>e||d>g?c(f,g):d>f&&g>e?c(f,d-1).concat(c(e+1,g)):d>f?c(f,d-1):g>e?c(e+1,g):null}if(this._blockSize){var m="_forceItemsBlocksInDOM begin("+a+") end("+b+"),";this._listView._writeProfilerMark(m+"StartTM");var n=this,o=0,p=0,q="padding"+(this._listView._horizontal()?"Left":"Top"),r=this._listView._groups.groupFromItem(a),s=this._listView._groups.groupFromItem(b-1),t=this._listView._groups.group(r),u=n.tree[r].itemsContainer,v=Math.floor((a-t.startIndex)/this._blockSize),w=this._listView._groups.group(s),x=n.tree[s].itemsContainer,y=Math.floor((b-1-w.startIndex)/this._blockSize);v&&-1===n._listView._itemsBlockExtent&&d(function(a,b){return b.items.length===n._blockSize&&b.element.parentNode===a.element?(e(b),!0):!1});var z=this._expandedRange?l([this._expandedRange.first.groupIndex,this._expandedRange.last.groupIndex],[r,s]):null;if(z&&z.forEach(j),this._expandedRange&&this._expandedRange.first.groupKey===t.key){var A=l([this._expandedRange.first.block,Number.MAX_VALUE],[v,Number.MAX_VALUE]);A&&g(u,A)}else this._expandedRange&&r>=this._expandedRange.first.groupIndex&&r<=this._expandedRange.last.groupIndex&&g(u,0,v);if(r!==s?(h(u,v,u.itemsBlocks.length),h(x,0,y+1)):h(u,v,y+1),this._expandedRange&&this._expandedRange.last.groupKey===w.key){var A=l([0,this._expandedRange.last.block],[0,y]);A&&g(x,A)}else this._expandedRange&&s>=this._expandedRange.first.groupIndex&&s<=this._expandedRange.last.groupIndex&&g(x,y+1,x.itemsBlocks.length);c(u,v?v*f()+"px":""),r!==s&&c(x,"");for(var B=r+1;s>B;B++)k(B);this._expandedRange={first:{index:a,groupIndex:r,groupKey:t.key,block:v},last:{index:b-1,groupIndex:s,groupKey:w.key,block:y}},this._listView._writeProfilerMark("_forceItemsBlocksInDOM groups("+r+"-"+s+") blocks("+v+"-"+y+") added("+o+") removed("+p+"),info"),this._listView._writeProfilerMark(m+"StopTM")}},_realizePageImpl:function(){var a=this,b="realizePage(scrollPosition:"+this._scrollbarPos+" forceLayout:"+this._forceRelayout+")";return this._listView._writeProfilerMark(b+",StartTM"),this._listView._versionManager.locked?(this._listView._versionManager.unlocked.done(function(){a._listView._isZombie()||a._listView._batchViewUpdates(l._ViewChange.realize,l._ScrollToPriority.low,a._listView.scrollPosition)}),this._listView._writeProfilerMark(b+",StopTM"),e.cancel):new e(function(c){function d(){c(),k.complete()}function g(){a._listView._hideProgressBar(),a._state.setLoadingState(a._listView._LoadingState.viewPortLoaded),a._executeAnimations&&a._setState(F,k.promise)}function h(b){a._updateAriaMarkers(0===b,a.firstIndexDisplayed,a.lastIndexDisplayed),a._state.setLoadingState&&a._state.setLoadingState(a._listView._LoadingState.itemsLoaded)}function j(b){a._listView._clearInsertedItems(),a._listView._groups.removeElements(),g(),h(b),d()}var k=new f;a._state.setLoadingState(a._listView._LoadingState.itemsLoading),a._firstLayoutPass&&a._listView._showProgressBar(a._listView._element,"50%","50%");var l=a.containers.length;if(l){var m,n,o=a.maxLeadingPages,p=a.maxTrailingPages,q=a._listView._getViewportLength();if(a._listView._zooming)m=n=0;else if(v._disableCustomPagesPrefetch)m=n=v._defaultPagesToPrefetch;else{m="left"===a._direction?o:p;var r=Math.max(0,m-a._scrollbarPos/q);n=Math.min(o,r+("right"===a._direction?o:p))}var s=Math.max(0,a._scrollbarPos-m*q),t=a._scrollbarPos+(1+n)*q,u=a._listView._layout.itemsFromRange(s,t-1);if((u.firstIndex<0||u.firstIndex>=l)&&(u.lastIndex<0||u.lastIndex>=l))a.begin=-1,a.end=-1,a.firstIndexDisplayed=-1,a.lastIndexDisplayed=-1,j(l);else{var w=i._clamp(u.firstIndex,0,l-1),x=i._clamp(u.lastIndex+1,0,l),y=a._listView._layout.itemsFromRange(a._scrollbarPos,a._scrollbarPos+q-1),z=i._clamp(y.firstIndex,0,l-1),A=i._clamp(y.lastIndex,0,l-1);if(a._realizationLevel!==v._realizationLevel.skip||a.lastRealizePass||z!==a.firstIndexDisplayed||A!==a.lastIndexDisplayed)if((a._forceRelayout||w!==a.begin||x!==a.end||z!==a.firstIndexDisplayed||A!==a.lastIndexDisplayed)&&x>w&&t>s){a._listView._writeProfilerMark("realizePage currentInView("+z+"-"+A+") previousInView("+a.firstIndexDisplayed+"-"+a.lastIndexDisplayed+") change("+(z-a.firstIndexDisplayed)+"),info"),a._cancelRealize();var B=a._realizePass;a.begin=w,a.end=x,a.firstIndexDisplayed=z,a.lastIndexDisplayed=A,a.deletesWithoutRealize=0,a._ensureItemsBlocksInDOM(a.begin,a.end);var C=a._realizeItems(a._listView._itemCanvas,a.begin,a.end,l,B,a._scrollbarPos,a._direction,z,A,a._forceRelayout);a._forceRelayout=!1;var D=C.viewportItemsRealized.then(function(){return g(),C.allItemsRealized}).then(function(){return a._realizePass===B?a._updateHeaders(a._listView._canvas,a.begin,a.end).then(function(){h(l)}):void 0}).then(function(){return C.loadingCompleted}).then(function(){a._unrealizeExcessiveItems(),a.lastRealizePass=null,d()},function(b){return a._realizePass===B&&(a.lastRealizePass=null,a.begin=-1,a.end=-1),e.wrapError(b)});a.lastRealizePass=e.join([C.viewportItemsRealized,C.allItemsRealized,C.loadingCompleted,D]),a._unrealizeExcessiveItems()}else a.lastRealizePass?a.lastRealizePass.then(d):j(l);else a.begin=w,a.end=w+Object.keys(a.items._itemData).length,a._updateHeaders(a._listView._canvas,a.begin,a.end).done(function(){a.lastRealizePass=null,j(l)})}}else a.begin=-1,a.end=-1,a.firstIndexDisplayed=-1,a.lastIndexDisplayed=-1,j(l);a._reportElementsLevel(a._direction),a._listView._writeProfilerMark(b+",StopTM")})},realizePage:function(a,b,c,d){this._scrollToFunctor=t(a),this._forceRelayout=this._forceRelayout||b,this._scrollEndPromise=c,this._listView._writeProfilerMark(this._state.name+"_realizePage,info"),this._state.realizePage(d||A)},onScroll:function(a,b){this.realizePage(a,!1,b,C)},reload:function(a,b){this._listView._isZombie()||(this._scrollToFunctor=t(a),this._forceRelayout=!0,this._highPriorityRealize=!!b,this.stopWork(!0),this._listView._writeProfilerMark(this._state.name+"_rebuildTree,info"),this._state.rebuildTree())},refresh:function(a){this._listView._isZombie()||(this._scrollToFunctor=t(a),this._forceRelayout=!0,this._highPriorityRealize=!0,this.stopWork(),this._listView._writeProfilerMark(this._state.name+"_relayout,info"),this._state.relayout())},waitForValidScrollPosition:function(a){var b=this,c=this._listView._viewport[this._listView._scrollLength]-this._listView._getViewportLength();return a>c?b._listView._itemsCount().then(function(c){return b.containers.length<c?e._cancelBlocker(b._creatingContainersWork&&b._creatingContainersWork.promise).then(function(){return b._getLayoutCompleted()}).then(function(){return a}):a}):e.wrap(a)},waitForEntityPosition:function(a){var b=this;return a.type===k.ObjectType.header||a.type===k.ObjectType.footer?e.wrap():(this._listView._writeProfilerMark(this._state.name+"_waitForEntityPosition("+a.type+": "+a.index+"),info"),e._cancelBlocker(this._state.waitForEntityPosition(a).then(function(){return a.type!==k.ObjectType.groupHeader&&a.index>=b.containers.length||a.type===k.ObjectType.groupHeader&&b._listView._groups.group(a.index).startIndex>=b.containers.length?b._creatingContainersWork&&b._creatingContainersWork.promise:void 0}).then(function(){return b._getLayoutCompleted()})))},stopWork:function(a){this._listView._writeProfilerMark(this._state.name+"_stop,info"),this._state.stop(a),this._layoutWork&&this._layoutWork.cancel(),a&&this._creatingContainersWork&&this._creatingContainersWork.cancel(),a&&(this._state=new w(this))},_cancelRealize:function(){this._listView._writeProfilerMark("_cancelRealize,StartTM"),(this.lastRealizePass||this.deferTimeout)&&(this._forceRelayout=!0),this._clearDeferTimeout(),this._realizePass++,this._headerRenderPromises&&(this._headerRenderPromises.cancel(),this._headerRenderPromises=null);var a=this.lastRealizePass;a&&(this.lastRealizePass=null,this.begin=-1,this.end=-1,a.cancel()),this._listView._writeProfilerMark("_cancelRealize,StopTM")},resetItems:function(a){if(!this._listView._isZombie()){this.firstIndexDisplayed=-1,this.lastIndexDisplayed=-1,this._runningAnimations=null,this._executeAnimations=!1;var b=this._listView;this._firstLayoutPass=!0,b._unsetFocusOnItem(),b._currentMode().onDataChanged&&b._currentMode().onDataChanged(),this.items.each(function(c,d){a&&d.parentNode&&d.parentNode.parentNode&&d.parentNode.parentNode.removeChild(d.parentNode),b._itemsManager.releaseItem(d),h._disposeElement(d)}),this.items.removeItems(),this._deferredReparenting=[],a&&b._groups.removeElements(),b._clearInsertedItems()}},reset:function(){if(this.stopWork(!0),this._state=new w(this),this.resetItems(),!this._listView._isZombie()){var a=this._listView;a._groups.resetGroups(),a._resetCanvas(),this.tree=null,this.keyToGroupIndex=null,this.containers=null,this._expandedRange=null}},cleanUp:function(){this.stopWork(!0),this._runningAnimations&&this._runningAnimations.cancel();var a=this._listView._itemsManager;this.items.each(function(b,c){a.releaseItem(c),h._disposeElement(c)}),this._listView._unsetFocusOnItem(),this.items.removeItems(),this._deferredReparenting=[],this._listView._groups.resetGroups(),this._listView._resetCanvas(),this.tree=null,this.keyToGroupIndex=null,this.containers=null,this._expandedRange=null,this.destroyed=!0},getContainer:function(a){return this.containers[a]},_getHeaderContainer:function(a){return this.tree[a].header},_getGroups:function(a){if(this._listView._groupDataSource){var b=this._listView._groups.groups,c=[];if(a)for(var d=0,e=b.length;e>d;d++){var f=b[d],g=e>d+1?b[d+1].startIndex:a;c.push({key:f.key,size:g-f.startIndex})}return c}return[{key:"-1",size:a}]},_createChunk:function(a,b,c){function d(a,b){var d=a.element.children,e=d.length,g=Math.min(b-a.items.length,c);j.insertAdjacentHTMLUnsafe(a.element,"beforeend",n._repeat("<div class='win-container win-backdrop'></div>",g));for(var h=0;g>h;h++){var i=d[e+h];a.items.push(i),f.containers.push(i)}}function e(a){var b={header:f._listView._groupDataSource?f._createHeaderContainer():null,itemsContainer:{element:f._createItemsContainer(),items:[]}};f.tree.push(b),f.keyToGroupIndex[a.key]=f.tree.length-1,d(b.itemsContainer,a.size)}var f=this;if(this._listView._writeProfilerMark("createChunk,StartTM"),this.tree.length&&this.tree.length<=a.length){var g=this.tree[this.tree.length-1],h=a[this.tree.length-1].size;if(g.itemsContainer.items.length<h)return d(g.itemsContainer,h),void this._listView._writeProfilerMark("createChunk,StopTM")}this.tree.length<a.length&&e(a[this.tree.length]),this._listView._writeProfilerMark("createChunk,StopTM")},_createChunkWithBlocks:function(a,c,d,e){function f(a,c){var f,g=a.itemsBlocks.length?a.itemsBlocks[a.itemsBlocks.length-1]:null;if(c=Math.min(c,e),g&&g.items.length<d){var i=Math.min(c,d-g.items.length),k=g.items.length,f=(a.itemsBlocks.length-1)*d+k,l=n._stripedContainers(i,f);j.insertAdjacentHTMLUnsafe(g.element,"beforeend",l),w=g.element.children;for(var m=0;i>m;m++){var o=w[k+m];g.items.push(o),h.containers.push(o)}c-=i}f=a.itemsBlocks.length*d;var p=Math.floor(c/d),q="",r=f,s=f+d;if(p>0){var t=["<div class='win-itemsblock'>"+n._stripedContainers(d,r)+"</div>","<div class='win-itemsblock'>"+n._stripedContainers(d,s)+"</div>"];q=n._repeat(t,p),f+=p*d}var u=c%d;u>0&&(q+="<div class='win-itemsblock'>"+n._stripedContainers(u,f)+"</div>",f+=u,p++);var v=b.document.createElement("div");j.setInnerHTMLUnsafe(v,q);for(var w=v.children,x=0;p>x;x++){var y=w[x],z={element:y,items:n._nodeListToArray(y.children)};a.itemsBlocks.push(z);for(var A=0;A<z.items.length;A++)h.containers.push(z.items[A])}}function g(a){var b={header:h._listView._groupDataSource?h._createHeaderContainer():null,itemsContainer:{element:h._createItemsContainer(),itemsBlocks:[]}};h.tree.push(b),h.keyToGroupIndex[a.key]=h.tree.length-1,f(b.itemsContainer,a.size)}var h=this;if(this._listView._writeProfilerMark("createChunk,StartTM"),this.tree.length&&this.tree.length<=a.length){var i=this.tree[this.tree.length-1].itemsContainer,k=a[this.tree.length-1].size,l=0;if(i.itemsBlocks.length&&(l=(i.itemsBlocks.length-1)*d+i.itemsBlocks[i.itemsBlocks.length-1].items.length),k>l)return f(i,k-l),void this._listView._writeProfilerMark("createChunk,StopTM")}this.tree.length<a.length&&g(a[this.tree.length]),this._listView._writeProfilerMark("createChunk,StopTM")},_generateCreateContainersWorker:function(){var a=this,b=0,c=!1;return function e(f){a._listView._versionManager.locked?f.setPromise(a._listView._versionManager.unlocked.then(function(){return e})):a._listView._itemsCount().then(function(g){var h=!c&&r(a._listView);if(h)f.setPromise(s(a._listView).then(function(a){return c=a,e}));else{if(a._listView._isZombie())return;c=!1;var i=d._now()+v._createContainersJobTimeslice,j=a._getGroups(g),k=a.containers.length,l=a.end===a.containers.length,m=v._chunkSize;do a._blockSize?a._createChunkWithBlocks(j,g,a._blockSize,m):a._createChunk(j,g,m),b++;while(a.containers.length<g&&d._now()<i);a._listView._writeProfilerMark("createContainers yields containers("+a.containers.length+"),info"),a._listView._affectedRange.add({start:k,end:a.containers.length},g),l?(a.stopWork(),a._listView._writeProfilerMark(a._state.name+"_relayout,info"),a._state.relayout()):(a._listView._writeProfilerMark(a._state.name+"_layoutNewContainers,info"),a._state.layoutNewContainers()),a.containers.length<g?f.setWork(e):(a._listView._writeProfilerMark("createContainers completed steps("+b+"),info"),a._creatingContainersWork.complete())}})}},_scheduleLazyTreeCreation:function(){return g.schedule(this._generateCreateContainersWorker(),g.Priority.idle,this,"WinJS.UI.ListView.LazyTreeCreation")},_createContainers:function(){this.tree=null,this.keyToGroupIndex=null,this.containers=null,this._expandedRange=null;var a,b=this;return this._listView._itemsCount().then(function(c){return 0===c&&b._listView._hideProgressBar(),a=c,b._listView._writeProfilerMark("createContainers("+a+"),StartTM"),b._listView._groupDataSource?b._listView._groups.initialize():void 0}).then(function(){return b._listView._writeProfilerMark("numberOfItemsPerItemsBlock,StartTM"),a&&b._listView._groups.length()?b._listView._layout.numberOfItemsPerItemsBlock:null}).then(function(c){b._listView._writeProfilerMark("numberOfItemsPerItemsBlock("+c+"),info"),b._listView._writeProfilerMark("numberOfItemsPerItemsBlock,StopTM"),b._listView._resetCanvas(),b.tree=[],b.keyToGroupIndex={},b.containers=[],b._blockSize=c;var e,f=b._getGroups(a),g=d._now()+v._maxTimePerCreateContainers,h=Math.min(v._startupChunkSize,v._chunkSize);do e=c?b._createChunkWithBlocks(f,a,c,h):b._createChunk(f,a,h);while(d._now()<g&&b.containers.length<a&&!e);if(b._listView._writeProfilerMark("createContainers created("+b.containers.length+"),info"),b._listView._affectedRange.add({start:0,end:b.containers.length},a),b.containers.length<a){var i=b._scheduleLazyTreeCreation();b._creatingContainersWork.promise.done(null,function(){i.cancel()})}else b._listView._writeProfilerMark("createContainers completed synchronously,info"),b._creatingContainersWork.complete();b._listView._writeProfilerMark("createContainers("+a+"),StopTM")})},_updateItemsBlocks:function(a){function c(){var a=b.document.createElement("div");return a.className=l._itemsBlockClass,a}function d(b,d){function g(){b.itemsBlocks=null,b.items=[];for(var a=0;k>a;a++){var c=e.containers[d+a];b.element.appendChild(c),b.items.push(c)}}function h(){b.itemsBlocks=[{element:j.length?j.shift():c(),items:[]}];for(var f=b.itemsBlocks[0],g=0;k>g;g++){if(f.items.length===a){var h=j.length?j.shift():c();b.itemsBlocks.push({element:h,items:[]}),f=b.itemsBlocks[b.itemsBlocks.length-1]}var i=e.containers[d+g];f.element.appendChild(i),f.items.push(i)}b.items=null}var i,j=[],k=0,l=b.itemsBlocks;if(l)for(i=0;i<l.length;i++)k+=l[i].items.length,j.push(l[i].element);else k=b.items.length;for(f?h():g(),i=0;i<j.length;i++){var m=j[i];m.parentNode===b.element&&b.element.removeChild(m)}return k}for(var e=this,f=!!a,g=0,h=0;g<this.tree.length;g++)h+=d(this.tree[g].itemsContainer,h);e._blockSize=a},_layoutItems:function(){var a=this;return this._listView._itemsCount().then(function(){return e.as(a._listView._layout.numberOfItemsPerItemsBlock).then(function(b){a._listView._writeProfilerMark("numberOfItemsPerItemsBlock("+b+"),info"),b!==a._blockSize&&(a._updateItemsBlocks(b),a._listView._itemsBlockExtent=-1);var c,d=a._listView._affectedRange.get();return d&&(c={firstIndex:Math.max(d.start-1,0),lastIndex:Math.min(a.containers.length-1,d.end)},c.firstIndex<a.containers.length||0===a.containers.length)?a._listView._layout.layout(a.tree,c,a._modifiedElements||[],a._modifiedGroups||[]):(a._listView._affectedRange.clear(),{realizedRangeComplete:e.wrap(),layoutComplete:e.wrap()})})})},updateTree:function(a,b,c){return this._listView._writeProfilerMark(this._state.name+"_updateTree,info"),this._state.updateTree(a,b,c)},_updateTreeImpl:function(a,c,d,e){function f(a){for(var b=0,c=a.length;c>b;b++){var d=a[b];d.parentNode.removeChild(d)}}if(this._executeAnimations=!0,this._modifiedElements=d,!d.handled){d.handled=!0,this._listView._writeProfilerMark("_updateTreeImpl,StartTM");var g,h=this;e||this._unrealizeItems();for(var g=0,j=d.length;j>g;g++)d[g]._itemBox&&d[g]._itemBox.parentNode&&i.removeClass(d[g]._itemBox.parentNode,l._selectedClass);this.items.each(function(a,b,c){c.container&&i.removeClass(c.container,l._selectedClass),c.container&&i.addClass(c.container,l._backdropClass)});var k=this._listView._updateContainers(this._getGroups(a),a,c,d);f(k.removedHeaders),f(k.removedItemsContainers);for(var g=0,j=d.length;j>g;g++){var n=d[g];if(-1!==n.newIndex){if(n.element=this.getContainer(n.newIndex),!n.element)throw"Container missing after updateContainers."}else i.removeClass(n.element,l._backdropClass)}var o=b.document.activeElement;this._listView._canvas.contains(o)&&(this._requireFocusRestore=o),this._deferredReparenting=[],this.items.each(function(a,b,c){var d=h.getContainer(a),e=c.itemBox;e&&d&&(c.container=d,e.parentNode!==d&&(a>=h.firstIndexDisplayed&&a<=h.lastIndexDisplayed?h._appendAndRestoreFocus(d,e):h._deferredReparenting.push({itemBox:e,container:d})),i.removeClass(d,l._backdropClass),i[h._listView.selection._isIncluded(a)?"addClass":"removeClass"](d,l._selectedClass),!h._listView.selection._isIncluded(a)&&i.hasClass(e,l._selectedClass)&&m._ItemEventsHandler.renderSelection(e,c.element,!1,!0))}),this._listView._writeProfilerMark("_updateTreeImpl,StopTM")}},_completeUpdateTree:function(){if(this._deferredReparenting){var a=this._deferredReparenting.length;if(a>0){var b="_completeReparenting("+a+")";this._listView._writeProfilerMark(b+",StartTM");for(var c,d=0;a>d;d++)c=this._deferredReparenting[d],this._appendAndRestoreFocus(c.container,c.itemBox);this._deferredReparenting=[],this._listView._writeProfilerMark(b+",StopTM")}}this._requireFocusRestore=null},_appendAndRestoreFocus:function(a,c){if(c.parentNode!==a){var d;if(this._requireFocusRestore&&(d=b.document.activeElement),this._requireFocusRestore&&this._requireFocusRestore===d&&(a.contains(d)||c.contains(d))&&(this._listView._unsetFocusOnItem(),d=b.document.activeElement),i.empty(a),a.appendChild(c),this._requireFocusRestore&&d===this._listView._keyboardEventsHelper){var e=this._listView._selection._getFocused();e.type===k.ObjectType.item&&this.items.itemBoxAt(e.index)===c&&(i._setActive(this._requireFocusRestore),this._requireFocusRestore=null)}}},_startAnimations:function(){this._listView._writeProfilerMark("startAnimations,StartTM");var a=this;this._hasAnimationInViewportPending=!1;var b=e.as(this._listView._layout.executeAnimations()).then(function(){a._listView._writeProfilerMark("startAnimations,StopTM")});return b},_setState:function(a,b){if(!this._listView._isZombie()){var c=this._state.name;this._state=new a(this,b),this._listView._writeProfilerMark(this._state.name+"_enter from("+c+"),info"),this._state.enter()}},getAdjacent:function(a,b){var c=this;return this.waitForEntityPosition(a).then(function(){return c._listView._layout.getAdjacent(a,b)})},hitTest:function(a,b){if(this._realizedRangeLaidOut)return{index:-1,insertAfterIndex:-1};var c=this._listView._layout.hitTest(a,b);return c.index=i._clamp(c.index,-1,this._listView._cachedCount-1,0),c.insertAfterIndex=i._clamp(c.insertAfterIndex,-1,this._listView._cachedCount-1,0),c},_createTreeBuildingSignal:function(){if(!this._creatingContainersWork){this._creatingContainersWork=new f;var a=this;this._creatingContainersWork.promise.done(function(){a._creatingContainersWork=null},function(){a._creatingContainersWork=null})}},_createLayoutSignal:function(){var a=this;this._layoutCompleted||(this._layoutCompleted=new f,this._layoutCompleted.promise.done(function(){a._layoutCompleted=null},function(){a._layoutCompleted=null})),this._realizedRangeLaidOut||(this._realizedRangeLaidOut=new f,this._realizedRangeLaidOut.promise.done(function(){a._realizedRangeLaidOut=null},function(){a._realizedRangeLaidOut=null}))},_getLayoutCompleted:function(){return this._layoutCompleted?e._cancelBlocker(this._layoutCompleted.promise):e.wrap()},_createSurfaceChild:function(a,c){var d=b.document.createElement("div");return d.className=a,this._listView._canvas.insertBefore(d,c?c.nextElementSibling:null),d},_executeScrollToFunctor:function(){var a=this;return e.as(this._scrollToFunctor?this._scrollToFunctor():null).then(function(b){a._scrollToFunctor=null,b=b||{},+b.position===b.position&&(a._scrollbarPos=b.position),a._direction=b.direction||"right"})}},{_defaultPagesToPrefetch:2,_iOSMaxLeadingPages:6,_iOSMaxTrailingPages:2,_disableCustomPagesPrefetch:!1,_waitForSeZoIntervalDuration:100,_waitForSeZoTimeoutDuration:500,_chunkSize:500,_startupChunkSize:100,_maxTimePerCreateContainers:5,_createContainersJobTimeslice:15,_blocksToRelease:10,_realizationLevel:{skip:"skip",realize:"realize",normal:"normal"}}),w=c.Class.define(function(a){this.view=a,this.view._createTreeBuildingSignal(),this.view._createLayoutSignal()},{name:"CreatedState",enter:function(){this.view._createTreeBuildingSignal(),this.view._createLayoutSignal()},stop:u,realizePage:u,rebuildTree:function(){this.view._setState(x)},relayout:function(){this.view._setState(x)},layoutNewContainers:u,waitForEntityPosition:function(){return this.view._setState(x),this.view._getLayoutCompleted()},updateTree:u}),x=c.Class.define(function(a){this.view=a},{name:"BuildingState",enter:function(){this.canceling=!1,this.view._createTreeBuildingSignal(),this.view._createLayoutSignal();var a=this,b=new f;this.promise=b.promise.then(function(){return a.view._createContainers()}).then(function(){a.view._setState(y)},function(b){return a.canceling||(a.view._setState(w),a.view._listView._raiseViewComplete()),e.wrapError(b)}),b.complete()},stop:function(){this.canceling=!0,this.promise.cancel(),this.view._setState(w);
},realizePage:u,rebuildTree:function(){this.canceling=!0,this.promise.cancel(),this.enter()},relayout:u,layoutNewContainers:u,waitForEntityPosition:function(){return this.view._getLayoutCompleted()},updateTree:u}),y=c.Class.define(function(a,b){this.view=a,this.nextStateType=b||A},{name:"LayingoutState",enter:function(){var a=this;this.canceling=!1,this.view._createLayoutSignal(),this.view._listView._writeProfilerMark(this.name+"_enter_layoutItems,StartTM");var b=new f;this.promise=b.promise.then(function(){return a.view._layoutItems()}).then(function(b){return a.view._layoutWork=b.layoutComplete,b.realizedRangeComplete}).then(function(){a.view._listView._writeProfilerMark(a.name+"_enter_layoutItems,StopTM"),a.view._listView._clearInsertedItems(),a.view._setAnimationInViewportState(a.view._modifiedElements),a.view._modifiedElements=[],a.view._modifiedGroups=[],a.view._realizedRangeLaidOut.complete(),a.view._layoutWork.then(function(){a.view._listView._writeProfilerMark(a.name+"_enter_layoutCompleted,info"),a.view._listView._affectedRange.clear(),a.view._layoutCompleted.complete()}),a.canceling||a.view._setState(a.nextStateType)},function(b){return a.view._listView._writeProfilerMark(a.name+"_enter_layoutCanceled,info"),a.canceling||(a.view.firstIndexDisplayed=a.view.lastIndexDisplayed=-1,a.view._updateAriaMarkers(!0,a.view.firstIndexDisplayed,a.view.lastIndexDisplayed),a.view._setState(G)),e.wrapError(b)}),b.complete(),this.canceling&&this.promise.cancel()},cancelLayout:function(a){this.view._listView._writeProfilerMark(this.name+"_cancelLayout,info"),this.canceling=!0,this.promise&&this.promise.cancel(),a&&this.view._setState(z)},stop:function(){this.cancelLayout(!0)},realizePage:u,rebuildTree:function(){this.cancelLayout(!1),this.view._setState(x)},relayout:function(){this.cancelLayout(!1),this.enter()},layoutNewContainers:function(){this.relayout()},waitForEntityPosition:function(){return this.view._getLayoutCompleted()},updateTree:function(a,b,c){return this.view._updateTreeImpl(a,b,c)}}),z=c.Class.define(function(a){this.view=a},{name:"LayoutCanceledState",enter:u,stop:u,realizePage:function(){this.relayout()},rebuildTree:function(){this.view._setState(x)},relayout:function(){this.view._setState(y)},layoutNewContainers:function(){this.relayout()},waitForEntityPosition:function(){return this.view._getLayoutCompleted()},updateTree:function(a,b,c){return this.view._updateTreeImpl(a,b,c)}}),A=c.Class.define(function(a){this.view=a,this.nextState=E,this.relayoutNewContainers=!0},{name:"RealizingState",enter:function(){var a=this,b=new f;this.promise=b.promise.then(function(){return a.view._executeScrollToFunctor()}).then(function(){return a.relayoutNewContainers=!1,e._cancelBlocker(a.view._realizePageImpl())}).then(function(){a.view._state===a&&(a.view._completeUpdateTree(),a.view._listView._writeProfilerMark("RealizingState_to_UnrealizingState"),a.view._setState(a.nextState))},function(b){return a.view._state!==a||a.canceling||(a.view._listView._writeProfilerMark("RealizingState_to_CanceledState"),a.view._setState(B)),e.wrapError(b)}),b.complete()},stop:function(){this.canceling=!0,this.promise.cancel(),this.view._cancelRealize(),this.view._setState(B)},realizePage:function(){this.canceling=!0,this.promise.cancel(),this.enter()},rebuildTree:function(){this.stop(),this.view._setState(x)},relayout:function(){this.stop(),this.view._setState(y)},layoutNewContainers:function(){this.relayoutNewContainers?this.relayout():(this.view._createLayoutSignal(),this.view._relayoutInComplete=!0)},waitForEntityPosition:function(){return this.view._getLayoutCompleted()},updateTree:function(a,b,c){return this.view._updateTreeImpl(a,b,c)},setLoadingState:function(a){this.view._listView._setViewState(a)}}),B=c.Class.define(function(a){this.view=a},{name:"CanceledState",enter:u,stop:function(){this.view._cancelRealize()},realizePage:function(a){this.stop(),this.view._setState(a)},rebuildTree:function(){this.stop(),this.view._setState(x)},relayout:function(a){this.stop(),this.view._setState(y,a)},layoutNewContainers:function(){this.relayout(B)},waitForEntityPosition:function(){return this.view._getLayoutCompleted()},updateTree:function(a,b,c){return this.view._updateTreeImpl(a,b,c)}}),C=c.Class.derive(A,function(a){this.view=a,this.nextState=D,this.relayoutNewContainers=!0},{name:"ScrollingState",setLoadingState:function(){}}),D=c.Class.derive(B,function(a){this.view=a},{name:"ScrollingPausedState",enter:function(){var a=this;this.promise=e._cancelBlocker(this.view._scrollEndPromise).then(function(){a.view._setState(E)})},stop:function(){this.promise.cancel(),this.view._cancelRealize()}}),E=c.Class.define(function(a){this.view=a},{name:"UnrealizingState",enter:function(){var a=this;this.promise=this.view._lazilyUnrealizeItems().then(function(){return a.view._listView._writeProfilerMark("_renderCompletePromise wait starts,info"),a.view._renderCompletePromise}).then(function(){a.view._setState(G)})},stop:function(){this.view._cancelRealize(),this.promise.cancel(),this.view._setState(B)},realizePage:function(a){this.promise.cancel(),this.view._setState(a)},rebuildTree:function(){this.view._setState(x)},relayout:function(){this.view._setState(y)},layoutNewContainers:function(){this.view._createLayoutSignal(),this.view._relayoutInComplete=!0},waitForEntityPosition:function(){return this.view._getLayoutCompleted()},updateTree:function(a,b,c){return this.view._updateTreeImpl(a,b,c)}}),F=c.Class.define(function(a,b){this.view=a,this.realizePromise=b,this.realizeId=1},{name:"RealizingAnimatingState",enter:function(){var a=this;this.animating=!0,this.animatePromise=this.view._startAnimations(),this.animateSignal=new f,this.view._executeAnimations=!1,this.animatePromise.done(function(){a.animating=!1,a.modifiedElements?(a.view._updateTreeImpl(a.count,a.delta,a.modifiedElements),a.modifiedElements=null,a.view._setState(B)):a.animateSignal.complete()},function(b){return a.animating=!1,e.wrapError(b)}),this._waitForRealize()},_waitForRealize:function(){var a=this;this.realizing=!0,this.realizePromise.done(function(){a.realizing=!1});var b=++this.realizeId;e.join([this.realizePromise,this.animateSignal.promise]).done(function(){b===a.realizeId&&(a.view._completeUpdateTree(),a.view._listView._writeProfilerMark("RealizingAnimatingState_to_UnrealizingState"),a.view._setState(E))})},stop:function(a){this.realizePromise.cancel(),this.view._cancelRealize(),a&&(this.animatePromise.cancel(),this.view._setState(B))},realizePage:function(){if(!this.modifiedElements){var a=this;this.realizePromise=this.view._executeScrollToFunctor().then(function(){return e._cancelBlocker(a.view._realizePageImpl())}),this._waitForRealize()}},rebuildTree:function(){this.stop(!0),this.view._setState(x)},relayout:function(){this.stop(!0),this.modifiedElements&&(this.view._updateTreeImpl(this.count,this.delta,this.modifiedElements),this.modifiedElements=null),this.view._setState(y)},layoutNewContainers:function(){this.view._createLayoutSignal(),this.view._relayoutInComplete=!0},waitForEntityPosition:function(){return this.view._getLayoutCompleted()},updateTree:function(a,b,c){if(this.animating){var d=this.modifiedElements;return this.count=a,this.delta=b,this.modifiedElements=c,d?e.cancel:this.animatePromise}return this.view._updateTreeImpl(a,b,c)},setLoadingState:function(a){this.view._listView._setViewState(a)}}),G=c.Class.derive(B,function(a){this.view=a},{name:"CompletedState",enter:function(){this._stopped=!1,this.view._setupDeferredActions(),this.view._realizationLevel=v._realizationLevel.normal,this.view._listView._raiseViewComplete(),this.view._state===this&&this.view._relayoutInComplete&&!this._stopped&&this.view._setState(H)},stop:function(){this._stopped=!0,B.prototype.stop.call(this)},layoutNewContainers:function(){this.view._createLayoutSignal(),this.view._setState(H)},updateTree:function(a,b,c){return this.view._updateTreeImpl(a,b,c,!0)}}),H=c.Class.derive(B,function(a){this.view=a},{name:"LayingoutNewContainersState",enter:function(){var a=this;this.promise=e.join([this.view.deferTimeout,this.view._layoutWork]),this.promise.then(function(){a.view._relayoutInComplete=!1,a.relayout(B)})},stop:function(){this.promise.cancel(),this.view._cancelRealize()},realizePage:function(a){this.stop(),this.view._setState(y,a)},layoutNewContainers:function(){this.view._createLayoutSignal()}});return v})})}),d("require-style!less/styles-listview",[],function(){}),d("require-style!less/colors-listview",[],function(){}),d("WinJS/Controls/ListView",["../Core/_Global","../Core/_Base","../Core/_BaseUtils","../Core/_ErrorFromName","../Core/_Events","../Core/_Log","../Core/_Resources","../Core/_WriteProfilerMark","../_Accents","../Animations","../Animations/_TransitionAnimation","../BindingList","../Promise","../Scheduler","../_Signal","../Utilities/_Control","../Utilities/_Dispose","../Utilities/_ElementUtilities","../Utilities/_Hoverable","../Utilities/_ItemsManager","../Utilities/_SafeHtml","../Utilities/_TabContainer","../Utilities/_UI","../Utilities/_VersionManager","./ElementResizeInstrument","./ItemContainer/_Constants","./ItemContainer/_ItemEventsHandler","./ListView/_BrowseMode","./ListView/_ErrorMessages","./ListView/_GroupFocusCache","./ListView/_GroupsContainer","./ListView/_Helpers","./ListView/_ItemsContainer","./ListView/_Layouts","./ListView/_SelectionManager","./ListView/_VirtualizeContentsView","require-style!less/styles-listview","require-style!less/colors-listview"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J){"use strict";function K(){var a=Q;Q=[],a=a.filter(function(a){return a._isZombie()?(a._dispose(),!1):!0}),Q=Q.concat(a)}function L(a){Q.push(a),N&&N.cancel(),N=m.timeout(P).then(K)}function M(a){return a.offsetParent?a.offsetParent.offsetWidth-a.offsetLeft-a.offsetWidth:0}i.createAccentRule(".win-listview:not(.win-selectionstylefilled) .win-selectioncheckmarkbackground, .win-itemcontainer:not(.win-selectionstylefilled) .win-selectioncheckmarkbackground",[{name:"border-color",value:i.ColorTypes.accent},{name:"background-color",value:i.ColorTypes.accent}]),i.createAccentRule(".win-listview:not(.win-selectionstylefilled) .win-container.win-selected .win-selectionborder, .win-itemcontainer:not(.win-selectionstylefilled).win-container.win-selected .win-selectionborder",[{name:"border-color",value:i.ColorTypes.accent}]),i.createAccentRule(".win-listview.win-selectionstylefilled .win-selected .win-selectionbackground, .win-itemcontainer.win-selectionstylefilled.win-selected .win-selectionbackground",[{name:"background-color",value:i.ColorTypes.accent}]);var N,O=c._browserStyleEquivalents.transform,P=1e3,Q=[],R=r._uniqueID,S={get notCompatibleWithSemanticZoom(){return"ListView can only be used with SemanticZoom if randomAccess loading behavior is specified."},get listViewInvalidItem(){return"Item must provide index, key or description of corresponding item."},get listViewViewportAriaLabel(){return g._getWinJSString("ui/listViewViewportAriaLabel").value}},T=c.requireSupportedForProcessing,U={entrance:"entrance",contentTransition:"contentTransition"};b.Namespace.define("WinJS.UI",{ListViewAnimationType:U,ListView:b.Namespace._lazy(function(){var g=b.Class.define(function(){this.clear()},{add:function(a,b){if(a._lastKnownSizeOfData=b,this._range){this._range.start=Math.min(this._range.start,a.start);var c=this._range._lastKnownSizeOfData-this._range.end,d=a._lastKnownSizeOfData-a.end,e=Math.min(c,d);this._range._lastKnownSizeOfData=a._lastKnownSizeOfData,this._range.end=this._range._lastKnownSizeOfData-e}else this._range=a},addAll:function(){this.add({start:0,end:Number.MAX_VALUE},Number.MAX_VALUE)},clear:function(){this._range=null},get:function(){return this._range}}),i=b.Class.define(function(a){this._listView=a},{getPanAxis:function(){return this._listView._getPanAxis()},configureForZoom:function(a,b,c,d){this._listView._configureForZoom(a,b,c,d)},setCurrentItem:function(a,b){this._listView._setCurrentItem(a,b)},getCurrentItem:function(){return this._listView._getCurrentItem()},beginZoom:function(){return this._listView._beginZoom()},positionItem:function(a,b){return this._listView._positionItem(a,b)},endZoom:function(a){this._listView._endZoom(a)},pinching:{get:function(){return this._listView._pinching},set:function(a){this._listView._pinching=a}}}),s=b.Class.define(function(b,c){if(b=b||a.document.createElement("div"),this._id=b.id||"",this._writeProfilerMark("constructor,StartTM"),c=c||{},b.winControl=this,r.addClass(b,"win-disposable"),this._affectedRange=new g,this._mutationObserver=new r._MutationObserver(this._itemPropertyChange.bind(this)),this._versionManager=null,this._insertedItems={},this._element=b,this._startProperty=null,this._scrollProperty=null,this._scrollLength=null,this._scrolling=!1,this._zooming=!1,this._pinching=!1,this._itemsManager=null,this._canvas=null,this._cachedCount=z._UNINITIALIZED,this._loadingState=this._LoadingState.complete,this._firstTimeDisplayed=!0,this._currentScrollPosition=0,this._lastScrollPosition=0,this._notificationHandlers=[],this._itemsBlockExtent=-1,this._lastFocusedElementInGroupTrack={type:w.ObjectType.item,index:-1},this._headerFooterVisibilityStatus={headerVisible:!1,footerVisible:!1},this._viewportWidth=z._UNINITIALIZED,this._viewportHeight=z._UNINITIALIZED,this._manipulationState=r._MSManipulationEvent.MS_MANIPULATION_STATE_STOPPED,this._maxDeferredItemCleanup=Number.MAX_VALUE,this._groupsToRemove={},this._setupInternalTree(),this._isCurrentZoomView=!0,this._dragSource=!1,this._reorderable=!1,this._groupFocusCache=new D._UnsupportedGroupFocusCache,this._viewChange=z._ViewChange.rebuild,this._scrollToFunctor=null,this._setScrollbarPosition=!1,this._view=new J._VirtualizeContentsView(this),this._selection=new I._SelectionManager(this),this._createTemplates(),this._groupHeaderRenderer=t._trivialHtmlRenderer,this._itemRenderer=t._trivialHtmlRenderer,this._groupHeaderRelease=null,this._itemRelease=null,c.itemDataSource)this._dataSource=c.itemDataSource;else{var d=new l.List;this._dataSource=d.dataSource}this._selectionMode=w.SelectionMode.multi,this._tap=w.TapBehavior.invokeOnly,this._groupHeaderTap=w.GroupHeaderTapBehavior.invoke,this._mode=new B._SelectionMode(this),this._groups=new E._NoGroups(this),this._updateItemsAriaRoles(),this._updateGroupHeadersAriaRoles(),this._element.setAttribute("aria-multiselectable",this._multiSelection()),this._element.tabIndex=-1,this._tabManager.tabIndex=this._tabIndex,"absolute"!==this._element.style.position&&"relative"!==this._element.style.position&&(this._element.style.position="relative"),this._updateItemsManager(),c.layout||this._updateLayout(new H.GridLayout),this._attachEvents(),this._runningInit=!0,p.setOptions(this,c),this._runningInit=!1,this._batchViewUpdates(z._ViewChange.rebuild,z._ScrollToPriority.medium,0),this._writeProfilerMark("constructor,StopTM")},{element:{get:function(){return this._element}},layout:{get:function(){return this._layoutImpl},set:function(a){this._updateLayout(a),this._runningInit||(this._view.reset(),this._updateItemsManager(),this._batchViewUpdates(z._ViewChange.rebuild,z._ScrollToPriority.medium,0,!0))}},maxLeadingPages:{get:function(){return this._view.maxLeadingPages},set:function(a){this._view.maxLeadingPages=Math.max(0,Math.floor(a))}},maxTrailingPages:{get:function(){return this._view.maxTrailingPages},set:function(a){this._view.maxTrailingPages=Math.max(0,Math.floor(a))}},pagesToLoad:{get:function(){return 2*J._VirtualizeContentsView._defaultPagesToPrefetch+1},set:function(){r._deprecated(C.pagesToLoadIsDeprecated)}},pagesToLoadThreshold:{get:function(){return 0},set:function(){r._deprecated(C.pagesToLoadThresholdIsDeprecated)}},groupDataSource:{get:function(){return this._groupDataSource},set:function(a){function b(a){a.detail===w.DataSourceStatus.failure&&(c.itemDataSource=null,c.groupDataSource=null)}this._writeProfilerMark("set_groupDataSource,info");var c=this;this._groupDataSource&&this._groupDataSource.removeEventListener&&this._groupDataSource.removeEventListener("statuschanged",b,!1),this._groupDataSource=a,this._groupFocusCache=a&&this._supportsGroupHeaderKeyboarding?new D._GroupFocusCache(this):new D._UnsupportedGroupFocusCache,this._groupDataSource&&this._groupDataSource.addEventListener&&this._groupDataSource.addEventListener("statuschanged",b,!1),this._createGroupsContainer(),this._runningInit?(this._updateGroupWork(),this._resetLayout()):(this._view.reset(),this._pendingLayoutReset=!0,this._pendingGroupWork=!0,this._batchViewUpdates(z._ViewChange.rebuild,z._ScrollToPriority.medium,0,!0))}},_updateGroupWork:function(){this._pendingGroupWork=!1,this._groupDataSource?r.addClass(this._element,z._groupsClass):r.removeClass(this._element,z._groupsClass),this._resetLayout()},automaticallyLoadPages:{get:function(){return!1},set:function(){r._deprecated(C.automaticallyLoadPagesIsDeprecated)}},loadingBehavior:{get:function(){return"randomAccess"},set:function(){r._deprecated(C.loadingBehaviorIsDeprecated)}},selectionMode:{get:function(){return this._selectionMode},set:function(a){if("string"==typeof a&&a.match(/^(none|single|multi)$/)){if(c.isPhone&&a===w.SelectionMode.single)return;return this._selectionMode=a,this._element.setAttribute("aria-multiselectable",this._multiSelection()),this._updateItemsAriaRoles(),void this._configureSelectionMode()}throw new d("WinJS.UI.ListView.ModeIsInvalid",C.modeIsInvalid)}},tapBehavior:{get:function(){return this._tap},set:function(a){c.isPhone&&a===w.TapBehavior.directSelect||(this._tap=a,this._updateItemsAriaRoles(),this._configureSelectionMode())}},groupHeaderTapBehavior:{get:function(){return this._groupHeaderTap},set:function(a){this._groupHeaderTap=a,this._updateGroupHeadersAriaRoles()}},swipeBehavior:{get:function(){return"none"},set:function(a){r._deprecated(C.swipeBehaviorDeprecated)}},itemDataSource:{get:function(){return this._itemsManager.dataSource},set:function(a){this._writeProfilerMark("set_itemDataSource,info"),this._dataSource=a||(new l.List).dataSource,this._groupFocusCache.clear(),this._runningInit||(this._selection._reset(),this._cancelAsyncViewWork(!0),this._updateItemsManager(),this._pendingLayoutReset=!0,this._batchViewUpdates(z._ViewChange.rebuild,z._ScrollToPriority.medium,0,!0))}},itemTemplate:{get:function(){return this._itemRenderer},set:function(a){this._setRenderer(a,!1),this._runningInit||(this._cancelAsyncViewWork(!0),this._updateItemsManager(),this._pendingLayoutReset=!0,this._batchViewUpdates(z._ViewChange.rebuild,z._ScrollToPriority.medium,0,!0))}},resetItem:{get:function(){return this._itemRelease},set:function(a){r._deprecated(C.resetItemIsDeprecated),this._itemRelease=a}},groupHeaderTemplate:{get:function(){return this._groupHeaderRenderer},set:function(a){this._setRenderer(a,!0),this._runningInit||(this._cancelAsyncViewWork(!0),this._pendingLayoutReset=!0,this._batchViewUpdates(z._ViewChange.rebuild,z._ScrollToPriority.medium,0,!0))}},resetGroupHeader:{get:function(){return this._groupHeaderRelease},set:function(a){r._deprecated(C.resetGroupHeaderIsDeprecated),this._groupHeaderRelease=a}},header:{get:function(){return this._header},set:function(a){r.empty(this._headerContainer),this._header=a,a&&(this._header.tabIndex=this._tabIndex,this._headerContainer.appendChild(a));var b=this._selection._getFocused();if(b.type===w.ObjectType.header){var c=b;a||(c={type:w.ObjectType.item,index:0}),this._hasKeyboardFocus?this._changeFocus(c,!0,!1,!0):this._changeFocusPassively(c)}this.recalculateItemPosition(),this._raiseHeaderFooterVisibilityEvent()}},footer:{get:function(){return this._footer},set:function(a){r.empty(this._footerContainer),this._footer=a,a&&(this._footer.tabIndex=this._tabIndex,this._footerContainer.appendChild(a));var b=this._selection._getFocused();if(b.type===w.ObjectType.footer){var c=b;a||(c={type:w.ObjectType.item,index:0}),this._hasKeyboardFocus?this._changeFocus(c,!0,!1,!0):this._changeFocusPassively(c)}this.recalculateItemPosition(),this._raiseHeaderFooterVisibilityEvent()}},loadingState:{get:function(){return this._loadingState}},selection:{get:function(){return this._selection}},indexOfFirstVisible:{get:function(){return this._view.firstIndexDisplayed},set:function(a){if(!(0>a)){this._writeProfilerMark("set_indexOfFirstVisible("+a+"),info"),this._raiseViewLoading(!0);var b=this;this._batchViewUpdates(z._ViewChange.realize,z._ScrollToPriority.high,function(){var c;return b._entityInRange({type:w.ObjectType.item,index:a}).then(function(a){return a.inRange?b._getItemOffset({type:w.ObjectType.item,index:a.index}).then(function(a){return c=a,b._ensureFirstColumnRange(w.ObjectType.item)}).then(function(){return c=b._correctRangeInFirstColumn(c,w.ObjectType.item),c=b._convertFromCanvasCoordinates(c),b._view.waitForValidScrollPosition(c.begin)}).then(function(a){var c=a<b._lastScrollPosition?"left":"right",d=b._viewport[b._scrollLength]-b._getViewportLength();return a=r._clamp(a,0,d),{position:a,direction:c}}):{position:0,direction:"left"}})},!0)}}},indexOfLastVisible:{get:function(){return this._view.lastIndexDisplayed}},currentItem:{get:function(){var a=this._selection._getFocused(),b={index:a.index,type:a.type,key:null,hasFocus:!!this._hasKeyboardFocus,showFocus:!1};if(a.type===w.ObjectType.groupHeader){var c=this._groups.group(a.index);c&&(b.key=c.key,b.showFocus=!(!c.header||!r.hasClass(c.header,z._itemFocusClass)))}else if(a.type===w.ObjectType.item){var d=this._view.items.itemAt(a.index);if(d){var e=this._itemsManager._recordFromElement(d);b.key=e.item&&e.item.key,b.showFocus=!!d.parentNode.querySelector("."+z._itemFocusOutlineClass)}}return b},set:function(a){function b(b,d,e){var f=!!a.showFocus&&c._hasKeyboardFocus;c._unsetFocusOnItem(d),c._selection._setFocused(e,f),c._hasKeyboardFocus?(c._keyboardFocusInbound=f,c._setFocusOnItem(e)):c._tabManager.childFocus=d?b:null,e.type!==w.ObjectType.groupHeader&&(c._updateFocusCache(e.index),c._updater&&(c._updater.newSelectionPivot=e.index,c._updater.oldSelectionPivot=-1),c._selection._pivot=e.index)}this._hasKeyboardFocus=a.hasFocus||this._hasKeyboardFocus,a.type||(a.type=w.ObjectType.item);var c=this;if(a.key&&(a.type===w.ObjectType.item&&this._dataSource.itemFromKey||a.type===w.ObjectType.groupHeader&&this._groupDataSource&&this._groupDataSource.itemFromKey)){this.oldCurrentItemKeyFetch&&this.oldCurrentItemKeyFetch.cancel();var d=a.type===w.ObjectType.groupHeader?this._groupDataSource:this._dataSource;this.oldCurrentItemKeyFetch=d.itemFromKey(a.key).then(function(d){if(c.oldCurrentItemKeyFetch=null,d){var e=a.type===w.ObjectType.groupHeader?c._groups.group(d.index).header:c._view.items.itemAt(d.index);b(e,!!e,{type:a.type,index:d.index})}})}else{var e;if(a.type===w.ObjectType.header||a.type===w.ObjectType.footer)e=a.type===w.ObjectType.header?this._header:this._footer,b(e,!!e,{type:a.type,index:a.index});else if(void 0!==a.index){if(a.type===w.ObjectType.groupHeader){var f=c._groups.group(a.index);e=f&&f.header}else e=c._view.items.itemAt(a.index);b(e,!!e,{type:a.type,index:a.index})}}}},zoomableView:{get:function(){return this._zoomableView||(this._zoomableView=new i(this)),this._zoomableView}},itemsDraggable:{get:function(){return this._dragSource},set:function(a){c.isPhone||this._dragSource!==a&&(this._dragSource=a,this._setDraggable())}},itemsReorderable:{get:function(){return this._reorderable},set:function(a){c.isPhone||this._reorderable!==a&&(this._reorderable=a,this._setDraggable())}},maxDeferredItemCleanup:{get:function(){return this._maxDeferredItemCleanup},set:function(a){this._maxDeferredItemCleanup=Math.max(0,+a||0)}},dispose:function(){this._dispose()},elementFromIndex:function(a){return this._view.items.itemAt(a)},indexOfElement:function(a){return this._view.items.index(a)},ensureVisible:function(a){var b=w.ObjectType.item,c=a;if(+a!==a&&(b=a.type,c=a.index),this._writeProfilerMark("ensureVisible("+b+": "+c+"),info"),!(0>c)){this._raiseViewLoading(!0);var d=this;this._batchViewUpdates(z._ViewChange.realize,z._ScrollToPriority.high,function(){var a;return d._entityInRange({type:b,index:c}).then(function(c){return c.inRange?d._getItemOffset({type:b,index:c.index}).then(function(c){return a=c,d._ensureFirstColumnRange(b)}).then(function(){a=d._correctRangeInFirstColumn(a,b);var e=d._getViewportLength(),f=d._viewportScrollPosition,g=f+e,h=d._viewportScrollPosition,i=a.end-a.begin;a=d._convertFromCanvasCoordinates(a);var j=!1;if(b===w.ObjectType.groupHeader&&f<=a.begin){var k=d._groups.group(c.index).header;if(k){var l,m=H._getMargins(k);if(d._horizontalLayout){var n=d._rtl(),o=n?M(k)-m.right:k.offsetLeft-m.left;l=o+k.offsetWidth+(n?m.left:m.right)}else l=k.offsetTop+k.offsetHeight+m.top;j=g>=l}}j||(i>=g-f?h=a.begin:a.begin<f?h=a.begin:a.end>g&&(h=a.end-e));var p=h<d._lastScrollPosition?"left":"right",q=d._viewport[d._scrollLength]-e;return h=r._clamp(h,0,q),{position:h,direction:p}}):{position:0,direction:"left"}})},!0)}},loadMorePages:function(){r._deprecated(C.loadMorePagesIsDeprecated)},recalculateItemPosition:function(){this._writeProfilerMark("recalculateItemPosition,info"),this._forceLayoutImpl(z._ViewChange.relayout)},forceLayout:function(){this._writeProfilerMark("forceLayout,info"),this._forceLayoutImpl(z._ViewChange.remeasure)},_entityInRange:function(a){if(a.type===w.ObjectType.item)return this._itemsCount().then(function(b){var c=r._clamp(a.index,0,b-1);return{inRange:c>=0&&b>c,index:c}});if(a.type===w.ObjectType.groupHeader){var b=r._clamp(a.index,0,this._groups.length()-1);return m.wrap({inRange:b>=0&&b<this._groups.length(),index:b})}return m.wrap({inRange:!0,index:0})},_forceLayoutImpl:function(a){var b=this;this._versionManager.unlocked.then(function(){b._writeProfilerMark("_forceLayoutImpl viewChange("+a+"),info"),b._cancelAsyncViewWork(),b._pendingLayoutReset=!0,b._resizeViewport(),b._batchViewUpdates(a,z._ScrollToPriority.low,function(){return{position:b._lastScrollPosition,direction:"right"}},!0,!0)})},_configureSelectionMode:function(){var b=z._selectionModeClass,c=z._hidingSelectionMode;if(this._isInSelectionMode())r.addClass(this._canvas,b),r.removeClass(this._canvas,c);else{if(r.hasClass(this._canvas,b)){var d=this;a.setTimeout(function(){a.setTimeout(function(){r.removeClass(d._canvas,c)},z._hidingSelectionModeAnimationTimeout)},50),r.addClass(this._canvas,c)}r.removeClass(this._canvas,b)}},_lastScrollPosition:{get:function(){return this._lastScrollPositionValue},set:function(a){if(0===a)this._lastDirection="right",this._direction="right",this._lastScrollPositionValue=0;else{var b=a<this._lastScrollPositionValue?"left":"right";this._direction=this._scrollDirection(a),this._lastDirection=b,this._lastScrollPositionValue=a}}},_hasHeaderOrFooter:{get:function(){return!(!this._header&&!this._footer)}},_getHeaderOrFooterFromElement:function(a){return this._header&&this._header.contains(a)?this._header:this._footer&&this._footer.contains(a)?this._footer:null},_supportsGroupHeaderKeyboarding:{get:function(){return this._groupDataSource}},_viewportScrollPosition:{get:function(){return this._currentScrollPosition=r.getScrollPosition(this._viewport)[this._scrollProperty],this._currentScrollPosition},set:function(a){var b={};b[this._scrollProperty]=a,r.setScrollPosition(this._viewport,b),this._currentScrollPosition=a}},_canvasStart:{get:function(){return this._canvasStartValue||0},set:function(a){var b=this._horizontal()?this._rtl()?-a:a:0,c=this._horizontal()?0:a;0!==a?this._canvas.style[O.scriptName]="translate( "+b+"px, "+c+"px)":this._canvas.style[O.scriptName]="",this._canvasStartValue=a}},scrollPosition:{get:function(){return this._viewportScrollPosition},set:function(a){var b=this;this._batchViewUpdates(z._ViewChange.realize,z._ScrollToPriority.high,function(){return b._view.waitForValidScrollPosition(a).then(function(){var c=b._viewport[b._scrollLength]-b._getViewportLength();a=r._clamp(a,0,c);var d=a<b._lastScrollPosition?"left":"right";return{position:a,direction:d}})},!0)}},_setRenderer:function(a,b){var e;if(a){if("function"==typeof a)e=a;else if("object"==typeof a){if(c.validation&&!a.renderItem)throw new d("WinJS.UI.ListView.invalidTemplate",C.invalidTemplate);e=a.renderItem}}else{if(c.validation)throw new d("WinJS.UI.ListView.invalidTemplate",C.invalidTemplate);e=t.trivialHtmlRenderer}e&&(b?this._groupHeaderRenderer=e:this._itemRenderer=e)},_renderWithoutReuse:function(a,b){b&&q._disposeElement(b);var c=this._itemRenderer(a);if(c.then)return c.then(function(a){return a.tabIndex=0,a});var d=c.element||c;return d.tabIndex=0,c},_isInsertedItem:function(a){return!!this._insertedItems[a.handle]},_clearInsertedItems:function(){for(var a=Object.keys(this._insertedItems),b=0,c=a.length;c>b;b++)this._insertedItems[a[b]].release();this._insertedItems={},this._modifiedElements=[],this._countDifference=0},_cancelAsyncViewWork:function(a){this._view.stopWork(a)},_updateView:function(){function a(){c._itemsBlockExtent=-1,c._firstItemRange=null,c._firstHeaderRange=null,c._itemMargins=null,c._headerMargins=null,c._canvasMargins=null,c._cachedRTL=null,c._rtl()}function b(){c._scrollToPriority=z._ScrollToPriority.uninitialized;var a=c._setScrollbarPosition;c._setScrollbarPosition=!1;var b="number"==typeof c._scrollToFunctor?{position:c._scrollToFunctor}:c._scrollToFunctor();return m.as(b).then(function(b){return b=b||{},a&&+b.position===b.position&&(c._lastScrollPosition=b.position,c._viewportScrollPosition=b.position),b},function(b){return c._setScrollbarPosition|=a,m.wrapError(b)})}if(!this._isZombie()){var c=this,d=this._viewChange;this._viewChange=z._ViewChange.realize,d===z._ViewChange.rebuild?(this._pendingGroupWork&&this._updateGroupWork(),this._pendingLayoutReset&&this._resetLayout(),a(),this._firstTimeDisplayed||this._view.reset(),this._view.reload(b,!0),this._setFocusOnItem(this._selection._getFocused()),this._headerFooterVisibilityStatus={headerVisible:!1,footerVisible:!1}):d===z._ViewChange.remeasure?(this._view.resetItems(!0),this._resetLayout(),a(),this._view.refresh(b),this._setFocusOnItem(this._selection._getFocused()),this._headerFooterVisibilityStatus={headerVisible:!1,footerVisible:!1}):d===z._ViewChange.relayout?(this._pendingLayoutReset&&(this._resetLayout(),a()),this._view.refresh(b)):(this._view.onScroll(b),this._raiseHeaderFooterVisibilityEvent())}},_batchViewUpdates:function(a,b,c,d,e){if(this._viewChange=Math.min(this._viewChange,a),(null===this._scrollToFunctor||b>=this._scrollToPriority)&&(this._scrollToPriority=b,this._scrollToFunctor=c),this._setScrollbarPosition|=!!d,!this._batchingViewUpdates){this._raiseViewLoading();var f=this;this._batchingViewUpdatesSignal=new o,this._batchingViewUpdates=m.any([this._batchingViewUpdatesSignal.promise,n.schedulePromiseHigh(null,"WinJS.UI.ListView._updateView")]).then(function(){return f._isZombie()?void 0:f._viewChange!==z._ViewChange.rebuild||f._firstTimeDisplayed||0===Object.keys(f._view.items._itemData).length||e?void 0:f._fadeOutViewport()}).then(function(){f._batchingViewUpdates=null,f._batchingViewUpdatesSignal=null,f._updateView(),f._firstTimeDisplayed=!1},function(){f._batchingViewUpdates=null,f._batchingViewUpdatesSignal=null})}return this._batchingViewUpdatesSignal},_resetCanvas:function(){if(!this._disposed){var b=a.document.createElement("div");b.className=this._canvas.className,this._viewport.replaceChild(b,this._canvas),this._canvas=b,this._groupsToRemove={},this._canvas.appendChild(this._canvasProxy)}},_setupInternalTree:function(){r.addClass(this._element,z._listViewClass),r[this._rtl()?"addClass":"removeClass"](this._element,z._rtlListViewClass),this._element.innerHTML='<div tabIndex="-1" role="group" class="'+z._viewportClass+" "+z._horizontalClass+'"><div></div><div class="'+z._scrollableClass+'"><div class="'+z._proxyClass+'"></div></div><div></div><div></div></div><div aria-hidden="true" style="position:absolute;left:50%;top:50%;width:0px;height:0px;" tabindex="-1"></div>',this._viewport=this._element.firstElementChild,
this._headerContainer=this._viewport.firstElementChild,r.addClass(this._headerContainer,z._listHeaderContainerClass),this._canvas=this._headerContainer.nextElementSibling,this._footerContainer=this._canvas.nextElementSibling,r.addClass(this._footerContainer,z._listFooterContainerClass),this._canvasProxy=this._canvas.firstElementChild,this._deleteWrapper=this._canvas.nextElementSibling,this._keyboardEventsHelper=this._viewport.nextElementSibling,this._tabIndex=r.getTabIndex(this._element),this._tabIndex<0&&(this._tabIndex=0),this._tabManager=new v.TabContainer(this._viewport),this._tabManager.tabIndex=this._tabIndex,this._progressBar=a.document.createElement("progress"),r.addClass(this._progressBar,z._progressClass),r.addClass(this._progressBar,"win-progress-ring"),this._progressBar.style.position="absolute",this._progressBar.max=100},_unsetFocusOnItem:function(b){this._tabManager.childFocus&&this._clearFocusRectangle(this._tabManager.childFocus),this._isZombie()||(b||(this._tabManager.childFocus&&(this._tabManager.childFocus=null),this._keyboardEventsHelper._shouldHaveFocus=!1,a.document.activeElement!==this._viewport&&this._hasKeyboardFocus&&(this._keyboardEventsHelper._shouldHaveFocus=!0,r._setActive(this._keyboardEventsHelper))),this._itemFocused=!1)},_setFocusOnItem:function(a){if(this._writeProfilerMark("_setFocusOnItem,info"),this._focusRequest&&this._focusRequest.cancel(),!this._isZombie()){var b=this,c=function(c){b._isZombie()||(b._tabManager.childFocus!==c&&(b._tabManager.childFocus=c),b._focusRequest=null,b._hasKeyboardFocus&&!b._itemFocused&&(b._selection._keyboardFocused()&&b._drawFocusRectangle(c),(a.type===w.ObjectType.groupHeader||a.type===w.ObjectType.item)&&b._view.updateAriaForAnnouncement(c,a.type===w.ObjectType.groupHeader?b._groups.length():b._cachedCount),b._itemFocused=!0,r._setActive(c)))};a.type===w.ObjectType.item?this._focusRequest=this._view.items.requestItem(a.index):a.type===w.ObjectType.groupHeader?this._focusRequest=this._groups.requestHeader(a.index):this._focusRequest=m.wrap(a.type===w.ObjectType.header?this._header:this._footer),this._focusRequest.then(c)}},_attachEvents:function(){function a(a,b,c){return{name:b?a:a.toLowerCase(),handler:function(b){d["_on"+a](b)},capture:c}}function b(a,b,c){return{capture:c,name:b?a:a.toLowerCase(),handler:function(b){var c=d._mode,e="on"+a;!d._disposed&&c[e]&&c[e](b)}}}function c(a,b){return{handler:function(b){d["_on"+a](b)},filter:b}}var d=this,e=[c("PropertyChange",["dir","style","tabindex"])];this._cachedStyleDir=this._element.style.direction,e.forEach(function(a){new r._MutationObserver(a.handler).observe(d._element,{attributes:!0,attributeFilter:a.filter})});var f=[b("PointerDown"),b("click",!1),b("PointerUp"),b("LostPointerCapture"),b("MSHoldVisual",!0),b("PointerCancel",!0),b("DragStart"),b("DragOver"),b("DragEnter"),b("DragLeave"),b("Drop"),b("ContextMenu")];f.forEach(function(a){r._addEventListener(d._viewport,a.name,a.handler,!!a.capture)});var g=[a("FocusIn",!1,!1),a("FocusOut",!1,!1),b("KeyDown"),b("KeyUp")];g.forEach(function(a){r._addEventListener(d._element,a.name,a.handler,!!a.capture)}),this._onElementResizeBound=this._onElementResize.bind(this),r._resizeNotifier.subscribe(this._element,this._onElementResizeBound),this._elementResizeInstrument=new y._ElementResizeInstrument,this._element.appendChild(this._elementResizeInstrument.element),this._elementResizeInstrument.addEventListener("resize",this._onElementResizeBound),r._inDom(this.element).then(function(){d._disposed||d._elementResizeInstrument.addedToDom()});var h=[a("MSManipulationStateChanged",!0),a("Scroll")];h.forEach(function(a){d._viewport.addEventListener(a.name,a.handler,!1)}),this._viewport.addEventListener("onTabEnter",this._onTabEnter.bind(this)),this._viewport.addEventListener("onTabExit",this._onTabExit.bind(this)),this._viewport.addEventListener("onTabEntered",function(a){d._mode.onTabEntered(a)}),this._viewport.addEventListener("onTabExiting",function(a){d._mode.onTabExiting(a)})},_updateItemsManager:function(){function a(a){a.detail===w.DataSourceStatus.failure&&(b.itemDataSource=null,b.groupDataSource=null)}var b=this,c={beginNotifications:function(){},changed:function(a,c){if(!b._ifZombieDispose()){b._createUpdater();var d=b._updater.elements[R(c)];if(d){var e=b.selection._isIncluded(d.index);if(e&&(b._updater.updateDrag=!0),c!==a){if((b._tabManager.childFocus===c||b._updater.newFocusedItem===c)&&(b._updater.newFocusedItem=a,b._tabManager.childFocus=null),d.itemBox){r.addClass(a,z._itemClass),b._setupAriaSelectionObserver(a);var f=c.nextElementSibling;d.itemBox.removeChild(c),d.itemBox.insertBefore(a,f)}b._setAriaSelected(a,e),b._view.items.setItemAt(d.newIndex,{element:a,itemBox:d.itemBox,container:d.container,itemsManagerRecord:d.itemsManagerRecord}),delete b._updater.elements[R(c)],q._disposeElement(c),b._updater.elements[R(a)]={item:a,container:d.container,itemBox:d.itemBox,index:d.index,newIndex:d.newIndex,itemsManagerRecord:d.itemsManagerRecord}}else d.itemBox&&d.container&&(A._ItemEventsHandler.renderSelection(d.itemBox,a,e,!0),r[e?"addClass":"removeClass"](d.container,z._selectedClass));b._updater.changed=!0}for(var g=0,h=b._notificationHandlers.length;h>g;g++)b._notificationHandlers[g].changed(a,c);b._writeProfilerMark("changed,info")}},removed:function(a,c,d){function e(a){b._updater.updateDrag=!0,b._currentMode()._dragging&&b._currentMode()._draggingUnselectedItem&&b._currentMode()._dragInfo._isIncluded(a)&&(b._updater.newDragInfo=new I._Selection(b,[]));var c=b._updater.selectionFirst[a],d=b._updater.selectionLast[a],e=c||d;e&&(delete b._updater.selectionFirst[e.oldFirstIndex],delete b._updater.selectionLast[e.oldLastIndex],b._updater.selectionChanged=!0)}if(!b._ifZombieDispose()){b._createUpdater();var f=b._insertedItems[d];f&&delete b._insertedItems[d];var g;if(a){var h=b._updater.elements[R(a)],i=b._itemsManager.itemObject(a);if(i&&b._groupFocusCache.deleteItem(i.key),h){if(g=h.index,h.itemBox){var j=h.itemBox,k=z._containerOddClass,l=z._containerEvenClass,m=r.hasClass(j.parentElement,l)?l:k;b._updater.removed.push({index:g,itemBox:j,containerStripe:m})}b._updater.deletesCount++;var n=b._view.items.itemDataAt(g);n.removed=!0,delete b._updater.elements[R(a)]}else g=i&&i.index;b._updater.oldFocus.type!==w.ObjectType.groupHeader&&b._updater.oldFocus.index===g&&(b._updater.newFocus.index=g,b._updater.focusedItemRemoved=!0),e(g)}else g=b._updater.selectionHandles[d],g===+g&&e(g);b._writeProfilerMark("removed("+g+"),info"),b._updater.changed=!0}},updateAffectedRange:function(a){b._itemsCount().then(function(c){var d=b._view.containers?b._view.containers.length:0;a.start=Math.min(a.start,d),b._affectedRange.add(a,c)}),b._createUpdater(),b._updater.changed=!0},indexChanged:function(a,c,d){if(!b._ifZombieDispose()){if(b._createUpdater(),a){var e=b._itemsManager.itemObject(a);e&&b._groupFocusCache.updateItemIndex(e.key,c);var f=b._updater.elements[R(a)];f&&(f.newIndex=c,b._updater.changed=!0),b._updater.itemsMoved=!0}b._currentMode()._dragging&&b._currentMode()._draggingUnselectedItem&&b._currentMode()._dragInfo._isIncluded(d)&&(b._updater.newDragInfo=new I._Selection(b,[{firstIndex:c,lastIndex:c}]),b._updater.updateDrag=!0),b._updater.oldFocus.type!==w.ObjectType.groupHeader&&b._updater.oldFocus.index===d&&(b._updater.newFocus.index=c,b._updater.changed=!0),b._updater.oldSelectionPivot===d&&(b._updater.newSelectionPivot=c,b._updater.changed=!0);var g=b._updater.selectionFirst[d];g&&(g.newFirstIndex=c,b._updater.changed=!0,b._updater.selectionChanged=!0,b._updater.updateDrag=!0),g=b._updater.selectionLast[d],g&&(g.newLastIndex=c,b._updater.changed=!0,b._updater.selectionChanged=!0,b._updater.updateDrag=!0)}},endNotifications:function(){b._update()},inserted:function(a){b._ifZombieDispose()||(b._writeProfilerMark("inserted,info"),b._createUpdater(),b._updater.changed=!0,a.retain(),b._updater.insertsCount++,b._insertedItems[a.handle]=a)},moved:function(a,c,d,e){if(!b._ifZombieDispose()){if(b._createUpdater(),b._updater.movesCount++,a){b._updater.itemsMoved=!0;var f=b._updater.elements[R(a)];f&&(f.moved=!0)}var g=b._updater.selectionHandles[e.handle];if(g===+g){b._updater.updateDrag=!0,b._updater.selectionChanged=!0,b._updater.changed=!0;var h=b._updater.selectionFirst[g],i=b._updater.selectionLast[g],j=h||i;j&&j.oldFirstIndex!==j.oldLastIndex&&(delete b._updater.selectionFirst[j.oldFirstIndex],delete b._updater.selectionLast[j.oldLastIndex])}b._writeProfilerMark("moved("+g+"),info")}},countChanged:function(a,c){b._ifZombieDispose()||(b._writeProfilerMark("countChanged("+a+"),info"),b._cachedCount=a,b._createUpdater(),b._view.lastIndexDisplayed+1===c&&(b._updater.changed=!0),b._updater.countDifference+=a-c)},reload:function(){b._ifZombieDispose()||(b._writeProfilerMark("reload,info"),b._processReload())}};this._versionManager&&this._versionManager._dispose(),this._versionManager=new x._VersionManager,this._updater=null;var d=this._selection.getRanges();this._selection._selected.clear(),this._itemsManager&&(this._itemsManager.dataSource&&this._itemsManager.dataSource.removeEventListener&&this._itemsManager.dataSource.removeEventListener("statuschanged",a,!1),this._clearInsertedItems(),this._itemsManager.release()),this._itemsCountPromise&&(this._itemsCountPromise.cancel(),this._itemsCountPromise=null),this._cachedCount=z._UNINITIALIZED,this._itemsManager=t._createItemsManager(this._dataSource,this._renderWithoutReuse.bind(this),c,{ownerElement:this._element,versionManager:this._versionManager,indexInView:function(a){return a>=b.indexOfFirstVisible&&a<=b.indexOfLastVisible},viewCallsReady:!0,profilerId:this._id}),this._dataSource.addEventListener&&this._dataSource.addEventListener("statuschanged",a,!1),this._selection._selected.set(d)},_processReload:function(){this._affectedRange.addAll(),this._cancelAsyncViewWork(!0),this._currentMode()._dragging&&this._currentMode()._clearDragProperties(),this._groupFocusCache.clear(),this._selection._reset(),this._updateItemsManager(),this._pendingLayoutReset=!0,this._batchViewUpdates(z._ViewChange.rebuild,z._ScrollToPriority.low,this.scrollPosition)},_createUpdater:function(){if(!this._updater){this.itemDataSource._isVirtualizedDataSource&&this._affectedRange.addAll(),this._versionManager.beginUpdating(),this._cancelAsyncViewWork();var a={changed:!1,elements:{},selectionFirst:{},selectionLast:{},selectionHandles:{},oldSelectionPivot:{type:w.ObjectType.item,index:z._INVALID_INDEX},newSelectionPivot:{type:w.ObjectType.item,index:z._INVALID_INDEX},removed:[],selectionChanged:!1,oldFocus:{type:w.ObjectType.item,index:z._INVALID_INDEX},newFocus:{type:w.ObjectType.item,index:z._INVALID_INDEX},hadKeyboardFocus:this._hasKeyboardFocus,itemsMoved:!1,lastVisible:this.indexOfLastVisible,updateDrag:!1,movesCount:0,insertsCount:0,deletesCount:0,countDifference:0};this._view.items.each(function(b,c,d){a.elements[R(c)]={item:c,container:d.container,itemBox:d.itemBox,index:b,newIndex:b,itemsManagerRecord:d.itemsManagerRecord,detached:d.detached}});for(var b=this._selection._selected._ranges,c=0,d=b.length;d>c;c++){var e=b[c],f={newFirstIndex:b[c].firstIndex,oldFirstIndex:b[c].firstIndex,newLastIndex:b[c].lastIndex,oldLastIndex:b[c].lastIndex};a.selectionFirst[f.oldFirstIndex]=f,a.selectionLast[f.oldLastIndex]=f,a.selectionHandles[e.firstPromise.handle]=f.oldFirstIndex,a.selectionHandles[e.lastPromise.handle]=f.oldLastIndex}a.oldSelectionPivot=this._selection._pivot,a.newSelectionPivot=a.oldSelectionPivot,a.oldFocus=this._selection._getFocused(),a.newFocus=this._selection._getFocused(),this._updater=a}},_synchronize:function(){var a=this._updater;if(this._updater=null,this._groupsChanged=!1,this._countDifference=this._countDifference||0,a&&a.changed){a.itemsMoved&&this._layout.itemsMoved&&this._layout.itemsMoved(),a.removed.length&&this._layout.itemsRemoved&&this._layout.itemsRemoved(a.removed.map(function(a){return a.itemBox})),(a.itemsMoved||a.removed.length||Object.keys(this._insertedItems).length)&&this._layout.setupAnimations&&this._layout.setupAnimations(),this._currentMode().onDataChanged&&this._currentMode().onDataChanged();var b=[];for(var c in a.selectionFirst)if(a.selectionFirst.hasOwnProperty(c)){var d=a.selectionFirst[c];a.selectionChanged=a.selectionChanged||d.newLastIndex-d.newFirstIndex!==d.oldLastIndex-d.oldFirstIndex,d.newFirstIndex<=d.newLastIndex&&b.push({firstIndex:d.newFirstIndex,lastIndex:d.newLastIndex})}if(a.selectionChanged){var e=new I._Selection(this,b);this._selection._fireSelectionChanging(e),this._selection._selected.set(b),this._selection._fireSelectionChanged(),e.clear()}else this._selection._selected.set(b);this._selection._updateCount(this._cachedCount),a.newSelectionPivot=Math.min(this._cachedCount-1,a.newSelectionPivot),this._selection._pivot=a.newSelectionPivot>=0?a.newSelectionPivot:z._INVALID_INDEX,a.newFocus.type!==w.ObjectType.groupHeader&&(a.newFocus.index=Math.max(0,Math.min(this._cachedCount-1,a.newFocus.index))),this._selection._setFocused(a.newFocus,this._selection._keyboardFocused());var f=this._modifiedElements||[],g={};for(this._modifiedElements=[],this._countDifference+=a.countDifference,c=0;c<f.length;c++){var h=f[c];-1===h.newIndex?this._modifiedElements.push(h):g[h.newIndex]=h}for(c=0;c<a.removed.length;c++){var i=a.removed[c],h=g[i.index];h?delete g[i.index]:h={oldIndex:i.index},h.newIndex=-1,h._removalHandled||(h._itemBox=i.itemBox,h._containerStripe=i.containerStripe),this._modifiedElements.push(h)}var j=Object.keys(this._insertedItems);for(c=0;c<j.length;c++)this._modifiedElements.push({oldIndex:-1,newIndex:this._insertedItems[j[c]].index});this._writeProfilerMark("_synchronize:update_modifiedElements,StartTM");var k={};for(c in a.elements)if(a.elements.hasOwnProperty(c)){var l=a.elements[c];k[l.newIndex]={element:l.item,container:l.container,itemBox:l.itemBox,itemsManagerRecord:l.itemsManagerRecord,detached:l.detached};var h=g[l.index];h?(delete g[l.index],h.newIndex=l.newIndex):h={oldIndex:l.index,newIndex:l.newIndex},h.moved=l.moved,this._modifiedElements.push(h)}this._writeProfilerMark("_synchronize:update_modifiedElements,StopTM");var m=Object.keys(g);for(c=0;c<m.length;c++){var n=m[c],h=g[n];-1!==h.oldIndex&&this._modifiedElements.push(h)}this._view.items._itemData=k,a.updateDrag&&this._currentMode()._dragging&&(this._currentMode()._draggingUnselectedItem?a.newDragInfo&&(this._currentMode()._dragInfo=a.newDragInfo):this._currentMode()._dragInfo=this._selection,this._currentMode().fireDragUpdateEvent()),a.focusedItemRemoved||this._focusRequest&&a.oldFocus.index!==a.newFocus.index||a.oldFocus.type!==a.newFocus.type?(this._itemFocused=!1,this._setFocusOnItem(this._selection._getFocused())):a.newFocusedItem&&(this._hasKeyboardFocus=a.hadKeyboardFocus,this._itemFocused=!1,this._setFocusOnItem(this._selection._getFocused()));var o=this;return this._groups.synchronizeGroups().then(function(){return a.newFocus.type===w.ObjectType.groupHeader&&(a.newFocus.index=Math.min(o._groups.length()-1,a.newFocus.index),a.newFocus.index<0&&(a.newFocus={type:w.ObjectType.item,index:0}),o._selection._setFocused(a.newFocus,o._selection._keyboardFocused())),o._versionManager.endUpdating(),a.deletesCount>0&&o._updateDeleteWrapperSize(),o._view.updateTree(o._cachedCount,o._countDifference,o._modifiedElements)}).then(function(){return o._lastScrollPosition})}this._countDifference+=a?a.countDifference:0;var o=this;return this._groups.synchronizeGroups().then(function(){return a&&o._versionManager.endUpdating(),o._view.updateTree(o._cachedCount,o._countDifference,o._modifiedElements)}).then(function(){return o.scrollPosition})},_updateDeleteWrapperSize:function(a){var b=this._horizontal()?"width":"height";this._deleteWrapper.style["min-"+b]=(a?0:this.scrollPosition+this._getViewportSize()[b])+"px"},_verifyRealizationNeededForChange:function(){var a=!1,b=(this._view.lastIndexDisplayed||0)-(this._view.firstIndexDisplayed||0),c=this._updater&&0===this._updater.movesCount&&0===this._updater.insertsCount&&this._updater.deletesCount>0&&this._updater.deletesCount===Math.abs(this._updater.countDifference);if(c&&this._updater.elements)for(var d=Object.keys(this._updater.elements),e=0,f=d.length;f>e;e++){var g=this._updater.elements[d[e]],h=g.index-g.newIndex;if(0>h||h>this._updater.deletesCount){c=!1;break}}this._view.deletesWithoutRealize=this._view.deletesWithoutRealize||0,c&&this._view.lastIndexDisplayed<this._view.end-b&&this._updater.deletesCount+this._view.deletesWithoutRealize<b?(a=!0,this._view.deletesWithoutRealize+=Math.abs(this._updater.countDifference),this._writeProfilerMark("skipping realization on delete,info")):this._view.deletesWithoutRealize=0,this._view._setSkipRealizationForChange(a)},_update:function(){if(this._writeProfilerMark("update,StartTM"),!this._ifZombieDispose()){this._updateJob=null;var a=this;this._versionManager.noOutstandingNotifications&&(this._updater||this._groupsChanged?(this._cancelAsyncViewWork(),this._verifyRealizationNeededForChange(),this._synchronize().then(function(b){a._writeProfilerMark("update,StopTM"),a._batchViewUpdates(z._ViewChange.relayout,z._ScrollToPriority.low,b).complete()})):this._batchViewUpdates(z._ViewChange.relayout,z._ScrollToPriority.low,this._lastScrollPosition).complete())}},_scheduleUpdate:function(){if(!this._updateJob){var a=this;this._updateJob=n.schedulePromiseHigh(null,"WinJS.UI.ListView._update").then(function(){a._updateJob&&a._update()}),this._raiseViewLoading()}},_createGroupsContainer:function(){this._groups&&this._groups.cleanUp(),this._groupDataSource?this._groups=new E._UnvirtualizedGroupsContainer(this,this._groupDataSource):this._groups=new E._NoGroups(this)},_createLayoutSite:function(){var b=this;return Object.create({invalidateLayout:function(){b._pendingLayoutReset=!0;var a="horizontal"===b._layout.orientation!==b._horizontalLayout;b._affectedRange.addAll(),b._batchViewUpdates(z._ViewChange.rebuild,z._ScrollToPriority.low,a?0:b.scrollPosition,!1,!0)},itemFromIndex:function(a){return b._itemsManager._itemPromiseAtIndex(a)},groupFromIndex:function(a){return b._groupsEnabled()?a<b._groups.length()?b._groups.group(a).userData:null:{key:"-1"}},groupIndexFromItemIndex:function(a){return a=Math.max(0,a),b._groups.groupFromItem(a)},renderItem:function(c){return m._cancelBlocker(b._itemsManager._itemFromItemPromise(c)).then(function(c){if(c){var d=b._itemsManager._recordFromElement(c);d.pendingReady&&d.pendingReady(),c=c.cloneNode(!0),r.addClass(c,z._itemClass);var e=a.document.createElement("div");r.addClass(e,z._itemBoxClass),e.appendChild(c);var f=a.document.createElement("div");return r.addClass(f,z._containerClass),f.appendChild(e),f}return m.cancel})},renderHeader:function(c){var d=t._normalizeRendererReturn(b.groupHeaderTemplate(m.wrap(c)));return d.then(function(b){r.addClass(b.element,z._headerClass);var c=a.document.createElement("div");return r.addClass(c,z._headerContainerClass),c.appendChild(b.element),c})},readyToMeasure:function(){b._getViewportLength(),b._getCanvasMargins()},_isZombie:function(){return b._isZombie()},_writeProfilerMark:function(a){b._writeProfilerMark(a)}},{_itemsManager:{enumerable:!0,get:function(){return b._itemsManager}},rtl:{enumerable:!0,get:function(){return b._rtl()}},surface:{enumerable:!0,get:function(){return b._canvas}},viewport:{enumerable:!0,get:function(){return b._viewport}},scrollbarPos:{enumerable:!0,get:function(){return b.scrollPosition}},viewportSize:{enumerable:!0,get:function(){return b._getViewportSize()}},loadingBehavior:{enumerable:!0,get:function(){return b.loadingBehavior}},animationsDisabled:{enumerable:!0,get:function(){return b._animationsDisabled()}},tree:{enumerable:!0,get:function(){return b._view.tree}},realizedRange:{enumerable:!0,get:function(){return{firstPixel:Math.max(0,b.scrollPosition-2*b._getViewportLength()),lastPixel:b.scrollPosition+3*b._getViewportLength()-1}}},visibleRange:{enumerable:!0,get:function(){return{firstPixel:b.scrollPosition,lastPixel:b.scrollPosition+b._getViewportLength()-1}}},itemCount:{enumerable:!0,get:function(){return b._itemsCount()}},groupCount:{enumerable:!0,get:function(){return b._groups.length()}},header:{enumerable:!0,get:function(){return b.header}},footer:{enumerable:!0,get:function(){return b.footer}}})},_initializeLayout:function(){this._affectedRange.addAll();var a=this._createLayoutSite();return this._layout.initialize(a,this._groupsEnabled()),"horizontal"===this._layout.orientation},_resetLayoutOrientation:function(a){this._horizontalLayout?(this._startProperty="left",this._scrollProperty="scrollLeft",this._scrollLength="scrollWidth",this._deleteWrapper.style.minHeight="",r.addClass(this._viewport,z._horizontalClass),r.removeClass(this._viewport,z._verticalClass),a&&(this._viewport.scrollTop=0)):(this._startProperty="top",this._scrollProperty="scrollTop",this._scrollLength="scrollHeight",this._deleteWrapper.style.minWidth="",r.addClass(this._viewport,z._verticalClass),r.removeClass(this._viewport,z._horizontalClass),a&&r.setScrollPosition(this._viewport,{scrollLeft:0}))},_resetLayout:function(){this._pendingLayoutReset=!1,this._affectedRange.addAll(),this._layout&&(this._layout.uninitialize(),this._horizontalLayout=this._initializeLayout(),this._resetLayoutOrientation())},_updateLayout:function(a){var b=!1;this._layout&&(this._cancelAsyncViewWork(!0),this._layout.uninitialize(),b=!0);var c;if(a&&"function"==typeof a.type){var d=T(a.type);c=new d(a)}else c=a&&a.initialize?a:new H.GridLayout(a);b&&this._resetCanvas(),this._layoutImpl=c,this._layout=new H._LayoutWrapper(c),b&&this._unsetFocusOnItem(),this._setFocusOnItem({type:w.ObjectType.item,index:0}),this._selection._setFocused({type:w.ObjectType.item,index:0}),this._lastFocusedElementInGroupTrack={type:w.ObjectType.item,index:-1},this._headerContainer.style.opacity=0,this._footerContainer.style.opacity=0,this._horizontalLayout=this._initializeLayout(),this._resetLayoutOrientation(b),b&&(this._canvas.style.width=this._canvas.style.height="")},_currentMode:function(){return this._mode},_setDraggable:function(){var a=this.itemsDraggable||this.itemsReorderable;this._view.items.each(function(b,c,d){d.itemBox&&(d.itemBox.draggable=a&&!r.hasClass(c,z._nonDraggableClass))})},_resizeViewport:function(){this._viewportWidth=z._UNINITIALIZED,this._viewportHeight=z._UNINITIALIZED},_onElementResize:function(){this._writeProfilerMark("_onElementResize,info"),n.schedule(function(){if(!this._isZombie()&&this._viewportWidth!==z._UNINITIALIZED&&this._viewportHeight!==z._UNINITIALIZED){var a=this._element.offsetWidth,b=this._element.offsetHeight;if(this._previousWidth!==a||this._previousHeight!==b){this._writeProfilerMark("resize ("+this._previousWidth+"x"+this._previousHeight+") => ("+a+"x"+b+"),info"),this._previousWidth=a,this._previousHeight=b,this._resizeViewport();var c=this;this._affectedRange.addAll(),this._batchViewUpdates(z._ViewChange.relayout,z._ScrollToPriority.low,function(){return{position:c.scrollPosition,direction:"right"}})}}},n.Priority.max,this,"WinJS.UI.ListView._onElementResize")},_onFocusIn:function(a){function b(a){c._changeFocus(c._selection._getFocused(),!0,!1,!1,a)}this._hasKeyboardFocus=!0;var c=this;if(a.target===this._keyboardEventsHelper)!this._keyboardEventsHelper._shouldHaveFocus&&this._keyboardFocusInbound?b(!0):this._keyboardEventsHelper._shouldHaveFocus=!1;else if(a.target===this._element)b();else{if(this._mode.inboundFocusHandled)return void(this._mode.inboundFocusHandled=!1);var d=this._view.items,e={},f=this._getHeaderOrFooterFromElement(a.target),g=null;if(f?(e.index=0,e.type=f===this._header?w.ObjectType.header:w.ObjectType.footer,this._lastFocusedElementInGroupTrack=e):(f=this._groups.headerFrom(a.target),f?(e.type=w.ObjectType.groupHeader,e.index=this._groups.index(f),this._lastFocusedElementInGroupTrack=e):(e.index=d.index(a.target),e.type=w.ObjectType.item,f=d.itemBoxAt(e.index),g=d.itemAt(e.index))),e.index!==z._INVALID_INDEX&&((this._keyboardFocusInbound||this._selection._keyboardFocused())&&(e.type===w.ObjectType.groupHeader&&a.target===f||e.type===w.ObjectType.item&&a.target.parentNode===f)&&this._drawFocusRectangle(f),this._tabManager.childFocus!==f&&this._tabManager.childFocus!==g&&(this._selection._setFocused(e,this._keyboardFocusInbound||this._selection._keyboardFocused()),this._keyboardFocusInbound=!1,e.type===w.ObjectType.item&&(f=d.itemAt(e.index)),this._tabManager.childFocus=f,c._updater))){var h=c._updater.elements[R(f)],i=e.index;h&&h.newIndex&&(i=h.newIndex),c._updater.oldFocus={type:e.type,index:i},c._updater.newFocus={type:e.type,index:i}}}},_onFocusOut:function(a){if(!this._disposed){this._hasKeyboardFocus=!1,this._itemFocused=!1;var b=this._view.items.itemBoxFrom(a.target)||this._groups.headerFrom(a.target);b&&this._clearFocusRectangle(b)}},_onMSManipulationStateChanged:function(a){function b(){c._manipulationEndSignal=null}var c=this;this._manipulationState=a.currentState,c._writeProfilerMark("_onMSManipulationStateChanged state("+a.currentState+"),info"),this._manipulationState===r._MSManipulationEvent.MS_MANIPULATION_STATE_STOPPED||this._manipulationEndSignal||(this._manipulationEndSignal=new o,this._manipulationEndSignal.promise.done(b,b)),this._manipulationState===r._MSManipulationEvent.MS_MANIPULATION_STATE_STOPPED&&this._manipulationEndSignal.complete()},_pendingScroll:!1,_onScroll:function(){this._zooming||this._pendingScroll||this._checkScroller()},_checkScroller:function(){if(!this._isZombie()){var a=this._viewportScrollPosition;if(a!==this._lastScrollPosition){this._pendingScroll=c._requestAnimationFrame(this._checkScroller.bind(this)),a=Math.max(0,a);var b=this._scrollDirection(a);this._lastScrollPosition=a,this._raiseViewLoading(!0),this._raiseHeaderFooterVisibilityEvent();var d=this;this._view.onScroll(function(){return{position:d._lastScrollPosition,direction:b}},this._manipulationEndSignal?this._manipulationEndSignal.promise:m.timeout(z._DEFERRED_SCROLL_END))}else this._pendingScroll=null}},_scrollDirection:function(a){var b=a<this._lastScrollPosition?"left":"right";return b===this._lastDirection?b:this._direction},_onTabEnter:function(){this._keyboardFocusInbound=!0},_onTabExit:function(){this._keyboardFocusInbound=!1},_onPropertyChange:function(a){var b=this;a.forEach(function(a){var c=!1;if("dir"===a.attributeName?c=!0:"style"===a.attributeName&&(c=b._cachedStyleDir!==a.target.style.direction),c&&(b._cachedStyleDir=a.target.style.direction,b._cachedRTL=null,r[b._rtl()?"addClass":"removeClass"](b._element,z._rtlListViewClass),b._lastScrollPosition=0,b._viewportScrollPosition=0,b.forceLayout()),"tabIndex"===a.attributeName){var d=b._element.tabIndex;d>=0&&(b._view.items.each(function(a,b){b.tabIndex=d}),b._header&&(b._header.tabIndex=d),b._footer&&(b._footer.tabIndex=d),b._tabIndex=d,b._tabManager.tabIndex=d,b._element.tabIndex=-1)}})},_getCanvasMargins:function(){return this._canvasMargins||(this._canvasMargins=H._getMargins(this._canvas)),this._canvasMargins},_convertCoordinatesByCanvasMargins:function(a,b){function c(c,d){void 0!==a[c]&&(a[c]=b(a[c],d))}var d;return this._horizontal()?(d=this._getCanvasMargins()[this._rtl()?"right":"left"],c("left",d)):(d=this._getCanvasMargins().top,c("top",d)),c("begin",d),c("end",d),a},_convertFromCanvasCoordinates:function(a){return this._convertCoordinatesByCanvasMargins(a,function(a,b){return a+b})},_convertToCanvasCoordinates:function(a){return this._convertCoordinatesByCanvasMargins(a,function(a,b){return a-b})},_getViewportSize:function(){return(this._viewportWidth===z._UNINITIALIZED||this._viewportHeight===z._UNINITIALIZED)&&(this._viewportWidth=Math.max(0,r.getContentWidth(this._element)),this._viewportHeight=Math.max(0,r.getContentHeight(this._element)),this._writeProfilerMark("viewportSizeDetected width:"+this._viewportWidth+" height:"+this._viewportHeight),this._previousWidth=this._element.offsetWidth,this._previousHeight=this._element.offsetHeight),{width:this._viewportWidth,height:this._viewportHeight}},_itemsCount:function(){function a(){b._itemsCountPromise=null}var b=this;if(this._cachedCount!==z._UNINITIALIZED)return m.wrap(this._cachedCount);var c;return this._itemsCountPromise?c=this._itemsCountPromise:(c=this._itemsCountPromise=this._itemsManager.dataSource.getCount().then(function(a){return a===w.CountResult.unknown&&(a=0),b._cachedCount=a,b._selection._updateCount(b._cachedCount),a},function(){return m.cancel}),this._itemsCountPromise.then(a,a)),c},_isSelected:function(a){return this._selection._isIncluded(a)},_LoadingState:{itemsLoading:"itemsLoading",viewPortLoaded:"viewPortLoaded",itemsLoaded:"itemsLoaded",complete:"complete"},_raiseViewLoading:function(a){this._loadingState!==this._LoadingState.itemsLoading&&(this._scrolling=!!a),this._setViewState(this._LoadingState.itemsLoading)},_raiseViewComplete:function(){this._disposed||this._view.animating||this._setViewState(this._LoadingState.complete)},_raiseHeaderFooterVisibilityEvent:function(){var b=this,c=function(a){if(!a)return!1;var c=b._lastScrollPosition,d=a[b._horizontal()?"offsetLeft":"offsetTop"],e=a[b._horizontal()?"offsetWidth":"offsetHeight"];return d+e>c&&d<c+b._getViewportLength()},d=function(c,d){var e=a.document.createEvent("CustomEvent");e.initCustomEvent(c,!0,!0,{visible:d}),b._element.dispatchEvent(e)},e=!!this._header&&c(this._headerContainer),f=!!this._footer&&c(this._footerContainer);this._headerFooterVisibilityStatus.headerVisible!==e&&(this._headerFooterVisibilityStatus.headerVisible=e,d("headervisibilitychanged",e)),this._headerFooterVisibilityStatus.footerVisible!==f&&(this._headerFooterVisibilityStatus.footerVisible=f,d("footervisibilitychanged",f))},_setViewState:function(b){if(b!==this._loadingState){var c={scrolling:!1};switch(b){case this._LoadingState.viewPortLoaded:this._scheduledForDispose||(L(this),this._scheduledForDispose=!0),this._setViewState(this._LoadingState.itemsLoading);break;case this._LoadingState.itemsLoaded:c={scrolling:this._scrolling},this._setViewState(this._LoadingState.viewPortLoaded);break;case this._LoadingState.complete:this._setViewState(this._LoadingState.itemsLoaded),this._updateDeleteWrapperSize(!0)}this._writeProfilerMark("loadingStateChanged:"+b+",info"),this._loadingState=b;var d=a.document.createEvent("CustomEvent");d.initCustomEvent("loadingstatechanged",!0,!1,c),this._element.dispatchEvent(d)}},_createTemplates:function(){function b(b,c){var d=a.document.createElement("div");return d.className=b,c||d.setAttribute("aria-hidden",!0),d}this._itemBoxTemplate=b(z._itemBoxClass,!0)},_updateSelection:function(){var a=this._selection.getIndices(),b=this._selection.isEverything(),c={};if(!b)for(var d=0,e=a.length;e>d;d++){var f=a[d];c[f]=!0}this._view.items.each(function(a,d,e){if(e.itemBox){var f=b||!!c[a];A._ItemEventsHandler.renderSelection(e.itemBox,d,f,!0),e.container&&r[f?"addClass":"removeClass"](e.container,z._selectedClass)}})},_getViewportLength:function(){return this._getViewportSize()[this._horizontal()?"width":"height"]},_horizontal:function(){return this._horizontalLayout},_rtl:function(){return"boolean"!=typeof this._cachedRTL&&(this._cachedRTL="rtl"===r._getComputedStyle(this._element,null).direction),this._cachedRTL},_showProgressBar:function(a,b,c){var d=this._progressBar,e=d.style;if(!d.parentNode){this._fadingProgressBar=!1,this._progressIndicatorDelayTimer&&this._progressIndicatorDelayTimer.cancel();var f=this;this._progressIndicatorDelayTimer=m.timeout(z._LISTVIEW_PROGRESS_DELAY).then(function(){f._isZombie()||(a.appendChild(d),j.fadeIn(d),f._progressIndicatorDelayTimer=null)})}e[this._rtl()?"right":"left"]=b,e.top=c},_hideProgressBar:function(){this._progressIndicatorDelayTimer&&(this._progressIndicatorDelayTimer.cancel(),this._progressIndicatorDelayTimer=null);var a=this._progressBar;if(a.parentNode&&!this._fadingProgressBar){this._fadingProgressBar=!0;var b=this;j.fadeOut(a).then(function(){a.parentNode&&a.parentNode.removeChild(a),b._fadingProgressBar=!1})}},_getPanAxis:function(){
return this._horizontal()?"horizontal":"vertical"},_configureForZoom:function(a,b,e){if(c.validation&&(!this._view.realizePage||"number"!=typeof this._view.begin))throw new d("WinJS.UI.ListView.NotCompatibleWithSemanticZoom",S.notCompatibleWithSemanticZoom);this._isZoomedOut=a,this._disableEntranceAnimation=!b,this._isCurrentZoomView=b,this._triggerZoom=e},_setCurrentItem:function(a,b){this._rtl()&&(a=this._viewportWidth-a),this._horizontal()?a+=this.scrollPosition:b+=this.scrollPosition;var c=this._view.hitTest(a,b),d={type:c.type?c.type:w.ObjectType.item,index:c.index};d.index>=0&&(this._hasKeyboardFocus?this._changeFocus(d,!0,!1,!0):this._changeFocusPassively(d))},_getCurrentItem:function(){var a=this._selection._getFocused();a.type===w.ObjectType.groupHeader?a={type:w.ObjectType.item,index:this._groups.group(a.index).startIndex}:a.type!==w.ObjectType.item&&(a={type:w.ObjectType.item,index:a.type===w.ObjectType.header?0:this._cachedCount}),"number"!=typeof a.index&&(this._setCurrentItem(.5*this._viewportWidth,.5*this._viewportHeight),a=this._selection._getFocused());var b=this,c=this._getItemOffsetPosition(a.index).then(function(a){var c=b._canvasStart;return a[b._startProperty]+=c,a});return m.join({item:this._dataSource.itemFromIndex(a.index),position:c})},_animateItemsForPhoneZoom:function(){function a(a,b,c){return function(d){return(b[d]-a)*c}}function b(){for(var a=0,b=c.length;b>a;a++)c[a].style[O.scriptName]=""}for(var c=[],d=[],e=[],f=Number.MAX_VALUE,g=this,h=this._view.firstIndexDisplayed,i=Math.min(this._cachedCount,this._view.lastIndexDisplayed+1);i>h;h++)e.push(this._view.waitForEntityPosition({type:w.ObjectType.item,index:h}).then(function(){c.push(g._view.items.containerAt(h));var a=0;if(g.layout._getItemPosition){var b=g.layout._getItemPosition(h);b.row&&(a=b.row)}d.push(a),f=Math.min(a,f)}));return m.join(e).then(function(){return(0===c.length?m.wrap():k.executeTransition(c,{property:O.cssName,delay:a(f,d,30),duration:100,timing:"ease-in-out",from:g._isCurrentZoomView?"rotateX(0deg)":"rotateX(-90deg)",to:g._isCurrentZoomView?"rotateX(90deg)":"rotateX(0deg)"})).then(b,b)}).then(b,b)},_beginZoom:function(){this._zooming=!0;var a=null;if(c.isPhone){if(this._isZoomedOut)if(this._zoomAnimationPromise&&this._zoomAnimationPromise.cancel(),this._isCurrentZoomView){var b=this,d=function(){b._zoomAnimationPromise=null};this._zoomAnimationPromise=a=this._animateItemsForPhoneZoom().then(d,d)}else this._zoomAnimationPromise=new o,a=this._zoomAnimationPromise.promise}else{var e=this._horizontal(),f=-this.scrollPosition;r.addClass(this._viewport,e?z._zoomingXClass:z._zoomingYClass),this._canvasStart=f,r.addClass(this._viewport,e?z._zoomingYClass:z._zoomingXClass)}return a},_positionItem:function(a,b){function e(a){return f._getItemOffsetPosition(a).then(function(d){var e,g=f._horizontal(),h=f._viewport[g?"scrollWidth":"scrollHeight"],i=g?f._viewportWidth:f._viewportHeight,j=g?"headerContainerWidth":"headerContainerHeight",k=f.layout._sizes,l=0;k&&k[j]&&(l=k[j]);var m=c.isPhone?l:b[f._startProperty],n=i-(g?d.width:d.height);m=Math.max(0,Math.min(n,m)),e=d[f._startProperty]-m;var o=Math.max(0,Math.min(h-i,e)),p=o-e;e=o;var q={type:w.ObjectType.item,index:a};if(f._hasKeyboardFocus?f._changeFocus(q,!0):f._changeFocusPassively(q),f._raiseViewLoading(!0),c.isPhone)f._viewportScrollPosition=e;else{var r=-e;f._canvasStart=r}if(f._view.realizePage(e,!0),c.isPhone&&f._isZoomedOut){var s=function(){f._zoomAnimationPromise&&f._zoomAnimationPromise.complete&&f._zoomAnimationPromise.complete(),f._zoomAnimationPromise=null};f._animateItemsForPhoneZoom().then(s,s)}return g?{x:p,y:0}:{x:0,y:p}})}var f=this,g=0;if(a&&(g=this._isZoomedOut?a.groupIndexHint:a.firstItemIndexHint),"number"==typeof g)return e(g);var h,i=this._isZoomedOut?a.groupKey:a.firstItemKey;if("string"==typeof i&&this._dataSource.itemFromKey)h=this._dataSource.itemFromKey(i,this._isZoomedOut?{groupMemberKey:a.key,groupMemberIndex:a.index}:null);else{var j=this._isZoomedOut?a.groupDescription:a.firstItemDescription;if(c.validation&&void 0===j)throw new d("WinJS.UI.ListView.InvalidItem",S.listViewInvalidItem);h=this._dataSource.itemFromDescription(j)}return h.then(function(a){return e(a.index)})},_endZoom:function(a){if(!this._isZombie()){if(!c.isPhone){var b=this._canvasStart;r.removeClass(this._viewport,z._zoomingYClass),r.removeClass(this._viewport,z._zoomingXClass),this._canvasStart=0,this._viewportScrollPosition=-b}this._disableEntranceAnimation=!a,this._isCurrentZoomView=a,this._zooming=!1,this._view.realizePage(this.scrollPosition,!1)}},_getItemOffsetPosition:function(a){var b=this;return this._getItemOffset({type:w.ObjectType.item,index:a}).then(function(a){return b._ensureFirstColumnRange(w.ObjectType.item).then(function(){return a=b._correctRangeInFirstColumn(a,w.ObjectType.item),a=b._convertFromCanvasCoordinates(a),b._horizontal()?(a.left=a.begin,a.width=a.end-a.begin,a.height=a.totalHeight):(a.top=a.begin,a.height=a.end-a.begin,a.width=a.totalWidth),a})})},_groupRemoved:function(a){this._groupFocusCache.deleteGroup(a)},_updateFocusCache:function(a){this._updateFocusCacheItemRequest&&this._updateFocusCacheItemRequest.cancel();var b=this;this._updateFocusCacheItemRequest=this._view.items.requestItem(a).then(function(){b._updateFocusCacheItemRequest=null;var c=b._view.items.itemDataAt(a),d=b._groups.groupFromItem(a),e=b._groups.group(d).key;c.itemsManagerRecord.item&&b._groupFocusCache.updateCache(e,c.itemsManagerRecord.item.key,a)})},_changeFocus:function(a,b,c,d,e){if(!this._isZombie()){var f;if(a.type===w.ObjectType.item)f=this._view.items.itemAt(a.index),!b&&f&&r.hasClass(f,z._nonSelectableClass)&&(b=!0),this._updateFocusCache(a.index);else if(a.type===w.ObjectType.groupHeader){this._lastFocusedElementInGroupTrack=a;var g=this._groups.group(a.index);f=g&&g.header}else this._lastFocusedElementInGroupTrack=a,f=a.type===w.ObjectType.footer?this._footer:this._header;this._unsetFocusOnItem(!!f),this._hasKeyboardFocus=!0,this._selection._setFocused(a,e),d||this.ensureVisible(a),!b&&this._selectFocused(c)&&this._selection.set(a.index),this._setFocusOnItem(a)}},_changeFocusPassively:function(a){var b;switch(a.type){case w.ObjectType.item:b=this._view.items.itemAt(a.index),this._updateFocusCache(a.index);break;case w.ObjectType.groupHeader:this._lastFocusedElementInGroupTrack=a;var c=this._groups.group(a.index);b=c&&c.header;break;case w.ObjectType.header:this._lastFocusedElementInGroupTrack=a,b=this._header;break;case w.ObjectType.footer:this._lastFocusedElementInGroupTrack=a,b=this._footer}this._unsetFocusOnItem(!!b),this._selection._setFocused(a),this._setFocusOnItem(a)},_drawFocusRectangle:function(b){if(b!==this._header&&b!==this._footer)if(r.hasClass(b,z._headerClass))r.addClass(b,z._itemFocusClass);else{var c=this._view.items.itemBoxFrom(b);if(c.querySelector("."+z._itemFocusOutlineClass))return;r.addClass(c,z._itemFocusClass);var d=a.document.createElement("div");d.className=z._itemFocusOutlineClass,c.appendChild(d)}},_clearFocusRectangle:function(a){if(a&&!this._isZombie()&&a!==this._header&&a!==this._footer){var b=this._view.items.itemBoxFrom(a);if(b){r.removeClass(b,z._itemFocusClass);var c=b.querySelector("."+z._itemFocusOutlineClass);c&&c.parentNode.removeChild(c)}else{var d=this._groups.headerFrom(a);d&&r.removeClass(d,z._itemFocusClass)}}},_defaultInvoke:function(a){(this._isZoomedOut||c.isPhone&&this._triggerZoom&&a.type===w.ObjectType.groupHeader)&&(this._changeFocusPassively(a),this._triggerZoom())},_selectionAllowed:function(a){var b=void 0!==a?this.elementFromIndex(a):null,c=!(b&&r.hasClass(b,z._nonSelectableClass));return c&&this._selectionMode!==w.SelectionMode.none},_multiSelection:function(){return this._selectionMode===w.SelectionMode.multi},_isInSelectionMode:function(){return this.tapBehavior===w.TapBehavior.toggleSelect&&this.selectionMode===w.SelectionMode.multi},_selectOnTap:function(){return this._tap===w.TapBehavior.toggleSelect||this._tap===w.TapBehavior.directSelect},_selectFocused:function(a){return this._tap===w.TapBehavior.directSelect&&this._selectionMode===w.SelectionMode.multi&&!a},_dispose:function(){if(!this._disposed){this._disposed=!0;var a=function(a){a&&(a.textContent="")};r._resizeNotifier.unsubscribe(this._element,this._onElementResizeBound),this._elementResizeInstrument.dispose(),this._batchingViewUpdates&&this._batchingViewUpdates.cancel(),this._view&&this._view._dispose&&this._view._dispose(),this._mode&&this._mode._dispose&&this._mode._dispose(),this._groups&&this._groups._dispose&&this._groups._dispose(),this._selection&&this._selection._dispose&&this._selection._dispose(),this._layout&&this._layout.uninitialize&&this._layout.uninitialize(),this._itemsCountPromise&&this._itemsCountPromise.cancel(),this._versionManager&&this._versionManager._dispose(),this._clearInsertedItems(),this._itemsManager&&this._itemsManager.release(),this._zoomAnimationPromise&&this._zoomAnimationPromise.cancel(),a(this._viewport),a(this._canvas),a(this._canvasProxy),this._versionManager=null,this._view=null,this._mode=null,this._element=null,this._viewport=null,this._itemsManager=null,this._canvas=null,this._canvasProxy=null,this._itemsCountPromise=null,this._scrollToFunctor=null;var b=Q.indexOf(this);b>=0&&Q.splice(b,1)}},_isZombie:function(){return this._disposed||!(this.element.firstElementChild&&a.document.body.contains(this.element))},_ifZombieDispose:function(){var a=this._isZombie();return a&&!this._disposed&&L(this),a},_animationsDisabled:function(){return 0===this._viewportWidth||0===this._viewportHeight?!0:!k.isAnimationEnabled()},_fadeOutViewport:function(){var a=this;return new m(function(b){if(a._animationsDisabled())return void b();if(!a._fadingViewportOut){a._waitingEntranceAnimationPromise&&(a._waitingEntranceAnimationPromise.cancel(),a._waitingEntranceAnimationPromise=null);var c=a._fireAnimationEvent(U.contentTransition);a._firedAnimationEvent=!0,c.prevented?(a._disableEntranceAnimation=!0,a._viewport.style.opacity=1,b()):(a._fadingViewportOut=!0,a._viewport.style.overflow="hidden",j.fadeOut(a._viewport).then(function(){a._isZombie()||(a._fadingViewportOut=!1,a._viewport.style.opacity=1,b())}))}})},_animateListEntrance:function(a){function b(){e._canvas.style.opacity=1,e._headerContainer.style.opacity=1,e._footerContainer.style.opacity=1,e._viewport.style.overflow="",e._raiseHeaderFooterVisibilityEvent()}var d={prevented:!1,animationPromise:m.wrap()},e=this;return this._raiseHeaderFooterVisibilityEvent(),this._disableEntranceAnimation||this._animationsDisabled()?(b(),this._waitingEntranceAnimationPromise&&(this._waitingEntranceAnimationPromise.cancel(),this._waitingEntranceAnimationPromise=null),m.wrap()):(this._firedAnimationEvent?this._firedAnimationEvent=!1:d=this._fireAnimationEvent(U.entrance),d.prevented||c.isPhone?(b(),m.wrap()):(this._waitingEntranceAnimationPromise&&this._waitingEntranceAnimationPromise.cancel(),this._canvas.style.opacity=0,this._viewport.style.overflow="hidden",this._headerContainer.style.opacity=1,this._footerContainer.style.opacity=1,this._waitingEntranceAnimationPromise=d.animationPromise.then(function(){return e._isZombie()?void 0:(e._canvas.style.opacity=1,j.enterContent(e._viewport).then(function(){e._isZombie()||(e._waitingEntranceAnimationPromise=null,e._viewport.style.overflow="")}))}),this._waitingEntranceAnimationPromise))},_fireAnimationEvent:function(b){var c=a.document.createEvent("CustomEvent"),d=m.wrap();c.initCustomEvent("contentanimating",!0,!0,{type:b}),b===U.entrance&&(c.detail.setPromise=function(a){d=a});var e=!this._element.dispatchEvent(c);return{prevented:e,animationPromise:d}},_createAriaMarkers:function(){this._viewport.getAttribute("aria-label")||this._viewport.setAttribute("aria-label",S.listViewViewportAriaLabel),this._ariaStartMarker||(this._ariaStartMarker=a.document.createElement("div"),this._ariaStartMarker.id=R(this._ariaStartMarker),this._viewport.insertBefore(this._ariaStartMarker,this._viewport.firstElementChild)),this._ariaEndMarker||(this._ariaEndMarker=a.document.createElement("div"),this._ariaEndMarker.id=R(this._ariaEndMarker),this._viewport.appendChild(this._ariaEndMarker))},_updateItemsAriaRoles:function(){var a,b,c=this,d=this._element.getAttribute("role");this._currentMode().staticMode()?(a="list",b="listitem"):(a="listbox",b="option"),(d!==a||this._itemRole!==b)&&(this._element.setAttribute("role",a),this._itemRole=b,this._view.items.each(function(a,b){b.setAttribute("role",c._itemRole)}))},_updateGroupHeadersAriaRoles:function(){var a=this.groupHeaderTapBehavior===w.GroupHeaderTapBehavior.none?"separator":"link";if(this._headerRole!==a){this._headerRole=a;for(var b=0,c=this._groups.length();c>b;b++){var d=this._groups.group(b).header;d&&d.setAttribute("role",this._headerRole)}}},_setAriaSelected:function(a,b){var c="true"===a.getAttribute("aria-selected");b!==c&&a.setAttribute("aria-selected",b)},_setupAriaSelectionObserver:function(a){a._mutationObserver||(this._mutationObserver.observe(a,{attributes:!0,attributeFilter:["aria-selected"]}),a._mutationObserver=!0)},_itemPropertyChange:function(a){function b(a){a.forEach(function(a){a.item.setAttribute("aria-selected",!a.selected)})}if(!this._isZombie()){for(var c=this,d=c._selectionMode===w.SelectionMode.single,e=[],f=[],g=0,h=a.length;h>g;g++){var i=a[g].target,j=c._view.items.itemBoxFrom(i),k="true"===i.getAttribute("aria-selected");if(j&&k!==r._isSelectionRendered(j)){var l=c._view.items.index(j),m={index:l,item:i,selected:k};(c._selectionAllowed(l)?e:f).push(m)}}if(e.length>0){var n=new o;c.selection._synchronize(n).then(function(){var a=c.selection._cloneSelection();return e.forEach(function(b){b.selected?a[d?"set":"add"](b.index):a.remove(b.index)}),c.selection._set(a)}).then(function(a){c._isZombie()||a||b(e),n.complete()})}b(f)}},_groupsEnabled:function(){return!!this._groups.groupDataSource},_getItemPosition:function(a,b){var c=this;return this._view.waitForEntityPosition(a).then(function(){var d,e=c._zooming&&0!==c._canvasStart;switch(a.type){case w.ObjectType.item:d=c._view.getContainer(a.index);break;case w.ObjectType.groupHeader:d=c._view._getHeaderContainer(a.index);break;case w.ObjectType.header:e=!0,d=c._headerContainer;break;case w.ObjectType.footer:e=!0,d=c._footerContainer}if(d){c._writeProfilerMark("WinJS.UI.ListView:getItemPosition,info");var f,g;c._view._expandedRange?(f=c._view._expandedRange.first.index,g=c._view._expandedRange.last.index):b=!1,a.type===w.ObjectType.item?(b=!!b,b&=c._view._ensureContainerInDOM(a.index)):b=!1;var h=c._getItemMargins(a.type),i={left:c._rtl()?M(d)-h.right:d.offsetLeft-h.left,top:d.offsetTop-h.top,totalWidth:r.getTotalWidth(d),totalHeight:r.getTotalHeight(d),contentWidth:r.getContentWidth(d),contentHeight:r.getContentHeight(d)};return b&&c._view._forceItemsBlocksInDOM(f,g+1),e?i:c._convertToCanvasCoordinates(i)}return m.cancel})},_getItemOffset:function(a,b){var c=this;return this._getItemPosition(a,b).then(function(b){var d=c._getItemMargins(a.type);if(c._horizontal()){var e=c._rtl();b.begin=b.left-d[e?"left":"right"],b.end=b.left+b.totalWidth+d[e?"right":"left"]}else b.begin=b.top-d.bottom,b.end=b.top+b.totalHeight+d.top;return b})},_getItemMargins:function(b){b=b||w.ObjectType.item;var c=this,d=function(b){var d,e=c._canvas.querySelector("."+b);e||(e=a.document.createElement("div"),r.addClass(e,b),c._viewport.appendChild(e),d=!0);var f=H._getMargins(e);return d&&c._viewport.removeChild(e),f};return b===w.ObjectType.item?this._itemMargins?this._itemMargins:this._itemMargins=d(z._containerClass):b===w.ObjectType.groupHeader?this._headerMargins?this._headerMargins:this._headerMargins=d(z._headerContainerClass):(this._headerFooterMargins||(this._headerFooterMargins={headerMargins:d(z._listHeaderContainerClass),footerMargins:d(z._listFooterContainerClass)}),this._headerFooterMargins[b===w.ObjectType.header?"headerMargins":"footerMargins"])},_fireAccessibilityAnnotationCompleteEvent:function(b,c,d,e){var f={firstIndex:b,lastIndex:c,firstHeaderIndex:+d||-1,lastHeaderIndex:+e||-1},g=a.document.createEvent("CustomEvent");g.initCustomEvent("accessibilityannotationcomplete",!0,!1,f),this._element.dispatchEvent(g)},_ensureFirstColumnRange:function(a){if(a===w.ObjectType.header||a===w.ObjectType.footer)return m.wrap();var b=a===w.ObjectType.item?"_firstItemRange":"_firstHeaderRange";if(this[b])return m.wrap();var c=this;return this._getItemOffset({type:a,index:0},!0).then(function(a){c[b]=a})},_correctRangeInFirstColumn:function(a,b){if(b===w.ObjectType.header||b===w.ObjectType.footer)return a;var c=b===w.ObjectType.groupHeader?this._firstHeaderRange:this._firstItemRange;return c.begin===a.begin&&(this._horizontal()?a.begin=-this._getCanvasMargins()[this._rtl()?"right":"left"]:a.begin=-this._getCanvasMargins().top),a},_updateContainers:function(b,c,d,e){function f(){var b=a.document.createElement("div");return b.className=z._containerClass,b}function g(b,c,d){c+d>m&&(d=m-c);var e,f=b.itemsContainer,g=f.itemsBlocks,h=n._view._blockSize,i=g.length?g[g.length-1]:null,j=g.length?(g.length-1)*h+i.items.length:0,k=d-j;if(k>0){var l,o=k;if(i&&i.items.length<h){var p=Math.min(o,h-i.items.length);l=i.items.length;var q=F._stripedContainers(p,j);u.insertAdjacentHTMLUnsafe(i.element,"beforeend",q),e=i.element.children;for(var r=0;p>r;r++)i.items.push(e[l+r]);o-=p}j=g.length*h;var s=Math.floor(o/h),t="",v=j,y=j+h;if(s>0){var z=["<div class='win-itemsblock'>"+F._stripedContainers(h,v)+"</div>","<div class='win-itemsblock'>"+F._stripedContainers(h,y)+"</div>"];t=F._repeat(z,s),j+=s*h}var A=o%h;A>0&&(t+="<div class='win-itemsblock'>"+F._stripedContainers(A,j)+"</div>",j+=A,s++);var B=a.document.createElement("div");u.setInnerHTMLUnsafe(B,t);for(var e=B.children,r=0;s>r;r++){var C=e[r],D={element:C,items:F._nodeListToArray(C.children)};g.push(D)}}else if(0>k)for(var E=k;0>E;E++){var G=i.items.pop();!n._view._requireFocusRestore&&G.contains(a.document.activeElement)&&(n._view._requireFocusRestore=a.document.activeElement,n._unsetFocusOnItem()),i.element.removeChild(G),x.push(G),i.items.length||(f.element===i.element.parentNode&&f.element.removeChild(i.element),g.pop(),i=g[g.length-1])}for(var r=0,H=g.length;H>r;r++)for(var C=g[r],E=0;E<C.items.length;E++)w.push(C.items[E])}function h(a,b,c){for(var d=e.filter(function(a){return-1===a.oldIndex&&a.newIndex>=b&&a.newIndex<b+c}).sort(function(a,b){return a.newIndex-b.newIndex}),g=a.itemsContainer,h=0,i=d.length;i>h;h++){var j=d[h],k=j.newIndex-b,l=f(),m=k<g.items.length?g.items[k]:null;g.items.splice(k,0,l),g.element.insertBefore(l,m)}}function i(a,b,c){b+c>m&&(c=m-b);var d=a.itemsContainer,e=c-d.items.length;if(e>0){var f=d.element.children,g=f.length;u.insertAdjacentHTMLUnsafe(d.element,"beforeend",F._repeat("<div class='win-container win-backdrop'></div>",e));for(var h=0;e>h;h++){var i=f[g+h];d.items.push(i)}}for(var h=e;0>h;h++){var i=d.items.pop();d.element.removeChild(i),x.push(i)}for(var h=0,j=d.items.length;j>h;h++)w.push(d.items[h])}function j(a,b){var c=n._view._createHeaderContainer(J),d={header:c,itemsContainer:{element:n._view._createItemsContainer(c)}};return d.itemsContainer[n._view._blockSize?"itemsBlocks":"items"]=[],n._view._blockSize?g(d,b,a.size):i(d,b,a.size),d}function k(a,b,d,f){for(var g,h,i=d+f-1,j=0,k=e.length;k>j;j++){var l=e[j];l.newIndex>=d&&l.newIndex<=i&&-1!==l.oldIndex&&(g!==+g||l.newIndex<g)&&(g=l.newIndex,h=l.newIndex-l.oldIndex)}if(g===+g){var m=0;for(j=0,k=e.length;k>j;j++){var l=e[j];l.newIndex>=d&&l.newIndex<g&&-1===l.oldIndex&&m++}var o=0,p=g-h;for(j=0,k=e.length;k>j;j++){var l=e[j];l.oldIndex>=b&&l.oldIndex<p&&-1===l.newIndex&&o++}h+=o,h-=m,h-=d-b;var q=a.itemsContainer;if(h>0){var r=q.element.children;u.insertAdjacentHTMLUnsafe(q.element,"afterBegin",F._repeat("<div class='win-container win-backdrop'></div>",h));for(var s=0;h>s;s++){var t=r[s];q.items.splice(s,0,t)}}for(var s=h;0>s;s++){var t=q.items.shift();q.element.removeChild(t)}h&&n._affectedRange.add({start:d,end:d+f},c)}}function l(a){for(var b=0,c=0,d=n._view.tree.length;d>c;c++){var e=n._view.tree[c],f=e.itemsContainer.items.length,g=b+f-1;if(a>=b&&g>=a)return{group:c,item:a-b};b+=f}}var m,n=this,o=this._view.containers.length+d,p=c>o;if(p){for(var q=0,s=0;s<e.length;s++)-1===e[s].oldIndex&&q++;m=this._view.containers.length+q}else m=c;var t=[],v={},w=[],x=[],y=[],A=0;if(!n._view._blockSize)for(var s=0,B=this._view.tree.length;B>s;s++)y.push(A),A+=this._view.tree[s].itemsContainer.items.length;if(!n._view._blockSize)for(var C=e.filter(function(a){return-1===a.newIndex&&!a._removalHandled}).sort(function(a,b){return b.oldIndex-a.oldIndex}),s=0,B=C.length;B>s;s++){var D=C[s];D._removalHandled=!0;var E=D._itemBox;D._itemBox=null;var G=l(D.oldIndex),H=this._view.tree[G.group],I=H.itemsContainer.items[G.item];I.parentNode.removeChild(I),r.hasClass(E,z._selectedClass)&&r.addClass(I,z._selectedClass),H.itemsContainer.items.splice(G.item,1),D.element=I}this._view._modifiedGroups=[];var J=this._canvasProxy;A=0;for(var s=0,B=b.length;B>s&&(!this._groupsEnabled()||m>A);s++){var K=b[s],L=this._view.keyToGroupIndex[K.key],M=this._view.tree[L];if(M)n._view._blockSize?g(M,A,K.size):(k(M,y[L],A,K.size),h(M,A,K.size),i(M,A,K.size)),t.push(M),v[K.key]=t.length-1,delete this._view.keyToGroupIndex[K.key],J=M.itemsContainer.element,this._view._modifiedGroups.push({oldIndex:L,newIndex:t.length-1,element:M.header});else{var N=j(K,A);t.push(N),v[K.key]=t.length-1,this._view._modifiedGroups.push({oldIndex:-1,newIndex:t.length-1,element:N.header}),J=N.itemsContainer.element}A+=K.size}for(var O=[],P=[],Q=this._view.keyToGroupIndex?Object.keys(this._view.keyToGroupIndex):[],s=0,B=Q.length;B>s;s++){var G=this._view.keyToGroupIndex[Q[s]],R=this._view.tree[G];if(P.push(R.header),O.push(R.itemsContainer.element),this._view._blockSize)for(var S=0;S<R.itemsContainer.itemsBlocks.length;S++)for(var T=R.itemsContainer.itemsBlocks[S],U=0;U<T.items.length;U++)x.push(T.items[U]);else for(var U=0;U<R.itemsContainer.items.length;U++)x.push(R.itemsContainer.items[U]);this._view._modifiedGroups.push({oldIndex:G,newIndex:-1,element:R.header})}for(var s=0,B=e.length;B>s;s++)if(-1===e[s].newIndex&&!e[s]._removalHandled){e[s]._removalHandled=!0;var E=e[s]._itemBox;e[s]._itemBox=null;var I;x.length?(I=x.pop(),r.empty(I)):I=f(),r.hasClass(E,z._selectedClass)&&r.addClass(I,z._selectedClass),e._containerStripe===z._containerEvenClass?(r.addClass(I,z._containerEvenClass),r.removeClass(I,z._containerOddClass)):(r.addClass(I,z._containerOddClass),r.removeClass(I,z._containerEvenClass)),I.appendChild(E),e[s].element=I}return this._view.tree=t,this._view.keyToGroupIndex=v,this._view.containers=w,{removedHeaders:P,removedItemsContainers:O}},_writeProfilerMark:function(a){var b="WinJS.UI.ListView:"+this._id+":"+a;h(b),f.log&&f.log(b,null,"listviewprofiler")}},{triggerDispose:function(){K()}});return b.Class.mix(s,e.createEventProperties("iteminvoked","groupheaderinvoked","selectionchanging","selectionchanged","loadingstatechanged","keyboardnavigating","contentanimating","itemdragstart","itemdragenter","itemdragend","itemdragbetween","itemdragleave","itemdragchanged","itemdragdrop","headervisibilitychanged","footervisibilitychanged","accessibilityannotationcomplete")),b.Class.mix(s,p.DOMEventMixin),s})})}),d("WinJS/Controls/FlipView/_Constants",[],function(){"use strict";var a={};return a.datasourceCountChangedEvent="datasourcecountchanged",a.pageVisibilityChangedEvent="pagevisibilitychanged",a.pageSelectedEvent="pageselected",a.pageCompletedEvent="pagecompleted",a}),d("WinJS/Controls/FlipView/_PageManager",["exports","../../Core/_Global","../../Core/_Base","../../Core/_BaseUtils","../../Core/_ErrorFromName","../../Core/_Log","../../Core/_Resources","../../Core/_WriteProfilerMark","../../Animations","../../Promise","../../_Signal","../../Scheduler","../../Utilities/_Dispose","../../Utilities/_ElementUtilities","../../Utilities/_TabContainer","./_Constants"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p){"use strict";c.Namespace._moduleDefine(a,"WinJS.UI",{_FlipPageManager:c.Namespace._lazy(function(){function a(a){var b=a.winControl;return b&&b._isFlipView?!0:!1}function g(a){a.forEach(function(a){var b=a.target;b.winControl&&b.tabIndex>=0&&(b.winControl._pageManager._updateTabIndex(b.tabIndex),b.tabIndex=-1);var c=b.winControl;if(c&&c._isFlipView){var d=!1;"dir"===a.attributeName?d=!0:"style"===a.attributeName&&(d=c._cachedStyleDir!==b.style.direction),d&&(c._cachedStyleDir=b.style.direction,c._pageManager._rtl="rtl"===n._getComputedStyle(c._pageManager._flipperDiv,null).direction,c._pageManager.resized())}})}var q=n._uniqueID,r=d._browserStyleEquivalents,s=50,t=250,u={get badCurrentPage(){return"Invalid argument: currentPage must be a number greater than or equal to zero and be within the bounds of the datasource"}},v=c.Class.define(function(a,b,c,e,f,h,i){this._visibleElements=[],this._flipperDiv=a,this._panningDiv=b,this._panningDivContainer=c,this._buttonVisibilityHandler=i,this._currentPage=null,this._rtl="rtl"===n._getComputedStyle(this._flipperDiv,null).direction,this._itemsManager=e,this._itemSpacing=f,this._tabIndex=n.getTabIndex(a),this._tabIndex<0&&(this._tabIndex=0),b.tabIndex=-1,a.tabIndex=-1,this._tabManager=new o.TabContainer(this._panningDivContainer),this._tabManager.tabIndex=this._tabIndex,this._lastSelectedPage=null,this._lastSelectedElement=null,this._bufferSize=v.flipPageBufferCount,this._cachedSize=-1,this._environmentSupportsTouch=h;var j=this;this._panningDiv.addEventListener("keydown",function(a){j._blockTabs&&a.keyCode===n.Key.tab&&(a.stopImmediatePropagation(),a.preventDefault())},!0),n._addEventListener(this._flipperDiv,"focusin",function(a){a.target===j._flipperDiv&&j._currentPage.element&&n._setActive(j._currentPage.element)},!1),new n._MutationObserver(g).observe(this._flipperDiv,{attributes:!0,attributeFilter:["dir","style","tabindex"]}),this._cachedStyleDir=this._flipperDiv.style.direction,this._handleManipulationStateChangedBound=this._handleManipulationStateChanged.bind(this),this._environmentSupportsTouch&&this._panningDivContainer.addEventListener(d._browserEventEquivalents.manipulationStateChanged,this._handleManipulationStateChangedBound,!0)},{initialize:function(a,c){var d=null;if(this._panningDivContainerOffsetWidth=this._panningDivContainer.offsetWidth,this._panningDivContainerOffsetHeight=this._panningDivContainer.offsetHeight,this._isHorizontal=c,!this._currentPage){this._bufferAriaStartMarker=b.document.createElement("div"),this._bufferAriaStartMarker.id=q(this._bufferAriaStartMarker),this._panningDiv.appendChild(this._bufferAriaStartMarker),this._currentPage=this._createFlipPage(null,this),d=this._currentPage,this._panningDiv.appendChild(d.pageRoot);for(var e=2*this._bufferSize,f=0;e>f;f++)d=this._createFlipPage(d,this),this._panningDiv.appendChild(d.pageRoot);this._bufferAriaEndMarker=b.document.createElement("div"),this._bufferAriaEndMarker.id=q(this._bufferAriaEndMarker),this._panningDiv.appendChild(this._bufferAriaEndMarker)}this._prevMarker=this._currentPage.prev.prev,this._itemsManager&&this.setNewItemsManager(this._itemsManager,a)},dispose:function(){var a=this._currentPage,b=a;do m._disposeElement(b.element),b=b.next;while(b!==a)},setOrientation:function(a){if(this._notificationsEndedSignal){var b=this;return void this._notificationsEndedSignal.promise.done(function(){b._notificationsEndedSignal=null,b.setOrientation(a)})}if(a!==this._isHorizontal){this._isOrientationChanging=!0,this._isHorizontal?n.setScrollPosition(this._panningDivContainer,{scrollLeft:this._getItemStart(this._currentPage),scrollTop:0}):n.setScrollPosition(this._panningDivContainer,{scrollLeft:0,scrollTop:this._getItemStart(this._currentPage)}),this._isHorizontal=a;var c=this._panningDivContainer.style;c.overflowX="hidden",c.overflowY="hidden";var b=this;d._requestAnimationFrame(function(){b._isOrientationChanging=!1,b._forEachPage(function(a){var b=a.pageRoot.style;b.left="0px",b.top="0px"}),c.overflowX=b._isHorizontal&&b._environmentSupportsTouch?"scroll":"hidden",c.overflowY=b._isHorizontal||!b._environmentSupportsTouch?"hidden":"scroll",b._ensureCentered()})}},resetState:function(a){if(this._writeProfilerMark("WinJS.UI.FlipView:resetState,info"),0!==a){var b=this.jumpToIndex(a,!0);if(!b&&d.validation)throw new e("WinJS.UI.FlipView.BadCurrentPage",u.badCurrentPage);return b}m.disposeSubTree(this._flipperDiv),this._resetBuffer(null,!0);var c=this,f=j.wrap(!0);return this._itemsManager&&(f=c._itemsManager._firstItem().then(function(a){return c._currentPage.setElement(a),c._fetchPreviousItems(!0).then(function(){return c._fetchNextItems()}).then(function(){c._setButtonStates()})})),f.then(function(){c._tabManager.childFocus=c._currentPage.element,c._ensureCentered(),c._itemSettledOn()})},setNewItemsManager:function(a,b){this._itemsManager=a;var c=this;return this.resetState(b).then(function(){0!==b&&(c._tabManager.childFocus=c._currentPage.element,c._ensureCentered(),c._itemSettledOn())})},currentIndex:function(){if(!this._itemsManager)return 0;var a=0,b=this._navigationAnimationRecord?this._navigationAnimationRecord.newCurrentElement:this._currentPage.element;return b&&(a=this._getElementIndex(b)),a},resetScrollPos:function(){this._ensureCentered()},scrollPosChanged:function(){if(this._hasFocus&&(this._hadFocus=!0),this._itemsManager&&this._currentPage.element&&!this._isOrientationChanging){var a=this._getViewportStart(),b=this._lastScrollPos>a?this._getTailOfBuffer():this._getHeadOfBuffer();if(a!==this._lastScrollPos){for(;this._currentPage.element&&this._getItemStart(this._currentPage)>a&&this._currentPage.prev.element;)this._currentPage=this._currentPage.prev,this._fetchOnePrevious(b.prev),b=b.prev;for(;this._currentPage.element&&this._itemEnd(this._currentPage)<=a&&this._currentPage.next.element;)this._currentPage=this._currentPage.next,this._fetchOneNext(b.next),b=b.next;this._setButtonStates(),this._checkElementVisibility(!1),this._blockTabs=!0,this._lastScrollPos=a,this._currentPage.element&&(this._tabManager.childFocus=this._currentPage.element),this._setListEnds(),!this._manipulationState&&this._viewportOnItemStart()&&(this._currentPage.element.setAttribute("aria-setsize",this._cachedSize),this._currentPage.element.setAttribute("aria-posinset",this.currentIndex()+1),this._timeoutPageSelection())}}},itemRetrieved:function(a,b){var c=this;if(this._forEachPage(function(d){return d.element===b?(d===c._currentPage||d===c._currentPage.next?c._changeFlipPage(d,b,a):d.setElement(a,!0),!0):void 0}),this._navigationAnimationRecord&&this._navigationAnimationRecord.elementContainers)for(var d=this._navigationAnimationRecord.elementContainers,e=0,f=d.length;f>e;e++)d[e].element===b&&(c._changeFlipPage(d[e],b,a),d[e].element=a);this._checkElementVisibility(!1)},resized:function(){this._panningDivContainerOffsetWidth=this._panningDivContainer.offsetWidth,this._panningDivContainerOffsetHeight=this._panningDivContainer.offsetHeight;var a=this;this._forEachPage(function(b){b.pageRoot.style.width=a._panningDivContainerOffsetWidth+"px",b.pageRoot.style.height=a._panningDivContainerOffsetHeight+"px"}),this._ensureCentered(),this._writeProfilerMark("WinJS.UI.FlipView:resize,StopTM")},jumpToIndex:function(a,b){if(!b){if(!this._itemsManager||!this._currentPage.element||0>a)return j.wrap(!1);var c=this._getElementIndex(this._currentPage.element),d=Math.abs(a-c);if(0===d)return j.wrap(!1)}var e=j.wrap(!0),f=this;return e=e.then(function(){var c=f._itemsManager._itemPromiseAtIndex(a);return j.join({element:f._itemsManager._itemFromItemPromise(c),item:c}).then(function(a){var c=a.element;return f._resetBuffer(c,b),c?(f._currentPage.setElement(c),f._fetchNextItems().then(function(){return f._fetchPreviousItems(!0)}).then(function(){return!0})):!1})}),e=e.then(function(a){return f._setButtonStates(),a})},startAnimatedNavigation:function(a,b,c){if(this._writeProfilerMark("WinJS.UI.FlipView:startAnimatedNavigation,info"),this._currentPage.element){
var d=this._currentPage,e=a?this._currentPage.next:this._currentPage.prev;if(e.element){this._hasFocus&&n._setActive(this._panningDiv),this._navigationAnimationRecord={},this._navigationAnimationRecord.goForward=a,this._navigationAnimationRecord.cancelAnimationCallback=b,this._navigationAnimationRecord.completionCallback=c,this._navigationAnimationRecord.oldCurrentPage=d,this._navigationAnimationRecord.newCurrentPage=e;var f=d.element,g=e.element;this._navigationAnimationRecord.newCurrentElement=g,d.setElement(null,!0),d.elementUniqueID=q(f),e.setElement(null,!0),e.elementUniqueID=q(g);var h=this._createDiscardablePage(f),i=this._createDiscardablePage(g);return h.pageRoot.itemIndex=this._getElementIndex(f),i.pageRoot.itemIndex=h.pageRoot.itemIndex+(a?1:-1),h.pageRoot.style.position="absolute",i.pageRoot.style.position="absolute",h.pageRoot.style.zIndex=1,i.pageRoot.style.zIndex=2,this._setItemStart(h,0),this._setItemStart(i,0),this._blockTabs=!0,this._visibleElements.push(g),this._announceElementVisible(g),this._navigationAnimationRecord.elementContainers=[h,i],{outgoing:h,incoming:i}}}return null},endAnimatedNavigation:function(a,b,c){if(this._writeProfilerMark("WinJS.UI.FlipView:endAnimatedNavigation,info"),this._navigationAnimationRecord&&this._navigationAnimationRecord.oldCurrentPage&&this._navigationAnimationRecord.newCurrentPage){var d=this._restoreAnimatedElement(this._navigationAnimationRecord.oldCurrentPage,b);this._restoreAnimatedElement(this._navigationAnimationRecord.newCurrentPage,c),d||this._setViewportStart(this._getItemStart(a?this._currentPage.next:this._currentPage.prev)),this._navigationAnimationRecord=null,this._itemSettledOn()}},startAnimatedJump:function(a,b,c){if(this._writeProfilerMark("WinJS.UI.FlipView:startAnimatedJump,info"),this._hasFocus&&(this._hadFocus=!0),this._currentPage.element){var d=this._currentPage.element,e=this._getElementIndex(d),f=this;return f.jumpToIndex(a).then(function(g){if(!g)return null;if(f._navigationAnimationRecord={},f._navigationAnimationRecord.cancelAnimationCallback=b,f._navigationAnimationRecord.completionCallback=c,f._navigationAnimationRecord.oldCurrentPage=null,f._forEachPage(function(a){return a.element===d?(f._navigationAnimationRecord.oldCurrentPage=a,!0):void 0}),f._navigationAnimationRecord.newCurrentPage=f._currentPage,f._navigationAnimationRecord.newCurrentPage===f._navigationAnimationRecord.oldCurrentPage)return null;var h=f._currentPage.element;f._navigationAnimationRecord.newCurrentElement=h,f._currentPage.setElement(null,!0),f._currentPage.elementUniqueID=q(h),f._navigationAnimationRecord.oldCurrentPage&&f._navigationAnimationRecord.oldCurrentPage.setElement(null,!0);var i=f._createDiscardablePage(d),j=f._createDiscardablePage(h);return i.pageRoot.itemIndex=e,j.pageRoot.itemIndex=a,i.pageRoot.style.position="absolute",j.pageRoot.style.position="absolute",i.pageRoot.style.zIndex=1,j.pageRoot.style.zIndex=2,f._setItemStart(i,0),f._setItemStart(j,f._itemSize(f._currentPage)),f._visibleElements.push(h),f._announceElementVisible(h),f._navigationAnimationRecord.elementContainers=[i,j],f._blockTabs=!0,{oldPage:i,newPage:j}})}return j.wrap(null)},simulateMouseWheelScroll:function(a){if(!this._environmentSupportsTouch&&!this._waitingForMouseScroll){var c;c="number"==typeof a.deltaY?(a.deltaX||a.deltaY)>0:a.wheelDelta<0;var d=c?this._currentPage.next:this._currentPage.prev;if(d.element){var e={contentX:0,contentY:0,viewportX:0,viewportY:0};e[this._isHorizontal?"contentX":"contentY"]=this._getItemStart(d),n._zoomTo(this._panningDivContainer,e),this._waitingForMouseScroll=!0,b.setTimeout(function(){this._waitingForMouseScroll=!1}.bind(this),n._zoomToDuration+100)}}},endAnimatedJump:function(a,b){this._writeProfilerMark("WinJS.UI.FlipView:endAnimatedJump,info"),this._navigationAnimationRecord.oldCurrentPage?this._navigationAnimationRecord.oldCurrentPage.setElement(a.element,!0):a.element.parentNode&&a.element.parentNode.removeChild(a.element),this._navigationAnimationRecord.newCurrentPage.setElement(b.element,!0),this._navigationAnimationRecord=null,this._ensureCentered(),this._itemSettledOn()},inserted:function(a,b,c,d){this._writeProfilerMark("WinJS.UI.FlipView:inserted,info");var e=this._prevMarker,f=!1,g=!1;if(d&&(this._createAnimationRecord(q(a),null),this._getAnimationRecord(a).inserted=!0),b){do{if(e===this._currentPage&&(f=!0),e.elementUniqueID===q(b)){g=!0;var h,i=e,j=a,k=q(a);if(f)for(;i.next!==this._prevMarker;)h=i.next.element,k=i.next.elementUniqueID,i.next.setElement(j,!0),!j&&k&&(i.next.elementUniqueID=k),j=h,i=i.next;else for(e.elementUniqueID===e.next.elementUniqueID&&e.elementUniqueID&&(i=e.next);i.next!==this._prevMarker;)h=i.element,k=i.elementUniqueID,i.setElement(j,!0),!j&&k&&(i.elementUniqueID=k),j=h,i=i.prev;if(j){var l=!1;this._forEachPage(function(a){return q(j)===a.elementUniqueID?(l=!0,!0):void 0}),l||this._releaseElementIfNotAnimated(j)}break}e=e.next}while(e!==this._prevMarker)}else if(c){for(;e.next!==this._prevMarker&&e.elementUniqueID!==q(c);)e===this._currentPage&&(f=!0),e=e.next;e.elementUniqueID===q(c)&&e!==this._prevMarker?(e.prev.setElement(a),g=!0):this._releaseElementIfNotAnimated(a)}else this._currentPage.setElement(a);this._getAnimationRecord(a).successfullyMoved=g,this._setButtonStates()},changed:function(a,b){this._writeProfilerMark("WinJS.UI.FlipView:changed,info");var c=this;if(this._forEachPage(function(d){if(d.elementUniqueID===q(b)){var e=c._animationRecords[d.elementUniqueID];return e.changed=!0,e.oldElement=b,e.newElement=a,d.element=a,d.elementUniqueID=q(a),c._animationRecords[q(a)]=e,!0}}),this._navigationAnimationRecord&&this._navigationAnimationRecord.elementContainers){for(var d=0,e=this._navigationAnimationRecord.elementContainers.length;e>d;d++){var f=this._navigationAnimationRecord.elementContainers[d];f&&f.elementUniqueID===q(b)&&(f.element=a,f.elementUniqueID=q(a))}var g=this._navigationAnimationRecord.newCurrentElement;g&&q(g)===q(b)&&(this._navigationAnimationRecord.newCurrentElement=a)}},moved:function(a,b,c){this._writeProfilerMark("WinJS.UI.FlipView:moved,info");var d=this._getAnimationRecord(a);d||(d=this._createAnimationRecord(q(a))),d.moved=!0,this.removed(a,!1,!1),b||c?this.inserted(a,b,c,!1):d.successfullyMoved=!1},removed:function(a,b,c){this._writeProfilerMark("WinJS.UI.FlipView:removed,info");var d=this,e=this._prevMarker,f=j.wrap();if(b){var g=!1;return this._forEachPage(function(b){(b.elementUniqueID===q(a)||g)&&(b.setElement(null,!0),g=!0)}),void this._setButtonStates()}if(c){var h=this._getAnimationRecord(a);h&&(h.removed=!0)}if(this._currentPage.elementUniqueID===q(a))this._currentPage.next.elementUniqueID?(this._shiftLeft(this._currentPage),this._ensureCentered()):this._currentPage.prev.elementUniqueID?this._shiftRight(this._currentPage):this._currentPage.setElement(null,!0);else if(e.elementUniqueID===q(a))e.next.element?f=this._itemsManager._previousItem(e.next.element).then(function(b){return b===a&&(b=d._itemsManager._previousItem(b)),b}).then(function(a){e.setElement(a,!0)}):e.setElement(null,!0);else if(e.prev.elementUniqueID===q(a))e.prev.prev&&e.prev.prev.element?f=this._itemsManager._nextItem(e.prev.prev.element).then(function(b){return b===a&&(b=d._itemsManager._nextItem(b)),b}).then(function(a){e.prev.setElement(a,!0)}):e.prev.setElement(null,!0);else{for(var i=this._currentPage.prev,k=!1;i!==e&&!k;)i.elementUniqueID===q(a)&&(this._shiftRight(i),k=!0),i=i.prev;for(i=this._currentPage.next;i!==e&&!k;)i.elementUniqueID===q(a)&&(this._shiftLeft(i),k=!0),i=i.next}return f.then(function(){d._setButtonStates()})},reload:function(){this._writeProfilerMark("WinJS.UI.FlipView:reload,info"),this.resetState(0)},getItemSpacing:function(){return this._itemSpacing},setItemSpacing:function(a){this._itemSpacing=a,this._ensureCentered()},notificationsStarted:function(){this._writeProfilerMark("WinJS.UI.FlipView:changeNotifications,StartTM"),this._logBuffer(),this._notificationsStarted=this._notificationsStarted||0,this._notificationsStarted++,this._notificationsEndedSignal=new k,this._temporaryKeys=[],this._animationRecords={};var a=this;this._forEachPage(function(b){a._createAnimationRecord(b.elementUniqueID,b)}),this._animationRecords.currentPage=this._currentPage.element,this._animationRecords.nextPage=this._currentPage.next.element},notificationsEnded:function(){var a=this;this._endNotificationsWork&&this._endNotificationsWork.cancel(),this._endNotificationsWork=this._ensureBufferConsistency().then(function(){function b(b){var c=null;return a._forEachPage(function(a){return a.element===b?(c=a,!0):void 0}),c}function c(b,c){a._writeProfilerMark("WinJS.UI.FlipView:_animateOldViewportItemRemoved,info");var d=a._createDiscardablePage(c);a._setItemStart(d,b.originalLocation),f.push(a._deleteFlipPage(d))}function d(c,d){a._writeProfilerMark("WinJS.UI.FlipView:_animateOldViewportItemMoved,info");var e,g=c.originalLocation;if(c.successfullyMoved)e=b(d),g=c.newLocation;else{e=a._createDiscardablePage(d);var h=a._getElementIndex(d),i=a._currentPage.element?a._getElementIndex(a._currentPage.element):0;g+=i>h?-100*a._bufferSize:100*a._bufferSize}e&&(a._setItemStart(e,c.originalLocation),f.push(a._moveFlipPage(e,function(){a._setItemStart(e,g)})))}function e(){return 0===f.length&&f.push(j.wrap()),j.join(f)}var f=[];a._forEachPage(function(b){var c=a._getAnimationRecord(b.element);c&&(c.changed&&(c.oldElement.removedFromChange=!0,f.push(a._changeFlipPage(b,c.oldElement,c.newElement))),c.newLocation=b.location,a._setItemStart(b,c.originalLocation),c.inserted&&(b.elementRoot.style.opacity=0))});var g=a._animationRecords.currentPage,h=a._getAnimationRecord(g),i=a._animationRecords.nextPage,k=a._getAnimationRecord(i);h&&h.changed&&(g=h.newElement),k&&k.changed&&(i=k.newElement),(g!==a._currentPage.element||i!==a._currentPage.next.element)&&(h&&h.removed&&c(h,g),k&&k.removed&&c(k,i)),a._blockTabs=!0,e().then(function(){f=[],h&&h.moved&&d(h,g),k&&k.moved&&d(k,i);var b=a._getAnimationRecord(a._currentPage.element),c=a._getAnimationRecord(a._currentPage.next.element);a._forEachPage(function(d){var e=a._getAnimationRecord(d.element);e&&(e.inserted?e!==b&&e!==c&&(d.elementRoot.style.opacity=1):e.originalLocation!==e.newLocation&&(e!==h&&e!==k||e===h&&!h.moved||e===k&&!k.moved)&&f.push(a._moveFlipPage(d,function(){a._setItemStart(d,e.newLocation)})))}),e().then(function(){f=[],b&&b.inserted&&f.push(a._insertFlipPage(a._currentPage)),c&&c.inserted&&f.push(a._insertFlipPage(a._currentPage.next)),e().then(function(){a._checkElementVisibility(!1),a._itemSettledOn(),a._setListEnds(),a._notificationsStarted--,0===a._notificationsStarted&&a._notificationsEndedSignal.complete(),a._writeProfilerMark("WinJS.UI.FlipView:changeNotifications,StopTM"),a._logBuffer(),a._endNotificationsWork=null})})})})},disableTouchFeatures:function(){this._environmentSupportsTouch=!1;var a=this._panningDivContainer.style;this._panningDivContainer.removeEventListener(d._browserEventEquivalents.manipulationStateChanged,this._handleManipulationStateChangedBound,!0),a.overflowX="hidden",a.overflowY="hidden";var b=["scroll-snap-type","scroll-snap-points-x","scroll-snap-points-y","scroll-limit-x-min","scroll-limit-x-max","scroll-limit-y-min","scroll-limit-y-max"];b.forEach(function(b){var c=r[b];c&&(a[c.scriptName]="")})},_hasFocus:{get:function(){return this._flipperDiv.contains(b.document.activeElement)}},_timeoutPageSelection:function(){var a=this;this._lastTimeoutRequest&&this._lastTimeoutRequest.cancel(),this._lastTimeoutRequest=j.timeout(t).then(function(){a._itemSettledOn()})},_updateTabIndex:function(a){this._forEachPage(function(b){b.element&&(b.element.tabIndex=a)}),this._tabIndex=a,this._tabManager.tabIndex=a},_releaseElementIfNotAnimated:function(a){var b=this._getAnimationRecord(a);b&&(b.changed||b.inserted||b.moved||b.removed)||this._itemsManager.releaseItem(a)},_getAnimationRecord:function(a){return a?this._animationRecords[q(a)]:null},_createAnimationRecord:function(a,b){if(a){var c=this._animationRecords[a]={removed:!1,changed:!1,inserted:!1};return b&&(c.originalLocation=b.location),c}},_writeProfilerMark:function(a){h(a),this._flipperDiv.winControl.constructor._enabledDebug&&f.log&&f.log(a,null,"flipviewdebug")},_getElementIndex:function(a){var b=0;try{b=this._itemsManager.itemObject(a).index}catch(c){}return b},_resetBuffer:function(a,b){this._writeProfilerMark("WinJS.UI.FlipView:_resetBuffer,info");var c=this._currentPage,d=c;do d.element&&d.element===a||b?d.setElement(null,!0):d.setElement(null),d=d.next;while(d!==c)},_getHeadOfBuffer:function(){return this._prevMarker.prev},_getTailOfBuffer:function(){return this._prevMarker},_insertNewFlipPage:function(a){this._writeProfilerMark("WinJS.UI.FlipView:_insertNewFlipPage,info");var b=this._createFlipPage(a,this);return this._panningDiv.appendChild(b.pageRoot),b},_fetchNextItems:function(){this._writeProfilerMark("WinJS.UI.FlipView:_fetchNextItems,info");for(var a=j.wrap(this._currentPage),b=this,c=0;c<this._bufferSize;c++)a=a.then(function(a){return a.next===b._prevMarker&&b._insertNewFlipPage(a),a.element?b._itemsManager._nextItem(a.element).then(function(b){return a.next.setElement(b),a.next}):(a.next.setElement(null),a.next)});return a},_fetchOneNext:function(a){this._writeProfilerMark("WinJS.UI.FlipView:_fetchOneNext,info");var b=a.prev.element;if(this._prevMarker===a&&(this._prevMarker=this._prevMarker.next),!b)return void a.setElement(null);var c=this;return this._itemsManager._nextItem(b).then(function(b){a.setElement(b),c._movePageAhead(a.prev,a)})},_fetchPreviousItems:function(a){this._writeProfilerMark("WinJS.UI.FlipView:_fetchPreviousItems,info");for(var b=this,c=j.wrap(this._currentPage),d=0;d<this._bufferSize;d++)c=c.then(function(a){return a.element?b._itemsManager._previousItem(a.element).then(function(b){return a.prev.setElement(b),a.prev}):(a.prev.setElement(null),a.prev)});return c.then(function(c){a&&(b._prevMarker=c)})},_fetchOnePrevious:function(a){this._writeProfilerMark("WinJS.UI.FlipView:_fetchOnePrevious,info");var b=a.next.element;if(this._prevMarker===a.next&&(this._prevMarker=this._prevMarker.prev),!b)return a.setElement(null),j.wrap();var c=this;return this._itemsManager._previousItem(b).then(function(b){a.setElement(b),c._movePageBehind(a.next,a)})},_setButtonStates:function(){this._currentPage.prev.element?this._buttonVisibilityHandler.showPreviousButton():this._buttonVisibilityHandler.hidePreviousButton(),this._currentPage.next.element?this._buttonVisibilityHandler.showNextButton():this._buttonVisibilityHandler.hideNextButton()},_ensureCentered:function(a){this._writeProfilerMark("WinJS.UI.FlipView:_ensureCentered,info"),this._setItemStart(this._currentPage,s*this._viewportSize());for(var b=this._currentPage;b!==this._prevMarker;)this._movePageBehind(b,b.prev),b=b.prev;for(b=this._currentPage;b.next!==this._prevMarker;)this._movePageAhead(b,b.next),b=b.next;var c=!1;this._lastScrollPos&&!a&&(this._setListEnds(),c=!0),this._lastScrollPos=this._getItemStart(this._currentPage),this._setViewportStart(this._lastScrollPos),this._checkElementVisibility(!0),this._setupSnapPoints(),c||this._setListEnds()},_ensureBufferConsistency:function(){var a=this,b=this._currentPage.element;if(!b)return j.wrap();var c=!1,d={},e={};this._forEachPage(function(a){if(a&&a.elementUniqueID){if(d[a.elementUniqueID])return c=!0,!0;if(d[a.elementUniqueID]=!0,a.location>0){if(e[a.location])return c=!0,!0;e[a.location]=!0}}});var f=Object.keys(this._animationRecords);return f.forEach(function(b){var d=a._animationRecords[b];d&&(d.changed||d.inserted||d.moved||d.removed)&&(c=!0)}),c?(this._resetBuffer(null,!0),this._currentPage.setElement(b),this._fetchNextItems().then(function(){return a._fetchPreviousItems(!0)}).then(function(){a._ensureCentered()})):j.wrap()},_shiftLeft:function(a){this._writeProfilerMark("WinJS.UI.FlipView:_shiftLeft,info");for(var b=a,c=null;b!==this._prevMarker&&b.next!==this._prevMarker;)c=b.next.element,!c&&b.next.elementUniqueID&&(b.elementUniqueID=b.next.elementUniqueID),b.next.setElement(null,!0),b.setElement(c,!0),b=b.next;if(b!==this._prevMarker&&b.prev.element){var d=this;return this._itemsManager._nextItem(b.prev.element).then(function(a){b.setElement(a),d._createAnimationRecord(b.elementUniqueID,b)})}},_logBuffer:function(){if(this._flipperDiv.winControl.constructor._enabledDebug){f.log&&f.log(this._currentPage.next.next.next.elementUniqueID+" @:"+this._currentPage.next.next.next.location+(this._currentPage.next.next.next.element?" "+this._currentPage.next.next.next.element.textContent:""),null,"flipviewdebug"),f.log&&f.log(this._currentPage.next.next.next.next.elementUniqueID+" @:"+this._currentPage.next.next.next.next.location+(this._currentPage.next.next.next.next.element?" "+this._currentPage.next.next.next.next.element.textContent:""),null,"flipviewdebug"),f.log&&f.log("> "+this._currentPage.elementUniqueID+" @:"+this._currentPage.location+(this._currentPage.element?" "+this._currentPage.element.textContent:""),null,"flipviewdebug"),f.log&&f.log(this._currentPage.next.elementUniqueID+" @:"+this._currentPage.next.location+(this._currentPage.next.element?" "+this._currentPage.next.element.textContent:""),null,"flipviewdebug"),f.log&&f.log(this._currentPage.next.next.elementUniqueID+" @:"+this._currentPage.next.next.location+(this._currentPage.next.next.element?" "+this._currentPage.next.next.element.textContent:""),null,"flipviewdebug");var a=Object.keys(this._itemsManager._elementMap),b=[];this._forEachPage(function(a){a&&a.elementUniqueID&&b.push(a.elementUniqueID)}),f.log&&f.log("itemsmanager = ["+a.join(" ")+"] flipview ["+b.join(" ")+"]",null,"flipviewdebug")}},_shiftRight:function(a){this._writeProfilerMark("WinJS.UI.FlipView:_shiftRight,info");for(var b=a,c=null;b!==this._prevMarker;)c=b.prev.element,!c&&b.prev.elementUniqueID&&(b.elementUniqueID=b.prev.elementUniqueID),b.prev.setElement(null,!0),b.setElement(c,!0),b=b.prev;if(b.next.element){var d=this;return this._itemsManager._previousItem(b.next.element).then(function(a){b.setElement(a),d._createAnimationRecord(b.elementUniqueID,b)})}},_checkElementVisibility:function(a){var b,c;if(a){var d=this._currentPage.element;for(b=0,c=this._visibleElements.length;c>b;b++)this._visibleElements[b]!==d&&this._announceElementInvisible(this._visibleElements[b]);this._visibleElements=[],d&&(this._visibleElements.push(d),this._announceElementVisible(d))}else{for(b=0,c=this._visibleElements.length;c>b;b++)(!this._visibleElements[b].parentNode||this._visibleElements[b].removedFromChange)&&this._announceElementInvisible(this._visibleElements[b]);this._visibleElements=[];var e=this;this._forEachPage(function(a){var b=a.element;b&&(e._itemInView(a)?(e._visibleElements.push(b),e._announceElementVisible(b)):e._announceElementInvisible(b))})}},_announceElementVisible:function(a){if(a&&!a.visible){a.visible=!0;var c=b.document.createEvent("CustomEvent");this._writeProfilerMark("WinJS.UI.FlipView:pageVisibilityChangedEvent(visible:true),info"),c.initCustomEvent(p.pageVisibilityChangedEvent,!0,!1,{source:this._flipperDiv,visible:!0}),a.dispatchEvent(c)}},_announceElementInvisible:function(a){if(a&&a.visible){a.visible=!1;var c=!1;a.parentNode||(c=!0,this._panningDivContainer.appendChild(a));var d=b.document.createEvent("CustomEvent");this._writeProfilerMark("WinJS.UI.FlipView:pageVisibilityChangedEvent(visible:false),info"),d.initCustomEvent(p.pageVisibilityChangedEvent,!0,!1,{source:this._flipperDiv,visible:!1}),a.dispatchEvent(d),c&&this._panningDivContainer.removeChild(a)}},_createDiscardablePage:function(a){var b=this._createPageContainer(),c={pageRoot:b.root,elementRoot:b.elementContainer,discardable:!0,element:a,elementUniqueID:q(a),discard:function(){c.pageRoot.parentNode&&c.pageRoot.parentNode.removeChild(c.pageRoot),c.element.parentNode&&c.element.parentNode.removeChild(c.element)}};return c.pageRoot.style.top="0px",c.elementRoot.appendChild(a),this._panningDiv.appendChild(c.pageRoot),c},_createPageContainer:function(){var a=this._panningDivContainerOffsetWidth,c=this._panningDivContainerOffsetHeight,d=b.document.createElement("div"),e=d.style,f=b.document.createElement("div");return f.className="win-item",e.position="absolute",e.overflow="hidden",e.width=a+"px",e.height=c+"px",d.appendChild(f),{root:d,elementContainer:f}},_createFlipPage:function(b,c){var d={};d.element=null,d.elementUniqueID=null,b?(d.prev=b,d.next=b.next,d.next.prev=d,b.next=d):(d.next=d,d.prev=d);var e=this._createPageContainer();return d.elementRoot=e.elementContainer,d.elementRoot.style.msOverflowStyle="auto",d.pageRoot=e.root,d.setElement=function(b,e){if(void 0===b&&(b=null),b===d.element)return void(b||(d.elementUniqueID=null));if(d.element&&(e||(c._itemsManager.releaseItem(d.element),m._disposeElement(d.element))),d.element=b,d.elementUniqueID=b?q(b):null,n.empty(d.elementRoot),d.element){if(d===c._currentPage&&(c._tabManager.childFocus=b),!a(d.element)){d.element.tabIndex=c._tabIndex,d.element.setAttribute("role","option"),d.element.setAttribute("aria-selected",!1),d.element.id||(d.element.id=q(d.element));var f=function(a,b,c){a.setAttribute(c,b.id)},g=!d.next.element||d===c._prevMarker.prev;g&&(f(d.element,c._bufferAriaEndMarker,"aria-flowto"),f(c._bufferAriaEndMarker,d.element,"x-ms-aria-flowfrom")),d!==c._prevMarker&&d.prev.element&&(f(d.prev.element,d.element,"aria-flowto"),f(d.element,d.prev.element,"x-ms-aria-flowfrom")),d.next!==c._prevMarker&&d.next.element&&(f(d.element,d.next.element,"aria-flowto"),f(d.next.element,d.element,"x-ms-aria-flowfrom")),d.prev.element||f(d.element,c._bufferAriaStartMarker,"x-ms-aria-flowfrom")}d.elementRoot.appendChild(d.element)}},d},_itemInView:function(a){return this._itemEnd(a)>this._getViewportStart()&&this._getItemStart(a)<this._viewportEnd()},_getViewportStart:function(){return this._panningDivContainer.parentNode?this._isHorizontal?n.getScrollPosition(this._panningDivContainer).scrollLeft:n.getScrollPosition(this._panningDivContainer).scrollTop:void 0},_setViewportStart:function(a){this._panningDivContainer.parentNode&&(this._isHorizontal?n.setScrollPosition(this._panningDivContainer,{scrollLeft:a}):n.setScrollPosition(this._panningDivContainer,{scrollTop:a}))},_viewportEnd:function(){var a=this._panningDivContainer;return this._isHorizontal?this._rtl?this._getViewportStart()+this._panningDivContainerOffsetWidth:n.getScrollPosition(a).scrollLeft+this._panningDivContainerOffsetWidth:a.scrollTop+this._panningDivContainerOffsetHeight},_viewportSize:function(){return this._isHorizontal?this._panningDivContainerOffsetWidth:this._panningDivContainerOffsetHeight},_getItemStart:function(a){return a.location},_setItemStart:function(a,b){void 0!==b&&(this._isHorizontal?a.pageRoot.style.left=(this._rtl?-b:b)+"px":a.pageRoot.style.top=b+"px",a.location=b)},_itemEnd:function(a){return(this._isHorizontal?a.location+this._panningDivContainerOffsetWidth:a.location+this._panningDivContainerOffsetHeight)+this._itemSpacing},_itemSize:function(){return this._isHorizontal?this._panningDivContainerOffsetWidth:this._panningDivContainerOffsetHeight},_movePageAhead:function(a,b){var c=this._itemSize(a)+this._itemSpacing;this._setItemStart(b,this._getItemStart(a)+c)},_movePageBehind:function(a,b){var c=this._itemSize(a)+this._itemSpacing;this._setItemStart(b,this._getItemStart(a)-c)},_setupSnapPoints:function(){if(this._environmentSupportsTouch){var a=this._panningDivContainer.style;a[r["scroll-snap-type"].scriptName]="mandatory";var b=this._viewportSize(),c=b+this._itemSpacing,d="scroll-snap-points",e=0,f=this._getItemStart(this._currentPage);e=f%(b+this._itemSpacing),a[r[this._isHorizontal?d+"-x":d+"-y"].scriptName]="snapInterval("+e+"px, "+c+"px)"}},_setListEnds:function(){if(this._environmentSupportsTouch&&this._currentPage.element){for(var a=this._panningDivContainer.style,b=0,c=0,d=this._getTailOfBuffer(),e=this._getHeadOfBuffer(),f=r["scroll-limit-"+(this._isHorizontal?"x-min":"y-min")].scriptName,g=r["scroll-limit-"+(this._isHorizontal?"x-max":"y-max")].scriptName;!e.element&&(e=e.prev,e!==this._prevMarker.prev););for(;!d.element&&(d=d.next,d!==this._prevMarker););c=this._getItemStart(e),b=this._getItemStart(d),a[f]=b+"px",a[g]=c+"px"}},_viewportOnItemStart:function(){return this._getItemStart(this._currentPage)===this._getViewportStart()},_restoreAnimatedElement:function(a,b){var c=!0;return a.elementUniqueID!==q(b.element)||a.element?this._forEachPage(function(a){a.elementUniqueID!==b.elementUniqueID||a.element||(a.setElement(b.element,!0),c=!1)}):(a.setElement(b.element,!0),c=!1),c},_itemSettledOn:function(){this._lastTimeoutRequest&&(this._lastTimeoutRequest.cancel(),this._lastTimeoutRequest=null);var c=this;d._setImmediate(function(){c._viewportOnItemStart()&&(c._blockTabs=!1,c._currentPage.element&&c._lastSelectedElement!==c._currentPage.element&&(c._lastSelectedPage&&c._lastSelectedPage.element&&!a(c._lastSelectedPage.element)&&c._lastSelectedPage.element.setAttribute("aria-selected",!1),c._lastSelectedPage=c._currentPage,c._lastSelectedElement=c._currentPage.element,a(c._currentPage.element)||c._currentPage.element.setAttribute("aria-selected",!0),l.schedule(function(){if(c._currentPage.element){(c._hasFocus||c._hadFocus)&&(c._hadFocus=!1,n._setActive(c._currentPage.element),c._tabManager.childFocus=c._currentPage.element);var a=b.document.createEvent("CustomEvent");a.initCustomEvent(p.pageSelectedEvent,!0,!1,{source:c._flipperDiv}),c._writeProfilerMark("WinJS.UI.FlipView:pageSelectedEvent,info"),c._currentPage.element.dispatchEvent(a);var d=c._currentPage.element;if(d){var e=c._itemsManager._recordFromElement(d,!0);e&&e.renderComplete.then(function(){d===c._currentPage.element&&(c._currentPage.element.setAttribute("aria-setsize",c._cachedSize),c._currentPage.element.setAttribute("aria-posinset",c.currentIndex()+1),c._bufferAriaStartMarker.setAttribute("aria-flowto",c._currentPage.element.id),a=b.document.createEvent("CustomEvent"),a.initCustomEvent(p.pageCompletedEvent,!0,!1,{source:c._flipperDiv}),c._writeProfilerMark("WinJS.UI.FlipView:pageCompletedEvent,info"),c._currentPage.element.dispatchEvent(a))})}}},l.Priority.normal,null,"WinJS.UI.FlipView._dispatchPageSelectedEvent")))})},_forEachPage:function(a){var b=this._prevMarker;do{if(a(b))break;b=b.next}while(b!==this._prevMarker)},_changeFlipPage:function(a,b,c){this._writeProfilerMark("WinJS.UI.FlipView:_changeFlipPage,info"),a.element=null,a.setElement?a.setElement(c,!0):(b.parentNode.removeChild(b),a.elementRoot.appendChild(c));var d=b.style;return d.position="absolute",d.left="0px",d.top="0px",d.opacity=1,a.pageRoot.appendChild(b),b.style.left=Math.max(0,(a.pageRoot.offsetWidth-b.offsetWidth)/2)+"px",b.style.top=Math.max(0,(a.pageRoot.offsetHeight-b.offsetHeight)/2)+"px",i.fadeOut(b).then(function(){b.parentNode&&b.parentNode.removeChild(b)})},_deleteFlipPage:function(a){h("WinJS.UI.FlipView:_deleteFlipPage,info"),a.elementRoot.style.opacity=0;var b=i.createDeleteFromListAnimation([a.elementRoot]),c=this;return b.execute().then(function(){a.discardable&&(a.discard(),c._itemsManager.releaseItem(a.element))})},_insertFlipPage:function(a){h("WinJS.UI.FlipView:_insertFlipPage,info"),a.elementRoot.style.opacity=1;var b=i.createAddToListAnimation([a.elementRoot]);return b.execute().then(function(){a.discardable&&a.discard()})},_moveFlipPage:function(a,b){h("WinJS.UI.FlipView:_moveFlipPage,info");var c=i.createRepositionAnimation(a.pageRoot);b();var d=this;return c.execute().then(function(){if(a.discardable){a.discard();var b=d._getAnimationRecord(a.element);b&&!b.successfullyMoved&&d._itemsManager.releaseItem(a.element)}})},_handleManipulationStateChanged:function(a){this._manipulationState=a.currentState,0===a.currentState&&a.target===this._panningDivContainer&&(this._itemSettledOn(),this._ensureCentered())}},{supportedForProcessing:!1});return v.flipPageBufferCount=2,v})})}),d("require-style!less/styles-flipview",[],function(){}),d("require-style!less/colors-flipview",[],function(){}),d("WinJS/Controls/FlipView",["../Core/_Global","../Core/_Base","../Core/_BaseUtils","../Core/_ErrorFromName","../Core/_Events","../Core/_Resources","../Core/_WriteProfilerMark","../Animations","../Animations/_TransitionAnimation","../BindingList","../Promise","../Scheduler","../Utilities/_Control","../Utilities/_Dispose","../Utilities/_ElementUtilities","../Utilities/_Hoverable","../Utilities/_ItemsManager","../Utilities/_UI","./ElementResizeInstrument","./FlipView/_Constants","./FlipView/_PageManager","require-style!less/styles-flipview","require-style!less/colors-flipview"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u){"use strict";b.Namespace.define("WinJS.UI",{FlipView:b.Namespace._lazy(function(){function p(a){var b=a[0].target.winControl;b&&b instanceof L&&a.some(function(a){return"dir"===a.attributeName?!0:"style"===a.attributeName?b._cachedStyleDir!==a.target.style.direction:!1})&&(b._cachedStyleDir=b._flipviewDiv.style.direction,b._rtl="rtl"===o._getComputedStyle(b._flipviewDiv,null).direction,b._setupOrientation())}var v="win-navbutton",w="win-flipview",x="win-navleft",y="win-navright",z="win-navtop",A="win-navbottom",B="Previous",C="Next",D=3e3,E=500,F="",G="",H="",I="",J=40,K={get badAxis(){return"Invalid argument: orientation must be a string, either 'horizontal' or 'vertical'"},get badCurrentPage(){return"Invalid argument: currentPage must be a number greater than or equal to zero and be within the bounds of the datasource"},get noitemsManagerForCount(){return"Invalid operation: can't get count if no dataSource has been set"},get badItemSpacingAmount(){return"Invalid argument: itemSpacing must be a number greater than or equal to zero"},get navigationDuringStateChange(){return"Error: After changing itemDataSource or itemTemplate, any navigation in the FlipView control should be delayed until the pageselected event is fired."},get panningContainerAriaLabel(){return f._getWinJSString("ui/flipViewPanningContainerAriaLabel").value}},L=b.Class.define(function(b,c){g("WinJS.UI.FlipView:constructor,StartTM"),this._disposed=!1,b=b||a.document.createElement("div");var d=!0,e=null,f=q._trivialHtmlRenderer,h=0,i=0;if(c){if(c.orientation&&"string"==typeof c.orientation)switch(c.orientation.toLowerCase()){case"horizontal":d=!0;break;case"vertical":d=!1}c.currentPage&&(h=c.currentPage>>0,h=0>h?0:h),c.itemDataSource&&(e=c.itemDataSource),c.itemTemplate&&(f=this._getItemRenderer(c.itemTemplate)),c.itemSpacing&&(i=c.itemSpacing>>0,i=0>i?0:i)}if(!e){var k=new j.List;e=k.dataSource}o.empty(b),this._flipviewDiv=b,b.winControl=this,m._setOptions(this,c,!0),this._initializeFlipView(b,d,e,f,h,i),o.addClass(b,"win-disposable"),this._avoidTrappingTime=0,this._windowWheelHandlerBound=this._windowWheelHandler.bind(this),o._globalListener.addEventListener(b,"wheel",this._windowWheelHandlerBound),o._globalListener.addEventListener(b,"mousewheel",this._windowWheelHandlerBound),g("WinJS.UI.FlipView:constructor,StopTM")},{dispose:function(){g("WinJS.UI.FlipView:dispose,StopTM"),this._disposed||(o._globalListener.removeEventListener(this._flipviewDiv,"wheel",this._windowWheelHandlerBound),o._globalListener.removeEventListener(this._flipviewDiv,"mousewheel",this._windowWheelHandlerBound),o._resizeNotifier.unsubscribe(this._flipviewDiv,this._resizeHandlerBound),this._elementResizeInstrument.dispose(),this._disposed=!0,this._pageManager.dispose(),this._itemsManager.release(),this.itemDataSource=null)},next:function(){g("WinJS.UI.FlipView:next,info");var a=this._nextAnimation?null:this._cancelDefaultAnimation;return this._navigate(!0,a)},previous:function(){g("WinJS.UI.FlipView:prev,info");var a=this._prevAnimation?null:this._cancelDefaultAnimation;return this._navigate(!1,a)},element:{get:function(){return this._flipviewDiv}},currentPage:{get:function(){return this._getCurrentIndex()},set:function(a){if(g("WinJS.UI.FlipView:set_currentPage,info"),this._pageManager._notificationsEndedSignal){
var b=this;return void this._pageManager._notificationsEndedSignal.promise.done(function(){b._pageManager._notificationsEndedSignal=null,b.currentPage=a})}if(!this._animating||this._cancelAnimation())if(a>>=0,a=0>a?0:a,this._refreshTimer)this._indexAfterRefresh=a;else{this._pageManager._cachedSize>0?a=Math.min(this._pageManager._cachedSize-1,a):0===this._pageManager._cachedSize&&(a=0);var b=this;if(this._jumpingToIndex===a)return;var c=function(){b._jumpingToIndex=null};this._jumpingToIndex=a;var d=this._jumpAnimation?this._jumpAnimation:this._defaultAnimation.bind(this),e=this._jumpAnimation?null:this._cancelDefaultAnimation,f=function(){b._completeJump()};this._pageManager.startAnimatedJump(a,e,f).then(function(a){if(a){b._animationsStarted();var e=a.oldPage.pageRoot,h=a.newPage.pageRoot;b._contentDiv.appendChild(e),b._contentDiv.appendChild(h),b._completeJumpPending=!0,d(e,h).then(function(){b._completeJumpPending&&(f(),g("WinJS.UI.FlipView:set_currentPage.animationComplete,info"))}).done(c,c)}else c()},c)}}},orientation:{get:function(){return this._axisAsString()},set:function(a){g("WinJS.UI.FlipView:set_orientation,info");var b="horizontal"===a;b!==this._isHorizontal&&(this._isHorizontal=b,this._setupOrientation(),this._pageManager.setOrientation(this._isHorizontal))}},itemDataSource:{get:function(){return this._dataSource},set:function(a){g("WinJS.UI.FlipView:set_itemDataSource,info"),this._dataSourceAfterRefresh=a||(new j.List).dataSource,this._refresh()}},itemTemplate:{get:function(){return this._itemRenderer},set:function(a){g("WinJS.UI.FlipView:set_itemTemplate,info"),this._itemRendererAfterRefresh=this._getItemRenderer(a),this._refresh()}},itemSpacing:{get:function(){return this._pageManager.getItemSpacing()},set:function(a){g("WinJS.UI.FlipView:set_itemSpacing,info"),a>>=0,a=0>a?0:a,this._pageManager.setItemSpacing(a)}},count:function(){g("WinJS.UI.FlipView:count,info");var a=this;return new k(function(b,c){a._itemsManager?a._pageManager._cachedSize===r.CountResult.unknown||a._pageManager._cachedSize>=0?b(a._pageManager._cachedSize):a._dataSource.getCount().then(function(c){a._pageManager._cachedSize=c,b(c)}):c(L.noitemsManagerForCount)})},setCustomAnimations:function(a){g("WinJS.UI.FlipView:setCustomAnimations,info"),void 0!==a.next&&(this._nextAnimation=a.next),void 0!==a.previous&&(this._prevAnimation=a.previous),void 0!==a.jump&&(this._jumpAnimation=a.jump)},forceLayout:function(){g("WinJS.UI.FlipView:forceLayout,info"),this._pageManager.resized()},_initializeFlipView:function(b,d,e,f,g,h){function i(a){a.setAttribute("aria-hidden",!0),a.style.visibility="hidden",a.style.opacity=0,a.tabIndex=-1,a.style.zIndex=1e3}function j(a){if(a.pointerType!==D){if(m._touchInteraction=!1,a.screenX===m._lastMouseX&&a.screenY===m._lastMouseY)return;m._lastMouseX=a.screenX,m._lastMouseY=a.screenY,m._mouseInViewport=!0,m._fadeInButton("prev"),m._fadeInButton("next"),m._fadeOutButtons()}}function k(a){a.pointerType===D?(m._mouseInViewport=!1,m._touchInteraction=!0,m._fadeOutButtons(!0)):(m._touchInteraction=!1,m._isInteractive(a.target)||0!==(4&a.buttons)&&(a.stopPropagation(),a.preventDefault()))}function l(a){a.pointerType!==D&&(m._touchInteraction=!1)}var m=this,n=!1;this._flipviewDiv=b,o.addClass(this._flipviewDiv,w),this._contentDiv=a.document.createElement("div"),this._panningDivContainer=a.document.createElement("div"),this._panningDivContainer.className="win-surface",this._panningDiv=a.document.createElement("div"),this._prevButton=a.document.createElement("button"),this._nextButton=a.document.createElement("button"),this._isHorizontal=d,this._dataSource=e,this._itemRenderer=f,this._itemsManager=null,this._pageManager=null;for(var t=["scroll-limit-x-max","scroll-limit-x-min","scroll-limit-y-max","scroll-limit-y-min","scroll-snap-type","scroll-snap-x","scroll-snap-y","overflow-style"],v=!0,x=c._browserStyleEquivalents,y=0,z=t.length;z>y;y++)v=v&&!!x[t[y]];v=v&&!!c._browserEventEquivalents.manipulationStateChanged,v=v&&o._supportsSnapPoints,this._environmentSupportsTouch=v;var A=this._flipviewDiv.getAttribute("aria-label");A||this._flipviewDiv.setAttribute("aria-label",""),this._flipviewDiv.setAttribute("role","listbox"),this._flipviewDiv.style.overflow||(this._flipviewDiv.style.overflow="hidden"),this._contentDiv.style.position="relative",this._contentDiv.style.zIndex=0,this._contentDiv.style.width="100%",this._contentDiv.style.height="100%",this._panningDiv.style.position="relative",this._panningDivContainer.style.position="relative",this._panningDivContainer.style.width="100%",this._panningDivContainer.style.height="100%",this._panningDivContainer.setAttribute("role","group"),this._panningDivContainer.setAttribute("aria-label",K.panningContainerAriaLabel),this._contentDiv.appendChild(this._panningDivContainer),this._flipviewDiv.appendChild(this._contentDiv),this._panningDiv.style.width="100%",this._panningDiv.style.height="100%",this._setupOrientation(),i(this._prevButton),i(this._nextButton),this._prevButton.setAttribute("aria-label",B),this._nextButton.setAttribute("aria-label",C),this._prevButton.setAttribute("type","button"),this._nextButton.setAttribute("type","button"),this._panningDivContainer.appendChild(this._panningDiv),this._contentDiv.appendChild(this._prevButton),this._contentDiv.appendChild(this._nextButton),this._itemsManagerCallback={inserted:function(a,b,c){m._itemsManager._itemFromPromise(a).then(function(a){var d=m._itemsManager._elementFromHandle(b),e=m._itemsManager._elementFromHandle(c);m._pageManager.inserted(a,d,e,!0)})},countChanged:function(a,b){m._pageManager._cachedSize=a,b!==r.CountResult.unknown&&m._fireDatasourceCountChangedEvent()},changed:function(a,b){m._pageManager.changed(a,b)},moved:function(a,b,c,d){var e=function(a){m._pageManager.moved(a,b,c)};a?e(a):m._itemsManager._itemFromPromise(d).then(e)},removed:function(a,b){a&&m._pageManager.removed(a,b,!0)},knownUpdatesComplete:function(){},beginNotifications:function(){m._cancelAnimation(),m._pageManager.notificationsStarted()},endNotifications:function(){m._pageManager.notificationsEnded()},itemAvailable:function(a,b){m._pageManager.itemRetrieved(a,b)},reload:function(){m._pageManager.reload()}},this._dataSource&&(this._itemsManager=q._createItemsManager(this._dataSource,this._itemRenderer,this._itemsManagerCallback,{ownerElement:this._flipviewDiv})),this._pageManager=new u._FlipPageManager(this._flipviewDiv,this._panningDiv,this._panningDivContainer,this._itemsManager,h,this._environmentSupportsTouch,{hidePreviousButton:function(){m._hasPrevContent=!1,m._fadeOutButton("prev"),m._prevButton.setAttribute("aria-hidden",!0)},showPreviousButton:function(){m._hasPrevContent=!0,m._fadeInButton("prev"),m._prevButton.setAttribute("aria-hidden",!1)},hideNextButton:function(){m._hasNextContent=!1,m._fadeOutButton("next"),m._nextButton.setAttribute("aria-hidden",!0)},showNextButton:function(){m._hasNextContent=!0,m._fadeInButton("next"),m._nextButton.setAttribute("aria-hidden",!1)}}),this._pageManager.initialize(g,this._isHorizontal),this._dataSource.getCount().then(function(a){m._pageManager._cachedSize=a}),this._prevButton.addEventListener("click",function(){m.previous()},!1),this._nextButton.addEventListener("click",function(){m.next()},!1),new o._MutationObserver(p).observe(this._flipviewDiv,{attributes:!0,attributeFilter:["dir","style"]}),this._cachedStyleDir=this._flipviewDiv.style.direction,this._contentDiv.addEventListener("mouseleave",function(){m._mouseInViewport=!1},!1);var D=o._MSPointerEvent.MSPOINTER_TYPE_TOUCH||"touch";this._environmentSupportsTouch&&(o._addEventListener(this._contentDiv,"pointerdown",k,!1),o._addEventListener(this._contentDiv,"pointermove",j,!1),o._addEventListener(this._contentDiv,"pointerup",l,!1)),this._panningDivContainer.addEventListener("scroll",function(){m._scrollPosChanged()},!1),this._panningDiv.addEventListener("blur",function(){m._touchInteraction||m._fadeOutButtons()},!0),this._resizeHandlerBound=this._resizeHandler.bind(this),this._elementResizeInstrument=new s._ElementResizeInstrument,this._flipviewDiv.appendChild(this._elementResizeInstrument.element),this._elementResizeInstrument.addEventListener("resize",this._resizeHandlerBound),o._resizeNotifier.subscribe(this._flipviewDiv,this._resizeHandlerBound);var E=a.document.body.contains(this._flipviewDiv);E&&this._elementResizeInstrument.addedToDom(),o._addInsertedNotifier(this._flipviewDiv);var F=!0;this._flipviewDiv.addEventListener("WinJSNodeInserted",function(a){F?(F=!1,E||(m._elementResizeInstrument.addedToDom(),m._pageManager.resized())):m._pageManager.resized()},!1),this._flipviewDiv.addEventListener("keydown",function(a){if(!m._disposed){var b=!0;if(!m._isInteractive(a.target)){var c=o.Key,d=!1;if(m._isHorizontal)switch(a.keyCode){case c.leftArrow:!m._rtl&&m.currentPage>0?(m.previous(),d=!0):m._rtl&&m.currentPage<m._pageManager._cachedSize-1&&(m.next(),d=!0);break;case c.pageUp:m.currentPage>0&&(m.previous(),d=!0);break;case c.rightArrow:!m._rtl&&m.currentPage<m._pageManager._cachedSize-1?(m.next(),d=!0):m._rtl&&m.currentPage>0&&(m.previous(),d=!0);break;case c.pageDown:m.currentPage<m._pageManager._cachedSize-1&&(m.next(),d=!0);break;case c.upArrow:case c.downArrow:d=!0,b=!1}else switch(a.keyCode){case c.upArrow:case c.pageUp:m.currentPage>0&&(m.previous(),d=!0);break;case c.downArrow:case c.pageDown:m.currentPage<m._pageManager._cachedSize-1&&(m.next(),d=!0);break;case c.space:d=!0}switch(a.keyCode){case c.home:m.currentPage=0,d=!0;break;case c.end:m._pageManager._cachedSize>0&&(m.currentPage=m._pageManager._cachedSize-1),d=!0}if(d)return a.preventDefault(),b&&a.stopPropagation(),!0}}},!1),n=!0},_windowWheelHandler:function(a){if(!this._disposed){a=a.detail.originalEvent;var b=a.target&&(this._flipviewDiv.contains(a.target)||this._flipviewDiv===a.target),d=this,e=c._now(),f=this._avoidTrappingTime>e;(!b||f)&&(this._avoidTrappingTime=e+E),b&&f?(this._panningDivContainer.style.overflowX="hidden",this._panningDivContainer.style.overflowY="hidden",c._yieldForDomModification(function(){d._pageManager._ensureCentered(),d._isHorizontal?(d._panningDivContainer.style.overflowX=d._environmentSupportsTouch?"scroll":"hidden",d._panningDivContainer.style.overflowY="hidden"):(d._panningDivContainer.style.overflowY=d._environmentSupportsTouch?"scroll":"hidden",d._panningDivContainer.style.overflowX="hidden")})):b&&this._pageManager.simulateMouseWheelScroll(a)}},_isInteractive:function(a){if(a.parentNode)for(var b=a.parentNode.querySelectorAll(".win-interactive, .win-interactive *"),c=0,d=b.length;d>c;c++)if(b[c]===a)return!0;return!1},_resizeHandler:function(){g("WinJS.UI.FlipView:resize,StartTM"),this._pageManager.resized()},_refreshHandler:function(){var a=this._dataSourceAfterRefresh||this._dataSource,b=this._itemRendererAfterRefresh||this._itemRenderer,c=this._indexAfterRefresh||0;this._setDatasource(a,b,c),this._dataSourceAfterRefresh=null,this._itemRendererAfterRefresh=null,this._indexAfterRefresh=0,this._refreshTimer=!1},_refresh:function(){if(!this._refreshTimer){var a=this;this._refreshTimer=!0,l.schedule(function(){a._refreshTimer&&!a._disposed&&a._refreshHandler()},l.Priority.high,null,"WinJS.UI.FlipView._refreshHandler")}},_getItemRenderer:function(b){var c=null;if("function"==typeof b){var d=new k(function(){}),e=b(d);c=e.element?"object"==typeof e.element&&"function"==typeof e.element.then?function(c){var d=a.document.createElement("div");return d.className="win-template",n.markDisposable(d),{element:d,renderComplete:b(c).element.then(function(a){d.appendChild(a)})}}:b:function(c){var d=a.document.createElement("div");return d.className="win-template",n.markDisposable(d),{element:d,renderComplete:c.then(function(){return k.as(b(c)).then(function(a){d.appendChild(a)})})}}}else"object"==typeof b&&(c=b.renderItem);return c},_navigate:function(a,b){if(c.validation&&this._refreshTimer)throw new d("WinJS.UI.FlipView.NavigationDuringStateChange",K.navigationDuringStateChange);if(this._animating||(this._animatingForward=a),this._goForward=a,this._animating&&!this._cancelAnimation())return!1;var e=this,f=a?this._nextAnimation:this._prevAnimation,g=f?f:this._defaultAnimation.bind(this),h=function(a){e._completeNavigation(a)},i=this._pageManager.startAnimatedNavigation(a,b,h);if(i){this._animationsStarted();var j=i.outgoing.pageRoot,k=i.incoming.pageRoot;return this._contentDiv.appendChild(j),this._contentDiv.appendChild(k),this._completeNavigationPending=!0,g(j,k).then(function(){e._completeNavigationPending&&h(e._goForward)}).done(),!0}return!1},_cancelDefaultAnimation:function(a,b){a.style.opacity=0,b.style.animationName="",b.style.opacity=1},_cancelAnimation:function(){if(this._pageManager._navigationAnimationRecord&&this._pageManager._navigationAnimationRecord.completionCallback){var a=this._pageManager._navigationAnimationRecord.cancelAnimationCallback;if(a&&(a=a.bind(this)),this._pageManager._navigationAnimationRecord&&this._pageManager._navigationAnimationRecord.elementContainers){var b=this._pageManager._navigationAnimationRecord.elementContainers[0],c=this._pageManager._navigationAnimationRecord.elementContainers[1],d=b.pageRoot,e=c.pageRoot;return a&&a(d,e),this._pageManager._navigationAnimationRecord.completionCallback(this._animatingForward),!0}}return!1},_completeNavigation:function(a){if(!this._disposed){if(this._pageManager._resizing=!1,this._pageManager._navigationAnimationRecord&&this._pageManager._navigationAnimationRecord.elementContainers){var b=this._pageManager._navigationAnimationRecord.elementContainers[0],c=this._pageManager._navigationAnimationRecord.elementContainers[1],d=b.pageRoot,e=c.pageRoot;d.parentNode&&d.parentNode.removeChild(d),e.parentNode&&e.parentNode.removeChild(e),this._pageManager.endAnimatedNavigation(a,b,c),this._fadeOutButtons(),this._scrollPosChanged(),this._pageManager._ensureCentered(!0),this._animationsFinished()}this._completeNavigationPending=!1}},_completeJump:function(){if(!this._disposed){if(this._pageManager._resizing=!1,this._pageManager._navigationAnimationRecord&&this._pageManager._navigationAnimationRecord.elementContainers){var a=this._pageManager._navigationAnimationRecord.elementContainers[0],b=this._pageManager._navigationAnimationRecord.elementContainers[1],c=a.pageRoot,d=b.pageRoot;c.parentNode&&c.parentNode.removeChild(c),d.parentNode&&d.parentNode.removeChild(d),this._pageManager.endAnimatedJump(a,b),this._animationsFinished()}this._completeJumpPending=!1}},_setCurrentIndex:function(a){return this._pageManager.jumpToIndex(a)},_getCurrentIndex:function(){return this._pageManager.currentIndex()},_setDatasource:function(a,b,c){this._animating&&this._cancelAnimation();var d=0;void 0!==c&&(d=c),this._dataSource=a,this._itemRenderer=b;var e=this._itemsManager;this._itemsManager=q._createItemsManager(this._dataSource,this._itemRenderer,this._itemsManagerCallback,{ownerElement:this._flipviewDiv}),this._dataSource=this._itemsManager.dataSource;var f=this;this._dataSource.getCount().then(function(a){f._pageManager._cachedSize=a}),this._pageManager.setNewItemsManager(this._itemsManager,d),e&&e.release()},_fireDatasourceCountChangedEvent:function(){var b=this;l.schedule(function(){var c=a.document.createEvent("Event");c.initEvent(L.datasourceCountChangedEvent,!0,!0),g("WinJS.UI.FlipView:dataSourceCountChangedEvent,info"),b._flipviewDiv.dispatchEvent(c)},l.Priority.normal,null,"WinJS.UI.FlipView._dispatchDataSourceCountChangedEvent")},_scrollPosChanged:function(){this._disposed||this._pageManager.scrollPosChanged()},_axisAsString:function(){return this._isHorizontal?"horizontal":"vertical"},_setupOrientation:function(){if(this._isHorizontal){this._panningDivContainer.style.overflowX=this._environmentSupportsTouch?"scroll":"hidden",this._panningDivContainer.style.overflowY="hidden";var a="rtl"===o._getComputedStyle(this._flipviewDiv,null).direction;this._rtl=a,a?(this._prevButton.className=v+" "+y,this._nextButton.className=v+" "+x):(this._prevButton.className=v+" "+x,this._nextButton.className=v+" "+y),this._prevButton.innerHTML=a?G:F,this._nextButton.innerHTML=a?F:G}else this._panningDivContainer.style.overflowY=this._environmentSupportsTouch?"scroll":"hidden",this._panningDivContainer.style.overflowX="hidden",this._prevButton.className=v+" "+z,this._nextButton.className=v+" "+A,this._prevButton.innerHTML=H,this._nextButton.innerHTML=I;this._panningDivContainer.style.msOverflowStyle="none"},_fadeInButton:function(a,b){(this._mouseInViewport||b||!this._environmentSupportsTouch)&&("next"===a&&this._hasNextContent?(this._nextButtonAnimation&&(this._nextButtonAnimation.cancel(),this._nextButtonAnimation=null),this._nextButton.style.visibility="visible",this._nextButtonAnimation=this._fadeInFromCurrentValue(this._nextButton)):"prev"===a&&this._hasPrevContent&&(this._prevButtonAnimation&&(this._prevButtonAnimation.cancel(),this._prevButtonAnimation=null),this._prevButton.style.visibility="visible",this._prevButtonAnimation=this._fadeInFromCurrentValue(this._prevButton)))},_fadeOutButton:function(a){var b=this;return"next"===a?(this._nextButtonAnimation&&(this._nextButtonAnimation.cancel(),this._nextButtonAnimation=null),this._nextButtonAnimation=h.fadeOut(this._nextButton).then(function(){b._nextButton.style.visibility="hidden"}),this._nextButtonAnimation):(this._prevButtonAnimation&&(this._prevButtonAnimation.cancel(),this._prevButtonAnimation=null),this._prevButtonAnimation=h.fadeOut(this._prevButton).then(function(){b._prevButton.style.visibility="hidden"}),this._prevButtonAnimation)},_fadeOutButtons:function(a){if(this._environmentSupportsTouch){this._buttonFadePromise&&(this._buttonFadePromise.cancel(),this._buttonFadePromise=null);var b=this;this._buttonFadePromise=(a?k.wrap():k.timeout(i._animationTimeAdjustment(D))).then(function(){b._fadeOutButton("prev"),b._fadeOutButton("next"),b._buttonFadePromise=null})}},_animationsStarted:function(){this._animating=!0},_animationsFinished:function(){this._animating=!1},_defaultAnimation:function(a,b){var c={};b.style.left="0px",b.style.top="0px",b.style.opacity=0;var d=a.itemIndex>b.itemIndex?-J:J;c.left=(this._isHorizontal?this._rtl?-d:d:0)+"px",c.top=(this._isHorizontal?0:d)+"px";var e=h.fadeOut(a),f=h.enterContent(b,[c],{mechanism:"transition"});return k.join([e,f])},_fadeInFromCurrentValue:function(a){return i.executeTransition(a,{property:"opacity",delay:0,duration:167,timing:"linear",to:1})}},t);return b.Class.mix(L,e.createEventProperties(L.datasourceCountChangedEvent,L.pageVisibilityChangedEvent,L.pageSelectedEvent,L.pageCompletedEvent)),b.Class.mix(L,m.DOMEventMixin),L})})}),d("WinJS/Controls/ItemContainer",["exports","../Core/_Global","../Core/_Base","../Core/_BaseUtils","../Core/_ErrorFromName","../Core/_Events","../Core/_Log","../Core/_Resources","../Core/_WriteProfilerMark","../Promise","../Scheduler","../Utilities/_Control","../Utilities/_Dispose","../Utilities/_ElementUtilities","../Utilities/_Hoverable","../Utilities/_KeyboardBehavior","../Utilities/_UI","./ItemContainer/_Constants","./ItemContainer/_ItemEventsHandler"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s){"use strict";var t=f._createEventProperty,u={invoked:"invoked",selectionchanging:"selectionchanging",selectionchanged:"selectionchanged"};c.Namespace._moduleDefine(a,"WinJS.UI",{ItemContainer:c.Namespace._lazy(function(){var f={get duplicateConstruction(){return"Invalid argument: Controls may only be instantiated one time for each DOM element"},get swipeOrientationDeprecated(){return"Invalid configuration: swipeOrientation is deprecated. The control will default this property to 'none'"},get swipeBehaviorDeprecated(){return"Invalid configuration: swipeBehavior is deprecated. The control will default this property to 'none'"}},h=c.Class.define(function(c,d){function g(a,b,c){return{name:b?a:a.toLowerCase(),handler:function(b){i["_on"+a](b)},capture:c}}if(c=c||b.document.createElement("DIV"),this._id=c.id||n._uniqueID(c),this._writeProfilerMark("constructor,StartTM"),d=d||{},c.winControl)throw new e("WinJS.UI.ItemContainer.DuplicateConstruction",f.duplicateConstruction);c.winControl=this,this._element=c,n.addClass(c,"win-disposable"),this._selectionMode=q.SelectionMode.single,this._draggable=!1,this._pressedEntity={type:q.ObjectType.item,index:r._INVALID_INDEX},this.tapBehavior=q.TapBehavior.invokeOnly,n.addClass(this.element,h._ClassName.itemContainer+" "+r._containerClass),this._setupInternalTree(),this._selection=new a._SingleItemSelectionManager(c,this._itemBox),this._setTabIndex(),l.setOptions(this,d),this._mutationObserver=new n._MutationObserver(this._itemPropertyChange.bind(this)),this._mutationObserver.observe(c,{attributes:!0,attributeFilter:["aria-selected"]}),this._setAriaRole();var i=this;this.selectionDisabled||k.schedule(function(){i._setDirectionClass()},k.Priority.normal,null,"WinJS.UI.ItemContainer_async_initialize"),this._itemEventsHandler=new s._ItemEventsHandler(Object.create({containerFromElement:function(){return i.element},indexForItemElement:function(){return 1},indexForHeaderElement:function(){return r._INVALID_INDEX},itemBoxAtIndex:function(){return i._itemBox},itemAtIndex:function(){return i.element},headerAtIndex:function(){return null},containerAtIndex:function(){return i.element},isZombie:function(){return this._disposed},getItemPosition:function(){return i._getItemPosition()},rtl:function(){return i._rtl()},fireInvokeEvent:function(){i._fireInvokeEvent()},verifySelectionAllowed:function(){return i._verifySelectionAllowed()},changeFocus:function(){},selectRange:function(a,b){return i._selection.set({firstIndex:a,lastIndex:b})}},{pressedEntity:{get:function(){return i._pressedEntity},set:function(a){i._pressedEntity=a}},pressedElement:{enumerable:!0,set:function(a){i._pressedElement=a}},eventHandlerRoot:{enumerable:!0,get:function(){return i.element}},selectionMode:{enumerable:!0,get:function(){return i._selectionMode}},accessibleItemClass:{enumerable:!0,get:function(){return r._containerClass}},canvasProxy:{enumerable:!0,get:function(){return i._captureProxy}},tapBehavior:{enumerable:!0,get:function(){return i._tapBehavior}},draggable:{enumerable:!0,get:function(){return i._draggable}},selection:{enumerable:!0,get:function(){return i._selection}},customFootprintParent:{enumerable:!0,get:function(){return null}},skipPreventDefaultOnPointerDown:{enumerable:!0,get:function(){return!0}}}));var j=[g("PointerDown"),g("Click"),g("PointerUp"),g("PointerCancel"),g("LostPointerCapture"),g("ContextMenu"),g("MSHoldVisual",!0),g("FocusIn"),g("FocusOut"),g("DragStart"),g("DragEnd"),g("KeyDown")];j.forEach(function(a){n._addEventListener(i.element,a.name,a.handler,!!a.capture)}),this._writeProfilerMark("constructor,StopTM")},{element:{get:function(){return this._element}},draggable:{get:function(){return this._draggable},set:function(a){d.isPhone||this._draggable!==a&&(this._draggable=a,this._updateDraggableAttribute())}},selected:{get:function(){return this._selection.selected},set:function(a){this._selection.selected!==a&&(this._selection.selected=a)}},swipeOrientation:{get:function(){return"none"},set:function(a){n._deprecated(f.swipeOrientationDeprecated)}},tapBehavior:{get:function(){return this._tapBehavior},set:function(a){d.isPhone&&a===q.TapBehavior.directSelect||(this._tapBehavior=a,this._setAriaRole())}},swipeBehavior:{get:function(){return"none"},set:function(a){n._deprecated(f.swipeBehaviorDeprecated)}},selectionDisabled:{get:function(){return this._selectionMode===q.SelectionMode.none},set:function(a){a?this._selectionMode=q.SelectionMode.none:(this._setDirectionClass(),this._selectionMode=q.SelectionMode.single),this._setAriaRole()}},oninvoked:t(u.invoked),onselectionchanging:t(u.selectionchanging),onselectionchanged:t(u.selectionchanged),forceLayout:function(){this._forceLayout()},dispose:function(){this._disposed||(this._disposed=!0,this._itemEventsHandler.dispose(),m.disposeSubTree(this.element))},_onMSManipulationStateChanged:function(a){this._itemEventsHandler.onMSManipulationStateChanged(a)},_onPointerDown:function(a){this._itemEventsHandler.onPointerDown(a)},_onClick:function(a){this._itemEventsHandler.onClick(a)},_onPointerUp:function(a){n.hasClass(this._itemBox,r._itemFocusClass)&&this._onFocusOut(a),this._itemEventsHandler.onPointerUp(a)},_onPointerCancel:function(a){this._itemEventsHandler.onPointerCancel(a)},_onLostPointerCapture:function(a){this._itemEventsHandler.onLostPointerCapture(a)},_onContextMenu:function(a){this._itemEventsHandler.onContextMenu(a)},_onMSHoldVisual:function(a){this._itemEventsHandler.onMSHoldVisual(a)},_onFocusIn:function(){if(!this._itemBox.querySelector("."+r._itemFocusOutlineClass)&&p._keyboardSeenLast){n.addClass(this._itemBox,r._itemFocusClass);var a=b.document.createElement("div");a.className=r._itemFocusOutlineClass,this._itemBox.appendChild(a)}},_onFocusOut:function(){n.removeClass(this._itemBox,r._itemFocusClass);var a=this._itemBox.querySelector("."+r._itemFocusOutlineClass);a&&a.parentNode.removeChild(a)},_onDragStart:function(a){if(this._pressedElement&&this._itemEventsHandler._isInteractive(this._pressedElement))a.preventDefault();else{this._dragging=!0;var b=this;if(a.dataTransfer.setData("text",""),a.dataTransfer.setDragImage){var c=this.element.getBoundingClientRect();a.dataTransfer.setDragImage(this.element,a.clientX-c.left,a.clientY-c.top)}d._yieldForDomModification(function(){b._dragging&&n.addClass(b._itemBox,r._dragSourceClass)})}},_onDragEnd:function(){this._dragging=!1,n.removeClass(this._itemBox,r._dragSourceClass),this._itemEventsHandler.resetPointerDownState()},_onKeyDown:function(a){if(!this._itemEventsHandler._isInteractive(a.target)){var b=n.Key,c=a.keyCode,d=!1;if(a.ctrlKey||c!==b.enter)a.ctrlKey&&c===b.enter||c===b.space?this.selectionDisabled||(this.selected=!this.selected,d=n._setActive(this.element)):c===b.escape&&this.selected&&(this.selected=!1,d=!0);else{var e=this._verifySelectionAllowed();e.canTapSelect&&(this.selected=!this.selected),this._fireInvokeEvent(),d=!0}d&&(a.stopPropagation(),a.preventDefault())}},_setTabIndex:function(){var a=this.element.getAttribute("tabindex");a||this.element.setAttribute("tabindex","0")},_rtl:function(){return"boolean"!=typeof this._cachedRTL&&(this._cachedRTL="rtl"===n._getComputedStyle(this.element,null).direction),this._cachedRTL},_setDirectionClass:function(){n[this._rtl()?"addClass":"removeClass"](this.element,r._rtlListViewClass)},_forceLayout:function(){this._cachedRTL="rtl"===n._getComputedStyle(this.element,null).direction,this._setDirectionClass()},_getItemPosition:function(){var a=this.element;return a?j.wrap({left:this._rtl()?a.offsetParent.offsetWidth-a.offsetLeft-a.offsetWidth:a.offsetLeft,top:a.offsetTop,totalWidth:n.getTotalWidth(a),totalHeight:n.getTotalHeight(a),contentWidth:n.getContentWidth(a),contentHeight:n.getContentHeight(a)}):j.cancel},_itemPropertyChange:function(a){if(!this._disposed){var b=a[0].target,c="true"===b.getAttribute("aria-selected");c!==n._isSelectionRendered(this._itemBox)&&(this.selectionDisabled?n._setAttribute(b,"aria-selected",!c):(this.selected=c,c!==this.selected&&n._setAttribute(b,"aria-selected",!c)))}},_updateDraggableAttribute:function(){this._itemBox.setAttribute("draggable",this._draggable)},_verifySelectionAllowed:function(){if(this._selectionMode!==q.SelectionMode.none&&this._tapBehavior===q.TapBehavior.toggleSelect){var a=this._selection.fireSelectionChanging();return{canSelect:a,canTapSelect:a&&this._tapBehavior===q.TapBehavior.toggleSelect}}return{canSelect:!1,canTapSelect:!1}},_setupInternalTree:function(){var a=b.document.createElement("div");a.className=r._itemClass,this._captureProxy=b.document.createElement("div"),this._itemBox=b.document.createElement("div"),this._itemBox.className=r._itemBoxClass;for(var c=this.element.firstChild;c;){var d=c.nextSibling;a.appendChild(c),c=d}this.element.appendChild(this._itemBox),this._itemBox.appendChild(a),this.element.appendChild(this._captureProxy)},_fireInvokeEvent:function(){if(this.tapBehavior!==q.TapBehavior.none){var a=b.document.createEvent("CustomEvent");a.initCustomEvent(u.invoked,!0,!1,{}),this.element.dispatchEvent(a)}},_setAriaRole:function(){if(!this.element.getAttribute("role")||this._usingDefaultItemRole){this._usingDefaultItemRole=!0;var a;a=this.tapBehavior===q.TapBehavior.none&&this.selectionDisabled?"listitem":"option",n._setAttribute(this.element,"role",a)}},_writeProfilerMark:function(a){var b="WinJS.UI.ItemContainer:"+this._id+":"+a;i(b),g.log&&g.log(b,null,"itemcontainerprofiler")}},{_ClassName:{itemContainer:"win-itemcontainer",vertical:"win-vertical",horizontal:"win-horizontal"}});return c.Class.mix(h,l.DOMEventMixin),h}),_SingleItemSelectionManager:c.Namespace._lazy(function(){return c.Class.define(function(a,b){this._selected=!1,this._element=a,this._itemBox=b},{selected:{get:function(){return this._selected},set:function(a){a=!!a,this._selected!==a&&this.fireSelectionChanging()&&(this._selected=a,s._ItemEventsHandler.renderSelection(this._itemBox,this._element,a,!0,this._element),this.fireSelectionChanged())}},count:function(){return this._selected?1:0},getIndices:function(){},getItems:function(){},getRanges:function(){},isEverything:function(){return!1},set:function(){this.selected=!0},clear:function(){this.selected=!1},add:function(){this.selected=!0},remove:function(){this.selected=!1},selectAll:function(){},fireSelectionChanging:function(){var a=b.document.createEvent("CustomEvent");return a.initCustomEvent(u.selectionchanging,!0,!0,{}),this._element.dispatchEvent(a)},fireSelectionChanged:function(){var a=b.document.createEvent("CustomEvent");a.initCustomEvent(u.selectionchanged,!0,!1,{}),this._element.dispatchEvent(a)},_isIncluded:function(){return this._selected},_getFocused:function(){return{type:q.ObjectType.item,index:r._INVALID_INDEX}}})})})}),d("WinJS/Controls/Repeater",["exports","../Core/_Global","../Core/_Base","../Core/_ErrorFromName","../Core/_Events","../Core/_Resources","../Core/_WriteProfilerMark","../BindingList","../BindingTemplate","../Promise","../Utilities/_Control","../Utilities/_Dispose","../Utilities/_ElementUtilities","../Utilities/_Hoverable"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n){"use strict";c.Namespace._moduleDefine(a,"WinJS.UI",{Repeater:c.Namespace._lazy(function(){function a(a){var c=b.document.createElement("div");return c.textContent=JSON.stringify(a),c}var f="itemsloaded",n="itemchanging",o="itemchanged",p="iteminserting",q="iteminserted",r="itemmoving",s="itemmoved",t="itemremoving",u="itemremoved",v="itemsreloading",w="itemsreloaded",x=e._createEventProperty,y={get duplicateConstruction(){return"Invalid argument: Controls may only be instantiated one time for each DOM element"},get asynchronousRender(){return"Top level items must render synchronously"},get repeaterReentrancy(){return"Cannot modify Repeater data until Repeater has commited previous modification."}},z=c.Class.define(function(a,c){if(a&&a.winControl)throw new d("WinJS.UI.Repeater.DuplicateConstruction",y.duplicateConstruction);this._element=a||b.document.createElement("div"),this._id=this._element.id||m._uniqueID(this._element),this._writeProfilerMark("constructor,StartTM"),c=c||{},m.addClass(this._element,"win-repeater win-disposable"),this._render=null,this._modifying=!1,this._disposed=!1,this._element.winControl=this,this._dataListeners={itemchanged:this._dataItemChangedHandler.bind(this),iteminserted:this._dataItemInsertedHandler.bind(this),itemmoved:this._dataItemMovedHandler.bind(this),itemremoved:this._dataItemRemovedHandler.bind(this),reload:this._dataReloadHandler.bind(this)};var e=this._extractInlineTemplate();this._initializing=!0,this.template=c.template||e,this.data=c.data,this._initializing=!1,k._setOptions(this,c,!0),this._repeatedDOM=[],this._renderAllItems(),this.dispatchEvent(f,{}),this._writeProfilerMark("constructor,StopTM")},{element:{get:function(){return this._element}},data:{get:function(){return this._data},set:function(a){this._writeProfilerMark("data.set,StartTM"),
this._data&&this._removeDataListeners(),this._data=a||new h.List,this._addDataListeners(),this._initializing||(this._reloadRepeater(!0),this.dispatchEvent(f,{})),this._writeProfilerMark("data.set,StopTM")}},template:{get:function(){return this._template},set:function(b){this._writeProfilerMark("template.set,StartTM"),this._template=b||a,this._render=m._syncRenderer(this._template,this.element.tagName),this._initializing||(this._reloadRepeater(!0),this.dispatchEvent(f,{})),this._writeProfilerMark("template.set,StopTM")}},length:{get:function(){return this._repeatedDOM.length}},elementFromIndex:function(a){return this._repeatedDOM[a]},dispose:function(){if(!this._disposed){this._disposed=!0,this._removeDataListeners(),this._data=null,this._template=null;for(var a=0,b=this._repeatedDOM.length;b>a;a++)l._disposeElement(this._repeatedDOM[a])}},onitemsloaded:x(f),onitemchanging:x(n),onitemchanged:x(o),oniteminserting:x(p),oniteminserted:x(q),onitemmoving:x(r),onitemmoved:x(s),onitemremoving:x(t),onitemremoved:x(u),onitemsreloading:x(v),onitemsreloaded:x(w),_extractInlineTemplate:function(){if(this._element.firstElementChild){for(var a=b.document.createElement(this._element.tagName);this._element.firstElementChild;)a.appendChild(this._element.firstElementChild);return new i.Template(a,{extractChild:!0})}},_renderAllItems:function(){for(var a=b.document.createDocumentFragment(),c=0,e=this._data.length;e>c;c++){var f=this._render(this._data.getAt(c));if(!f)throw new d("WinJS.UI.Repeater.AsynchronousRender",y.asynchronousRender);a.appendChild(f),this._repeatedDOM.push(f)}this._element.appendChild(a)},_reloadRepeater:function(a){this._unloadRepeatedDOM(a),this._repeatedDOM=[],this._renderAllItems()},_unloadRepeatedDOM:function(a){for(var b=0,c=this._repeatedDOM.length;c>b;b++){var d=this._repeatedDOM[b];a&&l._disposeElement(d),d.parentElement===this._element&&this._element.removeChild(d)}},_addDataListeners:function(){Object.keys(this._dataListeners).forEach(function(a){this._data.addEventListener(a,this._dataListeners[a],!1)}.bind(this))},_beginModification:function(){if(this._modifying)throw new d("WinJS.UI.Repeater.RepeaterModificationReentrancy",y.repeaterReentrancy);this._modifying=!0},_endModification:function(){this._modifying=!1},_removeDataListeners:function(){Object.keys(this._dataListeners).forEach(function(a){this._data.removeEventListener(a,this._dataListeners[a],!1)}.bind(this))},_dataItemChangedHandler:function(a){this._beginModification();var b,c=this._element,e=a.detail.index,f=this._render(a.detail.newValue);if(!f)throw new d("WinJS.UI.Repeater.AsynchronousRender",y.asynchronousRender);this._repeatedDOM[e]&&(a.detail.oldElement=this._repeatedDOM[e]),a.detail.newElement=f,a.detail.setPromise=function(a){b=a},this._writeProfilerMark(n+",info"),this.dispatchEvent(n,a.detail);var g=null;e<this._repeatedDOM.length?(g=this._repeatedDOM[e],c.replaceChild(f,g),this._repeatedDOM[e]=f):(c.appendChild(f),this._repeatedDOM.push(f)),this._endModification(),this._writeProfilerMark(o+",info"),this.dispatchEvent(o,a.detail),g&&j.as(b).done(function(){l._disposeElement(g)}.bind(this))},_dataItemInsertedHandler:function(a){this._beginModification();var b=a.detail.index,c=this._render(a.detail.value);if(!c)throw new d("WinJS.UI.Repeater.AsynchronousRender",y.asynchronousRender);var e=this._element;if(a.detail.affectedElement=c,this._writeProfilerMark(p+",info"),this.dispatchEvent(p,a.detail),b<this._repeatedDOM.length){var f=this._repeatedDOM[b];e.insertBefore(c,f)}else e.appendChild(c);this._repeatedDOM.splice(b,0,c),this._endModification(),this._writeProfilerMark(q+",info"),this.dispatchEvent(q,a.detail)},_dataItemMovedHandler:function(a){this._beginModification();var b=this._repeatedDOM[a.detail.oldIndex];if(a.detail.affectedElement=b,this._writeProfilerMark(r+",info"),this.dispatchEvent(r,a.detail),this._repeatedDOM.splice(a.detail.oldIndex,1)[0],b.parentNode.removeChild(b),a.detail.newIndex<this._data.length-1){var c=this._repeatedDOM[a.detail.newIndex];this._element.insertBefore(b,c),this._repeatedDOM.splice(a.detail.newIndex,0,b)}else this._repeatedDOM.push(b),this._element.appendChild(b);this._endModification(),this._writeProfilerMark(s+",info"),this.dispatchEvent(s,a.detail)},_dataItemRemovedHandler:function(a){this._beginModification();var b,c=this._repeatedDOM[a.detail.index],d={affectedElement:c,index:a.detail.index,item:a.detail.item};d.setPromise=function(a){b=a},this._writeProfilerMark(t+",info"),this.dispatchEvent(t,d),c.parentNode.removeChild(c),this._repeatedDOM.splice(a.detail.index,1),this._endModification(),this._writeProfilerMark(u+",info"),this.dispatchEvent(u,d),j.as(b).done(function(){l._disposeElement(c)}.bind(this))},_dataReloadHandler:function(){this._beginModification();var a,b=this._repeatedDOM.slice(0),c={affectedElements:b};c.setPromise=function(b){a=b},this._writeProfilerMark(v+",info"),this.dispatchEvent(v,c),this._reloadRepeater(!1);var d=this._repeatedDOM.slice(0);this._endModification(),this._writeProfilerMark(w+",info"),this.dispatchEvent(w,{affectedElements:d}),j.as(a).done(function(){for(var a=0,c=b.length;c>a;a++)l._disposeElement(b[a])}.bind(this))},_writeProfilerMark:function(a){g("WinJS.UI.Repeater:"+this._id+":"+a)}},{isDeclarativeControlContainer:!0});return c.Class.mix(z,k.DOMEventMixin),z})})}),d("require-style!less/styles-datetimepicker",[],function(){}),d("WinJS/Controls/DatePicker",["../Core/_Global","../Core/_WinRT","../Core/_Base","../Core/_BaseUtils","../Core/_Events","../Core/_Resources","../Utilities/_Control","../Utilities/_ElementUtilities","../Utilities/_Hoverable","../Utilities/_Select","require-style!less/styles-datetimepicker"],function(a,b,c,d,e,f,g,h,i,j){"use strict";c.Namespace.define("WinJS.UI",{DatePicker:c.Namespace._lazy(function(){function d(a,c,d){var e=b.Windows.Globalization.DateTimeFormatting;a=a?a:d;var f=new e.DateTimeFormatter(a);return c?new e.DateTimeFormatter(a,f.languages,f.geographicRegion,c,f.clock):f}function i(a,b,c){var e=t[a];e||(e=t[a]={});var f=e[b];f||(f=e[b]={});var g=f[c];return g||(g=f[c]={},g.formatter=d(a,b,c),g.years={}),g}function k(a,b,c,d,e,f){var g=i(a,b,c),h=g.years[f.year+"-"+f.era];return h||(h=g.formatter.format(f.getDateTime()),g.years[f.year+"-"+f.era]=h),h}function l(a,b,c,d){var e=i(a,b,c);return e.formatter.format(d.getDateTime())}function m(a,b,c,d){var e=i(a,b,c);return e.formatter.format(d.getDateTime())}function n(a){var c=b.Windows.Globalization,d=new c.Calendar;return a?new c.Calendar(d.languages,a,d.getClock()):d}function o(a,b){var c=0;if(a.era===b.era)c=b.year-a.year;else for(;a.era!==b.era||a.year!==b.year;)c++,a.addYears(1);return c}var p="day",q="{month.full}",r="year.full",s={get ariaLabel(){return f._getWinJSString("ui/datePicker").value},get selectDay(){return f._getWinJSString("ui/selectDay").value},get selectMonth(){return f._getWinJSString("ui/selectMonth").value},get selectYear(){return f._getWinJSString("ui/selectYear").value}},t={},u=c.Class.define(function(b,c){this._currentDate=new Date,this._minYear=this._currentDate.getFullYear()-100,this._maxYear=this._currentDate.getFullYear()+100,this._datePatterns={date:null,month:null,year:null},b=b||a.document.createElement("div"),h.addClass(b,"win-disposable"),b.winControl=this;var d=b.getAttribute("aria-label");d||b.setAttribute("aria-label",s.ariaLabel),this._init(b),g.setOptions(this,c)},{_information:null,_currentDate:null,_calendar:null,_disabled:!1,_dateElement:null,_dateControl:null,_monthElement:null,_monthControl:null,_minYear:null,_maxYear:null,_yearElement:null,_yearControl:null,_datePatterns:{date:null,month:null,year:null},_addAccessibilityAttributes:function(){this._domElement.setAttribute("role","group"),this._dateElement.setAttribute("aria-label",s.selectDay),this._monthElement.setAttribute("aria-label",s.selectMonth),this._yearElement.setAttribute("aria-label",s.selectYear)},_addControlsInOrder:function(){var a=this._domElement,b=this,c=0;b._information.order.forEach(function(d){switch(d){case"month":a.appendChild(b._monthElement),h.addClass(b._monthElement,"win-order"+c++);break;case"date":a.appendChild(b._dateElement),h.addClass(b._dateElement,"win-order"+c++);break;case"year":a.appendChild(b._yearElement),h.addClass(b._yearElement,"win-order"+c++)}})},_createControlElements:function(){this._monthElement=a.document.createElement("select"),this._monthElement.className="win-datepicker-month win-dropdown",this._dateElement=a.document.createElement("select"),this._dateElement.className="win-datepicker-date win-dropdown",this._yearElement=a.document.createElement("select"),this._yearElement.className="win-datepicker-year win-dropdown"},_createControls:function(){var a=this._information,b=a.getIndex(this.current);a.forceLanguage&&(this._domElement.setAttribute("lang",a.forceLanguage),this._domElement.setAttribute("dir",a.isRTL?"rtl":"ltr")),this._yearControl=new j._Select(this._yearElement,{dataSource:this._information.years,disabled:this.disabled,index:b.year}),this._monthControl=new j._Select(this._monthElement,{dataSource:this._information.months(b.year),disabled:this.disabled,index:b.month}),this._dateControl=new j._Select(this._dateElement,{dataSource:this._information.dates(b.year,b.month),disabled:this.disabled,index:b.date}),this._wireupEvents()},dispose:function(){},calendar:{get:function(){return this._calendar},set:function(a){this._calendar=a,this._setElement(this._domElement)}},current:{get:function(){var a=this._currentDate,b=a.getFullYear();return new Date(Math.max(Math.min(this.maxYear,b),this.minYear),a.getMonth(),a.getDate(),12,0,0,0)},set:function(a){var b;"string"==typeof a?(b=new Date(Date.parse(a)),b.setHours(12,0,0,0)):b=a;var c=this._currentDate;c!==b&&(this._currentDate=b,this._updateDisplay())}},disabled:{get:function(){return this._disabled},set:function(a){this._disabled!==a&&(this._disabled=a,this._yearControl&&(this._monthControl.setDisabled(a),this._dateControl.setDisabled(a),this._yearControl.setDisabled(a)))}},datePattern:{get:function(){return this._datePatterns.date},set:function(a){this._datePatterns.date!==a&&(this._datePatterns.date=a,this._init())}},element:{get:function(){return this._domElement}},_setElement:function(a){this._domElement=this._domElement||a,this._domElement&&(h.empty(this._domElement),h.addClass(this._domElement,"win-datepicker"),this._updateInformation(),this._createControlElements(),this._addControlsInOrder(),this._createControls(),this._addAccessibilityAttributes())},minYear:{get:function(){return this._information.getDate({year:0,month:0,date:0}).getFullYear()},set:function(a){this._minYear!==a&&(this._minYear=a,a>this._maxYear&&(this._maxYear=a),this._updateInformation(),this._yearControl&&(this._yearControl.dataSource=this._information.years),this._updateDisplay())}},maxYear:{get:function(){var a={year:this._information.years.getLength()-1};return a.month=this._information.months(a.year).getLength()-1,a.date=this._information.dates(a.year,a.month).getLength()-1,this._information.getDate(a).getFullYear()},set:function(a){this._maxYear!==a&&(this._maxYear=a,a<this._minYear&&(this._minYear=a),this._updateInformation(),this._yearControl&&(this._yearControl.dataSource=this._information.years),this._updateDisplay())}},monthPattern:{get:function(){return this._datePatterns.month},set:function(a){this._datePatterns.month!==a&&(this._datePatterns.month=a,this._init())}},_updateInformation:function(){var a=new Date(this._minYear,0,1,12,0,0),b=new Date(this._maxYear,11,31,12,0,0);a.setFullYear(this._minYear),b.setFullYear(this._maxYear),this._information=u.getInformation(a,b,this._calendar,this._datePatterns)},_init:function(a){this._setElement(a)},_updateDisplay:function(){if(this._domElement&&this._yearControl){var a=this._information.getIndex(this.current);this._yearControl.index=a.year,this._monthControl.dataSource=this._information.months(a.year),this._monthControl.index=a.month,this._dateControl.dataSource=this._information.dates(a.year,a.month),this._dateControl.index=a.date}},_wireupEvents:function(){function a(){b._currentDate=b._information.getDate({year:b._yearControl.index,month:b._monthControl.index,date:b._dateControl.index},b._currentDate);var a=b._information.getIndex(b._currentDate);b._monthControl.dataSource=b._information.months(a.year),b._monthControl.index=a.month,b._dateControl.dataSource=b._information.dates(a.year,a.month),b._dateControl.index=a.date}var b=this;this._dateElement.addEventListener("change",a,!1),this._monthElement.addEventListener("change",a,!1),this._yearElement.addEventListener("change",a,!1)},yearPattern:{get:function(){return this._datePatterns.year},set:function(a){this._datePatterns.year!==a&&(this._datePatterns.year=a,this._init())}}},{_getInformationWinRT:function(a,b,c,d){function e(a){return new Date(Math.min(new Date(Math.max(j,a)),s))}d=d||{date:p,month:q,year:r};var f=n(c),g=n(c),h=n(c);f.setToMin();var j=f.getDateTime();f.setToMax();var s=f.getDateTime();f.hour=12,a=e(a),b=e(b),f.setDateTime(b);var t={year:f.year,era:f.era};f.setDateTime(a);var u=0;u=o(f,t)+1;var v=i("day month.full year",c).formatter,w=v.patterns[0],x=8207===w.charCodeAt(0),y=["date","month","year"],z={month:w.indexOf("{month"),date:w.indexOf("{day"),year:w.indexOf("{year")};y.sort(function(a,b){return z[a]<z[b]?-1:z[a]>z[b]?1:0});var A=function(){return{getLength:function(){return u},getValue:function(b){return f.setDateTime(a),f.addYears(b),k(d.year,c,r,d,y,f)}}}(),B=function(b){return g.setDateTime(a),g.addYears(b),{getLength:function(){return g.numberOfMonthsInThisYear},getValue:function(a){return g.month=g.firstMonthInThisYear,g.addMonths(a),l(d.month,c,q,g)}}},C=function(b,e){return h.setDateTime(a),h.addYears(b),h.month=h.firstMonthInThisYear,h.addMonths(e),h.day=h.firstDayInThisMonth,{getLength:function(){return h.numberOfDaysInThisMonth},getValue:function(a){return h.day=h.firstDayInThisMonth,h.addDays(a),m(d.date,c,p,h)}}};return{isRTL:x,forceLanguage:v.resolvedLanguage,order:y,getDate:function(b,c){var d;c&&(f.setDateTime(c),d={year:f.year,month:f.month,day:f.day});var e=f;e.setDateTime(a),e.addYears(b.year);var g;e.firstMonthInThisYear>e.lastMonthInThisYear?(g=b.month+e.firstMonthInThisYear>e.numberOfMonthsInThisYear?b.month+e.firstMonthInThisYear-e.numberOfMonthsInThisYear:b.month+e.firstMonthInThisYear,d&&d.year!==e.year&&(g=Math.max(Math.min(d.month,e.numberOfMonthsInThisYear),1))):g=d&&d.year!==e.year?Math.max(Math.min(d.month,e.firstMonthInThisYear+e.numberOfMonthsInThisYear-1),e.firstMonthInThisYear):Math.max(Math.min(b.month+e.firstMonthInThisYear,e.firstMonthInThisYear+e.numberOfMonthsInThisYear-1),e.firstMonthInThisYear),e.month=g;var h=Math.max(Math.min(b.date+e.firstDayInThisMonth,e.firstDayInThisMonth+e.numberOfDaysInThisMonth-1),e.firstDayInThisMonth);return!d||d.year===e.year&&d.month===e.month||(h=Math.max(Math.min(d.day,e.firstDayInThisMonth+e.numberOfDaysInThisMonth-1),e.firstDayInThisMonth)),e.day=e.firstDayInThisMonth,e.addDays(h-e.firstDayInThisMonth),e.getDateTime()},getIndex:function(b){var c=e(b);f.setDateTime(c);var d={year:f.year,era:f.era},g=0;f.setDateTime(a),f.month=1,g=o(f,d),f.setDateTime(c);var h=f.month-f.firstMonthInThisYear;0>h&&(h=f.month-f.firstMonthInThisYear+f.numberOfMonthsInThisYear);var i=f.day-f.firstDayInThisMonth,j={year:g,month:h,date:i};return j},years:A,months:B,dates:C}},_getInformationJS:function(a,b){var c=a.getFullYear(),d=b.getFullYear(),e={getLength:function(){return Math.max(0,d-c+1)},getValue:function(a){return c+a}},f=["January","February","March","April","May","June","July","August","September","October","November","December"],g=function(){return{getLength:function(){return f.length},getValue:function(a){return f[a]},getMonthNumber:function(a){return Math.min(a,f.length-1)}}},h=function(a,b){var c=new Date,d=e.getValue(a),f=b+1;c.setFullYear(d,f,0);var g=c.getDate();return{getLength:function(){return g},getValue:function(a){return""+(a+1)},getDateNumber:function(a){return Math.min(a+1,g)}}};return{order:["month","date","year"],getDate:function(a){return new Date(e.getValue(a.year),g(a.year).getMonthNumber(a.month),h(a.year,a.month).getDateNumber(a.date),12,0)},getIndex:function(a){var b=0,d=a.getFullYear();b=c>d?0:d>this.maxYear?e.getLength()-1:a.getFullYear()-c;var f=Math.min(a.getMonth(),g(b).getLength()),i=Math.min(a.getDate()-1,h(b,f).getLength());return{year:b,month:f,date:i}},years:e,months:g,dates:h}}});return b.Windows.Globalization.Calendar&&b.Windows.Globalization.DateTimeFormatting?u.getInformation=u._getInformationWinRT:u.getInformation=u._getInformationJS,c.Class.mix(u,e.createEventProperties("change")),c.Class.mix(u,g.DOMEventMixin),u})})}),d("WinJS/Controls/TimePicker",["../Core/_Global","../Core/_WinRT","../Core/_Base","../Core/_BaseUtils","../Core/_Events","../Core/_Resources","../Utilities/_Control","../Utilities/_ElementUtilities","../Utilities/_Hoverable","../Utilities/_Select","require-style!less/styles-datetimepicker"],function(a,b,c,d,e,f,g,h,i,j){"use strict";c.Namespace.define("WinJS.UI",{TimePicker:c.Namespace._lazy(function(){var d="{minute.integer(2)}",i="{hour.integer(1)}",k="{period.abbreviated(2)}",l={get ariaLabel(){return f._getWinJSString("ui/timePicker").value},get selectHour(){return f._getWinJSString("ui/selectHour").value},get selectMinute(){return f._getWinJSString("ui/selectMinute").value},get selectAMPM(){return f._getWinJSString("ui/selectAMPM").value}},m=function(a,b){return a.getHours()===b.getHours()&&a.getMinutes()===b.getMinutes()},n=c.Class.define(function(b,c){this._currentTime=n._sentinelDate(),b=b||a.document.createElement("div"),h.addClass(b,"win-disposable"),b.winControl=this;var d=b.getAttribute("aria-label");d||b.setAttribute("aria-label",l.ariaLabel),this._timePatterns={minute:null,hour:null,period:null},this._init(b),g.setOptions(this,c)},{_currentTime:null,_clock:null,_disabled:!1,_hourElement:null,_hourControl:null,_minuteElement:null,_minuteControl:null,_ampmElement:null,_ampmControl:null,_minuteIncrement:1,_timePatterns:{minute:null,hour:null,period:null},_information:null,_addAccessibilityAttributes:function(){this._domElement.setAttribute("role","group"),this._hourElement.setAttribute("aria-label",l.selectHour),this._minuteElement.setAttribute("aria-label",l.selectMinute),this._ampmElement&&this._ampmElement.setAttribute("aria-label",l.selectAMPM)},_addControlsInOrder:function(a){var b=this;a.order.forEach(function(a,c){switch(a){case"hour":b._domElement.appendChild(b._hourElement),h.addClass(b._hourElement,"win-order"+c);break;case"minute":b._domElement.appendChild(b._minuteElement),h.addClass(b._minuteElement,"win-order"+c);break;case"period":b._ampmElement&&(b._domElement.appendChild(b._ampmElement),h.addClass(b._ampmElement,"win-order"+c))}})},dispose:function(){},clock:{get:function(){return this._clock},set:function(a){this._clock!==a&&(this._clock=a,this._init())}},current:{get:function(){var a=this._currentTime;if(a){var b=n._sentinelDate();return b.setHours(a.getHours()),b.setMinutes(this._getMinutesIndex(a)*this.minuteIncrement),b.setSeconds(0),b.setMilliseconds(0),b}return a},set:function(a){var b;"string"==typeof a?(b=n._sentinelDate(),b.setTime(Date.parse(b.toDateString()+" "+a))):(b=n._sentinelDate(),b.setHours(a.getHours()),b.setMinutes(a.getMinutes()));var c=this._currentTime;m(c,b)||(this._currentTime=b,this._updateDisplay())}},disabled:{get:function(){return this._disabled},set:function(a){this._disabled!==a&&(this._disabled=a,this._hourControl&&(this._hourControl.setDisabled(a),this._minuteControl.setDisabled(a)),this._ampmControl&&this._ampmControl.setDisabled(a))}},element:{get:function(){return this._domElement}},_init:function(a){this._setElement(a),this._updateDisplay()},hourPattern:{get:function(){return this._timePatterns.hour.pattern},set:function(a){this._timePatterns.hour!==a&&(this._timePatterns.hour=a,this._init())}},_getHoursAmpm:function(a){var b=a.getHours();return this._ampmElement?0===b?{hours:12,ampm:0}:12>b?{hours:b,ampm:0}:{hours:b-12,ampm:1}:{hours:b}},_getHoursIndex:function(a){return this._ampmElement&&12===a?0:a},_getMinutesIndex:function(a){return parseInt(a.getMinutes()/this.minuteIncrement)},minuteIncrement:{get:function(){return Math.max(1,Math.abs(0|this._minuteIncrement)%60)},set:function(a){this._minuteIncrement!==a&&(this._minuteIncrement=a,this._init())}},minutePattern:{get:function(){return this._timePatterns.minute.pattern},set:function(a){this._timePatterns.minute!==a&&(this._timePatterns.minute=a,this._init())}},periodPattern:{get:function(){return this._timePatterns.period.pattern},set:function(a){this._timePatterns.period!==a&&(this._timePatterns.period=a,this._init())}},_setElement:function(b){if(this._domElement=this._domElement||b,this._domElement){var c=n.getInformation(this.clock,this.minuteIncrement,this._timePatterns);this._information=c,c.forceLanguage&&(this._domElement.setAttribute("lang",c.forceLanguage),this._domElement.setAttribute("dir",c.isRTL?"rtl":"ltr")),h.empty(this._domElement),h.addClass(this._domElement,"win-timepicker"),this._hourElement=a.document.createElement("select"),h.addClass(this._hourElement,"win-timepicker-hour win-dropdown"),this._minuteElement=a.document.createElement("select"),h.addClass(this._minuteElement,"win-timepicker-minute win-dropdown"),this._ampmElement=null,"12HourClock"===c.clock&&(this._ampmElement=a.document.createElement("select"),h.addClass(this._ampmElement,"win-timepicker-period win-dropdown")),this._addControlsInOrder(c);var d=this._getHoursAmpm(this.current);this._hourControl=new j._Select(this._hourElement,{dataSource:this._getInfoHours(),disabled:this.disabled,index:this._getHoursIndex(d.hours)}),this._minuteControl=new j._Select(this._minuteElement,{dataSource:c.minutes,disabled:this.disabled,index:this._getMinutesIndex(this.current)}),this._ampmControl=null,this._ampmElement&&(this._ampmControl=new j._Select(this._ampmElement,{dataSource:c.periods,disabled:this.disabled,index:d.ampm})),this._wireupEvents(),this._updateValues(),this._addAccessibilityAttributes()}},_getInfoHours:function(){return this._information.hours},_updateLayout:function(){this._domElement&&this._updateValues()},_updateValues:function(){if(this._hourControl){var a=this._getHoursAmpm(this.current);this._ampmControl&&(this._ampmControl.index=a.ampm),this._hourControl.index=this._getHoursIndex(a.hours),this._minuteControl.index=this._getMinutesIndex(this.current)}},_updateDisplay:function(){var a=this._getHoursAmpm(this.current);this._ampmControl&&(this._ampmControl.index=a.ampm),this._hourControl&&(this._hourControl.index=this._getHoursIndex(a.hours),this._minuteControl.index=this._getMinutesIndex(this.current))},_wireupEvents:function(){var a=this,b=function(){var b=a._hourControl.index;return a._ampmElement&&1===a._ampmControl.index&&12!==b&&(b+=12),b},c=function(){var c=b();a._currentTime.setHours(c),a._currentTime.setMinutes(a._minuteControl.index*a.minuteIncrement)};this._hourElement.addEventListener("change",c,!1),this._minuteElement.addEventListener("change",c,!1),this._ampmElement&&this._ampmElement.addEventListener("change",c,!1)}},{_sentinelDate:function(){var a=new Date;return new Date(2011,6,15,a.getHours(),a.getMinutes())},_getInformationWinRT:function(a,c,e){var f=function(c,d){var e=b.Windows.Globalization.DateTimeFormatting;c=c?c:d;var f=new e.DateTimeFormatter(c);return a&&(f=e.DateTimeFormatter(c,f.languages,f.geographicRegion,f.calendar,a)),f},g=b.Windows.Globalization,h=new g.Calendar;a&&(h=new g.Calendar(h.languages,h.getCalendarSystem(),a)),h.setDateTime(n._sentinelDate());var j=h.getClock(),l=24;l=h.numberOfHoursInThisPeriod;var m=function(){var a=f(e.period,k);return{getLength:function(){return 2},getValue:function(b){var c=n._sentinelDate();if(0===b){c.setHours(1);var d=a.format(c);return d}if(1===b){c.setHours(13);var e=a.format(c);return e}return null}}}(),o=function(){var a=f(e.minute,d),b=n._sentinelDate();return{getLength:function(){return 60/c},getValue:function(d){var e=d*c;return b.setMinutes(e),a.format(b)}}}(),p=function(){var a=f(e.hour,i),b=n._sentinelDate();return{getLength:function(){return l},getValue:function(c){return b.setHours(c),a.format(b)}}}(),q=f("hour minute"),r=q.patterns[0],s=["hour","minute"],t={period:r.indexOf("{period"),hour:r.indexOf("{hour"),minute:r.indexOf("{minute")};t.period>-1&&s.push("period");var u=b.Windows.Globalization.DateTimeFormatting.DateTimeFormatter,v=new u("month.full",b.Windows.Globalization.ApplicationLanguages.languages,"ZZ","GregorianCalendar","24HourClock"),w=v.patterns[0],x=8207===w.charCodeAt(0);if(x){var y=t.hour;t.hour=t.minute,t.minute=y}return s.sort(function(a,b){return t[a]<t[b]?-1:t[a]>t[b]?1:0}),{minutes:o,hours:p,clock:j,periods:m,order:s,forceLanguage:q.resolvedLanguage,isRTL:x}},_getInformationJS:function(a,b){var c=[12,1,2,3,4,5,6,7,8,9,10,11],d={};d.getLength=function(){return 60/b},d.getValue=function(a){var c=a*b;return 10>c?"0"+c.toString():c.toString()};var e=["hour","minute","period"];return"24HourClock"===a&&(c=["00","01","02","03","04","05","06","07","08","09",10,11,12,13,14,15,16,17,18,19,20,21,22,23],e=["hour","minute"]),{minutes:d,hours:c,clock:a||"12HourClock",periods:["AM","PM"],order:e}}});return b.Windows.Globalization.DateTimeFormatting&&b.Windows.Globalization.Calendar&&b.Windows.Globalization.ApplicationLanguages?n.getInformation=n._getInformationWinRT:n.getInformation=n._getInformationJS,c.Class.mix(n,e.createEventProperties("change")),c.Class.mix(n,g.DOMEventMixin),n})})}),d("require-style!less/styles-backbutton",[],function(){}),d("require-style!less/colors-backbutton",[],function(){}),d("WinJS/Controls/BackButton",["exports","../Core/_Global","../Core/_Base","../Core/_ErrorFromName","../Core/_Resources","../Navigation","../Utilities/_Control","../Utilities/_ElementUtilities","../Utilities/_Hoverable","require-style!less/styles-backbutton","require-style!less/colors-backbutton"],function(a,b,c,d,e,f,g,h,i){"use strict";var j=h.Key,k="win-navigation-backbutton",l="win-back",m=3,n=function(){function a(){b.addEventListener("keyup",d,!1),h._addEventListener(b,"pointerup",e,!1)}function c(){b.removeEventListener("keyup",d,!1),h._removeEventListener(b,"pointerup",e,!1)}function d(a){(a.keyCode===j.leftArrow&&a.altKey&&!a.shiftKey&&!a.ctrlKey||a.keyCode===j.browserBack)&&(f.back(),a.preventDefault())}function e(a){a.button===m&&f.back()}var g=0;return{addRef:function(){0===g&&a(),g++},release:function(){g>0&&(g--,0===g&&c())},getCount:function(){return g}}}();c.Namespace._moduleDefine(a,"WinJS.UI",{BackButton:c.Namespace._lazy(function(){var a={get ariaLabel(){return e._getWinJSString("ui/backbuttonarialabel").value},get duplicateConstruction(){return"Invalid argument: Controls may only be instantiated one time for each DOM element"},get badButtonElement(){return"Invalid argument: For a button, toggle, or flyout command, the element must be null or a button element"}},i=c.Class.define(function(c,e){if(c&&c.winControl)throw new d("WinJS.UI.BackButton.DuplicateConstruction",a.duplicateConstruction);this._element=c||b.document.createElement("button"),e=e||{},this._initializeButton(),this._disposed=!1,this._element.winControl=this,g.setOptions(this,e),this._buttonClickHandler=this._handleBackButtonClick.bind(this),this._element.addEventListener("click",this._buttonClickHandler,!1),this._navigatedHandler=this._handleNavigatedEvent.bind(this),f.addEventListener("navigated",this._navigatedHandler,!1),n.addRef()},{element:{get:function(){return this._element}},dispose:function(){this._disposed||(this._disposed=!0,f.removeEventListener("navigated",this._navigatedHandler,!1),n.release())},refresh:function(){f.canGoBack?this._element.disabled=!1:this._element.disabled=!0},_initializeButton:function(){if("BUTTON"!==this._element.tagName)throw new d("WinJS.UI.BackButton.BadButtonElement",a.badButtonElement);h.addClass(this._element,k),h.addClass(this._element,"win-disposable"),this._element.innerHTML='<span class="'+l+'"></span>',this.refresh(),this._element.setAttribute("aria-label",a.ariaLabel),this._element.setAttribute("title",a.ariaLabel),this._element.setAttribute("type","button")},_handleNavigatedEvent:function(){this.refresh()},_handleBackButtonClick:function(){f.back()}});return i._getReferenceCount=function(){return n.getCount()},c.Class.mix(i,g.DOMEventMixin),i})})}),d("require-style!less/styles-tooltip",[],function(){}),d("require-style!less/colors-tooltip",[],function(){}),d("WinJS/Controls/Tooltip",["exports","../Core/_Global","../Core/_WinRT","../Core/_Base","../Core/_BaseUtils","../Core/_Events","../Animations","../Animations/_TransitionAnimation","../Utilities/_Control","../Utilities/_Dispose","../Utilities/_ElementUtilities","../Utilities/_Hoverable","require-style!less/styles-tooltip","require-style!less/colors-tooltip"],function(a,b,c,d,e,f,g,h,i,j,k,l){"use strict";d.Namespace._moduleDefine(a,"WinJS.UI",{Tooltip:d.Namespace._lazy(function(){function a(a,b){return"pointerdown"===a?b===G:a in H}function l(a,b){return"pointerdown"===a?b!==G:a in J}var m=0,n=k.Key,o="top",p=h._animationTimeAdjustment(400),q=h._animationTimeAdjustment(1200),r=h._animationTimeAdjustment(400),s=h._animationTimeAdjustment(5e3),t=h._animationTimeAdjustment(0),u=h._animationTimeAdjustment(600),v=h._animationTimeAdjustment(400),w=h._animationTimeAdjustment(600),x=h._animationTimeAdjustment(200),y=h._animationTimeAdjustment(3e5),z=12,A=20,B=45,C=20,D=12,E=1,F=k._MSPointerEvent.MSPOINTER_TYPE_MOUSE||"mouse",G=k._MSPointerEvent.MSPOINTER_TYPE_TOUCH||"touch",H={keyup:"",pointerover:"",pointerdown:""},I={pointermove:""},J={pointerdown:"",keydown:"",focusout:"",pointerout:"",pointercancel:"",pointerup:""},K={pointerover:"",pointerout:""},L="win-tooltip",M="win-tooltip-phantom",N=r,O=2*N,P=2.5*N,Q=s,R=!1,S=!1,T=f._createEventProperty;return d.Class.define(function(a,d){a=a||b.document.createElement("div");var e=k.data(a).tooltip;if(e)return e;if(!S&&c.Windows.UI.ViewManagement.UISettings){var f=new c.Windows.UI.ViewManagement.UISettings;N=h._animationTimeAdjustment(f.mouseHoverTime),O=2*N,P=2.5*N,Q=h._animationTimeAdjustment(1e3*f.messageDuration);var g=f.handPreference;R=g===c.Windows.UI.ViewManagement.HandPreference.leftHanded}S=!0,this._disposed=!1,this._placement=o,this._infotip=!1,this._innerHTML=null,this._contentElement=null,this._extraClass=null,this._lastContentType="html",this._anchorElement=a,this._domElement=null,this._phantomDiv=null,this._triggerByOpen=!1,this._eventListenerRemoveStack=[],this._lastKeyOrBlurEvent=null,this._currentKeyOrBlurEvent=null,a.winControl=this,k.addClass(a,"win-disposable"),a.title&&(this._innerHTML=this._anchorElement.title,this._anchorElement.removeAttribute("title")),i.setOptions(this,d),this._events(),k.data(a).tooltip=this},{innerHTML:{get:function(){return this._innerHTML},set:function(a){if(this._innerHTML=a,this._domElement){if(!this._innerHTML||""===this._innerHTML)return void this._onDismiss();this._domElement.innerHTML=a,this._position()}this._lastContentType="html"}},element:{get:function(){return this._anchorElement}},contentElement:{get:function(){return this._contentElement},set:function(a){if(this._contentElement=a,this._domElement){if(!this._contentElement)return void this._onDismiss();this._domElement.innerHTML="",this._domElement.appendChild(this._contentElement),this._position()}this._lastContentType="element"}},placement:{get:function(){return this._placement},set:function(a){"top"!==a&&"bottom"!==a&&"left"!==a&&"right"!==a&&(a=o),this._placement=a,this._domElement&&this._position()}},infotip:{get:function(){return this._infotip},set:function(a){this._infotip=!!a}},extraClass:{get:function(){return this._extraClass},set:function(a){this._extraClass=a}},onbeforeopen:T("beforeopen"),onopened:T("opened"),onbeforeclose:T("beforeclose"),onclosed:T("closed"),dispose:function(){if(!this._disposed){this._disposed=!0,j.disposeSubTree(this.element);for(var a=0,b=this._eventListenerRemoveStack.length;b>a;a++)this._eventListenerRemoveStack[a]();
this._onDismiss();var c=k.data(this._anchorElement);c&&delete c.tooltip}},addEventListener:function(a,b,c){if(this._anchorElement){this._anchorElement.addEventListener(a,b,c);var d=this;this._eventListenerRemoveStack.push(function(){d._anchorElement.removeEventListener(a,b,c)})}},removeEventListener:function(a,b,c){this._anchorElement&&this._anchorElement.removeEventListener(a,b,c)},open:function(a){switch(this._triggerByOpen=!0,"touch"!==a&&"mouseover"!==a&&"mousedown"!==a&&"keyboard"!==a&&(a="default"),a){case"touch":this._onInvoke("touch","never");break;case"mouseover":this._onInvoke("mouse","auto");break;case"keyboard":this._onInvoke("keyboard","auto");break;case"mousedown":case"default":this._onInvoke("nodelay","never")}},close:function(){this._onDismiss()},_cleanUpDOM:function(){this._domElement&&(j.disposeSubTree(this._domElement),b.document.body.removeChild(this._domElement),this._domElement=null,b.document.body.removeChild(this._phantomDiv),this._phantomDiv=null)},_createTooltipDOM:function(){this._cleanUpDOM(),this._domElement=b.document.createElement("div");var a=k._uniqueID(this._domElement);this._domElement.setAttribute("id",a);var c=k._getComputedStyle(this._anchorElement,null),d=this._domElement.style;d.direction=c.direction,d.writingMode=c["writing-mode"],this._domElement.setAttribute("tabindex",-1),this._domElement.setAttribute("role","tooltip"),this._anchorElement.setAttribute("aria-describedby",a),"element"===this._lastContentType?this._domElement.appendChild(this._contentElement):this._domElement.innerHTML=this._innerHTML,b.document.body.appendChild(this._domElement),k.addClass(this._domElement,L),this._extraClass&&k.addClass(this._domElement,this._extraClass),this._phantomDiv=b.document.createElement("div"),this._phantomDiv.setAttribute("tabindex",-1),b.document.body.appendChild(this._phantomDiv),k.addClass(this._phantomDiv,M);var e=k._getComputedStyle(this._domElement,null).zIndex+1;this._phantomDiv.style.zIndex=e},_raiseEvent:function(a,c){if(this._anchorElement){var d=b.document.createEvent("CustomEvent");d.initCustomEvent(a,!1,!1,c),this._anchorElement.dispatchEvent(d)}},_captureLastKeyBlurOrPointerOverEvent:function(a){switch(this._lastKeyOrBlurEvent=this._currentKeyOrBlurEvent,a.type){case"keyup":a.keyCode===n.shift?this._currentKeyOrBlurEvent=null:this._currentKeyOrBlurEvent="keyboard";break;case"focusout":this._currentKeyOrBlurEvent=null}},_registerEventToListener:function(a,b){var c=this,d=function(a){c._captureLastKeyBlurOrPointerOverEvent(a),c._handleEvent(a)};k._addEventListener(a,b,d,!1),this._eventListenerRemoveStack.push(function(){k._removeEventListener(a,b,d,!1)})},_events:function(){for(var a in H)this._registerEventToListener(this._anchorElement,a);for(var a in I)this._registerEventToListener(this._anchorElement,a);for(a in J)this._registerEventToListener(this._anchorElement,a);this._registerEventToListener(this._anchorElement,"contextmenu"),this._registerEventToListener(this._anchorElement,"MSHoldVisual")},_handleEvent:function(b){var c=b._normalizedType||b.type;if(!this._triggerByOpen){if(c in K&&k.eventWithinElement(this._anchorElement,b))return;if(a(c,b.pointerType))if(b.pointerType===G)this._isShown||(this._showTrigger="touch"),this._onInvoke("touch","never",b);else{if(this._skipMouseOver&&b.pointerType===F&&"pointerover"===c)return void(this._skipMouseOver=!1);var d="key"===c.substring(0,3)?"keyboard":"mouse";this._isShown||(this._showTrigger=d),this._onInvoke(d,"auto",b)}else if(c in I)this._contactPoint={x:b.clientX,y:b.clientY};else if(l(c,b.pointerType)){var f;if(b.pointerType===G){if("pointerup"===c){this._skipMouseOver=!0;var g=this;e._yieldForEvents(function(){g._skipMouseOver=!1})}f="touch"}else f="key"===c.substring(0,3)?"keyboard":"mouse";if("focusout"!==c&&f!==this._showTrigger)return;this._onDismiss()}else("contextmenu"===c||"MSHoldVisual"===c)&&b.preventDefault()}},_onShowAnimationEnd:function(){if(!this._shouldDismiss&&!this._disposed&&(this._raiseEvent("opened"),this._domElement&&"never"!==this._hideDelay)){var a=this,b=this._infotip?Math.min(3*Q,y):Q;this._hideDelayTimer=this._setTimeout(function(){a._onDismiss()},b)}},_onHideAnimationEnd:function(){b.document.body.removeEventListener("DOMNodeRemoved",this._removeTooltip,!1),this._cleanUpDOM(),this._anchorElement&&this._anchorElement.removeAttribute("aria-describedby"),m=(new Date).getTime(),this._triggerByOpen=!1,this._disposed||this._raiseEvent("closed")},_decideOnDelay:function(a){var b;if(this._useAnimation=!0,"nodelay"===a)b=0,this._useAnimation=!1;else{var c=(new Date).getTime();x>=c-m?(b="touch"===a?this._infotip?v:t:this._infotip?w:u,this._useAnimation=!1):b="touch"===a?this._infotip?q:p:this._infotip?P:O}return b},_getAnchorPositionFromElementWindowCoord:function(){var a=this._anchorElement.getBoundingClientRect();return{x:a.left,y:a.top,width:a.width,height:a.height}},_getAnchorPositionFromPointerWindowCoord:function(a){return{x:a.x,y:a.y,width:1,height:1}},_canPositionOnSide:function(a,b,c,d){var e=0,f=0;switch(a){case"top":e=d.width+this._offset,f=c.y;break;case"bottom":e=d.width+this._offset,f=b.height-c.y-c.height;break;case"left":e=c.x,f=d.height+this._offset;break;case"right":e=b.width-c.x-c.width,f=d.height+this._offset}return e>=d.width+this._offset&&f>=d.height+this._offset},_positionOnSide:function(a,b,c,d){var e=0,f=0;switch(a){case"top":case"bottom":e=c.x+c.width/2-d.width/2,e=Math.min(Math.max(e,0),b.width-d.width-E),f="top"===a?c.y-d.height-this._offset:c.y+c.height+this._offset;break;case"left":case"right":f=c.y+c.height/2-d.height/2,f=Math.min(Math.max(f,0),b.height-d.height-E),e="left"===a?c.x-d.width-this._offset:c.x+c.width+this._offset}this._domElement.style.left=e+"px",this._domElement.style.top=f+"px",this._phantomDiv.style.left=e+"px",this._phantomDiv.style.top=f+"px",this._phantomDiv.style.width=d.width+"px",this._phantomDiv.style.height=d.height+"px"},_position:function(a){var c={width:0,height:0},d={x:0,y:0,width:0,height:0},e={width:0,height:0};c.width=b.document.documentElement.clientWidth,c.height=b.document.documentElement.clientHeight,"tb-rl"===k._getComputedStyle(b.document.body,null)["writing-mode"]&&(c.width=b.document.documentElement.clientHeight,c.height=b.document.documentElement.clientWidth),d=!this._contactPoint||"touch"!==a&&"mouse"!==a?this._getAnchorPositionFromElementWindowCoord():this._getAnchorPositionFromPointerWindowCoord(this._contactPoint),e.width=this._domElement.offsetWidth,e.height=this._domElement.offsetHeight;var f={top:["top","bottom","left","right"],bottom:["bottom","top","left","right"],left:["left","right","top","bottom"],right:["right","left","top","bottom"]};R&&(f.top[2]="right",f.top[3]="left",f.bottom[2]="right",f.bottom[3]="left");for(var g=f[this._placement],h=g.length,i=0;h>i;i++)if(i===h-1||this._canPositionOnSide(g[i],c,d,e)){this._positionOnSide(g[i],c,d,e);break}return g[i]},_showTooltip:function(a){if(!this._shouldDismiss&&(this._isShown=!0,this._raiseEvent("beforeopen"),b.document.body.contains(this._anchorElement)&&!this._shouldDismiss)){if("element"===this._lastContentType){if(!this._contentElement)return void(this._isShown=!1)}else if(!this._innerHTML||""===this._innerHTML)return void(this._isShown=!1);var c=this;this._removeTooltip=function(a){for(var d=c._anchorElement;d;){if(a.target===d){b.document.body.removeEventListener("DOMNodeRemoved",c._removeTooltip,!1),c._cleanUpDOM();break}d=d.parentNode}},b.document.body.addEventListener("DOMNodeRemoved",this._removeTooltip,!1),this._createTooltipDOM(),this._position(a),this._useAnimation?g.fadeIn(this._domElement).then(this._onShowAnimationEnd.bind(this)):this._onShowAnimationEnd()}},_onInvoke:function(a,b,c){if(this._shouldDismiss=!1,!this._isShown&&(!c||"keyup"!==c.type||"keyboard"!==this._lastKeyOrBlurEvent&&(this._lastKeyOrBlurEvent||c.keyCode===n.tab))){this._hideDelay=b,this._contactPoint=null,c?(this._contactPoint={x:c.clientX,y:c.clientY},"touch"===a?this._offset=B:"keyboard"===a?this._offset=z:this._offset=A):"touch"===a?this._offset=C:this._offset=D,this._clearTimeout(this._delayTimer),this._clearTimeout(this._hideDelayTimer);var d=this._decideOnDelay(a);if(d>0){var e=this;this._delayTimer=this._setTimeout(function(){e._showTooltip(a)},d)}else this._showTooltip(a)}},_onDismiss:function(){this._shouldDismiss=!0,this._isShown&&(this._isShown=!1,this._showTrigger="mouse",this._domElement?(this._raiseEvent("beforeclose"),this._useAnimation?g.fadeOut(this._domElement).then(this._onHideAnimationEnd.bind(this)):this._onHideAnimationEnd()):(this._raiseEvent("beforeclose"),this._raiseEvent("closed")))},_setTimeout:function(a,c){return b.setTimeout(a,c)},_clearTimeout:function(a){b.clearTimeout(a)}},{_DELAY_INITIAL_TOUCH_SHORT:{get:function(){return p}},_DELAY_INITIAL_TOUCH_LONG:{get:function(){return q}},_DEFAULT_MOUSE_HOVER_TIME:{get:function(){return r}},_DEFAULT_MESSAGE_DURATION:{get:function(){return s}},_DELAY_RESHOW_NONINFOTIP_TOUCH:{get:function(){return t}},_DELAY_RESHOW_NONINFOTIP_NONTOUCH:{get:function(){return u}},_DELAY_RESHOW_INFOTIP_TOUCH:{get:function(){return v}},_DELAY_RESHOW_INFOTIP_NONTOUCH:{get:function(){return w}},_RESHOW_THRESHOLD:{get:function(){return x}},_HIDE_DELAY_MAX:{get:function(){return y}}})})})}),d("require-style!less/styles-rating",[],function(){}),d("require-style!less/colors-rating",[],function(){}),d("WinJS/Controls/Rating",["../Core/_Global","../Core/_Base","../Core/_ErrorFromName","../Core/_Events","../Core/_Resources","../_Accents","../Utilities/_Control","../Utilities/_ElementUtilities","../Utilities/_Hoverable","../Utilities/_SafeHtml","./Tooltip","require-style!less/styles-rating","require-style!less/colors-rating"],function(a,b,c,d,e,f,g,h,i,j,k){"use strict";f.createAccentRule(".win-rating .win-star.win-user.win-full, .win-rating .win-star.win-user.win-full.win-disabled",[{name:"color",value:f.ColorTypes.accent}]),b.Namespace.define("WinJS.UI",{Rating:b.Namespace._lazy(function(){var f=d._createEventProperty,i={get averageRating(){return e._getWinJSString("ui/averageRating").value},get clearYourRating(){return e._getWinJSString("ui/clearYourRating").value},get tentativeRating(){return e._getWinJSString("ui/tentativeRating").value},get tooltipStringsIsInvalid(){return"Invalid argument: tooltipStrings must be null or an array of strings."},get unrated(){return e._getWinJSString("ui/unrated").value},get userRating(){return e._getWinJSString("ui/userRating").value}},l=5,m=!1,n="cancel",o="change",p="previewchange",q=0,r=h._MSPointerEvent.MSPOINTER_TYPE_TOUCH||"touch",s=h._MSPointerEvent.MSPOINTER_TYPE_PEN||"pen",t=h._MSPointerEvent.MSPOINTER_TYPE_MOUSE||"mouse",u="padding-left: 0px; padding-right: 0px; border-left: 0px; border-right: 0px; -ms-flex: none; -webkit-flex: none; flex: none; display: none",v="win-rating",w="win-star win-empty",x="win-star win-average win-empty",y="win-star win-average win-full",z="win-star win-user win-empty",A="win-star win-user win-full",B="win-star win-tentative win-empty",C="win-star win-tentative win-full",D="win-disabled",E="win-average",F="win-user";return b.Class.define(function(b,c){this._disposed=!1,b=b||a.document.createElement("div"),c=c||{},this._element=b,h.addClass(this._element,"win-disposable"),this._userRating=0,this._averageRating=0,this._disabled=m,this._enableClear=!0,this._tooltipStrings=[],this._controlUpdateNeeded=!1,this._setControlSize(c.maxRating),c.tooltipStrings||this._updateTooltips(null),g.setOptions(this,c),this._controlUpdateNeeded=!0,this._forceLayout(),h._addInsertedNotifier(this._element),b.winControl=this,this._events()},{maxRating:{get:function(){return this._maxRating},set:function(a){this._setControlSize(a),this._forceLayout()}},userRating:{get:function(){return this._userRating},set:function(a){this._userRating=Math.max(0,Math.min(Number(a)>>0,this._maxRating)),this._updateControl()}},averageRating:{get:function(){return this._averageRating},set:function(a){this._averageRating=Number(a)<1?0:Math.min(Number(a)||0,this._maxRating),this._averageRatingElement&&this._ensureAverageMSStarRating(),this._updateControl()}},disabled:{get:function(){return this._disabled},set:function(a){this._disabled=!!a,this._disabled&&this._clearTooltips(),this._updateTabIndex(),this._updateControl()}},enableClear:{get:function(){return this._enableClear},set:function(a){this._enableClear=!!a,this._setAriaValueMin(),this._updateControl()}},tooltipStrings:{get:function(){return this._tooltipStrings},set:function(a){if("object"!=typeof a)throw new c("WinJS.UI.Rating.TooltipStringsIsInvalid",i.tooltipStringsIsInvalid);this._updateTooltips(a),this._updateAccessibilityRestState()}},element:{get:function(){return this._element}},oncancel:f(n),onchange:f(o),onpreviewchange:f(p),dispose:function(){if(!this._disposed){this._disposed=!0;for(var a=0;a<this._toolTips.length;a++)this._toolTips[a].dispose();this._toolTips=null}},addEventListener:function(a,b,c){this._element.addEventListener(a,b,c)},removeEventListener:function(a,b,c){return this._element.removeEventListener(a,b,c)},_forceLayout:function(){if(this._controlUpdateNeeded){var a=!1;this._updateControl=function(){a=!0},this.userRating=this._userRating,this.averageRating=this._averageRating,this._lastEventWasChange=!1,this._lastEventWasCancel=!1,this._tentativeRating=-1,this._captured=!1,this._pointerDownFocus=!1,this._elements=[],this._toolTips=[],this._clearElement=null,this._averageRatingElement=null,this._elementWidth=null,this._elementPadding=null,this._elementBorder=null,this._floatingValue=0,this._createControl(),this._setAccessibilityProperties(),delete this._updateControl,a&&this._updateControl()}},_hideAverageRating:function(){this._averageRatingHidden||(this._averageRatingHidden=!0,this._averageRatingElement.style.cssText=u)},_createControl:function(){h.addClass(this._element,v);var a="";this._averageRatingHidden=!0;for(var b=0;b<=this._maxRating;b++)a=b===this._maxRating?a+"<div class='"+y+"' style='"+u+"'></div>":a+"<div class='"+z+"'></div>";j.setInnerHTMLUnsafe(this._element,a);for(var c=this._element.firstElementChild,b=0;c;)this._elements[b]=c,b<this._maxRating&&(h.data(c).msStarRating=b+1),c=c.nextElementSibling,b++;this._averageRatingElement=this._elements[this._maxRating],this._ensureAverageMSStarRating(),this._updateTabIndex()},_setAriaValueMin:function(){this._element.setAttribute("aria-valuemin",this._enableClear?0:1)},_setAccessibilityProperties:function(){this._element.setAttribute("role","slider"),this._element.setAttribute("aria-valuemax",this._maxRating),this._setAriaValueMin(),this._updateAccessibilityRestState()},_getText:function(b){var c=this._tooltipStrings[b];if(c){var d=a.document.createElement("div");return d.innerHTML=c,d.textContent}return b===this._maxRating?i.clearYourRating:b+1},_updateAccessibilityRestState:function(){var a=this._element;this._ariaValueNowMutationObserver&&this._ariaValueNowMutationObserver.disconnect(),a.setAttribute("aria-readOnly",this._disabled),0!==this._userRating?(a.setAttribute("aria-valuenow",this._userRating),a.setAttribute("aria-label",i.userRating),a.setAttribute("aria-valuetext",this._getText(this._userRating-1))):0!==this._averageRating?(a.setAttribute("aria-valuenow",this._averageRating),a.setAttribute("aria-label",i.averageRating),a.setAttribute("aria-valuetext",this._averageRating)):(a.setAttribute("aria-valuenow",i.unrated),a.setAttribute("aria-label",i.userRating),a.setAttribute("aria-valuetext",i.unrated)),this._ariaValueNowMutationObserver&&this._ariaValueNowMutationObserver.observe(this._element,{attributes:!0,attributeFilter:["aria-valuenow"]})},_updateAccessibilityHoverState:function(){var a=this._element;this._ariaValueNowMutationObserver&&this._ariaValueNowMutationObserver.disconnect(),a.setAttribute("aria-readOnly",this._disabled),this._tentativeRating>0?(a.setAttribute("aria-label",i.tentativeRating),a.setAttribute("aria-valuenow",this._tentativeRating),a.setAttribute("aria-valuetext",this._getText(this._tentativeRating-1))):0===this._tentativeRating?(a.setAttribute("aria-valuenow",i.unrated),a.setAttribute("aria-label",i.tentativeRating),a.setAttribute("aria-valuetext",this._getText(this._maxRating))):(a.setAttribute("aria-valuenow",i.unrated),a.setAttribute("aria-label",i.tentativeRating),a.setAttribute("aria-valuetext",i.unrated)),this._ariaValueNowMutationObserver&&this._ariaValueNowMutationObserver.observe(this._element,{attributes:!0,attributeFilter:["aria-valuenow"]})},_ensureTooltips:function(){if(!this.disabled&&0===this._toolTips.length)for(var a=0;a<this._maxRating;a++)this._toolTips[a]=new k.Tooltip(this._elements[a])},_decrementRating:function(){this._closeTooltip();var a=!0;this._tentativeRating<=0?a=!1:(this._tentativeRating>0?this._tentativeRating--:-1===this._tentativeRating&&(0!==this._userRating&&this._userRating>0?this._tentativeRating=this._userRating-1:this._tentativeRating=0),0!==this._tentativeRating||this._enableClear||(this._tentativeRating=1,a=!1)),this._showTentativeRating(a,"keyboard")},_events:function(){function a(a){return{name:a,lowerCaseName:a.toLowerCase(),handler:function(b){var d=c["_on"+a];d&&d.apply(c,[b])}}}var b,c=this,d=[a("KeyDown"),a("FocusOut"),a("FocusIn"),a("PointerCancel"),a("PointerDown"),a("PointerMove"),a("PointerOver"),a("PointerUp"),a("PointerOut")],e=[a("WinJSNodeInserted")];for(b=0;b<d.length;++b)h._addEventListener(this._element,d[b].lowerCaseName,d[b].handler,!1);for(b=0;b<e.length;++b)this._element.addEventListener(e[b].name,e[b].handler,!1);this._ariaValueNowMutationObserver=new h._MutationObserver(this._ariaValueNowChanged.bind(this)),this._ariaValueNowMutationObserver.observe(this._element,{attributes:!0,attributeFilter:["aria-valuenow"]})},_onWinJSNodeInserted:function(){this._recalculateStarProperties(),this._updateControl()},_recalculateStarProperties:function(){var a=0;1===this._averageRating&&(a=1);var b=h._getComputedStyle(this._elements[a]);this._elementWidth=b.width,"rtl"===h._getComputedStyle(this._element).direction?(this._elementPadding=b.paddingRight,this._elementBorder=b.borderRight):(this._elementPadding=b.paddingLeft,this._elementBorder=b.borderLeft)},_hideAverageStar:function(){0!==this._averageRating&&this._resetAverageStar(!1)},_incrementRating:function(){this._closeTooltip();var a=!0;(this._tentativeRating<0||this._tentativeRating>=this._maxRating)&&(a=!1),-1!==this._tentativeRating?this._tentativeRating<this._maxRating&&this._tentativeRating++:0!==this._userRating?this._userRating<this._maxRating?this._tentativeRating=this._userRating+1:this._tentativeRating=this._maxRating:this._tentativeRating=1,this._showTentativeRating(a,"keyboard")},_ariaValueNowChanged:function(){if(!this._disabled){var a=this._element.getAttributeNode("aria-valuenow");if(null!==a){var b=Number(a.nodeValue);this.userRating!==b&&(this.userRating=b,this._tentativeRating=this._userRating,this._raiseEvent(o,this._userRating))}}},_onPointerCancel:function(){this._showCurrentRating(),this._lastEventWasChange||this._raiseEvent(n,null),this._captured=!1},_onPointerDown:function(a){(a.pointerType!==t||a.button===q)&&(this._captured||(this._pointerDownAt={x:a.clientX,y:a.clientY},this._pointerDownFocus=!0,this._disabled||(h._setPointerCapture(this._element,a.pointerId),this._captured=!0,a.pointerType===r?(this._tentativeRating=h.data(a.target).msStarRating||0,this._setStarClasses(C,this._tentativeRating,B),this._hideAverageStar(),this._updateAccessibilityHoverState(),this._openTooltip("touch"),this._raiseEvent(p,this._tentativeRating)):this._openTooltip("mousedown"))))},_onCapturedPointerMove:function(a,b){var c,d=this._pointerDownAt||{x:a.clientX,y:a.clientY},e=h._elementsFromPoint(a.clientX,d.y);if(e)for(var f=0,g=e.length;g>f;f++){var i=e[f];if("tooltip"===i.getAttribute("role"))return;if(h.hasClass(i,"win-star")){c=i;break}}var j;if(c&&c.parentElement===this._element)j=h.data(c).msStarRating||0;else{var k=0,l=this.maxRating;"rtl"===h._getComputedStyle(this._element).direction&&(k=l,l=0),j=a.clientX<d.x?k:l}var m=!1,n=Math.min(Math.ceil(j),this._maxRating);0!==n||this._enableClear||(n=1),n!==this._tentativeRating&&(this._closeTooltip(),m=!0),this._tentativeRating=n,this._showTentativeRating(m,b),a.preventDefault()},_onPointerMove:function(a){this._captured&&(a.pointerType===r?this._onCapturedPointerMove(a,"touch"):this._onCapturedPointerMove(a,"mousedown"))},_onPointerOver:function(a){this._disabled||a.pointerType!==s&&a.pointerType!==t||this._onCapturedPointerMove(a,"mouseover")},_onPointerUp:function(a){this._captured&&(h._releasePointerCapture(this._element,a.pointerId),this._captured=!1,this._onUserRatingChanged()),this._pointerDownAt=null},_onFocusOut:function(){this._captured||(this._onUserRatingChanged(),this._lastEventWasChange||this._lastEventWasCancel||this._raiseEvent(n,null))},_onFocusIn:function(){if(!this._pointerDownFocus){if(!this._disabled){if(0===this._userRating)for(var a=0;a<this._maxRating;a++)this._elements[a].className=B;this._hideAverageStar()}0!==this._userRating?this._raiseEvent(p,this._userRating):this._raiseEvent(p,0),this._tentativeRating=this._userRating}this._pointerDownFocus=!1},_onKeyDown:function(a){var b=h.Key,c=a.keyCode,d=h._getComputedStyle(this._element).direction,e=!0;switch(c){case b.enter:this._onUserRatingChanged();break;case b.tab:this._onUserRatingChanged(),e=!1;break;case b.escape:this._showCurrentRating(),this._lastEventWasChange||this._raiseEvent(n,null);break;case b.leftArrow:"rtl"===d&&this._tentativeRating<this.maxRating?this._incrementRating():"rtl"!==d&&this._tentativeRating>0?this._decrementRating():e=!1;break;case b.upArrow:this._tentativeRating<this.maxRating?this._incrementRating():e=!1;break;case b.rightArrow:"rtl"===d&&this._tentativeRating>0?this._decrementRating():"rtl"!==d&&this._tentativeRating<this.maxRating?this._incrementRating():e=!1;break;case b.downArrow:this._tentativeRating>0?this._decrementRating():e=!1;break;default:var f=0;if(c>=b.num0&&c<=b.num9?f=b.num0:c>=b.numPad0&&c<=b.numPad9&&(f=b.numPad0),f>0){var g=!1,i=Math.min(c-f,this._maxRating);0!==i||this._enableClear||(i=1),i!==this._tentativeRating&&(this._closeTooltip(),g=!0),this._tentativeRating=i,this._showTentativeRating(g,"keyboard")}else e=!1}e&&(a.stopPropagation(),a.preventDefault())},_onPointerOut:function(a){this._captured||h.eventWithinElement(this._element,a)||(this._showCurrentRating(),this._lastEventWasChange||this._raiseEvent(n,null))},_onUserRatingChanged:function(){this._disabled||(this._closeTooltip(),this._userRating===this._tentativeRating||this._lastEventWasCancel||this._lastEventWasChange?this._updateControl():(this.userRating=this._tentativeRating,this._raiseEvent(o,this._userRating)))},_raiseEvent:function(b,c){if(!this._disabled&&(this._lastEventWasChange=b===o,this._lastEventWasCancel=b===n,a.document.createEvent)){var d=a.document.createEvent("CustomEvent");d.initCustomEvent(b,!1,!1,{tentativeRating:c}),this._element.dispatchEvent(d)}},_resetNextElement:function(a){if(null!==this._averageRatingElement.nextSibling){h._setFlexStyle(this._averageRatingElement.nextSibling,{grow:1,shrink:1});var b=this._averageRatingElement.nextSibling.style,c=h._getComputedStyle(this._element).direction;a&&(c="rtl"===c?"ltr":"rtl"),"rtl"===c?(b.paddingRight=this._elementPadding,b.borderRight=this._elementBorder,b.direction="rtl"):(b.paddingLeft=this._elementPadding,b.borderLeft=this._elementBorder,b.direction="ltr"),b.backgroundPosition="left",b.backgroundSize="100% 100%",b.width=this._resizeStringValue(this._elementWidth,1,b.width)}},_resetAverageStar:function(a){this._resetNextElement(a),this._hideAverageRating()},_resizeStringValue:function(a,b,c){var d=parseFloat(a);if(isNaN(d))return null!==c?c:a;var e=a.substring(d.toString(10).length);return d*=b,d+e},_setControlSize:function(a){var b=(Number(a)||l)>>0;this._maxRating=b>0?b:l},_updateTooltips:function(a){var b,c=0;if(null!==a)for(c=a.length<=this._maxRating+1?a.length:this._maxRating+1,b=0;c>b;b++)this._tooltipStrings[b]=a[b];else{for(b=0;b<this._maxRating;b++)this._tooltipStrings[b]=b+1;this._tooltipStrings[this._maxRating]=i.clearYourRating}},_updateTabIndex:function(){this._element.tabIndex=this._disabled?"-1":"0"},_setStarClasses:function(a,b,c){for(var d=0;d<this._maxRating;d++)b>d?this._elements[d].className=a:this._elements[d].className=c},_updateAverageStar:function(){var a=this._averageRatingElement.style,b=this._averageRatingElement.nextSibling.style;"rtl"===h._getComputedStyle(this._element).direction?(a.backgroundPosition="right",a.paddingRight=this._elementPadding,a.borderRight=this._elementBorder,b.paddingRight="0px",b.borderRight="0px",b.direction="ltr"):(a.backgroundPosition="left",b.backgroundPosition="right",a.paddingLeft=this._elementPadding,a.borderLeft=this._elementBorder,b.paddingLeft="0px",b.borderLeft="0px",b.direction="rtl"),h._setFlexStyle(this._averageRatingElement,{grow:this._floatingValue,shrink:this._floatingValue}),a.width=this._resizeStringValue(this._elementWidth,this._floatingValue,a.width),a.backgroundSize=100/this._floatingValue+"% 100%",a.display=h._getComputedStyle(this._averageRatingElement.nextSibling).display,this._averageRatingHidden=!1,h._setFlexStyle(this._averageRatingElement.nextSibling,{grow:1-this._floatingValue,shrink:1-this._floatingValue}),b.width=this._resizeStringValue(this._elementWidth,1-this._floatingValue,b.width),b.backgroundSize=100/(1-this._floatingValue)+"% 100%"},_showCurrentRating:function(){this._closeTooltip(),this._tentativeRating=-1,this._disabled||this._updateControl(),this._updateAccessibilityRestState()},_showTentativeRating:function(a,b){!this._disabled&&this._tentativeRating>=0&&(this._setStarClasses(C,this._tentativeRating,B),this._hideAverageStar()),this._updateAccessibilityHoverState(),a&&(this._openTooltip(b),this._raiseEvent(p,this._tentativeRating))},_openTooltip:function(b){if(!this.disabled)if(this._ensureTooltips(),this._tentativeRating>0)this._toolTips[this._tentativeRating-1].innerHTML=this._tooltipStrings[this._tentativeRating-1],this._toolTips[this._tentativeRating-1].open(b);else if(0===this._tentativeRating){this._clearElement=a.document.createElement("div");var c=this._elements[0].offsetWidth+parseInt(this._elementPadding,10);"ltr"===h._getComputedStyle(this._element).direction&&(c*=-1),this._clearElement.style.cssText="visiblity:hidden; position:absolute; width:0px; height:100%; left:"+c+"px; top:0px;",this._elements[0].appendChild(this._clearElement),this._toolTips[this._maxRating]=new k.Tooltip(this._clearElement),this._toolTips[this._maxRating].innerHTML=this._tooltipStrings[this._maxRating],this._toolTips[this._maxRating].open(b)}},_closeTooltip:function(){0!==this._toolTips.length&&(this._tentativeRating>0?this._toolTips[this._tentativeRating-1].close():0===this._tentativeRating&&null!==this._clearElement&&(this._toolTips[this._maxRating].close(),this._elements[0].removeChild(this._clearElement),this._clearElement=null))},_clearTooltips:function(){if(this._toolTips&&0!==this._toolTips.length)for(var a=0;a<this._maxRating;a++)this._toolTips[a].innerHTML=null},_appendClass:function(a){for(var b=0;b<=this._maxRating;b++)h.addClass(this._elements[b],a)},_setClasses:function(a,b,c){for(var d=0;d<this._maxRating;d++)b>d?this._elements[d].className=a:this._elements[d].className=c},_ensureAverageMSStarRating:function(){h.data(this._averageRatingElement).msStarRating=Math.ceil(this._averageRating)},_updateControl:function(){if(this._controlUpdateNeeded){if(0!==this._averageRating&&0===this._userRating&&this._averageRating>=1&&this._averageRating<=this._maxRating){this._setClasses(y,this._averageRating-1,x),this._averageRatingElement.className=y;for(var a=0;a<this._maxRating;a++)if(a<this._averageRating&&a+1>=this._averageRating){this._resetNextElement(!1),this._element.insertBefore(this._averageRatingElement,this._elements[a]),this._floatingValue=this._averageRating-a;var b=h._getComputedStyle(this._elements[a]);this._elementWidth=b.width,"rtl"===h._getComputedStyle(this._element).direction?(this._elementPadding=b.paddingRight,this._elementBorder=b.borderRight):(this._elementPadding=b.paddingLeft,this._elementBorder=b.borderLeft),this._updateAverageStar()}}0!==this._userRating&&this._userRating>=1&&this._userRating<=this._maxRating&&(this._setClasses(A,this._userRating,z),this._resetAverageStar(!1)),0===this._userRating&&0===this._averageRating&&(this._setClasses(w,this._maxRating),this._resetAverageStar(!1)),this.disabled&&this._appendClass(D),0!==this._averageRating&&0===this._userRating?this._appendClass(E):this._appendClass(F),this._updateAccessibilityRestState()}}})})})}),d("require-style!less/styles-toggleswitch",[],function(){}),d("require-style!less/colors-toggleswitch",[],function(){}),d("WinJS/Controls/ToggleSwitch",["../Core/_Global","../Core/_Base","../Core/_BaseUtils","../Core/_Events","../Core/_Resources","../_Accents","../Utilities/_Control","../Utilities/_ElementUtilities","require-style!less/styles-toggleswitch","require-style!less/colors-toggleswitch"],function(a,b,c,d,e,f,g,h){"use strict";f.createAccentRule(".win-toggleswitch-on .win-toggleswitch-track",[{name:"background-color",value:f.ColorTypes.accent}]),f.createAccentRule("html.win-hoverable .win-toggleswitch-on:not(.win-toggleswitch-disabled):not(.win-toggleswitch-pressed) .win-toggleswitch-clickregion:hover .win-toggleswitch-track",[{name:"background-color",value:f.ColorTypes.listSelectPress}]),b.Namespace.define("WinJS.UI",{ToggleSwitch:b.Namespace._lazy(function(){var c="win-toggleswitch",f="win-toggleswitch-header",i="win-toggleswitch-clickregion",j="win-toggleswitch-track",k="win-toggleswitch-thumb",l="win-toggleswitch-values",m="win-toggleswitch-value",n="win-toggleswitch-value-on",o="win-toggleswitch-value-off",p="win-toggleswitch-description",q="win-toggleswitch-on",r="win-toggleswitch-off",s="win-toggleswitch-disabled",t="win-toggleswitch-enabled",u="win-toggleswitch-dragging",v="win-toggleswitch-pressed",w={get on(){return e._getWinJSString("ui/on").value},get off(){return e._getWinJSString("ui/off").value}},x=b.Class.define(function(b,d){b=b||a.document.createElement("div"),this._domElement=b,h.addClass(this._domElement,c),this._domElement.innerHTML=['<div class="'+f+'"></div>','<div class="'+i+'">',' <div class="'+j+'">',' <div class="'+k+'"></div>'," </div>",' <div class="'+l+'">',' <div class="'+m+" "+n+'"></div>',' <div class="'+m+" "+o+'"></div>'," </div>","</div>",'<div class="'+p+'"></div>'].join("\n"),this._headerElement=this._domElement.firstElementChild,this._clickElement=this._headerElement.nextElementSibling,this._trackElement=this._clickElement.firstElementChild,this._thumbElement=this._trackElement.firstElementChild,this._labelsElement=this._trackElement.nextElementSibling,this._labelOnElement=this._labelsElement.firstElementChild,this._labelOffElement=this._labelOnElement.nextElementSibling,this._descriptionElement=this._clickElement.nextElementSibling,this._headerElement.setAttribute("aria-hidden",!0),this._labelsElement.setAttribute("aria-hidden",!0),this._headerElement.setAttribute("id",h._uniqueID(this._headerElement)),this._domElement.setAttribute("aria-labelledby",this._headerElement.id),this._domElement.setAttribute("role","checkbox"),this._domElement.winControl=this,h.addClass(this._domElement,"win-disposable"),this._domElement.addEventListener("keydown",this._keyDownHandler.bind(this)),h._addEventListener(this._clickElement,"pointerdown",this._pointerDownHandler.bind(this)),h._addEventListener(this._clickElement,"pointercancel",this._pointerCancelHandler.bind(this)),this._boundPointerMove=this._pointerMoveHandler.bind(this),this._boundPointerUp=this._pointerUpHandler.bind(this),this._mutationObserver=new h._MutationObserver(this._ariaChangedHandler.bind(this)),this._mutationObserver.observe(this._domElement,{attributes:!0,attributeFilter:["aria-checked"]}),this._dragX=0,this._dragging=!1,this.checked=!1,this.disabled=!1,this.labelOn=w.on,this.labelOff=w.off,g.setOptions(this,d);
},{element:{get:function(){return this._domElement}},checked:{get:function(){return this._checked},set:function(a){a=!!a,a!==this.checked&&(this._checked=a,this._domElement.setAttribute("aria-checked",a),a?(h.addClass(this._domElement,q),h.removeClass(this._domElement,r)):(h.addClass(this._domElement,r),h.removeClass(this._domElement,q)),this.dispatchEvent("change"))}},disabled:{get:function(){return this._disabled},set:function(a){a=!!a,a!==this._disabled&&(a?(h.addClass(this._domElement,s),h.removeClass(this._domElement,t)):(h.removeClass(this._domElement,s),h.addClass(this._domElement,t)),this._disabled=a,this._domElement.setAttribute("aria-disabled",a),this._domElement.setAttribute("tabIndex",a?-1:0))}},labelOn:{get:function(){return this._labelOnElement.innerHTML},set:function(a){this._labelOnElement.innerHTML=a}},labelOff:{get:function(){return this._labelOffElement.innerHTML},set:function(a){this._labelOffElement.innerHTML=a}},title:{get:function(){return this._headerElement.innerHTML},set:function(a){this._headerElement.innerHTML=a}},onchange:d._createEventProperty("change"),dispose:function(){this._disposed||(this._disposed=!0)},_ariaChangedHandler:function(){var a=this._domElement.getAttribute("aria-checked");a="true"===a?!0:!1,this.checked=a},_keyDownHandler:function(a){this.disabled||(a.keyCode===h.Key.space&&(a.preventDefault(),this.checked=!this.checked),(a.keyCode===h.Key.rightArrow||a.keyCode===h.Key.upArrow)&&(a.preventDefault(),this.checked=!0),(a.keyCode===h.Key.leftArrow||a.keyCode===h.Key.downArrow)&&(a.preventDefault(),this.checked=!1))},_pointerDownHandler:function(a){this.disabled||this._mousedown||(a.preventDefault(),this._mousedown=!0,this._dragXStart=a.pageX-this._trackElement.getBoundingClientRect().left,this._dragX=this._dragXStart,this._dragging=!1,h.addClass(this._domElement,v),h._globalListener.addEventListener(this._domElement,"pointermove",this._boundPointerMove,!0),h._globalListener.addEventListener(this._domElement,"pointerup",this._boundPointerUp,!0),a.pointerType===h._MSPointerEvent.MSPOINTER_TYPE_TOUCH&&h._setPointerCapture(this._domElement,a.pointerId))},_pointerCancelHandler:function(a){this._resetPressedState(),a.pointerType===h._MSPointerEvent.MSPOINTER_TYPE_TOUCH&&h._releasePointerCapture(this._domElement,a.pointerId)},_pointerUpHandler:function(a){if(!this.disabled&&this._mousedown){a=a.detail.originalEvent,a.preventDefault();var b=this._trackElement.getBoundingClientRect(),c=this._thumbElement.getBoundingClientRect(),d="rtl"===h._getComputedStyle(this._domElement).direction;if(this._dragging){var e=b.width-c.width;this.checked=d?this._dragX<e/2:this._dragX>=e/2,this._dragging=!1,h.removeClass(this._domElement,u)}else this.checked=!this.checked;this._resetPressedState()}},_pointerMoveHandler:function(a){if(!this.disabled&&this._mousedown){a=a.detail.originalEvent,a.preventDefault();var b=this._trackElement.getBoundingClientRect(),c=a.pageX-b.left;if(!(c>b.width)){var d=this._thumbElement.getBoundingClientRect(),e=b.width-d.width-6;this._dragX=Math.min(e,c-d.width/2),this._dragX=Math.max(2,this._dragX),!this._dragging&&Math.abs(c-this._dragXStart)>3&&(this._dragging=!0,h.addClass(this._domElement,u)),this._thumbElement.style.left=this._dragX+"px"}}},_resetPressedState:function(){this._mousedown=!1,this._thumbElement.style.left="",h.removeClass(this._domElement,v),h._globalListener.removeEventListener(this._domElement,"pointermove",this._boundPointerMove,!0),h._globalListener.removeEventListener(this._domElement,"pointerup",this._boundPointerUp,!0)}});return b.Class.mix(x,g.DOMEventMixin),x})})}),d("require-style!less/styles-semanticzoom",[],function(){}),d("require-style!less/colors-semanticzoom",[],function(){}),d("WinJS/Controls/SemanticZoom",["../Core/_Global","../Core/_Base","../Core/_BaseUtils","../Core/_ErrorFromName","../Core/_Events","../Core/_Resources","../Core/_WriteProfilerMark","../Animations","../Animations/_TransitionAnimation","../ControlProcessor","../Promise","../Utilities/_Control","../Utilities/_Dispose","../Utilities/_ElementUtilities","../Utilities/_ElementListUtilities","../Utilities/_Hoverable","./ElementResizeInstrument","require-style!less/styles-semanticzoom","require-style!less/colors-semanticzoom"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q){"use strict";b.Namespace.define("WinJS.UI",{SemanticZoom:b.Namespace._lazy(function(){function f(a){return a}function r(a,b,c){return a+" "+i._animationTimeAdjustment(b)+"s "+c+" "+i._libraryDelay+"ms"}function s(){return r(X.cssName,Q,"ease-in-out")+", "+r("opacity",O,"ease-in-out")}function t(){return r(X.cssName,R,"ease-in-out")+", "+r("opacity",P,"ease-in-out")}function u(){return r(X.cssName,U,W)}function v(){return r(X.cssName,V,W)}function w(a,b){return n.convertToPixels(a,b)}function x(a,b){i.isAnimationEnabled()&&(a.style[X.scriptName]="scale("+b+")")}function y(a){var b=a[0].target&&a[0].target.winControl;b&&b instanceof ha&&b._onPropertyChanged()}var z=c._browserStyleEquivalents,A={get invalidZoomFactor(){return"Invalid zoomFactor"}},B="win-semanticzoom-button",C="win-semanticzoom-button-location",D=3e3,E=8,F="win-semanticzoom",G="win-semanticzoom-zoomedinview",H="win-semanticzoom-zoomedoutview",I="zoomchanged",J=1.05,K=.65,L=.8,M=.2,N=4096,O=.333,P=.333,Q=.333,R=.333,S=1e3*O,T=50,U=.333,V=.333,W="cubic-bezier(0.1,0.9,0.2,1)",X=z.transform,Y=z.transition.scriptName,Z=2,$=.2,_=.45,aa=1e3,ba=50,ca={none:0,zoomedIn:1,zoomedOut:2},da=n._MSPointerEvent.MSPOINTER_TYPE_TOUCH||"touch",ea=n._MSPointerEvent.MSPOINTER_TYPE_PEN||"pen",fa=n._MSPointerEvent.MSPOINTER_TYPE_MOUSE||"mouse",ga={x:0,y:0},ha=b.Class.define(function(b,e){this._disposed=!1;var f=this,g=c.isPhone;this._element=b,this._element.winControl=this,n.addClass(this._element,"win-disposable"),n.addClass(this._element,F),this._element.setAttribute("role","ms-semanticzoomcontainer");var h=this._element.getAttribute("aria-label");if(h||this._element.setAttribute("aria-label",""),e=e||{},this._zoomedOut=!!e.zoomedOut||!!e.initiallyZoomedOut||!1,this._enableButton=!g,g||void 0===e.enableButton||(this._enableButton=!!e.enableButton),this._element.setAttribute("aria-checked",this._zoomedOut.toString()),this._zoomFactor=n._clamp(e.zoomFactor,M,L,K),this.zoomedInItem=e.zoomedInItem,this.zoomedOutItem=e.zoomedOutItem,c.validation&&e._zoomFactor&&e._zoomFactor!==this._zoomFactor)throw new d("WinJS.UI.SemanticZoom.InvalidZoomFactor",A.invalidZoomFactor);this._locked=!!e.locked,this._zoomInProgress=!1,this._isBouncingIn=!1,this._isBouncing=!1,this._zooming=!1,this._aligning=!1,this._gesturing=!1,this._gestureEnding=!1,this._buttonShown=!1,this._shouldFakeTouchCancel="TouchEvent"in a,this._initialize(),this._configure(),this._onResizeBound=this._onResize.bind(this),this._elementResizeInstrument=new q._ElementResizeInstrument,this._element.appendChild(this._elementResizeInstrument.element),this._elementResizeInstrument.addEventListener("resize",this._onResizeBound),n._resizeNotifier.subscribe(this._element,this._onResizeBound);var i=a.document.body.contains(this._element);i&&this._elementResizeInstrument.addedToDom(),n._addInsertedNotifier(this._element);var j=!0;this._element.addEventListener("WinJSNodeInserted",function(a){j?(j=!1,i||(f._elementResizeInstrument.addedToDom(),f._onResizeBound())):f._onResizeBound()},!1),new n._MutationObserver(y).observe(this._element,{attributes:!0,attributeFilter:["aria-checked"]}),g||(this._element.addEventListener("wheel",this._onWheel.bind(this),!0),this._element.addEventListener("mousewheel",this._onMouseWheel.bind(this),!0),this._element.addEventListener("keydown",this._onKeyDown.bind(this),!0),n._addEventListener(this._element,"pointerdown",this._onPointerDown.bind(this),!0),n._addEventListener(this._element,"pointermove",this._onPointerMove.bind(this),!0),n._addEventListener(this._element,"pointerout",this._onPointerOut.bind(this),!0),n._addEventListener(this._element,"pointercancel",this._onPointerCancel.bind(this),!0),n._addEventListener(this._element,"pointerup",this._onPointerUp.bind(this),!1),this._hiddenElement.addEventListener("gotpointercapture",this._onGotPointerCapture.bind(this),!1),this._hiddenElement.addEventListener("lostpointercapture",this._onLostPointerCapture.bind(this),!1),this._element.addEventListener("click",this._onClick.bind(this),!0),this._canvasIn.addEventListener(c._browserEventEquivalents.transitionEnd,this._onCanvasTransitionEnd.bind(this),!1),this._canvasOut.addEventListener(c._browserEventEquivalents.transitionEnd,this._onCanvasTransitionEnd.bind(this),!1),this._element.addEventListener("MSContentZoom",this._onMSContentZoom.bind(this),!0),this._resetPointerRecords()),this._onResizeImpl(),l._setOptions(this,e,!0),f._setVisibility()},{element:{get:function(){return this._element}},enableButton:{get:function(){return this._enableButton},set:function(a){var b=!!a;this._enableButton===b||c.isPhone||(this._enableButton=b,b?this._createSemanticZoomButton():this._removeSemanticZoomButton())}},zoomedOut:{get:function(){return this._zoomedOut},set:function(a){this._zoom(!!a,{x:.5*this._sezoClientWidth,y:.5*this._sezoClientHeight},!1,!1,this._zoomedOut&&c.isPhone)}},zoomFactor:{get:function(){return this._zoomFactor},set:function(a){var b=this._zoomFactor,c=n._clamp(a,M,L,K);b!==c&&(this._zoomFactor=c,this.forceLayout())}},locked:{get:function(){return this._locked},set:function(a){this._locked=!!a,a?this._hideSemanticZoomButton():this._displayButton()}},zoomedInItem:{get:function(){return this._zoomedInItem},set:function(a){this._zoomedInItem=a||f}},zoomedOutItem:{get:function(){return this._zoomedOutItem},set:function(a){this._zoomedOutItem=a||f}},dispose:function(){this._disposed||(this._disposed=!0,this._elementResizeInstrument.dispose(),n._resizeNotifier.unsubscribe(this._element,this._onResizeBound),m._disposeElement(this._elementIn),m._disposeElement(this._elementOut),this._clearTimeout(this._completeZoomTimer),this._clearTimeout(this._TTFFTimer))},forceLayout:function(){this._onResizeImpl()},_initialize:function(){var b=o.children(this._element);this._elementIn=b[0],this._elementOut=b[1],this._elementIn.style.height=this._elementOut.style.height=this._element.offsetHeight+"px",j.processAll(this._elementIn),j.processAll(this._elementOut),this._viewIn=this._elementIn.winControl.zoomableView,this._viewOut=this._elementOut.winControl.zoomableView,this._element.removeChild(this._elementOut),this._element.removeChild(this._elementIn),this._element.innerHTML="",this._cropViewport=a.document.createElement("div"),this._element.appendChild(this._cropViewport),this._viewportIn=a.document.createElement("div"),this._opticalViewportIn=a.document.createElement("div"),this._viewportOut=a.document.createElement("div"),this._opticalViewportOut=a.document.createElement("div"),this._opticalViewportIn.appendChild(this._viewportIn),this._opticalViewportOut.appendChild(this._viewportOut),this._cropViewport.appendChild(this._opticalViewportIn),this._cropViewport.appendChild(this._opticalViewportOut),this._canvasIn=a.document.createElement("div"),this._canvasOut=a.document.createElement("div"),this._viewportIn.appendChild(this._canvasIn),this._viewportOut.appendChild(this._canvasOut),this._canvasIn.appendChild(this._elementIn),this._canvasOut.appendChild(this._elementOut),this._enableButton&&this._createSemanticZoomButton(),this._hiddenElement=a.document.createElement("div"),this._hiddenElement.tabIndex=-1,this._hiddenElement.visibility="hidden",this._hiddenElement.setAttribute("aria-hidden","true"),this._element.appendChild(this._hiddenElement),n.addClass(this._elementIn,G),n.addClass(this._elementOut,H),this._setLayout(this._element,"relative","hidden"),this._setLayout(this._cropViewport,"absolute","hidden"),this._setLayout(this._opticalViewportIn,"absolute","auto"),this._setLayout(this._opticalViewportOut,"absolute","auto"),this._setLayout(this._viewportIn,"absolute","hidden"),this._setLayout(this._viewportOut,"absolute","hidden"),this._setLayout(this._canvasIn,"absolute","hidden"),this._setLayout(this._canvasOut,"absolute","hidden"),this._setupOpticalViewport(this._opticalViewportIn),this._setupOpticalViewport(this._opticalViewportOut),this._viewportIn.style["-ms-overflow-style"]="-ms-autohiding-scrollbar",this._viewportOut.style["-ms-overflow-style"]="-ms-autohiding-scrollbar",this._elementIn.style.position="absolute",this._elementOut.style.position="absolute"},_createSemanticZoomButton:function(){this._sezoButton=a.document.createElement("button"),this._sezoButton.setAttribute("type","button"),this._sezoButton.className=B+" "+C+" win-button",this._sezoButton.tabIndex=-1,this._sezoButton.style.visibility="hidden",this._sezoButton.setAttribute("aria-hidden",!0),this._element.appendChild(this._sezoButton),this._sezoButton.addEventListener("click",this._onSeZoButtonZoomOutClick.bind(this),!1),this._element.addEventListener("scroll",this._onSeZoChildrenScroll.bind(this),!0),n._addEventListener(this._element,"pointermove",this._onPenHover.bind(this),!1)},_removeSemanticZoomButton:function(){this._sezoButton&&(this._element.removeChild(this._sezoButton),this._sezoButton=null)},_configure:function(){var a=this._viewIn.getPanAxis(),b=this._viewOut.getPanAxis(),d=c.isPhone;if(this._pansHorizontallyIn="horizontal"===a||"both"===a,this._pansVerticallyIn="vertical"===a||"both"===a,this._pansHorizontallyOut="horizontal"===b||"both"===b,this._pansVerticallyOut="vertical"===b||"both"===b,!this._zoomInProgress){var e=1/this._zoomFactor-1,f=J-1;this._setLayout(this._elementIn,"absolute","visible"),this._setLayout(this._elementOut,"absolute","visible"),this._viewIn.configureForZoom(!1,!this._zoomedOut,this._zoomFromCurrent.bind(this,!0),e),this._viewOut.configureForZoom(!0,this._zoomedOut,this._zoomFromCurrent.bind(this,!1),f),this._pinching=!1,this._pinchGesture=0,this._canvasLeftIn=0,this._canvasTopIn=0,this._canvasLeftOut=0,this._canvasTopOut=0,d||(this._zoomedOut?x(this._canvasIn,this._zoomFactor):x(this._canvasOut,1/this._zoomFactor));var g=this._opticalViewportIn.style,h=this._opticalViewportOut.style,j=this._canvasIn.style,k=this._canvasOut.style;j.opacity=this._zoomedOut&&!d?0:1,k.opacity=this._zoomedOut?1:0,d&&(j.zIndex=1,k.zIndex=2),i.isAnimationEnabled()&&!d&&(g[z["transition-property"].scriptName]=X.cssName,g[z["transition-duration"].scriptName]="0s",g[z["transition-timing-function"].scriptName]="linear",h[z["transition-property"].scriptName]=X.cssName,h[z["transition-duration"].scriptName]="0s",h[z["transition-timing-function"].scriptName]="linear")}},_onPropertyChanged:function(){var a=this._element.getAttribute("aria-checked"),b="true"===a;this._zoomedOut!==b&&(this.zoomedOut=b)},_onResizeImpl:function(){this._resizing=this._resizing||0,this._resizing++;try{var a=function(a,b,c,d,e){var f=a.style;f.left=b+"px",f.top=c+"px",f.width=d+"px",f.height=e+"px"},b=n._getComputedStyle(this._element,null),c=parseFloat(b.width),d=parseFloat(b.height),e=w(this._element,b.paddingLeft),f=w(this._element,b.paddingRight),g=w(this._element,b.paddingTop),h=w(this._element,b.paddingBottom),i=c-e-f,j=d-g-h,k=1/this._zoomFactor;if(this._viewportWidth===i&&this._viewportHeight===j)return;this._sezoClientHeight=d,this._sezoClientWidth=c,this._viewportWidth=i,this._viewportHeight=j,this._configure();var l=2*k-1,m=Math.min(N,(this._pansHorizontallyIn?l:1)*i),o=Math.min(N,(this._pansVerticallyIn?l:1)*j);this._canvasLeftIn=.5*(m-i),this._canvasTopIn=.5*(o-j),a(this._cropViewport,e,g,i,j),a(this._viewportIn,0,0,i,j),a(this._opticalViewportIn,0,0,i,j),a(this._canvasIn,-this._canvasLeftIn,-this._canvasTopIn,m,o),a(this._elementIn,this._canvasLeftIn,this._canvasTopIn,i,j);var p=2*J-1,q=(this._pansHorizontallyOut?p:1)*i,r=(this._pansVerticallyOut?p:1)*j;this._canvasLeftOut=.5*(q-i),this._canvasTopOut=.5*(r-j),a(this._viewportOut,0,0,i,j),a(this._opticalViewportOut,0,0,i,j),a(this._canvasOut,-this._canvasLeftOut,-this._canvasTopOut,q,r),a(this._elementOut,this._canvasLeftOut,this._canvasTopOut,i,j)}finally{this._resizing--}},_onResize:function(){this._resizing||this._onResizeImpl()},_onMouseMove:function(a){return this._zooming||!this._lastMouseX&&!this._lastMouseY||a.screenX===this._lastMouseX&&a.screenY===this._lastMouseY?(this._lastMouseX=a.screenX,void(this._lastMouseY=a.screenY)):void(Math.abs(a.screenX-this._lastMouseX)<=E&&Math.abs(a.screenY-this._lastMouseY)<=E||(this._lastMouseX=a.screenX,this._lastMouseY=a.screenY,this._displayButton()))},_displayButton:function(){if(p.isHoverable){a.clearTimeout(this._dismissButtonTimer),this._showSemanticZoomButton();var b=this;this._dismissButtonTimer=a.setTimeout(function(){b._hideSemanticZoomButton()},i._animationTimeAdjustment(D))}},_showSemanticZoomButton:function(){this._disposed||this._buttonShown||!this._sezoButton||this._zoomedOut||this._locked||(h.fadeIn(this._sezoButton),this._sezoButton.style.visibility="visible",this._buttonShown=!0)},_hideSemanticZoomButton:function(a){if(!this._disposed&&this._buttonShown&&this._sezoButton){if(a)this._sezoButton.style.visibility="hidden";else{var b=this;h.fadeOut(this._sezoButton).then(function(){b._sezoButton.style.visibility="hidden"})}this._buttonShown=!1}},_onSeZoChildrenScroll:function(a){a.target!==this.element&&this._hideSemanticZoomButton(!0)},_onWheel:function(a){a.ctrlKey&&(this._zoom(a.deltaY>0,this._getPointerLocation(a)),a.stopPropagation(),a.preventDefault())},_onMouseWheel:function(a){a.ctrlKey&&(this._zoom(a.wheelDelta<0,this._getPointerLocation(a)),a.stopPropagation(),a.preventDefault())},_onPenHover:function(a){a.pointerType===ea&&0===a.buttons&&this._displayButton()},_onSeZoButtonZoomOutClick:function(){this._hideSemanticZoomButton(),this._zoom(!0,{x:.5*this._sezoClientWidth,y:.5*this._sezoClientHeight},!1)},_onKeyDown:function(a){var b=!1;if(a.ctrlKey){var c=n.Key;switch(a.keyCode){case c.add:case c.equal:case 61:this._zoom(!1),b=!0;break;case c.subtract:case c.dash:case 173:this._zoom(!0),b=!0}}b&&(a.stopPropagation(),a.preventDefault())},_createPointerRecord:function(a,b){var c=this._getPointerLocation(a),d={};return d.startX=d.currentX=c.x,d.startY=d.currentY=c.y,d.fireCancelOnPinch=b,this._pointerRecords[a.pointerId]=d,this._pointerCount=Object.keys(this._pointerRecords).length,d},_deletePointerRecord:function(a){var b=this._pointerRecords[a];return delete this._pointerRecords[a],this._pointerCount=Object.keys(this._pointerRecords).length,2!==this._pointerCount&&(this._pinching=!1),b},_fakeCancelOnPointer:function(b){var c=a.document.createEvent("UIEvent");c.initUIEvent("touchcancel",!0,!0,a,0),c.touches=b.touches,c.targetTouches=b.targetTouches,c.changedTouches=[b._currentTouch],c._fakedBySemanticZoom=!0,b.target.dispatchEvent(c)},_handlePointerDown:function(a){this._createPointerRecord(a,!1);for(var b=Object.keys(this._pointerRecords),c=0,d=b.length;d>c;c++)try{n._setPointerCapture(this._hiddenElement,b[c]||0)}catch(e){return void this._resetPointerRecords()}a.stopImmediatePropagation(),a.preventDefault()},_handleFirstPointerDown:function(a){this._resetPointerRecords(),this._createPointerRecord(a,this._shouldFakeTouchCancel),this._startedZoomedOut=this._zoomedOut},_onClick:function(a){a.target!==this._element&&this._isBouncing&&a.stopImmediatePropagation()},_onPointerDown:function(a){a.pointerType===da&&(0===this._pointerCount?this._handleFirstPointerDown(a):this._handlePointerDown(a))},_onPointerMove:function(a){function b(a,b,c,d){return Math.sqrt((c-a)*(c-a)+(d-b)*(d-b))}function c(a,b){return{x:.5*(a.currentX+b.currentX)|0,y:.5*(a.currentY+b.currentY)|0}}if(a.pointerType===fa||a.pointerType===ea)return void this._onMouseMove(a);if(a.pointerType===da){var d=this._pointerRecords[a.pointerId],e=this._getPointerLocation(a);if(d){if(d.currentX=e.x,d.currentY=e.y,2===this._pointerCount){this._pinching=!0;var f=Object.keys(this._pointerRecords),h=this._pointerRecords[f[0]],i=this._pointerRecords[f[1]];this._currentMidPoint=c(h,i);var j=b(h.currentX,h.currentY,i.currentX,i.currentY),k=this,l=function(a){var b=a?ca.zoomedOut:ca.zoomedIn,d=a?k._pinchedDirection===ca.zoomedIn&&!k._zoomingOut:k._pinchedDirection===ca.zoomedOut&&k._zoomingOut,e=a?!k._zoomedOut:k._zoomedOut;if(k._pinchedDirection===ca.none)e?(k._isBouncingIn=!1,k._zoom(a,c(h,i),!0),k._pinchedDirection=b):k._isBouncingIn||k._playBounce(!0,c(h,i));else if(d){var f=k._lastPinchDistance/k._lastPinchStartDistance,g=k._lastLastPinchDistance/k._lastPinchDistance;(a&&f>$||!a&&g>_)&&(k._zoom(a,c(h,i),!0),k._pinchedDirection=b)}};this._updatePinchDistanceRecords(j),this._pinchDistanceCount>=Z&&(this._zooming||this._isBouncing||(g("WinJS.UI.SemanticZoom:EndPinchDetection,info"),l(this._lastPinchDirection===ca.zoomedOut)))}else this._pointerCount>2&&this._resetPinchDistanceRecords();this._pointerCount>=2&&(d.fireCancelOnPinch&&(this._fakeCancelOnPointer(a,d),d.fireCancelOnPinch=!1),a.stopImmediatePropagation(),a.preventDefault()),2!==this._pointerCount&&this._isBouncingIn&&this._playBounce(!1)}}},_onPointerOut:function(a){a.pointerType===da&&a.target===this._element&&this._completePointerUp(a,!1)},_onPointerUp:function(a){this._releasePointerCapture(a),this._completePointerUp(a,!0),this._completeZoomingIfTimeout()},_onPointerCancel:function(a){a._fakedBySemanticZoom||(this._releasePointerCapture(a),this._completePointerUp(a,!1),this._completeZoomingIfTimeout())},_onGotPointerCapture:function(a){var b=this._pointerRecords[a.pointerId];b&&(b.dirty=!1)},_onLostPointerCapture:function(a){var b=this._pointerRecords[a.pointerId];if(b){b.dirty=!0;var c=this;k.timeout(ba).then(function(){b.dirty&&c._completePointerUp(a,!1)})}},_onMSContentZoom:function(a){var b=a.target;if(b===this._opticalViewportIn||b===this._opticalViewportOut){var c=b.msContentZoomFactor<.995,d=b.msContentZoomFactor>1.005;!c||this._zoomedOut||this._zoomingOut?d&&(this._zoomedOut||this._zoomingOut)&&(this.zoomedOut=!1):this.zoomedOut=!0}},_updatePinchDistanceRecords:function(a){function b(b){c._lastPinchDirection===b?c._pinchDistanceCount++:(c._pinchGesture++,c._pinchDistanceCount=0,c._lastPinchStartDistance=a),c._lastPinchDirection=b,c._lastPinchDistance=a,c._lastLastPinchDistance=c._lastPinchDistance}var c=this;-1===this._lastPinchDistance?(g("WinJS.UI.SemanticZoom:StartPinchDetection,info"),this._lastPinchDistance=a):this._lastPinchDistance!==a&&b(this._lastPinchDistance>a?ca.zoomedOut:ca.zoomedIn)},_zoomFromCurrent:function(a){this._zoom(a,null,!1,!0)},_zoom:function(a,b,d,e,f){if(g("WinJS.UI.SemanticZoom:StartZoom(zoomOut="+a+"),info"),this._clearTimeout(this._completeZoomTimer),this._clearTimeout(this._TTFFTimer),this._hideSemanticZoomButton(),this._resetPinchDistanceRecords(),!this._locked&&!this._gestureEnding)if(this._zoomInProgress){if(this._gesturing===!d)return;a!==this._zoomingOut&&this._startAnimations(a)}else if(a!==this._zoomedOut){this._zooming=!0,this._aligning=!0,this._gesturing=!!d,b&&(a?this._viewIn:this._viewOut).setCurrentItem(b.x,b.y),this._zoomInProgress=!0,(a?this._opticalViewportOut:this._opticalViewportIn).style.visibility="visible",a&&c.isPhone&&(this._canvasOut.style.opacity=1);var h=this._viewIn.beginZoom(),i=this._viewOut.beginZoom(),j=null;if((h||i)&&c.isPhone&&(j=k.join([h,i])),e&&!f){var l=this;(a?this._viewIn:this._viewOut).getCurrentItem().then(function(b){var c=b.position;l._prepareForZoom(a,{x:l._rtl()?l._sezoClientWidth-c.left-.5*c.width:c.left+.5*c.width,y:c.top+.5*c.height},k.wrap(b),j)})}else this._prepareForZoom(a,b||{},null,j,f)}},_prepareForZoom:function(a,b,c,d,e){function f(a,b){h._canvasIn.style[z["transform-origin"].scriptName]=h._canvasLeftIn+i-a.x+"px "+(h._canvasTopIn+j-a.y)+"px",h._canvasOut.style[z["transform-origin"].scriptName]=h._canvasLeftOut+i-b.x+"px "+(h._canvasTopOut+j-b.y)+"px"}g("WinJS.UI.SemanticZoom:prepareForZoom,StartTM");var h=this,i=b.x,j=b.y;"number"==typeof i&&this._pansHorizontallyIn&&this._pansHorizontallyOut||(i=.5*this._sezoClientWidth),"number"==typeof j&&this._pansVerticallyIn&&this._pansVerticallyOut||(j=.5*this._sezoClientHeight),f(ga,ga),e?this._aligning=!1:this._alignViewsPromise=this._alignViews(a,i,j,c).then(function(){h._aligning=!1,h._gestureEnding=!1,h._alignViewsPromise=null,h._zooming||h._gesturing||h._completeZoom()}),this._zoomingOut=a,n._getComputedStyle(this._canvasIn).opacity,n._getComputedStyle(this._canvasOut).opacity,g("WinJS.UI.SemanticZoom:prepareForZoom,StopTM"),this._startAnimations(a,d)},_alignViews:function(a,b,c,d){var e=1-this._zoomFactor,f=this._rtl(),g=e*(f?this._viewportWidth-b:b),h=e*c,i=this;if(a){var j=d||this._viewIn.getCurrentItem();if(j)return j.then(function(a){var b=a.position,c={left:b.left*i._zoomFactor+g,top:b.top*i._zoomFactor+h,width:b.width*i._zoomFactor,height:b.height*i._zoomFactor};return i._viewOut.positionItem(i._zoomedOutItem(a.item),c)})}else{var l=d||this._viewOut.getCurrentItem();if(l)return l.then(function(a){var b=a.position,c={left:(b.left-g)/i._zoomFactor,top:(b.top-h)/i._zoomFactor,width:b.width/i._zoomFactor,height:b.height/i._zoomFactor};return i._viewIn.positionItem(i._zoomedInItem(a.item),c)})}return new k(function(a){a({x:0,y:0})})},_startAnimations:function(a,b){this._zoomingOut=a;var d=c.isPhone;if(i.isAnimationEnabled()&&!d&&(g("WinJS.UI.SemanticZoom:ZoomAnimation,StartTM"),this._canvasIn.style[Y]=a?s():t(),this._canvasOut.style[Y]=a?t():s()),d||(x(this._canvasIn,a?this._zoomFactor:1),x(this._canvasOut,a?1:1/this._zoomFactor)),this._canvasIn.style.opacity=a&&!d?0:1,(!d||a)&&(this._canvasOut.style.opacity=a?1:0),i.isAnimationEnabled())if(b){var e=this,f=function(){e._canvasIn.style[X.scriptName]="",e._canvasOut.style[X.scriptName]="",e._onZoomAnimationComplete()};b.then(f,f)}else this.setTimeoutAfterTTFF(this._onZoomAnimationComplete.bind(this),i._animationTimeAdjustment(S));else this._zooming=!1,this._canvasIn.style[X.scriptName]="",this._canvasOut.style[X.scriptName]="",this._completeZoom()},_onBounceAnimationComplete:function(){this._isBouncingIn||this._disposed||this._completeZoom()},_onZoomAnimationComplete:function(){g("WinJS.UI.SemanticZoom:ZoomAnimation,StopTM"),this._disposed||(this._zooming=!1,this._aligning||this._gesturing||this._gestureEnding||this._completeZoom())},_onCanvasTransitionEnd:function(a){return this._disposed?void 0:a.target!==this._canvasOut&&a.target!==this._canvasIn||!this._isBouncing?void(a.target===this._canvasIn&&a.propertyName===X.cssName&&this._onZoomAnimationComplete()):void this._onBounceAnimationComplete()},_clearTimeout:function(b){b&&a.clearTimeout(b)},_completePointerUp:function(a,b){if(!this._disposed){var c=a.pointerId,d=this._pointerRecords[c];if(d&&(this._deletePointerRecord(c),this._isBouncingIn&&this._playBounce(!1),b&&this._pinchedDirection!==ca.none&&a.stopImmediatePropagation(),0===this._pointerCount)){if(1===this._pinchGesture&&!this._zooming&&this._lastPinchDirection!==ca.none&&this._pinchDistanceCount<Z)return this._zoom(this._lastPinchDirection===ca.zoomedOut,this._currentMidPoint,!1),this._pinchGesture=0,void this._attemptRecordReset();this._pinchedDirection!==ca.none&&(this._gesturing=!1,this._aligning||this._zooming||this._completeZoom()),this._pinchGesture=0,this._attemptRecordReset()}}},setTimeoutAfterTTFF:function(b,c){var d=this;d._TTFFTimer=a.setTimeout(function(){this._disposed||(d._TTFFTimer=a.setTimeout(b,c))},T)},_completeZoomingIfTimeout:function(){if(0===this._pointerCount){var b=this;(this._zoomInProgress||this._isBouncing)&&(b._completeZoomTimer=a.setTimeout(function(){b._completeZoom()},i._animationTimeAdjustment(aa)))}},_completeZoom:function(){if(!this._disposed){if(this._isBouncing)return this._zoomedOut?this._viewOut.endZoom(!0):this._viewIn.endZoom(!0),void(this._isBouncing=!1);if(this._zoomInProgress){g("WinJS.UI.SemanticZoom:CompleteZoom,info"),this._aligning=!1,this._alignViewsPromise&&this._alignViewsPromise.cancel(),this._clearTimeout(this._completeZoomTimer),this._clearTimeout(this._TTFFTimer),this._gestureEnding=!1,this[this._zoomingOut?"_opticalViewportOut":"_opticalViewportIn"].msContentZoomFactor=1,this._viewIn.endZoom(!this._zoomingOut),this._viewOut.endZoom(this._zoomingOut),this._canvasIn.style.opacity=this._zoomingOut&&!c.isPhone?0:1,this._canvasOut.style.opacity=this._zoomingOut?1:0,this._zoomInProgress=!1;var b=!1;if(this._zoomingOut!==this._zoomedOut&&(this._zoomedOut=!!this._zoomingOut,this._element.setAttribute("aria-checked",this._zoomedOut.toString()),b=!0),this._setVisibility(),b){var d=a.document.createEvent("CustomEvent");d.initCustomEvent(I,!0,!0,this._zoomedOut),this._element.dispatchEvent(d),this._isActive&&n._setActive(this._zoomedOut?this._elementOut:this._elementIn)}g("WinJS.UI.SemanticZoom:CompleteZoom_Custom,info")}}},_isActive:function(){var b=a.document.activeElement;return this._element===b||this._element.contains(b)},_setLayout:function(a,b,c){var d=a.style;d.position=b,d.overflow=c},_setupOpticalViewport:function(a){a.style["-ms-overflow-style"]="none",c.isPhone||(a.style["-ms-content-zooming"]="zoom",a.style["-ms-content-zoom-limit-min"]="99%",a.style["-ms-content-zoom-limit-max"]="101%",a.style["-ms-content-zoom-snap-points"]="snapList(100%)",a.style["-ms-content-zoom-snap-type"]="mandatory")},_setVisibility:function(){function a(a,b){a.style.visibility=b?"visible":"hidden"}a(this._opticalViewportIn,!this._zoomedOut||c.isPhone),a(this._opticalViewportOut,this._zoomedOut),this._opticalViewportIn.setAttribute("aria-hidden",!!this._zoomedOut),this._opticalViewportOut.setAttribute("aria-hidden",!this._zoomedOut)},_resetPointerRecords:function(){this._pinchedDirection=ca.none,this._pointerCount=0,this._pointerRecords={},this._resetPinchDistanceRecords()},_releasePointerCapture:function(a){var b=a.pointerId;try{n._releasePointerCapture(this._hiddenElement,b)}catch(c){}},_attemptRecordReset:function(){this._recordResetPromise&&this._recordResetPromise.cancel();var a=this;this._recordResetPromise=k.timeout(ba).then(function(){0===a._pointerCount&&(a._resetPointerRecords(),a._recordResetPromise=null)})},_resetPinchDistanceRecords:function(){this._lastPinchDirection=ca.none,this._lastPinchDistance=-1,this._lastLastPinchDistance=-1,this._pinchDistanceCount=0,this._currentMidPoint=null},_getPointerLocation:function(a){var b={left:0,top:0};try{b=this._element.getBoundingClientRect()}catch(c){}var d=n._getComputedStyle(this._element,null),e=w(this._element,d.paddingLeft),f=w(this._element,d.paddingTop),g=w(this._element,d.borderLeftWidth);return{x:+a.clientX===a.clientX?a.clientX-b.left-e-g:0,y:+a.clientY===a.clientY?a.clientY-b.top-f-f:0}},_playBounce:function(a,b){if(i.isAnimationEnabled()&&this._isBouncingIn!==a){this._clearTimeout(this._completeZoomTimer),this._clearTimeout(this._TTFFTimer),this._isBouncing=!0,this._isBouncingIn=a,a?this._bounceCenter=b:this._aligned=!0;var c=this._zoomedOut?this._canvasOut:this._canvasIn,d=this._zoomedOut?this._canvasLeftOut:this._canvasLeftIn,e=this._zoomedOut?this._canvasTopOut:this._canvasTopIn;c.style[z["transform-origin"].scriptName]=d+this._bounceCenter.x+"px "+(e+this._bounceCenter.y)+"px",c.style[Y]=a?u():v(),this._zoomedOut?this._viewOut.beginZoom():this._viewIn.beginZoom();var f=a?this._zoomedOut?2-J:J:1;x(c,f),this.setTimeoutAfterTTFF(this._onBounceAnimationComplete.bind(this),i._animationTimeAdjustment(S))}},_rtl:function(){return"rtl"===n._getComputedStyle(this._element,null).direction},_pinching:{set:function(a){this._viewIn.pinching=a,this._viewOut.pinching=a}}});return b.Class.mix(ha,e.createEventProperties("zoomchanged")),b.Class.mix(ha,l.DOMEventMixin),ha})})}),d("WinJS/Controls/Pivot/_Constants",["require","exports"],function(a,b){b._ClassNames={pivot:"win-pivot",pivotCustomHeaders:"win-pivot-customheaders",pivotLocked:"win-pivot-locked",pivotTitle:"win-pivot-title",pivotHeaderArea:"win-pivot-header-area",pivotHeaderLeftCustom:"win-pivot-header-leftcustom",pivotHeaderRightCustom:"win-pivot-header-rightcustom",pivotHeaderItems:"win-pivot-header-items",pivotHeaders:"win-pivot-headers",pivotHeader:"win-pivot-header",pivotHeaderSelected:"win-pivot-header-selected",pivotViewport:"win-pivot-viewport",
pivotSurface:"win-pivot-surface",pivotNoSnap:"win-pivot-nosnap",pivotNavButton:"win-pivot-navbutton",pivotNavButtonPrev:"win-pivot-navbutton-prev",pivotNavButtonNext:"win-pivot-navbutton-next",pivotShowNavButtons:"win-pivot-shownavbuttons",pivotInputTypeMouse:"win-pivot-mouse",pivotInputTypeTouch:"win-pivot-touch",pivotDisableContentSwipeNavigation:"win-pivot-disablecontentswipenavigation"}}),d("WinJS/Controls/Pivot/_Item",["exports","../../Core/_Global","../../Core/_Base","../../Core/_BaseUtils","../../Core/_ErrorFromName","../../Core/_Resources","../../ControlProcessor","../../Promise","../../Scheduler","../../Utilities/_Control","../../Utilities/_Dispose","../../Utilities/_ElementUtilities","./_Constants"],function(a,b,c,d,e,f,g,h,i,j,k,l,m){"use strict";c.Namespace._moduleDefine(a,"WinJS.UI",{PivotItem:c.Namespace._lazy(function(){var a={get duplicateConstruction(){return"Invalid argument: Controls may only be instantiated one time for each DOM element"}},f=c.Class.define(function(c,d){if(c=c||b.document.createElement("DIV"),d=d||{},c.winControl)throw new e("WinJS.UI.PivotItem.DuplicateConstruction",a.duplicateConstruction);c.winControl=this,this._element=c,l.addClass(this.element,f._ClassName.pivotItem),l.addClass(this.element,"win-disposable"),this._element.setAttribute("role","tabpanel"),this._contentElement=b.document.createElement("DIV"),this._contentElement.className=f._ClassName.pivotItemContent,c.appendChild(this._contentElement);for(var h=this.element.firstChild;h!==this._contentElement;){var i=h.nextSibling;this._contentElement.appendChild(h),h=i}this._processors=[g.processAll],j.setOptions(this,d)},{element:{get:function(){return this._element}},contentElement:{get:function(){return this._contentElement}},header:{get:function(){return this._header},set:function(a){this._header=a,this._parentPivot&&this._parentPivot._headersState.handleHeaderChanged(this)}},_parentPivot:{get:function(){for(var a=this._element;a&&!l.hasClass(a,m._ClassNames.pivot);)a=a.parentNode;return a&&a.winControl}},_process:function(){var a=this;return this._processors&&this._processors.push(function(){return i.schedulePromiseAboveNormal()}),this._processed=(this._processors||[]).reduce(function(b,c){return b.then(function(){return c(a.contentElement)})},this._processed||h.as()),this._processors=null,this._processed},dispose:function(){this._disposed||(this._disposed=!0,this._processors=null,k.disposeSubTree(this.contentElement))}},{_ClassName:{pivotItem:"win-pivot-item",pivotItemContent:"win-pivot-item-content"},isDeclarativeControlContainer:d.markSupportedForProcessing(function(a,b){b!==g.processAll&&(a._processors=a._processors||[],a._processors.push(b),a._processed&&a._process())})});return f})})}),d("require-style!less/styles-pivot",[],function(){}),d("require-style!less/colors-pivot",[],function(){});var e=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};d("WinJS/Controls/Pivot/_Pivot",["require","exports","../../Core/_Global","../../Animations","../../BindingList","../../ControlProcessor","../../Promise","../../Scheduler","../../Core/_Base","../../Core/_BaseUtils","../../Utilities/_Control","../../Utilities/_Dispose","../ElementResizeInstrument","../../Utilities/_ElementUtilities","../../Core/_ErrorFromName","../../Core/_Events","../../Utilities/_Hoverable","../../Utilities/_KeyboardBehavior","../../Core/_Log","../../Core/_Resources","../../Animations/_TransitionAnimation","../../Core/_WriteProfilerMark","./_Constants"],function(a,b,c,d,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x){function y(a){var b=c.document.createTextNode("object"==typeof a.header?JSON.stringify(a.header):""+a.header);return b}r.isHoverable,a(["require-style!less/styles-pivot"]),a(["require-style!less/colors-pivot"]);var z={selectionChanged:"selectionchanged",itemAnimationStart:"itemanimationstart",itemAnimationEnd:"itemanimationend"},A={get duplicateConstruction(){return"Invalid argument: Controls may only be instantiated one time for each DOM element"},get duplicateItem(){return u._getWinJSString("ui/duplicateItem").value},get invalidContent(){return"Invalid content: Pivot content must be made up of PivotItems."},get pivotAriaLabel(){return u._getWinJSString("ui/pivotAriaLabel").value},get pivotViewportAriaLabel(){return u._getWinJSString("ui/pivotViewportAriaLabel").value}},B=!!(o._supportsSnapPoints&&"inertiaDestinationX"in c.MSManipulationEvent.prototype),C=o._MSPointerEvent.MSPOINTER_TYPE_MOUSE||"mouse",D=o._MSPointerEvent.MSPOINTER_TYPE_TOUCH||"touch",E=o.Key,F=250,G=-1,H=function(){function a(a,b){var d=this;if(void 0===b&&(b={}),this._disposed=!1,this._firstLoad=!0,this._hidePivotItemAnimation=h.wrap(),this._loadPromise=h.wrap(),this._pendingRefresh=!1,this._selectedIndex=0,this._showPivotItemAnimation=h.wrap(),this._slideHeadersAnimation=h.wrap(),a=a||c.document.createElement("DIV"),a.winControl)throw new p("WinJS.UI.Pivot.DuplicateConstruction",A.duplicateConstruction);this._handleItemChanged=this._handleItemChanged.bind(this),this._handleItemInserted=this._handleItemInserted.bind(this),this._handleItemMoved=this._handleItemMoved.bind(this),this._handleItemRemoved=this._handleItemRemoved.bind(this),this._handleItemReload=this._handleItemReload.bind(this),this._resizeHandler=this._resizeHandler.bind(this),this._updatePointerType=this._updatePointerType.bind(this),this._id=a.id||o._uniqueID(a),this._writeProfilerMark("constructor,StartTM"),a.winControl=this,this._element=a,this._element.setAttribute("role","tablist"),this._element.getAttribute("aria-label")||this._element.setAttribute("aria-label",A.pivotAriaLabel),o.addClass(this.element,x._ClassNames.pivot),o.addClass(this.element,"win-disposable"),o._addEventListener(this.element,"pointerenter",this._updatePointerType),o._addEventListener(this.element,"pointerout",this._updatePointerType),this._titleElement=c.document.createElement("DIV"),this._titleElement.style.display="none",o.addClass(this._titleElement,x._ClassNames.pivotTitle),this._element.appendChild(this._titleElement),this._headerAreaElement=c.document.createElement("DIV"),o.addClass(this._headerAreaElement,x._ClassNames.pivotHeaderArea),this._element.appendChild(this._headerAreaElement),this._headerItemsElement=c.document.createElement("DIV"),o.addClass(this._headerItemsElement,x._ClassNames.pivotHeaderItems),this._headerAreaElement.appendChild(this._headerItemsElement),this._headerItemsElWidth=null,this._headersContainerElement=c.document.createElement("DIV"),this._headersContainerElement.tabIndex=0,o.addClass(this._headersContainerElement,x._ClassNames.pivotHeaders),this._headersContainerElement.addEventListener("keydown",this._headersKeyDown.bind(this)),o._addEventListener(this._headersContainerElement,"pointerenter",this._showNavButtons.bind(this)),o._addEventListener(this._headersContainerElement,"pointerout",this._hideNavButtons.bind(this)),this._headerItemsElement.appendChild(this._headersContainerElement),this._element.addEventListener("click",this._elementClickedHandler.bind(this)),this._winKeyboard=new s._WinKeyboard(this._headersContainerElement),this._customLeftHeader=c.document.createElement("DIV"),o.addClass(this._customLeftHeader,x._ClassNames.pivotHeaderLeftCustom),this._headerAreaElement.insertBefore(this._customLeftHeader,this._headerAreaElement.children[0]),this._customRightHeader=c.document.createElement("DIV"),o.addClass(this._customRightHeader,x._ClassNames.pivotHeaderRightCustom),this._headerAreaElement.appendChild(this._customRightHeader),this._viewportElement=c.document.createElement("DIV"),this._viewportElement.className=x._ClassNames.pivotViewport,this._element.appendChild(this._viewportElement),this._viewportElement.setAttribute("role","group"),this._viewportElement.setAttribute("aria-label",A.pivotViewportAriaLabel),this._elementResizeInstrument=new n._ElementResizeInstrument,this._element.appendChild(this._elementResizeInstrument.element),this._elementResizeInstrument.addEventListener("resize",this._resizeHandler),o._inDom(this._element).then(function(){d._disposed||d._elementResizeInstrument.addedToDom()}),o._resizeNotifier.subscribe(this.element,this._resizeHandler),this._viewportElWidth=null,this._surfaceElement=c.document.createElement("DIV"),this._surfaceElement.className=x._ClassNames.pivotSurface,this._viewportElement.appendChild(this._surfaceElement),this._headersState=new I(this),B?this._viewportElement.addEventListener("MSManipulationStateChanged",this._MSManipulationStateChangedHandler.bind(this)):(o.addClass(this.element,x._ClassNames.pivotNoSnap),o._addEventListener(this._element,"pointerdown",this._elementPointerDownHandler.bind(this)),o._addEventListener(this._element,"pointerup",this._elementPointerUpHandler.bind(this))),this._parse(),b=k._shallowCopy(b),b.items&&(this.items=b.items,delete b.items),l.setOptions(this,b),this._refresh(),this._writeProfilerMark("constructor,StopTM")}return Object.defineProperty(a.prototype,"element",{get:function(){return this._element},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"customLeftHeader",{get:function(){return this._customLeftHeader.firstElementChild},set:function(a){o.empty(this._customLeftHeader),a?(this._customLeftHeader.appendChild(a),o.addClass(this._element,x._ClassNames.pivotCustomHeaders)):this._customLeftHeader.children.length||this._customRightHeader.childNodes.length||o.removeClass(this._element,x._ClassNames.pivotCustomHeaders),this.forceLayout()},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"customRightHeader",{get:function(){return this._customRightHeader.firstElementChild},set:function(a){o.empty(this._customRightHeader),a?(this._customRightHeader.appendChild(a),o.addClass(this._element,x._ClassNames.pivotCustomHeaders)):this._customLeftHeader.children.length||this._customRightHeader.childNodes.length||o.removeClass(this._element,x._ClassNames.pivotCustomHeaders),this.forceLayout()},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"locked",{get:function(){return o.hasClass(this.element,x._ClassNames.pivotLocked)},set:function(a){o[a?"addClass":"removeClass"](this.element,x._ClassNames.pivotLocked),a&&this._hideNavButtons()},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"items",{get:function(){return this._pendingItems?this._pendingItems:this._items},set:function(a){this._pendingItems=a,this._refresh()},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"title",{get:function(){return this._titleElement.textContent},set:function(a){a?(this._titleElement.style.display="block",this._titleElement.textContent=a):(this._titleElement.style.display="none",this._titleElement.textContent="")},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"selectedIndex",{get:function(){return 0===this.items.length?-1:this._selectedIndex},set:function(a){a>=0&&a<this.items.length&&(this._pendingRefresh?this._selectedIndex=a:this._loadItem(a))},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"selectedItem",{get:function(){return this.items.getAt(this.selectedIndex)},set:function(a){var b=this.items.indexOf(a);-1!==b&&(this.selectedIndex=b)},enumerable:!0,configurable:!0}),a.prototype.dispose=function(){if(!this._disposed){this._disposed=!0,this._updateEvents(this._items,null),o._resizeNotifier.unsubscribe(this.element,this._resizeHandler),this._elementResizeInstrument.dispose(),this._headersState.exit(),m._disposeElement(this._headersContainerElement);for(var a=0,b=this.items.length;b>a;a++)this.items.getAt(a).dispose()}},a.prototype.forceLayout=function(){this._disposed||this._resizeHandler()},a.prototype._applyProperties=function(){function a(a){for(var b=0,c=a.items.length;c>b;b++){var d=a._items.getAt(b);if(d.element.parentNode===a._surfaceElement)throw new p("WinJS.UI.Pivot.DuplicateItem",A.duplicateItem);d.element.style.display="none",a._surfaceElement.appendChild(d.element)}}if(!this._disposed){if(this._pendingItems){for(this._updateEvents(this._items,this._pendingItems),this._items=this._pendingItems,this._pendingItems=null;this.element.firstElementChild!==this._titleElement;){var b=this.element.firstElementChild;b.parentNode.removeChild(b)}o.empty(this._surfaceElement)}a(this),this._rtl="rtl"===o._getComputedStyle(this._element,null).direction,this._headersState.refreshHeadersState(!0),this._pendingRefresh=!1,this._firstLoad=!0,this.selectedIndex=this._selectedIndex,this._firstLoad=!1,this._recenterViewport()}},a.prototype._parse=function(){for(var a=[],b=this.element.firstElementChild;b!==this._titleElement;){g.processAll(b);var c=b.winControl;if(!c)throw new p("WinJS.UI.Pivot.InvalidContent",A.invalidContent);a.push(c);var d=b.nextElementSibling;b=d}this.items=new f.List(a)},a.prototype._refresh=function(){this._pendingRefresh||(this._pendingRefresh=!0,i.schedule(this._applyProperties.bind(this),i.Priority.high))},a.prototype._resizeHandler=function(){if(!this._disposed&&!this._pendingRefresh){var a=this._getViewportWidth(),b=this._getHeaderItemsWidth();this._invalidateMeasures(),a!==this._getViewportWidth()||b!==this._getHeaderItemsWidth()?(t.log&&t.log("_resizeHandler, viewport from:"+a+" to: "+this._getViewportWidth()),t.log&&t.log("_resizeHandler, headers from:"+b+" to: "+this._getHeaderItemsWidth()),this._hidePivotItemAnimation&&this._hidePivotItemAnimation.cancel(),this._showPivotItemAnimation&&this._showPivotItemAnimation.cancel(),this._slideHeadersAnimation&&this._slideHeadersAnimation.cancel(),this._recenterViewport(),this._headersState.handleResize()):t.log&&t.log("_resizeHandler worthless resize")}},a.prototype._activateHeader=function(a){if(!this.locked){var b=this._items.indexOf(a._item);b!==this.selectedIndex?this._headersState.activateHeader(a):o._setActiveFirstFocusableElement(this.selectedItem.element)}},a.prototype._goNext=function(){this.selectedIndex<this._items.length-1?this.selectedIndex++:this.selectedIndex=0},a.prototype._goPrevious=function(){this._animateToPrevious=!0,this.selectedIndex>0?this.selectedIndex--:this.selectedIndex=this._items.length-1,this._animateToPrevious=!1},a.prototype._loadItem=function(a){var b=this;this._rtl="rtl"===o._getComputedStyle(this._element,null).direction,this._hidePivotItemAnimation.cancel(),this._showPivotItemAnimation.cancel(),this._slideHeadersAnimation.cancel();var c=this._animateToPrevious,d=this._items.getAt(a),e=this._firstLoad,f=this._loadPromise=this._loadPromise.then(function(){var g=b._items.getAt(b.selectedIndex);g&&b._hidePivotItem(g.element,c,e);var i=b._selectedIndex;b._selectedIndex=a;var j={index:a,direction:c?"backwards":"forward",item:d};return b._fireEvent(z.selectionChanged,!0,!1,j),b._headersState.handleNavigation(c,a,i),h.join([d._process(),b._hidePivotItemAnimation,h.timeout()]).then(function(){return b._disposed||b._loadPromise!==f?void 0:(b._recenterViewport(),b._showPivotItem(d.element,c,e).then(function(){b._disposed||b._loadPromise!==f||(b._loadPromise=h.wrap(),b._writeProfilerMark("itemAnimationStop,info"),b._fireEvent(z.itemAnimationEnd,!0,!1,null))}))})})},a.prototype._recenterViewport=function(){o.setScrollPosition(this._viewportElement,{scrollLeft:this._getViewportWidth()}),this.selectedItem&&(this.selectedItem.element.style[this._getDirectionAccessor()]=this._getViewportWidth()+"px")},a.prototype._fireEvent=function(a,b,d,e){var f=c.document.createEvent("CustomEvent");return f.initCustomEvent(a,!!b,!!d,e),this.element.dispatchEvent(f)},a.prototype._getDirectionAccessor=function(){return this._rtl?"right":"left"},a.prototype._getHeaderItemsWidth=function(){return this._headerItemsElWidth||(this._headerItemsElWidth=parseFloat(o._getComputedStyle(this._headerItemsElement).width)),this._headerItemsElWidth||G},a.prototype._getViewportWidth=function(){return this._viewportElWidth||(this._viewportElWidth=parseFloat(o._getComputedStyle(this._viewportElement).width),B&&(this._viewportElement.style[k._browserStyleEquivalents["scroll-snap-points-x"].scriptName]="snapInterval(0%, "+Math.ceil(this._viewportElWidth)+"px)")),this._viewportElWidth||G},a.prototype._invalidateMeasures=function(){this._viewportElWidth=this._headerItemsElWidth=null},a.prototype._updateEvents=function(a,b){a&&(a.removeEventListener("itemchanged",this._handleItemChanged),a.removeEventListener("iteminserted",this._handleItemInserted),a.removeEventListener("itemmoved",this._handleItemMoved),a.removeEventListener("itemremoved",this._handleItemRemoved),a.removeEventListener("reload",this._handleItemReload)),b&&(b.addEventListener("itemchanged",this._handleItemChanged),b.addEventListener("iteminserted",this._handleItemInserted),b.addEventListener("itemmoved",this._handleItemMoved),b.addEventListener("itemremoved",this._handleItemRemoved),b.addEventListener("reload",this._handleItemReload))},a.prototype._writeProfilerMark=function(a){var b="WinJS.UI.Pivot:"+this._id+":"+a;w(b),t.log&&t.log(b,null,"pivotprofiler")},a.prototype._handleItemChanged=function(a){if(!this._pendingItems){var b=a.detail.index,c=a.detail.newValue,d=a.detail.oldValue;if(c.element!==d.element){if(c.element.parentNode===this._surfaceElement)throw new p("WinJS.UI.Pivot.DuplicateItem",A.duplicateItem);c.element.style.display="none",this._surfaceElement.insertBefore(c.element,d.element),this._surfaceElement.removeChild(d.element),b===this.selectedIndex&&(this.selectedIndex=b)}this._headersState.render(),this._headersState.refreshHeadersState(!0)}},a.prototype._handleItemInserted=function(a){if(!this._pendingItems){var b=a.detail.index,c=a.detail.value;if(c.element.parentNode===this._surfaceElement)throw new p("WinJS.UI.Pivot.DuplicateItem",A.duplicateItem);c.element.style.display="none",b<this.items.length-1?this._surfaceElement.insertBefore(c.element,this.items.getAt(b+1).element):this._surfaceElement.appendChild(c.element),b<=this.selectedIndex&&this._selectedIndex++,1===this._items.length&&(this.selectedIndex=0),this._headersState.render(),this._headersState.refreshHeadersState(!0)}},a.prototype._handleItemMoved=function(a){if(!this._pendingItems){var b=a.detail.oldIndex,c=a.detail.newIndex,d=a.detail.value;c<this.items.length-1?this._surfaceElement.insertBefore(d.element,this.items.getAt(c+1).element):this._surfaceElement.appendChild(d.element),b<this.selectedIndex&&c>=this.selectedIndex?this._selectedIndex--:c>this.selectedIndex&&b<=this.selectedIndex?this._selectedIndex++:b===this.selectedIndex&&(this.selectedIndex=this.selectedIndex),this._headersState.render(),this._headersState.refreshHeadersState(!0)}},a.prototype._handleItemReload=function(){this.items=this.items},a.prototype._handleItemRemoved=function(a){if(!this._pendingItems){var b=a.detail.value,c=a.detail.index;this._surfaceElement.removeChild(b.element),c<this.selectedIndex?this._selectedIndex--:c===this._selectedIndex&&(this.selectedIndex=Math.min(this.items.length-1,this._selectedIndex)),this._headersState.render(),this._headersState.refreshHeadersState(!0)}},a.prototype._elementClickedHandler=function(a){if(this.locked||this._navigationHandled)return void(this._navigationHandled=!1);var b,c=a.target;if(o.hasClass(c,x._ClassNames.pivotHeader))b=c;else{var d=!1,e=o._elementsFromPoint(a.clientX,a.clientY);if(e&&e[0]===this._viewportElement)for(var f=0,g=e.length;g>f;f++)e[f]===c&&(d=!0),o.hasClass(e[f],x._ClassNames.pivotHeader)&&(b=e[f]);d||(b=null)}b&&this._activateHeader(b)},a.prototype._elementPointerDownHandler=function(a){if(!B){var b=a.target;this._elementPointerDownPoint={x:a.clientX,y:a.clientY,type:a.pointerType||"mouse",time:Date.now(),inHeaders:this._headersContainerElement.contains(b)}}},a.prototype._elementPointerUpHandler=function(a){if(!this._elementPointerDownPoint||this.locked)return void(this._elementPointerDownPoint=null);var b=a.target,c=32,d=.4,e=Math.abs(a.clientY-this._elementPointerDownPoint.y),f=a.clientX-this._elementPointerDownPoint.x,g=Math.abs(f*d),h=g>e&&Math.abs(f)>c&&(!o._supportsTouchDetection||this._elementPointerDownPoint.type===a.pointerType&&a.pointerType===D)&&(!this.element.classList.contains(x._ClassNames.pivotDisableContentSwipeNavigation)||this._elementPointerDownPoint.inHeaders&&this._headersContainerElement.contains(b));if(this._navigationHandled=!1,h){var i=Date.now()-this._elementPointerDownPoint.time;f*=Math.max(1,Math.pow(350/i,2)),f=this._rtl?-f:f;var j=this._getViewportWidth()/4;-j>f?(this._goNext(),this._navigationHandled=!0):f>j&&(this._goPrevious(),this._navigationHandled=!0)}if(!this._navigationHandled){for(;null!==b&&!o.hasClass(b,x._ClassNames.pivotHeader);)b=b.parentElement;null!==b&&(this._activateHeader(b),this._navigationHandled=!0)}this._elementPointerDownPoint=null},a.prototype._headersKeyDown=function(a){this.locked||(a.keyCode===E.leftArrow||a.keyCode===E.pageUp?(this._rtl?this._goNext():this._goPrevious(),a.preventDefault()):(a.keyCode===E.rightArrow||a.keyCode===E.pageDown)&&(this._rtl?this._goPrevious():this._goNext(),a.preventDefault()))},a.prototype._hideNavButtons=function(a){a&&this._headersContainerElement.contains(a.relatedTarget)||o.removeClass(this._headersContainerElement,x._ClassNames.pivotShowNavButtons)},a.prototype._hidePivotItem=function(a,b,c){return c||!v.isAnimationEnabled()?(a.style.display="none",this._hidePivotItemAnimation=h.wrap(),this._hidePivotItemAnimation):(this._hidePivotItemAnimation=v.executeTransition(a,{property:"opacity",delay:0,duration:67,timing:"linear",from:"",to:"0"}).then(function(){a.style.display="none"}),this._hidePivotItemAnimation)},a.prototype._MSManipulationStateChangedHandler=function(a){if(a.target===this._viewportElement&&a.currentState===o._MSManipulationEvent.MS_MANIPULATION_STATE_INERTIA){var b=a.inertiaDestinationX-this._getViewportWidth();b>0?this._goNext():0>b&&this._goPrevious()}},a.prototype._updatePointerType=function(a){this._pointerType!==(a.pointerType||C)&&(this._pointerType=a.pointerType||C,this._pointerType===D?(o.removeClass(this.element,x._ClassNames.pivotInputTypeMouse),o.addClass(this.element,x._ClassNames.pivotInputTypeTouch),this._hideNavButtons()):(o.removeClass(this.element,x._ClassNames.pivotInputTypeTouch),o.addClass(this.element,x._ClassNames.pivotInputTypeMouse)))},a.prototype._showNavButtons=function(a){this.locked||a&&a.pointerType===D||o.addClass(this._headersContainerElement,x._ClassNames.pivotShowNavButtons)},a.prototype._showPivotItem=function(a,b,c){function e(a){var b=a.getBoundingClientRect();return b.top<g.bottom&&b.bottom>g.top}if(this._writeProfilerMark("itemAnimationStart,info"),this._fireEvent(z.itemAnimationStart,!0,!1,null),a.style.display="",c||!v.isAnimationEnabled())return a.style.opacity="",this._showPivotItemAnimation=h.wrap(),this._showPivotItemAnimation;var f=this._rtl?!b:b,g=this._viewportElement.getBoundingClientRect(),i=a.querySelectorAll(".win-pivot-slide1"),j=a.querySelectorAll(".win-pivot-slide2"),l=a.querySelectorAll(".win-pivot-slide3");return i=Array.prototype.filter.call(i,e),j=Array.prototype.filter.call(j,e),l=Array.prototype.filter.call(l,e),this._showPivotItemAnimation=h.join([v.executeTransition(a,{property:"opacity",delay:0,duration:333,timing:"cubic-bezier(0.1,0.9,0.2,1)",from:"0",to:""}),v.executeTransition(a,{property:k._browserStyleEquivalents.transform.cssName,delay:0,duration:767,timing:"cubic-bezier(0.1,0.9,0.2,1)",from:"translateX("+(f?"-20px":"20px")+")",to:""}),d[f?"slideRightIn":"slideLeftIn"](null,i,j,l)]),this._showPivotItemAnimation},a.supportedForProcessing=!0,a._ClassNames=x._ClassNames,a._EventNames=z,a}();b.Pivot=H;var I=function(){function a(a){this.pivot=a}return a.prototype.exit=function(){},a.prototype.render=function(a){},a.prototype.activateHeader=function(a){},a.prototype.handleNavigation=function(a,b,c){},a.prototype.handleResize=function(){},a.prototype.handleHeaderChanged=function(a){},a.prototype.getCumulativeHeaderWidth=function(b){if(0===b)return 0;for(var c=this.pivot._headersContainerElement.children.length,d=0;b>d;d++){var e=this.renderHeader(d,!1);this.pivot._headersContainerElement.appendChild(e)}var f=0,g=this.pivot._rtl?this.pivot._headersContainerElement.lastElementChild:this.pivot._headersContainerElement.children[c],h=this.pivot._rtl?this.pivot._headersContainerElement.children[c]:this.pivot._headersContainerElement.lastElementChild;f=h.offsetLeft+h.offsetWidth-g.offsetLeft,f+=2*a.headerHorizontalMargin;for(var d=0;b>d;d++)this.pivot._headersContainerElement.removeChild(this.pivot._headersContainerElement.lastElementChild);return f},a.prototype.refreshHeadersState=function(a){a&&(this.cachedHeaderWidth=0);var b=this.cachedHeaderWidth||this.getCumulativeHeaderWidth(this.pivot.items.length);this.cachedHeaderWidth=b,b>this.pivot._getHeaderItemsWidth()&&!(this.pivot._headersState instanceof K)?(this.exit(),this.pivot._headersState=new K(this.pivot)):b<=this.pivot._getHeaderItemsWidth()&&!(this.pivot._headersState instanceof J)&&(this.exit(),this.pivot._headersState=new J(this.pivot))},a.prototype.renderHeader=function(b,d){function e(){f.pivot._disposed||f.pivot._headersContainerElement.contains(i)&&b!==f.pivot.selectedIndex&&"true"===i.getAttribute("aria-selected")&&(f.pivot.selectedIndex=b)}var f=this,g=o._syncRenderer(y),h=this.pivot.items.getAt(b),i=c.document.createElement("BUTTON");return i.tabIndex=-1,i.setAttribute("type","button"),i.style.marginLeft=i.style.marginRight=a.headerHorizontalMargin+"px",o.addClass(i,x._ClassNames.pivotHeader),i._item=h,i._pivotItemIndex=b,g(h,i),d&&(i.setAttribute("aria-selected",""+(b===this.pivot.selectedIndex)),i.setAttribute("role","tab"),new o._MutationObserver(e).observe(i,{attributes:!0,attributeFilter:["aria-selected"]})),i},a.prototype.updateHeader=function(a){var b=this.pivot.items.indexOf(a),c=this.pivot._headersContainerElement.children[b];c.innerHTML="";var d=o._syncRenderer(y);d(a,c)},a.prototype.setActiveHeader=function(a){var b=!1,d=this.pivot._headersContainerElement.querySelector("."+x._ClassNames.pivotHeaderSelected);d&&(d.classList.remove(x._ClassNames.pivotHeaderSelected),d.setAttribute("aria-selected","false"),b=this.pivot._headersContainerElement.contains(c.document.activeElement)),a.classList.add(x._ClassNames.pivotHeaderSelected),a.setAttribute("aria-selected","true"),b&&this.pivot._headersContainerElement.focus()},a.headersContainerLeadingMargin=12,a.headerHorizontalMargin=12,a}(),J=function(a){function b(b){if(a.call(this,b),this._firstRender=!0,this._transitionAnimation=h.wrap(),b._headersContainerElement.children.length&&v.isAnimationEnabled()){var c=b._headersContainerElement.querySelector("."+x._ClassNames.pivotHeaderSelected),d=0,e=0;b._rtl?(d=c.offsetLeft+c.offsetWidth+I.headerHorizontalMargin,e=b._getHeaderItemsWidth()-this.getCumulativeHeaderWidth(b.selectedIndex)-I.headersContainerLeadingMargin,e+=parseFloat(b._headersContainerElement.style.marginLeft)):(d=c.offsetLeft,d+=parseFloat(b._headersContainerElement.style.marginLeft),e=this.getCumulativeHeaderWidth(b.selectedIndex)+I.headersContainerLeadingMargin+I.headerHorizontalMargin);var f=d-e;this.render();for(var g=k._browserStyleEquivalents.transform.cssName,i="translateX("+f+"px)",j=0,l=b._headersContainerElement.children.length;l>j;j++)b._headersContainerElement.children[j].style[g]=i;this._transitionAnimation=v.executeTransition(b._headersContainerElement.querySelectorAll("."+x._ClassNames.pivotHeader),{property:g,delay:0,duration:F,timing:"ease-out",to:""})}else this.render()}return e(b,a),b.prototype.exit=function(){this._transitionAnimation.cancel()},b.prototype.render=function(){var a=this.pivot;if(!a._pendingRefresh&&a._items){if(m._disposeElement(a._headersContainerElement),o.empty(a._headersContainerElement),a._rtl?(a._headersContainerElement.style.marginLeft="0px",a._headersContainerElement.style.marginRight=I.headersContainerLeadingMargin+"px"):(a._headersContainerElement.style.marginLeft=I.headersContainerLeadingMargin+"px",a._headersContainerElement.style.marginRight="0px"),a._viewportElement.style.overflow=1===a.items.length?"hidden":"",a.items.length)for(var b=0;b<a.items.length;b++){var c=this.renderHeader(b,!0);a._headersContainerElement.appendChild(c),b===a.selectedIndex&&c.classList.add(x._ClassNames.pivotHeaderSelected)}this._firstRender=!1}},b.prototype.activateHeader=function(a){this.setActiveHeader(a),this.pivot._animateToPrevious=a._pivotItemIndex<this.pivot.selectedIndex,this.pivot.selectedIndex=a._pivotItemIndex,this.pivot._animateToPrevious=!1},b.prototype.handleNavigation=function(a,b,c){this._firstRender&&this.render(),this.setActiveHeader(this.pivot._headersContainerElement.children[b])},b.prototype.handleResize=function(){this.refreshHeadersState(!1)},b.prototype.handleHeaderChanged=function(a){this.updateHeader(a),this.refreshHeadersState(!0)},b}(I),K=function(a){function b(b){if(a.call(this,b),this._blocked=!1,this._firstRender=!0,this._transitionAnimation=h.wrap(),b._slideHeadersAnimation=h.wrap(),b._headersContainerElement.children.length&&v.isAnimationEnabled()){var c=this,d=function(){c._blocked=!1,c.render()};this._blocked=!0;var e=b._headersContainerElement.querySelector("."+x._ClassNames.pivotHeaderSelected),f=0,g=0;b._rtl?(f=b._getHeaderItemsWidth()-I.headersContainerLeadingMargin,g=e.offsetLeft,g+=I.headerHorizontalMargin,g+=e.offsetWidth,g+=parseFloat(b._headersContainerElement.style.marginLeft)):(f=I.headersContainerLeadingMargin,g=e.offsetLeft,g-=I.headerHorizontalMargin,g+=parseFloat(b._headersContainerElement.style.marginLeft));for(var i=f-g,j=0;j<b.selectedIndex;j++)b._headersContainerElement.appendChild(b._headersContainerElement.children[j].cloneNode(!0));var l=k._browserStyleEquivalents.transform.cssName;this._transitionAnimation=v.executeTransition(b._headersContainerElement.querySelectorAll("."+x._ClassNames.pivotHeader),{property:l,delay:0,duration:F,timing:"ease-out",to:"translateX("+i+"px)"}).then(d,d)}else this.render()}return e(b,a),b.prototype.exit=function(){this._transitionAnimation.cancel(),this.pivot._slideHeadersAnimation.cancel()},b.prototype.render=function(a){var b=this.pivot;if(!this._blocked&&!b._pendingRefresh&&b._items){var d=b._headersContainerElement.contains(c.document.activeElement);if(m._disposeElement(b._headersContainerElement),o.empty(b._headersContainerElement),1===b._items.length){var e=this.renderHeader(0,!0);e.classList.add(x._ClassNames.pivotHeaderSelected),b._headersContainerElement.appendChild(e),b._viewportElement.style.overflow="hidden",b._headersContainerElement.style.marginLeft="0px",b._headersContainerElement.style.marginRight="0px"}else if(b._items.length>1){var f=b._items.length+(a?2:1),g=.8*b._getHeaderItemsWidth(),h=b.selectedIndex-1;b._viewportElement.style.overflow&&(b._viewportElement.style.overflow="");for(var i=0;f>i;i++){-1===h?h=b._items.length-1:h===b._items.length&&(h=0);var e=this.renderHeader(h,!0);b._headersContainerElement.appendChild(e),e.offsetWidth>g&&(e.style.textOverflow="ellipsis",e.style.width=g+"px"),h===b.selectedIndex&&e.classList.add(x._ClassNames.pivotHeaderSelected),h++}if(!b._firstLoad&&!this._firstRender){var j,l;a?(j="",l="0"):(j="0",l="");var n=b._headersContainerElement.children[f-1];n.style.opacity=j;var p=.167;n.style[k._browserStyleEquivalents.transition.scriptName]="opacity "+v._animationTimeAdjustment(p)+"s",o._getComputedStyle(n).opacity,n.style.opacity=l}b._headersContainerElement.children[0].setAttribute("aria-hidden","true"),b._headersContainerElement.style.marginLeft="0px",b._headersContainerElement.style.marginRight="0px";var q=b._rtl?"marginRight":"marginLeft",r=b._headersContainerElement.children[0],s=o.getTotalWidth(r)-I.headersContainerLeadingMargin;if(r!==b._headersContainerElement.children[0])return;b._headersContainerElement.style[q]=-1*s+"px",b._prevButton=c.document.createElement("button"),b._prevButton.setAttribute("type","button"),o.addClass(b._prevButton,x._ClassNames.pivotNavButton),o.addClass(b._prevButton,x._ClassNames.pivotNavButtonPrev),b._prevButton.addEventListener("click",function(){b.locked||(b._rtl?b._goNext():b._goPrevious());
}),b._headersContainerElement.appendChild(b._prevButton),b._prevButton.style.left=b._rtl?"0px":s+"px",b._nextButton=c.document.createElement("button"),b._nextButton.setAttribute("type","button"),o.addClass(b._nextButton,x._ClassNames.pivotNavButton),o.addClass(b._nextButton,x._ClassNames.pivotNavButtonNext),b._nextButton.addEventListener("click",function(){b.locked||(b._rtl?b._goPrevious():b._goNext())}),b._headersContainerElement.appendChild(b._nextButton),b._nextButton.style.right=b._rtl?s+"px":"0px"}b._headersContainerElement.children.length>1?1:0;d&&b._headersContainerElement.focus(),this._firstRender=!1}},b.prototype.activateHeader=function(a){a.previousSibling&&(this.pivot.selectedIndex=a._pivotItemIndex)},b.prototype.handleNavigation=function(a,b,c){function d(a){return j?a.offsetParent.offsetWidth-a.offsetLeft-a.offsetWidth:a.offsetLeft}function e(){g._disposed||(f.render(a),g._slideHeadersAnimation=h.wrap())}var f=this,g=this.pivot;if(this._blocked||0>b||g._firstLoad)return void this.render(a);var i;if(a?i=g._headersContainerElement.children[0]:(c>b&&(b+=g._items.length),i=g._headersContainerElement.children[1+b-c]),!i)return void this.render(a);o.removeClass(g._headersContainerElement.children[1],x._ClassNames.pivotHeaderSelected),o.addClass(i,x._ClassNames.pivotHeaderSelected);var j=g._rtl,l=d(g._headersContainerElement.children[1])-d(i);j&&(l*=-1);var m;m=v.isAnimationEnabled()?v.executeTransition(g._headersContainerElement.querySelectorAll("."+x._ClassNames.pivotHeader),{property:k._browserStyleEquivalents.transform.cssName,delay:0,duration:F,timing:"ease-out",to:"translateX("+l+"px)"}):h.wrap(),g._slideHeadersAnimation=m.then(e,e)},b.prototype.handleResize=function(){this.refreshHeadersState(!1)},b.prototype.handleHeaderChanged=function(a){this.render(),this.refreshHeadersState(!0)},b}(I);j.Class.mix(H,q.createEventProperties(z.itemAnimationEnd,z.itemAnimationStart,z.selectionChanged)),j.Class.mix(H,l.DOMEventMixin)}),d("WinJS/Controls/Pivot",["require","exports","../Core/_Base","./Pivot/_Item"],function(a,b,c,d){d.touch;var e=null;c.Namespace.define("WinJS.UI",{Pivot:{get:function(){return e||a(["./Pivot/_Pivot"],function(a){e=a}),e.Pivot}}})}),d("WinJS/Controls/Hub/_Section",["exports","../../Core/_Global","../../Core/_Base","../../Core/_BaseUtils","../../Core/_ErrorFromName","../../Core/_Resources","../../ControlProcessor","../../Promise","../../Utilities/_Control","../../Utilities/_Dispose","../../Utilities/_ElementUtilities","../../Utilities/_KeyboardBehavior"],function(a,b,c,d,e,f,g,h,i,j,k,l){"use strict";c.Namespace._moduleDefine(a,"WinJS.UI",{HubSection:c.Namespace._lazy(function(){var a={get duplicateConstruction(){return"Invalid argument: Controls may only be instantiated one time for each DOM element"},get seeMore(){return f._getWinJSString("ui/seeMore").value}},m=c.Class.define(function(c,d){if(c=c||b.document.createElement("DIV"),d=d||{},c.winControl)throw new e("WinJS.UI.HubSection.DuplicateConstruction",a.duplicateConstruction);c.winControl=this,this._element=c,k.addClass(this.element,m._ClassName.hubSection),k.addClass(this.element,"win-disposable"),this._headerElement=b.document.createElement("DIV"),this._headerElement.className=m._ClassName.hubSectionHeader,this._headerElement.innerHTML='<button type="button" role="link" class="'+m._ClassName.hubSectionInteractive+" "+m._ClassName.hubSectionHeaderTabStop+'"><div class="'+m._ClassName.hubSectionHeaderWrapper+'" tabindex="-1"><h2 class="win-type-subheader '+m._ClassName.hubSectionHeaderContent+'"></h2><span class="'+m._ClassName.hubSectionHeaderChevron+' win-type-body">'+a.seeMore+"</span></div></button>",this._headerTabStopElement=this._headerElement.firstElementChild,this._headerWrapperElement=this._headerTabStopElement.firstElementChild,this._headerContentElement=this._headerWrapperElement.firstElementChild,this._headerChevronElement=this._headerWrapperElement.lastElementChild,c.appendChild(this._headerElement),this._winKeyboard=new l._WinKeyboard(this._headerElement),this._contentElement=b.document.createElement("DIV"),this._contentElement.className=m._ClassName.hubSectionContent,this._contentElement.style.visibility="hidden",c.appendChild(this._contentElement);for(var f=this.element.firstChild;f!==this._headerElement;){var h=f.nextSibling;this._contentElement.appendChild(f),f=h}this._processors=[g.processAll],i.setOptions(this,d)},{element:{get:function(){return this._element}},isHeaderStatic:{get:function(){return this._isHeaderStatic},set:function(a){this._isHeaderStatic=a,this._isHeaderStatic?(this._headerTabStopElement.setAttribute("role","heading"),k.removeClass(this._headerTabStopElement,m._ClassName.hubSectionInteractive)):(this._headerTabStopElement.setAttribute("role","link"),k.addClass(this._headerTabStopElement,m._ClassName.hubSectionInteractive))}},contentElement:{get:function(){return this._contentElement}},header:{get:function(){return this._header},set:function(a){this._header=a,this._renderHeader()}},_setHeaderTemplate:function(a){this._template=k._syncRenderer(a),this._renderHeader()},_renderHeader:function(){this._template&&(j._disposeElement(this._headerContentElement),k.empty(this._headerContentElement),this._template(this,this._headerContentElement))},_process:function(){var a=this;return this._processed=(this._processors||[]).reduce(function(b,c){return b.then(function(){return c(a.contentElement)})},this._processed||h.as()),this._processors=null,this._processed},dispose:function(){this._disposed||(this._disposed=!0,this._processors=null,j._disposeElement(this._headerContentElement),j.disposeSubTree(this.contentElement))}},{_ClassName:{hubSection:"win-hub-section",hubSectionHeader:"win-hub-section-header",hubSectionHeaderTabStop:"win-hub-section-header-tabstop",hubSectionHeaderWrapper:"win-hub-section-header-wrapper",hubSectionInteractive:"win-hub-section-header-interactive",hubSectionHeaderContent:"win-hub-section-header-content",hubSectionHeaderChevron:"win-hub-section-header-chevron",hubSectionContent:"win-hub-section-content"},isDeclarativeControlContainer:d.markSupportedForProcessing(function(a,b){b!==g.processAll&&(a._processors=a._processors||[],a._processors.push(b),a._processed&&a._process())})});return m})})}),d("require-style!less/styles-hub",[],function(){}),d("require-style!less/colors-hub",[],function(){}),d("WinJS/Controls/Hub",["../Core/_Global","../Core/_Base","../Core/_BaseUtils","../Core/_ErrorFromName","../Core/_Events","../Core/_Log","../Core/_Resources","../Core/_WriteProfilerMark","../_Accents","../Animations","../Animations/_TransitionAnimation","../BindingList","../ControlProcessor","../Promise","../_Signal","../Scheduler","../Utilities/_Control","../Utilities/_ElementUtilities","../Utilities/_Hoverable","../Utilities/_UI","./ElementResizeInstrument","./Hub/_Section","require-style!less/styles-hub","require-style!less/colors-hub"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v){"use strict";i.createAccentRule(".win-semanticzoom-zoomedoutview .win-hub-section-header-interactive .win-hub-section-header-content, .win-hub-section-header-interactive .win-hub-section-header-chevron",[{name:"color",value:i.ColorTypes.accent}]),b.Namespace.define("WinJS.UI",{Hub:b.Namespace._lazy(function(){function i(b){var c=a.document.createTextNode("object"==typeof b.header?JSON.stringify(b.header):""+b.header);return c}var s=r.Key,w=e._createEventProperty,x={contentAnimating:"contentanimating",headerInvoked:"headerinvoked",loadingStateChanged:"loadingstatechanged"},y=500,z={scrollPos:"scrollTop",scrollSize:"scrollHeight",offsetPos:"offsetTop",offsetSize:"offsetHeight",oppositeOffsetSize:"offsetWidth",marginStart:"marginTop",marginEnd:"marginBottom",borderStart:"borderTopWidth",borderEnd:"borderBottomWidth",paddingStart:"paddingTop",paddingEnd:"paddingBottom"},A={scrollPos:"scrollLeft",scrollSize:"scrollWidth",offsetPos:"offsetLeft",offsetSize:"offsetWidth",oppositeOffsetSize:"offsetHeight",marginStart:"marginRight",marginEnd:"marginLeft",borderStart:"borderRightWidth",borderEnd:"borderLeftWidth",paddingStart:"paddingRight",paddingEnd:"paddingLeft"},B={scrollPos:"scrollLeft",scrollSize:"scrollWidth",offsetPos:"offsetLeft",offsetSize:"offsetWidth",oppositeOffsetSize:"offsetHeight",marginStart:"marginLeft",marginEnd:"marginRight",borderStart:"borderLeftWidth",borderEnd:"borderRightWidth",paddingStart:"paddingLeft",paddingEnd:"paddingRight"},C=b.Class.define(function(b,c){if(b=b||a.document.createElement("DIV"),c=c||{},b.winControl)throw new d("WinJS.UI.Hub.DuplicateConstruction",E.duplicateConstruction);this._id=b.id||r._uniqueID(b),this._writeProfilerMark("constructor,StartTM"),this._windowKeyDownHandlerBound=this._windowKeyDownHandler.bind(this),a.addEventListener("keydown",this._windowKeyDownHandlerBound),b.winControl=this,this._element=b,r.addClass(this.element,C._ClassName.hub),r.addClass(this.element,"win-disposable"),this._parse(),this._viewportElement=a.document.createElement("DIV"),this._viewportElement.className=C._ClassName.hubViewport,this._element.appendChild(this._viewportElement),this._viewportElement.setAttribute("role","group"),this._viewportElement.setAttribute("aria-label",E.hubViewportAriaLabel),this._surfaceElement=a.document.createElement("DIV"),this._surfaceElement.className=C._ClassName.hubSurface,this._viewportElement.appendChild(this._surfaceElement),this._visible=!1,this._viewportElement.style.opacity=0,c.orientation||(this._orientation=t.Orientation.horizontal,r.addClass(this.element,C._ClassName.hubHorizontal)),this._fireEntrance=!0,this._animateEntrance=!0,this._loadId=0,this.runningAnimations=new n.wrap,this._currentIndexForSezo=0,q.setOptions(this,c),r._addEventListener(this.element,"focusin",this._focusin.bind(this),!1),this.element.addEventListener("keydown",this._keyDownHandler.bind(this)),this.element.addEventListener("click",this._clickHandler.bind(this)),this._viewportElement.addEventListener("scroll",this._scrollHandler.bind(this)),this._resizeHandlerBound=this._resizeHandler.bind(this),this._elementResizeInstrument=new u._ElementResizeInstrument,this._element.appendChild(this._elementResizeInstrument.element),this._elementResizeInstrument.addEventListener("resize",this._resizeHandlerBound);var e=this;r._inDom(this.element).then(function(){e._disposed||e._elementResizeInstrument.addedToDom()}),r._resizeNotifier.subscribe(this.element,this._resizeHandlerBound),this._handleSectionChangedBind=this._handleSectionChanged.bind(this),this._handleSectionInsertedBind=this._handleSectionInserted.bind(this),this._handleSectionMovedBind=this._handleSectionMoved.bind(this),this._handleSectionRemovedBind=this._handleSectionRemoved.bind(this),this._handleSectionReloadBind=this._handleSectionReload.bind(this),this._refresh(),this._writeProfilerMark("constructor,StopTM")},{element:{get:function(){return this._element}},orientation:{get:function(){return this._orientation},set:function(a){if(a!==this._orientation){if(this._measured=!1,this._names){var b={};b[this._names.scrollPos]=0,r.setScrollPosition(this._viewportElement,b)}a===t.Orientation.vertical?(r.removeClass(this.element,C._ClassName.hubHorizontal),r.addClass(this.element,C._ClassName.hubVertical)):(a=t.Orientation.horizontal,r.removeClass(this.element,C._ClassName.hubVertical),r.addClass(this.element,C._ClassName.hubHorizontal)),this._orientation=a,p.schedule(this._updateSnapList.bind(this),p.Priority.idle)}}},sections:{get:function(){return this._pendingSections?this._pendingSections:this._sections},set:function(a){var b=!this._pendingSections;this._pendingSections=a,this._refresh(),b&&(this.scrollPosition=0)}},headerTemplate:{get:function(){return this._pendingHeaderTemplate?this._pendingHeaderTemplate:(this._headerTemplate||(this._headerTemplate=i),this._headerTemplate)},set:function(a){this._pendingHeaderTemplate=a||i,this._refresh()}},scrollPosition:{get:function(){return+this._pendingScrollLocation===this._pendingScrollLocation?this._pendingScrollLocation:(this._measure(),this._scrollPosition)},set:function(a){if(a=Math.max(0,a),this._pendingRefresh)this._pendingScrollLocation=a,this._pendingSectionOnScreen=null;else{this._measure();var b=Math.max(0,Math.min(this._scrollLength-this._viewportSize,a));this._scrollPosition=b;var c={};c[this._names.scrollPos]=b,r.setScrollPosition(this._viewportElement,c)}}},sectionOnScreen:{get:function(){if(+this._pendingSectionOnScreen===this._pendingSectionOnScreen)return this._pendingSectionOnScreen;this._measure();for(var a=0;a<this._sectionSizes.length;a++){var b=this._sectionSizes[a];if(b.offset+b.size-b.borderEnd-b.paddingEnd>this._scrollPosition+this._startSpacer+b.borderStart+b.paddingStart)return a}return-1},set:function(a){a=Math.max(0,a),this._pendingRefresh?(this._pendingSectionOnScreen=a,this._pendingScrollLocation=null):(this._measure(),a>=0&&a<this._sectionSizes.length&&this._scrollToSection(a))}},indexOfFirstVisible:{get:function(){this._measure();for(var a=0;a<this._sectionSizes.length;a++){var b=this._sectionSizes[a];if(b.offset+b.size-b.borderEnd-b.paddingEnd>this._scrollPosition)return a}return-1}},indexOfLastVisible:{get:function(){this._measure();for(var a=this._sectionSizes.length-1;a>=0;a--){var b=this._sectionSizes[a];if(b.offset+b.paddingStart+b.borderStart<this._scrollPosition+this._viewportSize)return a}return-1}},onheaderinvoked:w(x.headerInvoked),onloadingstatechanged:w(x.loadingStateChanged),oncontentanimating:w(x.contentAnimating),_refresh:function(){this._pendingRefresh||(this._loadId++,this._setState(C.LoadingState.loading),this._pendingRefresh=!0,p.schedule(this._refreshImpl.bind(this),p.Priority.high))},_refreshImpl:function(){if(!this._disposed){var a=n.wrap();if(this._pendingSections&&(this._animateEntrance=!0,this._fireEntrance=!this._visible,!this._fireEntrance&&(this._visible=!1,this._viewportElement.style.opacity=0,k.isAnimationEnabled()))){var b=this._fireEvent(C._EventName.contentAnimating,{type:C.AnimationType.contentTransition});b&&(this._viewportElement.style["-ms-overflow-style"]="none",a=j.fadeOut(this._viewportElement).then(function(){this._viewportElement.style["-ms-overflow-style"]=""}.bind(this))),this._animateEntrance=b}a.done(this._applyProperties.bind(this))}},_applyProperties:function(){if(!this._disposed){this._pendingRefresh=!1;var a=!1;this._pendingSections&&(a=!0,this._updateEvents(this._sections,this._pendingSections),this._sections&&this._sections.forEach(function(a){var b=a.element;b.parentElement.removeChild(b)}),this._sections=this._pendingSections,this._pendingSections=null),this._pendingHeaderTemplate&&(this._headerTemplate=this._pendingHeaderTemplate,this._pendingHeaderTemplate=null),this._assignHeaderTemplate(),a&&this._attachSections(),+this._pendingSectionOnScreen===this._pendingSectionOnScreen?this.sectionOnScreen=this._pendingSectionOnScreen:+this._pendingScrollLocation===this._pendingScrollLocation?this.scrollPosition=this._pendingScrollLocation:this.scrollPosition=0,this._pendingSectionOnScreen=null,this._pendingScrollLocation=null,this._setState(C.LoadingState.loading),this._loadSections()}},_handleSectionChanged:function(a){if(!this._pendingSections){var b=a.detail.newValue,c=a.detail.oldValue;if(b._setHeaderTemplate(this.headerTemplate),b.element!==c.element){if(b.element.parentNode===this._surfaceElement)throw new d("WinJS.UI.Hub.DuplicateSection",E.duplicateSection);this._surfaceElement.insertBefore(b.element,c.element),this._surfaceElement.removeChild(c.element),this._measured=!1,this._setState(C.LoadingState.loading),this._loadSections()}}},_handleSectionInserted:function(a){if(!this._pendingSections){var b=a.detail.index,c=a.detail.value;c._animation&&c._animation.cancel();var e,f=this._fireEvent(C._EventName.contentAnimating,{type:C.AnimationType.insert,index:b,section:c});if(f){for(var g=[],h=b+1;h<this.sections.length;h++)g.push(this.sections.getAt(h).element);e=new j._createUpdateListAnimation([c.element],[],g)}if(c.element.parentNode===this._surfaceElement)throw new d("WinJS.UI.Hub.DuplicateSection",E.duplicateSection);if(c._setHeaderTemplate(this.headerTemplate),b<this.sections.length-1?this._surfaceElement.insertBefore(c.element,this.sections.getAt(b+1).element):this._surfaceElement.appendChild(c.element),this._measured=!1,e){var i=e.execute();this.runningAnimations=n.join([this.runningAnimations,i])}this._setState(C.LoadingState.loading),this._loadSections()}},_handleSectionMoved:function(a){if(!this._pendingSections){var b=a.detail.newIndex,c=a.detail.value;b<this.sections.length-1?this._surfaceElement.insertBefore(c.element,this.sections.getAt(b+1).element):this._surfaceElement.appendChild(c.element),this._measured=!1,this._setState(C.LoadingState.loading),this._loadSections()}},_handleSectionRemoved:function(a){if(!this._pendingSections){var b=a.detail.value,c=a.detail.index,d=n.wrap(),e=this._fireEvent(C._EventName.contentAnimating,{type:C.AnimationType.remove,index:c,section:b});if(e){for(var f=[],g=c;g<this.sections.length;g++)f.push(this.sections.getAt(g).element);var h=new j._createUpdateListAnimation([],[b.element],f);this._measure();var i=b.element.offsetTop,k=b.element.offsetLeft;b.element.style.position="absolute",b.element.style.top=i,b.element.style.left=k,b.element.style.opacity=0,this._measured=!1,d=h.execute().then(function(){b.element.style.position="",b.element.style.top="",b.element.style.left="",b.element.style.opacity=1}.bind(this))}d.done(function(){this._disposed||(this._surfaceElement.removeChild(b.element),this._measured=!1)}.bind(this)),b._animation=d,this.runningAnimations=n.join([this.runningAnimations,d]),this._setState(C.LoadingState.loading),this._loadSections()}},_handleSectionReload:function(){this.sections=this.sections},_updateEvents:function(a,b){a&&(a.removeEventListener("itemchanged",this._handleSectionChangedBind),a.removeEventListener("iteminserted",this._handleSectionInsertedBind),a.removeEventListener("itemmoved",this._handleSectionMovedBind),a.removeEventListener("itemremoved",this._handleSectionRemovedBind),a.removeEventListener("reload",this._handleSectionReloadBind)),b&&(b.addEventListener("itemchanged",this._handleSectionChangedBind),b.addEventListener("iteminserted",this._handleSectionInsertedBind),b.addEventListener("itemmoved",this._handleSectionMovedBind),b.addEventListener("itemremoved",this._handleSectionRemovedBind),b.addEventListener("reload",this._handleSectionReloadBind))},_attachSections:function(){this._measured=!1;for(var a=0;a<this.sections.length;a++){var b=this._sections.getAt(a);if(b._animation&&b._animation.cancel(),b.element.parentNode===this._surfaceElement)throw new d("WinJS.UI.Hub.DuplicateSection",E.duplicateSection);this._surfaceElement.appendChild(b.element)}},_assignHeaderTemplate:function(){this._measured=!1;for(var a=0;a<this.sections.length;a++){var b=this._sections.getAt(a);b._setHeaderTemplate(this.headerTemplate)}},_loadSection:function(a){var b=this._sections.getAt(a);return b._process().then(function(){var a=b.contentElement.style;""!==a.visibility&&(a.visibility="")})},_loadSections:function(){function b(a){a.then(function(){p.schedule(c,p.Priority.idle)})}function c(){if(d===e._loadId&&!e._disposed)if(g.length){var a=g.shift(),c=e._loadSection(a);b(c)}else i.complete()}this._loadId++;var d=this._loadId,e=this,f=n.wrap(),g=[],h=n.wrap();if(this._showProgressPromise||(this._showProgressPromise=n.timeout(y).then(function(){this._disposed||(this._progressBar||(this._progressBar=a.document.createElement("progress"),r.addClass(this._progressBar,C._ClassName.hubProgress),this._progressBar.max=100),this._progressBar.parentNode||this.element.insertBefore(this._progressBar,this._viewportElement),this._showProgressPromise=null)}.bind(this),function(){this._showProgressPromise=null}.bind(this))),this.sections.length){var i=new o;h=i.promise;for(var l=[],m=Math.max(0,this.indexOfFirstVisible),q=Math.max(0,this.indexOfLastVisible),s=m;q>=s;s++)l.push(this._loadSection(s));for(m--,q++;m>=0||q<this.sections.length;)q<this.sections.length&&(g.push(q),q++),m>=0&&(g.push(m),m--);var t=n.join(l);t.done(function(){d!==this._loadId||e._disposed||(this._showProgressPromise&&this._showProgressPromise.cancel(),this._progressBar&&this._progressBar.parentNode&&this._progressBar.parentNode.removeChild(this._progressBar),p.schedule(function(){if(d===this._loadId&&!e._disposed&&!this._visible){if(this._visible=!0,this._viewportElement.style.opacity=1,this._animateEntrance&&k.isAnimationEnabled()){var b={type:C.AnimationType.entrance};(!this._fireEntrance||this._fireEvent(C._EventName.contentAnimating,b))&&(this._viewportElement.style["-ms-overflow-style"]="none",f=j.enterContent(this._viewportElement).then(function(){this._viewportElement.style["-ms-overflow-style"]="",this._viewportElement.onmousewheel=function(){}}.bind(this)))}this._element===a.document.activeElement&&this._moveFocusIn(this.sectionOnScreen)}},p.Priority.high,this,"WinJS.UI.Hub.entranceAnimation"))}.bind(this)),b(t)}else this._showProgressPromise&&this._showProgressPromise.cancel(),this._progressBar&&this._progressBar.parentNode&&this._progressBar.parentNode.removeChild(this._progressBar);n.join([this.runningAnimations,f,h]).done(function(){d!==this._loadId||e._disposed||(this.runningAnimations=n.wrap(),this._measured&&this._scrollLength!==this._viewportElement[this._names.scrollSize]&&(this._measured=!1),this._setState(C.LoadingState.complete),p.schedule(this._updateSnapList.bind(this),p.Priority.idle))}.bind(this))},loadingState:{get:function(){return this._loadingState}},_setState:function(b){if(b!==this._loadingState){this._writeProfilerMark("loadingStateChanged:"+b+",info"),this._loadingState=b;var c=a.document.createEvent("CustomEvent");c.initCustomEvent(C._EventName.loadingStateChanged,!0,!1,{loadingState:b}),this._element.dispatchEvent(c)}},_parse:function(){for(var a=[],b=this.element.firstElementChild;b;){m.processAll(b);var c=b.winControl;if(!c)throw new d("WinJS.UI.Hub.InvalidContent",E.invalidContent);a.push(c);var e=b.nextElementSibling;b.parentElement.removeChild(b),b=e}this.sections=new l.List(a)},_fireEvent:function(b,c){var d=a.document.createEvent("CustomEvent");return d.initCustomEvent(b,!0,!0,c),this.element.dispatchEvent(d)},_findHeaderTabStop:function(a){if(a.parentNode&&r._matchesSelector(a,".win-hub-section-header-tabstop, .win-hub-section-header-tabstop *")){for(;!r.hasClass(a,"win-hub-section-header-tabstop");)a=a.parentElement;return a}return null},_isInteractive:function(b){for(;b&&b!==a.document.body;){if(r.hasClass(b,"win-interactive"))return!0;b=b.parentElement}return!1},_clickHandler:function(a){var b=this._findHeaderTabStop(a.target);if(b&&!this._isInteractive(a.target)){var c=b.parentElement.parentElement.winControl;if(!c.isHeaderStatic){var d=this.sections.indexOf(c);this._fireEvent(C._EventName.headerInvoked,{index:d,section:c})}}},_resizeHandler:function(){this._measured=!1,p.schedule(this._updateSnapList.bind(this),p.Priority.idle)},_scrollHandler:function(){this._measured=!1,this._pendingSections||(this._pendingScrollLocation=null,this._pendingSectionOnScreen=null,this._pendingScrollHandler||(this._pendingScrollHandler=c._requestAnimationFrame(function(){this._pendingScrollHandler=null,this._pendingSections||this.loadingState!==C.LoadingState.complete&&this._loadSections()}.bind(this))))},_measure:function(){if(!this._measured||0===this._scrollLength){this._writeProfilerMark("measure,StartTM"),this._measured=!0,this._rtl="rtl"===r._getComputedStyle(this._element,null).direction,this.orientation===t.Orientation.vertical?this._names=z:this._rtl?this._names=A:this._names=B,this._viewportSize=this._viewportElement[this._names.offsetSize],this._viewportOppositeSize=this._viewportElement[this._names.oppositeOffsetSize],this._scrollPosition=r.getScrollPosition(this._viewportElement)[this._names.scrollPos],this._scrollLength=this._viewportElement[this._names.scrollSize];var a=r._getComputedStyle(this._surfaceElement);this._startSpacer=parseFloat(a[this._names.marginStart])+parseFloat(a[this._names.borderStart])+parseFloat(a[this._names.paddingStart]),this._endSpacer=parseFloat(a[this._names.marginEnd])+parseFloat(a[this._names.borderEnd])+parseFloat(a[this._names.paddingEnd]),this._sectionSizes=[];for(var b=0;b<this.sections.length;b++){var c=this.sections.getAt(b),d=r._getComputedStyle(c.element);this._sectionSizes[b]={offset:c.element[this._names.offsetPos],size:c.element[this._names.offsetSize],marginStart:parseFloat(d[this._names.marginStart]),marginEnd:parseFloat(d[this._names.marginEnd]),borderStart:parseFloat(d[this._names.borderStart]),borderEnd:parseFloat(d[this._names.borderEnd]),paddingStart:parseFloat(d[this._names.paddingStart]),paddingEnd:parseFloat(d[this._names.paddingEnd])},this._rtl&&this.orientation===t.Orientation.horizontal&&(this._sectionSizes[b].offset=this._viewportSize-(this._sectionSizes[b].offset+this._sectionSizes[b].size))}this._writeProfilerMark("measure,StopTM")}},_updateSnapList:function(){this._writeProfilerMark("updateSnapList,StartTM"),this._measure();for(var a="snapList(",b=0;b<this._sectionSizes.length;b++){b>0&&(a+=",");var c=this._sectionSizes[b];a+=c.offset-c.marginStart-this._startSpacer+"px"}a+=")";var d="",e="";this.orientation===t.Orientation.vertical?d=a:e=a,this._lastSnapPointY!==d&&(this._lastSnapPointY=d,this._viewportElement.style["-ms-scroll-snap-points-y"]=d),this._lastSnapPointX!==e&&(this._lastSnapPointX=e,this._viewportElement.style["-ms-scroll-snap-points-x"]=e),this._writeProfilerMark("updateSnapList,StopTM")},_scrollToSection:function(a,b){this._measure();var c=this._sectionSizes[a],d=Math.min(this._scrollLength-this._viewportSize,c.offset-c.marginStart-this._startSpacer);this._scrollTo(d,b)},_ensureVisible:function(a,b){this._measure();var c=this._ensureVisibleMath(a,this._scrollPosition);this._scrollTo(c,b)},_ensureVisibleMath:function(a,b){this._measure();var c=this._sectionSizes[a],d=Math.min(this._scrollLength-this._viewportSize,c.offset-c.marginStart-this._startSpacer),e=Math.max(0,c.offset+c.size+c.marginEnd+this._endSpacer-this._viewportSize+1);return b>d?b=d:e>b&&(b=Math.min(d,e)),b},_scrollTo:function(a,b){if(this._scrollPosition=a,b)this.orientation===t.Orientation.vertical?r._zoomTo(this._viewportElement,{contentX:0,contentY:this._scrollPosition,viewportX:0,viewportY:0}):r._zoomTo(this._viewportElement,{contentX:this._scrollPosition,contentY:0,viewportX:0,viewportY:0});else{var c={};c[this._names.scrollPos]=this._scrollPosition,r.setScrollPosition(this._viewportElement,c)}},_windowKeyDownHandler:function(a){if(a.keyCode===s.tab){this._tabSeenLast=!0;var b=this;c._yieldForEvents(function(){b._tabSeenLast=!1})}},_focusin:function(a){if(this._tabSeenLast){var b=this._findHeaderTabStop(a.target);if(b&&!this._isInteractive(a.target)){var c=this.sections.indexOf(b.parentElement.parentElement.winControl);c>-1&&this._ensureVisible(c,!0)}}for(var d=a.target;d&&!r.hasClass(d,v.HubSection._ClassName.hubSection);)d=d.parentElement;if(d){var c=this.sections.indexOf(d.winControl);c>-1&&(this._currentIndexForSezo=c)}if(a.target===this.element){var e;+this._sectionToFocus===this._sectionToFocus&&this._sectionToFocus>=0&&this._sectionToFocus<this.sections.length?(e=this._sectionToFocus,this._sectionToFocus=null):e=this.sectionOnScreen,this._moveFocusIn(e)}},_moveFocusIn:function(a){if(a>=0){for(var b=a;b<this.sections.length;b++){var c=this.sections.getAt(b),d=r._trySetActive(c._headerTabStopElement,this._viewportElement);if(d)return;if(r._setActiveFirstFocusableElement(c.contentElement,this._viewportElement))return}for(var b=a-1;b>=0;b--){var c=this.sections.getAt(b);if(r._setActiveFirstFocusableElement(c.contentElement,this._viewportElement))return;var d=r._trySetActive(c._headerTabStopElement,this._viewportElement);if(d)return}}},_keyDownHandler:function(a){if(!this._isInteractive(a.target)&&!r._hasCursorKeysBehaviors(a.target)){var b=this._rtl?s.rightArrow:s.leftArrow,c=this._rtl?s.leftArrow:s.rightArrow;if(a.keyCode===s.upArrow||a.keyCode===s.downArrow||a.keyCode===s.leftArrow||a.keyCode===s.rightArrow||a.keyCode===s.pageUp||a.keyCode===s.pageDown){var d=this._findHeaderTabStop(a.target);if(d){var e,f=this.sections.indexOf(d.parentElement.parentElement.winControl),g=!1;if(a.keyCode===s.pageDown||this.orientation===t.Orientation.horizontal&&a.keyCode===c||this.orientation===t.Orientation.vertical&&a.keyCode===s.downArrow){for(var h=f+1;h<this.sections.length;h++)if(this._tryFocus(h)){e=h;break}}else if(a.keyCode===s.pageUp||this.orientation===t.Orientation.horizontal&&a.keyCode===b||this.orientation===t.Orientation.vertical&&a.keyCode===s.upArrow)for(var h=f-1;h>=0;h--)if(this._tryFocus(h)){e=h;break}(a.keyCode===s.upArrow||a.keyCode===s.downArrow||a.keyCode===s.leftArrow||a.keyCode===s.rightArrow)&&(g=!0),+e===e&&(g?this._ensureVisible(e,!0):this._scrollToSection(e,!0),a.preventDefault())}}else if(a.keyCode===s.home||a.keyCode===s.end){this._measure();var i=Math.max(0,this._scrollLength-this._viewportSize);this._scrollTo(a.keyCode===s.home?0:i,!0),a.preventDefault()}}},_tryFocus:function(b){var c=this.sections.getAt(b);return r._setActive(c._headerTabStopElement,this._viewportElement),a.document.activeElement===c._headerTabStopElement},zoomableView:{get:function(){return this._zoomableView||(this._zoomableView=new D(this)),this._zoomableView}},_getPanAxis:function(){return this.orientation===t.Orientation.horizontal?"horizontal":"vertical"},_configureForZoom:function(){},_setCurrentItem:function(a,b){var c;c=this.orientation===t.Orientation.horizontal?a:b,this._measure(),c+=this._scrollPosition,this._currentIndexForSezo=this._sectionSizes.length-1;for(var d=1;d<this._sectionSizes.length;d++){var e=this._sectionSizes[d];if(e.offset-e.marginStart>c){this._currentIndexForSezo=d-1;break}}},_getCurrentItem:function(){var a;if(this._sectionSizes.length>0){this._measure();var b=Math.max(0,Math.min(this._currentIndexForSezo,this._sectionSizes.length)),c=this._sectionSizes[b];a=this.orientation===t.Orientation.horizontal?{left:Math.max(0,c.offset-c.marginStart-this._scrollPosition),top:0,width:c.size,height:this._viewportOppositeSize}:{left:0,top:Math.max(0,c.offset-c.marginStart-this._scrollPosition),width:this._viewportOppositeSize,height:c.size};var d=this.sections.getAt(b);return n.wrap({item:{data:d,index:b,groupIndexHint:b},position:a})}},_beginZoom:function(){this._viewportElement.style["-ms-overflow-style"]="none"},_positionItem:function(a,b){if(a.index>=0&&a.index<this._sectionSizes.length){this._measure();var c,d=this._sectionSizes[a.index];c=this.orientation===t.Orientation.horizontal?b.left:b.top,this._sectionToFocus=a.index;var e=d.offset-c,e=this._ensureVisibleMath(a.index,e);this._scrollPosition=e;var f={};f[this._names.scrollPos]=this._scrollPosition,r.setScrollPosition(this._viewportElement,f)}},_endZoom:function(){this._viewportElement.style["-ms-overflow-style"]=""},_writeProfilerMark:function(a){var b="WinJS.UI.Hub:"+this._id+":"+a;h(b),f.log&&f.log(b,null,"hubprofiler")},dispose:function(){if(!this._disposed){this._disposed=!0,a.removeEventListener("keydown",this._windowKeyDownHandlerBound),r._resizeNotifier.unsubscribe(this.element,this._resizeHandlerBound),this._elementResizeInstrument.dispose(),this._updateEvents(this._sections);for(var b=0;b<this.sections.length;b++)this.sections.getAt(b).dispose()}},forceLayout:function(){this._resizeHandler()}},{AnimationType:{entrance:"entrance",contentTransition:"contentTransition",insert:"insert",remove:"remove"},LoadingState:{loading:"loading",complete:"complete"},_ClassName:{hub:"win-hub",hubSurface:"win-hub-surface",hubProgress:"win-hub-progress",hubViewport:"win-hub-viewport",hubVertical:"win-hub-vertical",hubHorizontal:"win-hub-horizontal"},_EventName:{contentAnimating:x.contentAnimating,headerInvoked:x.headerInvoked,loadingStateChanged:x.loadingStateChanged}});b.Class.mix(C,q.DOMEventMixin);var D=b.Class.define(function(a){this._hub=a},{getPanAxis:function(){return this._hub._getPanAxis();
},configureForZoom:function(a,b,c,d){this._hub._configureForZoom(a,b,c,d)},setCurrentItem:function(a,b){this._hub._setCurrentItem(a,b)},getCurrentItem:function(){return this._hub._getCurrentItem()},beginZoom:function(){this._hub._beginZoom()},positionItem:function(a,b){return this._hub._positionItem(a,b)},endZoom:function(a){this._hub._endZoom(a)}}),E={get duplicateConstruction(){return"Invalid argument: Controls may only be instantiated one time for each DOM element"},get duplicateSection(){return"Hub duplicate sections: Each HubSection must be unique"},get invalidContent(){return"Invalid content: Hub content must be made up of HubSections."},get hubViewportAriaLabel(){return g._getWinJSString("ui/hubViewportAriaLabel").value}};return C})})}),d("require-style!less/styles-lightdismissservice",[],function(){});var e=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};d("WinJS/_LightDismissService",["require","exports","./Application","./Core/_Base","./Core/_BaseUtils","./Utilities/_ElementUtilities","./Core/_Global","./Utilities/_KeyboardBehavior","./Core/_Log","./Core/_Resources"],function(a,b,c,d,f,g,h,i,j,k){a(["require-style!less/styles-lightdismissservice"]);var l=1e3,m={get closeOverlay(){return k._getWinJSString("ui/closeOverlay").value}};b._ClassNames={_clickEater:"win-clickeater"};b.LightDismissalReasons={tap:"tap",lostFocus:"lostFocus",escape:"escape",hardwareBackButton:"hardwareBackButton",windowResize:"windowResize",windowBlur:"windowBlur"},b.DismissalPolicies={light:function(a){switch(a.reason){case b.LightDismissalReasons.tap:case b.LightDismissalReasons.escape:return a.active?!0:(a.stopPropagation(),!1);case b.LightDismissalReasons.hardwareBackButton:return a.active?(a.preventDefault(),!0):(a.stopPropagation(),!1);case b.LightDismissalReasons.lostFocus:case b.LightDismissalReasons.windowResize:case b.LightDismissalReasons.windowBlur:return!0}},modal:function(a){switch(a.stopPropagation(),a.reason){case b.LightDismissalReasons.tap:case b.LightDismissalReasons.lostFocus:case b.LightDismissalReasons.windowResize:case b.LightDismissalReasons.windowBlur:return!1;case b.LightDismissalReasons.escape:return a.active;case b.LightDismissalReasons.hardwareBackButton:return a.preventDefault(),a.active}},sticky:function(a){return a.stopPropagation(),!1}};var n={keyDown:"keyDown",keyUp:"keyUp",keyPress:"keyPress"},o=function(){function a(a){this.element=a.element,this.element.tabIndex=a.tabIndex,this.onLightDismiss=a.onLightDismiss,a.onTakeFocus&&(this.onTakeFocus=a.onTakeFocus),a.onShouldLightDismiss&&(this.onShouldLightDismiss=a.onShouldLightDismiss),this._ldeOnKeyDownBound=this._ldeOnKeyDown.bind(this),this._ldeOnKeyUpBound=this._ldeOnKeyUp.bind(this),this._ldeOnKeyPressBound=this._ldeOnKeyPress.bind(this)}return a.prototype.restoreFocus=function(){var a=h.document.activeElement;if(a&&this.containsElement(a))return this._ldeCurrentFocus=a,!0;var b=!i._keyboardSeenLast;return this._ldeCurrentFocus&&this.containsElement(this._ldeCurrentFocus)&&g._tryFocusOnAnyElement(this._ldeCurrentFocus,b)},a.prototype._ldeOnKeyDown=function(a){this._ldeService.keyDown(this,a)},a.prototype._ldeOnKeyUp=function(a){this._ldeService.keyUp(this,a)},a.prototype._ldeOnKeyPress=function(a){this._ldeService.keyPress(this,a)},a.prototype.setZIndex=function(a){this.element.style.zIndex=a},a.prototype.getZIndexCount=function(){return 1},a.prototype.containsElement=function(a){return this.element.contains(a)},a.prototype.onTakeFocus=function(a){this.restoreFocus()||g._focusFirstFocusableElement(this.element,a)||g._tryFocusOnAnyElement(this.element,a)},a.prototype.onFocus=function(a){this._ldeCurrentFocus=a},a.prototype.onShow=function(a){this._ldeService=a,this.element.addEventListener("keydown",this._ldeOnKeyDownBound),this.element.addEventListener("keyup",this._ldeOnKeyUpBound),this.element.addEventListener("keypress",this._ldeOnKeyPressBound)},a.prototype.onHide=function(){this._ldeCurrentFocus=null,this._ldeService=null,this.element.removeEventListener("keydown",this._ldeOnKeyDownBound),this.element.removeEventListener("keyup",this._ldeOnKeyUpBound),this.element.removeEventListener("keypress",this._ldeOnKeyPressBound)},a.prototype.onKeyInStack=function(a){},a.prototype.onShouldLightDismiss=function(a){return!1},a.prototype.onLightDismiss=function(a){},a}(),p=function(a){function c(){a.apply(this,arguments)}return e(c,a),c.prototype.onKeyInStack=function(a){},c.prototype.onShouldLightDismiss=function(a){return b.DismissalPolicies.light(a)},c}(o);b.LightDismissableElement=p;var q=function(a){function c(){a.apply(this,arguments)}return e(c,a),c.prototype.onKeyInStack=function(a){a.stopPropagation()},c.prototype.onShouldLightDismiss=function(a){return b.DismissalPolicies.modal(a)},c}(o);b.ModalElement=q;var r=function(){function a(){}return a.prototype.setZIndex=function(a){},a.prototype.getZIndexCount=function(){return 1},a.prototype.containsElement=function(a){return h.document.body.contains(a)},a.prototype.onTakeFocus=function(a){this.currentFocus&&this.containsElement(this.currentFocus)&&g._tryFocusOnAnyElement(this.currentFocus,a)},a.prototype.onFocus=function(a){this.currentFocus=a},a.prototype.onShow=function(a){},a.prototype.onHide=function(){this.currentFocus=null},a.prototype.onKeyInStack=function(a){},a.prototype.onShouldLightDismiss=function(a){return!1},a.prototype.onLightDismiss=function(a){},a}(),s=function(){function a(){this._debug=!1,this._clients=[],this._notifying=!1,this._bodyClient=new r,this._updateDom_rendered={serviceActive:!1},this._clickEaterEl=this._createClickEater(),this._onBeforeRequestingFocusOnKeyboardInputBound=this._onBeforeRequestingFocusOnKeyboardInput.bind(this),this._onFocusInBound=this._onFocusIn.bind(this),this._onKeyDownBound=this._onKeyDown.bind(this),this._onWindowResizeBound=this._onWindowResize.bind(this),this._onClickEaterPointerUpBound=this._onClickEaterPointerUp.bind(this),this._onClickEaterPointerCancelBound=this._onClickEaterPointerCancel.bind(this),c.addEventListener("backclick",this._onBackClick.bind(this)),h.window.addEventListener("blur",this._onWindowBlur.bind(this)),this.shown(this._bodyClient)}return a.prototype.shown=function(a){var b=this._clients.indexOf(a);-1===b&&(this._clients.push(a),a.onShow(this),this._updateDom())},a.prototype.hidden=function(a){var b=this._clients.indexOf(a);-1!==b&&(this._clients.splice(b,1),a.setZIndex(""),a.onHide(),this._updateDom())},a.prototype.updated=function(a){this._updateDom()},a.prototype.keyDown=function(a,b){b.keyCode===g.Key.escape?this._escapePressed(b):this._dispatchKeyboardEvent(a,n.keyDown,b)},a.prototype.keyUp=function(a,b){this._dispatchKeyboardEvent(a,n.keyUp,b)},a.prototype.keyPress=function(a,b){this._dispatchKeyboardEvent(a,n.keyPress,b)},a.prototype.isShown=function(a){return-1!==this._clients.indexOf(a)},a.prototype.isTopmost=function(a){return a===this._clients[this._clients.length-1]},a.prototype._setDebug=function(a){this._debug=a},a.prototype._updateDom=function(a){a=a||{};var b=!!a.activeDismissableNeedsFocus,d=this._updateDom_rendered;if(!this._notifying){var e=this._clients.length>1;if(e!==d.serviceActive){if(e)c.addEventListener("beforerequestingfocusonkeyboardinput",this._onBeforeRequestingFocusOnKeyboardInputBound),g._addEventListener(h.document.documentElement,"focusin",this._onFocusInBound),h.document.documentElement.addEventListener("keydown",this._onKeyDownBound),h.window.addEventListener("resize",this._onWindowResizeBound),this._bodyClient.currentFocus=h.document.activeElement,h.document.body.appendChild(this._clickEaterEl);else{c.removeEventListener("beforerequestingfocusonkeyboardinput",this._onBeforeRequestingFocusOnKeyboardInputBound),g._removeEventListener(h.document.documentElement,"focusin",this._onFocusInBound),h.document.documentElement.removeEventListener("keydown",this._onKeyDownBound),h.window.removeEventListener("resize",this._onWindowResizeBound);var f=this._clickEaterEl.parentNode;f&&f.removeChild(this._clickEaterEl)}d.serviceActive=e}var j=0,k=l+1;this._clients.forEach(function(a,b){var c=k+j;a.setZIndex(""+c),k=c,j=a.getZIndexCount()+1}),e&&(this._clickEaterEl.style.zIndex=""+(k-1));var m=this._clients.length>0?this._clients[this._clients.length-1]:null;if(this._activeDismissable!==m&&(this._activeDismissable=m,b=!0),b){var n=!i._keyboardSeenLast;this._activeDismissable&&this._activeDismissable.onTakeFocus(n)}}},a.prototype._dispatchKeyboardEvent=function(a,b,c){var d=this._clients.indexOf(a);if(-1!==d)for(var e={type:b,keyCode:c.keyCode,propagationStopped:!1,stopPropagation:function(){this.propagationStopped=!0,c.stopPropagation()}},f=this._clients.slice(0,d+1),g=f.length-1;g>=0&&!e.propagationStopped;g--)f[g].onKeyInStack(e)},a.prototype._dispatchLightDismiss=function(a,b,c){if(this._notifying)return void(j.log&&j.log('_LightDismissService ignored dismiss trigger to avoid re-entrancy: "'+a+'"',"winjs _LightDismissService","warning"));if(b=b||this._clients.slice(0),0!==b.length){this._notifying=!0;for(var d={reason:a,active:!1,_stop:!1,stopPropagation:function(){this._stop=!0},_doDefault:!0,preventDefault:function(){this._doDefault=!1}},e=b.length-1;e>=0&&!d._stop;e--)d.active=this._activeDismissable===b[e],b[e].onShouldLightDismiss(d)&&b[e].onLightDismiss(d);return this._notifying=!1,this._updateDom(c),d._doDefault}},a.prototype._onBeforeRequestingFocusOnKeyboardInput=function(a){return!0},a.prototype._clickEaterTapped=function(){this._dispatchLightDismiss(b.LightDismissalReasons.tap)},a.prototype._onFocusIn=function(a){for(var c=a.target,d=this._clients.length-1;d>=0&&!this._clients[d].containsElement(c);d--);-1!==d&&this._clients[d].onFocus(c),d+1<this._clients.length&&this._dispatchLightDismiss(b.LightDismissalReasons.lostFocus,this._clients.slice(d+1),{activeDismissableNeedsFocus:!0})},a.prototype._onKeyDown=function(a){a.keyCode===g.Key.escape&&this._escapePressed(a)},a.prototype._escapePressed=function(a){a.preventDefault(),a.stopPropagation(),this._dispatchLightDismiss(b.LightDismissalReasons.escape)},a.prototype._onBackClick=function(a){var c=this._dispatchLightDismiss(b.LightDismissalReasons.hardwareBackButton);return!c},a.prototype._onWindowResize=function(a){this._dispatchLightDismiss(b.LightDismissalReasons.windowResize)},a.prototype._onWindowBlur=function(a){if(!this._debug)if(h.document.hasFocus()){var c=h.document.activeElement;c&&"IFRAME"===c.tagName&&!c.msLightDismissBlur&&(c.addEventListener("blur",this._onWindowBlur.bind(this),!1),c.msLightDismissBlur=!0)}else this._dispatchLightDismiss(b.LightDismissalReasons.windowBlur)},a.prototype._createClickEater=function(){var a=h.document.createElement("section");return a.className=b._ClassNames._clickEater,g._addEventListener(a,"pointerdown",this._onClickEaterPointerDown.bind(this),!0),a.addEventListener("click",this._onClickEaterClick.bind(this),!0),a.setAttribute("role","menuitem"),a.setAttribute("aria-label",m.closeOverlay),a.setAttribute("unselectable","on"),a},a.prototype._onClickEaterPointerDown=function(a){a.stopPropagation(),a.preventDefault(),this._clickEaterPointerId=a.pointerId,this._registeredClickEaterCleanUp||(g._addEventListener(h.window,"pointerup",this._onClickEaterPointerUpBound),g._addEventListener(h.window,"pointercancel",this._onClickEaterPointerCancelBound),this._registeredClickEaterCleanUp=!0)},a.prototype._onClickEaterPointerUp=function(a){var b=this;if(a.stopPropagation(),a.preventDefault(),a.pointerId===this._clickEaterPointerId){this._resetClickEaterPointerState();var c=h.document.elementFromPoint(a.clientX,a.clientY);c===this._clickEaterEl&&(this._skipClickEaterClick=!0,f._yieldForEvents(function(){b._skipClickEaterClick=!1}),this._clickEaterTapped())}},a.prototype._onClickEaterClick=function(a){a.stopPropagation(),a.preventDefault(),this._skipClickEaterClick||this._clickEaterTapped()},a.prototype._onClickEaterPointerCancel=function(a){a.pointerId===this._clickEaterPointerId&&this._resetClickEaterPointerState()},a.prototype._resetClickEaterPointerState=function(){this._registeredClickEaterCleanUp&&(g._removeEventListener(h.window,"pointerup",this._onClickEaterPointerUpBound),g._removeEventListener(h.window,"pointercancel",this._onClickEaterPointerCancelBound)),this._clickEaterPointerId=null,this._registeredClickEaterCleanUp=!1},a}(),t=new s;b.shown=t.shown.bind(t),b.hidden=t.hidden.bind(t),b.updated=t.updated.bind(t),b.isShown=t.isShown.bind(t),b.isTopmost=t.isTopmost.bind(t),b.keyDown=t.keyDown.bind(t),b.keyUp=t.keyUp.bind(t),b.keyPress=t.keyPress.bind(t),b._clickEaterTapped=t._clickEaterTapped.bind(t),b._onBackClick=t._onBackClick.bind(t),b._setDebug=t._setDebug.bind(t),d.Namespace.define("WinJS.UI._LightDismissService",{shown:b.shown,hidden:b.hidden,updated:b.updated,isShown:b.isShown,isTopmost:b.isTopmost,keyDown:b.keyDown,keyUp:b.keyUp,keyPress:b.keyPress,_clickEaterTapped:b._clickEaterTapped,_onBackClick:b._onBackClick,_setDebug:b._setDebug,LightDismissableElement:p,DismissalPolicies:b.DismissalPolicies,LightDismissalReasons:b.LightDismissalReasons,_ClassNames:b._ClassNames,_service:t})}),d("WinJS/Controls/_LegacyAppBar/_Constants",["exports","../../Core/_Base"],function(a,b){"use strict";b.Namespace._moduleDefine(a,null,{appBarClass:"win-navbar",firstDivClass:"win-firstdiv",finalDivClass:"win-finaldiv",invokeButtonClass:"win-navbar-invokebutton",ellipsisClass:"win-navbar-ellipsis",primaryCommandsClass:"win-primarygroup",secondaryCommandsClass:"win-secondarygroup",commandLayoutClass:"win-commandlayout",menuLayoutClass:"win-menulayout",topClass:"win-top",bottomClass:"win-bottom",showingClass:"win-navbar-opening",shownClass:"win-navbar-opened",hidingClass:"win-navbar-closing",hiddenClass:"win-navbar-closed",compactClass:"win-navbar-compact",minimalClass:"win-navbar-minimal",menuContainerClass:"win-navbar-menu",appBarPlacementTop:"top",appBarPlacementBottom:"bottom",appBarLayoutCustom:"custom",appBarLayoutCommands:"commands",appBarLayoutMenu:"menu",appBarInvokeButtonWidth:32,typeSeparator:"separator",typeContent:"content",typeButton:"button",typeToggle:"toggle",typeFlyout:"flyout",appBarCommandClass:"win-command",appBarCommandGlobalClass:"win-global",appBarCommandSelectionClass:"win-selection",commandHiddenClass:"win-command-hidden",sectionSelection:"selection",sectionGlobal:"global",sectionPrimary:"primary",sectionSecondary:"secondary",menuCommandClass:"win-command",menuCommandButtonClass:"win-command-button",menuCommandToggleClass:"win-command-toggle",menuCommandFlyoutClass:"win-command-flyout",menuCommandFlyoutActivatedClass:"win-command-flyout-activated",menuCommandSeparatorClass:"win-command-separator",_menuCommandInvokedEvent:"_invoked",menuClass:"win-menu",menuContainsToggleCommandClass:"win-menu-containstogglecommand",menuContainsFlyoutCommandClass:"win-menu-containsflyoutcommand",menuMouseSpacingClass:"win-menu-mousespacing",menuTouchSpacingClass:"win-menu-touchspacing",menuCommandHoverDelay:400,overlayClass:"win-overlay",flyoutClass:"win-flyout",flyoutLightClass:"win-ui-light",settingsFlyoutClass:"win-settingsflyout",scrollsClass:"win-scrolls",pinToRightEdge:-1,pinToBottomEdge:-1,separatorWidth:34,buttonWidth:68,narrowClass:"win-narrow",wideClass:"win-wide",_visualViewportClass:"win-visualviewport-space",commandPropertyMutated:"_commandpropertymutated",commandVisibilityChanged:"commandvisibilitychanged"})}),d("WinJS/Utilities/_KeyboardInfo",["require","exports","../Core/_BaseCoreUtils","../Core/_Global","../Core/_WinRT"],function(a,b,c,d,e){"use strict";var f={visualViewportClass:"win-visualviewport-space",scrollTimeout:150};b._KeyboardInfo,b._KeyboardInfo={get _visible(){try{return e.Windows.UI.ViewManagement.InputPane&&e.Windows.UI.ViewManagement.InputPane.getForCurrentView().occludedRect.height>0}catch(a){return!1}},get _extraOccluded(){var a=0;return!b._KeyboardInfo._isResized&&e.Windows.UI.ViewManagement.InputPane&&(a=e.Windows.UI.ViewManagement.InputPane.getForCurrentView().occludedRect.height),a},get _isResized(){var a=d.document.documentElement.clientHeight/d.innerHeight,b=d.document.documentElement.clientWidth/d.innerWidth;return.99>b/a},get _visibleDocBottom(){return b._KeyboardInfo._visibleDocTop+b._KeyboardInfo._visibleDocHeight},get _visibleDocHeight(){return b._KeyboardInfo._visualViewportHeight-b._KeyboardInfo._extraOccluded},get _visibleDocTop(){return 0},get _visibleDocBottomOffset(){return b._KeyboardInfo._extraOccluded},get _visualViewportHeight(){var a=b._KeyboardInfo._visualViewportSpace;return a.height},get _visualViewportWidth(){var a=b._KeyboardInfo._visualViewportSpace;return a.width},get _visualViewportSpace(){var a=d.document.body.querySelector("."+f.visualViewportClass);return a||(a=d.document.createElement("DIV"),a.className=f.visualViewportClass,d.document.body.appendChild(a)),a.getBoundingClientRect()},get _animationShowLength(){if(c.hasWinRT){if(e.Windows.UI.Core.AnimationMetrics){for(var a=e.Windows.UI.Core.AnimationMetrics,b=new a.AnimationDescription(a.AnimationEffect.showPanel,a.AnimationEffectTarget.primary),d=b.animations,f=0,g=0;g<d.size;g++){var h=d[g];f=Math.max(f,h.delay+h.duration)}return f}var i=300,j=50;return j+i}return 0},get _scrollTimeout(){return f.scrollTimeout},get _layoutViewportCoords(){var a=d.window.pageYOffset-d.document.documentElement.scrollTop,b=d.document.documentElement.clientHeight-(a+this._visibleDocHeight);return{visibleDocTop:a,visibleDocBottom:b}}}}),d("require-style!less/styles-overlay",[],function(){}),d("require-style!less/colors-overlay",[],function(){}),d("WinJS/Controls/Flyout/_Overlay",["exports","../../Core/_Global","../../Core/_WinRT","../../Core/_Base","../../Core/_BaseUtils","../../Core/_ErrorFromName","../../Core/_Events","../../Core/_Resources","../../Core/_WriteProfilerMark","../../_Accents","../../Animations","../../Application","../../ControlProcessor","../../Promise","../../Scheduler","../../Utilities/_Control","../../Utilities/_ElementUtilities","../../Utilities/_KeyboardInfo","../_LegacyAppBar/_Constants","require-style!less/styles-overlay","require-style!less/colors-overlay"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s){"use strict";j.createAccentRule("button[aria-checked=true].win-command:before, .win-menu-containsflyoutcommand button.win-command-flyout-activated:before",[{name:"background-color",value:j.ColorTypes.accent},{name:"border-color",value:j.ColorTypes.accent}]),j.createAccentRule(".win-flyout, .win-settingsflyout",[{name:"border-color",value:j.ColorTypes.accent}]),d.Namespace._moduleDefine(a,"WinJS.UI",{_Overlay:d.Namespace._lazy(function(){function a(a,c,d){var e=b.document.querySelectorAll("."+s.overlayClass);if(e)for(var f=e.length,g=0;f>g;g++){var h=e[g],i=h.winControl;if(!i._disposed&&i){var j=i[c](a);if(d&&j)return j}}}function e(a){if(!a)return[];"string"!=typeof a&&a&&a.length||(a=[a]);var c,d=[];for(c=0;c<a.length;c++)if(a[c])if("string"==typeof a[c]){var e=b.document.getElementById(a[c]);e&&d.push(e)}else a[c].element?d.push(a[c].element):d.push(a[c]);return d}var g=d.Class.define(function(){this._currentState=g.states.off,this._inputPaneShowing=this._inputPaneShowing.bind(this),this._inputPaneHiding=this._inputPaneHiding.bind(this),this._documentScroll=this._documentScroll.bind(this),this._windowResized=this._windowResized.bind(this)},{initialize:function(){this._toggleListeners(g.states.on)},reset:function(){this._toggleListeners(g.states.off),this._toggleListeners(g.states.on)},_inputPaneShowing:function(b){i(g.profilerString+"_showingKeyboard,StartTM"),a(b,"_showingKeyboard"),i(g.profilerString+"_showingKeyboard,StopTM")},_inputPaneHiding:function(b){i(g.profilerString+"_hidingKeyboard,StartTM"),a(b,"_hidingKeyboard"),i(g.profilerString+"_hidingKeyboard,StopTM")},_documentScroll:function(b){i(g.profilerString+"_checkScrollPosition,StartTM"),a(b,"_checkScrollPosition"),i(g.profilerString+"_checkScrollPosition,StopTM")},_windowResized:function(b){i(g.profilerString+"_baseResize,StartTM"),a(b,"_baseResize"),i(g.profilerString+"_baseResize,StopTM")},_toggleListeners:function(a){var d;if(this._currentState!==a){if(a===g.states.on?d="addEventListener":a===g.states.off&&(d="removeEventListener"),c.Windows.UI.ViewManagement.InputPane){var e=c.Windows.UI.ViewManagement.InputPane.getForCurrentView();e[d]("showing",this._inputPaneShowing,!1),e[d]("hiding",this._inputPaneHiding,!1),b.document[d]("scroll",this._documentScroll,!1)}b.addEventListener("resize",this._windowResized,!1),this._currentState=a}}},{profilerString:{get:function(){return"WinJS.UI._Overlay Global Listener:"}},states:{get:function(){return{off:0,on:1}}}}),j={get duplicateConstruction(){return"Invalid argument: Controls may only be instantiated one time for each DOM element"},get mustContainCommands(){return"Invalid HTML: AppBars/Menus must contain only AppBarCommands/MenuCommands"},get closeOverlay(){return h._getWinJSString("ui/closeOverlay").value}},l=d.Class.define(function(a,b){this._baseOverlayConstructor(a,b)},{_baseOverlayConstructor:function(a,c){this._disposed=!1,a||(a=b.document.createElement("div"));var d=a.winControl;if(d)throw new f("WinJS.UI._Overlay.DuplicateConstruction",j.duplicateConstruction);this._element||(this._element=a),this._element.hasAttribute("tabIndex")||(this._element.tabIndex=-1),this._sticky=!1,this._doNext="",this._element.style.visibility="hidden",this._element.style.opacity=0,a.winControl=this,q.addClass(this._element,s.overlayClass),q.addClass(this._element,"win-disposable");var e=this._element.getAttribute("unselectable");(null===e||void 0===e)&&this._element.setAttribute("unselectable","on"),this._currentAnimateIn=this._baseAnimateIn,this._currentAnimateOut=this._baseAnimateOut,this._animationPromise=n.as(),this._queuedToShow=[],this._queuedToHide=[],this._queuedCommandAnimation=!1,c&&p.setOptions(this,c),l._globalEventListeners.initialize()},element:{get:function(){return this._element}},dispose:function(){this._disposed||(this._disposed=!0,this._dispose())},_dispose:function(){},_show:function(){this._baseShow()},_hide:function(){this._baseHide()},hidden:{get:function(){return"hidden"===this._element.style.visibility||"hiding"===this._element.winAnimating||"hide"===this._doNext},set:function(a){var b=this.hidden;!a&&b?this.show():a&&!b&&this.hide()}},addEventListener:function(a,b,c){return this._element.addEventListener(a,b,c)},removeEventListener:function(a,b,c){return this._element.removeEventListener(a,b,c)},_baseShow:function(){if(this._animating||this._needToHandleHidingKeyboard)return this._doNext="show",!1;if("visible"!==this._element.style.visibility){this._element.winAnimating="showing",this._element.style.display="",this._element.style.visibility="hidden",this._queuedCommandAnimation&&(this._showAndHideFast(this._queuedToShow,this._queuedToHide),this._queuedToShow=[],this._queuedToHide=[]),this._beforeShow(),this._sendEvent(l.beforeShow),this._ensurePosition();var a=this;return this._animationPromise=this._currentAnimateIn().then(function(){a._baseEndShow()},function(){a._baseEndShow()}),!0}return!1},_beforeShow:function(){},_ensurePosition:function(){},_baseEndShow:function(){this._disposed||(this._element.setAttribute("aria-hidden","false"),this._element.winAnimating="","show"===this._doNext&&(this._doNext=""),this._sendEvent(l.afterShow),this._writeProfilerMark("show,StopTM"),o.schedule(this._checkDoNext,o.Priority.normal,this,"WinJS.UI._Overlay._checkDoNext"))},_baseHide:function(){if(this._animating)return this._doNext="hide",!1;if(this._needToHandleHidingKeyboard&&(this._element.style.visibility=""),"hidden"!==this._element.style.visibility){if(this._element.winAnimating="hiding",this._element.setAttribute("aria-hidden","true"),this._sendEvent(l.beforeHide),""===this._element.style.visibility)this._element.style.opacity=0,this._baseEndHide();else{var a=this;this._animationPromise=this._currentAnimateOut().then(function(){a._baseEndHide()},function(){a._baseEndHide()})}return!0}return!1},_baseEndHide:function(){this._disposed||(this._beforeEndHide(),this._element.style.visibility="hidden",this._element.style.display="none",this._element.winAnimating="",this._queuedCommandAnimation&&(this._showAndHideFast(this._queuedToShow,this._queuedToHide),this._queuedToShow=[],this._queuedToHide=[]),"hide"===this._doNext&&(this._doNext=""),this._afterHide(),this._sendEvent(l.afterHide),this._writeProfilerMark("hide,StopTM"),o.schedule(this._checkDoNext,o.Priority.normal,this,"WinJS.UI._Overlay._checkDoNext"))},_beforeEndHide:function(){},_afterHide:function(){},_checkDoNext:function(){this._animating||this._needToHandleHidingKeyboard||this._disposed||("hide"===this._doNext?(this._hide(),this._doNext=""):this._queuedCommandAnimation?this._showAndHideQueue():"show"===this._doNext&&(this._show(),this._doNext=""))},_baseAnimateIn:function(){return this._element.style.opacity=0,this._element.style.visibility="visible",q._getComputedStyle(this._element,null).opacity,k.fadeIn(this._element)},_baseAnimateOut:function(){return this._element.style.opacity=1,q._getComputedStyle(this._element,null).opacity,k.fadeOut(this._element)},_animating:{get:function(){return!!this._element.winAnimating}},_sendEvent:function(a,c){if(!this._disposed){var d=b.document.createEvent("CustomEvent");d.initEvent(a,!0,!0,c||{}),this._element.dispatchEvent(d)}},_showCommands:function(a,b){var c=this._resolveCommands(a);this._showAndHideCommands(c.commands,[],b)},_hideCommands:function(a,b){var c=this._resolveCommands(a);this._showAndHideCommands([],c.commands,b)},_showOnlyCommands:function(a,b){var c=this._resolveCommands(a);this._showAndHideCommands(c.commands,c.others,b)},_showAndHideCommands:function(a,b,c){c||this.hidden&&!this._animating?(this._showAndHideFast(a,b),this._removeFromQueue(a,this._queuedToShow),this._removeFromQueue(b,this._queuedToHide)):(this._updateAnimateQueue(a,this._queuedToShow,this._queuedToHide),this._updateAnimateQueue(b,this._queuedToHide,this._queuedToShow))},_removeFromQueue:function(a,b){var c;for(c=0;c<a.length;c++){var d;for(d=0;d<b.length;d++)if(b[d]===a[c]){b.splice(d,1);break}}},_updateAnimateQueue:function(a,b,c){if(!this._disposed){var d;for(d=0;d<a.length;d++){var e;for(e=0;e<b.length&&b[e]!==a[d];e++);for(e===b.length&&(b[e]=a[d]),e=0;e<c.length;e++)if(c[e]===a[d]){c.splice(e,1);break}}this._queuedCommandAnimation||(this._animating||o.schedule(this._checkDoNext,o.Priority.normal,this,"WinJS.UI._Overlay._checkDoNext"),this._queuedCommandAnimation=!0)}},_showAndHideFast:function(a,b){var c,d;for(c=0;c<a.length;c++)d=a[c],d&&d.style&&(d.style.visibility="",d.style.display="");for(c=0;c<b.length;c++)d=b[c],d&&d.style&&(d.style.visibility="hidden",d.style.display="none");this._commandsUpdated()},_showAndHideQueue:function(){if(this._queuedCommandAnimation=!1,this.hidden)this._showAndHideFast(this._queuedToShow,this._queuedToHide),o.schedule(this._checkDoNext,o.Priority.normal,this,"WinJS.UI._Overlay._checkDoNext");else{var a,c=this._queuedToShow,d=this._queuedToHide,e=this._findSiblings(c.concat(d));for(a=0;a<c.length;a++)c[a]&&c[a].style&&b.document.body.contains(c[a])?"hidden"!==c[a].style.visibility&&"0"!==c[a].style.opacity&&(e.push(c[a]),c.splice(a,1),a--):(c.splice(a,1),a--);for(a=0;a<d.length;a++)d[a]&&d[a].style&&b.document.body.contains(d[a])&&"hidden"!==d[a].style.visibility&&"0"!==d[a].style.opacity||(d.splice(a,1),a--);var f=this._baseBeginAnimateCommands(c,d,e),g=this;f?f.done(function(){g._baseEndAnimateCommands(d)},function(){g._baseEndAnimateCommands(d)}):o.schedule(function(){g._baseEndAnimateCommands([])},o.Priority.normal,null,"WinJS.UI._Overlay._endAnimateCommandsWithoutAnimation")}this._queuedToShow=[],this._queuedToHide=[]},_baseBeginAnimateCommands:function(a,b,c){this._beginAnimateCommands(a,b,this._getVisibleCommands(c));var d=null,e=null;b.length>0&&(e=k.createDeleteFromListAnimation(b,0===a.length?c:void 0)),a.length>0&&(d=k.createAddToListAnimation(a,c));for(var f=0,g=b.length;g>f;f++){var h=b[f].getBoundingClientRect(),i=q._getComputedStyle(b[f]);b[f].style.top=h.top-parseFloat(i.marginTop)+"px",b[f].style.left=h.left-parseFloat(i.marginLeft)+"px",b[f].style.opacity=0,b[f].style.position="fixed"}this._element.winAnimating="rearranging";var j=null;for(e&&(j=e.execute()),f=0;f<a.length;f++)a[f].style.visibility="",a[f].style.display="",a[f].style.opacity=1;if(d){var l=d.execute();j=j?n.join([j,l]):l}return j},_beginAnimateCommands:function(){},_getVisibleCommands:function(a){var b,c=a,d=[];c||(c=this.element.querySelectorAll(".win-command"));for(var e=0,f=c.length;f>e;e++)b=c[e].winControl||c[e],b.hidden||d.push(b);return d},_baseEndAnimateCommands:function(a){if(!this._disposed){var b;for(b=0;b<a.length;b++)a[b].style.position="",a[b].style.top="",a[b].style.left="",a[b].getBoundingClientRect(),a[b].style.visibility="hidden",a[b].style.display="none",a[b].style.opacity=1;this._element.winAnimating="",this._endAnimateCommands(),this._checkDoNext()}},_endAnimateCommands:function(){},_resolveCommands:function(a){a=e(a);var b={};b.commands=[],b.others=[];var c,d,f=this.element.querySelectorAll(".win-command");for(c=0;c<f.length;c++){var g=!1;for(d=0;d<a.length;d++)if(a[d]===f[c]){b.commands.push(f[c]),a.splice(d,1),g=!0;break}g||b.others.push(f[c])}return b},_findSiblings:function(a){var b,c,d=[],e=this.element.querySelectorAll(".win-command");for(b=0;b<e.length;b++){var f=!1;for(c=0;c<a.length;c++)if(a[c]===e[b]){a.splice(c,1),f=!0;break}f||d.push(e[b])}return d},_baseResize:function(a){this._resize(a)},_hideOrDismiss:function(){var a=this._element;a&&q.hasClass(a,s.settingsFlyoutClass)?this._dismiss():a&&q.hasClass(a,s.appBarClass)?this.close():this.hide()},_resize:function(){},_commandsUpdated:function(){},_checkScrollPosition:function(){},_showingKeyboard:function(){},_hidingKeyboard:function(){},_verifyCommandsOnly:function(a,b){for(var c=a.children,d=new Array(c.length),e=0;e<c.length;e++){if(!q.hasClass(c[e],"win-command")&&c[e].getAttribute("data-win-control")!==b)throw new f("WinJS.UI._Overlay.MustContainCommands",j.mustContainCommands);m.processAll(c[e]),d[e]=c[e].winControl}return d},_focusOnLastFocusableElementOrThis:function(){this._focusOnLastFocusableElement()||l._trySetActive(this._element)},_focusOnLastFocusableElement:function(){if(this._element.firstElementChild){var a=this._element.firstElementChild.tabIndex,c=this._element.lastElementChild.tabIndex;this._element.firstElementChild.tabIndex=-1,this._element.lastElementChild.tabIndex=-1;var d=q._focusLastFocusableElement(this._element);return d&&l._trySelect(b.document.activeElement),this._element.firstElementChild.tabIndex=a,this._element.lastElementChild.tabIndex=c,d}return!1},_focusOnFirstFocusableElementOrThis:function(){this._focusOnFirstFocusableElement()||l._trySetActive(this._element)},_focusOnFirstFocusableElement:function(a,c){if(this._element.firstElementChild){var d=this._element.firstElementChild.tabIndex,e=this._element.lastElementChild.tabIndex;this._element.firstElementChild.tabIndex=-1,this._element.lastElementChild.tabIndex=-1;var f=q._focusFirstFocusableElement(this._element,a,c);return f&&l._trySelect(b.document.activeElement),this._element.firstElementChild.tabIndex=d,this._element.lastElementChild.tabIndex=e,f}return!1},_writeProfilerMark:function(a){i("WinJS.UI._Overlay:"+this._id+":"+a)}},{_isFlyoutVisible:function(){for(var a=b.document.querySelectorAll("."+s.flyoutClass),c=0;c<a.length;c++){var d=a[c].winControl;if(d&&!d.hidden)return!0}return!1},_trySetActive:function(a,c){return a&&b.document.body&&b.document.body.contains(a)&&q._setActive(a,c)?a===b.document.activeElement:!1},_trySelect:function(a){try{a&&a.select&&a.select()}catch(b){}},_sizeOfDocument:function(){return{width:b.document.documentElement.offsetWidth,height:b.document.documentElement.offsetHeight}},_getParentControlUsingClassName:function(a,c){for(;a&&a!==b.document.body;){if(q.hasClass(a,c))return a.winControl;a=a.parentNode}return null},_globalEventListeners:new g,
_hideAppBars:function(a,b){var c=a.map(function(a){return a.close(),a._animationPromise});return n.join(c)},_showAppBars:function(a,b){var c=a.map(function(a){return a._show(),a._animationPromise});return n.join(c)},_keyboardInfo:r._KeyboardInfo,_scrollTimeout:r._KeyboardInfo._scrollTimeout,beforeShow:"beforeshow",beforeHide:"beforehide",afterShow:"aftershow",afterHide:"afterhide",commonstrings:{get cannotChangeCommandsWhenVisible(){return"Invalid argument: You must call hide() before changing {0} commands"},get cannotChangeHiddenProperty(){return"Unable to set hidden property while parent {0} is visible."}}});return d.Class.mix(l,p.DOMEventMixin),l})})}),d("WinJS/Controls/Flyout",["exports","../Core/_Global","../Core/_Base","../Core/_BaseUtils","../Core/_ErrorFromName","../Core/_Events","../Core/_Log","../Core/_Resources","../Core/_WriteProfilerMark","../Animations","../_Signal","../_LightDismissService","../Utilities/_Dispose","../Utilities/_ElementUtilities","../Utilities/_KeyboardBehavior","../Utilities/_Hoverable","./_LegacyAppBar/_Constants","./Flyout/_Overlay"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r){"use strict";c.Namespace._moduleDefine(a,"WinJS.UI",{Flyout:c.Namespace._lazy(function(){function a(a,b){return n.convertToPixels(a,n._getComputedStyle(a,null)[b])}function p(b){return{marginTop:a(b,"marginTop"),marginBottom:a(b,"marginBottom"),marginLeft:a(b,"marginLeft"),marginRight:a(b,"marginRight"),totalWidth:n.getTotalWidth(b),totalHeight:n.getTotalHeight(b),contentWidth:n.getContentWidth(b),contentHeight:n.getContentHeight(b)}}var s=n.Key,t={get ariaLabel(){return h._getWinJSString("ui/flyoutAriaLabel").value},get noAnchor(){return"Invalid argument: Flyout anchor element not found in DOM."},get badPlacement(){return"Invalid argument: Flyout placement should be 'top' (default), 'bottom', 'left', 'right', 'auto', 'autohorizontal', or 'autovertical'."},get badAlignment(){return"Invalid argument: Flyout alignment should be 'center' (default), 'left', or 'right'."},get noCoordinates(){return"Invalid argument: Flyout coordinates must contain a valid x,y pair."}},u=f._createEventProperty,v=c.Class.define(function(a){this._onLightDismiss=a,this._currentlyFocusedClient=null,this._clients=[]},{shown:function(a){a._focusable=!0;var b=this._clients.indexOf(a);-1===b&&(this._clients.push(a),a.onShow(this),l.isShown(this)?(l.updated(this),this._activateTopFocusableClientIfNeeded()):l.shown(this))},hiding:function(a){var b=this._clients.indexOf(a);-1!==b&&(this._clients[b]._focusable=!1,this._activateTopFocusableClientIfNeeded())},hidden:function(a){var b=this._clients.indexOf(a);-1!==b&&(this._clients.splice(b,1),a.setZIndex(""),a.onHide(),0===this._clients.length?l.hidden(this):(l.updated(this),this._activateTopFocusableClientIfNeeded()))},keyDown:function(a,b){l.keyDown(this,b)},keyUp:function(a,b){l.keyUp(this,b)},keyPress:function(a,b){l.keyPress(this,b)},clients:{get:function(){return this._clients}},_clientForElement:function(a){for(var b=this._clients.length-1;b>=0;b--)if(this._clients[b].containsElement(a))return this._clients[b];return null},_focusableClientForElement:function(a){for(var b=this._clients.length-1;b>=0;b--)if(this._clients[b]._focusable&&this._clients[b].containsElement(a))return this._clients[b];return null},_getTopmostFocusableClient:function(){for(var a=this._clients.length-1;a>=0;a--){var b=this._clients[a];if(b&&b._focusable)return b}return null},_activateTopFocusableClientIfNeeded:function(){var a=this._getTopmostFocusableClient();if(a&&l.isTopmost(this)){var b=!o._keyboardSeenLast;a.onTakeFocus(b)}},setZIndex:function(a){this._clients.forEach(function(b,c){b.setZIndex(a+c)},this)},getZIndexCount:function(){return this._clients.length},containsElement:function(a){return!!this._clientForElement(a)},onTakeFocus:function(a){var c=this._focusableClientForElement(b.document.activeElement);!c&&-1!==this._clients.indexOf(this._currentlyFocusedClient)&&this._currentlyFocusedClient._focusable&&(c=this._currentlyFocusedClient),c||(c=this._getTopmostFocusableClient()),this._currentlyFocusedClient=c,c&&c.onTakeFocus(a)},onFocus:function(a){this._currentlyFocusedClient=this._clientForElement(a),this._currentlyFocusedClient&&this._currentlyFocusedClient.onFocus(a)},onShow:function(a){},onHide:function(){this._currentlyFocusedClient=null},onKeyInStack:function(a){var b=this._clients.indexOf(this._currentlyFocusedClient);if(-1!==b)for(var c=this._clients.slice(0,b+1),d=c.length-1;d>=0&&!a.propagationStopped;d--)c[d]._focusable&&c[d].onKeyInStack(a)},onShouldLightDismiss:function(a){return l.DismissalPolicies.light(a)},onLightDismiss:function(a){this._onLightDismiss(a)}}),w=c.Class.define(function(){var a=this;this._dismissableLayer=new v(function(b){b.reason===l.LightDismissalReasons.escape?a.collapseFlyout(a.getAt(a.length-1)):a.collapseAll()}),this._cascadingStack=[],this._handleKeyDownInCascade_bound=this._handleKeyDownInCascade.bind(this),this._inputType=null},{appendFlyout:function(a){if(g.log&&this.reentrancyLock&&g.log("_CascadeManager is attempting to append a Flyout through reentrancy.","winjs _CascadeManager","error"),this.indexOf(a)<0){var b=this.collapseAll;if(a._positionRequest instanceof y.AnchorPositioning){var c=this.indexOfElement(a._positionRequest.anchor);c>=0&&(b=function(){this.collapseFlyout(this.getAt(c+1))})}b.call(this),a.element.addEventListener("keydown",this._handleKeyDownInCascade_bound,!1),this._cascadingStack.push(a)}},collapseFlyout:function(a){if(!this.reentrancyLock&&a&&this.indexOf(a)>=0){this.reentrancyLock=!0;var b=new k;this.unlocked=b.promise;for(var c;this.length&&a!==c;)c=this._cascadingStack.pop(),c.element.removeEventListener("keydown",this._handleKeyDownInCascade_bound,!1),c._hide();0===this._cascadingStack.length&&(this._inputType=null),this.reentrancyLock=!1,this.unlocked=null,b.complete()}},flyoutShown:function(a){this._dismissableLayer.shown(a._dismissable)},flyoutHiding:function(a){this._dismissableLayer.hiding(a._dismissable)},flyoutHidden:function(a){this._dismissableLayer.hidden(a._dismissable)},collapseAll:function(){var a=this.getAt(0);a&&this.collapseFlyout(a)},indexOf:function(a){return this._cascadingStack.indexOf(a)},indexOfElement:function(a){for(var b=-1,c=0,d=this.length;d>c;c++){var e=this.getAt(c);if(e.element.contains(a)){b=c;break}}return b},length:{get:function(){return this._cascadingStack.length}},getAt:function(a){return this._cascadingStack[a]},handleFocusIntoFlyout:function(a){var b=this.indexOfElement(a.target);if(b>=0){var c=this.getAt(b+1);this.collapseFlyout(c)}},inputType:{get:function(){return this._inputType||(this._inputType=o._lastInputType),this._inputType}},dismissableLayer:{get:function(){return this._dismissableLayer}},_handleKeyDownInCascade:function(a){var b="rtl"===n._getComputedStyle(a.target).direction,c=b?s.rightArrow:s.leftArrow,d=a.target;if(a.keyCode===c){var e=this.indexOfElement(d);if(e>=1){var f=this.getAt(e);this.collapseFlyout(f),a.preventDefault()}}else(a.keyCode===s.alt||a.keyCode===s.F10)&&this.collapseAll()}}),x={top:{top:"50px",left:"0px",keyframe:"WinJS-showFlyoutTop"},bottom:{top:"-50px",left:"0px",keyframe:"WinJS-showFlyoutBottom"},left:{top:"0px",left:"50px",keyframe:"WinJS-showFlyoutLeft"},right:{top:"0px",left:"-50px",keyframe:"WinJS-showFlyoutRight"}},y={AnchorPositioning:c.Class.define(function(a,c,d){if("string"==typeof a?a=b.document.getElementById(a):a&&a.element&&(a=a.element),!a)throw new e("WinJS.UI.Flyout.NoAnchor",t.noAnchor);this.anchor=a,this.placement=c,this.alignment=d},{getTopLeft:function(a,b){function c(a){h(a)?(z=f(a)-y,u=r._Overlay._keyboardInfo._visibleDocTop,w=x.top):(z=g(a)-y,u=q.pinToBottomEdge,w=x.bottom),v=!0}function d(a,b){return(r._Overlay._keyboardInfo._visibleDocHeight-a.height)/2>=b.totalHeight}function f(a){return a.top-r._Overlay._keyboardInfo._visibleDocTop}function g(a){return r._Overlay._keyboardInfo._visibleDocBottom-a.bottom}function h(a){return f(a)>g(a)}function i(a,b){return u=a-b.totalHeight,w=x.top,u>=r._Overlay._keyboardInfo._visibleDocTop&&u+b.totalHeight<=r._Overlay._keyboardInfo._visibleDocBottom}function j(a,b){return u=a,w=x.bottom,u>=r._Overlay._keyboardInfo._visibleDocTop&&u+b.totalHeight<=r._Overlay._keyboardInfo._visibleDocBottom}function k(a,b){return s=a-b.totalWidth,w=x.left,s>=0&&s+b.totalWidth<=r._Overlay._keyboardInfo._visualViewportWidth}function l(a,b){return s=a,w=x.right,s>=0&&s+b.totalWidth<=r._Overlay._keyboardInfo._visualViewportWidth}function m(a,b){u=a.top+a.height/2-b.totalHeight/2,u<r._Overlay._keyboardInfo._visibleDocTop?u=r._Overlay._keyboardInfo._visibleDocTop:u+b.totalHeight>=r._Overlay._keyboardInfo._visibleDocBottom&&(u=q.pinToBottomEdge)}function n(a,b,c){if("center"===c)s=a.left+a.width/2-b.totalWidth/2;else if("left"===c)s=a.left;else{if("right"!==c)throw new e("WinJS.UI.Flyout.BadAlignment",t.badAlignment);s=a.right-b.totalWidth}0>s?s=0:s+b.totalWidth>=r._Overlay._keyboardInfo._visualViewportWidth&&(s=q.pinToRightEdge)}var o;try{o=this.anchor.getBoundingClientRect()}catch(p){throw new e("WinJS.UI.Flyout.NoAnchor",t.noAnchor)}var s,u,v,w,y=a.totalHeight-a.contentHeight,z=a.contentHeight,A=this.alignment;switch(this.placement){case"top":i(o.top,a)||(u=r._Overlay._keyboardInfo._visibleDocTop,v=!0,z=f(o)-y),n(o,a,A);break;case"bottom":j(o.bottom,a)||(u=q.pinToBottomEdge,v=!0,z=g(o)-y),n(o,a,A);break;case"left":k(o.left,a)||(s=0),m(o,a);break;case"right":l(o.right,a)||(s=q.pinToRightEdge),m(o,a);break;case"autovertical":i(o.top,a)||j(o.bottom,a)||c(o),n(o,a,A);break;case"autohorizontal":k(o.left,a)||l(o.right,a)||(s=q.pinToRightEdge),m(o,a);break;case"auto":d(o,a)?(i(o.top,a)||j(o.bottom,a),n(o,a,A)):k(o.left,a)||l(o.right,a)?m(o,a):(c(o),n(o,a,A));break;case"_cascade":j(o.top-a.marginTop,a)||i(o.bottom+a.marginBottom,a)||m(o,a);var B=3,C=o.right-a.marginLeft-B,D=o.left+a.marginRight+B;b?k(D,a)||l(C,a)||(s=0,w=x.left):l(C,a)||k(D,a)||(s=q.pinToRightEdge,w=x.right);break;default:throw new e("WinJS.UI.Flyout.BadPlacement",t.badPlacement)}return{left:s,top:u,animOffset:w,doesScroll:v,contentHeight:z,verticalMarginBorderPadding:y}}}),CoordinatePositioning:c.Class.define(function(a){if(a.clientX===+a.clientX&&a.clientY===+a.clientY){var b=a;a={x:b.clientX,y:b.clientY}}else if(a.x!==+a.x||a.y!==+a.y)throw new e("WinJS.UI.Flyout.NoCoordinates",t.noCoordinates);this.coordinates=a},{getTopLeft:function(a,b){var c=this.coordinates,d=a.totalWidth-a.marginLeft-a.marginRight,e=b?d:0,f=a.totalHeight-a.contentHeight,g=a.contentHeight,h=c.y-a.marginTop,i=c.x-a.marginLeft-e;return 0>h?h=0:h+a.totalHeight>r._Overlay._keyboardInfo._visibleDocBottom&&(h=q.pinToBottomEdge),0>i?i=0:i+a.totalWidth>r._Overlay._keyboardInfo._visualViewportWidth&&(i=q.pinToRightEdge),{left:i,top:h,verticalMarginBorderPadding:f,contentHeight:g,doesScroll:!1,animOffset:x.top}}})},z=c.Class.derive(r._Overlay,function(a,c){c=c||{},this._element=a||b.document.createElement("div"),this._id=this._element.id||n._uniqueID(this._element),this._writeProfilerMark("constructor,StartTM"),this._baseFlyoutConstructor(this._element,c);var d=this._element.getElementsByTagName("*"),e=this._addFirstDiv();e.tabIndex=n._getLowestTabIndexInList(d);var f=this._addFinalDiv();return f.tabIndex=n._getHighestTabIndexInList(d),this._element.addEventListener("keydown",this._handleKeyDown,!0),this._writeProfilerMark("constructor,StopTM"),this},{_lastMaxHeight:null,_baseFlyoutConstructor:function(a,b){this._placement="auto",this._alignment="center",this._baseOverlayConstructor(a,b),this._element.style.visibilty="hidden",this._element.style.display="none",n.addClass(this._element,q.flyoutClass);var c=this;this._dismissable=new l.LightDismissableElement({element:this._element,tabIndex:this._element.hasAttribute("tabIndex")?this._element.tabIndex:-1,onLightDismiss:function(){c.hide()},onTakeFocus:function(a){c._dismissable.restoreFocus()||(n.hasClass(c.element,q.menuClass)?r._Overlay._trySetActive(c._element):c._focusOnFirstFocusableElementOrThis())}});var d=this._element.getAttribute("role");(null===d||""===d||void 0===d)&&(n.hasClass(this._element,q.menuClass)?this._element.setAttribute("role","menu"):this._element.setAttribute("role","dialog"));var e=this._element.getAttribute("aria-label");(null===e||""===e||void 0===e)&&this._element.setAttribute("aria-label",t.ariaLabel),this._currentAnimateIn=this._flyoutAnimateIn,this._currentAnimateOut=this._flyoutAnimateOut,n._addEventListener(this.element,"focusin",this._handleFocusIn.bind(this),!1)},anchor:{get:function(){return this._anchor},set:function(a){this._anchor=a}},placement:{get:function(){return this._placement},set:function(a){if("top"!==a&&"bottom"!==a&&"left"!==a&&"right"!==a&&"auto"!==a&&"autohorizontal"!==a&&"autovertical"!==a)throw new e("WinJS.UI.Flyout.BadPlacement",t.badPlacement);this._placement=a}},alignment:{get:function(){return this._alignment},set:function(a){if("right"!==a&&"left"!==a&&"center"!==a)throw new e("WinJS.UI.Flyout.BadAlignment",t.badAlignment);this._alignment=a}},disabled:{get:function(){return!!this._element.disabled},set:function(a){a=!!a;var b=!!this._element.disabled;b!==a&&(this._element.disabled=a,!this.hidden&&this._element.disabled&&this.hide())}},onbeforeshow:u(r._Overlay.beforeShow),onaftershow:u(r._Overlay.afterShow),onbeforehide:u(r._Overlay.beforeHide),onafterhide:u(r._Overlay.afterHide),_dispose:function(){m.disposeSubTree(this.element),this._hide(),z._cascadeManager.flyoutHidden(this),this.anchor=null},show:function(a,b,c){this._writeProfilerMark("show,StartTM"),this._positionRequest=new y.AnchorPositioning(a||this._anchor,b||this._placement,c||this._alignment),this._show()},_show:function(){this._baseFlyoutShow()},showAt:function(a){this._writeProfilerMark("show,StartTM"),this._positionRequest=new y.CoordinatePositioning(a),this._show()},hide:function(){this._writeProfilerMark("hide,StartTM"),this._hide()},_hide:function(){z._cascadeManager.collapseFlyout(this),this._baseHide()&&z._cascadeManager.flyoutHiding(this)},_beforeEndHide:function(){z._cascadeManager.flyoutHidden(this)},_baseFlyoutShow:function(){if(!this.disabled&&!this._disposed)if(z._cascadeManager.appendFlyout(this),this._element.winAnimating)this._doNext="show";else if(z._cascadeManager.reentrancyLock){this._doNext="show";var a=this;z._cascadeManager.unlocked.then(function(){a._checkDoNext()})}else if(this._baseShow()){if(!n.hasClass(this.element,"win-menu")){var b=this._element.getElementsByTagName("*"),c=this.element.querySelectorAll(".win-first");this.element.children.length&&!n.hasClass(this.element.children[0],q.firstDivClass)&&(c&&c.length>0&&c.item(0).parentNode.removeChild(c.item(0)),c=this._addFirstDiv()),c.tabIndex=n._getLowestTabIndexInList(b);var d=this.element.querySelectorAll(".win-final");n.hasClass(this.element.children[this.element.children.length-1],q.finalDivClass)||(d&&d.length>0&&d.item(0).parentNode.removeChild(d.item(0)),d=this._addFinalDiv()),d.tabIndex=n._getHighestTabIndexInList(b)}z._cascadeManager.flyoutShown(this)}},_lightDismiss:function(){z._cascadeManager.collapseAll()},_ensurePosition:function(){this._keyboardMovedUs=!1,this._clearAdjustedStyles(),this._setAlignment();var a=p(this._element),b="rtl"===n._getComputedStyle(this._element).direction;this._currentPosition=this._positionRequest.getTopLeft(a,b),this._currentPosition.top<0?(this._element.style.bottom=r._Overlay._keyboardInfo._visibleDocBottomOffset+"px",this._element.style.top="auto"):(this._element.style.top=this._currentPosition.top+"px",this._element.style.bottom="auto"),this._currentPosition.left<0?(this._element.style.right="0px",this._element.style.left="auto"):(this._element.style.left=this._currentPosition.left+"px",this._element.style.right="auto"),this._currentPosition.doesScroll&&(n.addClass(this._element,q.scrollsClass),this._lastMaxHeight=this._element.style.maxHeight,this._element.style.maxHeight=this._currentPosition.contentHeight+"px"),r._Overlay._keyboardInfo._visible&&(this._checkKeyboardFit(),this._keyboardMovedUs&&this._adjustForKeyboard())},_clearAdjustedStyles:function(){this._element.style.top="0px",this._element.style.bottom="auto",this._element.style.left="0px",this._element.style.right="auto",n.removeClass(this._element,q.scrollsClass),null!==this._lastMaxHeight&&(this._element.style.maxHeight=this._lastMaxHeight,this._lastMaxHeight=null),n.removeClass(this._element,"win-rightalign"),n.removeClass(this._element,"win-leftalign")},_setAlignment:function(){switch(this._positionRequest.alignment){case"left":n.addClass(this._element,"win-leftalign");break;case"right":n.addClass(this._element,"win-rightalign")}},_showingKeyboard:function(a){if(!this.hidden&&(a.ensuredFocusedElementInView=!0,this._checkKeyboardFit(),this._keyboardMovedUs)){this._element.style.opacity=0;var c=this;b.setTimeout(function(){c._adjustForKeyboard(),c._baseAnimateIn()},r._Overlay._keyboardInfo._animationShowLength)}},_resize:function(){if((!this.hidden||this._animating)&&this._needToHandleHidingKeyboard){var a=this;d._setImmediate(function(){(!a.hidden||a._animating)&&a._ensurePosition()}),this._needToHandleHidingKeyboard=!1}},_checkKeyboardFit:function(){var a=!1,b=r._Overlay._keyboardInfo._visibleDocHeight,c=this._currentPosition.contentHeight+this._currentPosition.verticalMarginBorderPadding;c>b?(a=!0,this._currentPosition.top=q.pinToBottomEdge,this._currentPosition.contentHeight=b-this._currentPosition.verticalMarginBorderPadding,this._currentPosition.doesScroll=!0):this._currentPosition.top>=0&&this._currentPosition.top+c>r._Overlay._keyboardInfo._visibleDocBottom?(this._currentPosition.top=q.pinToBottomEdge,a=!0):this._currentPosition.top===q.pinToBottomEdge&&(a=!0),this._keyboardMovedUs=a},_adjustForKeyboard:function(){this._currentPosition.doesScroll&&(this._lastMaxHeight||(n.addClass(this._element,q.scrollsClass),this._lastMaxHeight=this._element.style.maxHeight),this._element.style.maxHeight=this._currentPosition.contentHeight+"px"),this._checkScrollPosition(!0)},_hidingKeyboard:function(){if(!this.hidden||this._animating)if(r._Overlay._keyboardInfo._isResized)this._needToHandleHidingKeyboard=!0;else{var a=this;d._setImmediate(function(){(!a.hidden||a._animating)&&a._ensurePosition()})}},_checkScrollPosition:function(a){(!this.hidden||a)&&(this._currentPosition.top<0?(this._element.style.bottom=r._Overlay._keyboardInfo._visibleDocBottomOffset+"px",this._element.style.top="auto"):(this._element.style.top=this._currentPosition.top+"px",this._element.style.bottom="auto"))},_flyoutAnimateIn:function(){return this._keyboardMovedUs?this._baseAnimateIn():(this._element.style.opacity=1,this._element.style.visibility="visible",j.showPopup(this._element,this._currentPosition.animOffset))},_flyoutAnimateOut:function(){return this._keyboardMovedUs?this._baseAnimateOut():(this._element.style.opacity=0,j.hidePopup(this._element,this._currentPosition.animOffset))},_hideAllOtherFlyouts:function(a){for(var c=b.document.querySelectorAll("."+q.flyoutClass),d=0;d<c.length;d++){var e=c[d].winControl;e&&!e.hidden&&e!==a&&e.hide()}},_handleKeyDown:function(a){a.keyCode!==s.space&&a.keyCode!==s.enter||this!==b.document.activeElement?!a.shiftKey||a.keyCode!==s.tab||this!==b.document.activeElement||a.altKey||a.ctrlKey||a.metaKey||(a.preventDefault(),a.stopPropagation(),this.winControl._focusOnLastFocusableElementOrThis()):(a.preventDefault(),a.stopPropagation(),this.winControl.hide())},_handleFocusIn:function(a){this.element.contains(a.relatedTarget)||z._cascadeManager.handleFocusIntoFlyout(a)},_addFirstDiv:function(){var a=b.document.createElement("div");a.className=q.firstDivClass,a.style.display="inline",a.setAttribute("role","menuitem"),a.setAttribute("aria-hidden","true"),this._element.children[0]?this._element.insertBefore(a,this._element.children[0]):this._element.appendChild(a);var c=this;return n._addEventListener(a,"focusin",function(){c._focusOnLastFocusableElementOrThis()},!1),a},_addFinalDiv:function(){var a=b.document.createElement("div");a.className=q.finalDivClass,a.style.display="inline",a.setAttribute("role","menuitem"),a.setAttribute("aria-hidden","true"),this._element.appendChild(a);var c=this;return n._addEventListener(a,"focusin",function(){c._focusOnFirstFocusableElementOrThis()},!1),a},_writeProfilerMark:function(a){i("WinJS.UI.Flyout:"+this._id+":"+a)}},{_cascadeManager:new w});return z})})}),d("WinJS/Controls/CommandingSurface/_Constants",["require","exports"],function(a,b){b.ClassNames={controlCssClass:"win-commandingsurface",disposableCssClass:"win-disposable",tabStopClass:"win-commandingsurface-tabstop",contentClass:"win-commandingsurface-content",actionAreaCssClass:"win-commandingsurface-actionarea",actionAreaContainerCssClass:"win-commandingsurface-actionareacontainer",overflowButtonCssClass:"win-commandingsurface-overflowbutton",spacerCssClass:"win-commandingsurface-spacer",ellipsisCssClass:"win-commandingsurface-ellipsis",overflowAreaCssClass:"win-commandingsurface-overflowarea",overflowAreaContainerCssClass:"win-commandingsurface-overflowareacontainer",contentFlyoutCssClass:"win-commandingsurface-contentflyout",menuCssClass:"win-menu",menuContainsToggleCommandClass:"win-menu-containstogglecommand",insetOutlineClass:"win-commandingsurface-insetoutline",openingClass:"win-commandingsurface-opening",openedClass:"win-commandingsurface-opened",closingClass:"win-commandingsurface-closing",closedClass:"win-commandingsurface-closed",noneClass:"win-commandingsurface-closeddisplaynone",minimalClass:"win-commandingsurface-closeddisplayminimal",compactClass:"win-commandingsurface-closeddisplaycompact",fullClass:"win-commandingsurface-closeddisplayfull",overflowTopClass:"win-commandingsurface-overflowtop",overflowBottomClass:"win-commandingsurface-overflowbottom",commandHiddenClass:"win-commandingsurface-command-hidden",commandPrimaryOverflownPolicyClass:"win-commandingsurface-command-primary-overflown",commandSecondaryOverflownPolicyClass:"win-commandingsurface-command-secondary-overflown",commandSeparatorHiddenPolicyClass:"win-commandingsurface-command-separator-hidden"},b.EventNames={beforeOpen:"beforeopen",afterOpen:"afteropen",beforeClose:"beforeclose",afterClose:"afterclose",commandPropertyMutated:"_commandpropertymutated"},b.actionAreaCommandWidth=68,b.actionAreaSeparatorWidth=34,b.actionAreaOverflowButtonWidth=32,b.overflowCommandHeight=44,b.overflowSeparatorHeight=12,b.controlMinWidth=b.actionAreaOverflowButtonWidth,b.overflowAreaMaxWidth=480,b.heightOfMinimal=24,b.heightOfCompact=48,b.contentMenuCommandDefaultLabel="Custom content",b.defaultClosedDisplayMode="compact",b.defaultOpened=!1,b.defaultOverflowDirection="bottom",b.typeSeparator="separator",b.typeContent="content",b.typeButton="button",b.typeToggle="toggle",b.typeFlyout="flyout",b.commandSelector=".win-command",b.primaryCommandSection="primary",b.secondaryCommandSection="secondary"}),d("WinJS/Controls/ToolBar/_Constants",["require","exports","../CommandingSurface/_Constants"],function(a,b,c){b.ClassNames={controlCssClass:"win-toolbar",disposableCssClass:"win-disposable",actionAreaCssClass:"win-toolbar-actionarea",overflowButtonCssClass:"win-toolbar-overflowbutton",spacerCssClass:"win-toolbar-spacer",ellipsisCssClass:"win-toolbar-ellipsis",overflowAreaCssClass:"win-toolbar-overflowarea",contentFlyoutCssClass:"win-toolbar-contentflyout",emptytoolbarCssClass:"win-toolbar-empty",menuCssClass:"win-menu",menuContainsToggleCommandClass:"win-menu-containstogglecommand",openedClass:"win-toolbar-opened",closedClass:"win-toolbar-closed",compactClass:"win-toolbar-closeddisplaycompact",fullClass:"win-toolbar-closeddisplayfull",overflowTopClass:"win-toolbar-overflowtop",overflowBottomClass:"win-toolbar-overflowbottom",placeHolderCssClass:"win-toolbar-placeholder"},b.EventNames={beforeOpen:"beforeopen",afterOpen:"afteropen",beforeClose:"beforeclose",afterClose:"afterclose"},b.OverflowDirection={top:"top",bottom:"bottom"},b.overflowAreaMaxWidth=c.overflowAreaMaxWidth,b.controlMinWidth=c.controlMinWidth,b.defaultClosedDisplayMode="compact",b.defaultOpened=!1,b.typeSeparator="separator",b.typeContent="content",b.typeButton="button",b.typeToggle="toggle",b.typeFlyout="flyout",b.commandSelector=".win-command",b.primaryCommandSection="primary",b.secondaryCommandSection="secondary"}),d("WinJS/Controls/AppBar/_Icon",["exports","../../Core/_Base","../../Core/_Resources"],function(a,b,c){"use strict";var d=["previous","next","play","pause","edit","save","clear","delete","remove","add","cancel","accept","more","redo","undo","home","up","forward","right","back","left","favorite","camera","settings","video","sync","download","mail","find","help","upload","emoji","twopage","leavechat","mailforward","clock","send","crop","rotatecamera","people","closepane","openpane","world","flag","previewlink","globe","trim","attachcamera","zoomin","bookmarks","document","protecteddocument","page","bullets","comment","mail2","contactinfo","hangup","viewall","mappin","phone","videochat","switch","contact","rename","pin","musicinfo","go","keyboard","dockleft","dockright","dockbottom","remote","refresh","rotate","shuffle","list","shop","selectall","orientation","import","importall","browsephotos","webcam","pictures","savelocal","caption","stop","showresults","volume","repair","message","page2","calendarday","calendarweek","calendar","characters","mailreplyall","read","link","accounts","showbcc","hidebcc","cut","attach","paste","filter","copy","emoji2","important","mailreply","slideshow","sort","manage","allapps","disconnectdrive","mapdrive","newwindow","openwith","contactpresence","priority","uploadskydrive","gototoday","font","fontcolor","contact2","folder","audio","placeholder","view","setlockscreen","settile","cc","stopslideshow","permissions","highlight","disableupdates","unfavorite","unpin","openlocal","mute","italic","underline","bold","movetofolder","likedislike","dislike","like","alignright","aligncenter","alignleft","zoom","zoomout","openfile","otheruser","admin","street","map","clearselection","fontdecrease","fontincrease","fontsize","cellphone","reshare","tag","repeatone","repeatall","outlinestar","solidstar","calculator","directions","target","library","phonebook","memo","microphone","postupdate","backtowindow","fullscreen","newfolder","calendarreply","unsyncfolder","reporthacked","syncfolder","blockcontact","switchapps","addfriend","touchpointer","gotostart","zerobars","onebar","twobars","threebars","fourbars","scan","preview","hamburger"],e=d.reduce(function(a,b){return a[b]={get:function(){return c._getWinJSString("ui/appBarIcons/"+b).value}},a},{});b.Namespace._moduleDefine(a,"WinJS.UI.AppBarIcon",e)}),d("WinJS/Controls/AppBar/_Command",["exports","../../Core/_Global","../../Core/_WinRT","../../Core/_Base","../../Core/_BaseUtils","../../Core/_ErrorFromName","../../Core/_Events","../../Core/_Resources","../../Utilities/_Control","../../Utilities/_Dispose","../../Utilities/_ElementUtilities","../Flyout/_Overlay","../Tooltip","../_LegacyAppBar/_Constants","./_Icon"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o){"use strict";d.Namespace._moduleDefine(a,"WinJS.UI",{AppBarCommand:d.Namespace._lazy(function(){function a(a){var c=this.winControl;if(c){if(c._type===n.typeToggle)c.selected=!c.selected;else if(c._type===n.typeFlyout&&c._flyout){var d=c._flyout;"string"==typeof d&&(d=b.document.getElementById(d)),d.show||(d=d.winControl),d&&d.show&&d.show(this,"autovertical")}c.onclick&&c.onclick(a)}}function p(a,b){var c=a[b],d=a.constructor.prototype,e=q(d,b)||{},f=e.get.bind(a)||function(){return c},g=e.set.bind(a)||function(a){c=a};Object.defineProperty(a,b,{get:function(){return f()},set:function(c){var d=f();g(c);var e=f();this._disposed||d===c||d===e||a._disposed||a._propertyMutations.dispatchEvent(n.commandPropertyMutated,{command:a,propertyName:b,oldValue:d,newValue:e})}})}function q(a,b){for(var c=null;a&&!c;)c=Object.getOwnPropertyDescriptor(a,b),a=Object.getPrototypeOf(a);return c}var r=d.Class.define(function(){this._observer=e._merge({},g.eventMixin)},{bind:function(a){this._observer.addEventListener(n.commandPropertyMutated,a)},unbind:function(a){this._observer.removeEventListener(n.commandPropertyMutated,a)},dispatchEvent:function(a,b){this._observer.dispatchEvent(a,b)}}),s={get ariaLabel(){return h._getWinJSString("ui/appBarCommandAriaLabel").value},get duplicateConstruction(){return"Invalid argument: Controls may only be instantiated one time for each DOM element"},get badClick(){return"Invalid argument: The onclick property for an {0} must be a function"},get badDivElement(){return"Invalid argument: For a content command, the element must be null or a div element"},get badHrElement(){return"Invalid argument: For a separator, the element must be null or an hr element"},get badButtonElement(){return"Invalid argument: For a button, toggle, or flyout command, the element must be null or a button element"},get badPriority(){return"Invalid argument: the priority of an {0} must be a non-negative integer"}},t=d.Class.define(function(b,c){if(b&&b.winControl)throw new f("WinJS.UI.AppBarCommand.DuplicateConstruction",s.duplicateConstruction);if(this._disposed=!1,c||(c={}),c.type||(this._type=n.typeButton),c.section=c.section||n.sectionPrimary,this._element=b,c.type===n.typeContent?this._createContent():c.type===n.typeSeparator?this._createSeparator():this._createButton(),k.addClass(this._element,"win-disposable"),this._element.winControl=this,k.addClass(this._element,n.appBarCommandClass),c.onclick&&(this.onclick=c.onclick),c.onclick=a,i.setOptions(this,c),this._type!==n.typeToggle||c.selected||(this.selected=!1),this._type!==n.typeSeparator){var d=this._element.getAttribute("role");(null===d||""===d||void 0===d)&&(d=this._type===n.typeToggle?"checkbox":this._type===n.typeContent?"group":"menuitem",this._element.setAttribute("role",d),this._type===n.typeFlyout&&this._element.setAttribute("aria-haspopup",!0));var e=this._element.getAttribute("aria-label");(null===e||""===e||void 0===e)&&this._element.setAttribute("aria-label",s.ariaLabel)}this._propertyMutations=new r;var g=this;u.forEach(function(a){p(g,a)})},{id:{get:function(){return this._element.id},set:function(a){a&&!this._element.id&&(this._element.id=a)}},type:{get:function(){return this._type},set:function(a){this._type||(a!==n.typeContent&&a!==n.typeFlyout&&a!==n.typeToggle&&a!==n.typeSeparator?this._type=n.typeButton:this._type=a)}},label:{get:function(){return this._label},set:function(a){this._label=a,this._labelSpan&&(this._labelSpan.textContent=this.label),!this.tooltip&&this._tooltipControl&&(this._tooltip=this.label,this._tooltipControl.innerHTML=this.label),this._element.setAttribute("aria-label",this.label),this._testIdenticalTooltip()}},icon:{get:function(){return this._icon},set:function(a){this._icon=o[a]||a,this._imageSpan&&(this._icon&&1===this._icon.length?(this._imageSpan.textContent=this._icon,this._imageSpan.style.backgroundImage="",this._imageSpan.style.msHighContrastAdjust="",k.addClass(this._imageSpan,"win-commandglyph")):(this._imageSpan.textContent="",this._imageSpan.style.backgroundImage=this._icon,this._imageSpan.style.msHighContrastAdjust="none",k.removeClass(this._imageSpan,"win-commandglyph")))}},onclick:{get:function(){return this._onclick},set:function(a){if(a&&"function"!=typeof a)throw new f("WinJS.UI.AppBarCommand.BadClick",h._formatString(s.badClick,"AppBarCommand"));this._onclick=a}},priority:{get:function(){return this._priority},set:function(a){if(!(void 0===a||"number"==typeof a&&a>=0))throw new f("WinJS.UI.AppBarCommand.BadPriority",h._formatString(s.badPriority,"AppBarCommand"));this._priority=a}},flyout:{get:function(){var a=this._flyout;return"string"==typeof a&&(a=b.document.getElementById(a)),a&&!a.element&&a.winControl&&(a=a.winControl),a},set:function(a){var b=a;b&&"string"!=typeof b&&(b.element&&(b=b.element),b&&(b.id?b=b.id:(b.id=k._uniqueID(b),b=b.id))),"string"==typeof b&&this._element.setAttribute("aria-owns",b),this._flyout=a}},section:{get:function(){return this._section;
},set:function(a){(!this._section||c.Windows.ApplicationModel.DesignMode.designModeEnabled)&&this._setSection(a)}},tooltip:{get:function(){return this._tooltip},set:function(a){this._tooltip=a,this._tooltipControl&&(this._tooltipControl.innerHTML=this._tooltip),this._testIdenticalTooltip()}},selected:{get:function(){return"true"===this._element.getAttribute("aria-checked")},set:function(a){this._element.setAttribute("aria-checked",a)}},element:{get:function(){return this._element}},disabled:{get:function(){return!!this._element.disabled},set:function(a){this._element.disabled=a}},hidden:{get:function(){return k.hasClass(this._element,n.commandHiddenClass)},set:function(a){if(a!==this.hidden){var b=this.hidden;a?k.addClass(this._element,n.commandHiddenClass):k.removeClass(this._element,n.commandHiddenClass),this._sendEvent(n.commandVisibilityChanged)||(b?k.addClass(this._element,n.commandHiddenClass):k.removeClass(this._element,n.commandHiddenClass))}}},firstElementFocus:{get:function(){return this._firstElementFocus||this._lastElementFocus||this._element},set:function(a){this._firstElementFocus=a===this.element?null:a,this._updateTabStop()}},lastElementFocus:{get:function(){return this._lastElementFocus||this._firstElementFocus||this._element},set:function(a){this._lastElementFocus=a===this.element?null:a,this._updateTabStop()}},dispose:function(){this._disposed||(this._disposed=!0,this._tooltipControl&&this._tooltipControl.dispose(),this._type===n.typeContent&&j.disposeSubTree(this.element))},addEventListener:function(a,b,c){return this._element.addEventListener(a,b,c)},removeEventListener:function(a,b,c){return this._element.removeEventListener(a,b,c)},extraClass:{get:function(){return this._extraClass},set:function(a){this._extraClass&&k.removeClass(this._element,this._extraClass),this._extraClass=a,k.addClass(this._element,this._extraClass)}},_testIdenticalTooltip:function(){this._hideIfFullSize=this._label===this._tooltip},_createContent:function(){if(this._element){if("DIV"!==this._element.tagName)throw new f("WinJS.UI.AppBarCommand.BadDivElement",s.badDivElement)}else this._element=b.document.createElement("div");parseInt(this._element.getAttribute("tabIndex"),10)!==this._element.tabIndex&&(this._element.tabIndex=0)},_createSeparator:function(){if(this._element){if("HR"!==this._element.tagName)throw new f("WinJS.UI.AppBarCommand.BadHrElement",s.badHrElement)}else this._element=b.document.createElement("hr")},_createButton:function(){if(this._element){if("BUTTON"!==this._element.tagName)throw new f("WinJS.UI.AppBarCommand.BadButtonElement",s.badButtonElement);var a=this._element.getAttribute("type");(null===a||""===a||void 0===a)&&this._element.setAttribute("type","button"),this._element.innerHTML=""}else this._element=b.document.createElement("button");this._element.type="button",this._iconSpan=b.document.createElement("span"),this._iconSpan.setAttribute("aria-hidden","true"),this._iconSpan.className="win-commandicon",this._iconSpan.tabIndex=-1,this._element.appendChild(this._iconSpan),this._imageSpan=b.document.createElement("span"),this._imageSpan.setAttribute("aria-hidden","true"),this._imageSpan.className="win-commandimage",this._imageSpan.tabIndex=-1,this._iconSpan.appendChild(this._imageSpan),this._labelSpan=b.document.createElement("span"),this._labelSpan.setAttribute("aria-hidden","true"),this._labelSpan.className="win-label",this._labelSpan.tabIndex=-1,this._element.appendChild(this._labelSpan),this._tooltipControl=new m.Tooltip(this._element);var c=this;this._tooltipControl.addEventListener("beforeopen",function(){c._hideIfFullSize&&!l._Overlay._getParentControlUsingClassName(c._element.parentElement,n.reducedClass)&&c._tooltipControl.close()},!1)},_setSection:function(a){a||(a=n.sectionPrimary),this._section&&(this._section===n.sectionGlobal?k.removeClass(this._element,n.appBarCommandGlobalClass):this.section===n.sectionSelection&&k.removeClass(this._element,n.appBarCommandSelectionClass)),this._section=a,a===n.sectionGlobal?k.addClass(this._element,n.appBarCommandGlobalClass):a===n.sectionSelection&&k.addClass(this._element,n.appBarCommandSelectionClass)},_updateTabStop:function(){this._firstElementFocus||this._lastElementFocus?this.element.tabIndex=-1:this.element.tabIndex=0},_isFocusable:function(){return!this.hidden&&this._type!==n.typeSeparator&&!this.element.disabled&&(this.firstElementFocus.tabIndex>=0||this.lastElementFocus.tabIndex>=0)},_sendEvent:function(a,c){if(!this._disposed){var d=b.document.createEvent("CustomEvent");return d.initCustomEvent(a,!0,!0,c||{}),this._element.dispatchEvent(d)}}}),u=["label","disabled","flyout","extraClass","selected","onclick","hidden"];return t})}),d.Namespace._moduleDefine(a,"WinJS.UI",{Command:d.Namespace._lazy(function(){return a.AppBarCommand})})}),d("WinJS/Controls/Menu/_Command",["exports","../../Core/_Global","../../Core/_Base","../../Core/_ErrorFromName","../../Core/_Resources","../../Promise","../../Utilities/_Control","../../Utilities/_ElementUtilities","../_LegacyAppBar/_Constants","../Flyout/_Overlay"],function(a,b,c,d,e,f,g,h,i,j){"use strict";c.Namespace._moduleDefine(a,"WinJS.UI",{MenuCommand:c.Namespace._lazy(function(){var a={get ariaLabel(){return e._getWinJSString("ui/menuCommandAriaLabel").value},get duplicateConstruction(){return"Invalid argument: Controls may only be instantiated one time for each DOM element"},get badClick(){return"Invalid argument: The onclick property for an {0} must be a function"},get badHrElement(){return"Invalid argument: For a separator, the element must be null or an hr element"},get badButtonElement(){return"Invalid argument: For a button, toggle, or flyout command, the element must be null or a button element"}},k=c.Class.define(function(b,c){if(b&&b.winControl)throw new d("WinJS.UI.MenuCommand.DuplicateConstruction",a.duplicateConstruction);if(this._disposed=!1,c||(c={}),c.type||(this._type=i.typeButton),this._element=b,c.type===i.typeSeparator?this._createSeparator():this._createButton(),h.addClass(this._element,"win-disposable"),this._element.winControl=this,h.addClass(this._element,i.menuCommandClass),c.selected||c.type!==i.typeToggle||(this.selected=!1),c.onclick&&(this.onclick=c.onclick),c.onclick=this._handleClick.bind(this),g.setOptions(this,c),this._type!==i.typeSeparator){var e=this._element.getAttribute("role");(null===e||""===e||void 0===e)&&(e="menuitem",this._type===i.typeToggle&&(e="checkbox"),this._element.setAttribute("role",e),this._type===i.typeFlyout&&this._element.setAttribute("aria-haspopup",!0));var f=this._element.getAttribute("aria-label");(null===f||""===f||void 0===f)&&this._element.setAttribute("aria-label",a.ariaLabel)}},{id:{get:function(){return this._element.id},set:function(a){this._element.id||(this._element.id=a)}},type:{get:function(){return this._type},set:function(a){this._type||(a!==i.typeButton&&a!==i.typeFlyout&&a!==i.typeToggle&&a!==i.typeSeparator&&(a=i.typeButton),this._type=a,a===i.typeButton?h.addClass(this.element,i.menuCommandButtonClass):a===i.typeFlyout?(h.addClass(this.element,i.menuCommandFlyoutClass),this.element.addEventListener("keydown",this._handleKeyDown.bind(this),!1)):a===i.typeSeparator?h.addClass(this.element,i.menuCommandSeparatorClass):a===i.typeToggle&&h.addClass(this.element,i.menuCommandToggleClass))}},label:{get:function(){return this._label},set:function(a){this._label=a||"",this._labelSpan&&(this._labelSpan.textContent=this.label),this._element.setAttribute("aria-label",this.label)}},onclick:{get:function(){return this._onclick},set:function(b){if(b&&"function"!=typeof b)throw new d("WinJS.UI.MenuCommand.BadClick",e._formatString(a.badClick,"MenuCommand"));this._onclick=b}},flyout:{get:function(){var a=this._flyout;return"string"==typeof a&&(a=b.document.getElementById(a)),a&&!a.element&&(a=a.winControl),a},set:function(a){var b=a;b&&"string"!=typeof b&&(b.element&&(b=b.element),b&&(b.id?b=b.id:(b.id=h._uniqueID(b),b=b.id))),"string"==typeof b&&this._element.setAttribute("aria-owns",b),this._flyout!==a&&k._deactivateFlyoutCommand(this),this._flyout=a}},selected:{get:function(){return"true"===this._element.getAttribute("aria-checked")},set:function(a){this._element.setAttribute("aria-checked",!!a)}},element:{get:function(){return this._element}},disabled:{get:function(){return!!this._element.disabled},set:function(a){a=!!a,a&&this.type===i.typeFlyout&&k._deactivateFlyoutCommand(this),this._element.disabled=a}},hidden:{get:function(){return"hidden"===this._element.style.visibility},set:function(a){var b=j._Overlay._getParentControlUsingClassName(this._element,i.menuClass);if(b&&!b.hidden)throw new d("WinJS.UI.MenuCommand.CannotChangeHiddenProperty",e._formatString(j._Overlay.commonstrings.cannotChangeHiddenProperty,"Menu"));var c=this._element.style;a?(this.type===i.typeFlyout&&k._deactivateFlyoutCommand(this),c.visibility="hidden",c.display="none"):(c.visibility="",c.display="block")}},extraClass:{get:function(){return this._extraClass},set:function(a){this._extraClass&&h.removeClass(this._element,this._extraClass),this._extraClass=a,h.addClass(this._element,this._extraClass)}},dispose:function(){this._disposed||(this._disposed=!0)},addEventListener:function(a,b,c){return this._element.addEventListener(a,b,c)},removeEventListener:function(a,b,c){return this._element.removeEventListener(a,b,c)},_createSeparator:function(){if(this._element){if("HR"!==this._element.tagName)throw new d("WinJS.UI.MenuCommand.BadHrElement",a.badHrElement)}else this._element=b.document.createElement("hr")},_createButton:function(){if(this._element){if("BUTTON"!==this._element.tagName)throw new d("WinJS.UI.MenuCommand.BadButtonElement",a.badButtonElement)}else this._element=b.document.createElement("button");this._element.innerHTML='<div class="win-menucommand-liner"><span class="win-toggleicon" aria-hidden="true"></span><span class="win-label" aria-hidden="true"></span><span class="win-flyouticon" aria-hidden="true"></span></div>',this._element.type="button",this._menuCommandLiner=this._element.firstElementChild,this._toggleSpan=this._menuCommandLiner.firstElementChild,this._labelSpan=this._toggleSpan.nextElementSibling,this._flyoutSpan=this._labelSpan.nextElementSibling},_sendEvent:function(a,c){if(!this._disposed){var d=b.document.createEvent("CustomEvent");d.initCustomEvent(a,!0,!0,c||{}),this._element.dispatchEvent(d)}},_invoke:function(a){this.hidden||this.disabled||this._disposed||(this._type===i.typeToggle?this.selected=!this.selected:this._type===i.typeFlyout&&k._activateFlyoutCommand(this),a&&"click"===a.type&&this.onclick&&this.onclick(a),this._sendEvent(i._menuCommandInvokedEvent,{command:this}))},_handleClick:function(a){this._invoke(a)},_handleKeyDown:function(a){var b=h.Key,c="rtl"===h._getComputedStyle(this.element).direction,d=c?b.leftArrow:b.rightArrow;a.keyCode===d&&this.type===i.typeFlyout&&(this._invoke(a),a.preventDefault())}},{_activateFlyoutCommand:function(a){return new f(function(b,c){a=a.winControl||a;var d=a.flyout;d&&d.hidden&&d.show?(h.addClass(a.element,i.menuCommandFlyoutActivatedClass),d.element.setAttribute("aria-expanded","true"),d.addEventListener("beforehide",function e(){d.removeEventListener("beforehide",e,!1),h.removeClass(a.element,i.menuCommandFlyoutActivatedClass),d.element.removeAttribute("aria-expanded")},!1),d.addEventListener("aftershow",function f(){d.removeEventListener("aftershow",f,!1),b()},!1),d.show(a,"_cascade")):c()})},_deactivateFlyoutCommand:function(a){return new f(function(b){a=a.winControl||a,h.removeClass(a.element,i.menuCommandFlyoutActivatedClass);var c=a.flyout;c&&!c.hidden&&c.hide?(c.addEventListener("afterhide",function d(){c.removeEventListener("afterhide",d,!1),b()},!1),c.hide()):b()})}});return k})})});var e=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c};return d("WinJS/Controls/CommandingSurface/_MenuCommand",["require","exports","../Menu/_Command"],function(a,b,c){var d=function(a){function b(b,c){c&&c.beforeInvoke&&(this._beforeInvoke=c.beforeInvoke),a.call(this,b,c)}return e(b,a),b.prototype._invoke=function(b){this._beforeInvoke&&this._beforeInvoke(b),a.prototype._invoke.call(this,b)},b}(c.MenuCommand);b._MenuCommand=d}),d("WinJS/Utilities/_OpenCloseMachine",["require","exports","../Core/_Global","../Promise","../_Signal"],function(a,b,c,d,e){"use strict";function f(a){return d._cancelBlocker(a,function(){a.cancel()})}function g(){}function h(a,b){a._interruptibleWorkPromises=a._interruptibleWorkPromises||[];var c=new e;a._interruptibleWorkPromises.push(b(c.promise)),c.complete()}function i(){(this._interruptibleWorkPromises||[]).forEach(function(a){a.cancel()})}var j={beforeOpen:"beforeopen",afterOpen:"afteropen",beforeClose:"beforeclose",afterClose:"afterclose",_openCloseStateSettled:"_openCloseStateSettled"},k=function(){function a(a){this._control=a,this._initializedSignal=new e,this._disposed=!1,this._setState(l.Init)}return a.prototype.exitInit=function(){this._initializedSignal.complete()},a.prototype.updateDom=function(){this._state.updateDom()},a.prototype.open=function(){this._state.open()},a.prototype.close=function(){this._state.close()},Object.defineProperty(a.prototype,"opened",{get:function(){return this._state.opened},set:function(a){a?this.open():this.close()},enumerable:!0,configurable:!0}),a.prototype.dispose=function(){this._setState(l.Disposed),this._disposed=!0,this._control=null},a.prototype._setState=function(a,b){this._disposed||(this._state&&this._state.exit(),this._state=new a,this._state.machine=this,this._state.enter(b))},a.prototype._fireEvent=function(a,b){b=b||{};var d=b.detail||null,e=!!b.cancelable,f=c.document.createEvent("CustomEvent");return f.initCustomEvent(a,!0,e,d),this._control.eventElement.dispatchEvent(f)},a.prototype._fireBeforeOpen=function(){return this._fireEvent(j.beforeOpen,{cancelable:!0})},a.prototype._fireBeforeClose=function(){return this._fireEvent(j.beforeClose,{cancelable:!0})},a}();b.OpenCloseMachine=k;var l;!function(a){function b(){this.machine._control.onUpdateDom()}var c=function(){function a(){this.name="Init",this.exit=i,this.updateDom=g}return a.prototype.enter=function(){var a=this;h(this,function(b){return b.then(function(){return a.machine._initializedSignal.promise}).then(function(){a.machine._control.onUpdateDomWithIsOpened(a._opened),a.machine._setState(a._opened?l:d)})})},Object.defineProperty(a.prototype,"opened",{get:function(){return this._opened},enumerable:!0,configurable:!0}),a.prototype.open=function(){this._opened=!0},a.prototype.close=function(){this._opened=!1},a}();a.Init=c;var d=function(){function a(){this.name="Closed",this.exit=g,this.opened=!1,this.close=g,this.updateDom=b}return a.prototype.enter=function(a){a=a||{},a.openIsPending&&this.open(),this.machine._fireEvent(j._openCloseStateSettled)},a.prototype.open=function(){this.machine._setState(e)},a}(),e=function(){function a(){this.name="BeforeOpen",this.exit=i,this.opened=!1,this.open=g,this.close=g,this.updateDom=b}return a.prototype.enter=function(){var a=this;h(this,function(b){return b.then(function(){return a.machine._fireBeforeOpen()}).then(function(b){b?a.machine._setState(k):a.machine._setState(d)})})},a}(),k=function(){function a(){this.name="Opening",this.exit=i,this.updateDom=g}return a.prototype.enter=function(){var a=this;h(this,function(b){return b.then(function(){return a._closeIsPending=!1,f(a.machine._control.onOpen())}).then(function(){a.machine._fireEvent(j.afterOpen)}).then(function(){a.machine._control.onUpdateDom(),a.machine._setState(l,{closeIsPending:a._closeIsPending})})})},Object.defineProperty(a.prototype,"opened",{get:function(){return!this._closeIsPending},enumerable:!0,configurable:!0}),a.prototype.open=function(){this._closeIsPending=!1},a.prototype.close=function(){this._closeIsPending=!0},a}(),l=function(){function a(){this.name="Opened",this.exit=g,this.opened=!0,this.open=g,this.updateDom=b}return a.prototype.enter=function(a){a=a||{},a.closeIsPending&&this.close(),this.machine._fireEvent(j._openCloseStateSettled)},a.prototype.close=function(){this.machine._setState(m)},a}(),m=function(){function a(){this.name="BeforeClose",this.exit=i,this.opened=!0,this.open=g,this.close=g,this.updateDom=b}return a.prototype.enter=function(){var a=this;h(this,function(b){return b.then(function(){return a.machine._fireBeforeClose()}).then(function(b){b?a.machine._setState(n):a.machine._setState(l)})})},a}(),n=function(){function a(){this.name="Closing",this.exit=i,this.updateDom=g}return a.prototype.enter=function(){var a=this;h(this,function(b){return b.then(function(){return a._openIsPending=!1,f(a.machine._control.onClose())}).then(function(){a.machine._fireEvent(j.afterClose)}).then(function(){a.machine._control.onUpdateDom(),a.machine._setState(d,{openIsPending:a._openIsPending})})})},Object.defineProperty(a.prototype,"opened",{get:function(){return this._openIsPending},enumerable:!0,configurable:!0}),a.prototype.open=function(){this._openIsPending=!0},a.prototype.close=function(){this._openIsPending=!1},a}(),o=function(){function a(){this.name="Disposed",this.enter=g,this.exit=g,this.opened=!1,this.open=g,this.close=g,this.updateDom=g}return a}();a.Disposed=o}(l||(l={}))}),d("require-style!less/styles-commandingsurface",[],function(){}),d("require-style!less/colors-commandingsurface",[],function(){}),d("WinJS/Controls/CommandingSurface/_CommandingSurface",["require","exports","../../Animations","../../Core/_Base","../../Core/_BaseUtils","../../BindingList","../../ControlProcessor","../CommandingSurface/_Constants","../AppBar/_Command","../CommandingSurface/_MenuCommand","../../Utilities/_Control","../../Utilities/_Dispose","../../Utilities/_ElementUtilities","../../Core/_ErrorFromName","../../Core/_Events","../../Controls/Flyout","../../Core/_Global","../../Utilities/_Hoverable","../../Utilities/_KeyboardBehavior","../../Core/_Log","../../Promise","../../Core/_Resources","../../Scheduler","../../Utilities/_OpenCloseMachine","../../_Signal","../../Core/_WriteProfilerMark"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z){function A(a,b){b&&m.addClass(a,b)}function B(a,b){b&&m.removeClass(a,b)}function C(a,b){return a.filter(function(a){return b.indexOf(a)<0})}function D(a,b){return a.filter(function(a){return-1!==b.indexOf(a)})}a(["require-style!less/styles-commandingsurface"]),a(["require-style!less/colors-commandingsurface"]);var E={get overflowButtonAriaLabel(){return v._getWinJSString("ui/commandingSurfaceOverflowButtonAriaLabel").value},get badData(){return"Invalid argument: The data property must an instance of a WinJS.Binding.List"},get mustContainCommands(){return"The commandingSurface can only contain WinJS.UI.Command or WinJS.UI.AppBarCommand controls"},get duplicateConstruction(){return"Invalid argument: Controls may only be instantiated one time for each DOM element"}},F={bottom:"bottom",top:"top"},G={};G[F.top]=h.ClassNames.overflowTopClass,G[F.bottom]=h.ClassNames.overflowBottomClass;var H={none:"none",minimal:"minimal",compact:"compact",full:"full"},I={};I[H.none]=h.ClassNames.noneClass,I[H.minimal]=h.ClassNames.minimalClass,I[H.compact]=h.ClassNames.compactClass,I[H.full]=h.ClassNames.fullClass;var J=function(){function a(a,b){var c=this;if(void 0===b&&(b={}),this._hoverable=r.isHoverable,this._dataChangedEvents=["itemchanged","iteminserted","itemmoved","itemremoved","reload"],this._updateDomImpl=function(){var a={closedDisplayMode:void 0,isOpenedMode:void 0,overflowDirection:void 0,overflowAlignmentOffset:void 0},b=function(){var b=a,d=c._dom;if(b.isOpenedMode!==c._isOpenedMode&&(c._isOpenedMode?(B(d.root,h.ClassNames.closedClass),A(d.root,h.ClassNames.openedClass),d.overflowButton.setAttribute("aria-expanded","true"),d.firstTabStop.tabIndex=0,d.finalTabStop.tabIndex=0,d.firstTabStop.setAttribute("x-ms-aria-flowfrom",d.finalTabStop.id),d.finalTabStop.setAttribute("aria-flowto",d.firstTabStop.id)):(B(d.root,h.ClassNames.openedClass),A(d.root,h.ClassNames.closedClass),d.overflowButton.setAttribute("aria-expanded","false"),d.firstTabStop.tabIndex=-1,d.finalTabStop.tabIndex=-1,d.firstTabStop.removeAttribute("x-ms-aria-flowfrom"),d.finalTabStop.removeAttribute("aria-flowto")),b.isOpenedMode=c._isOpenedMode),b.closedDisplayMode!==c.closedDisplayMode&&(B(d.root,I[b.closedDisplayMode]),A(d.root,I[c.closedDisplayMode]),b.closedDisplayMode=c.closedDisplayMode),b.overflowDirection!==c.overflowDirection&&(B(d.root,G[b.overflowDirection]),A(d.root,G[c.overflowDirection]),b.overflowDirection=c.overflowDirection),c._overflowAlignmentOffset!==b.overflowAlignmentOffset){var e=c._rtl?"left":"right",f=c._overflowAlignmentOffset+"px";d.overflowAreaContainer.style[e]=f}},d={newDataStage:3,measuringStage:2,layoutStage:1,idle:0},e=d.idle,f=function(){c._writeProfilerMark("_updateDomImpl_updateCommands,info");for(var a=e;a!==d.idle;){var b=a,f=!1;switch(a){case d.newDataStage:a=d.measuringStage,f=c._processNewData();break;case d.measuringStage:a=d.layoutStage,f=c._measure();break;case d.layoutStage:a=d.idle,f=c._layoutCommands()}if(!f){a=b;break}}e=a,a===d.idle?c._layoutCompleteCallback&&c._layoutCompleteCallback():c._minimalLayout()};return{get renderedState(){return{get closedDisplayMode(){return a.closedDisplayMode},get isOpenedMode(){return a.isOpenedMode},get overflowDirection(){return a.overflowDirection},get overflowAlignmentOffset(){return a.overflowAlignmentOffset}}},update:function(){b(),f()},dataDirty:function(){e=Math.max(d.newDataStage,e)},measurementsDirty:function(){e=Math.max(d.measuringStage,e)},layoutDirty:function(){e=Math.max(d.layoutStage,e)},get _currentLayoutStage(){return e}}}(),this._writeProfilerMark("constructor,StartTM"),a){if(a.winControl)throw new n("WinJS.UI._CommandingSurface.DuplicateConstruction",E.duplicateConstruction);b.data||(b=e._shallowCopy(b),b.data=b.data||this._getDataFromDOMElements(a))}this._initializeDom(a||q.document.createElement("div")),this._machine=b.openCloseMachine||new x.OpenCloseMachine({eventElement:this._dom.root,onOpen:function(){return c.synchronousOpen(),u.wrap()},onClose:function(){return c.synchronousClose(),u.wrap()},onUpdateDom:function(){c._updateDomImpl.update()},onUpdateDomWithIsOpened:function(a){a?c.synchronousOpen():c.synchronousClose()}}),this._disposed=!1,this._primaryCommands=[],this._secondaryCommands=[],this._refreshBound=this._refresh.bind(this),this._resizeHandlerBound=this._resizeHandler.bind(this),this._winKeyboard=new s._WinKeyboard(this._dom.root),this._refreshPending=!1,this._rtl=!1,this._initializedSignal=new y,this._isOpenedMode=h.defaultOpened,this._menuCommandProjections=[],this.overflowDirection=h.defaultOverflowDirection,this.closedDisplayMode=h.defaultClosedDisplayMode,this.opened=this._isOpenedMode,k.setOptions(this,b),m._resizeNotifier.subscribe(this._dom.root,this._resizeHandlerBound),this._dom.root.addEventListener("keydown",this._keyDownHandler.bind(this)),m._addEventListener(this._dom.firstTabStop,"focusin",function(){c._focusLastFocusableElementOrThis(!1)}),m._addEventListener(this._dom.finalTabStop,"focusin",function(){c._focusFirstFocusableElementOrThis(!1)}),m._inDom(this._dom.root).then(function(){c._rtl="rtl"===m._getComputedStyle(c._dom.root).direction,b.openCloseMachine||c._machine.exitInit(),c._initializedSignal.complete(),c._writeProfilerMark("constructor,StopTM")})}return Object.defineProperty(a.prototype,"element",{get:function(){return this._dom.root},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"data",{get:function(){return this._data},set:function(a){if(this._writeProfilerMark("set_data,info"),a!==this.data){if(!(a instanceof f.List))throw new n("WinJS.UI._CommandingSurface.BadData",E.badData);this._data&&this._removeDataListeners(),this._data=a,this._addDataListeners(),this._dataUpdated()}},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"closedDisplayMode",{get:function(){return this._closedDisplayMode},set:function(a){this._writeProfilerMark("set_closedDisplayMode,info");var b=a!==this._closedDisplayMode;H[a]&&b&&(this._updateDomImpl.layoutDirty(),this._closedDisplayMode=a,this._machine.updateDom())},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"overflowDirection",{get:function(){return this._overflowDirection},set:function(a){var b=a!==this._overflowDirection;F[a]&&b&&(this._overflowDirection=a,this._machine.updateDom())},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"opened",{get:function(){return this._machine.opened},set:function(a){this._machine.opened=a},enumerable:!0,configurable:!0}),a.prototype.open=function(){this._machine.open()},a.prototype.close=function(){this._machine.close()},a.prototype.dispose=function(){this._disposed||(this._disposed=!0,this._machine.dispose(),m._resizeNotifier.unsubscribe(this._dom.root,this._resizeHandlerBound),this._contentFlyout&&(this._contentFlyout.dispose(),this._contentFlyout.element.parentNode.removeChild(this._contentFlyout.element)),l.disposeSubTree(this._dom.root))},a.prototype.forceLayout=function(){this._updateDomImpl.measurementsDirty(),this._machine.updateDom()},a.prototype.getBoundingRects=function(){return{commandingSurface:this._dom.root.getBoundingClientRect(),overflowArea:this._dom.overflowArea.getBoundingClientRect()}},a.prototype.getCommandById=function(a){if(this._data)for(var b=0,c=this._data.length;c>b;b++){var d=this._data.getAt(b);if(d.id===a)return d}return null},a.prototype.showOnlyCommands=function(a){if(this._data){for(var b=0,c=this._data.length;c>b;b++)this._data.getAt(b).hidden=!0;for(var b=0,c=a.length;c>b;b++){var d="string"==typeof a[b]?this.getCommandById(a[b]):a[b];d&&(d.hidden=!1)}}},a.prototype.takeFocus=function(a){this._focusFirstFocusableElementOrThis(a)},a.prototype._focusFirstFocusableElementOrThis=function(a){m._focusFirstFocusableElement(this._dom.content,a)||m._tryFocusOnAnyElement(this.element,a)},a.prototype._focusLastFocusableElementOrThis=function(a){m._focusLastFocusableElement(this._dom.content,a)||m._tryFocusOnAnyElement(this.element,a)},a.prototype.deferredDomUpate=function(){this._machine.updateDom()},a.prototype.createOpenAnimation=function(a){t.log&&this._updateDomImpl.renderedState.isOpenedMode&&t.log("The CommandingSurface should only attempt to create an open animation when it's not already opened");var b=this;return{execute:function(){m.addClass(b.element,h.ClassNames.openingClass);var d=b.getBoundingRects();return b._dom.overflowAreaContainer.style.width=d.overflowArea.width+"px",b._dom.overflowAreaContainer.style.height=d.overflowArea.height+"px",c._commandingSurfaceOpenAnimation({actionAreaClipper:b._dom.actionAreaContainer,actionArea:b._dom.actionArea,overflowAreaClipper:b._dom.overflowAreaContainer,overflowArea:b._dom.overflowArea,oldHeight:a,newHeight:d.commandingSurface.height,overflowAreaHeight:d.overflowArea.height,menuPositionedAbove:b.overflowDirection===F.top}).then(function(){m.removeClass(b.element,h.ClassNames.openingClass),b._clearAnimation()})}}},a.prototype.createCloseAnimation=function(a){t.log&&!this._updateDomImpl.renderedState.isOpenedMode&&t.log("The CommandingSurface should only attempt to create an closed animation when it's not already closed");var b=this.getBoundingRects().commandingSurface.height,d=this._dom.overflowArea.offsetHeight,e=(this._dom.overflowArea.offsetTop,this);return{execute:function(){return m.addClass(e.element,h.ClassNames.closingClass),c._commandingSurfaceCloseAnimation({actionAreaClipper:e._dom.actionAreaContainer,actionArea:e._dom.actionArea,overflowAreaClipper:e._dom.overflowAreaContainer,overflowArea:e._dom.overflowArea,oldHeight:b,newHeight:a,overflowAreaHeight:d,menuPositionedAbove:e.overflowDirection===F.top}).then(function(){m.removeClass(e.element,h.ClassNames.closingClass),e._clearAnimation()})}}},Object.defineProperty(a.prototype,"initialized",{get:function(){return this._initializedSignal.promise},enumerable:!0,configurable:!0}),a.prototype._writeProfilerMark=function(a){z("WinJS.UI._CommandingSurface:"+this._id+":"+a)},a.prototype._initializeDom=function(a){var b=this;this._writeProfilerMark("_intializeDom,info"),a.winControl=this,this._id=a.id||m._uniqueID(a),a.hasAttribute("tabIndex")||(a.tabIndex=-1),m.addClass(a,h.ClassNames.controlCssClass),m.addClass(a,h.ClassNames.disposableCssClass);var c=q.document.createElement("div");m.addClass(c,h.ClassNames.contentClass),a.appendChild(c);var d=q.document.createElement("div");m.addClass(d,h.ClassNames.actionAreaCssClass);var e=document.createElement("div");m.addClass(e,h.ClassNames.insetOutlineClass);var f=q.document.createElement("div");m.addClass(f,h.ClassNames.actionAreaContainerCssClass),f.appendChild(d),f.appendChild(e),c.appendChild(f);var g=q.document.createElement("div");m.addClass(g,h.ClassNames.spacerCssClass),g.tabIndex=-1,d.appendChild(g);var i=q.document.createElement("button");i.tabIndex=0,i.innerHTML="<span class='"+h.ClassNames.ellipsisCssClass+"'></span>",i.setAttribute("aria-label",E.overflowButtonAriaLabel),m.addClass(i,h.ClassNames.overflowButtonCssClass),d.appendChild(i),i.addEventListener("click",function(){b.opened=!b.opened});var j=q.document.createElement("div");m.addClass(j,h.ClassNames.overflowAreaCssClass),m.addClass(j,h.ClassNames.menuCssClass);var k=q.document.createElement("DIV");m.addClass(k,h.ClassNames.insetOutlineClass);var l=q.document.createElement("div");m.addClass(l,h.ClassNames.overflowAreaContainerCssClass),l.appendChild(j),l.appendChild(k),c.appendChild(l);var n=q.document.createElement("div");m.addClass(n,h.ClassNames.spacerCssClass),n.tabIndex=-1,j.appendChild(n);var o=q.document.createElement("div");m.addClass(o,h.ClassNames.tabStopClass),m._ensureId(o),a.insertBefore(o,a.children[0]);var p=q.document.createElement("div");m.addClass(p,h.ClassNames.tabStopClass),m._ensureId(p),a.appendChild(p),this._dom={root:a,content:c,actionArea:d,actionAreaContainer:f,actionAreaSpacer:g,overflowButton:i,overflowArea:j,overflowAreaContainer:l,overflowAreaSpacer:n,firstTabStop:o,finalTabStop:p}},a.prototype._getFocusableElementsInfo=function(){var a=this,b={elements:[],focusedIndex:-1},c=Array.prototype.slice.call(this._dom.actionArea.children);return this._updateDomImpl.renderedState.isOpenedMode&&(c=c.concat(Array.prototype.slice.call(this._dom.overflowArea.children))),c.forEach(function(c){a._isElementFocusable(c)&&(b.elements.push(c),c.contains(q.document.activeElement)&&(b.focusedIndex=b.elements.length-1))}),b},a.prototype._dataUpdated=function(){var a=this;this._primaryCommands=[],this._secondaryCommands=[],this.data.length>0&&this.data.forEach(function(b){"secondary"===b.section?a._secondaryCommands.push(b):a._primaryCommands.push(b)}),this._updateDomImpl.dataDirty(),this._machine.updateDom()},a.prototype._refresh=function(){var a=this;this._refreshPending||(this._refreshPending=!0,this._batchDataUpdates(function(){a._refreshPending&&!a._disposed&&(a._refreshPending=!1,a._dataUpdated())}))},a.prototype._batchDataUpdates=function(a){w.schedule(function(){a()},w.Priority.high,null,"WinJS.UI._CommandingSurface._refresh")},a.prototype._addDataListeners=function(){var a=this;this._dataChangedEvents.forEach(function(b){a._data.addEventListener(b,a._refreshBound,!1)})},a.prototype._removeDataListeners=function(){var a=this;this._dataChangedEvents.forEach(function(b){a._data.removeEventListener(b,a._refreshBound,!1)})},a.prototype._isElementFocusable=function(a){var b=!1;if(a){var c=a.winControl;b=c?!this._hasAnyHiddenClasses(c)&&c.type!==h.typeSeparator&&!c.hidden&&!c.disabled&&(!c.firstElementFocus||c.firstElementFocus.tabIndex>=0||c.lastElementFocus.tabIndex>=0):"none"!==a.style.display&&"hidden"!==m._getComputedStyle(a).visibility&&a.tabIndex>=0}return b},a.prototype._clearHiddenPolicyClasses=function(a){m.removeClass(a.element,h.ClassNames.commandPrimaryOverflownPolicyClass),m.removeClass(a.element,h.ClassNames.commandSecondaryOverflownPolicyClass),m.removeClass(a.element,h.ClassNames.commandSeparatorHiddenPolicyClass);
},a.prototype._hasHiddenPolicyClasses=function(a){return m.hasClass(a.element,h.ClassNames.commandPrimaryOverflownPolicyClass)||m.hasClass(a.element,h.ClassNames.commandSecondaryOverflownPolicyClass)||m.hasClass(a.element,h.ClassNames.commandSeparatorHiddenPolicyClass)},a.prototype._hasAnyHiddenClasses=function(a){return m.hasClass(a.element,h.ClassNames.commandHiddenClass)||this._hasHiddenPolicyClasses(a)},a.prototype._isCommandInActionArea=function(a){return a&&a.winControl&&a.parentElement===this._dom.actionArea},a.prototype._getLastElementFocus=function(a){return this._isCommandInActionArea(a)?a.winControl.lastElementFocus:a},a.prototype._getFirstElementFocus=function(a){return this._isCommandInActionArea(a)?a.winControl.firstElementFocus:a},a.prototype._keyDownHandler=function(a){if(!a.altKey){if(m._matchesSelector(a.target,".win-interactive, .win-interactive *"))return;var b,c=m.Key,d=this._getFocusableElementsInfo();if(d.elements.length)switch(a.keyCode){case this._rtl?c.rightArrow:c.leftArrow:case c.upArrow:var e=Math.max(0,d.focusedIndex-1);b=this._getLastElementFocus(d.elements[e%d.elements.length]);break;case this._rtl?c.leftArrow:c.rightArrow:case c.downArrow:var e=Math.min(d.focusedIndex+1,d.elements.length-1);b=this._getFirstElementFocus(d.elements[e]);break;case c.home:var e=0;b=this._getFirstElementFocus(d.elements[e]);break;case c.end:var e=d.elements.length-1;b=this._getLastElementFocus(d.elements[e])}b&&b!==q.document.activeElement&&(b.focus(),a.preventDefault())}},a.prototype._getDataFromDOMElements=function(a){this._writeProfilerMark("_getDataFromDOMElements,info"),g.processAll(a,!0);for(var b,c=[],d=a.children.length,e=0;d>e;e++){if(b=a.children[e],!(b.winControl&&b.winControl instanceof i.AppBarCommand))throw new n("WinJS.UI._CommandingSurface.MustContainCommands",E.mustContainCommands);c.push(b.winControl)}return new f.List(c)},a.prototype._canMeasure=function(){return(this._updateDomImpl.renderedState.isOpenedMode||this._updateDomImpl.renderedState.closedDisplayMode===H.compact||this._updateDomImpl.renderedState.closedDisplayMode===H.full)&&q.document.body.contains(this._dom.root)&&this._dom.actionArea.offsetWidth>0},a.prototype._resizeHandler=function(){if(this._canMeasure()){var a=m._getPreciseContentWidth(this._dom.actionArea);this._cachedMeasurements&&this._cachedMeasurements.actionAreaContentBoxWidth!==a&&(this._cachedMeasurements.actionAreaContentBoxWidth=a,this._updateDomImpl.layoutDirty(),this._machine.updateDom())}else this._updateDomImpl.measurementsDirty()},a.prototype.synchronousOpen=function(){this._overflowAlignmentOffset=0,this._isOpenedMode=!0,this._updateDomImpl.update(),this._overflowAlignmentOffset=this._computeAdjustedOverflowAreaOffset(),this._updateDomImpl.update()},a.prototype._computeAdjustedOverflowAreaOffset=function(){t.log&&(!this._updateDomImpl.renderedState.isOpenedMode&&t.log("The CommandingSurface should only attempt to compute adjusted overflowArea offset when it has been rendered opened"),0!==this._updateDomImpl.renderedState.overflowAlignmentOffset&&t.log("The CommandingSurface should only attempt to compute adjusted overflowArea offset when it has been rendered with an overflowAlignementOffset of 0"));var a=(this._dom.overflowArea,this.getBoundingRects()),b=0;if(this._rtl){var c=window.innerWidth,d=a.overflowArea.right;b=Math.min(c-d,0)}else{var e=a.overflowArea.left;b=Math.min(0,e)}return b},a.prototype.synchronousClose=function(){this._isOpenedMode=!1,this._updateDomImpl.update()},a.prototype.updateDom=function(){this._updateDomImpl.update()},a.prototype._getDataChangeInfo=function(){var a=this,b=[],c=[],d=[],e=[],f=[],g=[],i=[],j=[],k=[],l=[];return Array.prototype.forEach.call(this._dom.actionArea.querySelectorAll(h.commandSelector),function(b){a._hasAnyHiddenClasses(b.winControl)||e.push(b),f.push(b)}),this.data.forEach(function(b){var c=b.hidden,d=c&&!m.hasClass(b.element,h.ClassNames.commandHiddenClass),e=!c&&m.hasClass(b.element,h.ClassNames.commandHiddenClass),f=m.hasClass(b.element,h.ClassNames.commandPrimaryOverflownPolicyClass);a._hasAnyHiddenClasses(b.element.winControl)||g.push(b.element),f?j.push(b.element):d?k.push(b.element):e&&l.push(b.element),i.push(b.element)}),c=C(f,i),d=D(e,g),b=C(i,f),{nextElements:i,prevElements:f,added:b,deleted:c,unchanged:d,hiding:k,showing:l,overflown:j}},a.prototype._processNewData=function(){var a=this;this._writeProfilerMark("_processNewData,info");var b=this._getDataChangeInfo(),d=c._createUpdateListAnimation(b.added.concat(b.showing).concat(b.overflown),b.deleted.concat(b.hiding),b.unchanged);return b.deleted.forEach(function(b){var c=b.winControl;c&&c._propertyMutations&&c._propertyMutations.unbind(a._refreshBound)}),b.added.forEach(function(b){var c=b.winControl;c&&c._propertyMutations&&c._propertyMutations.bind(a._refreshBound)}),b.prevElements.forEach(function(a){a.parentElement&&a.parentElement.removeChild(a)}),b.nextElements.forEach(function(b){a._dom.actionArea.appendChild(b)}),b.hiding.forEach(function(a){m.addClass(a,h.ClassNames.commandHiddenClass)}),b.showing.forEach(function(a){m.removeClass(a,h.ClassNames.commandHiddenClass)}),this._dom.actionArea.appendChild(this._dom.overflowButton),d.execute(),!0},a.prototype._measure=function(){var a=this;if(this._writeProfilerMark("_measure,info"),this._canMeasure()){var b=this._dom.overflowButton.style.display;this._dom.overflowButton.style.display="";var c=m._getPreciseTotalWidth(this._dom.overflowButton);this._dom.overflowButton.style.display=b;var d=m._getPreciseContentWidth(this._dom.actionArea),e=0,f=0,g={};return this._primaryCommands.forEach(function(b){var c=b.element.style.display;b.element.style.display="inline-block",b.type===h.typeContent?g[a._commandUniqueId(b)]=m._getPreciseTotalWidth(b.element):b.type===h.typeSeparator?e||(e=m._getPreciseTotalWidth(b.element)):f||(f=m._getPreciseTotalWidth(b.element)),b.element.style.display=c}),this._cachedMeasurements={contentCommandWidths:g,separatorWidth:e,standardCommandWidth:f,overflowButtonWidth:c,actionAreaContentBoxWidth:d},!0}return!1},a.prototype._layoutCommands=function(){var a=this;this._writeProfilerMark("_layoutCommands,StartTM");var b=[],c=[],d=[],e=[];this.data.forEach(function(d){a._clearHiddenPolicyClasses(d),d.hidden||(d.section===h.secondaryCommandSection?b.push(d):c.push(d))});var f=b.length>0,g=this._getVisiblePrimaryCommandsLocation(c,f);d=g.commandsForActionArea,e=g.commandsForOverflowArea,e.forEach(function(a){return m.addClass(a.element,h.ClassNames.commandPrimaryOverflownPolicyClass)}),b.forEach(function(a){return m.addClass(a.element,h.ClassNames.commandSecondaryOverflownPolicyClass)}),this._hideSeparatorsIfNeeded(d),m.empty(this._dom.overflowArea),this._menuCommandProjections.map(function(a){a.dispose()});var i=function(a){return a.type===h.typeContent},k=e.some(i)||b.some(i);k&&!this._contentFlyout&&(this._contentFlyoutInterior=q.document.createElement("div"),m.addClass(this._contentFlyoutInterior,h.ClassNames.contentFlyoutCssClass),this._contentFlyout=new p.Flyout,this._contentFlyout.element.appendChild(this._contentFlyoutInterior),q.document.body.appendChild(this._contentFlyout.element),this._contentFlyout.onbeforeshow=function(){m.empty(a._contentFlyoutInterior),m._reparentChildren(a._chosenCommand.element,a._contentFlyoutInterior)},this._contentFlyout.onafterhide=function(){m._reparentChildren(a._contentFlyoutInterior,a._chosenCommand.element)});var l=!1,n=[];if(e.forEach(function(b){b.type===h.typeToggle&&(l=!0),n.push(a._projectAsMenuCommand(b))}),e.length>0&&b.length>0){var o=new j._MenuCommand(null,{type:h.typeSeparator});n.push(o)}b.forEach(function(b){b.type===h.typeToggle&&(l=!0),n.push(a._projectAsMenuCommand(b))}),this._hideSeparatorsIfNeeded(n),n.forEach(function(b){a._dom.overflowArea.appendChild(b.element)}),this._menuCommandProjections=n,m[l?"addClass":"removeClass"](this._dom.overflowArea,h.ClassNames.menuContainsToggleCommandClass),n.length>0&&this._dom.overflowArea.appendChild(this._dom.overflowAreaSpacer);var r=this._needsOverflowButton(d.length>0,n.length>0);return this._dom.overflowButton.style.display=r?"":"none",this._writeProfilerMark("_layoutCommands,StopTM"),!0},a.prototype._getVisiblePrimaryCommandsInfo=function(a){for(var b=0,c=[],d=0,e=0,f=a.length-1;f>=0;f--){var g=a[f];d=void 0===g.priority?e--:g.priority,b=this._getCommandWidth(g),c.unshift({command:g,width:b,priority:d})}return c},a.prototype._getVisiblePrimaryCommandsLocation=function(a,b){for(var c=[],d=[],e=this._getVisiblePrimaryCommandsInfo(a),f=e.slice(0).sort(function(a,b){return a.priority-b.priority}),g=Number.MAX_VALUE,h=this._cachedMeasurements.actionAreaContentBoxWidth,i=this._needsOverflowButton(a.length>0,b),j=0,k=f.length;k>j;j++){h-=f[j].width;var l=i||j!==k-1?this._cachedMeasurements.overflowButtonWidth:0;if(l>h){g=f[j].priority-1;break}}return e.forEach(function(a){a.priority<=g?c.push(a.command):d.push(a.command)}),{commandsForActionArea:c,commandsForOverflowArea:d}},a.prototype._needsOverflowButton=function(a,b){return b?!0:this._hasExpandableActionArea()&&a?!0:!1},a.prototype._minimalLayout=function(){if(this.closedDisplayMode===H.minimal){var a=function(a){return!a.hidden},b=this.data.some(a);this._dom.overflowButton.style.display=b?"":"none"}},a.prototype._commandUniqueId=function(a){return m._uniqueID(a.element)},a.prototype._getCommandWidth=function(a){return a.type===h.typeContent?this._cachedMeasurements.contentCommandWidths[this._commandUniqueId(a)]:a.type===h.typeSeparator?this._cachedMeasurements.separatorWidth:this._cachedMeasurements.standardCommandWidth},a.prototype._projectAsMenuCommand=function(a){var b=this,c=new j._MenuCommand(null,{label:a.label,type:(a.type===h.typeContent?h.typeFlyout:a.type)||h.typeButton,disabled:a.disabled,flyout:a.flyout,beforeInvoke:function(){b._chosenCommand=c._originalICommand,b._chosenCommand.type===h.typeToggle&&(b._chosenCommand.selected=!b._chosenCommand.selected)}});return a.selected&&(c.selected=!0),a.extraClass&&(c.extraClass=a.extraClass),a.type===h.typeContent?(c.label||(c.label=h.contentMenuCommandDefaultLabel),c.flyout=this._contentFlyout):c.onclick=a.onclick,c._originalICommand=a,c},a.prototype._hideSeparatorsIfNeeded=function(a){var b,c=h.typeSeparator,d=a.length;a.forEach(function(a){a.type===h.typeSeparator&&c===h.typeSeparator&&m.addClass(a.element,h.ClassNames.commandSeparatorHiddenPolicyClass),c=a.type});for(var e=d-1;e>=0&&(b=a[e],b.type===h.typeSeparator);e--)m.addClass(b.element,h.ClassNames.commandSeparatorHiddenPolicyClass)},a.prototype._hasExpandableActionArea=function(){switch(this.closedDisplayMode){case H.none:case H.minimal:case H.compact:return!0;case H.full:default:return!1}},a.prototype._clearAnimation=function(){var a=e._browserStyleEquivalents.transform.scriptName;this._dom.actionAreaContainer.style[a]="",this._dom.actionArea.style[a]="",this._dom.overflowAreaContainer.style[a]="",this._dom.overflowArea.style[a]=""},a.ClosedDisplayMode=H,a.OverflowDirection=F,a.supportedForProcessing=!0,a}();b._CommandingSurface=J,d.Class.mix(J,o.createEventProperties(h.EventNames.beforeOpen,h.EventNames.afterOpen,h.EventNames.beforeClose,h.EventNames.afterClose)),d.Class.mix(J,k.DOMEventMixin)}),d("WinJS/Controls/CommandingSurface",["require","exports"],function(a,b){function c(){return d||a(["./CommandingSurface/_CommandingSurface"],function(a){d=a}),d._CommandingSurface}var d=null,e=Object.create({},{_CommandingSurface:{get:function(){return c()}}});return e}),d("require-style!less/styles-toolbar",[],function(){}),d("WinJS/Controls/ToolBar/_ToolBar",["require","exports","../../Core/_Base","../ToolBar/_Constants","../CommandingSurface","../../Utilities/_Control","../../Utilities/_Dispose","../../Utilities/_ElementUtilities","../../Core/_ErrorFromName","../../Core/_Events","../../Core/_Global","../../_LightDismissService","../../Core/_Resources","../../Utilities/_OpenCloseMachine","../../Core/_WriteProfilerMark"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o){function p(a,b){b&&h.addClass(a,b)}function q(a,b){b&&h.removeClass(a,b)}a(["require-style!less/styles-toolbar"]);var r={get ariaLabel(){return m._getWinJSString("ui/toolbarAriaLabel").value},get overflowButtonAriaLabel(){return m._getWinJSString("ui/toolbarOverflowButtonAriaLabel").value},get mustContainCommands(){return"The toolbar can only contain WinJS.UI.Command or WinJS.UI.AppBarCommand controls"},get duplicateConstruction(){return"Invalid argument: Controls may only be instantiated one time for each DOM element"}},s={compact:"compact",full:"full"},t={};t[s.compact]=d.ClassNames.compactClass,t[s.full]=d.ClassNames.fullClass;var u=function(){function a(a,b){var c=this;if(void 0===b&&(b={}),this._updateDomImpl_renderedState={isOpenedMode:void 0,closedDisplayMode:void 0,prevInlineWidth:void 0},this._writeProfilerMark("constructor,StartTM"),a&&a.winControl)throw new i("WinJS.UI.ToolBar.DuplicateConstruction",r.duplicateConstruction);this._initializeDom(a||k.document.createElement("div"));var g=new n.OpenCloseMachine({eventElement:this.element,onOpen:function(){var a=c._commandingSurface.createOpenAnimation(c._getClosedHeight());return c._synchronousOpen(),a.execute()},onClose:function(){var a=c._commandingSurface.createCloseAnimation(c._getClosedHeight());return a.execute().then(function(){c._synchronousClose()})},onUpdateDom:function(){c._updateDomImpl()},onUpdateDomWithIsOpened:function(a){c._isOpenedMode=a,c._updateDomImpl()}});this._handleShowingKeyboardBound=this._handleShowingKeyboard.bind(this),h._inputPaneListener.addEventListener(this._dom.root,"showing",this._handleShowingKeyboardBound),this._disposed=!1,this._cachedClosedHeight=null,this._commandingSurface=new e._CommandingSurface(this._dom.commandingSurfaceEl,{openCloseMachine:g}),p(this._dom.commandingSurfaceEl.querySelector(".win-commandingsurface-actionarea"),d.ClassNames.actionAreaCssClass),p(this._dom.commandingSurfaceEl.querySelector(".win-commandingsurface-overflowarea"),d.ClassNames.overflowAreaCssClass),p(this._dom.commandingSurfaceEl.querySelector(".win-commandingsurface-overflowbutton"),d.ClassNames.overflowButtonCssClass),p(this._dom.commandingSurfaceEl.querySelector(".win-commandingsurface-ellipsis"),d.ClassNames.ellipsisCssClass),this._isOpenedMode=d.defaultOpened,this._dismissable=new l.LightDismissableElement({element:this._dom.root,tabIndex:this._dom.root.hasAttribute("tabIndex")?this._dom.root.tabIndex:-1,onLightDismiss:function(){c.close()},onTakeFocus:function(a){c._dismissable.restoreFocus()||c._commandingSurface.takeFocus(a)}}),this.closedDisplayMode=d.defaultClosedDisplayMode,this.opened=this._isOpenedMode,f.setOptions(this,b),h._inDom(this.element).then(function(){return c._commandingSurface.initialized}).then(function(){g.exitInit(),c._writeProfilerMark("constructor,StopTM")})}return Object.defineProperty(a.prototype,"element",{get:function(){return this._dom.root},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"data",{get:function(){return this._commandingSurface.data},set:function(a){this._commandingSurface.data=a},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"closedDisplayMode",{get:function(){return this._commandingSurface.closedDisplayMode},set:function(a){s[a]&&(this._commandingSurface.closedDisplayMode=a,this._cachedClosedHeight=null)},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"opened",{get:function(){return this._commandingSurface.opened},set:function(a){this._commandingSurface.opened=a},enumerable:!0,configurable:!0}),a.prototype.open=function(){this._commandingSurface.open()},a.prototype.close=function(){this._commandingSurface.close()},a.prototype.dispose=function(){this._disposed||(this._disposed=!0,l.hidden(this._dismissable),this._commandingSurface.dispose(),this._synchronousClose(),h._inputPaneListener.removeEventListener(this._dom.root,"showing",this._handleShowingKeyboardBound),g.disposeSubTree(this.element))},a.prototype.forceLayout=function(){this._commandingSurface.forceLayout()},a.prototype.getCommandById=function(a){return this._commandingSurface.getCommandById(a)},a.prototype.showOnlyCommands=function(a){return this._commandingSurface.showOnlyCommands(a)},a.prototype._writeProfilerMark=function(a){o("WinJS.UI.ToolBar:"+this._id+":"+a)},a.prototype._initializeDom=function(a){this._writeProfilerMark("_intializeDom,info"),a.winControl=this,this._id=a.id||h._uniqueID(a),h.addClass(a,d.ClassNames.controlCssClass),h.addClass(a,d.ClassNames.disposableCssClass);var b=a.getAttribute("role");b||a.setAttribute("role","menubar");var c=a.getAttribute("aria-label");c||a.setAttribute("aria-label",r.ariaLabel);var e=document.createElement("DIV");h._reparentChildren(a,e),a.appendChild(e);var f=k.document.createElement("DIV");h.addClass(f,d.ClassNames.placeHolderCssClass),g.markDisposable(f,this.dispose.bind(this)),this._dom={root:a,commandingSurfaceEl:e,placeHolder:f}},a.prototype._handleShowingKeyboard=function(a){this.close()},a.prototype._synchronousOpen=function(){this._isOpenedMode=!0,this._updateDomImpl()},a.prototype._synchronousClose=function(){this._isOpenedMode=!1,this._updateDomImpl()},a.prototype._updateDomImpl=function(){var a=this._updateDomImpl_renderedState;a.isOpenedMode!==this._isOpenedMode&&(this._isOpenedMode?this._updateDomImpl_renderOpened():this._updateDomImpl_renderClosed(),a.isOpenedMode=this._isOpenedMode),a.closedDisplayMode!==this.closedDisplayMode&&(q(this._dom.root,t[a.closedDisplayMode]),p(this._dom.root,t[this.closedDisplayMode]),a.closedDisplayMode=this.closedDisplayMode),this._commandingSurface.updateDom()},a.prototype._getClosedHeight=function(){if(null===this._cachedClosedHeight){var a=this._isOpenedMode;this._isOpenedMode&&this._synchronousClose(),this._cachedClosedHeight=this._commandingSurface.getBoundingRects().commandingSurface.height,a&&this._synchronousOpen()}return this._cachedClosedHeight},a.prototype._updateDomImpl_renderOpened=function(){var a=this;this._updateDomImpl_renderedState.prevInlineWidth=this._dom.root.style.width;var b=this._dom.root.getBoundingClientRect(),c=h._getPreciseContentWidth(this._dom.root),e=h._getPreciseContentHeight(this._dom.root),f=h._getComputedStyle(this._dom.root),g=h._convertToPrecisePixels(f.paddingTop),i=h._convertToPrecisePixels(f.borderTopWidth),j=h._getPreciseMargins(this._dom.root),m=b.top+i+g,n=m+e,o=this._dom.placeHolder,p=o.style;p.width=b.width+"px",p.height=b.height+"px",p.marginTop=j.top+"px",p.marginRight=j.right+"px",p.marginBottom=j.bottom+"px",p.marginLeft=j.left+"px",h._maintainFocus(function(){a._dom.root.parentElement.insertBefore(o,a._dom.root),k.document.body.appendChild(a._dom.root),a._dom.root.style.width=c+"px",a._dom.root.style.left=b.left-j.left+"px";var e=0,f=k.innerHeight,g=m-e,i=f-n;g>i?(a._commandingSurface.overflowDirection=d.OverflowDirection.top,a._dom.root.style.bottom=f-b.bottom-j.bottom+"px"):(a._commandingSurface.overflowDirection=d.OverflowDirection.bottom,a._dom.root.style.top=e+b.top-j.top+"px"),h.addClass(a._dom.root,d.ClassNames.openedClass),h.removeClass(a._dom.root,d.ClassNames.closedClass)}),this._commandingSurface.synchronousOpen(),l.shown(this._dismissable)},a.prototype._updateDomImpl_renderClosed=function(){var a=this;h._maintainFocus(function(){if(a._dom.placeHolder.parentElement){var b=a._dom.placeHolder;b.parentElement.insertBefore(a._dom.root,b),b.parentElement.removeChild(b)}a._dom.root.style.top="",a._dom.root.style.right="",a._dom.root.style.bottom="",a._dom.root.style.left="",a._dom.root.style.width=a._updateDomImpl_renderedState.prevInlineWidth,h.addClass(a._dom.root,d.ClassNames.closedClass),h.removeClass(a._dom.root,d.ClassNames.openedClass)}),this._commandingSurface.synchronousClose(),l.hidden(this._dismissable)},a.ClosedDisplayMode=s,a.supportedForProcessing=!0,a}();b.ToolBar=u,c.Class.mix(u,j.createEventProperties(d.EventNames.beforeOpen,d.EventNames.afterOpen,d.EventNames.beforeClose,d.EventNames.afterClose)),c.Class.mix(u,f.DOMEventMixin)}),d("WinJS/Controls/ToolBar",["require","exports","../Core/_Base"],function(a,b,c){var d=null;c.Namespace.define("WinJS.UI",{ToolBar:{get:function(){return d||a(["./ToolBar/_ToolBar"],function(a){d=a}),d.ToolBar}}})}),d("WinJS/Controls/_LegacyAppBar/_Layouts",["exports","../../Animations/_TransitionAnimation","../../BindingList","../../Core/_BaseUtils","../../Core/_Global","../../Core/_Base","../../Core/_ErrorFromName","../../Core/_Resources","../../Core/_WriteProfilerMark","../../Controls/ToolBar","../../Controls/ToolBar/_Constants","../../Promise","../../Scheduler","../../Utilities/_Control","../../Utilities/_Dispose","../../Utilities/_ElementUtilities","../AppBar/_Command","./_Constants"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r){"use strict";f.Namespace._moduleDefine(a,"WinJS.UI",{_AppBarBaseLayout:f.Namespace._lazy(function(){var a=r.appBarLayoutCustom,b={get nullCommand(){return"Invalid argument: command must not be null"}},c=f.Class.define(function(a,b){this._disposed=!1,b=b||{},n.setOptions(this,b),a&&this.connect(a)},{className:{get:function(){return this._className}},type:{get:function(){return this._type||a}},commandsInOrder:{get:function(){var a=this.appBarEl.querySelectorAll("."+r.appBarCommandClass);return Array.prototype.map.call(a,function(a){return a.winControl})}},connect:function(a){this.className&&p.addClass(a,this.className),this.appBarEl=a},disconnect:function(){this.className&&p.removeClass(this.appBarEl,this.className),this.appBarEl=null,this.dispose()},layout:function(a){for(var b=a.length,c=0;b>c;c++){var d=this.sanitizeCommand(a[c]);this.appBarEl.appendChild(d._element)}},showCommands:function(a){this.appBarEl.winControl._showCommands(a)},showOnlyCommands:function(a){this.appBarEl.winControl._showOnlyCommands(a)},hideCommands:function(a){this.appBarEl.winControl._hideCommands(a)},sanitizeCommand:function(a){if(!a)throw new g("WinJS.UI.AppBar.NullCommand",b.nullCommand);return a=a.winControl||a,a._element||(a=new q.AppBarCommand(null,a)),a._element.parentElement&&a._element.parentElement.removeChild(a._element),a},dispose:function(){this._disposed=!0},disposeChildren:function(){var a=this.appBarEl.querySelectorAll("."+r.firstDivClass);a=a.length>=1?a[0]:null;var b=this.appBarEl.querySelectorAll("."+r.finalDivClass);b=b.length>=1?b[0]:null;for(var c=this.appBarEl.children,d=c.length,e=0;d>e;e++){var f=c[e];f!==a&&f!==b&&o.disposeSubTree(f)}},handleKeyDown:function(){},commandsUpdated:function(){},beginAnimateCommands:function(){},endAnimateCommands:function(){},scale:function(){},resize:function(){},positionChanging:function(a,b){return l.wrap()},setFocusOnShow:function(){this.appBarEl.winControl._setFocusToAppBar()}});return c})}),f.Namespace._moduleDefine(a,"WinJS.UI",{_AppBarCommandsLayout:f.Namespace._lazy(function(){var b=r.commandLayoutClass,c=r.appBarLayoutCommands,d=f.Class.derive(a._AppBarBaseLayout,function(d){a._AppBarBaseLayout.call(this,d,{_className:b,_type:c}),this._commandLayoutsInit(d)},{commandsInOrder:{get:function(){return this._originalCommands.filter(function(a){return this.appBarEl.contains(a.element)},this)}},layout:function(a){p.empty(this._primaryCommands),p.empty(this._secondaryCommands),this._originalCommands=[];for(var b=0,c=a.length;c>b;b++){var d=this.sanitizeCommand(a[b]);this._originalCommands.push(d),"primary"===d.section||"global"===d.section?this._primaryCommands.appendChild(d._element):this._secondaryCommands.appendChild(d._element)}this.appBarEl.appendChild(this._secondaryCommands),this.appBarEl.appendChild(this._primaryCommands),this._needToMeasureNewCommands=!0,m.schedule(function(){this._needToMeasureNewCommands&&!this._disposed&&this.scale()}.bind(this),m.Priority.idle,this,"WinJS._commandLayoutsMixin._scaleNewCommands")},disposeChildren:function(){o.disposeSubTree(this._primaryCommands),o.disposeSubTree(this._secondaryCommands)},handleKeyDown:function(a){var b=p.Key;if(!p._matchesSelector(a.target,".win-interactive, .win-interactive *")){var c="rtl"===p._getComputedStyle(this.appBarEl).direction,d=c?b.rightArrow:b.leftArrow,f=c?b.leftArrow:b.rightArrow;if(a.keyCode===d||a.keyCode===f||a.keyCode===b.home||a.keyCode===b.end){var g,h=this._primaryCommands.contains(e.document.activeElement),i=this._getFocusableCommandsInLogicalOrder(h);if(i.length)switch(a.keyCode){case d:var j=Math.max(-1,i.focusedIndex-1)+i.length;g=i[j%i.length].winControl.lastElementFocus;break;case f:var j=i.focusedIndex+1+i.length;g=i[j%i.length].winControl.firstElementFocus;break;case b.home:var j=0;g=i[j].winControl.firstElementFocus;break;case b.end:var j=i.length-1;g=i[j].winControl.lastElementFocus}g&&g!==e.document.activeElement&&(g.focus(),a.preventDefault())}}},commandsUpdated:function(a){var b=a?a:this.commandsInOrder.filter(function(a){return!a.hidden});this._fullSizeWidthOfLastKnownVisibleCommands=this._getWidthOfFullSizeCommands(b)},beginAnimateCommands:function(a,b,c){this._scaleAfterAnimations=!1;var d=this._getWidthOfFullSizeCommands(a)-this._getWidthOfFullSizeCommands(b);if(d>0){var e=c.concat(a);this.commandsUpdated(e),this.scale()}else 0>d&&(this._scaleAfterAnimations=!0)},endAnimateCommands:function(){this._scaleAfterAnimations&&(this.commandsUpdated(),this.scale())},resize:function(){this._disposed||(this._appBarTotalKnownWidth=null,this.appBarEl.winControl.opened&&this.scale())},disconnect:function(){a._AppBarBaseLayout.prototype.disconnect.call(this)},_getWidthOfFullSizeCommands:function(a){this._needToMeasureNewCommands&&this._measureContentCommands();var b=0,c=0,d=0;if(!a)return this._fullSizeWidthOfLastKnownVisibleCommands;for(var e,f=0,g=a.length;g>f;f++)e=a[f].winControl||a[f],e._type===r.typeSeparator?c++:e._type!==r.typeContent?d++:b+=e._fullSizeWidth;return b+=c*r.separatorWidth+d*r.buttonWidth},_getFocusableCommandsInLogicalOrder:function(){var a=this._secondaryCommands.children,b=this._primaryCommands.children,c=-1,d=function(a){for(var b=[],d=0,f=a.length;f>d;d++){var g=a[d];if(p.hasClass(g,r.appBarCommandClass)&&g.winControl){var h=g.contains(e.document.activeElement);(g.winControl._isFocusable()||h)&&(b.push(g),h&&(c=b.length-1))}}return b},f=Array.prototype.slice.call(a).concat(Array.prototype.slice.call(b)),g=d(f);return g.focusedIndex=c,g},_commandLayoutsInit:function(){this._primaryCommands=e.document.createElement("DIV"),this._secondaryCommands=e.document.createElement("DIV"),p.addClass(this._primaryCommands,r.primaryCommandsClass),p.addClass(this._secondaryCommands,r.secondaryCommandsClass)},_scaleHelper:function(){var a="minimal"===this.appBarEl.winControl.closedDisplayMode?r.appBarInvokeButtonWidth:0;return e.document.documentElement.clientWidth-a},_measureContentCommands:function(){if(e.document.body.contains(this.appBarEl)){this._needToMeasureNewCommands=!1;var a=p.hasClass(this.appBarEl,"win-navbar-closed");p.removeClass(this.appBarEl,"win-navbar-closed");var b=this.appBarEl.style.display;this.appBarEl.style.display="";for(var c,d,f=this.appBarEl.querySelectorAll("div."+r.appBarCommandClass),g=0,h=f.length;h>g;g++)d=f[g],d.winControl&&d.winControl._type===r.typeContent&&(c=d.style.display,d.style.display="",d.winControl._fullSizeWidth=p.getTotalWidth(d)||0,d.style.display=c);this.appBarEl.style.display=b,a&&p.addClass(this.appBarEl,"win-navbar-closed"),this.commandsUpdated()}}});return d})}),f.Namespace._moduleDefine(a,"WinJS.UI",{_AppBarMenuLayout:f.Namespace._lazy(function(){function g(a,c){var f=c.duration*b._animationFactor,g=d._browserStyleEquivalents.transition.scriptName;a.style[g]=f+"ms "+t.cssName+" "+c.timing,a.style[t.scriptName]=c.to;var h;return new l(function(b){var c=function(b){b.target===a&&b.propertyName===t.cssName&&h()},i=!1;h=function(){i||(e.clearTimeout(j),a.removeEventListener(d._browserEventEquivalents.transitionEnd,c),a.style[g]="",i=!0),b()};var j=e.setTimeout(function(){j=e.setTimeout(h,f)},50);a.addEventListener(d._browserEventEquivalents.transitionEnd,c)},function(){h()})}function h(a,b,c){var d=c.anchorTrailingEdge?c.to.total-c.from.total:c.from.total-c.to.total,e="width"===c.dimension?"translateX":"translateY",f=c.dimension,h=c.duration||367,i=c.timing||"cubic-bezier(0.1, 0.9, 0.2, 1)";a.style[f]=c.to.total+"px",a.style[t.scriptName]=e+"("+d+"px)",b.style[f]=c.to.content+"px",b.style[t.scriptName]=e+"("+-d+"px)",p._getComputedStyle(a).opacity,p._getComputedStyle(b).opacity;var j={duration:h,timing:i,to:""};return l.join([g(a,j),g(b,j)])}function m(a,b,c){var e=c.anchorTrailingEdge?c.from.total-c.to.total:c.to.total-c.from.total,f="width"===c.dimension?"translateX":"translateY",h=c.duration||367,i=c.timing||"cubic-bezier(0.1, 0.9, 0.2, 1)";a.style[t.scriptName]="",b.style[t.scriptName]="",p._getComputedStyle(a).opacity,p._getComputedStyle(b).opacity;var j={duration:h,timing:i},k=d._merge(j,{to:f+"("+e+"px)"}),m=d._merge(j,{to:f+"("+-e+"px)"});return l.join([g(a,k),g(b,m)])}function n(a,b,c){return c.to.total>c.from.total?h(a,b,c):c.to.total<c.from.total?m(a,b,c):l.as()}var q=r.menuLayoutClass,s=r.appBarLayoutMenu,t=d._browserStyleEquivalents.transform,u=f.Class.derive(a._AppBarBaseLayout,function(b){a._AppBarBaseLayout.call(this,b,{_className:q,_type:s}),this._tranformNames=d._browserStyleEquivalents.transform,this._animationCompleteBound=this._animationComplete.bind(this),this._positionToolBarBound=this._positionToolBar.bind(this)},{commandsInOrder:{get:function(){return this._originalCommands}},layout:function(a){this._writeProfilerMark("layout,info"),a=a||[],this._originalCommands=[];var b=this;a.forEach(function(a){b._originalCommands.push(b.sanitizeCommand(a))}),this._displayedCommands=this._originalCommands.slice(0),this._menu?p.empty(this._menu):(this._menu=e.document.createElement("div"),p.addClass(this._menu,r.menuContainerClass)),this.appBarEl.appendChild(this._menu),this._toolbarEl=e.document.createElement("div"),this._menu.appendChild(this._toolbarEl),this._createToolBar(a)},showCommands:function(a){var b=this._getCommandsElements(a),c=[],d=[],e=this;this._originalCommands.forEach(function(a){(b.indexOf(a.element)>=0||e._displayedCommands.indexOf(a)>=0)&&(d.push(a),c.push(a))}),this._displayedCommands=d,this._updateData(c)},showOnlyCommands:function(a){this._displayedCommands=[],this.showCommands(a)},hideCommands:function(a){var b=this._getCommandsElements(a),c=[],d=[],e=this;this._originalCommands.forEach(function(a){-1===b.indexOf(a.element)&&e._displayedCommands.indexOf(a)>=0&&(d.push(a),c.push(a))}),this._displayedCommands=d,this._updateData(c)},connect:function(b){this._writeProfilerMark("connect,info"),a._AppBarBaseLayout.prototype.connect.call(this,b),this._id=p._uniqueID(b)},resize:function(){this._writeProfilerMark("resize,info"),this._initialized&&(this._forceLayoutPending=!0)},positionChanging:function(a,b){return this._writeProfilerMark("positionChanging from:"+a+" to: "+b+",info"),this._animationPromise=this._animationPromise||l.wrap(),this._animating&&this._animationPromise.cancel(),this._animating=!0,"shown"===b||"shown"!==a&&"compact"===b?(this._positionToolBar(),this._animationPromise=this._animateToolBarEntrance()):"minimal"===a||"compact"===a||"hidden"===a?this._animationPromise=l.wrap():this._animationPromise=this._animateToolBarExit(),this._animationPromise.then(this._animationCompleteBound,this._animationCompleteBound),this._animationPromise},disposeChildren:function(){this._writeProfilerMark("disposeChildren,info"),this._toolbar&&o.disposeSubTree(this._toolbarEl),this._originalCommands=[],this._displayedCommands=[]},setFocusOnShow:function(){this.appBarEl.winControl._setFocusToAppBar(!0,this._menu)},_updateData:function(a){var b=p.hasClass(this.appBarEl,"win-navbar-closed"),d=p.hasClass(this.appBarEl,"win-navbar-opened");p.removeClass(this.appBarEl,"win-navbar-closed");var e=this.appBarEl.style.display;this.appBarEl.style.display="",this._toolbar.data=new c.List(a),b&&this._positionToolBar(),this.appBarEl.style.display=e,b&&p.addClass(this.appBarEl,"win-navbar-closed"),d&&(this._positionToolBar(),this._animateToolBarEntrance())},_getCommandsElements:function(a){
if(!a)return[];"string"!=typeof a&&a&&a.length||(a=[a]);for(var b=[],c=0,d=a.length;d>c;c++)if(a[c])if("string"==typeof a[c]){var f=e.document.getElementById(a[c]);if(f)b.push(f);else for(var g=0,h=this._originalCommands.length;h>g;g++){var f=this._originalCommands[g].element;f.id===a[c]&&b.push(f)}}else a[c].element?b.push(a[c].element):b.push(a[c]);return b},_animationComplete:function(){this._disposed||(this._animating=!1)},_createToolBar:function(a){this._writeProfilerMark("_createToolBar,info");var b=p.hasClass(this.appBarEl,"win-navbar-closed");p.removeClass(this.appBarEl,"win-navbar-closed");var d=this.appBarEl.style.display;this.appBarEl.style.display="",this._toolbar=new j.ToolBar(this._toolbarEl,{data:new c.List(this._originalCommands),shownDisplayMode:"full"});var e=this;this._appbarInvokeButton=this.appBarEl.querySelector("."+r.invokeButtonClass),this._overflowButton=this._toolbarEl.querySelector("."+k.overflowButtonCssClass),this._overflowButton.addEventListener("click",function(){e._appbarInvokeButton.click()}),this._positionToolBar(),this.appBarEl.style.display=d,b&&p.addClass(this.appBarEl,"win-navbar-closed")},_positionToolBar:function(){this._disposed||(this._writeProfilerMark("_positionToolBar,info"),this._initialized=!0)},_animateToolBarEntrance:function(){this._writeProfilerMark("_animateToolBarEntrance,info"),this._forceLayoutPending&&(this._forceLayoutPending=!1,this._toolbar.forceLayout(),this._positionToolBar());var a=this._isMinimal()?0:this.appBarEl.offsetHeight;if(this._isBottom()){var b=this._menu.offsetHeight-a;return this._executeTranslate(this._menu,"translateY("+-b+"px)")}return n(this._menu,this._toolbarEl,{from:{content:a,total:a},to:{content:this._menu.offsetHeight,total:this._menu.offsetHeight},dimension:"height",duration:400,timing:"ease-in"})},_animateToolBarExit:function(){this._writeProfilerMark("_animateToolBarExit,info");var a=this._isMinimal()?0:this.appBarEl.offsetHeight;return this._isBottom()?this._executeTranslate(this._menu,"none"):n(this._menu,this._toolbarEl,{from:{content:this._menu.offsetHeight,total:this._menu.offsetHeight},to:{content:a,total:a},dimension:"height",duration:400,timing:"ease-in"})},_executeTranslate:function(a,c){return b.executeTransition(a,{property:this._tranformNames.cssName,delay:0,duration:400,timing:"ease-in",to:c})},_isMinimal:function(){return"minimal"===this.appBarEl.winControl.closedDisplayMode},_isBottom:function(){return"bottom"===this.appBarEl.winControl.placement},_writeProfilerMark:function(a){i("WinJS.UI._AppBarMenuLayout:"+this._id+":"+a)}});return u})})}),d("WinJS/Controls/_LegacyAppBar",["exports","../Core/_Global","../Core/_WinRT","../Core/_Base","../Core/_BaseUtils","../Core/_ErrorFromName","../Core/_Events","../Core/_Resources","../Core/_WriteProfilerMark","../Animations","../Promise","../Scheduler","../_LightDismissService","../Utilities/_Control","../Utilities/_Dispose","../Utilities/_ElementUtilities","../Utilities/_Hoverable","../Utilities/_KeyboardBehavior","./_LegacyAppBar/_Constants","./_LegacyAppBar/_Layouts","./AppBar/_Command","./AppBar/_Icon","./Flyout/_Overlay","../Application"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x){"use strict";d.Namespace._moduleDefine(a,"WinJS.UI",{_LegacyAppBar:d.Namespace._lazy(function(){function a(a){var c=b.document.querySelectorAll("."+s.appBarClass);if(c)for(var d=c.length,e=0;d>e;e++){var f=c[e],g=f.winControl;g&&!f.disabled&&g._manipulationChanged(a)}}var q={beforeOpen:"beforeopen",afterOpen:"afteropen",beforeClose:"beforeclose",afterClose:"afterclose"},u=g._createEventProperty,v={none:0,hidden:0,minimal:25,compact:48},x={none:"hidden",hidden:"hidden",minimal:"minimal",shown:"shown",compact:"compact"},y={none:"none",minimal:"minimal",compact:"compact"},z="shown",A="hidden",B=!1,C={get ariaLabel(){return h._getWinJSString("ui/appBarAriaLabel").value},get requiresCommands(){return"Invalid argument: commands must not be empty"},get cannotChangePlacementWhenVisible(){return"Invalid argument: The placement property cannot be set when the AppBar is visible, call hide() first"},get cannotChangeLayoutWhenVisible(){return"Invalid argument: The layout property cannot be set when the AppBar is visible, call hide() first"}},D=d.Class.derive(w._Overlay,function(c,d){this._initializing=!0,d=d||{},this._element=c||b.document.createElement("div"),this._id=this._element.id||p._uniqueID(this._element),this._writeProfilerMark("constructor,StartTM"),p.addClass(this._element,s.appBarClass);var e=this;this._dismissable=new m.LightDismissableElement({element:this._element,tabIndex:this._element.hasAttribute("tabIndex")?this._element.tabIndex:-1,onLightDismiss:function(){e.close()},onTakeFocus:function(a){e._dismissable.restoreFocus()||e._layoutImpl.setFocusOnShow()}});var f=this._element.getAttribute("role");f||this._element.setAttribute("role","menubar");var g=this._element.getAttribute("aria-label");g||this._element.setAttribute("aria-label",C.ariaLabel),this._baseOverlayConstructor(this._element),this._lastPositionVisited=x.none,p.addClass(this._element,s.hiddenClass),this._invokeButton=b.document.createElement("button"),this._invokeButton.tabIndex=0,this._invokeButton.setAttribute("type","button"),this._invokeButton.innerHTML="<span class='"+s.ellipsisClass+"'></span>",p.addClass(this._invokeButton,s.invokeButtonClass),this._element.appendChild(this._invokeButton),this._invokeButton.addEventListener("click",function(){e.opened?e._hide():e._show()},!1),this._layout=s.appBarLayoutCustom,delete d._layout,this.placement=d.placement||s.appBarPlacementBottom,this.closedDisplayMode=d.closedDisplayMode||y.compact,n.setOptions(this,d);var h=this._commandsUpdated.bind(this);return this._element.addEventListener(s.commandVisibilityChanged,function(a){e._disposed||(e.opened&&a.preventDefault(),h())}),this._initializing=!1,this._setFocusToAppBarBound=this._setFocusToAppBar.bind(this),this._element.addEventListener("keydown",this._handleKeyDown.bind(this),!1),B||(b.document.addEventListener("MSManipulationStateChanged",a,!1),B=!0),this.closedDisplayMode===y.none&&this.layout===s.appBarLayoutCommands&&(this._element.style.display="none"),this._winKeyboard=new r._WinKeyboard(this._element),this._writeProfilerMark("constructor,StopTM"),this},{placement:{get:function(){return this._placement},set:function(a){var b=!1;if(c.Windows.ApplicationModel.DesignMode.designModeEnabled&&(this._hide(),b=!0),this.opened)throw new f("WinJS.UI._LegacyAppBar.CannotChangePlacementWhenVisible",C.cannotChangePlacementWhenVisible);this._placement=a===s.appBarPlacementTop?s.appBarPlacementTop:s.appBarPlacementBottom,this._placement===s.appBarPlacementTop?(p.addClass(this._element,s.topClass),p.removeClass(this._element,s.bottomClass)):this._placement===s.appBarPlacementBottom&&(p.removeClass(this._element,s.topClass),p.addClass(this._element,s.bottomClass)),this._ensurePosition(),b&&this._show()}},_layout:{get:function(){return this._layoutImpl.type},set:function(a){a!==s.appBarLayoutCommands&&a!==s.appBarLayoutCustom&&a!==s.appBarLayoutMenu;var b=!1;if(c.Windows.ApplicationModel.DesignMode.designModeEnabled&&(this._hide(),b=!0),this.opened)throw new f("WinJS.UI._LegacyAppBar.CannotChangeLayoutWhenVisible",C.cannotChangeLayoutWhenVisible);var d;this._initializing||(d=this._layoutImpl.commandsInOrder,this._layoutImpl.disconnect()),a===s.appBarLayoutCommands?this._layoutImpl=new t._AppBarCommandsLayout:a===s.appBarLayoutMenu?this._layoutImpl=new t._AppBarMenuLayout:this._layoutImpl=new t._AppBarBaseLayout,this._layoutImpl.connect(this._element),d&&d.length&&this._layoutCommands(d),b&&this._show()},configurable:!0},commands:{set:function(a){if(this.opened)throw new f("WinJS.UI._LegacyAppBar.CannotChangeCommandsWhenVisible",h._formatString(w._Overlay.commonstrings.cannotChangeCommandsWhenVisible,"_LegacyAppBar"));this._initializing||this._disposeChildren(),this._layoutCommands(a)}},_layoutCommands:function(a){p.empty(this._element),this._element.appendChild(this._invokeButton),Array.isArray(a)||(a=[a]),this._layoutImpl.layout(a)},closedDisplayMode:{get:function(){return this._closedDisplayMode},set:function(a){var b=this._closedDisplayMode;if(b!==a){var c=p.hasClass(this._element,s.hiddenClass)||p.hasClass(this._element,s.hidingClass);a===y.none?(this._closedDisplayMode=y.none,c&&b||(p.removeClass(this._element,s.minimalClass),p.removeClass(this._element,s.compactClass))):a===y.minimal?(this._closedDisplayMode=y.minimal,c&&b&&b!==y.none||(p.addClass(this._element,s.minimalClass),p.removeClass(this._element,s.compactClass))):(this._closedDisplayMode=y.compact,p.addClass(this._element,s.compactClass),p.removeClass(this._element,s.minimalClass)),this._layoutImpl.resize(),c&&this._changeVisiblePosition(x[this._closedDisplayMode])}}},opened:{get:function(){return!p.hasClass(this._element,s.hiddenClass)&&!p.hasClass(this._element,s.hidingClass)&&this._doNext!==x.minimal&&this._doNext!==x.compact&&this._doNext!==x.none},set:function(a){var b=this.opened;a&&!b?this._show():!a&&b&&this._hide()}},onbeforeopen:u(q.beforeOpen),onafteropen:u(q.afterOpen),onbeforeclose:u(q.beforeClose),onafterclose:u(q.afterClose),getCommandById:function(a){var b=this._layoutImpl.commandsInOrder.filter(function(b){return b.id===a||b.element.id===a});return 1===b.length?b[0]:0===b.length?null:b},showCommands:function(a){if(!a)throw new f("WinJS.UI._LegacyAppBar.RequiresCommands",C.requiresCommands);this._layoutImpl.showCommands(a)},hideCommands:function(a){if(!a)throw new f("WinJS.UI._LegacyAppBar.RequiresCommands",C.requiresCommands);this._layoutImpl.hideCommands(a)},showOnlyCommands:function(a){if(!a)throw new f("WinJS.UI._LegacyAppBar.RequiresCommands",C.requiresCommands);this._layoutImpl.showOnlyCommands(a)},open:function(){this._writeProfilerMark("show,StartTM"),this._show()},_show:function(){var a=x.shown,b=null;this.disabled||!p.hasClass(this._element,s.hiddenClass)&&!p.hasClass(this._element,s.hidingClass)||(b=z),this._changeVisiblePosition(a,b),b&&(this._updateFirstAndFinalDiv(),m.shown(this._dismissable))},close:function(){this._writeProfilerMark("hide,StartTM"),this._hide()},_hide:function(a){var a=a||x[this.closedDisplayMode],b=null;p.hasClass(this._element,s.hiddenClass)||p.hasClass(this._element,s.hidingClass)||(b=A),this._changeVisiblePosition(a,b)},_dispose:function(){o.disposeSubTree(this.element),m.hidden(this._dismissable),this._layoutImpl.dispose(),this.disabled=!0,this.close()},_disposeChildren:function(){this._layoutImpl.disposeChildren()},_handleKeyDown:function(a){this._invokeButton.contains(b.document.activeElement)||this._layoutImpl.handleKeyDown(a)},_visiblePixels:{get:function(){return{hidden:v.hidden,minimal:v.minimal,compact:Math.max(this._heightWithoutLabels||0,v.compact),shown:this._element.offsetHeight}}},_visiblePosition:{get:function(){return this._animating&&x[this._element.winAnimating]?this._element.winAnimating:this._lastPositionVisited}},_visible:{get:function(){return this._visiblePosition!==x.none}},_changeVisiblePosition:function(a,b){if(this._visiblePosition===a&&!this._keyboardObscured||this.disabled&&a!==x.disabled)this._afterPositionChange(null);else if(this._animating||this._needToHandleShowingKeyboard||this._needToHandleHidingKeyboard)this._doNext=a,this._afterPositionChange(null);else{this._element.winAnimating=a;var c=this._initializing?!1:!0,d=this._lastPositionVisited;this._element.style.display="";var e=a===x.hidden;this._keyboardObscured&&(e?c=!1:d=x.hidden,this._keyboardObscured=!1),b===z?this._beforeShow():b===A&&this._beforeHide(),this._ensurePosition(),this._element.style.opacity=1,this._element.style.visibility="visible",this._animationPromise=c?this._animatePositionChange(d,a):k.wrap(),this._animationPromise.then(function(){this._afterPositionChange(a,b)}.bind(this),function(){this._afterPositionChange(a,b)}.bind(this))}},_afterPositionChange:function(a,b){if(!this._disposed){if(a){a===x.minimal&&(p.addClass(this._element,s.minimalClass),p.removeClass(this._element,s.compactClass)),a===x.hidden&&this.closedDisplayMode===y.none&&(p.removeClass(this._element,s.minimalClass),p.removeClass(this._element,s.compactClass)),this._element.winAnimating="",this._lastPositionVisited=a,this._doNext===this._lastPositionVisited&&(this._doNext=""),b===A&&m.hidden(this._dismissable),a===x.hidden&&(this._element.style.visibility="hidden",this._element.style.display="none");var c=e._browserStyleEquivalents.transform.scriptName;this._element.style[c]="",b===z?this._afterShow():b===A&&this._afterHide(),l.schedule(this._checkDoNext,l.Priority.normal,this,"WinJS.UI._LegacyAppBar._checkDoNext")}this._afterPositionChangeCallBack()}},_afterPositionChangeCallBack:function(){},_beforeShow:function(){this._queuedCommandAnimation&&(this._showAndHideFast(this._queuedToShow,this._queuedToHide),this._queuedToShow=[],this._queuedToHide=[]),this._layoutImpl.scale(),this.closedDisplayMode===y.compact&&(this._heightWithoutLabels=this._element.offsetHeight),p.removeClass(this._element,s.hiddenClass),p.addClass(this._element,s.showingClass),this._sendEvent(q.beforeOpen)},_afterShow:function(){p.removeClass(this._element,s.showingClass),p.addClass(this._element,s.shownClass),this._sendEvent(q.afterOpen),this._writeProfilerMark("show,StopTM")},_beforeHide:function(){p.removeClass(this._element,s.shownClass),p.addClass(this._element,s.hidingClass),this._sendEvent(q.beforeClose)},_afterHide:function(){this._queuedCommandAnimation&&(this._showAndHideFast(this._queuedToShow,this._queuedToHide),this._queuedToShow=[],this._queuedToHide=[]),p.removeClass(this._element,s.hidingClass),p.addClass(this._element,s.hiddenClass),this._sendEvent(q.afterClose),this._writeProfilerMark("hide,StopTM")},_animatePositionChange:function(a,b){var c,d=this._layoutImpl.positionChanging(a,b),e=this._visiblePixels[a],f=this._visiblePixels[b],g=Math.abs(f-e),h=this._placement===s.appBarPlacementTop?-g:g;if(this._placement===s.appBarPlacementTop&&(a===x.shown&&b===x.compact||a===x.compact&&b===x.shown)&&(h=0),f>e){var i={top:h+"px",left:"0px"};c=j.showEdgeUI(this._element,i,{mechanism:"transition"})}else{var l={top:h+"px",left:"0px"};c=j.hideEdgeUI(this._element,l,{mechanism:"transition"})}return k.join([d,c])},_checkDoNext:function(){this._animating||this._needToHandleShowingKeyboard||this._needToHandleHidingKeyboard||this._disposed||(this._doNext===x.disabled||this._doNext===x.hidden||this._doNext===x.minimal||this._doNext===x.compact?(this._hide(this._doNext),this._doNext=""):this._queuedCommandAnimation?this._showAndHideQueue():this._doNext===x.shown&&(this._show(),this._doNext=""))},_setFocusToAppBar:function(a,b){this._focusOnFirstFocusableElement(a,b)||w._Overlay._trySetActive(this._element,b)},_commandsUpdated:function(){this._initializing||(this._layoutImpl.commandsUpdated(),this._layoutImpl.scale())},_beginAnimateCommands:function(a,b,c){this._layoutImpl.beginAnimateCommands(a,b,c)},_endAnimateCommands:function(){this._layoutImpl.endAnimateCommands(),this._endAnimateCommandsCallBack()},_endAnimateCommandsCallBack:function(){},_getTopOfVisualViewport:function(){return w._Overlay._keyboardInfo._visibleDocTop},_getAdjustedBottom:function(){return w._Overlay._keyboardInfo._visibleDocBottomOffset},_showingKeyboard:function(a){if(this._keyboardObscured=!1,this._needToHandleHidingKeyboard=!1,!w._Overlay._keyboardInfo._visible||!this._alreadyInPlace()){this._needToHandleShowingKeyboard=!0,this.opened&&this._element.contains(b.document.activeElement)&&(a.ensuredFocusedElementInView=!0),this._visible&&this._placement!==s.appBarPlacementTop&&w._Overlay._isFlyoutVisible()?this._keyboardObscured=!0:this._scrollHappened=!1;var c=this;b.setTimeout(function(a){c._checkKeyboardTimer(a)},w._Overlay._keyboardInfo._animationShowLength+w._Overlay._scrollTimeout)}},_hidingKeyboard:function(){this._keyboardObscured=!1,this._needToHandleShowingKeyboard=!1,this._needToHandleHidingKeyboard=!0,w._Overlay._keyboardInfo._isResized||((this._visible||this._animating)&&(this._checkScrollPosition(),this._element.style.display=""),this._needToHandleHidingKeyboard=!1)},_resize:function(a){this._needToHandleShowingKeyboard?this._visible&&(this._placement===s.appBarPlacementTop||this._keyboardObscured||(this._element.style.display="none")):this._needToHandleHidingKeyboard&&(this._needToHandleHidingKeyboard=!1,(this._visible||this._animating)&&(this._checkScrollPosition(),this._element.style.display="")),this._initializing||this._layoutImpl.resize(a)},_checkKeyboardTimer:function(){this._scrollHappened||this._mayEdgeBackIn()},_manipulationChanged:function(a){0===a.currentState&&this._scrollHappened&&this._mayEdgeBackIn()},_mayEdgeBackIn:function(){if(this._needToHandleShowingKeyboard)if(this._needToHandleShowingKeyboard=!1,this._keyboardObscured||this._placement===s.appBarPlacementTop&&0===w._Overlay._keyboardInfo._visibleDocTop)this._checkDoNext();else{var a=this._visiblePosition;this._lastPositionVisited=x.hidden,this._changeVisiblePosition(a,!1)}this._scrollHappened=!1},_ensurePosition:function(){var a=this._computePositionOffset();this._element.style.bottom=a.bottom,this._element.style.top=a.top},_computePositionOffset:function(){var a={};return this._placement===s.appBarPlacementBottom?(a.bottom=this._getAdjustedBottom()+"px",a.top=""):this._placement===s.appBarPlacementTop&&(a.bottom="",a.top=this._getTopOfVisualViewport()+"px"),a},_checkScrollPosition:function(){return this._needToHandleShowingKeyboard?void(this._scrollHappened=!0):void((this._visible||this._animating)&&(this._ensurePosition(),this._checkDoNext()))},_alreadyInPlace:function(){var a=this._computePositionOffset();return a.top===this._element.style.top&&a.bottom===this._element.style.bottom},_updateFirstAndFinalDiv:function(){var a=this._element.querySelectorAll("."+s.firstDivClass);a=a.length>=1?a[0]:null;var c=this._element.querySelectorAll("."+s.finalDivClass);c=c.length>=1?c[0]:null,a&&this._element.children[0]!==a&&(a.parentNode.removeChild(a),a=null),c&&this._element.children[this._element.children.length-1]!==c&&(c.parentNode.removeChild(c),c=null),a||(a=b.document.createElement("div"),a.style.display="inline",a.className=s.firstDivClass,a.tabIndex=-1,a.setAttribute("aria-hidden","true"),p._addEventListener(a,"focusin",this._focusOnLastFocusableElementOrThis.bind(this),!1),this._element.children[0]?this._element.insertBefore(a,this._element.children[0]):this._element.appendChild(a)),c||(c=b.document.createElement("div"),c.style.display="inline",c.className=s.finalDivClass,c.tabIndex=-1,c.setAttribute("aria-hidden","true"),p._addEventListener(c,"focusin",this._focusOnFirstFocusableElementOrThis.bind(this),!1),this._element.appendChild(c)),this._element.children[this._element.children.length-2]!==this._invokeButton&&this._element.insertBefore(this._invokeButton,c);var d=this._element.getElementsByTagName("*"),e=p._getHighestTabIndexInList(d);this._invokeButton.tabIndex=e,a&&(a.tabIndex=p._getLowestTabIndexInList(d)),c&&(c.tabIndex=e)},_writeProfilerMark:function(a){i("WinJS.UI._LegacyAppBar:"+this._id+":"+a)}},{_Events:q});return D})})}),d("WinJS/Controls/Menu",["exports","../Core/_Global","../Core/_Base","../Core/_BaseUtils","../Core/_ErrorFromName","../Core/_Resources","../Core/_WriteProfilerMark","../Promise","../Utilities/_ElementUtilities","../Utilities/_Hoverable","../Utilities/_KeyboardBehavior","./_LegacyAppBar/_Constants","./Flyout","./Flyout/_Overlay","./Menu/_Command"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o){"use strict";c.Namespace._moduleDefine(a,"WinJS.UI",{Menu:c.Namespace._lazy(function(){function a(a){var b=a.element||a;return i._matchesSelector(b,"."+l.menuClass+" ."+l.menuCommandClass)}var j=i.Key,p={get ariaLabel(){return f._getWinJSString("ui/menuAriaLabel").value},get requiresCommands(){return"Invalid argument: commands must not be empty"},get nullCommand(){return"Invalid argument: command must not be null"}},q=c.Class.derive(m.Flyout,function(a,c){c=c||{},this._element=a||b.document.createElement("div"),this._id=this._element.id||i._uniqueID(this._element),this._writeProfilerMark("constructor,StartTM"),!c.commands&&this._element&&(c=d._shallowCopy(c),c.commands=this._verifyCommandsOnly(this._element,"WinJS.UI.MenuCommand"));var e="menu",f=null;this._element&&(e=this._element.getAttribute("role")||e,f=this._element.getAttribute("aria-label")||f),this._baseFlyoutConstructor(this._element,c),this._element.setAttribute("role",e),this._element.setAttribute("aria-label",f),this._element.addEventListener("keydown",this._handleKeyDown.bind(this),!0),this._element.addEventListener(l._menuCommandInvokedEvent,this._handleCommandInvoked.bind(this),!1),this._element.addEventListener("mouseover",this._handleMouseOver.bind(this),!1),this._element.addEventListener("mouseout",this._handleMouseOut.bind(this),!1),i.addClass(this._element,l.menuClass),this._winKeyboard=new k._WinKeyboard(this._element),this.hide(),this._writeProfilerMark("constructor,StopTM")},{commands:{set:function(a){if(!this.hidden)throw new e("WinJS.UI.Menu.CannotChangeCommandsWhenVisible",f._formatString(n._Overlay.commonstrings.cannotChangeCommandsWhenVisible,"Menu"));i.empty(this._element),Array.isArray(a)||(a=[a]);for(var b=a.length,c=0;b>c;c++)this._addCommand(a[c])}},getCommandById:function(a){for(var b=this.element.querySelectorAll("#"+a),c=[],d=0,e=b.length;e>d;d++)b[d].winControl&&c.push(b[d].winControl);return 1===c.length?c[0]:0===c.length?null:c},showCommands:function(a){if(!a)throw new e("WinJS.UI.Menu.RequiresCommands",p.requiresCommands);this._showCommands(a,!0)},hideCommands:function(a){if(!a)throw new e("WinJS.UI.Menu.RequiresCommands",p.requiresCommands);this._hideCommands(a,!0)},showOnlyCommands:function(a){if(!a)throw new e("WinJS.UI.Menu.RequiresCommands",p.requiresCommands);this._showOnlyCommands(a,!0)},_hide:function(){this._hoverPromise&&this._hoverPromise.cancel(),m.Flyout.prototype._hide.call(this)},_afterHide:function(){i.removeClass(this.element,l.menuMouseSpacingClass),i.removeClass(this.element,l.menuTouchSpacingClass)},_beforeShow:function(){i.hasClass(this.element,l.menuMouseSpacingClass)||i.hasClass(this.element,l.menuTouchSpacingClass)||i.addClass(this.element,m.Flyout._cascadeManager.inputType===k._InputTypes.mouse||m.Flyout._cascadeManager.inputType===k._InputTypes.keyboard?l.menuMouseSpacingClass:l.menuTouchSpacingClass),this._checkMenuCommands()},_addCommand:function(a){if(!a)throw new e("WinJS.UI.Menu.NullCommand",p.nullCommand);a._element||(a=new o.MenuCommand(null,a)),a._element.parentElement&&a._element.parentElement.removeChild(a._element),this._element.appendChild(a._element)},_dispose:function(){this._hoverPromise&&this._hoverPromise.cancel(),m.Flyout.prototype._dispose.call(this)},_commandsUpdated:function(){this.hidden||this._checkMenuCommands()},_checkMenuCommands:function(){var a=this._element.querySelectorAll(".win-command"),b=!1,c=!1;if(a)for(var d=0,e=a.length;e>d;d++){var f=a[d].winControl;f&&!f.hidden&&(b||f.type!==l.typeToggle||(b=!0),c||f.type!==l.typeFlyout||(c=!0))}i[b?"addClass":"removeClass"](this._element,l.menuContainsToggleCommandClass),i[c?"addClass":"removeClass"](this._element,l.menuContainsFlyoutCommandClass)},_handleKeyDown:function(a){a.keyCode===j.upArrow?(q._focusOnPreviousElement(this.element),a.preventDefault()):a.keyCode===j.downArrow?(q._focusOnNextElement(this.element),a.preventDefault()):a.keyCode!==j.space&&a.keyCode!==j.enter||this.element!==b.document.activeElement?a.keyCode===j.tab&&a.preventDefault():(a.preventDefault(),this.hide())},_handleFocusIn:function(b){var c=b.target;if(a(c)){var d=c.winControl;if(i.hasClass(d.element,l.menuCommandFlyoutActivatedClass))d.flyout.element.focus();else{var e=this.element.querySelector("."+l.menuCommandFlyoutActivatedClass);e&&o.MenuCommand._deactivateFlyoutCommand(e)}}else c===this.element&&m.Flyout.prototype._handleFocusIn.call(this,b)},_handleCommandInvoked:function(a){this._hoverPromise&&this._hoverPromise.cancel();var b=a.detail.command;b._type!==l.typeFlyout&&b._type!==l.typeSeparator&&this._lightDismiss()},_hoverPromise:null,_handleMouseOver:function(b){var c=b.target;if(a(c)){var d=c.winControl,e=this;c.focus&&(c.focus(),i.removeClass(c,"win-keyboard"),d.type===l.typeFlyout&&d.flyout&&d.flyout.hidden&&(this._hoverPromise=this._hoverPromise||h.timeout(l.menuCommandHoverDelay).then(function(){e.hidden||e._disposed||d._invoke(b),e._hoverPromise=null},function(){e._hoverPromise=null})))}},_handleMouseOut:function(c){var d=c.target;a(d)&&!d.contains(c.relatedTarget)&&(d===b.document.activeElement&&this.element.focus(),this._hoverPromise&&this._hoverPromise.cancel())},_writeProfilerMark:function(a){g("WinJS.UI.Menu:"+this._id+":"+a)}});return q._focusOnNextElement=function(a){var c=b.document.activeElement;do c=c===a?c.firstElementChild:c.nextElementSibling,c?c.focus():c=a;while(c!==b.document.activeElement)},q._focusOnPreviousElement=function(a){var c=b.document.activeElement;do c=c===a?c.lastElementChild:c.previousElementSibling,c?c.focus():c=a;while(c!==b.document.activeElement)},q})})}),d("WinJS/Controls/AutoSuggestBox/_SearchSuggestionManagerShim",["exports","../../_Signal","../../Core/_Base","../../Core/_BaseUtils","../../Core/_Events","../../BindingList"],function(a,b,c,d,e,f){"use strict";var g={reset:0,itemInserted:1,itemRemoved:2,itemChanged:3},h={Query:0,Result:1,Separator:2},i=c.Class.derive(Array,function(){},{reset:function(){this.length=0,this.dispatchEvent("vectorchanged",{collectionChange:g.reset,index:0})},insert:function(a,b){this.splice(a,0,b),this.dispatchEvent("vectorchanged",{collectionChange:g.itemInserted,index:a})},remove:function(a){this.splice(a,1),this.dispatchEvent("vectorchanged",{collectionChange:g.itemRemoved,index:a})}});c.Class.mix(i,e.eventMixin);var j=c.Class.define(function(){this._data=[]},{size:{get:function(){return this._data.length}},appendQuerySuggestion:function(a){this._data.push({kind:h.Query,text:a})},appendQuerySuggestions:function(a){a.forEach(this.appendQuerySuggestion.bind(this))},appendResultSuggestion:function(a,b,c,d,e){this._data.push({kind:h.Result,text:a,detailText:b,tag:c,imageUrl:d,imageAlternateText:e,image:null})},appendSearchSeparator:function(a){this._data.push({kind:h.Separator,text:a})}}),k=c.Class.define(function(a,b,c){this._queryText=a,this._language=b,this._linguisticDetails=c,this._searchSuggestionCollection=new j},{language:{get:function(){return this._language}},linguisticDetails:{get:function(){return this._linguisticDetails}},queryText:{get:function(){return this._queryText}},searchSuggestionCollection:{get:function(){return this._searchSuggestionCollection}},getDeferral:function(){return this._deferralSignal||(this._deferralSignal=new b)},_deferralSignal:null}),l=c.Class.define(function(){this._updateVector=this._updateVector.bind(this),this._suggestionVector=new i,this._query="",this._history={"":[]},this._dataSource=[],this.searchHistoryContext="",this.searchHistoryEnabled=!0},{addToHistory:function(a){if(a&&a.trim()){for(var b=this._history[this.searchHistoryContext],c=-1,d=0,e=b.length;e>d;d++){var f=b[d];if(f.text.toLowerCase()===a.toLowerCase()){c=d;break}}c>=0&&b.splice(c,1),b.splice(0,0,{text:a,kind:h.Query}),this._updateVector()}},clearHistory:function(){this._history[this.searchHistoryContext]=[],this._updateVector()},setLocalContentSuggestionSettings:function(a){},setQuery:function(a){function b(a){c._dataSource=a,c._updateVector()}var c=this;this._query=a;var d=new k(a);this.dispatchEvent("suggestionsrequested",{request:d}),d._deferralSignal?d._deferralSignal.promise.then(b.bind(this,d.searchSuggestionCollection._data)):b(d.searchSuggestionCollection._data)},searchHistoryContext:{get:function(){return""+this._searchHistoryContext},set:function(a){a=""+a,this._history[a]||(this._history[a]=[]),this._searchHistoryContext=a}},searchHistoryEnabled:{get:function(){return this._searchHistoryEnabled},set:function(a){this._searchHistoryEnabled=a}},suggestions:{get:function(){return this._suggestionVector}},_updateVector:function(){for(this.suggestions.insert(this.suggestions.length,{text:"",kind:h.Query});this.suggestions.length>1;)this.suggestions.remove(0);var a=0,b={};if(this.searchHistoryEnabled){var c=this._query.toLowerCase();this._history[this.searchHistoryContext].forEach(function(d){var e=d.text.toLowerCase();0===e.indexOf(c)&&(this.suggestions.insert(a,d),b[e]=!0,a++)},this)}this._dataSource.forEach(function(c){c.kind===h.Query?b[c.text.toLowerCase()]||(this.suggestions.insert(a,c),a++):(this.suggestions.insert(a,c),a++)},this),this.suggestions.remove(this.suggestions.length-1)}});c.Class.mix(l,e.eventMixin),c.Namespace._moduleDefine(a,null,{_CollectionChange:g,_SearchSuggestionKind:h,_SearchSuggestionManagerShim:l})}),d("require-style!less/styles-autosuggestbox",[],function(){}),d("require-style!less/colors-autosuggestbox",[],function(){}),d("WinJS/Controls/AutoSuggestBox",["exports","../Core/_Global","../Core/_WinRT","../Core/_Base","../Core/_ErrorFromName","../Core/_Events","../Core/_Resources","../Utilities/_Control","../Utilities/_ElementListUtilities","../Utilities/_ElementUtilities","../Utilities/_Hoverable","../_Accents","../Animations","../BindingList","../Promise","./Repeater","./AutoSuggestBox/_SearchSuggestionManagerShim","require-style!less/styles-autosuggestbox","require-style!less/colors-autosuggestbox"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q){"use strict";l.createAccentRule("html.win-hoverable .win-autosuggestbox .win-autosuggestbox-suggestion-selected:hover",[{name:"background-color",value:l.ColorTypes.listSelectHover}]),l.createAccentRule(".win-autosuggestbox .win-autosuggestbox-suggestion-selected",[{name:"background-color",value:l.ColorTypes.listSelectRest}]),l.createAccentRule(".win-autosuggestbox .win-autosuggestbox-suggestion-selected.win-autosuggestbox-suggestion-selected:hover:active",[{name:"background-color",value:l.ColorTypes.listSelectPress}]);var r={asb:"win-autosuggestbox",asbDisabled:"win-autosuggestbox-disabled",asbFlyout:"win-autosuggestbox-flyout",asbFlyoutAbove:"win-autosuggestbox-flyout-above",asbBoxFlyoutHighlightText:"win-autosuggestbox-flyout-highlighttext",asbHitHighlightSpan:"win-autosuggestbox-hithighlight-span",asbInput:"win-autosuggestbox-input",asbInputFocus:"win-autosuggestbox-input-focus",asbSuggestionQuery:"win-autosuggestbox-suggestion-query",asbSuggestionResult:"win-autosuggestbox-suggestion-result",asbSuggestionResultText:"win-autosuggestbox-suggestion-result-text",asbSuggestionResultDetailedText:"win-autosuggestbox-suggestion-result-detailed-text",asbSuggestionSelected:"win-autosuggestbox-suggestion-selected",asbSuggestionSeparator:"win-autosuggestbox-suggestion-separator"};d.Namespace._moduleDefine(a,"WinJS.UI",{AutoSuggestBox:d.Namespace._lazy(function(){function a(a,c,d,e){function f(a,c,d){var e=b.document.createElement("span");return e.textContent=c,e.setAttribute("aria-hidden","true"),e.classList.add(r.asbHitHighlightSpan),a.insertBefore(e,d),e}if(d){i.query("."+r.asbHitHighlightSpan,a).forEach(function(a){a.parentNode.removeChild(a)});var g=a.firstChild,h=c.hits;!h&&e&&c.kind!==q._SearchSuggestionKind.Separator&&(h=e.find(d));for(var k=x._sortAndMergeHits(h),l=0,m=0;m<k.length;m++){var n=k[m];f(a,d.substring(l,n.startPosition),g),l=n.startPosition+n.length;var o=f(a,d.substring(n.startPosition,l),g);j.addClass(o,r.asbBoxFlyoutHighlightText)}l<d.length&&f(a,d.substring(l),g)}}function k(a){var b={ctrlKey:1,altKey:2,shiftKey:4},c=0;return a.ctrlKey&&(c|=b.ctrlKey),a.altKey&&(c|=b.altKey),a.shiftKey&&(c|=b.shiftKey),c}function l(c,d){function e(a){c._internalFocusMove=!0,c._inputElement.focus(),c._processSuggestionChosen(d,a)}var f=b.document.createElement("div"),h=new b.Image;h.style.opacity=0;var i=function(a){function b(){h.removeEventListener("load",b,!1),m.fadeIn(h)}h.addEventListener("load",b,!1),h.src=a};null!==d.image?d.image.openReadAsync().then(function(a){null!==a&&i(b.URL.createObjectURL(a,{oneTimeOnly:!0}))}):null!==d.imageUrl&&i(d.imageUrl),
h.setAttribute("aria-hidden","true"),f.appendChild(h);var k=b.document.createElement("div");j.addClass(k,r.asbSuggestionResultText),a(k,d,d.text),k.title=d.text,k.setAttribute("aria-hidden","true"),f.appendChild(k);var l=b.document.createElement("br");k.appendChild(l);var n=b.document.createElement("span");j.addClass(n,r.asbSuggestionResultDetailedText),a(n,d,d.detailText),n.title=d.detailText,n.setAttribute("aria-hidden","true"),k.appendChild(n),j.addClass(f,r.asbSuggestionResult),j._addEventListener(f,"click",function(a){c._isFlyoutPointerDown||e(a)}),j._addEventListener(f,"pointerup",e),f.setAttribute("role","option");var o=g._formatString(w.ariaLabelResult,d.text,d.detailText);return f.setAttribute("aria-label",o),f}function s(c,d){function e(a){c._internalFocusMove=!0,c._inputElement.focus(),c._processSuggestionChosen(d,a)}var f=b.document.createElement("div");a(f,d,d.text),f.title=d.text,f.classList.add(r.asbSuggestionQuery),j._addEventListener(f,"click",function(a){c._isFlyoutPointerDown||e(a)}),j._addEventListener(f,"pointerup",e);var h=g._formatString(w.ariaLabelQuery,d.text);return f.setAttribute("role","option"),f.setAttribute("aria-label",h),f}function t(a){var c=b.document.createElement("div");if(a.text.length>0){var d=b.document.createElement("div");d.textContent=a.text,d.title=a.text,d.setAttribute("aria-hidden","true"),c.appendChild(d)}c.insertAdjacentHTML("beforeend","<hr/>"),j.addClass(c,r.asbSuggestionSeparator),c.setAttribute("role","separator");var e=g._formatString(w.ariaLabelSeparator,a.text);return c.setAttribute("aria-label",e),c}var u=j.Key,v={querychanged:"querychanged",querysubmitted:"querysubmitted",resultsuggestionchosen:"resultsuggestionchosen",suggestionsrequested:"suggestionsrequested"},w={get duplicateConstruction(){return"Invalid argument: Controls may only be instantiated one time for each DOM element"},get invalidSuggestionKind(){return"Error: Invalid suggestion kind."},get ariaLabel(){return g._getWinJSString("ui/autoSuggestBoxAriaLabel").value},get ariaLabelInputNoPlaceHolder(){return g._getWinJSString("ui/autoSuggestBoxAriaLabelInputNoPlaceHolder").value},get ariaLabelInputPlaceHolder(){return g._getWinJSString("ui/autoSuggestBoxAriaLabelInputPlaceHolder").value},get ariaLabelQuery(){return g._getWinJSString("ui/autoSuggestBoxAriaLabelQuery").value},get ariaLabelResult(){return g._getWinJSString("ui/autoSuggestBoxAriaLabelResult").value},get ariaLabelSeparator(){return g._getWinJSString("ui/autoSuggestBoxAriaLabelSeparator").value}},x=d.Class.define(function(a,c){if(a=a||b.document.createElement("div"),c=c||{},a.winControl)throw new e("WinJS.UI.AutoSuggestBox.DuplicateConstruction",w.duplicateConstruction);this._suggestionsChangedHandler=this._suggestionsChangedHandler.bind(this),this._suggestionsRequestedHandler=this._suggestionsRequestedHandler.bind(this),this._element=a,a.winControl=this,a.classList.add(r.asb),a.classList.add("win-disposable"),this._setupDOM(),this._setupSSM(),this._chooseSuggestionOnEnter=!1,this._currentFocusedIndex=-1,this._currentSelectedIndex=-1,this._flyoutOpenPromise=o.wrap(),this._lastKeyPressLanguage="",this._prevLinguisticDetails=this._getLinguisticDetails(),this._prevQueryText="",h.setOptions(this,c),this._hideFlyout()},{onresultsuggestionchosen:f._createEventProperty(v.resultsuggestionchosen),onquerychanged:f._createEventProperty(v.querychanged),onquerysubmitted:f._createEventProperty(v.querysubmitted),onsuggestionsrequested:f._createEventProperty(v.suggestionsrequested),element:{get:function(){return this._element}},chooseSuggestionOnEnter:{get:function(){return this._chooseSuggestionOnEnter},set:function(a){this._chooseSuggestionOnEnter=!!a}},disabled:{get:function(){return this._inputElement.disabled},set:function(a){this._inputElement.disabled!==!!a&&(a?this._disableControl():this._enableControl())}},placeholderText:{get:function(){return this._inputElement.placeholder},set:function(a){this._inputElement.placeholder=a,this._updateInputElementAriaLabel()}},queryText:{get:function(){return this._inputElement.value},set:function(a){this._inputElement.value="",this._inputElement.value=a}},searchHistoryDisabled:{get:function(){return!this._suggestionManager.searchHistoryEnabled},set:function(a){this._suggestionManager.searchHistoryEnabled=!a}},searchHistoryContext:{get:function(){return this._suggestionManager.searchHistoryContext},set:function(a){this._suggestionManager.searchHistoryContext=a}},dispose:function(){this._disposed||(this._flyoutOpenPromise.cancel(),this._suggestions.removeEventListener("vectorchanged",this._suggestionsChangedHandler),this._suggestionManager.removeEventListener("suggestionsrequested",this._suggestionsRequestedHandler),this._suggestionManager=null,this._suggestions=null,this._hitFinder=null,this._disposed=!0)},setLocalContentSuggestionSettings:function(a){this._suggestionManager.setLocalContentSuggestionSettings(a)},_setupDOM:function(){function a(a){return f._renderSuggestion(a)}var c=this._flyoutPointerReleasedHandler.bind(this),d=this._inputOrImeChangeHandler.bind(this);this._element.getAttribute("aria-label")||this._element.setAttribute("aria-label",w.ariaLabel),this._element.setAttribute("role","group"),this._inputElement=b.document.createElement("input"),this._inputElement.autocorrect="off",this._inputElement.type="search",this._inputElement.classList.add(r.asbInput),this._inputElement.classList.add("win-textbox"),this._inputElement.setAttribute("role","textbox"),this._inputElement.addEventListener("keydown",this._keyDownHandler.bind(this)),this._inputElement.addEventListener("keypress",this._keyPressHandler.bind(this)),this._inputElement.addEventListener("keyup",this._keyUpHandler.bind(this)),this._inputElement.addEventListener("focus",this._inputFocusHandler.bind(this)),this._inputElement.addEventListener("blur",this._inputBlurHandler.bind(this)),this._inputElement.addEventListener("input",d),this._inputElement.addEventListener("compositionstart",d),this._inputElement.addEventListener("compositionupdate",d),this._inputElement.addEventListener("compositionend",d),j._addEventListener(this._inputElement,"pointerdown",this._inputPointerDownHandler.bind(this)),this._updateInputElementAriaLabel(),this._element.appendChild(this._inputElement);var e=this._tryGetInputContext();e&&(e.addEventListener("MSCandidateWindowShow",this._msCandidateWindowShowHandler.bind(this)),e.addEventListener("MSCandidateWindowHide",this._msCandidateWindowHideHandler.bind(this))),this._flyoutElement=b.document.createElement("div"),this._flyoutElement.classList.add(r.asbFlyout),this._flyoutElement.addEventListener("blur",this._flyoutBlurHandler.bind(this)),j._addEventListener(this._flyoutElement,"pointerup",c),j._addEventListener(this._flyoutElement,"pointercancel",c),j._addEventListener(this._flyoutElement,"pointerout",c),j._addEventListener(this._flyoutElement,"pointerdown",this._flyoutPointerDownHandler.bind(this)),this._element.appendChild(this._flyoutElement);var f=this;this._suggestionsData=new n.List,this._repeaterElement=b.document.createElement("div"),this._repeater=new p.Repeater(this._repeaterElement,{data:this._suggestionsData,template:a}),j._ensureId(this._repeaterElement),this._repeaterElement.setAttribute("role","listbox"),this._repeaterElement.setAttribute("aria-live","polite"),this._flyoutElement.appendChild(this._repeaterElement)},_setupSSM:function(){this._suggestionManager=new q._SearchSuggestionManagerShim,this._suggestions=this._suggestionManager.suggestions,this._suggestions.addEventListener("vectorchanged",this._suggestionsChangedHandler),this._suggestionManager.addEventListener("suggestionsrequested",this._suggestionsRequestedHandler)},_hideFlyout:function(){this._isFlyoutShown()&&(this._flyoutElement.style.display="none")},_showFlyout:function(){var a=this._prevNumSuggestions||0;if(this._prevNumSuggestions=this._suggestionsData.length,(!this._isFlyoutShown()||a!==this._suggestionsData.length)&&0!==this._suggestionsData.length){this._flyoutElement.style.display="block";var c=this._inputElement.getBoundingClientRect(),d=this._flyoutElement.getBoundingClientRect(),e=b.document.documentElement.clientWidth,f=c.top,g=b.document.documentElement.clientHeight-c.bottom;this._flyoutBelowInput=g>=f,this._flyoutBelowInput?(this._flyoutElement.classList.remove(r.asbFlyoutAbove),this._flyoutElement.scrollTop=0):(this._flyoutElement.classList.add(r.asbFlyoutAbove),this._flyoutElement.scrollTop=this._flyoutElement.scrollHeight-this._flyoutElement.clientHeight),this._addFlyoutIMEPaddingIfRequired();var h;h="rtl"===j._getComputedStyle(this._flyoutElement).direction?c.right-d.width>=0||c.left+d.width>e:c.left+d.width>e&&c.right-d.width>=0,h?this._flyoutElement.style.left=c.width-d.width-this._element.clientLeft+"px":this._flyoutElement.style.left="-"+this._element.clientLeft+"px",this._flyoutElement.style.touchAction=this._flyoutElement.scrollHeight>d.height?"pan-y":"none",this._flyoutOpenPromise.cancel();var i=this._flyoutBelowInput?"WinJS-flyoutBelowASB-showPopup":"WinJS-flyoutAboveASB-showPopup";this._flyoutOpenPromise=m.showPopup(this._flyoutElement,{top:"0px",left:"0px",keyframe:i})}},_addFlyoutIMEPaddingIfRequired:function(){var a=this._tryGetInputContext();if(a&&this._isFlyoutShown()&&this._flyoutBelowInput){var b=this._flyoutElement.getBoundingClientRect(),c=a.getCandidateWindowClientRect(),d=this._inputElement.getBoundingClientRect(),e=d.bottom,f=d.bottom+b.height;if(!(c.top>f||c.bottom<e)){var g=m.createRepositionAnimation(this._flyoutElement);c.width<.45*d.width?this._flyoutElement.style.marginLeft=c.width+"px":this._flyoutElement.style.marginTop=c.bottom-c.top+4+"px",g.execute()}}},_findNextSuggestionElementIndex:function(a){for(var b=0>a?0:a+1,c=b;c<this._suggestionsData.length;c++)if(this._repeater.elementFromIndex(c)&&this._isSuggestionSelectable(this._suggestionsData.getAt(c)))return c;return-1},_findPreviousSuggestionElementIndex:function(a){for(var b=a>=this._suggestionsData.length?this._suggestionsData.length-1:a-1,c=b;c>=0;c--)if(this._repeater.elementFromIndex(c)&&this._isSuggestionSelectable(this._suggestionsData.getAt(c)))return c;return-1},_isFlyoutShown:function(){return"none"!==this._flyoutElement.style.display},_isSuggestionSelectable:function(a){return a.kind===q._SearchSuggestionKind.Query||a.kind===q._SearchSuggestionKind.Result},_processSuggestionChosen:function(a,b){this.queryText=a.text,a.kind===q._SearchSuggestionKind.Query?this._submitQuery(a.text,!1,b):a.kind===q._SearchSuggestionKind.Result&&this._fireEvent(v.resultsuggestionchosen,{tag:a.tag,keyModifiers:k(b),storageFile:null}),this._hideFlyout()},_selectSuggestionAtIndex:function(a){function b(a){var b=c._flyoutElement.getBoundingClientRect().bottom-c._flyoutElement.getBoundingClientRect().top;if(a.offsetTop+a.offsetHeight>c._flyoutElement.scrollTop+b){var d=a.offsetTop+a.offsetHeight-(c._flyoutElement.scrollTop+b);j._zoomTo(c._flyoutElement,{contentX:0,contentY:c._flyoutElement.scrollTop+d,viewportX:0,viewportY:0})}else a.offsetTop<c._flyoutElement.scrollTop&&j._zoomTo(c._flyoutElement,{contentX:0,contentY:a.offsetTop,viewportX:0,viewportY:0})}for(var c=this,d=null,e=0;e<this._suggestionsData.length;e++)d=this._repeater.elementFromIndex(e),e!==a?(d.classList.remove(r.asbSuggestionSelected),d.setAttribute("aria-selected","false")):(d.classList.add(r.asbSuggestionSelected),b(d),d.setAttribute("aria-selected","true"));this._currentSelectedIndex=a,d?this._inputElement.setAttribute("aria-activedescendant",this._repeaterElement.id+a):this._inputElement.hasAttribute("aria-activedescendant")&&this._inputElement.removeAttribute("aria-activedescendant")},_updateFakeFocus:function(){var a;a=this._isFlyoutShown()&&this._chooseSuggestionOnEnter?this._findNextSuggestionElementIndex(-1):-1,this._selectSuggestionAtIndex(a)},_updateQueryTextWithSuggestionText:function(a){a>=0&&a<this._suggestionsData.length&&(this.queryText=this._suggestionsData.getAt(a).text)},_disableControl:function(){this._isFlyoutShown()&&this._hideFlyout(),this._element.disabled=!0,this._element.classList.add(r.asbDisabled),this._inputElement.disabled=!0},_enableControl:function(){this._element.disabled=!1,this._element.classList.remove(r.asbDisabled),this._inputElement.disabled=!1,b.document.activeElement===this._element&&j._setActive(this._inputElement)},_fireEvent:function(a,c){var d=b.document.createEvent("CustomEvent");return d.initCustomEvent(a,!0,!0,c),this._element.dispatchEvent(d)},_getLinguisticDetails:function(a,b){function d(a,b,d,e,f){for(var g=null,h=[],i=0;i<a.length;i++)h[i]=e+a[i]+f;if(c.Windows.ApplicationModel.Search.SearchQueryLinguisticDetails)try{g=new c.Windows.ApplicationModel.Search.SearchQueryLinguisticDetails(h,b,d)}catch(j){}return g||(g={queryTextAlternatives:h,queryTextCompositionStart:b,queryTextCompositionLength:d}),g}var e=null;if(this._inputElement.value===this._prevQueryText&&a&&this._prevLinguisticDetails&&b)e=this._prevLinguisticDetails;else{var f=[],g=0,h=0,i="",j="";if(b){var k=this._tryGetInputContext();k&&k.getCompositionAlternatives&&(f=k.getCompositionAlternatives(),g=k.compositionStartOffset,h=k.compositionEndOffset-k.compositionStartOffset,this._inputElement.value!==this._prevQueryText||0===this._prevCompositionLength||h>0?(i=this._inputElement.value.substring(0,g),j=this._inputElement.value.substring(g+h)):(i=this._inputElement.value.substring(0,this._prevCompositionStart),j=this._inputElement.value.substring(this._prevCompositionStart+this._prevCompositionLength)))}e=d(f,g,h,i,j)}return e},_isElementInSearchControl:function(a){return this.element.contains(a)||this.element===a},_renderSuggestion:function(a){var b=null;if(!a)return b;if(a.kind===q._SearchSuggestionKind.Query)b=s(this,a);else if(a.kind===q._SearchSuggestionKind.Separator)b=t(a);else{if(a.kind!==q._SearchSuggestionKind.Result)throw new e("WinJS.UI.AutoSuggestBox.invalidSuggestionKind",w.invalidSuggestionKind);b=l(this,a)}return b},_shouldIgnoreInput:function(){var a=this._isProcessingDownKey||this._isProcessingUpKey||this._isProcessingTabKey||this._isProcessingEnterKey;return a||this._isFlyoutPointerDown},_submitQuery:function(a,b,d){this._disposed||(c.Windows.Globalization.Language&&(this._lastKeyPressLanguage=c.Windows.Globalization.Language.currentInputMethodLanguageTag),this._fireEvent(v.querysubmitted,{language:this._lastKeyPressLanguage,linguisticDetails:this._getLinguisticDetails(!0,b),queryText:a,keyModifiers:k(d)}),this._suggestionManager&&this._suggestionManager.addToHistory(this._inputElement.value,this._lastKeyPressLanguage))},_tryGetInputContext:function(){if(this._inputElement.msGetInputContext)try{return this._inputElement.msGetInputContext()}catch(a){return null}return null},_updateInputElementAriaLabel:function(){this._inputElement.setAttribute("aria-label",this._inputElement.placeholder?g._formatString(w.ariaLabelInputPlaceHolder,this._inputElement.placeholder):w.ariaLabelInputNoPlaceHolder)},_flyoutBlurHandler:function(a){this._isElementInSearchControl(b.document.activeElement)?this._internalFocusMove=!0:(this._element.classList.remove(r.asbInputFocus),this._hideFlyout())},_flyoutPointerDownHandler:function(a){function b(){if(d)for(var a=0;a<c._suggestionsData.length;a++)if(c._repeater.elementFromIndex(a)===d)return a;return-1}var c=this,d=a.target;for(this._isFlyoutPointerDown=!0;d&&d.parentNode!==this._repeaterElement;)d=d.parentNode;var e=b();e>=0&&e<this._suggestionsData.length&&this._currentFocusedIndex!==e&&this._isSuggestionSelectable(this._suggestionsData.getAt(e))&&(this._currentFocusedIndex=e,this._selectSuggestionAtIndex(e),this._updateQueryTextWithSuggestionText(this._currentFocusedIndex)),a.preventDefault()},_flyoutPointerReleasedHandler:function(){if(this._isFlyoutPointerDown=!1,this._reflowImeOnPointerRelease){this._reflowImeOnPointerRelease=!1;var a=m.createRepositionAnimation(this._flyoutElement);this._flyoutElement.style.marginTop="",this._flyoutElement.style.marginLeft="",a.execute()}},_inputBlurHandler:function(a){this._isElementInSearchControl(b.document.activeElement)||(this._element.classList.remove(r.asbInputFocus),this._hideFlyout()),this.queryText=this._prevQueryText,this._isProcessingDownKey=!1,this._isProcessingUpKey=!1,this._isProcessingTabKey=!1,this._isProcessingEnterKey=!1},_inputFocusHandler:function(a){this._inputElement.value!==this._prevQueryText&&c.Windows.Data.Text.SemanticTextQuery&&(""!==this._inputElement.value?this._hitFinder=new c.Windows.Data.Text.SemanticTextQuery(this._inputElement.value,this._inputElement.lang):this._hitFinder=null),a.target!==this._inputElement||this._internalFocusMove||(this._showFlyout(),-1!==this._currentFocusedIndex?this._selectSuggestionAtIndex(this._currentFocusedIndex):this._updateFakeFocus(),this._suggestionManager.setQuery(this._inputElement.value,this._lastKeyPressLanguage,this._getLinguisticDetails(!0,!0))),this._internalFocusMove=!1,this._element.classList.add(r.asbInputFocus)},_inputOrImeChangeHandler:function(){function a(a){var c=!1;return(b._prevLinguisticDetails.queryTextCompositionStart!==a.queryTextCompositionStart||b._prevLinguisticDetails.queryTextCompositionLength!==a.queryTextCompositionLength||b._prevLinguisticDetails.queryTextAlternatives.length!==a.queryTextAlternatives.length)&&(c=!0),b._prevLinguisticDetails=a,c}var b=this;if(!this._shouldIgnoreInput()){var d=this._getLinguisticDetails(!1,!0),a=a(d);if((this._inputElement.value!==this._prevQueryText||0===this._prevCompositionLength||d.queryTextCompositionLength>0)&&(this._prevCompositionStart=d.queryTextCompositionStart,this._prevCompositionLength=d.queryTextCompositionLength),this._prevQueryText===this._inputElement.value&&!a)return;this._prevQueryText=this._inputElement.value,c.Windows.Globalization.Language&&(this._lastKeyPressLanguage=c.Windows.Globalization.Language.currentInputMethodLanguageTag),c.Windows.Data.Text.SemanticTextQuery&&(""!==this._inputElement.value?this._hitFinder=new c.Windows.Data.Text.SemanticTextQuery(this._inputElement.value,this._lastKeyPressLanguage):this._hitFinder=null),this._fireEvent(v.querychanged,{language:this._lastKeyPressLanguage,queryText:this._inputElement.value,linguisticDetails:d}),this._suggestionManager.setQuery(this._inputElement.value,this._lastKeyPressLanguage,d)}},_inputPointerDownHandler:function(){b.document.activeElement===this._inputElement&&-1!==this._currentSelectedIndex&&(this._currentFocusedIndex=-1,this._selectSuggestionAtIndex(this._currentFocusedIndex))},_keyDownHandler:function(a){function b(b){c._currentFocusedIndex=b,c._selectSuggestionAtIndex(b),a.preventDefault(),a.stopPropagation()}var c=this;if(this._lastKeyPressLanguage=a.locale,a.keyCode===u.tab?this._isProcessingTabKey=!0:a.keyCode===u.upArrow?this._isProcessingUpKey=!0:a.keyCode===u.downArrow?this._isProcessingDownKey=!0:a.keyCode===u.enter&&"ko"===a.locale&&(this._isProcessingEnterKey=!0),a.keyCode!==u.IME)if(a.keyCode===u.tab){var d=!0;a.shiftKey?-1!==this._currentFocusedIndex&&(b(-1),d=!1):-1===this._currentFocusedIndex&&(this._currentFocusedIndex=this._flyoutBelowInput?this._findNextSuggestionElementIndex(this._currentFocusedIndex):this._findPreviousSuggestionElementIndex(this._suggestionsData.length),-1!==this._currentFocusedIndex&&(b(this._currentFocusedIndex),this._updateQueryTextWithSuggestionText(this._currentFocusedIndex),d=!1)),d&&this._hideFlyout()}else if(a.keyCode===u.escape)-1!==this._currentFocusedIndex?(this.queryText=this._prevQueryText,b(-1)):""!==this.queryText&&(this.queryText="",this._inputOrImeChangeHandler(null),a.preventDefault(),a.stopPropagation());else if(this._flyoutBelowInput&&a.keyCode===u.upArrow||!this._flyoutBelowInput&&a.keyCode===u.downArrow){var e;-1!==this._currentSelectedIndex?(e=this._findPreviousSuggestionElementIndex(this._currentSelectedIndex),-1===e&&(this.queryText=this._prevQueryText)):e=this._findPreviousSuggestionElementIndex(this._suggestionsData.length),b(e),this._updateQueryTextWithSuggestionText(this._currentFocusedIndex)}else if(this._flyoutBelowInput&&a.keyCode===u.downArrow||!this._flyoutBelowInput&&a.keyCode===u.upArrow){var f=this._findNextSuggestionElementIndex(this._currentSelectedIndex);-1!==this._currentSelectedIndex&&-1===f&&(this.queryText=this._prevQueryText),b(f),this._updateQueryTextWithSuggestionText(this._currentFocusedIndex)}else a.keyCode===u.enter&&(-1===this._currentSelectedIndex?this._submitQuery(this._inputElement.value,!0,a):this._processSuggestionChosen(this._suggestionsData.getAt(this._currentSelectedIndex),a),this._hideFlyout())},_keyUpHandler:function(a){a.keyCode===u.tab?this._isProcessingTabKey=!1:a.keyCode===u.upArrow?this._isProcessingUpKey=!1:a.keyCode===u.downArrow?this._isProcessingDownKey=!1:a.keyCode===u.enter&&(this._isProcessingEnterKey=!1)},_keyPressHandler:function(a){this._lastKeyPressLanguage=a.locale},_msCandidateWindowHideHandler:function(){if(this._isFlyoutPointerDown)this._reflowImeOnPointerRelease=!0;else{var a=m.createRepositionAnimation(this._flyoutElement);this._flyoutElement.style.marginTop="",this._flyoutElement.style.marginLeft="",a.execute()}},_msCandidateWindowShowHandler:function(){this._addFlyoutIMEPaddingIfRequired(),this._reflowImeOnPointerRelease=!1},_suggestionsChangedHandler:function(c){var d=c.collectionChange||c.detail.collectionChange,e=+c.index===c.index?c.index:c.detail.index,f=q._CollectionChange;if(d===f.reset)this._isFlyoutShown()&&this._hideFlyout(),this._suggestionsData.splice(0,this._suggestionsData.length);else if(d===f.itemInserted){var g=this._suggestions[e];this._suggestionsData.splice(e,0,g),this._showFlyout()}else if(d===f.itemRemoved)1===this._suggestionsData.length&&(j._setActive(this._inputElement),this._hideFlyout()),this._suggestionsData.splice(e,1);else if(d===f.itemChanged){var g=this._suggestions[e];if(g!==this._suggestionsData.getAt(e))this._suggestionsData.setAt(e,g);else{var h=this._repeater.elementFromIndex(e);if(j.hasClass(h,r.asbSuggestionQuery))a(h,g,g.text);else{var i=h.querySelector("."+r.asbSuggestionResultText);if(i){a(i,g,g.text);var k=h.querySelector("."+r.asbSuggestionResultDetailedText);k&&a(k,g,g.detailText)}}}}b.document.activeElement===this._inputElement&&this._updateFakeFocus()},_suggestionsRequestedHandler:function(a){c.Windows.Globalization.Language&&(this._lastKeyPressLanguage=c.Windows.Globalization.Language.currentInputMethodLanguageTag);var b,d=a.request||a.detail.request;this._fireEvent(v.suggestionsrequested,{setPromise:function(a){b=d.getDeferral(),a.then(function(){b.complete()})},searchSuggestionCollection:d.searchSuggestionCollection,language:this._lastKeyPressLanguage,linguisticDetails:this._getLinguisticDetails(!0,!0),queryText:this._inputElement.value})}},{createResultSuggestionImage:function(a){return c.Windows.Foundation.Uri&&c.Windows.Storage.Streams.RandomAccessStreamReference?c.Windows.Storage.Streams.RandomAccessStreamReference.createFromUri(new c.Windows.Foundation.Uri(a)):a},_EventNames:v,_sortAndMergeHits:function(a){function b(a,b){var c=0;return a.startPosition<b.startPosition?c=-1:a.startPosition>b.startPosition&&(c=1),c}function c(a,b,c){if(0===c)a.push(b);else{var d=a[a.length-1],e=d.startPosition+d.length;if(b.startPosition<=e){var f=b.startPosition+b.length;f>e&&(d.length=f-d.startPosition)}else a.push(b)}return a}var d=[];if(a){for(var e=new Array(a.length),f=0;f<a.length;f++)e.push({startPosition:a[f].startPosition,length:a[f].length});e.sort(b),e.reduce(c,d)}return d}});return d.Class.mix(x,h.DOMEventMixin),x})}),a.ClassNames=r}),d("require-style!less/styles-searchbox",[],function(){}),d("require-style!less/colors-searchbox",[],function(){}),d("WinJS/Controls/SearchBox",["../Core/_Global","../Core/_WinRT","../Core/_Base","../Core/_ErrorFromName","../Core/_Events","../Core/_Resources","./AutoSuggestBox","../_Accents","../Utilities/_Control","../Utilities/_ElementUtilities","./AutoSuggestBox/_SearchSuggestionManagerShim","../Application","require-style!less/styles-searchbox","require-style!less/colors-searchbox"],function(a,b,c,d,e,f,g,h,i,j,k,l){"use strict";h.createAccentRule("html.win-hoverable .win-searchbox-button:not(.win-searchbox-button-disabled):hover",[{name:"color",value:h.ColorTypes.accent}]),h.createAccentRule(".win-searchbox-button.win-searchbox-button:not(.win-searchbox-button-disabled):hover:active",[{name:"background-color",value:h.ColorTypes.accent}]),c.Namespace.define("WinJS.UI",{SearchBox:c.Namespace._lazy(function(){var d={searchBox:"win-searchbox",searchBoxDisabled:"win-searchbox-disabled",searchBoxInput:"win-searchbox-input",searchBoxInputFocus:"win-searchbox-input-focus",searchBoxButton:"win-searchbox-button",searchBoxFlyout:"win-searchbox-flyout",searchBoxFlyoutHighlightText:"win-searchbox-flyout-highlighttext",searchBoxHitHighlightSpan:"win-searchbox-hithighlight-span",searchBoxSuggestionResult:"win-searchbox-suggestion-result",searchBoxSuggestionResultText:"win-searchbox-suggestion-result-text",searchBoxSuggestionResultDetailedText:"win-searchbox-suggestion-result-detailed-text",searchBoxSuggestionSelected:"win-searchbox-suggestion-selected",searchBoxSuggestionQuery:"win-searchbox-suggestion-query",searchBoxSuggestionSeparator:"win-searchbox-suggestion-separator",searchBoxButtonInputFocus:"win-searchbox-button-input-focus",searchBoxButtonDisabled:"win-searchbox-button-disabled"},e={receivingfocusonkeyboardinput:"receivingfocusonkeyboardinput"},h={get invalidSearchBoxSuggestionKind(){return"Error: Invalid search suggestion kind."},get ariaLabel(){return f._getWinJSString("ui/searchBoxAriaLabel").value},get ariaLabelInputNoPlaceHolder(){return f._getWinJSString("ui/searchBoxAriaLabelInputNoPlaceHolder").value},get ariaLabelInputPlaceHolder(){return f._getWinJSString("ui/searchBoxAriaLabelInputPlaceHolder").value},get searchBoxDeprecated(){return"SearchBox is deprecated and may not be available in future releases. Instead use AutoSuggestBox."}},m=c.Class.derive(g.AutoSuggestBox,function(b,c){j._deprecated(h.searchBoxDeprecated),this._requestingFocusOnKeyboardInputHandlerBind=this._requestingFocusOnKeyboardInputHandler.bind(this),this._buttonElement=a.document.createElement("div"),this._focusOnKeyboardInput=!1,g.AutoSuggestBox.call(this,b,c),this.element.classList.add(d.searchBox),this._flyoutElement.classList.add(d.searchBoxFlyout),this._inputElement.classList.add(d.searchBoxInput),this._inputElement.addEventListener("blur",this._searchboxInputBlurHandler.bind(this)),this._inputElement.addEventListener("focus",this._searchboxInputFocusHandler.bind(this)),this._buttonElement.tabIndex=-1,this._buttonElement.classList.add(d.searchBoxButton),this._buttonElement.addEventListener("click",this._buttonClickHandler.bind(this)),j._addEventListener(this._buttonElement,"pointerdown",this._buttonPointerDownHandler.bind(this)),this.element.appendChild(this._buttonElement)},{focusOnKeyboardInput:{get:function(){return this._focusOnKeyboardInput},set:function(a){this._focusOnKeyboardInput&&!a?l._applicationListener.removeEventListener(this.element,"requestingfocusonkeyboardinput",this._requestingFocusOnKeyboardInputHandlerBind):!this._focusOnKeyboardInput&&a&&l._applicationListener.addEventListener(this.element,"requestingfocusonkeyboardinput",this._requestingFocusOnKeyboardInputHandlerBind),this._focusOnKeyboardInput=!!a}},dispose:function(){this._disposed||(g.AutoSuggestBox.prototype.dispose.call(this),this._focusOnKeyboardInput&&l._applicationListener.removeEventListener(this.element,"requestingfocusonkeyboardinput",this._requestingFocusOnKeyboardInputHandlerBind))},_disableControl:function(){g.AutoSuggestBox.prototype._disableControl.call(this),this._buttonElement.disabled=!0,this._buttonElement.classList.add(d.searchBoxButtonDisabled),this.element.classList.add(d.searchBoxDisabled)},_enableControl:function(){g.AutoSuggestBox.prototype._enableControl.call(this),this._buttonElement.disabled=!1,this._buttonElement.classList.remove(d.searchBoxButtonDisabled),this.element.classList.remove(d.searchBoxDisabled)},_renderSuggestion:function(a){var b=g.AutoSuggestBox.prototype._renderSuggestion.call(this,a);if(a.kind===k._SearchSuggestionKind.Query)b.classList.add(d.searchBoxSuggestionQuery);else if(a.kind===k._SearchSuggestionKind.Separator)b.classList.add(d.searchBoxSuggestionSeparator);else{b.classList.add(d.searchBoxSuggestionResult);var c=b.querySelector("."+g.ClassNames.asbSuggestionResultText);c.classList.add(d.searchBoxSuggestionResultText);var e=b.querySelector("."+g.ClassNames.asbSuggestionResultDetailedText);e.classList.add(d.searchBoxSuggestionResultDetailedText);for(var f=b.querySelectorAll("."+g.ClassNames.asbHitHighlightSpan),h=0,i=f.length;i>h;h++)f[h].classList.add(d.searchBoxHitHighlightSpan);for(var j=b.querySelectorAll("."+g.ClassNames.asbBoxFlyoutHighlightText),h=0,i=j.length;i>h;h++)j[h].classList.add(d.searchBoxFlyoutHighlightText)}return b},_selectSuggestionAtIndex:function(a){g.AutoSuggestBox.prototype._selectSuggestionAtIndex.call(this,a);var b=this.element.querySelector("."+d.searchBoxSuggestionSelected);b&&b.classList.remove(d.searchBoxSuggestionSelected);var c=this.element.querySelector("."+g.ClassNames.asbSuggestionSelected);c&&c.classList.add(d.searchBoxSuggestionSelected)},_shouldIgnoreInput:function(){var a=g.AutoSuggestBox.prototype._shouldIgnoreInput(),b=j._matchesSelector(this._buttonElement,":active");return a||b},_updateInputElementAriaLabel:function(){this._inputElement.setAttribute("aria-label",this._inputElement.placeholder?f._formatString(h.ariaLabelInputPlaceHolder,this._inputElement.placeholder):h.ariaLabelInputNoPlaceHolder)},_buttonPointerDownHandler:function(a){this._inputElement.focus(),a.preventDefault()},_buttonClickHandler:function(a){this._inputElement.focus(),this._submitQuery(this._inputElement.value,!0,a),this._hideFlyout()},_searchboxInputBlurHandler:function(){j.removeClass(this.element,d.searchBoxInputFocus),j.removeClass(this._buttonElement,d.searchBoxButtonInputFocus)},_searchboxInputFocusHandler:function(){j.addClass(this.element,d.searchBoxInputFocus),j.addClass(this._buttonElement,d.searchBoxButtonInputFocus)},_requestingFocusOnKeyboardInputHandler:function(){if(this._fireEvent(e.receivingfocusonkeyboardinput,null),a.document.activeElement!==this._inputElement)try{this._inputElement.focus()}catch(b){}}},{createResultSuggestionImage:function(a){return j._deprecated(h.searchBoxDeprecated),b.Windows.Foundation.Uri&&b.Windows.Storage.Streams.RandomAccessStreamReference?b.Windows.Storage.Streams.RandomAccessStreamReference.createFromUri(new b.Windows.Foundation.Uri(a)):a},_getKeyModifiers:function(a){var b={ctrlKey:1,altKey:2,shiftKey:4},c=0;return a.ctrlKey&&(c|=b.ctrlKey),a.altKey&&(c|=b.altKey),a.shiftKey&&(c|=b.shiftKey),c},_isTypeToSearchKey:function(a){return a.shiftKey||a.ctrlKey||a.altKey?!1:!0}});return c.Class.mix(m,i.DOMEventMixin),m})})}),d("WinJS/Controls/SettingsFlyout",["../Core/_Global","../Core/_WinRT","../Core/_Base","../Core/_BaseUtils","../Core/_ErrorFromName","../Core/_Events","../Core/_Resources","../Core/_WriteProfilerMark","../Animations","../Pages","../Promise","../_LightDismissService","../Utilities/_Dispose","../Utilities/_ElementUtilities","../Utilities/_ElementListUtilities","../Utilities/_Hoverable","./_LegacyAppBar/_Constants","./Flyout/_Overlay"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r){"use strict";c.Namespace.define("WinJS.UI",{SettingsFlyout:c.Namespace._lazy(function(){function d(){if(b.Windows.UI.ApplicationSettings.SettingsEdgeLocation){var a=b.Windows.UI.ApplicationSettings;return a.SettingsPane.edge===a.SettingsEdgeLocation.left}return!1}function p(a,b){for(var c,d,e=a.querySelectorAll("."+q.settingsFlyoutClass),f=0;f<e.length;f++)if(d=e[f].winControl){if(d.settingsCommandId===b){c=d;break}e[f].id===b&&(c=c||d)}return c}var s,t=n.Key,u=f._createEventProperty,v="narrow",w="wide",x=c.Class.derive(r._Overlay,function(b,c){n._deprecated(z.settingsFlyoutIsDeprecated),this._element=b||a.document.createElement("div"),this._id=this._element.id||n._uniqueID(this._element),this._writeProfilerMark("constructor,StartTM"),
this._baseOverlayConstructor(this._element,c),this._addFirstDiv(),this._addFinalDiv(),this._element.addEventListener("keydown",this._handleKeyDown,!0),this._element.style.visibilty="hidden",this._element.style.display="none",n.addClass(this._element,q.settingsFlyoutClass);var d=this;this._dismissable=new l.LightDismissableElement({element:this._element,tabIndex:this._element.hasAttribute("tabIndex")?this._element.tabIndex:-1,onLightDismiss:function(){d.hide()},onTakeFocus:function(a){if(!d._dismissable.restoreFocus()){var b=d.element.querySelector("."+q.firstDivClass);b&&(b.msSettingsFlyoutFocusOut||(n._addEventListener(b,"focusout",function(){s=1},!1),b.msSettingsFlyoutFocusOut=!0),s=0,n._tryFocus(b,a))}}}),o.query("div.win-content",this._element).forEach(function(a){n._matchesSelector(a,".win-ui-dark, .win-ui-dark *")||n.addClass(a,q.flyoutLightClass)});var e=this._element.getAttribute("role");(null===e||""===e||void 0===e)&&this._element.setAttribute("role","dialog");var f=this._element.getAttribute("aria-label");(null===f||""===f||void 0===f)&&this._element.setAttribute("aria-label",z.ariaLabel),this._currentAnimateIn=this._animateSlideIn,this._currentAnimateOut=this._animateSlideOut,this._writeProfilerMark("constructor,StopTM")},{width:{get:function(){return this._width},set:function(a){n._deprecated(z.widthDeprecationMessage),a!==this._width&&(this._width===v?n.removeClass(this._element,q.narrowClass):this._width===w&&n.removeClass(this._element,q.wideClass),this._width=a,this._width===v?n.addClass(this._element,q.narrowClass):this._width===w&&n.addClass(this._element,q.wideClass))}},settingsCommandId:{get:function(){return this._settingsCommandId},set:function(a){this._settingsCommandId=a}},disabled:{get:function(){return!!this._element.disabled},set:function(a){a=!!a;var b=!!this._element.disabled;b!==a&&(this._element.disabled=a,!this.hidden&&this._element.disabled&&this._dismiss())}},onbeforeshow:u(r._Overlay.beforeShow),onaftershow:u(r._Overlay.afterShow),onbeforehide:u(r._Overlay.beforeHide),onafterhide:u(r._Overlay.afterHide),show:function(){this.disabled||(this._writeProfilerMark("show,StartTM"),this._show())},_dispose:function(){l.hidden(this._dismissable),m.disposeSubTree(this.element),this._dismiss()},_show:function(){if(this._baseShow()){if(!n.hasClass(this.element.children[0],q.firstDivClass)){var a=this.element.querySelectorAll("."+q.firstDivClass);a&&a.length>0&&a.item(0).parentNode.removeChild(a.item(0)),this._addFirstDiv()}if(!n.hasClass(this.element.children[this.element.children.length-1],q.finalDivClass)){var b=this.element.querySelectorAll("."+q.finalDivClass);b&&b.length>0&&b.item(0).parentNode.removeChild(b.item(0)),this._addFinalDiv()}this._setBackButtonsAriaLabel(),l.shown(this._dismissable)}},_setBackButtonsAriaLabel:function(){for(var a,b=this.element.querySelectorAll(".win-backbutton"),c=0;c<b.length;c++)a=b[c].getAttribute("aria-label"),(null===a||""===a||void 0===a)&&b[c].setAttribute("aria-label",z.backbuttonAriaLabel)},hide:function(){this._writeProfilerMark("hide,StartTM"),this._hide()},_hide:function(){this._baseHide()},_beforeEndHide:function(){l.hidden(this._dismissable)},_animateSlideIn:function(){var a=d(),b=a?"-100px":"100px";o.query("div.win-content",this._element).forEach(function(a){i.enterPage(a,{left:b})});var c,e=this._element.offsetWidth;return a?(c={top:"0px",left:"-"+e+"px"},this._element.style.right="auto",this._element.style.left="0px"):(c={top:"0px",left:e+"px"},this._element.style.right="0px",this._element.style.left="auto"),this._element.style.opacity=1,this._element.style.visibility="visible",i.showPanel(this._element,c)},_animateSlideOut:function(){var a,b=this._element.offsetWidth;return d()?(a={top:"0px",left:b+"px"},this._element.style.right="auto",this._element.style.left="-"+b+"px"):(a={top:"0px",left:"-"+b+"px"},this._element.style.right="-"+b+"px",this._element.style.left="auto"),i.showPanel(this._element,a)},_fragmentDiv:{get:function(){return this._fragDiv},set:function(a){this._fragDiv=a}},_unloadPage:function(b){var c=b.currentTarget.winControl;c.removeEventListener(r._Overlay.afterHide,this._unloadPage,!1),k.as().then(function(){c._fragmentDiv&&(a.document.body.removeChild(c._fragmentDiv),c._fragmentDiv=null)})},_dismiss:function(){this.addEventListener(r._Overlay.afterHide,this._unloadPage,!1),this._hide()},_handleKeyDown:function(b){if(b.keyCode!==t.space&&b.keyCode!==t.enter||this.children[0]!==a.document.activeElement){if(b.shiftKey&&b.keyCode===t.tab&&this.children[0]===a.document.activeElement){b.preventDefault(),b.stopPropagation();for(var c=this.getElementsByTagName("*"),d=c.length-2;d>=0&&(c[d].focus(),c[d]!==a.document.activeElement);d--);}}else b.preventDefault(),b.stopPropagation(),this.winControl._dismiss()},_focusOnLastFocusableElementFromParent:function(){var b=a.document.activeElement;if(s&&b&&n.hasClass(b,q.firstDivClass)){var c=this.parentElement.getElementsByTagName("*");if(!(c.length<=2)){var d,e=c[c.length-1].tabIndex;if(e){for(d=c.length-2;d>0;d--)if(c[d].tabIndex===e){c[d].focus();break}}else for(d=c.length-2;d>0&&("DIV"===c[d].tagName&&null===c[d].getAttribute("tabIndex")||(c[d].focus(),c[d]!==a.document.activeElement));d--);}}},_focusOnFirstFocusableElementFromParent:function(){var b=a.document.activeElement;if(b&&n.hasClass(b,q.finalDivClass)){var c=this.parentElement.getElementsByTagName("*");if(!(c.length<=2)){var d,e=c[0].tabIndex;if(e){for(d=1;d<c.length-1;d++)if(c[d].tabIndex===e){c[d].focus();break}}else for(d=1;d<c.length-1&&("DIV"===c[d].tagName&&null===c[d].getAttribute("tabIndex")||(c[d].focus(),c[d]!==a.document.activeElement));d++);}}},_addFirstDiv:function(){for(var b=this._element.getElementsByTagName("*"),c=0,d=0;d<b.length;d++)0<b[d].tabIndex&&(0===c||b[d].tabIndex<c)&&(c=b[d].tabIndex);var e=a.document.createElement("div");e.className=q.firstDivClass,e.style.display="inline",e.setAttribute("role","menuitem"),e.setAttribute("aria-hidden","true"),e.tabIndex=c,n._addEventListener(e,"focusin",this._focusOnLastFocusableElementFromParent,!1),this._element.children[0]?this._element.insertBefore(e,this._element.children[0]):this._element.appendChild(e)},_addFinalDiv:function(){for(var b=this._element.getElementsByTagName("*"),c=0,d=0;d<b.length;d++)b[d].tabIndex>c&&(c=b[d].tabIndex);var e=a.document.createElement("div");e.className=q.finalDivClass,e.style.display="inline",e.setAttribute("role","menuitem"),e.setAttribute("aria-hidden","true"),e.tabIndex=c,n._addEventListener(e,"focusin",this._focusOnFirstFocusableElementFromParent,!1),this._element.appendChild(e)},_writeProfilerMark:function(a){h("WinJS.UI.SettingsFlyout:"+this._id+":"+a)}});x.show=function(){b.Windows.UI.ApplicationSettings.SettingsPane&&b.Windows.UI.ApplicationSettings.SettingsPane.show();for(var c=a.document.querySelectorAll('div[data-win-control="WinJS.UI.SettingsFlyout"]'),d=c.length,e=0;d>e;e++){var f=c[e].winControl;f&&f._dismiss()}};var y={event:void 0};x.populateSettings=function(a){if(y.event=a.detail,y.event.applicationcommands){var c=b.Windows.UI.ApplicationSettings;Object.keys(y.event.applicationcommands).forEach(function(a){var b=y.event.applicationcommands[a];b.title||(b.title=a);var d=new c.SettingsCommand(a,b.title,x._onSettingsCommand);y.event.e.request.applicationCommands.append(d)})}},x._onSettingsCommand=function(a){var b=a.id;y.event.applicationcommands&&y.event.applicationcommands[b]&&x.showSettings(b,y.event.applicationcommands[b].href)},x.showSettings=function(b,c){var d=p(a.document,b);if(d)d.show();else{if(!c)throw new e("WinJS.UI.SettingsFlyout.BadReference",z.badReference);var f=a.document.createElement("div");f=a.document.body.appendChild(f),j.render(c,f).then(function(){d=p(f,b),d?(d._fragmentDiv=f,d.show()):a.document.body.removeChild(f)})}};var z={get ariaLabel(){return g._getWinJSString("ui/settingsFlyoutAriaLabel").value},get badReference(){return"Invalid argument: Invalid href to settings flyout fragment"},get backbuttonAriaLabel(){return g._getWinJSString("ui/backbuttonarialabel").value},get widthDeprecationMessage(){return"SettingsFlyout.width may be altered or unavailable in future versions. Instead, style the CSS width property on elements with the .win-settingsflyout class."},get settingsFlyoutIsDeprecated(){return"SettingsFlyout is deprecated and may not be available in future releases. Instead, put settings on their own page within the app."}};return x})})}),d("require-style!less/styles-splitviewcommand",[],function(){}),d("require-style!less/colors-splitviewcommand",[],function(){}),d("WinJS/Controls/SplitView/Command",["exports","../../Core/_Global","../../Core/_Base","../../Core/_ErrorFromName","../../Core/_Events","../../ControlProcessor","../../Utilities/_Control","../../Utilities/_ElementUtilities","../../Utilities/_KeyboardBehavior","../AppBar/_Icon","require-style!less/styles-splitviewcommand","require-style!less/colors-splitviewcommand"],function(a,b,c,d,e,f,g,h,i,j){"use strict";c.Namespace._moduleDefine(a,"WinJS.UI",{_WinPressed:c.Namespace._lazy(function(){var a=c.Class.define(function(a){this._element=a,h._addEventListener(this._element,"pointerdown",this._MSPointerDownButtonHandler.bind(this))},{_MSPointerDownButtonHandler:function(c){this._pointerUpBound||(this._pointerUpBound=this._MSPointerUpHandler.bind(this),this._pointerCancelBound=this._MSPointerCancelHandler.bind(this),this._pointerOverBound=this._MSPointerOverHandler.bind(this),this._pointerOutBound=this._MSPointerOutHandler.bind(this)),c.isPrimary&&(this._pointerId&&this._resetPointer(),h._matchesSelector(c.target,".win-interactive, .win-interactive *")||(this._pointerId=c.pointerId,h._addEventListener(b,"pointerup",this._pointerUpBound,!0),h._addEventListener(b,"pointercancel",this._pointerCancelBound),!0,h._addEventListener(this._element,"pointerover",this._pointerOverBound,!0),h._addEventListener(this._element,"pointerout",this._pointerOutBound,!0),h.addClass(this._element,a.winPressed)))},_MSPointerOverHandler:function(b){this._pointerId===b.pointerId&&h.addClass(this._element,a.winPressed)},_MSPointerOutHandler:function(b){this._pointerId===b.pointerId&&h.removeClass(this._element,a.winPressed)},_MSPointerCancelHandler:function(a){this._pointerId===a.pointerId&&this._resetPointer()},_MSPointerUpHandler:function(a){this._pointerId===a.pointerId&&this._resetPointer()},_resetPointer:function(){this._pointerId=null,h._removeEventListener(b,"pointerup",this._pointerUpBound,!0),h._removeEventListener(b,"pointercancel",this._pointerCancelBound,!0),h._removeEventListener(this._element,"pointerover",this._pointerOverBound,!0),h._removeEventListener(this._element,"pointerout",this._pointerOutBound,!0),h.removeClass(this._element,a.winPressed)},dispose:function(){this._disposed||(this._disposed=!0,this._resetPointer())}},{winPressed:"win-pressed"});return a}),SplitViewCommand:c.Namespace._lazy(function(){var k=h.Key,l={get duplicateConstruction(){return"Invalid argument: Controls may only be instantiated one time for each DOM element"}},m={command:"win-splitviewcommand",commandButton:"win-splitviewcommand-button",commandButtonContent:"win-splitviewcommand-button-content",commandSplitButton:"win-splitviewcommand-splitbutton",commandSplitButtonOpened:"win-splitviewcommand-splitbutton-opened",commandIcon:"win-splitviewcommand-icon",commandLabel:"win-splitviewcommand-label"},n={invoked:"invoked",_splitToggle:"_splittoggle"},o=e._createEventProperty,p=c.Class.define(function(a,c){if(a=a||b.document.createElement("DIV"),c=c||{},a.winControl)throw new d("WinJS.UI.SplitViewCommand.DuplicateConstruction",l.duplicateConstruction);this._winKeyboard=new i._WinKeyboard(a),this._baseConstructor(a,c)},{_baseConstructor:function(a,b,c){this._classNames=c||m,a.winControl=this,this._element=a,h.addClass(this.element,this._classNames.command),h.addClass(this.element,"win-disposable"),this._tooltip=null,this._splitOpened=!1,this._buildDom(),a.addEventListener("keydown",this._keydownHandler.bind(this)),g.setOptions(this,b)},element:{get:function(){return this._element}},label:{get:function(){return this._label},set:function(a){this._label=a,this._labelEl.textContent=a}},tooltip:{get:function(){return this._tooltip},set:function(a){this._tooltip=a,this._tooltip||""===this._tooltip?this._element.setAttribute("title",this._tooltip):this._element.removeAttribute("title")}},icon:{get:function(){return this._icon},set:function(a){this._icon=j[a]||a,this._icon&&1===this._icon.length?(this._imageSpan.textContent=this._icon,this._imageSpan.style.backgroundImage="",this._imageSpan.style.msHighContrastAdjust="",this._imageSpan.style.display=""):this._icon&&this._icon.length>1?(this._imageSpan.textContent="",this._imageSpan.style.backgroundImage=this._icon,this._imageSpan.style.msHighContrastAdjust="none",this._imageSpan.style.display=""):(this._imageSpan.textContent="",this._imageSpan.style.backgroundImage="",this._imageSpan.style.msHighContrastAdjust="",this._imageSpan.style.display="none")}},oninvoked:o(n.invoked),_toggleSplit:function(){this._splitOpened=!this._splitOpened,this._splitOpened?(h.addClass(this._splitButtonEl,this._classNames.commandSplitButtonOpened),this._splitButtonEl.setAttribute("aria-expanded","true")):(h.removeClass(this._splitButtonEl,this._classNames.commandSplitButtonOpened),this._splitButtonEl.setAttribute("aria-expanded","false")),this._fireEvent(p._EventName._splitToggle)},_rtl:{get:function(){return"rtl"===h._getComputedStyle(this.element).direction}},_keydownHandler:function(a){if(!h._matchesSelector(a.target,".win-interactive, .win-interactive *")){var b=this._rtl?k.rightArrow:k.leftArrow,c=this._rtl?k.leftArrow:k.rightArrow;a.altKey||a.keyCode!==b&&a.keyCode!==k.home&&a.keyCode!==k.end||a.target!==this._splitButtonEl?a.altKey||a.keyCode!==c||!this.splitButton||a.target!==this._buttonEl&&!this._buttonEl.contains(a.target)?a.keyCode!==k.space&&a.keyCode!==k.enter||a.target!==this._buttonEl&&!this._buttonEl.contains(a.target)?a.keyCode!==k.space&&a.keyCode!==k.enter||a.target!==this._splitButtonEl||this._toggleSplit():this._invoke():(h._setActive(this._splitButtonEl),a.keyCode===c&&a.stopPropagation(),a.preventDefault()):(h._setActive(this._buttonEl),a.keyCode===b&&a.stopPropagation(),a.preventDefault())}},_getFocusInto:function(a){var b=this._rtl?k.rightArrow:k.leftArrow;return a===b&&this.splitButton?this._splitButtonEl:this._buttonEl},_buildDom:function(){var b='<div tabindex="0" role="button" class="'+this._classNames.commandButton+'"><div class="'+this._classNames.commandButtonContent+'"><div class="'+this._classNames.commandIcon+'"></div><div class="'+this._classNames.commandLabel+'"></div></div></div><div tabindex="-1" aria-expanded="false" class="'+this._classNames.commandSplitButton+'"></div>';this.element.insertAdjacentHTML("afterBegin",b),this._buttonEl=this.element.firstElementChild,this._buttonPressedBehavior=new a._WinPressed(this._buttonEl),this._contentEl=this._buttonEl.firstElementChild,this._imageSpan=this._contentEl.firstElementChild,this._imageSpan.style.display="none",this._labelEl=this._imageSpan.nextElementSibling,this._splitButtonEl=this._buttonEl.nextElementSibling,this._splitButtonPressedBehavior=new a._WinPressed(this._splitButtonEl),this._splitButtonEl.style.display="none",h._ensureId(this._buttonEl),this._splitButtonEl.setAttribute("aria-labelledby",this._buttonEl.id),this._buttonEl.addEventListener("click",this._handleButtonClick.bind(this));var c=new h._MutationObserver(this._splitButtonAriaExpandedPropertyChangeHandler.bind(this));c.observe(this._splitButtonEl,{attributes:!0,attributeFilter:["aria-expanded"]}),this._splitButtonEl.addEventListener("click",this._handleSplitButtonClick.bind(this));for(var d=this._splitButtonEl.nextSibling;d;)this._buttonEl.insertBefore(d,this._contentEl),"#text"!==d.nodeName&&f.processAll(d),d=this._splitButtonEl.nextSibling},_handleButtonClick:function(a){var b=a.target;h._matchesSelector(b,".win-interactive, .win-interactive *")||this._invoke()},_splitButtonAriaExpandedPropertyChangeHandler:function(){"true"===this._splitButtonEl.getAttribute("aria-expanded")!==this._splitOpened&&this._toggleSplit()},_handleSplitButtonClick:function(){this._toggleSplit()},_invoke:function(){this._fireEvent(p._EventName.invoked)},_fireEvent:function(a,c){var d=b.document.createEvent("CustomEvent");d.initCustomEvent(a,!0,!1,c),this.element.dispatchEvent(d)},dispose:function(){this._disposed||(this._disposed=!0,this._buttonPressedBehavior.dispose(),this._splitButtonPressedBehavior.dispose())}},{_ClassName:m,_EventName:n});return c.Class.mix(p,g.DOMEventMixin),p})})}),d("WinJS/Controls/NavBar/_Command",["exports","../../Core/_Global","../../Core/_Base","../../Core/_ErrorFromName","../../Navigation","../../Utilities/_ElementUtilities","../SplitView/Command"],function(a,b,c,d,e,f,g){"use strict";c.Namespace._moduleDefine(a,"WinJS.UI",{NavBarCommand:c.Namespace._lazy(function(){var a={get duplicateConstruction(){return"Invalid argument: Controls may only be instantiated one time for each DOM element"},get navBarCommandDeprecated(){return"NavBarCommand is deprecated and may not be available in future releases. If you were using a NavBarCommand inside of a SplitView, use SplitViewCommand instead."}},h={command:"win-navbarcommand",commandButton:"win-navbarcommand-button",commandButtonContent:"win-navbarcommand-button-content",commandSplitButton:"win-navbarcommand-splitbutton",commandSplitButtonOpened:"win-navbarcommand-splitbutton-opened",commandIcon:"win-navbarcommand-icon",commandLabel:"win-navbarcommand-label"},i=g.SplitViewCommand.prototype,j=c.Class.derive(g.SplitViewCommand,function(c,e){if(f._deprecated(a.navBarCommandDeprecated),c=c||b.document.createElement("DIV"),e=e||{},c.winControl)throw new d("WinJS.UI.NavBarCommand.DuplicateConstruction",a.duplicateConstruction);this._baseConstructor(c,e,h)},{element:{get:function(){return Object.getOwnPropertyDescriptor(i,"element").get.call(this)}},label:{get:function(){return Object.getOwnPropertyDescriptor(i,"label").get.call(this)},set:function(a){return Object.getOwnPropertyDescriptor(i,"label").set.call(this,a)}},tooltip:{get:function(){return Object.getOwnPropertyDescriptor(i,"tooltip").get.call(this)},set:function(a){return Object.getOwnPropertyDescriptor(i,"tooltip").set.call(this,a)}},icon:{get:function(){return Object.getOwnPropertyDescriptor(i,"icon").get.call(this)},set:function(a){return Object.getOwnPropertyDescriptor(i,"icon").set.call(this,a)}},location:{get:function(){return this._location},set:function(a){this._location=a}},oninvoked:{get:function(){return void 0},enumerable:!1},state:{get:function(){return this._state},set:function(a){this._state=a}},splitButton:{get:function(){return this._split},set:function(a){this._split=a,this._split?this._splitButtonEl.style.display="":this._splitButtonEl.style.display="none"}},splitOpened:{get:function(){return this._splitOpened},set:function(a){this._splitOpened!==!!a&&this._toggleSplit()}},dispose:function(){i.dispose.call(this)},_invoke:function(){this.location&&e.navigate(this.location,this.state),this._fireEvent(j._EventName._invoked)}},{_ClassName:h,_EventName:{_invoked:"_invoked",_splitToggle:"_splittoggle"}});return j})})}),d("WinJS/Controls/NavBar/_Container",["exports","../../Core/_Global","../../Core/_Base","../../Core/_BaseUtils","../../Core/_ErrorFromName","../../Core/_Events","../../Core/_Log","../../Core/_Resources","../../Core/_WriteProfilerMark","../../Animations","../../Animations/_TransitionAnimation","../../BindingList","../../ControlProcessor","../../Navigation","../../Promise","../../Scheduler","../../Utilities/_Control","../../Utilities/_ElementUtilities","../../Utilities/_KeyboardBehavior","../../Utilities/_UI","../_LegacyAppBar/_Constants","../Repeater","./_Command"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w){"use strict";function x(){return null===b.document.activeElement||b.document.activeElement===b.document.body}c.Namespace._moduleDefine(a,"WinJS.UI",{NavBarContainer:c.Namespace._lazy(function(){var a=r.Key,y=3e3,z=r._MSPointerEvent.MSPOINTER_TYPE_TOUCH||"touch",A=0,B=f._createEventProperty,C={invoked:"invoked",splittoggle:"splittoggle"},D={get duplicateConstruction(){return"Invalid argument: Controls may only be instantiated one time for each DOM element"},get navBarContainerViewportAriaLabel(){return h._getWinJSString("ui/navBarContainerViewportAriaLabel").value},get navBarContainerIsDeprecated(){return"NavBarContainer is deprecated and may not be available in future releases. Instead, use a WinJS SplitView to display navigation targets within the app."}},E=c.Class.define(function(a,c){if(r._deprecated(D.navBarContainerIsDeprecated),a=a||b.document.createElement("DIV"),this._id=a.id||r._uniqueID(a),this._writeProfilerMark("constructor,StartTM"),c=c||{},a.winControl)throw new e("WinJS.UI.NavBarContainer.DuplicateConstruction",D.duplicateConstruction);a.winControl=this,this._element=a,r.addClass(this.element,E._ClassName.navbarcontainer),r.addClass(this.element,"win-disposable"),a.getAttribute("tabIndex")||(a.tabIndex=-1),this._focusCurrentItemPassivelyBound=this._focusCurrentItemPassively.bind(this),this._closeSplitAndResetBound=this._closeSplitAndReset.bind(this),this._currentManipulationState=A,this._panningDisabled=!r._supportsSnapPoints,this._fixedSize=!1,this._maxRows=1,this._sizes={},this._setupTree(),this._duringConstructor=!0,this._dataChangingBound=this._dataChanging.bind(this),this._dataChangedBound=this._dataChanged.bind(this),n.addEventListener("navigated",this._closeSplitAndResetBound),this.layout=c.layout||t.Orientation.horizontal,c.maxRows&&(this.maxRows=c.maxRows),c.template&&(this.template=c.template),c.data&&(this.data=c.data),c.fixedSize&&(this.fixedSize=c.fixedSize),q._setOptions(this,c,!0),this._duringConstructor=!1,c.currentIndex&&(this.currentIndex=c.currentIndex),this._updatePageUI(),p.schedule(function(){this._updateAppBarReference()},p.Priority.normal,this,"WinJS.UI.NavBarContainer_async_initialize"),this._writeProfilerMark("constructor,StopTM")},{element:{get:function(){return this._element}},template:{get:function(){return this._template},set:function(a){if(this._template=a,this._repeater){var c=this.element.contains(b.document.activeElement);this._duringConstructor||this._closeSplitIfOpen(),this._repeater.template=this._repeater.template,this._duringConstructor||(this._measured=!1,this._sizes.itemMeasured=!1,this._reset(),c&&this._keyboardBehavior._focus(0))}}},_render:function(a){var c=b.document.createElement("div"),d=this._template;d&&(d.render?d.render(a,c):d.winControl&&d.winControl.render?d.winControl.render(a,c):c.appendChild(d(a)));var e=new w.NavBarCommand(c,a);return e._element},data:{get:function(){return this._repeater&&this._repeater.data},set:function(a){a||(a=new l.List),this._duringConstructor||this._closeSplitIfOpen(),this._removeDataChangingEvents(),this._removeDataChangedEvents();var c=this.element.contains(b.document.activeElement);this._repeater||(this._surfaceEl.innerHTML="",this._repeater=new v.Repeater(this._surfaceEl,{template:this._render.bind(this)})),this._addDataChangingEvents(a),this._repeater.data=a,this._addDataChangedEvents(a),this._duringConstructor||(this._measured=!1,this._sizes.itemMeasured=!1,this._reset(),c&&this._keyboardBehavior._focus(0))}},maxRows:{get:function(){return this._maxRows},set:function(a){a=+a===a?a:1,this._maxRows=Math.max(1,a),this._duringConstructor||(this._closeSplitIfOpen(),this._measured=!1,this._reset())}},layout:{get:function(){return this._layout},set:function(a){a===t.Orientation.vertical?(this._layout=t.Orientation.vertical,r.removeClass(this.element,E._ClassName.horizontal),r.addClass(this.element,E._ClassName.vertical)):(this._layout=t.Orientation.horizontal,r.removeClass(this.element,E._ClassName.vertical),r.addClass(this.element,E._ClassName.horizontal)),this._viewportEl.style.msScrollSnapType="",this._zooming=!1,this._duringConstructor||(this._measured=!1,this._sizes.itemMeasured=!1,this._ensureVisible(this._keyboardBehavior.currentIndex,!0),this._updatePageUI(),this._closeSplitIfOpen())}},currentIndex:{get:function(){return this._keyboardBehavior.currentIndex},set:function(a){if(a===+a){var c=this.element.contains(b.document.activeElement);this._keyboardBehavior.currentIndex=a,this._ensureVisible(this._keyboardBehavior.currentIndex,!0),c&&this._keyboardBehavior._focus()}}},fixedSize:{get:function(){return this._fixedSize},set:function(a){this._fixedSize=!!a,this._duringConstructor||(this._closeSplitIfOpen(),this._measured?this._surfaceEl.children.length>0&&this._updateGridStyles():this._measure())}},oninvoked:B(C.invoked),onsplittoggle:B(C.splittoggle),forceLayout:function(){this._resizeHandler(),this._measured&&(this._scrollPosition=r.getScrollPosition(this._viewportEl)[this.layout===t.Orientation.horizontal?"scrollLeft":"scrollTop"]),this._duringForceLayout=!0,this._ensureVisible(this._keyboardBehavior.currentIndex,!0),this._updatePageUI(),this._duringForceLayout=!1},_updateAppBarReference:function(){if(!this._appBarEl||!this._appBarEl.contains(this.element)){this._appBarEl&&(this._appBarEl.removeEventListener("beforeopen",this._closeSplitAndResetBound),this._appBarEl.removeEventListener("beforeopen",this._resizeImplBound),this._appBarEl.removeEventListener("afteropen",this._focusCurrentItemPassivelyBound));for(var a=this.element.parentNode;a&&!r.hasClass(a,u.appBarClass);)a=a.parentNode;this._appBarEl=a,this._appBarEl&&(this._appBarEl.addEventListener("beforeopen",this._closeSplitAndResetBound),this._appBarEl.addEventListener("afteropen",this._focusCurrentItemPassivelyBound))}},_closeSplitAndReset:function(){this._closeSplitIfOpen(),this._reset()},_dataChanging:function(a){this._elementHadFocus=b.document.activeElement,this._currentSplitNavItem&&this._currentSplitNavItem.splitOpened&&("itemremoved"===a.type?this._surfaceEl.children[a.detail.index].winControl===this._currentSplitNavItem&&this._closeSplitIfOpen():"itemchanged"===a.type?this._surfaceEl.children[a.detail.index].winControl===this._currentSplitNavItem&&this._closeSplitIfOpen():"itemmoved"===a.type?this._surfaceEl.children[a.detail.oldIndex].winControl===this._currentSplitNavItem&&this._closeSplitIfOpen():"reload"===a.type&&this._closeSplitIfOpen())},_dataChanged:function(a){this._measured=!1,"itemremoved"===a.type?a.detail.index<this._keyboardBehavior.currentIndex?this._keyboardBehavior.currentIndex--:a.detail.index===this._keyboardBehavior.currentIndex&&(this._keyboardBehavior.currentIndex=this._keyboardBehavior.currentIndex,x()&&this._elementHadFocus&&this._keyboardBehavior._focus()):"itemchanged"===a.type?a.detail.index===this._keyboardBehavior.currentIndex&&x()&&this._elementHadFocus&&this._keyboardBehavior._focus():"iteminserted"===a.type?a.detail.index<=this._keyboardBehavior.currentIndex&&this._keyboardBehavior.currentIndex++:"itemmoved"===a.type?a.detail.oldIndex===this._keyboardBehavior.currentIndex&&(this._keyboardBehavior.currentIndex=a.detail.newIndex,x()&&this._elementHadFocus&&this._keyboardBehavior._focus()):"reload"===a.type&&(this._keyboardBehavior.currentIndex=0,x()&&this._elementHadFocus&&this._keyboardBehavior._focus()),this._ensureVisible(this._keyboardBehavior.currentIndex,!0),this._updatePageUI()},_focusCurrentItemPassively:function(){this.element.contains(b.document.activeElement)&&this._keyboardBehavior._focus()},_reset:function(){this._keyboardBehavior.currentIndex=0,this.element.contains(b.document.activeElement)&&this._keyboardBehavior._focus(0),this._viewportEl.style.msScrollSnapType="",this._zooming=!1,this._ensureVisible(0,!0),this._updatePageUI()},_removeDataChangedEvents:function(){this._repeater&&(this._repeater.data.removeEventListener("itemchanged",this._dataChangedBound),this._repeater.data.removeEventListener("iteminserted",this._dataChangedBound),this._repeater.data.removeEventListener("itemmoved",this._dataChangedBound),this._repeater.data.removeEventListener("itemremoved",this._dataChangedBound),this._repeater.data.removeEventListener("reload",this._dataChangedBound))},_addDataChangedEvents:function(){this._repeater&&(this._repeater.data.addEventListener("itemchanged",this._dataChangedBound),this._repeater.data.addEventListener("iteminserted",this._dataChangedBound),this._repeater.data.addEventListener("itemmoved",this._dataChangedBound),this._repeater.data.addEventListener("itemremoved",this._dataChangedBound),this._repeater.data.addEventListener("reload",this._dataChangedBound))},_removeDataChangingEvents:function(){this._repeater&&(this._repeater.data.removeEventListener("itemchanged",this._dataChangingBound),this._repeater.data.removeEventListener("iteminserted",this._dataChangingBound),this._repeater.data.removeEventListener("itemmoved",this._dataChangingBound),this._repeater.data.removeEventListener("itemremoved",this._dataChangingBound),this._repeater.data.removeEventListener("reload",this._dataChangingBound))},_addDataChangingEvents:function(a){a.addEventListener("itemchanged",this._dataChangingBound),a.addEventListener("iteminserted",this._dataChangingBound),a.addEventListener("itemmoved",this._dataChangingBound),a.addEventListener("itemremoved",this._dataChangingBound),a.addEventListener("reload",this._dataChangingBound)},_mouseleave:function(){this._mouseInViewport&&(this._mouseInViewport=!1,this._updateArrows())},_MSPointerDown:function(a){a.pointerType===z&&this._mouseInViewport&&(this._mouseInViewport=!1,this._updateArrows())},_MSPointerMove:function(a){a.pointerType!==z&&(this._mouseInViewport||(this._mouseInViewport=!0,this._updateArrows()))},_setupTree:function(){this._animateNextPreviousButtons=o.wrap(),this._element.addEventListener("mouseleave",this._mouseleave.bind(this)),r._addEventListener(this._element,"pointerdown",this._MSPointerDown.bind(this)),r._addEventListener(this._element,"pointermove",this._MSPointerMove.bind(this)),r._addEventListener(this._element,"focusin",this._focusHandler.bind(this),!1),this._pageindicatorsEl=b.document.createElement("div"),r.addClass(this._pageindicatorsEl,E._ClassName.pageindicators),this._element.appendChild(this._pageindicatorsEl),this._ariaStartMarker=b.document.createElement("div"),this._element.appendChild(this._ariaStartMarker),this._viewportEl=b.document.createElement("div"),r.addClass(this._viewportEl,E._ClassName.viewport),this._element.appendChild(this._viewportEl),this._viewportEl.setAttribute("role","group"),this._viewportEl.setAttribute("aria-label",D.navBarContainerViewportAriaLabel),this._boundResizeHandler=this._resizeHandler.bind(this),r._resizeNotifier.subscribe(this._element,this._boundResizeHandler),this._viewportEl.addEventListener("mselementresize",this._resizeHandler.bind(this)),this._viewportEl.addEventListener("scroll",this._scrollHandler.bind(this)),this._viewportEl.addEventListener("MSManipulationStateChanged",this._MSManipulationStateChangedHandler.bind(this)),this._ariaEndMarker=b.document.createElement("div"),this._element.appendChild(this._ariaEndMarker),this._surfaceEl=b.document.createElement("div"),r.addClass(this._surfaceEl,E._ClassName.surface),this._viewportEl.appendChild(this._surfaceEl),this._surfaceEl.addEventListener(w.NavBarCommand._EventName._invoked,this._navbarCommandInvokedHandler.bind(this)),this._surfaceEl.addEventListener(w.NavBarCommand._EventName._splitToggle,this._navbarCommandSplitToggleHandler.bind(this)),r._addEventListener(this._surfaceEl,"focusin",this._itemsFocusHandler.bind(this),!1),this._surfaceEl.addEventListener("keydown",this._keyDownHandler.bind(this));for(var a=this.element.firstElementChild;a!==this._pageindicatorsEl;)this._surfaceEl.appendChild(a),m.process(a),a=this.element.firstElementChild;this._leftArrowEl=b.document.createElement("div"),r.addClass(this._leftArrowEl,E._ClassName.navleftarrow),r.addClass(this._leftArrowEl,E._ClassName.navarrow),this._element.appendChild(this._leftArrowEl),this._leftArrowEl.addEventListener("click",this._goLeft.bind(this)),this._leftArrowEl.style.opacity=0,
this._leftArrowEl.style.visibility="hidden",this._leftArrowFadeOut=o.wrap(),this._rightArrowEl=b.document.createElement("div"),r.addClass(this._rightArrowEl,E._ClassName.navrightarrow),r.addClass(this._rightArrowEl,E._ClassName.navarrow),this._element.appendChild(this._rightArrowEl),this._rightArrowEl.addEventListener("click",this._goRight.bind(this)),this._rightArrowEl.style.opacity=0,this._rightArrowEl.style.visibility="hidden",this._rightArrowFadeOut=o.wrap(),this._keyboardBehavior=new s._KeyboardBehavior(this._surfaceEl,{scroller:this._viewportEl}),this._winKeyboard=new s._WinKeyboard(this._surfaceEl)},_goRight:function(){this._sizes.rtl?this._goPrev():this._goNext()},_goLeft:function(){this._sizes.rtl?this._goNext():this._goPrev()},_goNext:function(){this._measure();var a=this._sizes.rowsPerPage*this._sizes.columnsPerPage,b=Math.min(Math.floor(this._keyboardBehavior.currentIndex/a)+1,this._sizes.pages-1);this._keyboardBehavior.currentIndex=Math.min(a*b,this._surfaceEl.children.length),this._keyboardBehavior._focus()},_goPrev:function(){this._measure();var a=this._sizes.rowsPerPage*this._sizes.columnsPerPage,b=Math.max(0,Math.floor(this._keyboardBehavior.currentIndex/a)-1);this._keyboardBehavior.currentIndex=Math.max(a*b,0),this._keyboardBehavior._focus()},_currentPage:{get:function(){return this.layout===t.Orientation.horizontal&&(this._measure(),this._sizes.viewportOffsetWidth>0)?Math.min(this._sizes.pages-1,Math.round(this._scrollPosition/this._sizes.viewportOffsetWidth)):0}},_resizeHandler:function(){if(!this._disposed&&this._measured){var a=this.layout===t.Orientation.horizontal?this._sizes.viewportOffsetWidth!==parseFloat(r._getComputedStyle(this._viewportEl).width):this._sizes.viewportOffsetHeight!==parseFloat(r._getComputedStyle(this._viewportEl).height);a&&(this._measured=!1,this._pendingResize||(this._pendingResize=!0,this._resizeImplBound=this._resizeImplBound||this._resizeImpl.bind(this),this._updateAppBarReference(),this._appBarEl&&this._appBarEl.winControl&&!this._appBarEl.winControl.opened?(p.schedule(this._resizeImplBound,p.Priority.idle,null,"WinJS.UI.NavBarContainer._resizeImpl"),this._appBarEl.addEventListener("beforeopen",this._resizeImplBound)):this._resizeImpl()))}},_resizeImpl:function(){!this._disposed&&this._pendingResize&&(this._pendingResize=!1,this._appBarEl&&this._appBarEl.removeEventListener("beforeopen",this._resizeImplBound),this._keyboardBehavior.currentIndex=0,this.element.contains(b.document.activeElement)&&this._keyboardBehavior._focus(this._keyboardBehavior.currentIndex),this._closeSplitIfOpen(),this._ensureVisible(this._keyboardBehavior.currentIndex,!0),this._updatePageUI())},_keyDownHandler:function(c){var d=c.keyCode;if(!c.altKey&&(d===a.pageUp||d===a.pageDown)){var e=c.target;if(r._matchesSelector(e,".win-interactive, .win-interactive *"))return;var f=this._keyboardBehavior.currentIndex;this._measure();var g=this._sizes,h=Math.floor(f/(g.columnsPerPage*g.rowsPerPage)),i=null;if(d===a.pageUp){if(this.layout===t.Orientation.horizontal){var j=h*g.columnsPerPage*g.rowsPerPage;f===j&&this._surfaceEl.children[f].winControl._buttonEl===b.document.activeElement?f-=g.columnsPerPage*g.rowsPerPage:f=j}else{var k=this._surfaceEl.children[f],l=k.offsetTop,m=l+k.offsetHeight,n=this._zooming?this._zoomPosition:this._scrollPosition;if(l>=n&&m<n+g.viewportOffsetHeight)for(;f>0&&this._surfaceEl.children[f-1].offsetTop>n;)f--;if(this._keyboardBehavior.currentIndex===f){var o=m-g.viewportOffsetHeight;for(f=Math.max(0,f-1);f>0&&this._surfaceEl.children[f-1].offsetTop>o;)f--;i=f>0?this._surfaceEl.children[f].offsetTop-this._sizes.itemMarginTop:0}}f=Math.max(f,0),this._keyboardBehavior.currentIndex=f;var p=this._surfaceEl.children[f].winControl._buttonEl;null!==i&&this._scrollTo(i),r._setActive(p,this._viewportEl)}else{if(this.layout===t.Orientation.horizontal){var q=(h+1)*g.columnsPerPage*g.rowsPerPage-1;f===q?f+=g.columnsPerPage*g.rowsPerPage:f=q}else{var k=this._surfaceEl.children[this._keyboardBehavior.currentIndex],l=k.offsetTop,m=l+k.offsetHeight,n=this._zooming?this._zoomPosition:this._scrollPosition;if(l>=n&&m<n+g.viewportOffsetHeight)for(;f<this._surfaceEl.children.length-1&&this._surfaceEl.children[f+1].offsetTop+this._surfaceEl.children[f+1].offsetHeight<n+g.viewportOffsetHeight;)f++;if(f===this._keyboardBehavior.currentIndex){var s=l+g.viewportOffsetHeight;for(f=Math.min(this._surfaceEl.children.length-1,f+1);f<this._surfaceEl.children.length-1&&this._surfaceEl.children[f+1].offsetTop+this._surfaceEl.children[f+1].offsetHeight<s;)f++;i=f<this._surfaceEl.children.length-1?this._surfaceEl.children[f+1].offsetTop-this._sizes.viewportOffsetHeight:this._scrollLength-this._sizes.viewportOffsetHeight}}f=Math.min(f,this._surfaceEl.children.length-1),this._keyboardBehavior.currentIndex=f;var p=this._surfaceEl.children[f].winControl._buttonEl;null!==i&&this._scrollTo(i);try{r._setActive(p,this._viewportEl)}catch(u){}}}},_focusHandler:function(a){var b=a.target;this._surfaceEl.contains(b)||(this._skipEnsureVisible=!0,this._keyboardBehavior._focus(this._keyboardBehavior.currentIndex))},_itemsFocusHandler:function(a){var b=a.target;if(b!==this._surfaceEl){for(;b.parentNode!==this._surfaceEl;)b=b.parentNode;for(var c=-1;b;)c++,b=b.previousSibling;this._skipEnsureVisible?this._skipEnsureVisible=!1:this._ensureVisible(c)}},_ensureVisible:function(a,b){if(this._measure(),this.layout===t.Orientation.horizontal){var c=Math.floor(a/(this._sizes.rowsPerPage*this._sizes.columnsPerPage));this._scrollTo(c*this._sizes.viewportOffsetWidth,b)}else{var d,e=this._surfaceEl.children[a];d=a>0?e.offsetTop-this._sizes.itemMarginTop:0;var f;f=a<this._surfaceEl.children.length-1?this._surfaceEl.children[a+1].offsetTop-this._sizes.viewportOffsetHeight:this._scrollLength-this._sizes.viewportOffsetHeight;var g=this._zooming?this._zoomPosition:this._scrollPosition;g=Math.max(g,f),g=Math.min(g,d),this._scrollTo(g,b)}},_scrollTo:function(a,b){if(this._measure(),a=this.layout===t.Orientation.horizontal?Math.max(0,Math.min(this._scrollLength-this._sizes.viewportOffsetWidth,a)):Math.max(0,Math.min(this._scrollLength-this._sizes.viewportOffsetHeight,a)),b){if(Math.abs(this._scrollPosition-a)>1){this._zooming=!1,this._scrollPosition=a,this._updatePageUI(),this._duringForceLayout||this._closeSplitIfOpen();var c={};c[this.layout===t.Orientation.horizontal?"scrollLeft":"scrollTop"]=a,r.setScrollPosition(this._viewportEl,c)}}else(!this._zooming&&Math.abs(this._scrollPosition-a)>1||this._zooming&&Math.abs(this._zoomPosition-a)>1)&&(this._zoomPosition=a,this._zooming=!0,this.layout===t.Orientation.horizontal?(this._viewportEl.style.msScrollSnapType="none",r._zoomTo(this._viewportEl,{contentX:a,contentY:0,viewportX:0,viewportY:0})):r._zoomTo(this._viewportEl,{contentX:0,contentY:a,viewportX:0,viewportY:0}),this._closeSplitIfOpen())},_MSManipulationStateChangedHandler:function(a){this._currentManipulationState=a.currentState,a.currentState===a.MS_MANIPULATION_STATE_ACTIVE&&(this._viewportEl.style.msScrollSnapType="",this._zooming=!1),b.clearTimeout(this._manipulationStateTimeoutId),a.currentState===a.MS_MANIPULATION_STATE_STOPPED&&(this._manipulationStateTimeoutId=b.setTimeout(function(){this._viewportEl.style.msScrollSnapType="",this._zooming=!1,this._updateCurrentIndexIfPageChanged()}.bind(this),100))},_scrollHandler:function(){if(!this._disposed&&(this._measured=!1,!this._checkingScroll)){var a=this;this._checkingScroll=d._requestAnimationFrame(function(){if(!a._disposed){a._checkingScroll=null;var b=r.getScrollPosition(a._viewportEl)[a.layout===t.Orientation.horizontal?"scrollLeft":"scrollTop"];b!==a._scrollPosition&&(a._scrollPosition=b,a._closeSplitIfOpen()),a._updatePageUI(),a._zooming||a._currentManipulationState!==A||a._updateCurrentIndexIfPageChanged()}})}},_updateCurrentIndexIfPageChanged:function(){if(this.layout===t.Orientation.horizontal){this._measure();var a=this._currentPage,c=a*this._sizes.rowsPerPage*this._sizes.columnsPerPage,d=(a+1)*this._sizes.rowsPerPage*this._sizes.columnsPerPage-1;(this._keyboardBehavior.currentIndex<c||this._keyboardBehavior.currentIndex>d)&&(this._keyboardBehavior.currentIndex=c,this.element.contains(b.document.activeElement)&&this._keyboardBehavior._focus(this._keyboardBehavior.currentIndex))}},_measure:function(){if(!this._measured){this._resizeImpl(),this._writeProfilerMark("measure,StartTM");var a=this._sizes;a.rtl="rtl"===r._getComputedStyle(this._element).direction;var b=this._surfaceEl.children.length;if(b>0){if(!this._sizes.itemMeasured){this._writeProfilerMark("measureItem,StartTM");var c=this._surfaceEl.firstElementChild;c.style.margin="",c.style.width="";var d=r._getComputedStyle(c);a.itemOffsetWidth=parseFloat(r._getComputedStyle(c).width),0===c.offsetWidth&&(a.itemOffsetWidth=0),a.itemMarginLeft=parseFloat(d.marginLeft),a.itemMarginRight=parseFloat(d.marginRight),a.itemWidth=a.itemOffsetWidth+a.itemMarginLeft+a.itemMarginRight,a.itemOffsetHeight=parseFloat(r._getComputedStyle(c).height),0===c.offsetHeight&&(a.itemOffsetHeight=0),a.itemMarginTop=parseFloat(d.marginTop),a.itemMarginBottom=parseFloat(d.marginBottom),a.itemHeight=a.itemOffsetHeight+a.itemMarginTop+a.itemMarginBottom,a.itemOffsetWidth>0&&a.itemOffsetHeight>0&&(a.itemMeasured=!0),this._writeProfilerMark("measureItem,StopTM")}if(a.viewportOffsetWidth=parseFloat(r._getComputedStyle(this._viewportEl).width),0===this._viewportEl.offsetWidth&&(a.viewportOffsetWidth=0),a.viewportOffsetHeight=parseFloat(r._getComputedStyle(this._viewportEl).height),0===this._viewportEl.offsetHeight&&(a.viewportOffsetHeight=0),0===a.viewportOffsetWidth||0===a.itemOffsetHeight?this._measured=!1:this._measured=!0,this.layout===t.Orientation.horizontal){this._scrollPosition=r.getScrollPosition(this._viewportEl).scrollLeft,a.leadingEdge=this._leftArrowEl.offsetWidth+parseInt(r._getComputedStyle(this._leftArrowEl).marginLeft)+parseInt(r._getComputedStyle(this._leftArrowEl).marginRight);var e=a.viewportOffsetWidth-2*a.leadingEdge;a.maxColumns=a.itemWidth?Math.max(1,Math.floor(e/a.itemWidth)):1,a.rowsPerPage=Math.min(this.maxRows,Math.ceil(b/a.maxColumns)),a.columnsPerPage=Math.min(a.maxColumns,b),a.pages=Math.ceil(b/(a.columnsPerPage*a.rowsPerPage)),a.trailingEdge=a.leadingEdge,a.extraSpace=e-a.columnsPerPage*a.itemWidth,this._scrollLength=a.viewportOffsetWidth*a.pages,this._keyboardBehavior.fixedSize=a.rowsPerPage,this._keyboardBehavior.fixedDirection=s._KeyboardBehavior.FixedDirection.height,this._surfaceEl.style.height=a.itemHeight*a.rowsPerPage+"px",this._surfaceEl.style.width=this._scrollLength+"px"}else this._scrollPosition=this._viewportEl.scrollTop,a.leadingEdge=0,a.rowsPerPage=b,a.columnsPerPage=1,a.pages=1,a.trailingEdge=0,this._scrollLength=this._viewportEl.scrollHeight,this._keyboardBehavior.fixedSize=a.columnsPerPage,this._keyboardBehavior.fixedDirection=s._KeyboardBehavior.FixedDirection.width,this._surfaceEl.style.height="",this._surfaceEl.style.width="";this._updateGridStyles()}else a.pages=1,this._hasPreviousContent=!1,this._hasNextContent=!1,this._surfaceEl.style.height="",this._surfaceEl.style.width="";this._writeProfilerMark("measure,StopTM")}},_updateGridStyles:function(){for(var a=this._sizes,b=this._surfaceEl.children.length,c=0;b>c;c++){var d,e,f=this._surfaceEl.children[c],g="";if(this.layout===t.Orientation.horizontal){var h=Math.floor(c/a.rowsPerPage),i=h%a.columnsPerPage===0,j=h%a.columnsPerPage===a.columnsPerPage-1,k=a.trailingEdge;if(this.fixedSize)k+=a.extraSpace;else{var l=a.extraSpace-(a.maxColumns-a.columnsPerPage)*a.itemWidth;g=a.itemOffsetWidth+l/a.maxColumns+"px"}var m,n;a.rtl?(m=i?a.leadingEdge:0,n=j?k:0):(m=j?k:0,n=i?a.leadingEdge:0),d=m+a.itemMarginRight+"px",e=n+a.itemMarginLeft+"px"}else d="",e="";f.style.marginRight!==d&&(f.style.marginRight=d),f.style.marginLeft!==e&&(f.style.marginLeft=e),f.style.width!==g&&(f.style.width=g)}},_updatePageUI:function(){this._measure();var a=this._currentPage;this._hasPreviousContent=0!==a,this._hasNextContent=a<this._sizes.pages-1,this._updateArrows(),this._indicatorCount!==this._sizes.pages&&(this._indicatorCount=this._sizes.pages,this._pageindicatorsEl.innerHTML=new Array(this._sizes.pages+1).join('<span class="'+E._ClassName.indicator+'"></span>'));for(var b=0;b<this._pageindicatorsEl.children.length;b++)b===a?r.addClass(this._pageindicatorsEl.children[b],E._ClassName.currentindicator):r.removeClass(this._pageindicatorsEl.children[b],E._ClassName.currentindicator);if(this._sizes.pages>1?(this._viewportEl.style.overflowX=this._panningDisabled?"hidden":"",this._pageindicatorsEl.style.visibility=""):(this._viewportEl.style.overflowX="hidden",this._pageindicatorsEl.style.visibility="hidden"),this._sizes.pages<=1||this._layout!==t.Orientation.horizontal)this._ariaStartMarker.removeAttribute("aria-flowto"),this._ariaEndMarker.removeAttribute("x-ms-aria-flowfrom");else{var c=a*this._sizes.rowsPerPage*this._sizes.columnsPerPage,d=this._surfaceEl.children[c].winControl._buttonEl;r._ensureId(d),this._ariaStartMarker.setAttribute("aria-flowto",d.id);var e=Math.min(this._surfaceEl.children.length-1,(a+1)*this._sizes.rowsPerPage*this._sizes.columnsPerPage-1),f=this._surfaceEl.children[e].winControl._buttonEl;r._ensureId(f),this._ariaEndMarker.setAttribute("x-ms-aria-flowfrom",f.id)}},_closeSplitIfOpen:function(){this._currentSplitNavItem&&(this._currentSplitNavItem.splitOpened&&this._currentSplitNavItem._toggleSplit(),this._currentSplitNavItem=null)},_updateArrows:function(){var a=this._sizes.rtl?this._hasNextContent:this._hasPreviousContent,b=this._sizes.rtl?this._hasPreviousContent:this._hasNextContent,c=this;(this._mouseInViewport||this._panningDisabled)&&a?(this._leftArrowWaitingToFadeOut&&this._leftArrowWaitingToFadeOut.cancel(),this._leftArrowWaitingToFadeOut=null,this._leftArrowFadeOut&&this._leftArrowFadeOut.cancel(),this._leftArrowFadeOut=null,this._leftArrowEl.style.visibility="",this._leftArrowFadeIn=this._leftArrowFadeIn||j.fadeIn(this._leftArrowEl)):(a?this._leftArrowWaitingToFadeOut=this._leftArrowWaitingToFadeOut||o.timeout(k._animationTimeAdjustment(y)):(this._leftArrowWaitingToFadeOut&&this._leftArrowWaitingToFadeOut.cancel(),this._leftArrowWaitingToFadeOut=o.wrap()),this._leftArrowWaitingToFadeOut.then(function(){this._leftArrowFadeIn&&this._leftArrowFadeIn.cancel(),this._leftArrowFadeIn=null,this._leftArrowFadeOut=this._leftArrowFadeOut||j.fadeOut(this._leftArrowEl).then(function(){c._leftArrowEl.style.visibility="hidden"})}.bind(this))),(this._mouseInViewport||this._panningDisabled)&&b?(this._rightArrowWaitingToFadeOut&&this._rightArrowWaitingToFadeOut.cancel(),this._rightArrowWaitingToFadeOut=null,this._rightArrowFadeOut&&this._rightArrowFadeOut.cancel(),this._rightArrowFadeOut=null,this._rightArrowEl.style.visibility="",this._rightArrowFadeIn=this._rightArrowFadeIn||j.fadeIn(this._rightArrowEl)):(b?this._rightArrowWaitingToFadeOut=this._rightArrowWaitingToFadeOut||o.timeout(k._animationTimeAdjustment(y)):(this._rightArrowWaitingToFadeOut&&this._rightArrowWaitingToFadeOut.cancel(),this._rightArrowWaitingToFadeOut=o.wrap()),this._rightArrowWaitingToFadeOut.then(function(){this._rightArrowFadeIn&&this._rightArrowFadeIn.cancel(),this._rightArrowFadeIn=null,this._rightArrowFadeOut=this._rightArrowFadeOut||j.fadeOut(this._rightArrowEl).then(function(){c._rightArrowEl.style.visibility="hidden"})}.bind(this)))},_navbarCommandInvokedHandler:function(a){for(var b=a.target,c=-1;b;)c++,b=b.previousSibling;this._fireEvent(E._EventName.invoked,{index:c,navbarCommand:a.target.winControl,data:this._repeater?this._repeater.data.getAt(c):null})},_navbarCommandSplitToggleHandler:function(a){for(var b=a.target,c=-1;b;)c++,b=b.previousSibling;var d=a.target.winControl;this._closeSplitIfOpen(),d.splitOpened&&(this._currentSplitNavItem=d),this._fireEvent(E._EventName.splitToggle,{opened:d.splitOpened,index:c,navbarCommand:d,data:this._repeater?this._repeater.data.getAt(c):null})},_fireEvent:function(a,c){var d=b.document.createEvent("CustomEvent");d.initCustomEvent(a,!0,!1,c),this.element.dispatchEvent(d)},_writeProfilerMark:function(a){var b="WinJS.UI.NavBarContainer:"+this._id+":"+a;i(b),g.log&&g.log(b,null,"navbarcontainerprofiler")},dispose:function(){this._disposed||(this._disposed=!0,this._appBarEl&&(this._appBarEl.removeEventListener("beforeopen",this._closeSplitAndResetBound),this._appBarEl.removeEventListener("beforeopen",this._resizeImplBound)),n.removeEventListener("navigated",this._closeSplitAndResetBound),this._leftArrowWaitingToFadeOut&&this._leftArrowWaitingToFadeOut.cancel(),this._leftArrowFadeOut&&this._leftArrowFadeOut.cancel(),this._leftArrowFadeIn&&this._leftArrowFadeIn.cancel(),this._rightArrowWaitingToFadeOut&&this._rightArrowWaitingToFadeOut.cancel(),this._rightArrowFadeOut&&this._rightArrowFadeOut.cancel(),this._rightArrowFadeIn&&this._rightArrowFadeIn.cancel(),r._resizeNotifier.unsubscribe(this._element,this._boundResizeHandler),this._removeDataChangingEvents(),this._removeDataChangedEvents())}},{_ClassName:{navbarcontainer:"win-navbarcontainer",pageindicators:"win-navbarcontainer-pageindicator-box",indicator:"win-navbarcontainer-pageindicator",currentindicator:"win-navbarcontainer-pageindicator-current",vertical:"win-navbarcontainer-vertical",horizontal:"win-navbarcontainer-horizontal",viewport:"win-navbarcontainer-viewport",surface:"win-navbarcontainer-surface",navarrow:"win-navbarcontainer-navarrow",navleftarrow:"win-navbarcontainer-navleft",navrightarrow:"win-navbarcontainer-navright"},_EventName:{invoked:C.invoked,splitToggle:C.splittoggle}});return c.Class.mix(E,q.DOMEventMixin),E})})}),d("require-style!less/styles-navbar",[],function(){}),d("require-style!less/colors-navbar",[],function(){}),d("WinJS/Controls/NavBar",["../Core/_Global","../Core/_WinRT","../Core/_Base","../Core/_BaseUtils","../Core/_Events","../Core/_WriteProfilerMark","../Promise","../Scheduler","../Utilities/_ElementUtilities","../Utilities/_Hoverable","../_Accents","./_LegacyAppBar","./NavBar/_Command","./NavBar/_Container","require-style!less/styles-navbar","require-style!less/colors-navbar"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n){"use strict";k.createAccentRule("html.win-hoverable .win-navbarcommand-splitbutton.win-navbarcommand-splitbutton-opened:hover",[{name:"background-color",value:k.ColorTypes.listSelectHover}]),k.createAccentRule("html.win-hoverable .win-navbarcommand-splitbutton.win-navbarcommand-splitbutton-opened:hover.win-pressed",[{name:"background-color",value:k.ColorTypes.listSelectPress}]),k.createAccentRule(".win-navbarcommand-splitbutton.win-navbarcommand-splitbutton-opened",[{name:"background-color",value:k.ColorTypes.listSelectRest}]),k.createAccentRule(".win-navbarcommand-splitbutton.win-navbarcommand-splitbutton-opened.win-pressed",[{name:"background-color",value:k.ColorTypes.listSelectPress}]);var o="custom";c.Namespace.define("WinJS.UI",{NavBar:c.Namespace._lazy(function(){var j="childrenprocessed",k=e._createEventProperty,m=c.Class.derive(l._LegacyAppBar,function(a,c){i._deprecated(n.navBarIsDeprecated),c=c||{},c=d._shallowCopy(c),c.placement=c.placement||"top",c.layout=o,c.closedDisplayMode=c.closedDisplayMode||"minimal",l._LegacyAppBar.call(this,a,c),this._element.addEventListener("beforeopen",this._handleBeforeShow.bind(this)),i.addClass(this.element,m._ClassName.navbar),b.Windows.ApplicationModel.DesignMode.designModeEnabled?this._processChildren():h.schedule(this._processChildren.bind(this),h.Priority.idle,null,"WinJS.UI.NavBar.processChildren")},{closedDisplayMode:{get:function(){return this._closedDisplayMode},set:function(a){var b="none"===a?"none":"minimal";Object.getOwnPropertyDescriptor(l._LegacyAppBar.prototype,"closedDisplayMode").set.call(this,b),this._closedDisplayMode=b}},onchildrenprocessed:k(j),_processChildren:function(){if(!this._processed){this._processed=!0,this._writeProfilerMark("processChildren,StartTM");var a=this,b=g.as();return this._processors&&this._processors.forEach(function(c){for(var d=0,e=a.element.children.length;e>d;d++)!function(a){b=b.then(function(){c(a)})}(a.element.children[d])}),b.then(function(){a._writeProfilerMark("processChildren,StopTM"),a._fireEvent(m._EventName.childrenProcessed)},function(){a._writeProfilerMark("processChildren,StopTM"),a._fireEvent(m._EventName.childrenProcessed)})}return g.wrap()},_show:function(){if(!this.disabled){var a=this;this._processChildren().then(function(){l._LegacyAppBar.prototype._show.call(a)})}},_handleBeforeShow:function(){if(!this._disposed)for(var a=this.element.querySelectorAll(".win-navbarcontainer"),b=0;b<a.length;b++)a[b].winControl.forceLayout()},_fireEvent:function(b,c){var d=a.document.createEvent("CustomEvent");d.initCustomEvent(b,!0,!1,c||{}),this.element.dispatchEvent(d)},_writeProfilerMark:function(a){f("WinJS.UI.NavBar:"+this._id+":"+a)}},{_ClassName:{navbar:"win-navbar"},_EventName:{childrenProcessed:j},isDeclarativeControlContainer:d.markSupportedForProcessing(function(a,b){if(a._processed)for(var c=0,d=a.element.children.length;d>c;c++)b(a.element.children[c]);else a._processors=a._processors||[],a._processors.push(b)})}),n={get navBarIsDeprecated(){return"NavBar is deprecated and may not be available in future releases. Instead, use a WinJS SplitView to display navigation targets within the app."}};return m})})}),d("require-style!less/styles-viewbox",[],function(){}),d("WinJS/Controls/ViewBox",["../Core/_Global","../Core/_Base","../Core/_BaseUtils","../Core/_ErrorFromName","../Core/_Resources","../Scheduler","../Utilities/_Control","../Utilities/_Dispose","../Utilities/_ElementUtilities","../Utilities/_Hoverable","./ElementResizeInstrument","require-style!less/styles-viewbox"],function(a,b,c,d,e,f,g,h,i,j,k){"use strict";b.Namespace.define("WinJS.UI",{ViewBox:b.Namespace._lazy(function(){var e={get invalidViewBoxChildren(){return"ViewBox expects to be provided with only one child element"}},j=b.Class.define(function(b){this._disposed=!1,this._element=b||a.document.createElement("div");var c=this.element;c.winControl=this,i.addClass(c,"win-disposable"),i.addClass(c,"win-viewbox"),this._handleResizeBound=this._handleResize.bind(this),i._resizeNotifier.subscribe(c,this._handleResizeBound),this._elementResizeInstrument=new k._ElementResizeInstrument,c.appendChild(this._elementResizeInstrument.element),this._elementResizeInstrument.addEventListener("resize",this._handleResizeBound);var d=this;i._inDom(c).then(function(){d._disposed||d._elementResizeInstrument.addedToDom()}),this.forceLayout()},{_sizer:null,_element:null,element:{get:function(){return this._element}},_rtl:{get:function(){return"rtl"===i._getComputedStyle(this.element).direction}},_initialize:function(){var a=this.element,b=Array.prototype.slice.call(a.children);-1===b.indexOf(this._elementResizeInstrument.element)&&a.appendChild(this._elementResizeInstrument.element);var g=this;if(-1===b.indexOf(this._sizer)){var h=b.filter(function(a){return a!==g._elementResizeInstrument.element});if(c.validation&&1!==h.length)throw new d("WinJS.UI.ViewBox.InvalidChildren",e.invalidViewBoxChildren);this._sizer&&(this._sizer.onresize=null);var i=h[0];if(this._sizer=i,0===a.clientWidth&&0===a.clientHeight){var g=this;f.schedule(function(){g._updateLayout()},f.Priority.normal,null,"WinJS.UI.ViewBox._updateLayout")}}},_updateLayout:function(){var a=this._sizer;if(a){var b=this.element,d=a.clientWidth,e=a.clientHeight,f=b.clientWidth,g=b.clientHeight,h=f/d,i=g/e,j=Math.min(h,i),k=Math.abs(f-d*j)/2,l=Math.abs(g-e*j)/2,m=this._rtl;this._sizer.style[c._browserStyleEquivalents.transform.scriptName]="translate("+(m?"-":"")+k+"px,"+l+"px) scale("+j+")",this._sizer.style[c._browserStyleEquivalents["transform-origin"].scriptName]=m?"top right":"top left"}this._layoutCompleteCallback()},_handleResize:function(){if(!this._resizing){this._resizing=this._resizing||0,this._resizing++;try{this._updateLayout()}finally{this._resizing--}}},_layoutCompleteCallback:function(){},dispose:function(){this._disposed||(this.element&&i._resizeNotifier.unsubscribe(this.element,this._handleResizeBound),this._elementResizeInstrument.dispose(),this._disposed=!0,h.disposeSubTree(this._element))},forceLayout:function(){this._initialize(),this._updateLayout()}});return b.Class.mix(j,g.DOMEventMixin),j})})}),d("require-style!less/styles-contentdialog",[],function(){}),d("require-style!less/colors-contentdialog",[],function(){}),d("WinJS/Controls/ContentDialog",["../Application","../Utilities/_Dispose","../_Accents","../Promise","../_Signal","../_LightDismissService","../Core/_BaseUtils","../Core/_Global","../Core/_WinRT","../Core/_Base","../Core/_Events","../Core/_ErrorFromName","../Core/_Resources","../Utilities/_Control","../Utilities/_ElementUtilities","../Utilities/_KeyboardInfo","../Utilities/_Hoverable","../Animations","require-style!less/styles-contentdialog","require-style!less/colors-contentdialog"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r){"use strict";c.createAccentRule(".win-contentdialog-dialog",[{name:"outline-color",value:c.ColorTypes.accent}]),j.Namespace.define("WinJS.UI",{ContentDialog:j.Namespace._lazy(function(){function a(a){if("undefined"==typeof u){var b=h.document.createElement("div");b.style.position="-ms-device-fixed",u="-ms-device-fixed"===o._getComputedStyle(b).position}return u}function c(a){return d._cancelBlocker(a,function(){a.cancel()})}function i(a){a.ensuredFocusedElementInView=!0,this.dialog._renderForInputPane(a.occludedRect.height)}function m(){this.dialog._clearInputPaneRendering()}function q(){}function s(a,b){a._interruptibleWorkPromises=a._interruptibleWorkPromises||[];var c=new e;a._interruptibleWorkPromises.push(b(a,c.promise)),c.complete()}function t(){(this._interruptibleWorkPromises||[]).forEach(function(a){a.cancel()})}var u,v={get duplicateConstruction(){return"Invalid argument: Controls may only be instantiated one time for each DOM element"},get controlDisposed(){return"Cannot interact with the control after it has been disposed"},get contentDialogAlreadyShowing(){return"Cannot show a ContentDialog if there is already a ContentDialog that is showing"}},w={none:"none",primary:"primary",secondary:"secondary"},x={contentDialog:"win-contentdialog",backgroundOverlay:"win-contentdialog-backgroundoverlay",dialog:"win-contentdialog-dialog",title:"win-contentdialog-title",content:"win-contentdialog-content",commands:"win-contentdialog-commands",primaryCommand:"win-contentdialog-primarycommand",secondaryCommand:"win-contentdialog-secondarycommand",_verticalAlignment:"win-contentdialog-verticalalignment",_scroller:"win-contentdialog-scroller",_column0or1:"win-contentdialog-column0or1",_visible:"win-contentdialog-visible",_tabStop:"win-contentdialog-tabstop",_commandSpacer:"win-contentdialog-commandspacer",_deviceFixedSupported:"win-contentdialog-devicefixedsupported"},y={beforeShow:"beforeshow",afterShow:"aftershow",beforeHide:"beforehide",afterHide:"afterhide"},z={Init:j.Class.define(null,{name:"Init",hidden:!0,enter:function(){var a=this.dialog;a._dismissable=new f.ModalElement({element:a._dom.root,tabIndex:a._dom.root.hasAttribute("tabIndex")?a._dom.root.tabIndex:-1,onLightDismiss:function(){a.hide(w.none)},onTakeFocus:function(b){a._dismissable.restoreFocus()||o._tryFocusOnAnyElement(a._dom.dialog,b)}}),this.dialog._dismissedSignal=null,this.dialog._setState(z.Hidden,!1)},exit:q,show:function(){throw"It's illegal to call show on the Init state"},hide:q,onCommandClicked:q,onInputPaneShown:q,onInputPaneHidden:q}),Hidden:j.Class.define(null,{name:"Hidden",hidden:!0,enter:function(a){a&&this.show()},exit:q,show:function(){var a=this.dialog._dismissedSignal=new e;return this.dialog._setState(z.BeforeShow),a.promise},hide:q,onCommandClicked:q,onInputPaneShown:q,onInputPaneHidden:q}),BeforeShow:j.Class.define(null,{name:"BeforeShow",hidden:!0,enter:function(){s(this,function(a,b){return b.then(function(){return a.dialog._fireBeforeShow()}).then(function(b){return b||a.dialog._cancelDismissalPromise(null),b}).then(function(b){b?a.dialog._setState(z.Showing):a.dialog._setState(z.Hidden,!1)})})},exit:t,show:function(){return d.wrapError(new l("WinJS.UI.ContentDialog.ContentDialogAlreadyShowing",v.contentDialogAlreadyShowing))},hide:q,onCommandClicked:q,onInputPaneShown:q,onInputPaneHidden:q}),Showing:j.Class.define(null,{name:"Showing",hidden:{get:function(){return!!this._pendingHide}},enter:function(){s(this,function(a,b){return b.then(function(){return a._pendingHide=null,o.addClass(a.dialog._dom.root,x._visible),a.dialog._addExternalListeners(),p._KeyboardInfo._visible&&a.dialog._renderForInputPane(),f.shown(a.dialog._dismissable),a.dialog._playEntranceAnimation()}).then(function(){a.dialog._fireEvent(y.afterShow)}).then(function(){a.dialog._setState(z.Shown,a._pendingHide)})})},exit:t,show:function(){if(this._pendingHide){var a=this._pendingHide.dismissalResult;return this._pendingHide=null,this.dialog._resetDismissalPromise(a,new e).promise}return d.wrapError(new l("WinJS.UI.ContentDialog.ContentDialogAlreadyShowing",v.contentDialogAlreadyShowing))},hide:function(a){this._pendingHide={dismissalResult:a}},onCommandClicked:q,onInputPaneShown:i,onInputPaneHidden:m}),Shown:j.Class.define(null,{name:"Shown",hidden:!1,enter:function(a){a&&this.hide(a.dismissalResult)},exit:q,show:function(){return d.wrapError(new l("WinJS.UI.ContentDialog.ContentDialogAlreadyShowing",v.contentDialogAlreadyShowing))},hide:function(a){this.dialog._setState(z.BeforeHide,a)},onCommandClicked:function(a){this.hide(a)},onInputPaneShown:i,onInputPaneHidden:m}),BeforeHide:j.Class.define(null,{name:"BeforeHide",hidden:!1,enter:function(a){s(this,function(b,c){return c.then(function(){return b.dialog._fireBeforeHide(a)}).then(function(c){c?b.dialog._setState(z.Hiding,a):b.dialog._setState(z.Shown,null)})})},exit:t,show:function(){return d.wrapError(new l("WinJS.UI.ContentDialog.ContentDialogAlreadyShowing",v.contentDialogAlreadyShowing))},hide:q,onCommandClicked:q,onInputPaneShown:i,onInputPaneHidden:m}),Hiding:j.Class.define(null,{name:"Hiding",hidden:{get:function(){return!this._showIsPending}},enter:function(a){s(this,function(b,c){return c.then(function(){b._showIsPending=!1,b.dialog._resetDismissalPromise(a,null)}).then(function(){return b.dialog._playExitAnimation()}).then(function(){b.dialog._removeExternalListeners(),f.hidden(b.dialog._dismissable),o.removeClass(b.dialog._dom.root,x._visible),b.dialog._clearInputPaneRendering(),b.dialog._fireAfterHide(a)}).then(function(){b.dialog._setState(z.Hidden,b._showIsPending)})})},exit:t,show:function(){return this._showIsPending?d.wrapError(new l("WinJS.UI.ContentDialog.ContentDialogAlreadyShowing",v.contentDialogAlreadyShowing)):(this._showIsPending=!0,this.dialog._dismissedSignal=new e,this.dialog._dismissedSignal.promise)},hide:function(a){this._showIsPending&&(this._showIsPending=!1,this.dialog._resetDismissalPromise(a,null))},onCommandClicked:q,onInputPaneShown:q,onInputPaneHidden:q}),Disposed:j.Class.define(null,{name:"Disposed",hidden:!0,enter:function(){f.hidden(this.dialog._dismissable),this.dialog._removeExternalListeners(),this.dialog._dismissedSignal&&this.dialog._dismissedSignal.error(new l("WinJS.UI.ContentDialog.ControlDisposed",v.controlDisposed))},exit:q,show:function(){return d.wrapError(new l("WinJS.UI.ContentDialog.ControlDisposed",v.controlDisposed))},hide:q,onCommandClicked:q,onInputPaneShown:q,onInputPaneHidden:q})},A=j.Class.define(function(a,b){if(a&&a.winControl)throw new l("WinJS.UI.ContentDialog.DuplicateConstruction",v.duplicateConstruction);b=b||{},this._onInputPaneShownBound=this._onInputPaneShown.bind(this),this._onInputPaneHiddenBound=this._onInputPaneHidden.bind(this),this._onUpdateInputPaneRenderingBound=this._onUpdateInputPaneRendering.bind(this),this._disposed=!1,this._currentFocus=null,this._rendered={registeredForResize:!1,resizedForInputPane:!1,top:"",bottom:""},this._initializeDom(a||h.document.createElement("div")),this._setState(z.Init),this.title="",this.primaryCommandText="",this.primaryCommandDisabled=!1,this.secondaryCommandText="",
this.secondaryCommandDisabled=!1,n.setOptions(this,b)},{element:{get:function(){return this._dom.root}},title:{get:function(){return this._title},set:function(a){a=a||"",this._title!==a&&(this._title=a,this._dom.title.textContent=a,this._dom.title.style.display=a?"":"none")}},primaryCommandText:{get:function(){return this._primaryCommandText},set:function(a){a=a||"",this._primaryCommandText!==a&&(this._primaryCommandText=a,this._dom.commands[0].textContent=a,this._updateCommandsUI())}},secondaryCommandText:{get:function(){return this._secondaryCommandText},set:function(a){a=a||"",this._secondaryCommandText!==a&&(this._secondaryCommandText=a,this._dom.commands[1].textContent=a,this._updateCommandsUI())}},primaryCommandDisabled:{get:function(){return this._primaryCommandDisabled},set:function(a){a=!!a,this._primaryCommandDisabled!==a&&(this._primaryCommandDisabled=a,this._dom.commands[0].disabled=a)}},secondaryCommandDisabled:{get:function(){return this._secondaryCommandDisabled},set:function(a){a=!!a,this._secondaryCommandDisabled!==a&&(this._secondaryCommandDisabled=a,this._dom.commands[1].disabled=a)}},hidden:{get:function(){return this._state.hidden},set:function(a){if(!a&&this._state.hidden){var b=function(){};this.show().done(b,b)}else a&&!this._state.hidden&&this.hide(w.none)}},dispose:function(){this._disposed||(this._setState(z.Disposed),this._disposed=!0,o._resizeNotifier.unsubscribe(this._dom.root,this._onUpdateInputPaneRenderingBound),b._disposeElement(this._dom.content))},show:function(){return this._state.show()},hide:function(a){this._state.hide(void 0===a?w.none:a)},_initializeDom:function(b){var c=h.document.createElement("div");c.className=x.content,o._reparentChildren(b,c),b.winControl=this,o.addClass(b,x.contentDialog),o.addClass(b,x._verticalAlignment),o.addClass(b,"win-disposable"),b.innerHTML='<div class="'+x.backgroundOverlay+'"></div><div class="'+x._tabStop+'"></div><div tabindex="-1" role="dialog" class="'+x.dialog+'"><h2 class="'+x.title+'" role="heading"></h2><div class="'+x._scroller+'"></div><div class="'+x.commands+'"><button type="button" class="'+x._commandSpacer+' win-button"></button><button type="button" class="'+x.primaryCommand+' win-button"></button><button type="button" class="'+x.secondaryCommand+' win-button"></button></div></div><div class="'+x._tabStop+'"></div><div class="'+x._column0or1+'"></div>';var d={};d.root=b,d.backgroundOverlay=d.root.firstElementChild,d.startBodyTab=d.backgroundOverlay.nextElementSibling,d.dialog=d.startBodyTab.nextElementSibling,d.title=d.dialog.firstElementChild,d.scroller=d.title.nextElementSibling,d.commandContainer=d.scroller.nextElementSibling,d.commandSpacer=d.commandContainer.firstElementChild,d.commands=[],d.commands.push(d.commandSpacer.nextElementSibling),d.commands.push(d.commands[0].nextElementSibling),d.endBodyTab=d.dialog.nextElementSibling,d.content=c,this._dom=d,d.scroller.appendChild(d.content),o._ensureId(d.title),o._ensureId(d.startBodyTab),o._ensureId(d.endBodyTab),d.dialog.setAttribute("aria-labelledby",d.title.id),d.startBodyTab.setAttribute("x-ms-aria-flowfrom",d.endBodyTab.id),d.endBodyTab.setAttribute("aria-flowto",d.startBodyTab.id),this._updateTabIndices(),d.root.addEventListener("keydown",this._onKeyDownEnteringElement.bind(this),!0),o._addEventListener(d.root,"pointerdown",this._onPointerDown.bind(this)),o._addEventListener(d.root,"pointerup",this._onPointerUp.bind(this)),d.root.addEventListener("click",this._onClick.bind(this)),o._addEventListener(d.startBodyTab,"focusin",this._onStartBodyTabFocusIn.bind(this)),o._addEventListener(d.endBodyTab,"focusin",this._onEndBodyTabFocusIn.bind(this)),d.commands[0].addEventListener("click",this._onCommandClicked.bind(this,w.primary)),d.commands[1].addEventListener("click",this._onCommandClicked.bind(this,w.secondary)),a()&&o.addClass(d.root,x._deviceFixedSupported)},_updateCommandsUI:function(){this._dom.commands[0].style.display=this.primaryCommandText?"":"none",this._dom.commands[1].style.display=this.secondaryCommandText?"":"none",this._dom.commandSpacer.style.display=this.primaryCommandText&&!this.secondaryCommandText||!this.primaryCommandText&&this.secondaryCommandText?"":"none"},_updateTabIndices:function(){this._updateTabIndicesThrottled||(this._updateTabIndicesThrottled=g._throttledFunction(100,this._updateTabIndicesImpl.bind(this))),this._updateTabIndicesThrottled()},_updateTabIndicesImpl:function(){var a=o._getHighAndLowTabIndices(this._dom.content);this._dom.startBodyTab.tabIndex=a.lowest,this._dom.commands[0].tabIndex=a.highest,this._dom.commands[1].tabIndex=a.highest,this._dom.endBodyTab.tabIndex=a.highest},_elementInDialog:function(a){return this._dom.dialog.contains(a)||a===this._dom.startBodyTab||a===this._dom.endBodyTab},_onCommandClicked:function(a){this._state.onCommandClicked(a)},_onPointerDown:function(a){a.stopPropagation(),this._elementInDialog(a.target)||a.preventDefault()},_onPointerUp:function(a){a.stopPropagation(),this._elementInDialog(a.target)||a.preventDefault()},_onClick:function(a){a.stopPropagation(),this._elementInDialog(a.target)||a.preventDefault()},_onKeyDownEnteringElement:function(a){a.keyCode===o.Key.tab&&this._updateTabIndices()},_onStartBodyTabFocusIn:function(){o._focusLastFocusableElement(this._dom.dialog)},_onEndBodyTabFocusIn:function(){o._focusFirstFocusableElement(this._dom.dialog)},_onInputPaneShown:function(a){this._state.onInputPaneShown(a.detail.originalEvent)},_onInputPaneHidden:function(){this._state.onInputPaneHidden()},_onUpdateInputPaneRendering:function(){this._renderForInputPane()},_setState:function(a,b){this._disposed||(this._state&&this._state.exit(),this._state=new a,this._state.dialog=this,this._state.enter(b))},_resetDismissalPromise:function(a,b){var c=this._dismissedSignal,d=this._dismissedSignal=b;return c.complete({result:a}),d},_cancelDismissalPromise:function(a){var b=this._dismissedSignal,c=this._dismissedSignal=a;return b.cancel(),c},_fireEvent:function(a,b){b=b||{};var c=b.detail||null,d=!!b.cancelable,e=h.document.createEvent("CustomEvent");return e.initCustomEvent(a,!0,d,c),this._dom.root.dispatchEvent(e)},_fireBeforeShow:function(){return this._fireEvent(y.beforeShow,{cancelable:!0})},_fireBeforeHide:function(a){return this._fireEvent(y.beforeHide,{detail:{result:a},cancelable:!0})},_fireAfterHide:function(a){this._fireEvent(y.afterHide,{detail:{result:a}})},_playEntranceAnimation:function(){return c(r.fadeIn(this._dom.root))},_playExitAnimation:function(){return c(r.fadeOut(this._dom.root))},_addExternalListeners:function(){o._inputPaneListener.addEventListener(this._dom.root,"showing",this._onInputPaneShownBound),o._inputPaneListener.addEventListener(this._dom.root,"hiding",this._onInputPaneHiddenBound)},_removeExternalListeners:function(){o._inputPaneListener.removeEventListener(this._dom.root,"showing",this._onInputPaneShownBound),o._inputPaneListener.removeEventListener(this._dom.root,"hiding",this._onInputPaneHiddenBound)},_shouldResizeForInputPane:function(){if(this._rendered.resizedForInputPane)return!0;var a=this._dom.dialog.getBoundingClientRect(),b=p._KeyboardInfo._visibleDocTop>a.top||p._KeyboardInfo._visibleDocBottom<a.bottom;return b},_renderForInputPane:function(){var a=this._rendered;if(a.registeredForResize||(o._resizeNotifier.subscribe(this._dom.root,this._onUpdateInputPaneRenderingBound),a.registeredForResize=!0),this._shouldResizeForInputPane()){var b=p._KeyboardInfo._visibleDocTop+"px",c=p._KeyboardInfo._visibleDocBottomOffset+"px";if(a.top!==b&&(this._dom.root.style.top=b,a.top=b),a.bottom!==c&&(this._dom.root.style.bottom=c,a.bottom=c),!a.resizedForInputPane){this._dom.scroller.insertBefore(this._dom.title,this._dom.content),this._dom.root.style.height="auto";var d=h.document.activeElement;d&&this._dom.scroller.contains(d)&&d.scrollIntoView(),a.resizedForInputPane=!0}}},_clearInputPaneRendering:function(){var a=this._rendered;a.registeredForResize&&(o._resizeNotifier.unsubscribe(this._dom.root,this._onUpdateInputPaneRenderingBound),a.registeredForResize=!1),""!==a.top&&(this._dom.root.style.top="",a.top=""),""!==a.bottom&&(this._dom.root.style.bottom="",a.bottom=""),a.resizedForInputPane&&(this._dom.dialog.insertBefore(this._dom.title,this._dom.scroller),this._dom.root.style.height="",a.resizedForInputPane=!1)}},{DismissalResult:w,_ClassNames:x});return j.Class.mix(A,k.createEventProperties("beforeshow","aftershow","beforehide","afterhide")),j.Class.mix(A,n.DOMEventMixin),A})})}),d("require-style!less/styles-splitview",[],function(){}),d("require-style!less/colors-splitview",[],function(){}),d("WinJS/Controls/SplitView/_SplitView",["require","exports","../../Animations","../../Core/_Base","../../Core/_BaseUtils","../../Utilities/_Control","../../Utilities/_Dispose","../../Utilities/_ElementUtilities","../../Core/_ErrorFromName","../../Core/_Events","../../Core/_Global","../../_LightDismissService","../../Utilities/_OpenCloseMachine"],function(a,b,c,d,e,f,g,h,i,j,k,l,m){function n(a,b){b&&h.addClass(a,b)}function o(a,b){b&&h.removeClass(a,b)}function p(a,b){return b===u.width?{content:a.contentWidth,total:a.totalWidth}:{content:a.contentHeight,total:a.totalHeight}}a(["require-style!less/styles-splitview"]),a(["require-style!less/colors-splitview"]);var q=e._browserStyleEquivalents.transform,r={get duplicateConstruction(){return"Invalid argument: Controls may only be instantiated one time for each DOM element"}},s={splitView:"win-splitview",pane:"win-splitview-pane",content:"win-splitview-content",paneClosed:"win-splitview-pane-closed",paneOpened:"win-splitview-pane-opened",_panePlaceholder:"win-splitview-paneplaceholder",_paneOutline:"win-splitview-paneoutline",_tabStop:"win-splitview-tabstop",_paneWrapper:"win-splitview-panewrapper",_contentWrapper:"win-splitview-contentwrapper",_animating:"win-splitview-animating",_placementLeft:"win-splitview-placementleft",_placementRight:"win-splitview-placementright",_placementTop:"win-splitview-placementtop",_placementBottom:"win-splitview-placementbottom",_closedDisplayNone:"win-splitview-closeddisplaynone",_closedDisplayInline:"win-splitview-closeddisplayinline",_openedDisplayInline:"win-splitview-openeddisplayinline",_openedDisplayOverlay:"win-splitview-openeddisplayoverlay"},t={beforeOpen:"beforeopen",afterOpen:"afteropen",beforeClose:"beforeclose",afterClose:"afterclose"},u={width:"width",height:"height"},v={none:"none",inline:"inline"},w={inline:"inline",overlay:"overlay"},x={left:"left",right:"right",top:"top",bottom:"bottom"},y={};y[v.none]=s._closedDisplayNone,y[v.inline]=s._closedDisplayInline;var z={};z[w.overlay]=s._openedDisplayOverlay,z[w.inline]=s._openedDisplayInline;var A={};A[x.left]=s._placementLeft,A[x.right]=s._placementRight,A[x.top]=s._placementTop,A[x.bottom]=s._placementBottom;var B=function(){function a(a,b){var c=this;if(void 0===b&&(b={}),this._updateDomImpl_rendered={paneIsFirst:void 0,isOpenedMode:void 0,closedDisplayMode:void 0,openedDisplayMode:void 0,panePlacement:void 0,panePlaceholderWidth:void 0,panePlaceholderHeight:void 0,isOverlayShown:void 0,startPaneTabIndex:void 0,endPaneTabIndex:void 0},a&&a.winControl)throw new i("WinJS.UI.SplitView.DuplicateConstruction",r.duplicateConstruction);this._initializeDom(a||k.document.createElement("div")),this._machine=new m.OpenCloseMachine({eventElement:this._dom.root,onOpen:function(){c._cachedHiddenPaneThickness=null;var a=c._getHiddenPaneThickness();return c._isOpenedMode=!0,c._updateDomImpl(),h.addClass(c._dom.root,s._animating),c._playShowAnimation(a).then(function(){h.removeClass(c._dom.root,s._animating)})},onClose:function(){return h.addClass(c._dom.root,s._animating),c._playHideAnimation(c._getHiddenPaneThickness()).then(function(){h.removeClass(c._dom.root,s._animating),c._isOpenedMode=!1,c._updateDomImpl()})},onUpdateDom:function(){c._updateDomImpl()},onUpdateDomWithIsOpened:function(a){c._isOpenedMode=a,c._updateDomImpl()}}),this._disposed=!1,this._dismissable=new l.LightDismissableElement({element:this._dom.paneWrapper,tabIndex:-1,onLightDismiss:function(){c.closePane()},onTakeFocus:function(a){c._dismissable.restoreFocus()||h._tryFocusOnAnyElement(c._dom.pane,a)}}),this._cachedHiddenPaneThickness=null,this.paneOpened=!1,this.closedDisplayMode=v.inline,this.openedDisplayMode=w.overlay,this.panePlacement=x.left,f.setOptions(this,b),h._inDom(this._dom.root).then(function(){c._rtl="rtl"===h._getComputedStyle(c._dom.root).direction,c._updateTabIndices(),c._machine.exitInit()})}return Object.defineProperty(a.prototype,"element",{get:function(){return this._dom.root},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"paneElement",{get:function(){return this._dom.pane},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"contentElement",{get:function(){return this._dom.content},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"closedDisplayMode",{get:function(){return this._closedDisplayMode},set:function(a){v[a]&&this._closedDisplayMode!==a&&(this._closedDisplayMode=a,this._cachedHiddenPaneThickness=null,this._machine.updateDom())},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"openedDisplayMode",{get:function(){return this._openedDisplayMode},set:function(a){w[a]&&this._openedDisplayMode!==a&&(this._openedDisplayMode=a,this._cachedHiddenPaneThickness=null,this._machine.updateDom())},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"panePlacement",{get:function(){return this._panePlacement},set:function(a){x[a]&&this._panePlacement!==a&&(this._panePlacement=a,this._cachedHiddenPaneThickness=null,this._machine.updateDom())},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"paneOpened",{get:function(){return this._machine.opened},set:function(a){this._machine.opened=a},enumerable:!0,configurable:!0}),a.prototype.dispose=function(){this._disposed||(this._disposed=!0,this._machine.dispose(),l.hidden(this._dismissable),g._disposeElement(this._dom.pane),g._disposeElement(this._dom.content))},a.prototype.openPane=function(){this._machine.open()},a.prototype.closePane=function(){this._machine.close()},a.prototype._initializeDom=function(a){var b=a.firstElementChild||k.document.createElement("div");h.addClass(b,s.pane),b.hasAttribute("tabIndex")||(b.tabIndex=-1);var c=k.document.createElement("div");h.addClass(c,s.content);for(var d=b.nextSibling;d;){var e=d.nextSibling;c.appendChild(d),d=e}var f=k.document.createElement("div");f.className=s._tabStop,h._ensureId(f);var g=k.document.createElement("div");g.className=s._tabStop,h._ensureId(g);var i=k.document.createElement("div");i.className=s._paneOutline;var j=k.document.createElement("div");j.className=s._paneWrapper,j.appendChild(f),j.appendChild(b),j.appendChild(i),j.appendChild(g);var l=k.document.createElement("div");l.className=s._panePlaceholder;var m=k.document.createElement("div");m.className=s._contentWrapper,m.appendChild(c),a.winControl=this,h.addClass(a,s.splitView),h.addClass(a,"win-disposable"),this._dom={root:a,pane:b,startPaneTab:f,endPaneTab:g,paneOutline:i,paneWrapper:j,panePlaceholder:l,content:c,contentWrapper:m},h._addEventListener(b,"keydown",this._onKeyDown.bind(this)),h._addEventListener(f,"focusin",this._onStartPaneTabFocusIn.bind(this)),h._addEventListener(g,"focusin",this._onEndPaneTabFocusIn.bind(this))},a.prototype._onKeyDown=function(a){a.keyCode===h.Key.tab&&this._updateTabIndices()},a.prototype._onStartPaneTabFocusIn=function(a){h._focusLastFocusableElement(this._dom.pane)},a.prototype._onEndPaneTabFocusIn=function(a){h._focusFirstFocusableElement(this._dom.pane)},a.prototype._measureElement=function(a){var b=h._getComputedStyle(a),c=h._getPositionRelativeTo(a,this._dom.root),d=parseInt(b.marginLeft,10),e=parseInt(b.marginTop,10);return{left:c.left-d,top:c.top-e,contentWidth:h.getContentWidth(a),contentHeight:h.getContentHeight(a),totalWidth:h.getTotalWidth(a),totalHeight:h.getTotalHeight(a)}},a.prototype._setContentRect=function(a){var b=this._dom.contentWrapper.style;b.left=a.left+"px",b.top=a.top+"px",b.height=a.contentHeight+"px",b.width=a.contentWidth+"px"},a.prototype._prepareAnimation=function(a,b){var c=this._dom.paneWrapper.style;c.position="absolute",c.left=a.left+"px",c.top=a.top+"px",c.height=a.totalHeight+"px",c.width=a.totalWidth+"px";var d=this._dom.contentWrapper.style;d.position="absolute",this._setContentRect(b)},a.prototype._clearAnimation=function(){var a=this._dom.paneWrapper.style;a.position="",a.left="",a.top="",a.height="",a.width="",a[q.scriptName]="";var b=this._dom.contentWrapper.style;b.position="",b.left="",b.top="",b.height="",b.width="",b[q.scriptName]="";var c=this._dom.pane.style;c.height="",c.width="",c[q.scriptName]=""},a.prototype._getHiddenContentRect=function(a,b,c){if(this.openedDisplayMode===w.overlay)return a;var d=this._rtl?x.left:x.right,e=this.panePlacement===d||this.panePlacement===x.bottom?0:1,f={content:c.content-b.content,total:c.total-b.total};return this._horizontal?{left:a.left-e*f.total,top:a.top,contentWidth:a.contentWidth+f.content,contentHeight:a.contentHeight,totalWidth:a.totalWidth+f.total,totalHeight:a.totalHeight}:{left:a.left,top:a.top-e*f.total,contentWidth:a.contentWidth,contentHeight:a.contentHeight+f.content,totalWidth:a.totalWidth,totalHeight:a.totalHeight+f.total}},Object.defineProperty(a.prototype,"_horizontal",{get:function(){return this.panePlacement===x.left||this.panePlacement===x.right},enumerable:!0,configurable:!0}),a.prototype._getHiddenPaneThickness=function(){if(null===this._cachedHiddenPaneThickness)if(this._closedDisplayMode===v.none)this._cachedHiddenPaneThickness={content:0,total:0};else{this._isOpenedMode&&(h.removeClass(this._dom.root,s.paneOpened),h.addClass(this._dom.root,s.paneClosed));var a=this._measureElement(this._dom.pane);this._cachedHiddenPaneThickness=p(a,this._horizontal?u.width:u.height),this._isOpenedMode&&(h.removeClass(this._dom.root,s.paneClosed),h.addClass(this._dom.root,s.paneOpened))}return this._cachedHiddenPaneThickness},a.prototype._playShowAnimation=function(a){var b=this,d=this._horizontal?u.width:u.height,e=this._measureElement(this._dom.pane),f=this._measureElement(this._dom.content),g=p(e,d),h=this._getHiddenContentRect(f,a,g);this._prepareAnimation(e,h);var i=function(){var e=b._rtl?x.left:x.right,f=.3,h=a.total+f*(g.total-a.total);return c._resizeTransition(b._dom.paneWrapper,b._dom.pane,{from:h,to:g.total,actualSize:g.total,dimension:d,anchorTrailingEdge:b.panePlacement===e||b.panePlacement===x.bottom})},j=function(){return b.openedDisplayMode===w.inline&&b._setContentRect(f),i()};return j().then(function(){b._clearAnimation()})},a.prototype._playHideAnimation=function(a){var b=this,d=this._horizontal?u.width:u.height,e=this._measureElement(this._dom.pane),f=this._measureElement(this._dom.content),g=p(e,d),h=this._getHiddenContentRect(f,a,g);this._prepareAnimation(e,f);var i=function(){var e=b._rtl?x.left:x.right,f=.3,h=g.total-f*(g.total-a.total);return c._resizeTransition(b._dom.paneWrapper,b._dom.pane,{from:h,to:a.total,actualSize:g.total,dimension:d,anchorTrailingEdge:b.panePlacement===e||b.panePlacement===x.bottom})},j=function(){return b.openedDisplayMode===w.inline&&b._setContentRect(h),i()};return j().then(function(){b._clearAnimation()})},a.prototype._updateTabIndices=function(){this._updateTabIndicesThrottled||(this._updateTabIndicesThrottled=e._throttledFunction(100,this._updateTabIndicesImpl.bind(this))),this._updateTabIndicesThrottled()},a.prototype._updateTabIndicesImpl=function(){var a=h._getHighAndLowTabIndices(this._dom.pane);this._highestPaneTabIndex=a.highest,this._lowestPaneTabIndex=a.lowest,this._machine.updateDom()},a.prototype._updateDomImpl=function(){var a=this._updateDomImpl_rendered,b=this.panePlacement===x.left||this.panePlacement===x.top;b!==a.paneIsFirst&&(b?(this._dom.root.appendChild(this._dom.panePlaceholder),this._dom.root.appendChild(this._dom.paneWrapper),this._dom.root.appendChild(this._dom.contentWrapper)):(this._dom.root.appendChild(this._dom.contentWrapper),this._dom.root.appendChild(this._dom.paneWrapper),this._dom.root.appendChild(this._dom.panePlaceholder))),a.paneIsFirst=b,a.isOpenedMode!==this._isOpenedMode&&(this._isOpenedMode?(h.removeClass(this._dom.root,s.paneClosed),h.addClass(this._dom.root,s.paneOpened)):(h.removeClass(this._dom.root,s.paneOpened),h.addClass(this._dom.root,s.paneClosed))),a.isOpenedMode=this._isOpenedMode,a.panePlacement!==this.panePlacement&&(o(this._dom.root,A[a.panePlacement]),n(this._dom.root,A[this.panePlacement]),a.panePlacement=this.panePlacement),a.closedDisplayMode!==this.closedDisplayMode&&(o(this._dom.root,y[a.closedDisplayMode]),n(this._dom.root,y[this.closedDisplayMode]),a.closedDisplayMode=this.closedDisplayMode),a.openedDisplayMode!==this.openedDisplayMode&&(o(this._dom.root,z[a.openedDisplayMode]),n(this._dom.root,z[this.openedDisplayMode]),a.openedDisplayMode=this.openedDisplayMode);var c=this._isOpenedMode&&this.openedDisplayMode===w.overlay,d=c?this._lowestPaneTabIndex:-1,e=c?this._highestPaneTabIndex:-1;a.startPaneTabIndex!==d&&(this._dom.startPaneTab.tabIndex=d,-1===d?this._dom.startPaneTab.removeAttribute("x-ms-aria-flowfrom"):this._dom.startPaneTab.setAttribute("x-ms-aria-flowfrom",this._dom.endPaneTab.id),a.startPaneTabIndex=d),a.endPaneTabIndex!==e&&(this._dom.endPaneTab.tabIndex=e,-1===e?this._dom.endPaneTab.removeAttribute("aria-flowto"):this._dom.endPaneTab.setAttribute("aria-flowto",this._dom.startPaneTab.id),a.endPaneTabIndex=e);var f,g;if(c){var i=this._getHiddenPaneThickness();this._horizontal?(f=i.total+"px",g=""):(f="",g=i.total+"px")}else f="",g="";if(a.panePlaceholderWidth!==f||a.panePlaceholderHeight!==g){var j=this._dom.panePlaceholder.style;j.width=f,j.height=g,a.panePlaceholderWidth=f,a.panePlaceholderHeight=g}a.isOverlayShown!==c&&(c?l.shown(this._dismissable):l.hidden(this._dismissable),a.isOverlayShown=c)},a.ClosedDisplayMode=v,a.OpenedDisplayMode=w,a.PanePlacement=x,a.supportedForProcessing=!0,a._ClassNames=s,a}();b.SplitView=B,d.Class.mix(B,j.createEventProperties(t.beforeOpen,t.afterOpen,t.beforeClose,t.afterClose)),d.Class.mix(B,f.DOMEventMixin)}),d("WinJS/Controls/SplitView",["require","exports","../Core/_Base"],function(a,b,c){var d=null;c.Namespace.define("WinJS.UI",{SplitView:{get:function(){return d||a(["./SplitView/_SplitView"],function(a){d=a}),d.SplitView}}})}),d("require-style!less/styles-splitviewpanetoggle",[],function(){}),d("require-style!less/colors-splitviewpanetoggle",[],function(){}),d("WinJS/Controls/SplitViewPaneToggle/_SplitViewPaneToggle",["require","exports","../../Core/_Base","../../Utilities/_Control","../../Utilities/_ElementUtilities","../../Core/_ErrorFromName","../../Core/_Events","../../Core/_Global","../../Utilities/_KeyboardBehavior","../../Utilities/_Hoverable"],function(a,b,c,d,e,f,g,h,i,j){function k(a){return a&&a.winControl}function l(a){var b=k(a);return b?b.paneOpened:!1}j.isHoverable,a(["require-style!less/styles-splitviewpanetoggle"]),a(["require-style!less/colors-splitviewpanetoggle"]);var m={splitViewPaneToggle:"win-splitviewpanetoggle"},n={invoked:"invoked"},o={get duplicateConstruction(){return"Invalid argument: Controls may only be instantiated one time for each DOM element"},get badButtonElement(){return"Invalid argument: The SplitViewPaneToggle's element must be a button element"}},p=function(){function a(a,b){if(void 0===b&&(b={}),this._updateDom_rendered={splitView:void 0},a&&a.winControl)throw new f("WinJS.UI.SplitViewPaneToggle.DuplicateConstruction",o.duplicateConstruction);this._onPaneStateSettledBound=this._onPaneStateSettled.bind(this),this._ariaExpandedMutationObserver=new e._MutationObserver(this._onAriaExpandedPropertyChanged.bind(this)),this._initializeDom(a||h.document.createElement("button")),this._disposed=!1,this.splitView=null,d.setOptions(this,b),this._initialized=!0,this._updateDom()}return Object.defineProperty(a.prototype,"element",{get:function(){return this._dom.root},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"splitView",{get:function(){return this._splitView},set:function(a){this._splitView=a,a&&(this._opened=l(a)),this._updateDom()},enumerable:!0,configurable:!0}),a.prototype.dispose=function(){this._disposed||(this._disposed=!0,this._splitView&&this._removeListeners(this._splitView))},a.prototype._initializeDom=function(a){if("BUTTON"!==a.tagName)throw new f("WinJS.UI.SplitViewPaneToggle.BadButtonElement",o.badButtonElement);a.winControl=this,e.addClass(a,m.splitViewPaneToggle),e.addClass(a,"win-disposable"),a.hasAttribute("type")||(a.type="button"),new i._WinKeyboard(a),a.addEventListener("click",this._onClick.bind(this)),this._dom={root:a}},a.prototype._updateDom=function(){if(this._initialized&&!this._disposed){var a=this._updateDom_rendered;if(this._splitView!==a.splitView&&(a.splitView&&(this._dom.root.removeAttribute("aria-controls"),this._removeListeners(a.splitView)),this._splitView&&(e._ensureId(this._splitView),this._dom.root.setAttribute("aria-controls",this._splitView.id),this._addListeners(this._splitView)),a.splitView=this._splitView),this._splitView){var b=this._opened?"true":"false";e._setAttribute(this._dom.root,"aria-expanded",b);var c=k(this._splitView);c&&(c.paneOpened=this._opened)}}},a.prototype._addListeners=function(a){a.addEventListener("_openCloseStateSettled",this._onPaneStateSettledBound),this._ariaExpandedMutationObserver.observe(this._dom.root,{attributes:!0,attributeFilter:["aria-expanded"]})},a.prototype._removeListeners=function(a){a.removeEventListener("_openCloseStateSettled",this._onPaneStateSettledBound),this._ariaExpandedMutationObserver.disconnect()},a.prototype._fireEvent=function(a){var b=h.document.createEvent("CustomEvent");return b.initCustomEvent(a,!0,!1,null),this._dom.root.dispatchEvent(b)},a.prototype._onPaneStateSettled=function(a){a.target===this._splitView&&(this._opened=l(this._splitView),this._updateDom())},a.prototype._onAriaExpandedPropertyChanged=function(a){var b="true"===this._dom.root.getAttribute("aria-expanded");this._opened=b,this._updateDom()},a.prototype._onClick=function(a){this._invoked()},a.prototype._invoked=function(){this._disposed||(this._splitView&&(this._opened=!this._opened,this._updateDom()),this._fireEvent(n.invoked))},a._ClassNames=m,a.supportedForProcessing=!0,a}();b.SplitViewPaneToggle=p,c.Class.mix(p,g.createEventProperties(n.invoked)),c.Class.mix(p,d.DOMEventMixin)}),d("WinJS/Controls/SplitViewPaneToggle",["require","exports","../Core/_Base"],function(a,b,c){var d=null;c.Namespace.define("WinJS.UI",{SplitViewPaneToggle:{get:function(){return d||a(["./SplitViewPaneToggle/_SplitViewPaneToggle"],function(a){d=a}),d.SplitViewPaneToggle}}})}),d("WinJS/Controls/AppBar/_Constants",["require","exports","../CommandingSurface/_Constants"],function(a,b,c){b.ClassNames={controlCssClass:"win-appbar",disposableCssClass:"win-disposable",actionAreaCssClass:"win-appbar-actionarea",overflowButtonCssClass:"win-appbar-overflowbutton",spacerCssClass:"win-appbar-spacer",ellipsisCssClass:"win-appbar-ellipsis",overflowAreaCssClass:"win-appbar-overflowarea",contentFlyoutCssClass:"win-appbar-contentflyout",emptyappbarCssClass:"win-appbar-empty",menuCssClass:"win-menu",menuContainsToggleCommandClass:"win-menu-containstogglecommand",openedClass:"win-appbar-opened",closedClass:"win-appbar-closed",noneClass:"win-appbar-closeddisplaynone",minimalClass:"win-appbar-closeddisplayminimal",compactClass:"win-appbar-closeddisplaycompact",fullClass:"win-appbar-closeddisplayfull",placementTopClass:"win-appbar-top",placementBottomClass:"win-appbar-bottom"},b.EventNames={beforeOpen:"beforeopen",afterOpen:"afteropen",beforeClose:"beforeclose",afterClose:"afterclose",commandPropertyMutated:"_commandpropertymutated"},b.controlMinWidth=c.controlMinWidth,b.defaultClosedDisplayMode="compact",b.defaultOpened=!1,b.defaultPlacement="bottom",b.typeSeparator="separator",b.typeContent="content",b.typeButton="button",b.typeToggle="toggle",b.typeFlyout="flyout",b.commandSelector=".win-command",b.primaryCommandSection="primary",b.secondaryCommandSection="secondary"}),d("require-style!less/styles-appbar",[],function(){}),d("WinJS/Controls/AppBar/_AppBar",["require","exports","../../Core/_Base","../AppBar/_Constants","../CommandingSurface","../../Utilities/_Control","../../Utilities/_Dispose","../../Utilities/_ElementUtilities","../../Core/_ErrorFromName","../../Core/_Events","../../Core/_Global","../../Utilities/_KeyboardInfo","../../_LightDismissService","../../Promise","../../Core/_Resources","../../Utilities/_OpenCloseMachine","../../Core/_WriteProfilerMark"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q){function r(a,b){b&&h.addClass(a,b)}function s(a,b){b&&h.removeClass(a,b)}a(["require-style!less/styles-appbar"]);var t=l._KeyboardInfo,u={get ariaLabel(){return o._getWinJSString("ui/appBarAriaLabel").value},get overflowButtonAriaLabel(){return o._getWinJSString("ui/appBarOverflowButtonAriaLabel").value},get mustContainCommands(){return"The AppBar can only contain WinJS.UI.Command or WinJS.UI.AppBarCommand controls"},get duplicateConstruction(){return"Invalid argument: Controls may only be instantiated one time for each DOM element"}},v={none:"none",minimal:"minimal",compact:"compact",full:"full"},w={};w[v.none]=d.ClassNames.noneClass,w[v.minimal]=d.ClassNames.minimalClass,w[v.compact]=d.ClassNames.compactClass,w[v.full]=d.ClassNames.fullClass;var x={top:"top",bottom:"bottom"},y={};y[x.top]=d.ClassNames.placementTopClass,y[x.bottom]=d.ClassNames.placementBottomClass;var z=function(){function a(b,c){var g=this;if(void 0===c&&(c={}),this._updateDomImpl_renderedState={isOpenedMode:void 0,placement:void 0,closedDisplayMode:void 0,adjustedOffsets:{top:void 0,bottom:void 0}},this._writeProfilerMark("constructor,StartTM"),b&&b.winControl)throw new i("WinJS.UI.AppBar.DuplicateConstruction",u.duplicateConstruction);this._initializeDom(b||k.document.createElement("div"));var j=new p.OpenCloseMachine({eventElement:this.element,onOpen:function(){var b=g._commandingSurface.createOpenAnimation(g._getClosedHeight());return g.element.style.position="fixed",g._placement===a.Placement.top?g.element.style.top=l._KeyboardInfo._layoutViewportCoords.visibleDocTop+"px":g.element.style.bottom=l._KeyboardInfo._layoutViewportCoords.visibleDocBottom+"px",g._synchronousOpen(),b.execute().then(function(){g.element.style.position="",g.element.style.top=g._adjustedOffsets.top,g.element.style.bottom=g._adjustedOffsets.bottom})},onClose:function(){var b=g._commandingSurface.createCloseAnimation(g._getClosedHeight());return g.element.style.position="fixed",g._placement===a.Placement.top?g.element.style.top=l._KeyboardInfo._layoutViewportCoords.visibleDocTop+"px":g.element.style.bottom=l._KeyboardInfo._layoutViewportCoords.visibleDocBottom+"px",b.execute().then(function(){g._synchronousClose(),g.element.style.position="",g.element.style.top=g._adjustedOffsets.top,g.element.style.bottom=g._adjustedOffsets.bottom})},onUpdateDom:function(){g._updateDomImpl()},onUpdateDomWithIsOpened:function(a){g._isOpenedMode=a,g._updateDomImpl()}});this._handleShowingKeyboardBound=this._handleShowingKeyboard.bind(this),this._handleHidingKeyboardBound=this._handleHidingKeyboard.bind(this),h._inputPaneListener.addEventListener(this._dom.root,"showing",this._handleShowingKeyboardBound),h._inputPaneListener.addEventListener(this._dom.root,"hiding",this._handleHidingKeyboardBound),this._disposed=!1,this._cachedClosedHeight=null,this._commandingSurface=new e._CommandingSurface(this._dom.commandingSurfaceEl,{openCloseMachine:j}),r(this._dom.commandingSurfaceEl.querySelector(".win-commandingsurface-actionarea"),d.ClassNames.actionAreaCssClass),r(this._dom.commandingSurfaceEl.querySelector(".win-commandingsurface-overflowarea"),d.ClassNames.overflowAreaCssClass),r(this._dom.commandingSurfaceEl.querySelector(".win-commandingsurface-overflowbutton"),d.ClassNames.overflowButtonCssClass),r(this._dom.commandingSurfaceEl.querySelector(".win-commandingsurface-ellipsis"),d.ClassNames.ellipsisCssClass),
this._isOpenedMode=d.defaultOpened,this._dismissable=new m.LightDismissableElement({element:this._dom.root,tabIndex:this._dom.root.hasAttribute("tabIndex")?this._dom.root.tabIndex:-1,onLightDismiss:function(){g.close()},onTakeFocus:function(a){g._dismissable.restoreFocus()||g._commandingSurface.takeFocus(a)}}),this.closedDisplayMode=d.defaultClosedDisplayMode,this.placement=d.defaultPlacement,this.opened=this._isOpenedMode,f.setOptions(this,c),h._inDom(this.element).then(function(){return g._commandingSurface.initialized}).then(function(){j.exitInit(),g._writeProfilerMark("constructor,StopTM")})}return Object.defineProperty(a.prototype,"element",{get:function(){return this._dom.root},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"data",{get:function(){return this._commandingSurface.data},set:function(a){this._commandingSurface.data=a},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"closedDisplayMode",{get:function(){return this._commandingSurface.closedDisplayMode},set:function(a){v[a]&&(this._commandingSurface.closedDisplayMode=a,this._cachedClosedHeight=null)},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"placement",{get:function(){return this._placement},set:function(a){if(x[a]&&this._placement!==a){switch(this._placement=a,a){case x.top:this._commandingSurface.overflowDirection="bottom";break;case x.bottom:this._commandingSurface.overflowDirection="top"}this._adjustedOffsets=this._computeAdjustedOffsets(),this._commandingSurface.deferredDomUpate()}},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"opened",{get:function(){return this._commandingSurface.opened},set:function(a){this._commandingSurface.opened=a},enumerable:!0,configurable:!0}),a.prototype.open=function(){this._commandingSurface.open()},a.prototype.close=function(){this._commandingSurface.close()},a.prototype.dispose=function(){this._disposed||(this._disposed=!0,m.hidden(this._dismissable),this._commandingSurface.dispose(),h._inputPaneListener.removeEventListener(this._dom.root,"showing",this._handleShowingKeyboardBound),h._inputPaneListener.removeEventListener(this._dom.root,"hiding",this._handleHidingKeyboardBound),g.disposeSubTree(this.element))},a.prototype.forceLayout=function(){this._commandingSurface.forceLayout()},a.prototype.getCommandById=function(a){return this._commandingSurface.getCommandById(a)},a.prototype.showOnlyCommands=function(a){return this._commandingSurface.showOnlyCommands(a)},a.prototype._writeProfilerMark=function(a){q("WinJS.UI.AppBar:"+this._id+":"+a)},a.prototype._initializeDom=function(a){this._writeProfilerMark("_intializeDom,info"),a.winControl=this,this._id=a.id||h._uniqueID(a),h.addClass(a,d.ClassNames.controlCssClass),h.addClass(a,d.ClassNames.disposableCssClass);var b=a.getAttribute("role");b||a.setAttribute("role","menubar");var c=a.getAttribute("aria-label");c||a.setAttribute("aria-label",u.ariaLabel);var e=document.createElement("DIV");h._reparentChildren(a,e),a.appendChild(e),this._dom={root:a,commandingSurfaceEl:e}},a.prototype._handleShowingKeyboard=function(a){var b=this;if(this._dom.root.contains(k.document.activeElement)){var c=a.detail.originalEvent;c.ensuredFocusedElementInView=!0}var d=t._animationShowLength+t._scrollTimeout;return n.timeout(d).then(function(){b._shouldAdjustForShowingKeyboard()&&!b._disposed&&(b._adjustedOffsets=b._computeAdjustedOffsets(),b._commandingSurface.deferredDomUpate())})},a.prototype._shouldAdjustForShowingKeyboard=function(){return t._visible&&!t._isResized},a.prototype._handleHidingKeyboard=function(){this._adjustedOffsets=this._computeAdjustedOffsets(),this._commandingSurface.deferredDomUpate()},a.prototype._computeAdjustedOffsets=function(){var a={top:"",bottom:""};return this._placement===x.bottom?a.bottom=t._visibleDocBottomOffset+"px":this._placement===x.top&&(a.top=t._visibleDocTop+"px"),a},a.prototype._synchronousOpen=function(){this._isOpenedMode=!0,this._updateDomImpl()},a.prototype._synchronousClose=function(){this._isOpenedMode=!1,this._updateDomImpl()},a.prototype._updateDomImpl=function(){var a=this._updateDomImpl_renderedState;a.isOpenedMode!==this._isOpenedMode&&(this._isOpenedMode?this._updateDomImpl_renderOpened():this._updateDomImpl_renderClosed(),a.isOpenedMode=this._isOpenedMode),a.placement!==this.placement&&(s(this._dom.root,y[a.placement]),r(this._dom.root,y[this.placement]),a.placement=this.placement),a.closedDisplayMode!==this.closedDisplayMode&&(s(this._dom.root,w[a.closedDisplayMode]),r(this._dom.root,w[this.closedDisplayMode]),a.closedDisplayMode=this.closedDisplayMode),a.adjustedOffsets.top!==this._adjustedOffsets.top&&(this._dom.root.style.top=this._adjustedOffsets.top,a.adjustedOffsets.top=this._adjustedOffsets.top),a.adjustedOffsets.bottom!==this._adjustedOffsets.bottom&&(this._dom.root.style.bottom=this._adjustedOffsets.bottom,a.adjustedOffsets.bottom=this._adjustedOffsets.bottom),this._commandingSurface.updateDom()},a.prototype._getClosedHeight=function(){if(null===this._cachedClosedHeight){var a=this._isOpenedMode;this._isOpenedMode&&this._synchronousClose(),this._cachedClosedHeight=this._commandingSurface.getBoundingRects().commandingSurface.height,a&&this._synchronousOpen()}return this._cachedClosedHeight},a.prototype._updateDomImpl_renderOpened=function(){r(this._dom.root,d.ClassNames.openedClass),s(this._dom.root,d.ClassNames.closedClass),this._commandingSurface.synchronousOpen(),m.shown(this._dismissable)},a.prototype._updateDomImpl_renderClosed=function(){r(this._dom.root,d.ClassNames.closedClass),s(this._dom.root,d.ClassNames.openedClass),this._commandingSurface.synchronousClose(),m.hidden(this._dismissable)},a.ClosedDisplayMode=v,a.Placement=x,a.supportedForProcessing=!0,a}();b.AppBar=z,c.Class.mix(z,j.createEventProperties(d.EventNames.beforeOpen,d.EventNames.afterOpen,d.EventNames.beforeClose,d.EventNames.afterClose)),c.Class.mix(z,f.DOMEventMixin)}),d("WinJS/Controls/AppBar",["require","exports","../Core/_Base"],function(a,b,c){var d=null;c.Namespace.define("WinJS.UI",{AppBar:{get:function(){return d||a(["./AppBar/_AppBar"],function(a){d=a}),d.AppBar}}})}),d("ui",["WinJS/Core/_WinJS","WinJS/VirtualizedDataSource","WinJS/Vui","WinJS/Controls/IntrinsicControls","WinJS/Controls/ListView","WinJS/Controls/FlipView","WinJS/Controls/ItemContainer","WinJS/Controls/Repeater","WinJS/Controls/DatePicker","WinJS/Controls/TimePicker","WinJS/Controls/BackButton","WinJS/Controls/Rating","WinJS/Controls/ToggleSwitch","WinJS/Controls/SemanticZoom","WinJS/Controls/Pivot","WinJS/Controls/Hub","WinJS/Controls/Flyout","WinJS/Controls/_LegacyAppBar","WinJS/Controls/Menu","WinJS/Controls/SearchBox","WinJS/Controls/SettingsFlyout","WinJS/Controls/NavBar","WinJS/Controls/Tooltip","WinJS/Controls/ViewBox","WinJS/Controls/ContentDialog","WinJS/Controls/SplitView","WinJS/Controls/SplitViewPaneToggle","WinJS/Controls/SplitView/Command","WinJS/Controls/ToolBar","WinJS/Controls/AppBar"],function(a){"use strict";return a}),c(["WinJS/Core/_WinJS","ui"],function(b){a.WinJS=b,"undefined"!=typeof module&&(module.exports=b)}),a.WinJS})}();
//# sourceMappingURL=ui.min.js.map |
demo15/index.js | bjtqti/how_to_use_webpack | import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
ReactDOM.render(<App />, document.getElementById('root'));
|
app/containers/LogInPage/index.js | Frizi/amciu | /*
*
* LogInPage
*
*/
import React from 'react';
import { connect } from 'react-redux';
import Helmet from 'react-helmet';
import { FormattedMessage } from 'react-intl';
import messages from './messages';
import styles from './styles.scss';
export class LogInPage extends React.Component { // eslint-disable-line react/prefer-stateless-function
render() {
return (
<div className={styles.logInPage}>
<Helmet
title="LogInPage"
meta={[
{ name: 'description', content: 'AmciuApp - log in' },
]}
/>
<div className={styles.message}>
<FormattedMessage {...messages.header} />
</div>
</div>
);
}
}
function mapDispatchToProps(dispatch) {
return {
dispatch,
};
}
export default connect(null, mapDispatchToProps)(LogInPage);
|
src/components/__tests__/Calendar-test.js | mxenabled/mx-react-components | import React from 'react'; // eslint-disable-line no-unused-vars
import { mount } from 'enzyme';
import moment from 'moment';
import { getNewDateStateChange } from '../Calendar';
import Calendar from '../Calendar';
describe('Calendar', () => {
let wrapper;
beforeEach(() => {
const theme = {
Colors: {},
Fonts: {},
FontSizes: {},
Spacing: {}
};
const mockCallback = jest.fn();
wrapper = mount(
<Calendar
onDateSelect={mockCallback}
selectedDate={1533124800}
theme={theme}
/>
);
});
describe('rendering', () => {
it('should mount and render 35 calendar days', () => {
expect(wrapper.find('.calendar-day')).toHaveLength(35);
});
it('should only render one focused day', () => {
expect(wrapper.find('#focused-day')).toHaveLength(1);
});
});
describe('getNewDateStateChange', () => {
const focusedDay = moment('2018-01-17');
const startDate = moment('2018-01-17').startOf('month').startOf('week');
const endDate = moment('2018-01-17').endOf('month').endOf('week');
it('should return an object with a focusedDay key when right key is pressed', () => {
const result = {
focusedDay: moment(focusedDay).add(1, 'days').startOf('day').unix()
};
expect(getNewDateStateChange({ code: 'right', focusedDay, startDate, endDate })).toEqual(result);
});
it('should return an object with a focusedDay key and a currentDate key when right key is pressed and newDate is outside of start and end date bounds', () => {
const result = {
focusedDay: moment(focusedDay).add(1, 'days').startOf('day').unix(),
currentDate: moment(focusedDay).add(1, 'days').startOf('day').unix()
};
//deliberately set to be out of range
const endDate = moment(focusedDay).clone();
expect(getNewDateStateChange({ code: 'right', focusedDay, startDate, endDate })).toEqual(result);
});
it('should return an object with a focusedDay key when left key is pressed', () => {
const result = {
focusedDay: moment(focusedDay).subtract(1, 'days').startOf('day').unix()
};
expect(getNewDateStateChange({ code: 'left', focusedDay, startDate, endDate })).toEqual(result);
});
it('should return an object with a focusedDay key and a currentDate key when left key is pressed and newDate is outside of start and end date bounds', () => {
const result = {
focusedDay: moment(focusedDay).subtract(1, 'days').startOf('day').unix(),
currentDate: moment(focusedDay).subtract(1, 'days').startOf('day').unix()
};
//deliberately set to be out of range
const startDate = moment(focusedDay).clone();
expect(getNewDateStateChange({ code: 'left', focusedDay, startDate, endDate })).toEqual(result);
});
it('should return correct day when up key is pressed', () => {
const result = {
focusedDay: moment(focusedDay).subtract(7, 'days').startOf('day').unix()
};
expect(getNewDateStateChange({ code: 'up', focusedDay, startDate, endDate })).toEqual(result);
});
it('should return correct day when down key is pressed', () => {
const result = {
focusedDay: moment(focusedDay).add(7, 'days').startOf('day').unix()
};
expect(getNewDateStateChange({ code: 'down', focusedDay, startDate, endDate })).toEqual(result);
});
});
});
|
ajax/libs/mobx-react/3.5.0/custom.min.js | seogi1004/cdnjs | !function(){function e(e,t,o){function r(e){return o?o.findDOMNode(e):null}function n(e){var t=r(e);t&&h&&h.set(t,e),m.emit({event:"render",renderTime:e.__$mobRenderEnd-e.__$mobRenderStart,totalTime:Date.now()-e.__$mobRenderStart,component:e,node:t})}function i(){if("undefined"==typeof WeakMap)throw new Error("[mobx-react] tracking components is not supported in this browser.");f||(f=!0)}function s(){this.listeners=[]}function a(e,t){var o=e[t],r=y[t];o?e[t]=function(){o.apply(this,arguments),r.apply(this,arguments)}:e[t]=r}function p(e,o){if("string"==typeof e)throw new Error("Store names should be provided as array");if(Array.isArray(e))return o?u.apply(null,e)(p(o)):function(t){return p(e,t)};var r=e;if(!("function"!=typeof r||r.prototype&&r.prototype.render||r.isReactClass||t.Component.isPrototypeOf(r)))return p(t.createClass({displayName:r.displayName||r.name,propTypes:r.propTypes,contextTypes:r.contextTypes,getDefaultProps:function(){return r.defaultProps},render:function(){return r.call(this,this.props,this.context)}}));if(!r)throw new Error("Please pass a valid component to 'observer'");var n=r.prototype||r;return["componentWillMount","componentWillUnmount","componentDidMount","componentDidUpdate"].forEach(function(e){a(n,e)}),n.shouldComponentUpdate||(n.shouldComponentUpdate=y.shouldComponentUpdate),r.isMobXReactObserver=!0,r}function c(e,o){var r=t.createClass({displayName:"MobXStoreInjector",render:function(){var r={};for(var n in this.props)r[n]=this.props[n];return r=e(this.context.mobxStores||{},r,this.context),t.createElement(o,r)}});return r.contextTypes={mobxStores:x.object},r.wrappedComponent=o,r}function u(){var e;if("function"==typeof arguments[0])e=arguments[0];else{for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];e=d(t)}return function(t){return c(e,t)}}function d(e){return function(t,o){return e.forEach(function(e){if(!(e in o)){if(!(e in t))throw new Error("MobX observer: Store '"+e+"' is not available! Make sure it is provided by some Provider");o[e]=t[e]}}),o}}function l(t){return function(o,r,n){if(!e["isObservable"+t](o[r]))return new Error("Invalid prop `"+r+"` supplied to `"+n+"`. Expected a mobx observable "+t+". Validation failed.")}}if(!e)throw new Error("mobx-react requires the MobX package");if(!t)throw new Error("mobx-react/custom requires React to be available");var f=!1,h="undefined"!=typeof WeakMap?new WeakMap:void 0,m=new s;s.prototype.on=function(e){this.listeners.push(e);var t=this;return function(){var o=t.listeners.indexOf(e);o!==-1&&t.listeners.splice(o,1)}},s.prototype.emit=function(e){this.listeners.forEach(function(t){t(e)})};var b={children:!0,key:!0,ref:!0},y={componentWillMount:function(){function o(){return a=new e.Reaction(n,function(){p||(p=!0,"function"==typeof s.componentWillReact&&s.componentWillReact(),s.__$mobxMounted&&t.Component.prototype.forceUpdate.call(s))}),r.$mobx=a,s.render=r,r()}function r(){p=!1;var t;return a.track(function(){f&&(s.__$mobRenderStart=Date.now()),t=e.extras.allowStateChanges(!1,i),f&&(s.__$mobRenderEnd=Date.now())}),t}var n=[this.displayName||this.name||this.constructor&&(this.constructor.displayName||this.constructor.name)||"<component>","#",this._reactInternalInstance&&this._reactInternalInstance._rootNodeID,".render()"].join(""),i=this.render.bind(this),s=this,a=null,p=!1;this.render=o},componentWillUnmount:function(){if(this.render.$mobx&&this.render.$mobx.dispose(),this.__$mobxMounted=!1,f){var e=r(this);e&&h&&h.delete(e),m.emit({event:"destroy",component:this,node:e})}},componentDidMount:function(){this.__$mobxMounted=!0,f&&n(this)},componentDidUpdate:function(){f&&n(this)},shouldComponentUpdate:function(t,o){if(this.render.$mobx&&this.render.$mobx.isScheduled()===!0)return!1;if(this.state!==o)return!0;var r,n=Object.keys(this.props);if(n.length!==Object.keys(t).length)return!0;for(var i=n.length-1;r=n[i];i--){var s=t[r];if(s!==this.props[r])return!0;if(s&&"object"==typeof s&&!e.isObservable(s))return!0}return!1}},v=t.createClass({displayName:"Provider",render:function(){return t.Children.only(this.props.children)},getChildContext:function(){var e={},t=this.context.mobxStores;if(t)for(var o in t)e[o]=t[o];for(var o in this.props)b[o]||(e[o]=this.props[o]);return{mobxStores:e}},componentWillReceiveProps:function(e){Object.keys(e).length!==Object.keys(this.props).length&&console.warn("MobX Provider: The set of provided stores has changed. Please avoid changing stores as the change might not propagate to all children");for(var t in e)b[t]||this.props[t]===e[t]||console.warn("MobX Provider: Provided store '"+t+"' has changed. Please avoid replacing stores as the change might not propagate to all children")}}),x=t.PropTypes;v.contextTypes={mobxStores:x.object},v.childContextTypes={mobxStores:x.object.isRequired};var w={observableArray:t.PropTypes.oneOfType([l("Array")]),observableMap:t.PropTypes.oneOfType([l("Map")]),observableObject:t.PropTypes.oneOfType([l("Object")]),arrayOrObservableArray:t.PropTypes.oneOfType([t.PropTypes.array,l("Array")]),objectOrObservableObject:t.PropTypes.oneOfType([t.PropTypes.object,l("Object")])};return{observer:p,Provider:v,inject:u,propTypes:w,reactiveComponent:function(){return console.warn("[mobx-react] `reactiveComponent` has been renamed to `observer` and will be removed in 1.1."),p.apply(null,arguments)},renderReporter:m,componentByNodeRegistery:h,trackComponents:i}}"object"==typeof exports?module.exports=e(require("mobx"),require("react")):"function"==typeof define&&define.amd?define("mobx-react",["mobx","react"],e):this.mobxReact=e(this.mobx,this.React)}();
//# sourceMappingURL=custom.min.js.map |
ajax/libs/webshim/1.15.1-RC1/dev/shims/moxie/js/moxie-html4.js | Amomo/cdnjs | /**
* mOxie - multi-runtime File API & XMLHttpRequest L2 Polyfill
* v1.2.1
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*
* Date: 2014-05-14
*/
/**
* Compiled inline version. (Library mode)
*/
/*jshint smarttabs:true, undef:true, latedef:true, curly:true, bitwise:true, camelcase:true */
/*globals $code */
(function(exports, undefined) {
"use strict";
var modules = {};
function require(ids, callback) {
var module, defs = [];
for (var i = 0; i < ids.length; ++i) {
module = modules[ids[i]] || resolve(ids[i]);
if (!module) {
throw 'module definition dependecy not found: ' + ids[i];
}
defs.push(module);
}
callback.apply(null, defs);
}
function define(id, dependencies, definition) {
if (typeof id !== 'string') {
throw 'invalid module definition, module id must be defined and be a string';
}
if (dependencies === undefined) {
throw 'invalid module definition, dependencies must be specified';
}
if (definition === undefined) {
throw 'invalid module definition, definition function must be specified';
}
require(dependencies, function() {
modules[id] = definition.apply(null, arguments);
});
}
function defined(id) {
return !!modules[id];
}
function resolve(id) {
var target = exports;
var fragments = id.split(/[.\/]/);
for (var fi = 0; fi < fragments.length; ++fi) {
if (!target[fragments[fi]]) {
return;
}
target = target[fragments[fi]];
}
return target;
}
function expose(ids) {
for (var i = 0; i < ids.length; i++) {
var target = exports;
var id = ids[i];
var fragments = id.split(/[.\/]/);
for (var fi = 0; fi < fragments.length - 1; ++fi) {
if (target[fragments[fi]] === undefined) {
target[fragments[fi]] = {};
}
target = target[fragments[fi]];
}
target[fragments[fragments.length - 1]] = modules[id];
}
}
// Included from: src/javascript/core/utils/Basic.js
/**
* Basic.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/core/utils/Basic', [], function() {
/**
Gets the true type of the built-in object (better version of typeof).
@author Angus Croll (http://javascriptweblog.wordpress.com/)
@method typeOf
@for Utils
@static
@param {Object} o Object to check.
@return {String} Object [[Class]]
*/
var typeOf = function(o) {
var undef;
if (o === undef) {
return 'undefined';
} else if (o === null) {
return 'null';
} else if (o.nodeType) {
return 'node';
}
// the snippet below is awesome, however it fails to detect null, undefined and arguments types in IE lte 8
return ({}).toString.call(o).match(/\s([a-z|A-Z]+)/)[1].toLowerCase();
};
/**
Extends the specified object with another object.
@method extend
@static
@param {Object} target Object to extend.
@param {Object} [obj]* Multiple objects to extend with.
@return {Object} Same as target, the extended object.
*/
var extend = function(target) {
var undef;
each(arguments, function(arg, i) {
if (i > 0) {
each(arg, function(value, key) {
if (value !== undef) {
if (typeOf(target[key]) === typeOf(value) && !!~inArray(typeOf(value), ['array', 'object'])) {
extend(target[key], value);
} else {
target[key] = value;
}
}
});
}
});
return target;
};
/**
Executes the callback function for each item in array/object. If you return false in the
callback it will break the loop.
@method each
@static
@param {Object} obj Object to iterate.
@param {function} callback Callback function to execute for each item.
*/
var each = function(obj, callback) {
var length, key, i, undef;
if (obj) {
try {
length = obj.length;
} catch(ex) {
length = undef;
}
if (length === undef) {
// Loop object items
for (key in obj) {
if (obj.hasOwnProperty(key)) {
if (callback(obj[key], key) === false) {
return;
}
}
}
} else {
// Loop array items
for (i = 0; i < length; i++) {
if (callback(obj[i], i) === false) {
return;
}
}
}
}
};
/**
Checks if object is empty.
@method isEmptyObj
@static
@param {Object} o Object to check.
@return {Boolean}
*/
var isEmptyObj = function(obj) {
var prop;
if (!obj || typeOf(obj) !== 'object') {
return true;
}
for (prop in obj) {
return false;
}
return true;
};
/**
Recieve an array of functions (usually async) to call in sequence, each function
receives a callback as first argument that it should call, when it completes. Finally,
after everything is complete, main callback is called. Passing truthy value to the
callback as a first argument will interrupt the sequence and invoke main callback
immediately.
@method inSeries
@static
@param {Array} queue Array of functions to call in sequence
@param {Function} cb Main callback that is called in the end, or in case of error
*/
var inSeries = function(queue, cb) {
var i = 0, length = queue.length;
if (typeOf(cb) !== 'function') {
cb = function() {};
}
if (!queue || !queue.length) {
cb();
}
function callNext(i) {
if (typeOf(queue[i]) === 'function') {
queue[i](function(error) {
/*jshint expr:true */
++i < length && !error ? callNext(i) : cb(error);
});
}
}
callNext(i);
};
/**
Recieve an array of functions (usually async) to call in parallel, each function
receives a callback as first argument that it should call, when it completes. After
everything is complete, main callback is called. Passing truthy value to the
callback as a first argument will interrupt the process and invoke main callback
immediately.
@method inParallel
@static
@param {Array} queue Array of functions to call in sequence
@param {Function} cb Main callback that is called in the end, or in case of erro
*/
var inParallel = function(queue, cb) {
var count = 0, num = queue.length, cbArgs = new Array(num);
each(queue, function(fn, i) {
fn(function(error) {
if (error) {
return cb(error);
}
var args = [].slice.call(arguments);
args.shift(); // strip error - undefined or not
cbArgs[i] = args;
count++;
if (count === num) {
cbArgs.unshift(null);
cb.apply(this, cbArgs);
}
});
});
};
/**
Find an element in array and return it's index if present, otherwise return -1.
@method inArray
@static
@param {Mixed} needle Element to find
@param {Array} array
@return {Int} Index of the element, or -1 if not found
*/
var inArray = function(needle, array) {
if (array) {
if (Array.prototype.indexOf) {
return Array.prototype.indexOf.call(array, needle);
}
for (var i = 0, length = array.length; i < length; i++) {
if (array[i] === needle) {
return i;
}
}
}
return -1;
};
/**
Returns elements of first array if they are not present in second. And false - otherwise.
@private
@method arrayDiff
@param {Array} needles
@param {Array} array
@return {Array|Boolean}
*/
var arrayDiff = function(needles, array) {
var diff = [];
if (typeOf(needles) !== 'array') {
needles = [needles];
}
if (typeOf(array) !== 'array') {
array = [array];
}
for (var i in needles) {
if (inArray(needles[i], array) === -1) {
diff.push(needles[i]);
}
}
return diff.length ? diff : false;
};
/**
Find intersection of two arrays.
@private
@method arrayIntersect
@param {Array} array1
@param {Array} array2
@return {Array} Intersection of two arrays or null if there is none
*/
var arrayIntersect = function(array1, array2) {
var result = [];
each(array1, function(item) {
if (inArray(item, array2) !== -1) {
result.push(item);
}
});
return result.length ? result : null;
};
/**
Forces anything into an array.
@method toArray
@static
@param {Object} obj Object with length field.
@return {Array} Array object containing all items.
*/
var toArray = function(obj) {
var i, arr = [];
for (i = 0; i < obj.length; i++) {
arr[i] = obj[i];
}
return arr;
};
/**
Generates an unique ID. This is 99.99% unique since it takes the current time and 5 random numbers.
The only way a user would be able to get the same ID is if the two persons at the same exact milisecond manages
to get 5 the same random numbers between 0-65535 it also uses a counter so each call will be guaranteed to be page unique.
It's more probable for the earth to be hit with an ansteriod. Y
@method guid
@static
@param {String} prefix to prepend (by default 'o' will be prepended).
@method guid
@return {String} Virtually unique id.
*/
var guid = (function() {
var counter = 0;
return function(prefix) {
var guid = new Date().getTime().toString(32), i;
for (i = 0; i < 5; i++) {
guid += Math.floor(Math.random() * 65535).toString(32);
}
return (prefix || 'o_') + guid + (counter++).toString(32);
};
}());
/**
Trims white spaces around the string
@method trim
@static
@param {String} str
@return {String}
*/
var trim = function(str) {
if (!str) {
return str;
}
return String.prototype.trim ? String.prototype.trim.call(str) : str.toString().replace(/^\s*/, '').replace(/\s*$/, '');
};
/**
Parses the specified size string into a byte value. For example 10kb becomes 10240.
@method parseSizeStr
@static
@param {String/Number} size String to parse or number to just pass through.
@return {Number} Size in bytes.
*/
var parseSizeStr = function(size) {
if (typeof(size) !== 'string') {
return size;
}
var muls = {
t: 1099511627776,
g: 1073741824,
m: 1048576,
k: 1024
},
mul;
size = /^([0-9]+)([mgk]?)$/.exec(size.toLowerCase().replace(/[^0-9mkg]/g, ''));
mul = size[2];
size = +size[1];
if (muls.hasOwnProperty(mul)) {
size *= muls[mul];
}
return size;
};
return {
guid: guid,
typeOf: typeOf,
extend: extend,
each: each,
isEmptyObj: isEmptyObj,
inSeries: inSeries,
inParallel: inParallel,
inArray: inArray,
arrayDiff: arrayDiff,
arrayIntersect: arrayIntersect,
toArray: toArray,
trim: trim,
parseSizeStr: parseSizeStr
};
});
// Included from: src/javascript/core/I18n.js
/**
* I18n.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define("moxie/core/I18n", [
"moxie/core/utils/Basic"
], function(Basic) {
var i18n = {};
return {
/**
* Extends the language pack object with new items.
*
* @param {Object} pack Language pack items to add.
* @return {Object} Extended language pack object.
*/
addI18n: function(pack) {
return Basic.extend(i18n, pack);
},
/**
* Translates the specified string by checking for the english string in the language pack lookup.
*
* @param {String} str String to look for.
* @return {String} Translated string or the input string if it wasn't found.
*/
translate: function(str) {
return i18n[str] || str;
},
/**
* Shortcut for translate function
*
* @param {String} str String to look for.
* @return {String} Translated string or the input string if it wasn't found.
*/
_: function(str) {
return this.translate(str);
},
/**
* Pseudo sprintf implementation - simple way to replace tokens with specified values.
*
* @param {String} str String with tokens
* @return {String} String with replaced tokens
*/
sprintf: function(str) {
var args = [].slice.call(arguments, 1);
return str.replace(/%[a-z]/g, function() {
var value = args.shift();
return Basic.typeOf(value) !== 'undefined' ? value : '';
});
}
};
});
// Included from: src/javascript/core/utils/Mime.js
/**
* Mime.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define("moxie/core/utils/Mime", [
"moxie/core/utils/Basic",
"moxie/core/I18n"
], function(Basic, I18n) {
var mimeData = "" +
"application/msword,doc dot," +
"application/pdf,pdf," +
"application/pgp-signature,pgp," +
"application/postscript,ps ai eps," +
"application/rtf,rtf," +
"application/vnd.ms-excel,xls xlb," +
"application/vnd.ms-powerpoint,ppt pps pot," +
"application/zip,zip," +
"application/x-shockwave-flash,swf swfl," +
"application/vnd.openxmlformats-officedocument.wordprocessingml.document,docx," +
"application/vnd.openxmlformats-officedocument.wordprocessingml.template,dotx," +
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,xlsx," +
"application/vnd.openxmlformats-officedocument.presentationml.presentation,pptx," +
"application/vnd.openxmlformats-officedocument.presentationml.template,potx," +
"application/vnd.openxmlformats-officedocument.presentationml.slideshow,ppsx," +
"application/x-javascript,js," +
"application/json,json," +
"audio/mpeg,mp3 mpga mpega mp2," +
"audio/x-wav,wav," +
"audio/x-m4a,m4a," +
"audio/ogg,oga ogg," +
"audio/aiff,aiff aif," +
"audio/flac,flac," +
"audio/aac,aac," +
"audio/ac3,ac3," +
"audio/x-ms-wma,wma," +
"image/bmp,bmp," +
"image/gif,gif," +
"image/jpeg,jpg jpeg jpe," +
"image/photoshop,psd," +
"image/png,png," +
"image/svg+xml,svg svgz," +
"image/tiff,tiff tif," +
"text/plain,asc txt text diff log," +
"text/html,htm html xhtml," +
"text/css,css," +
"text/csv,csv," +
"text/rtf,rtf," +
"video/mpeg,mpeg mpg mpe m2v," +
"video/quicktime,qt mov," +
"video/mp4,mp4," +
"video/x-m4v,m4v," +
"video/x-flv,flv," +
"video/x-ms-wmv,wmv," +
"video/avi,avi," +
"video/webm,webm," +
"video/3gpp,3gpp 3gp," +
"video/3gpp2,3g2," +
"video/vnd.rn-realvideo,rv," +
"video/ogg,ogv," +
"video/x-matroska,mkv," +
"application/vnd.oasis.opendocument.formula-template,otf," +
"application/octet-stream,exe";
var Mime = {
mimes: {},
extensions: {},
// Parses the default mime types string into a mimes and extensions lookup maps
addMimeType: function (mimeData) {
var items = mimeData.split(/,/), i, ii, ext;
for (i = 0; i < items.length; i += 2) {
ext = items[i + 1].split(/ /);
// extension to mime lookup
for (ii = 0; ii < ext.length; ii++) {
this.mimes[ext[ii]] = items[i];
}
// mime to extension lookup
this.extensions[items[i]] = ext;
}
},
extList2mimes: function (filters, addMissingExtensions) {
var self = this, ext, i, ii, type, mimes = [];
// convert extensions to mime types list
for (i = 0; i < filters.length; i++) {
ext = filters[i].extensions.split(/\s*,\s*/);
for (ii = 0; ii < ext.length; ii++) {
// if there's an asterisk in the list, then accept attribute is not required
if (ext[ii] === '*') {
return [];
}
type = self.mimes[ext[ii]];
if (!type) {
if (addMissingExtensions && /^\w+$/.test(ext[ii])) {
mimes.push('.' + ext[ii]);
} else {
return []; // accept all
}
} else if (Basic.inArray(type, mimes) === -1) {
mimes.push(type);
}
}
}
return mimes;
},
mimes2exts: function(mimes) {
var self = this, exts = [];
Basic.each(mimes, function(mime) {
if (mime === '*') {
exts = [];
return false;
}
// check if this thing looks like mime type
var m = mime.match(/^(\w+)\/(\*|\w+)$/);
if (m) {
if (m[2] === '*') {
// wildcard mime type detected
Basic.each(self.extensions, function(arr, mime) {
if ((new RegExp('^' + m[1] + '/')).test(mime)) {
[].push.apply(exts, self.extensions[mime]);
}
});
} else if (self.extensions[mime]) {
[].push.apply(exts, self.extensions[mime]);
}
}
});
return exts;
},
mimes2extList: function(mimes) {
var accept = [], exts = [];
if (Basic.typeOf(mimes) === 'string') {
mimes = Basic.trim(mimes).split(/\s*,\s*/);
}
exts = this.mimes2exts(mimes);
accept.push({
title: I18n.translate('Files'),
extensions: exts.length ? exts.join(',') : '*'
});
// save original mimes string
accept.mimes = mimes;
return accept;
},
getFileExtension: function(fileName) {
var matches = fileName && fileName.match(/\.([^.]+)$/);
if (matches) {
return matches[1].toLowerCase();
}
return '';
},
getFileMime: function(fileName) {
return this.mimes[this.getFileExtension(fileName)] || '';
}
};
Mime.addMimeType(mimeData);
return Mime;
});
// Included from: src/javascript/core/utils/Env.js
/**
* Env.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define("moxie/core/utils/Env", [
"moxie/core/utils/Basic"
], function(Basic) {
// UAParser.js v0.6.2
// Lightweight JavaScript-based User-Agent string parser
// https://github.com/faisalman/ua-parser-js
//
// Copyright © 2012-2013 Faisalman <fyzlman@gmail.com>
// Dual licensed under GPLv2 & MIT
var UAParser = (function (undefined) {
//////////////
// Constants
/////////////
var EMPTY = '',
UNKNOWN = '?',
FUNC_TYPE = 'function',
UNDEF_TYPE = 'undefined',
OBJ_TYPE = 'object',
MAJOR = 'major',
MODEL = 'model',
NAME = 'name',
TYPE = 'type',
VENDOR = 'vendor',
VERSION = 'version',
ARCHITECTURE= 'architecture',
CONSOLE = 'console',
MOBILE = 'mobile',
TABLET = 'tablet';
///////////
// Helper
//////////
var util = {
has : function (str1, str2) {
return str2.toLowerCase().indexOf(str1.toLowerCase()) !== -1;
},
lowerize : function (str) {
return str.toLowerCase();
}
};
///////////////
// Map helper
//////////////
var mapper = {
rgx : function () {
// loop through all regexes maps
for (var result, i = 0, j, k, p, q, matches, match, args = arguments; i < args.length; i += 2) {
var regex = args[i], // even sequence (0,2,4,..)
props = args[i + 1]; // odd sequence (1,3,5,..)
// construct object barebones
if (typeof(result) === UNDEF_TYPE) {
result = {};
for (p in props) {
q = props[p];
if (typeof(q) === OBJ_TYPE) {
result[q[0]] = undefined;
} else {
result[q] = undefined;
}
}
}
// try matching uastring with regexes
for (j = k = 0; j < regex.length; j++) {
matches = regex[j].exec(this.getUA());
if (!!matches) {
for (p = 0; p < props.length; p++) {
match = matches[++k];
q = props[p];
// check if given property is actually array
if (typeof(q) === OBJ_TYPE && q.length > 0) {
if (q.length == 2) {
if (typeof(q[1]) == FUNC_TYPE) {
// assign modified match
result[q[0]] = q[1].call(this, match);
} else {
// assign given value, ignore regex match
result[q[0]] = q[1];
}
} else if (q.length == 3) {
// check whether function or regex
if (typeof(q[1]) === FUNC_TYPE && !(q[1].exec && q[1].test)) {
// call function (usually string mapper)
result[q[0]] = match ? q[1].call(this, match, q[2]) : undefined;
} else {
// sanitize match using given regex
result[q[0]] = match ? match.replace(q[1], q[2]) : undefined;
}
} else if (q.length == 4) {
result[q[0]] = match ? q[3].call(this, match.replace(q[1], q[2])) : undefined;
}
} else {
result[q] = match ? match : undefined;
}
}
break;
}
}
if(!!matches) break; // break the loop immediately if match found
}
return result;
},
str : function (str, map) {
for (var i in map) {
// check if array
if (typeof(map[i]) === OBJ_TYPE && map[i].length > 0) {
for (var j = 0; j < map[i].length; j++) {
if (util.has(map[i][j], str)) {
return (i === UNKNOWN) ? undefined : i;
}
}
} else if (util.has(map[i], str)) {
return (i === UNKNOWN) ? undefined : i;
}
}
return str;
}
};
///////////////
// String map
//////////////
var maps = {
browser : {
oldsafari : {
major : {
'1' : ['/8', '/1', '/3'],
'2' : '/4',
'?' : '/'
},
version : {
'1.0' : '/8',
'1.2' : '/1',
'1.3' : '/3',
'2.0' : '/412',
'2.0.2' : '/416',
'2.0.3' : '/417',
'2.0.4' : '/419',
'?' : '/'
}
}
},
device : {
sprint : {
model : {
'Evo Shift 4G' : '7373KT'
},
vendor : {
'HTC' : 'APA',
'Sprint' : 'Sprint'
}
}
},
os : {
windows : {
version : {
'ME' : '4.90',
'NT 3.11' : 'NT3.51',
'NT 4.0' : 'NT4.0',
'2000' : 'NT 5.0',
'XP' : ['NT 5.1', 'NT 5.2'],
'Vista' : 'NT 6.0',
'7' : 'NT 6.1',
'8' : 'NT 6.2',
'8.1' : 'NT 6.3',
'RT' : 'ARM'
}
}
}
};
//////////////
// Regex map
/////////////
var regexes = {
browser : [[
// Presto based
/(opera\smini)\/((\d+)?[\w\.-]+)/i, // Opera Mini
/(opera\s[mobiletab]+).+version\/((\d+)?[\w\.-]+)/i, // Opera Mobi/Tablet
/(opera).+version\/((\d+)?[\w\.]+)/i, // Opera > 9.80
/(opera)[\/\s]+((\d+)?[\w\.]+)/i // Opera < 9.80
], [NAME, VERSION, MAJOR], [
/\s(opr)\/((\d+)?[\w\.]+)/i // Opera Webkit
], [[NAME, 'Opera'], VERSION, MAJOR], [
// Mixed
/(kindle)\/((\d+)?[\w\.]+)/i, // Kindle
/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?((\d+)?[\w\.]+)*/i,
// Lunascape/Maxthon/Netfront/Jasmine/Blazer
// Trident based
/(avant\s|iemobile|slim|baidu)(?:browser)?[\/\s]?((\d+)?[\w\.]*)/i,
// Avant/IEMobile/SlimBrowser/Baidu
/(?:ms|\()(ie)\s((\d+)?[\w\.]+)/i, // Internet Explorer
// Webkit/KHTML based
/(rekonq)((?:\/)[\w\.]+)*/i, // Rekonq
/(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron)\/((\d+)?[\w\.-]+)/i
// Chromium/Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron
], [NAME, VERSION, MAJOR], [
/(trident).+rv[:\s]((\d+)?[\w\.]+).+like\sgecko/i // IE11
], [[NAME, 'IE'], VERSION, MAJOR], [
/(yabrowser)\/((\d+)?[\w\.]+)/i // Yandex
], [[NAME, 'Yandex'], VERSION, MAJOR], [
/(comodo_dragon)\/((\d+)?[\w\.]+)/i // Comodo Dragon
], [[NAME, /_/g, ' '], VERSION, MAJOR], [
/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?((\d+)?[\w\.]+)/i
// Chrome/OmniWeb/Arora/Tizen/Nokia
], [NAME, VERSION, MAJOR], [
/(dolfin)\/((\d+)?[\w\.]+)/i // Dolphin
], [[NAME, 'Dolphin'], VERSION, MAJOR], [
/((?:android.+)crmo|crios)\/((\d+)?[\w\.]+)/i // Chrome for Android/iOS
], [[NAME, 'Chrome'], VERSION, MAJOR], [
/((?:android.+))version\/((\d+)?[\w\.]+)\smobile\ssafari/i // Android Browser
], [[NAME, 'Android Browser'], VERSION, MAJOR], [
/version\/((\d+)?[\w\.]+).+?mobile\/\w+\s(safari)/i // Mobile Safari
], [VERSION, MAJOR, [NAME, 'Mobile Safari']], [
/version\/((\d+)?[\w\.]+).+?(mobile\s?safari|safari)/i // Safari & Safari Mobile
], [VERSION, MAJOR, NAME], [
/webkit.+?(mobile\s?safari|safari)((\/[\w\.]+))/i // Safari < 3.0
], [NAME, [MAJOR, mapper.str, maps.browser.oldsafari.major], [VERSION, mapper.str, maps.browser.oldsafari.version]], [
/(konqueror)\/((\d+)?[\w\.]+)/i, // Konqueror
/(webkit|khtml)\/((\d+)?[\w\.]+)/i
], [NAME, VERSION, MAJOR], [
// Gecko based
/(navigator|netscape)\/((\d+)?[\w\.-]+)/i // Netscape
], [[NAME, 'Netscape'], VERSION, MAJOR], [
/(swiftfox)/i, // Swiftfox
/(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?((\d+)?[\w\.\+]+)/i,
// IceDragon/Iceweasel/Camino/Chimera/Fennec/Maemo/Minimo/Conkeror
/(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix)\/((\d+)?[\w\.-]+)/i,
// Firefox/SeaMonkey/K-Meleon/IceCat/IceApe/Firebird/Phoenix
/(mozilla)\/((\d+)?[\w\.]+).+rv\:.+gecko\/\d+/i, // Mozilla
// Other
/(uc\s?browser|polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|qqbrowser)[\/\s]?((\d+)?[\w\.]+)/i,
// UCBrowser/Polaris/Lynx/Dillo/iCab/Doris/Amaya/w3m/NetSurf/QQBrowser
/(links)\s\(((\d+)?[\w\.]+)/i, // Links
/(gobrowser)\/?((\d+)?[\w\.]+)*/i, // GoBrowser
/(ice\s?browser)\/v?((\d+)?[\w\._]+)/i, // ICE Browser
/(mosaic)[\/\s]((\d+)?[\w\.]+)/i // Mosaic
], [NAME, VERSION, MAJOR]
],
engine : [[
/(presto)\/([\w\.]+)/i, // Presto
/(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i, // WebKit/Trident/NetFront/NetSurf/Amaya/Lynx/w3m
/(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i, // KHTML/Tasman/Links
/(icab)[\/\s]([23]\.[\d\.]+)/i // iCab
], [NAME, VERSION], [
/rv\:([\w\.]+).*(gecko)/i // Gecko
], [VERSION, NAME]
],
os : [[
// Windows based
/(windows)\snt\s6\.2;\s(arm)/i, // Windows RT
/(windows\sphone(?:\sos)*|windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i
], [NAME, [VERSION, mapper.str, maps.os.windows.version]], [
/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i
], [[NAME, 'Windows'], [VERSION, mapper.str, maps.os.windows.version]], [
// Mobile/Embedded OS
/\((bb)(10);/i // BlackBerry 10
], [[NAME, 'BlackBerry'], VERSION], [
/(blackberry)\w*\/?([\w\.]+)*/i, // Blackberry
/(tizen)\/([\w\.]+)/i, // Tizen
/(android|webos|palm\os|qnx|bada|rim\stablet\sos|meego)[\/\s-]?([\w\.]+)*/i
// Android/WebOS/Palm/QNX/Bada/RIM/MeeGo
], [NAME, VERSION], [
/(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]+)*/i // Symbian
], [[NAME, 'Symbian'], VERSION],[
/mozilla.+\(mobile;.+gecko.+firefox/i // Firefox OS
], [[NAME, 'Firefox OS'], VERSION], [
// Console
/(nintendo|playstation)\s([wids3portablevu]+)/i, // Nintendo/Playstation
// GNU/Linux based
/(mint)[\/\s\(]?(\w+)*/i, // Mint
/(joli|[kxln]?ubuntu|debian|[open]*suse|gentoo|arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk)[\/\s-]?([\w\.-]+)*/i,
// Joli/Ubuntu/Debian/SUSE/Gentoo/Arch/Slackware
// Fedora/Mandriva/CentOS/PCLinuxOS/RedHat/Zenwalk
/(hurd|linux)\s?([\w\.]+)*/i, // Hurd/Linux
/(gnu)\s?([\w\.]+)*/i // GNU
], [NAME, VERSION], [
/(cros)\s[\w]+\s([\w\.]+\w)/i // Chromium OS
], [[NAME, 'Chromium OS'], VERSION],[
// Solaris
/(sunos)\s?([\w\.]+\d)*/i // Solaris
], [[NAME, 'Solaris'], VERSION], [
// BSD based
/\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]+)*/i // FreeBSD/NetBSD/OpenBSD/PC-BSD/DragonFly
], [NAME, VERSION],[
/(ip[honead]+)(?:.*os\s*([\w]+)*\slike\smac|;\sopera)/i // iOS
], [[NAME, 'iOS'], [VERSION, /_/g, '.']], [
/(mac\sos\sx)\s?([\w\s\.]+\w)*/i // Mac OS
], [NAME, [VERSION, /_/g, '.']], [
// Other
/(haiku)\s(\w+)/i, // Haiku
/(aix)\s((\d)(?=\.|\)|\s)[\w\.]*)*/i, // AIX
/(macintosh|mac(?=_powerpc)|plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos)/i,
// Plan9/Minix/BeOS/OS2/AmigaOS/MorphOS/RISCOS
/(unix)\s?([\w\.]+)*/i // UNIX
], [NAME, VERSION]
]
};
/////////////////
// Constructor
////////////////
var UAParser = function (uastring) {
var ua = uastring || ((window && window.navigator && window.navigator.userAgent) ? window.navigator.userAgent : EMPTY);
this.getBrowser = function () {
return mapper.rgx.apply(this, regexes.browser);
};
this.getEngine = function () {
return mapper.rgx.apply(this, regexes.engine);
};
this.getOS = function () {
return mapper.rgx.apply(this, regexes.os);
};
this.getResult = function() {
return {
ua : this.getUA(),
browser : this.getBrowser(),
engine : this.getEngine(),
os : this.getOS()
};
};
this.getUA = function () {
return ua;
};
this.setUA = function (uastring) {
ua = uastring;
return this;
};
this.setUA(ua);
};
return new UAParser().getResult();
})();
function version_compare(v1, v2, operator) {
// From: http://phpjs.org/functions
// + original by: Philippe Jausions (http://pear.php.net/user/jausions)
// + original by: Aidan Lister (http://aidanlister.com/)
// + reimplemented by: Kankrelune (http://www.webfaktory.info/)
// + improved by: Brett Zamir (http://brett-zamir.me)
// + improved by: Scott Baker
// + improved by: Theriault
// * example 1: version_compare('8.2.5rc', '8.2.5a');
// * returns 1: 1
// * example 2: version_compare('8.2.50', '8.2.52', '<');
// * returns 2: true
// * example 3: version_compare('5.3.0-dev', '5.3.0');
// * returns 3: -1
// * example 4: version_compare('4.1.0.52','4.01.0.51');
// * returns 4: 1
// Important: compare must be initialized at 0.
var i = 0,
x = 0,
compare = 0,
// vm maps textual PHP versions to negatives so they're less than 0.
// PHP currently defines these as CASE-SENSITIVE. It is important to
// leave these as negatives so that they can come before numerical versions
// and as if no letters were there to begin with.
// (1alpha is < 1 and < 1.1 but > 1dev1)
// If a non-numerical value can't be mapped to this table, it receives
// -7 as its value.
vm = {
'dev': -6,
'alpha': -5,
'a': -5,
'beta': -4,
'b': -4,
'RC': -3,
'rc': -3,
'#': -2,
'p': 1,
'pl': 1
},
// This function will be called to prepare each version argument.
// It replaces every _, -, and + with a dot.
// It surrounds any nonsequence of numbers/dots with dots.
// It replaces sequences of dots with a single dot.
// version_compare('4..0', '4.0') == 0
// Important: A string of 0 length needs to be converted into a value
// even less than an unexisting value in vm (-7), hence [-8].
// It's also important to not strip spaces because of this.
// version_compare('', ' ') == 1
prepVersion = function (v) {
v = ('' + v).replace(/[_\-+]/g, '.');
v = v.replace(/([^.\d]+)/g, '.$1.').replace(/\.{2,}/g, '.');
return (!v.length ? [-8] : v.split('.'));
},
// This converts a version component to a number.
// Empty component becomes 0.
// Non-numerical component becomes a negative number.
// Numerical component becomes itself as an integer.
numVersion = function (v) {
return !v ? 0 : (isNaN(v) ? vm[v] || -7 : parseInt(v, 10));
};
v1 = prepVersion(v1);
v2 = prepVersion(v2);
x = Math.max(v1.length, v2.length);
for (i = 0; i < x; i++) {
if (v1[i] == v2[i]) {
continue;
}
v1[i] = numVersion(v1[i]);
v2[i] = numVersion(v2[i]);
if (v1[i] < v2[i]) {
compare = -1;
break;
} else if (v1[i] > v2[i]) {
compare = 1;
break;
}
}
if (!operator) {
return compare;
}
// Important: operator is CASE-SENSITIVE.
// "No operator" seems to be treated as "<."
// Any other values seem to make the function return null.
switch (operator) {
case '>':
case 'gt':
return (compare > 0);
case '>=':
case 'ge':
return (compare >= 0);
case '<=':
case 'le':
return (compare <= 0);
case '==':
case '=':
case 'eq':
return (compare === 0);
case '<>':
case '!=':
case 'ne':
return (compare !== 0);
case '':
case '<':
case 'lt':
return (compare < 0);
default:
return null;
}
}
var can = (function() {
var caps = {
define_property: (function() {
/* // currently too much extra code required, not exactly worth it
try { // as of IE8, getters/setters are supported only on DOM elements
var obj = {};
if (Object.defineProperty) {
Object.defineProperty(obj, 'prop', {
enumerable: true,
configurable: true
});
return true;
}
} catch(ex) {}
if (Object.prototype.__defineGetter__ && Object.prototype.__defineSetter__) {
return true;
}*/
return false;
}()),
create_canvas: (function() {
// On the S60 and BB Storm, getContext exists, but always returns undefined
// so we actually have to call getContext() to verify
// github.com/Modernizr/Modernizr/issues/issue/97/
var el = document.createElement('canvas');
return !!(el.getContext && el.getContext('2d'));
}()),
return_response_type: function(responseType) {
try {
if (Basic.inArray(responseType, ['', 'text', 'document']) !== -1) {
return true;
} else if (window.XMLHttpRequest) {
var xhr = new XMLHttpRequest();
xhr.open('get', '/'); // otherwise Gecko throws an exception
if ('responseType' in xhr) {
xhr.responseType = responseType;
// as of 23.0.1271.64, Chrome switched from throwing exception to merely logging it to the console (why? o why?)
if (xhr.responseType !== responseType) {
return false;
}
return true;
}
}
} catch (ex) {}
return false;
},
// ideas for this heavily come from Modernizr (http://modernizr.com/)
use_data_uri: (function() {
var du = new Image();
du.onload = function() {
caps.use_data_uri = (du.width === 1 && du.height === 1);
};
setTimeout(function() {
du.src = "data:image/gif;base64,R0lGODlhAQABAIAAAP8AAAAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==";
}, 1);
return false;
}()),
use_data_uri_over32kb: function() { // IE8
return caps.use_data_uri && (Env.browser !== 'IE' || Env.version >= 9);
},
use_data_uri_of: function(bytes) {
return (caps.use_data_uri && bytes < 33000 || caps.use_data_uri_over32kb());
},
use_fileinput: function() {
var el = document.createElement('input');
el.setAttribute('type', 'file');
return !el.disabled;
}
};
return function(cap) {
var args = [].slice.call(arguments);
args.shift(); // shift of cap
return Basic.typeOf(caps[cap]) === 'function' ? caps[cap].apply(this, args) : !!caps[cap];
};
}());
var Env = {
can: can,
browser: UAParser.browser.name,
version: parseFloat(UAParser.browser.major),
os: UAParser.os.name, // everybody intuitively types it in a lowercase for some reason
osVersion: UAParser.os.version,
verComp: version_compare,
swf_url: "../flash/Moxie.swf",
xap_url: "../silverlight/Moxie.xap",
global_event_dispatcher: "moxie.core.EventTarget.instance.dispatchEvent"
};
// for backward compatibility
// @deprecated Use `Env.os` instead
Env.OS = Env.os;
return Env;
});
// Included from: src/javascript/core/utils/Dom.js
/**
* Dom.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/core/utils/Dom', ['moxie/core/utils/Env'], function(Env) {
/**
Get DOM Element by it's id.
@method get
@for Utils
@param {String} id Identifier of the DOM Element
@return {DOMElement}
*/
var get = function(id) {
if (typeof id !== 'string') {
return id;
}
return document.getElementById(id);
};
/**
Checks if specified DOM element has specified class.
@method hasClass
@static
@param {Object} obj DOM element like object to add handler to.
@param {String} name Class name
*/
var hasClass = function(obj, name) {
if (!obj.className) {
return false;
}
var regExp = new RegExp("(^|\\s+)"+name+"(\\s+|$)");
return regExp.test(obj.className);
};
/**
Adds specified className to specified DOM element.
@method addClass
@static
@param {Object} obj DOM element like object to add handler to.
@param {String} name Class name
*/
var addClass = function(obj, name) {
if (!hasClass(obj, name)) {
obj.className = !obj.className ? name : obj.className.replace(/\s+$/, '') + ' ' + name;
}
};
/**
Removes specified className from specified DOM element.
@method removeClass
@static
@param {Object} obj DOM element like object to add handler to.
@param {String} name Class name
*/
var removeClass = function(obj, name) {
if (obj.className) {
var regExp = new RegExp("(^|\\s+)"+name+"(\\s+|$)");
obj.className = obj.className.replace(regExp, function($0, $1, $2) {
return $1 === ' ' && $2 === ' ' ? ' ' : '';
});
}
};
/**
Returns a given computed style of a DOM element.
@method getStyle
@static
@param {Object} obj DOM element like object.
@param {String} name Style you want to get from the DOM element
*/
var getStyle = function(obj, name) {
if (obj.currentStyle) {
return obj.currentStyle[name];
} else if (window.getComputedStyle) {
return window.getComputedStyle(obj, null)[name];
}
};
/**
Returns the absolute x, y position of an Element. The position will be returned in a object with x, y fields.
@method getPos
@static
@param {Element} node HTML element or element id to get x, y position from.
@param {Element} root Optional root element to stop calculations at.
@return {object} Absolute position of the specified element object with x, y fields.
*/
var getPos = function(node, root) {
var x = 0, y = 0, parent, doc = document, nodeRect, rootRect;
node = node;
root = root || doc.body;
// Returns the x, y cordinate for an element on IE 6 and IE 7
function getIEPos(node) {
var bodyElm, rect, x = 0, y = 0;
if (node) {
rect = node.getBoundingClientRect();
bodyElm = doc.compatMode === "CSS1Compat" ? doc.documentElement : doc.body;
x = rect.left + bodyElm.scrollLeft;
y = rect.top + bodyElm.scrollTop;
}
return {
x : x,
y : y
};
}
// Use getBoundingClientRect on IE 6 and IE 7 but not on IE 8 in standards mode
if (node && node.getBoundingClientRect && Env.browser === 'IE' && (!doc.documentMode || doc.documentMode < 8)) {
nodeRect = getIEPos(node);
rootRect = getIEPos(root);
return {
x : nodeRect.x - rootRect.x,
y : nodeRect.y - rootRect.y
};
}
parent = node;
while (parent && parent != root && parent.nodeType) {
x += parent.offsetLeft || 0;
y += parent.offsetTop || 0;
parent = parent.offsetParent;
}
parent = node.parentNode;
while (parent && parent != root && parent.nodeType) {
x -= parent.scrollLeft || 0;
y -= parent.scrollTop || 0;
parent = parent.parentNode;
}
return {
x : x,
y : y
};
};
/**
Returns the size of the specified node in pixels.
@method getSize
@static
@param {Node} node Node to get the size of.
@return {Object} Object with a w and h property.
*/
var getSize = function(node) {
return {
w : node.offsetWidth || node.clientWidth,
h : node.offsetHeight || node.clientHeight
};
};
return {
get: get,
hasClass: hasClass,
addClass: addClass,
removeClass: removeClass,
getStyle: getStyle,
getPos: getPos,
getSize: getSize
};
});
// Included from: src/javascript/core/Exceptions.js
/**
* Exceptions.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/core/Exceptions', [
'moxie/core/utils/Basic'
], function(Basic) {
function _findKey(obj, value) {
var key;
for (key in obj) {
if (obj[key] === value) {
return key;
}
}
return null;
}
return {
RuntimeError: (function() {
var namecodes = {
NOT_INIT_ERR: 1,
NOT_SUPPORTED_ERR: 9,
JS_ERR: 4
};
function RuntimeError(code) {
this.code = code;
this.name = _findKey(namecodes, code);
this.message = this.name + ": RuntimeError " + this.code;
}
Basic.extend(RuntimeError, namecodes);
RuntimeError.prototype = Error.prototype;
return RuntimeError;
}()),
OperationNotAllowedException: (function() {
function OperationNotAllowedException(code) {
this.code = code;
this.name = 'OperationNotAllowedException';
}
Basic.extend(OperationNotAllowedException, {
NOT_ALLOWED_ERR: 1
});
OperationNotAllowedException.prototype = Error.prototype;
return OperationNotAllowedException;
}()),
ImageError: (function() {
var namecodes = {
WRONG_FORMAT: 1,
MAX_RESOLUTION_ERR: 2
};
function ImageError(code) {
this.code = code;
this.name = _findKey(namecodes, code);
this.message = this.name + ": ImageError " + this.code;
}
Basic.extend(ImageError, namecodes);
ImageError.prototype = Error.prototype;
return ImageError;
}()),
FileException: (function() {
var namecodes = {
NOT_FOUND_ERR: 1,
SECURITY_ERR: 2,
ABORT_ERR: 3,
NOT_READABLE_ERR: 4,
ENCODING_ERR: 5,
NO_MODIFICATION_ALLOWED_ERR: 6,
INVALID_STATE_ERR: 7,
SYNTAX_ERR: 8
};
function FileException(code) {
this.code = code;
this.name = _findKey(namecodes, code);
this.message = this.name + ": FileException " + this.code;
}
Basic.extend(FileException, namecodes);
FileException.prototype = Error.prototype;
return FileException;
}()),
DOMException: (function() {
var namecodes = {
INDEX_SIZE_ERR: 1,
DOMSTRING_SIZE_ERR: 2,
HIERARCHY_REQUEST_ERR: 3,
WRONG_DOCUMENT_ERR: 4,
INVALID_CHARACTER_ERR: 5,
NO_DATA_ALLOWED_ERR: 6,
NO_MODIFICATION_ALLOWED_ERR: 7,
NOT_FOUND_ERR: 8,
NOT_SUPPORTED_ERR: 9,
INUSE_ATTRIBUTE_ERR: 10,
INVALID_STATE_ERR: 11,
SYNTAX_ERR: 12,
INVALID_MODIFICATION_ERR: 13,
NAMESPACE_ERR: 14,
INVALID_ACCESS_ERR: 15,
VALIDATION_ERR: 16,
TYPE_MISMATCH_ERR: 17,
SECURITY_ERR: 18,
NETWORK_ERR: 19,
ABORT_ERR: 20,
URL_MISMATCH_ERR: 21,
QUOTA_EXCEEDED_ERR: 22,
TIMEOUT_ERR: 23,
INVALID_NODE_TYPE_ERR: 24,
DATA_CLONE_ERR: 25
};
function DOMException(code) {
this.code = code;
this.name = _findKey(namecodes, code);
this.message = this.name + ": DOMException " + this.code;
}
Basic.extend(DOMException, namecodes);
DOMException.prototype = Error.prototype;
return DOMException;
}()),
EventException: (function() {
function EventException(code) {
this.code = code;
this.name = 'EventException';
}
Basic.extend(EventException, {
UNSPECIFIED_EVENT_TYPE_ERR: 0
});
EventException.prototype = Error.prototype;
return EventException;
}())
};
});
// Included from: src/javascript/core/EventTarget.js
/**
* EventTarget.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/core/EventTarget', [
'moxie/core/Exceptions',
'moxie/core/utils/Basic'
], function(x, Basic) {
/**
Parent object for all event dispatching components and objects
@class EventTarget
@constructor EventTarget
*/
function EventTarget() {
// hash of event listeners by object uid
var eventpool = {};
Basic.extend(this, {
/**
Unique id of the event dispatcher, usually overriden by children
@property uid
@type String
*/
uid: null,
/**
Can be called from within a child in order to acquire uniqie id in automated manner
@method init
*/
init: function() {
if (!this.uid) {
this.uid = Basic.guid('uid_');
}
},
/**
Register a handler to a specific event dispatched by the object
@method addEventListener
@param {String} type Type or basically a name of the event to subscribe to
@param {Function} fn Callback function that will be called when event happens
@param {Number} [priority=0] Priority of the event handler - handlers with higher priorities will be called first
@param {Object} [scope=this] A scope to invoke event handler in
*/
addEventListener: function(type, fn, priority, scope) {
var self = this, list;
type = Basic.trim(type);
if (/\s/.test(type)) {
// multiple event types were passed for one handler
Basic.each(type.split(/\s+/), function(type) {
self.addEventListener(type, fn, priority, scope);
});
return;
}
type = type.toLowerCase();
priority = parseInt(priority, 10) || 0;
list = eventpool[this.uid] && eventpool[this.uid][type] || [];
list.push({fn : fn, priority : priority, scope : scope || this});
if (!eventpool[this.uid]) {
eventpool[this.uid] = {};
}
eventpool[this.uid][type] = list;
},
/**
Check if any handlers were registered to the specified event
@method hasEventListener
@param {String} type Type or basically a name of the event to check
@return {Mixed} Returns a handler if it was found and false, if - not
*/
hasEventListener: function(type) {
return type ? !!(eventpool[this.uid] && eventpool[this.uid][type]) : !!eventpool[this.uid];
},
/**
Unregister the handler from the event, or if former was not specified - unregister all handlers
@method removeEventListener
@param {String} type Type or basically a name of the event
@param {Function} [fn] Handler to unregister
*/
removeEventListener: function(type, fn) {
type = type.toLowerCase();
var list = eventpool[this.uid] && eventpool[this.uid][type], i;
if (list) {
if (fn) {
for (i = list.length - 1; i >= 0; i--) {
if (list[i].fn === fn) {
list.splice(i, 1);
break;
}
}
} else {
list = [];
}
// delete event list if it has become empty
if (!list.length) {
delete eventpool[this.uid][type];
// and object specific entry in a hash if it has no more listeners attached
if (Basic.isEmptyObj(eventpool[this.uid])) {
delete eventpool[this.uid];
}
}
}
},
/**
Remove all event handlers from the object
@method removeAllEventListeners
*/
removeAllEventListeners: function() {
if (eventpool[this.uid]) {
delete eventpool[this.uid];
}
},
/**
Dispatch the event
@method dispatchEvent
@param {String/Object} Type of event or event object to dispatch
@param {Mixed} [...] Variable number of arguments to be passed to a handlers
@return {Boolean} true by default and false if any handler returned false
*/
dispatchEvent: function(type) {
var uid, list, args, tmpEvt, evt = {}, result = true, undef;
if (Basic.typeOf(type) !== 'string') {
// we can't use original object directly (because of Silverlight)
tmpEvt = type;
if (Basic.typeOf(tmpEvt.type) === 'string') {
type = tmpEvt.type;
if (tmpEvt.total !== undef && tmpEvt.loaded !== undef) { // progress event
evt.total = tmpEvt.total;
evt.loaded = tmpEvt.loaded;
}
evt.async = tmpEvt.async || false;
} else {
throw new x.EventException(x.EventException.UNSPECIFIED_EVENT_TYPE_ERR);
}
}
// check if event is meant to be dispatched on an object having specific uid
if (type.indexOf('::') !== -1) {
(function(arr) {
uid = arr[0];
type = arr[1];
}(type.split('::')));
} else {
uid = this.uid;
}
type = type.toLowerCase();
list = eventpool[uid] && eventpool[uid][type];
if (list) {
// sort event list by prority
list.sort(function(a, b) { return b.priority - a.priority; });
args = [].slice.call(arguments);
// first argument will be pseudo-event object
args.shift();
evt.type = type;
args.unshift(evt);
// Dispatch event to all listeners
var queue = [];
Basic.each(list, function(handler) {
// explicitly set the target, otherwise events fired from shims do not get it
args[0].target = handler.scope;
// if event is marked as async, detach the handler
if (evt.async) {
queue.push(function(cb) {
setTimeout(function() {
cb(handler.fn.apply(handler.scope, args) === false);
}, 1);
});
} else {
queue.push(function(cb) {
cb(handler.fn.apply(handler.scope, args) === false); // if handler returns false stop propagation
});
}
});
if (queue.length) {
Basic.inSeries(queue, function(err) {
result = !err;
});
}
}
return result;
},
/**
Alias for addEventListener
@method bind
@protected
*/
bind: function() {
this.addEventListener.apply(this, arguments);
},
/**
Alias for removeEventListener
@method unbind
@protected
*/
unbind: function() {
this.removeEventListener.apply(this, arguments);
},
/**
Alias for removeAllEventListeners
@method unbindAll
@protected
*/
unbindAll: function() {
this.removeAllEventListeners.apply(this, arguments);
},
/**
Alias for dispatchEvent
@method trigger
@protected
*/
trigger: function() {
return this.dispatchEvent.apply(this, arguments);
},
/**
Converts properties of on[event] type to corresponding event handlers,
is used to avoid extra hassle around the process of calling them back
@method convertEventPropsToHandlers
@private
*/
convertEventPropsToHandlers: function(handlers) {
var h;
if (Basic.typeOf(handlers) !== 'array') {
handlers = [handlers];
}
for (var i = 0; i < handlers.length; i++) {
h = 'on' + handlers[i];
if (Basic.typeOf(this[h]) === 'function') {
this.addEventListener(handlers[i], this[h]);
} else if (Basic.typeOf(this[h]) === 'undefined') {
this[h] = null; // object must have defined event properties, even if it doesn't make use of them
}
}
}
});
}
EventTarget.instance = new EventTarget();
return EventTarget;
});
// Included from: src/javascript/core/utils/Encode.js
/**
* Encode.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/core/utils/Encode', [], function() {
/**
Encode string with UTF-8
@method utf8_encode
@for Utils
@static
@param {String} str String to encode
@return {String} UTF-8 encoded string
*/
var utf8_encode = function(str) {
return unescape(encodeURIComponent(str));
};
/**
Decode UTF-8 encoded string
@method utf8_decode
@static
@param {String} str String to decode
@return {String} Decoded string
*/
var utf8_decode = function(str_data) {
return decodeURIComponent(escape(str_data));
};
/**
Decode Base64 encoded string (uses browser's default method if available),
from: https://raw.github.com/kvz/phpjs/master/functions/url/base64_decode.js
@method atob
@static
@param {String} data String to decode
@return {String} Decoded string
*/
var atob = function(data, utf8) {
if (typeof(window.atob) === 'function') {
return utf8 ? utf8_decode(window.atob(data)) : window.atob(data);
}
// http://kevin.vanzonneveld.net
// + original by: Tyler Akins (http://rumkin.com)
// + improved by: Thunder.m
// + input by: Aman Gupta
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + bugfixed by: Onno Marsman
// + bugfixed by: Pellentesque Malesuada
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + input by: Brett Zamir (http://brett-zamir.me)
// + bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// * example 1: base64_decode('S2V2aW4gdmFuIFpvbm5ldmVsZA==');
// * returns 1: 'Kevin van Zonneveld'
// mozilla has this native
// - but breaks in 2.0.0.12!
//if (typeof this.window.atob == 'function') {
// return atob(data);
//}
var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
var o1, o2, o3, h1, h2, h3, h4, bits, i = 0,
ac = 0,
dec = "",
tmp_arr = [];
if (!data) {
return data;
}
data += '';
do { // unpack four hexets into three octets using index points in b64
h1 = b64.indexOf(data.charAt(i++));
h2 = b64.indexOf(data.charAt(i++));
h3 = b64.indexOf(data.charAt(i++));
h4 = b64.indexOf(data.charAt(i++));
bits = h1 << 18 | h2 << 12 | h3 << 6 | h4;
o1 = bits >> 16 & 0xff;
o2 = bits >> 8 & 0xff;
o3 = bits & 0xff;
if (h3 == 64) {
tmp_arr[ac++] = String.fromCharCode(o1);
} else if (h4 == 64) {
tmp_arr[ac++] = String.fromCharCode(o1, o2);
} else {
tmp_arr[ac++] = String.fromCharCode(o1, o2, o3);
}
} while (i < data.length);
dec = tmp_arr.join('');
return utf8 ? utf8_decode(dec) : dec;
};
/**
Base64 encode string (uses browser's default method if available),
from: https://raw.github.com/kvz/phpjs/master/functions/url/base64_encode.js
@method btoa
@static
@param {String} data String to encode
@return {String} Base64 encoded string
*/
var btoa = function(data, utf8) {
if (utf8) {
utf8_encode(data);
}
if (typeof(window.btoa) === 'function') {
return window.btoa(data);
}
// http://kevin.vanzonneveld.net
// + original by: Tyler Akins (http://rumkin.com)
// + improved by: Bayron Guevara
// + improved by: Thunder.m
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + bugfixed by: Pellentesque Malesuada
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + improved by: Rafał Kukawski (http://kukawski.pl)
// * example 1: base64_encode('Kevin van Zonneveld');
// * returns 1: 'S2V2aW4gdmFuIFpvbm5ldmVsZA=='
// mozilla has this native
// - but breaks in 2.0.0.12!
var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
var o1, o2, o3, h1, h2, h3, h4, bits, i = 0,
ac = 0,
enc = "",
tmp_arr = [];
if (!data) {
return data;
}
do { // pack three octets into four hexets
o1 = data.charCodeAt(i++);
o2 = data.charCodeAt(i++);
o3 = data.charCodeAt(i++);
bits = o1 << 16 | o2 << 8 | o3;
h1 = bits >> 18 & 0x3f;
h2 = bits >> 12 & 0x3f;
h3 = bits >> 6 & 0x3f;
h4 = bits & 0x3f;
// use hexets to index into b64, and append result to encoded string
tmp_arr[ac++] = b64.charAt(h1) + b64.charAt(h2) + b64.charAt(h3) + b64.charAt(h4);
} while (i < data.length);
enc = tmp_arr.join('');
var r = data.length % 3;
return (r ? enc.slice(0, r - 3) : enc) + '==='.slice(r || 3);
};
return {
utf8_encode: utf8_encode,
utf8_decode: utf8_decode,
atob: atob,
btoa: btoa
};
});
// Included from: src/javascript/runtime/Runtime.js
/**
* Runtime.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/runtime/Runtime', [
"moxie/core/utils/Basic",
"moxie/core/utils/Dom",
"moxie/core/EventTarget"
], function(Basic, Dom, EventTarget) {
var runtimeConstructors = {}, runtimes = {};
/**
Common set of methods and properties for every runtime instance
@class Runtime
@param {Object} options
@param {String} type Sanitized name of the runtime
@param {Object} [caps] Set of capabilities that differentiate specified runtime
@param {Object} [modeCaps] Set of capabilities that do require specific operational mode
@param {String} [preferredMode='browser'] Preferred operational mode to choose if no required capabilities were requested
*/
function Runtime(options, type, caps, modeCaps, preferredMode) {
/**
Dispatched when runtime is initialized and ready.
Results in RuntimeInit on a connected component.
@event Init
*/
/**
Dispatched when runtime fails to initialize.
Results in RuntimeError on a connected component.
@event Error
*/
var self = this
, _shim
, _uid = Basic.guid(type + '_')
, defaultMode = preferredMode || 'browser'
;
options = options || {};
// register runtime in private hash
runtimes[_uid] = this;
/**
Default set of capabilities, which can be redifined later by specific runtime
@private
@property caps
@type Object
*/
caps = Basic.extend({
// Runtime can:
// provide access to raw binary data of the file
access_binary: false,
// provide access to raw binary data of the image (image extension is optional)
access_image_binary: false,
// display binary data as thumbs for example
display_media: false,
// make cross-domain requests
do_cors: false,
// accept files dragged and dropped from the desktop
drag_and_drop: false,
// filter files in selection dialog by their extensions
filter_by_extension: true,
// resize image (and manipulate it raw data of any file in general)
resize_image: false,
// periodically report how many bytes of total in the file were uploaded (loaded)
report_upload_progress: false,
// provide access to the headers of http response
return_response_headers: false,
// support response of specific type, which should be passed as an argument
// e.g. runtime.can('return_response_type', 'blob')
return_response_type: false,
// return http status code of the response
return_status_code: true,
// send custom http header with the request
send_custom_headers: false,
// pick up the files from a dialog
select_file: false,
// select whole folder in file browse dialog
select_folder: false,
// select multiple files at once in file browse dialog
select_multiple: true,
// send raw binary data, that is generated after image resizing or manipulation of other kind
send_binary_string: false,
// send cookies with http request and therefore retain session
send_browser_cookies: true,
// send data formatted as multipart/form-data
send_multipart: true,
// slice the file or blob to smaller parts
slice_blob: false,
// upload file without preloading it to memory, stream it out directly from disk
stream_upload: false,
// programmatically trigger file browse dialog
summon_file_dialog: false,
// upload file of specific size, size should be passed as argument
// e.g. runtime.can('upload_filesize', '500mb')
upload_filesize: true,
// initiate http request with specific http method, method should be passed as argument
// e.g. runtime.can('use_http_method', 'put')
use_http_method: true
}, caps);
// default to the mode that is compatible with preferred caps
if (options.preferred_caps) {
defaultMode = Runtime.getMode(modeCaps, options.preferred_caps, defaultMode);
}
// small extension factory here (is meant to be extended with actual extensions constructors)
_shim = (function() {
var objpool = {};
return {
exec: function(uid, comp, fn, args) {
if (_shim[comp]) {
if (!objpool[uid]) {
objpool[uid] = {
context: this,
instance: new _shim[comp]()
};
}
if (objpool[uid].instance[fn]) {
return objpool[uid].instance[fn].apply(this, args);
}
}
},
removeInstance: function(uid) {
delete objpool[uid];
},
removeAllInstances: function() {
var self = this;
Basic.each(objpool, function(obj, uid) {
if (Basic.typeOf(obj.instance.destroy) === 'function') {
obj.instance.destroy.call(obj.context);
}
self.removeInstance(uid);
});
}
};
}());
// public methods
Basic.extend(this, {
/**
Specifies whether runtime instance was initialized or not
@property initialized
@type {Boolean}
@default false
*/
initialized: false, // shims require this flag to stop initialization retries
/**
Unique ID of the runtime
@property uid
@type {String}
*/
uid: _uid,
/**
Runtime type (e.g. flash, html5, etc)
@property type
@type {String}
*/
type: type,
/**
Runtime (not native one) may operate in browser or client mode.
@property mode
@private
@type {String|Boolean} current mode or false, if none possible
*/
mode: Runtime.getMode(modeCaps, (options.required_caps), defaultMode),
/**
id of the DOM container for the runtime (if available)
@property shimid
@type {String}
*/
shimid: _uid + '_container',
/**
Number of connected clients. If equal to zero, runtime can be destroyed
@property clients
@type {Number}
*/
clients: 0,
/**
Runtime initialization options
@property options
@type {Object}
*/
options: options,
/**
Checks if the runtime has specific capability
@method can
@param {String} cap Name of capability to check
@param {Mixed} [value] If passed, capability should somehow correlate to the value
@param {Object} [refCaps] Set of capabilities to check the specified cap against (defaults to internal set)
@return {Boolean} true if runtime has such capability and false, if - not
*/
can: function(cap, value) {
var refCaps = arguments[2] || caps;
// if cap var is a comma-separated list of caps, convert it to object (key/value)
if (Basic.typeOf(cap) === 'string' && Basic.typeOf(value) === 'undefined') {
cap = Runtime.parseCaps(cap);
}
if (Basic.typeOf(cap) === 'object') {
for (var key in cap) {
if (!this.can(key, cap[key], refCaps)) {
return false;
}
}
return true;
}
// check the individual cap
if (Basic.typeOf(refCaps[cap]) === 'function') {
return refCaps[cap].call(this, value);
} else {
return (value === refCaps[cap]);
}
},
/**
Returns container for the runtime as DOM element
@method getShimContainer
@return {DOMElement}
*/
getShimContainer: function() {
var container, shimContainer = Dom.get(this.shimid);
// if no container for shim, create one
if (!shimContainer) {
container = this.options.container ? Dom.get(this.options.container) : document.body;
// create shim container and insert it at an absolute position into the outer container
shimContainer = document.createElement('div');
shimContainer.id = this.shimid;
shimContainer.className = 'moxie-shim moxie-shim-' + this.type;
Basic.extend(shimContainer.style, {
position: 'absolute',
top: '0px',
left: '0px',
width: '1px',
height: '1px',
overflow: 'hidden'
});
container.appendChild(shimContainer);
container = null;
}
return shimContainer;
},
/**
Returns runtime as DOM element (if appropriate)
@method getShim
@return {DOMElement}
*/
getShim: function() {
return _shim;
},
/**
Invokes a method within the runtime itself (might differ across the runtimes)
@method shimExec
@param {Mixed} []
@protected
@return {Mixed} Depends on the action and component
*/
shimExec: function(component, action) {
var args = [].slice.call(arguments, 2);
return self.getShim().exec.call(this, this.uid, component, action, args);
},
/**
Operaional interface that is used by components to invoke specific actions on the runtime
(is invoked in the scope of component)
@method exec
@param {Mixed} []*
@protected
@return {Mixed} Depends on the action and component
*/
exec: function(component, action) { // this is called in the context of component, not runtime
var args = [].slice.call(arguments, 2);
if (self[component] && self[component][action]) {
return self[component][action].apply(this, args);
}
return self.shimExec.apply(this, arguments);
},
/**
Destroys the runtime (removes all events and deletes DOM structures)
@method destroy
*/
destroy: function() {
if (!self) {
return; // obviously already destroyed
}
var shimContainer = Dom.get(this.shimid);
if (shimContainer) {
shimContainer.parentNode.removeChild(shimContainer);
}
if (_shim) {
_shim.removeAllInstances();
}
this.unbindAll();
delete runtimes[this.uid];
this.uid = null; // mark this runtime as destroyed
_uid = self = _shim = shimContainer = null;
}
});
// once we got the mode, test against all caps
if (this.mode && options.required_caps && !this.can(options.required_caps)) {
this.mode = false;
}
}
/**
Default order to try different runtime types
@property order
@type String
@static
*/
Runtime.order = 'html5,flash,silverlight,html4';
/**
Retrieves runtime from private hash by it's uid
@method getRuntime
@private
@static
@param {String} uid Unique identifier of the runtime
@return {Runtime|Boolean} Returns runtime, if it exists and false, if - not
*/
Runtime.getRuntime = function(uid) {
return runtimes[uid] ? runtimes[uid] : false;
};
/**
Register constructor for the Runtime of new (or perhaps modified) type
@method addConstructor
@static
@param {String} type Runtime type (e.g. flash, html5, etc)
@param {Function} construct Constructor for the Runtime type
*/
Runtime.addConstructor = function(type, constructor) {
constructor.prototype = EventTarget.instance;
runtimeConstructors[type] = constructor;
};
/**
Get the constructor for the specified type.
method getConstructor
@static
@param {String} type Runtime type (e.g. flash, html5, etc)
@return {Function} Constructor for the Runtime type
*/
Runtime.getConstructor = function(type) {
return runtimeConstructors[type] || null;
};
/**
Get info about the runtime (uid, type, capabilities)
@method getInfo
@static
@param {String} uid Unique identifier of the runtime
@return {Mixed} Info object or null if runtime doesn't exist
*/
Runtime.getInfo = function(uid) {
var runtime = Runtime.getRuntime(uid);
if (runtime) {
return {
uid: runtime.uid,
type: runtime.type,
mode: runtime.mode,
can: function() {
return runtime.can.apply(runtime, arguments);
}
};
}
return null;
};
/**
Convert caps represented by a comma-separated string to the object representation.
@method parseCaps
@static
@param {String} capStr Comma-separated list of capabilities
@return {Object}
*/
Runtime.parseCaps = function(capStr) {
var capObj = {};
if (Basic.typeOf(capStr) !== 'string') {
return capStr || {};
}
Basic.each(capStr.split(','), function(key) {
capObj[key] = true; // we assume it to be - true
});
return capObj;
};
/**
Test the specified runtime for specific capabilities.
@method can
@static
@param {String} type Runtime type (e.g. flash, html5, etc)
@param {String|Object} caps Set of capabilities to check
@return {Boolean} Result of the test
*/
Runtime.can = function(type, caps) {
var runtime
, constructor = Runtime.getConstructor(type)
, mode
;
if (constructor) {
runtime = new constructor({
required_caps: caps
});
mode = runtime.mode;
runtime.destroy();
return !!mode;
}
return false;
};
/**
Figure out a runtime that supports specified capabilities.
@method thatCan
@static
@param {String|Object} caps Set of capabilities to check
@param {String} [runtimeOrder] Comma-separated list of runtimes to check against
@return {String} Usable runtime identifier or null
*/
Runtime.thatCan = function(caps, runtimeOrder) {
var types = (runtimeOrder || Runtime.order).split(/\s*,\s*/);
for (var i in types) {
if (Runtime.can(types[i], caps)) {
return types[i];
}
}
return null;
};
/**
Figure out an operational mode for the specified set of capabilities.
@method getMode
@static
@param {Object} modeCaps Set of capabilities that depend on particular runtime mode
@param {Object} [requiredCaps] Supplied set of capabilities to find operational mode for
@param {String|Boolean} [defaultMode='browser'] Default mode to use
@return {String|Boolean} Compatible operational mode
*/
Runtime.getMode = function(modeCaps, requiredCaps, defaultMode) {
var mode = null;
if (Basic.typeOf(defaultMode) === 'undefined') { // only if not specified
defaultMode = 'browser';
}
if (requiredCaps && !Basic.isEmptyObj(modeCaps)) {
// loop over required caps and check if they do require the same mode
Basic.each(requiredCaps, function(value, cap) {
if (modeCaps.hasOwnProperty(cap)) {
var capMode = modeCaps[cap](value);
// make sure we always have an array
if (typeof(capMode) === 'string') {
capMode = [capMode];
}
if (!mode) {
mode = capMode;
} else if (!(mode = Basic.arrayIntersect(mode, capMode))) {
// if cap requires conflicting mode - runtime cannot fulfill required caps
return (mode = false);
}
}
});
if (mode) {
return Basic.inArray(defaultMode, mode) !== -1 ? defaultMode : mode[0];
} else if (mode === false) {
return false;
}
}
return defaultMode;
};
/**
Capability check that always returns true
@private
@static
@return {True}
*/
Runtime.capTrue = function() {
return true;
};
/**
Capability check that always returns false
@private
@static
@return {False}
*/
Runtime.capFalse = function() {
return false;
};
/**
Evaluate the expression to boolean value and create a function that always returns it.
@private
@static
@param {Mixed} expr Expression to evaluate
@return {Function} Function returning the result of evaluation
*/
Runtime.capTest = function(expr) {
return function() {
return !!expr;
};
};
return Runtime;
});
// Included from: src/javascript/runtime/RuntimeClient.js
/**
* RuntimeClient.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/runtime/RuntimeClient', [
'moxie/core/Exceptions',
'moxie/core/utils/Basic',
'moxie/runtime/Runtime'
], function(x, Basic, Runtime) {
/**
Set of methods and properties, required by a component to acquire ability to connect to a runtime
@class RuntimeClient
*/
return function RuntimeClient() {
var runtime;
Basic.extend(this, {
/**
Connects to the runtime specified by the options. Will either connect to existing runtime or create a new one.
Increments number of clients connected to the specified runtime.
@method connectRuntime
@param {Mixed} options Can be a runtme uid or a set of key-value pairs defining requirements and pre-requisites
*/
connectRuntime: function(options) {
var comp = this, ruid;
function initialize(items) {
var type, constructor;
// if we ran out of runtimes
if (!items.length) {
comp.trigger('RuntimeError', new x.RuntimeError(x.RuntimeError.NOT_INIT_ERR));
runtime = null;
return;
}
type = items.shift();
constructor = Runtime.getConstructor(type);
if (!constructor) {
initialize(items);
return;
}
// try initializing the runtime
runtime = new constructor(options);
runtime.bind('Init', function() {
// mark runtime as initialized
runtime.initialized = true;
// jailbreak ...
setTimeout(function() {
runtime.clients++;
// this will be triggered on component
comp.trigger('RuntimeInit', runtime);
}, 1);
});
runtime.bind('Error', function() {
runtime.destroy(); // runtime cannot destroy itself from inside at a right moment, thus we do it here
initialize(items);
});
/*runtime.bind('Exception', function() { });*/
// check if runtime managed to pick-up operational mode
if (!runtime.mode) {
runtime.trigger('Error');
return;
}
runtime.init();
}
// check if a particular runtime was requested
if (Basic.typeOf(options) === 'string') {
ruid = options;
} else if (Basic.typeOf(options.ruid) === 'string') {
ruid = options.ruid;
}
if (ruid) {
runtime = Runtime.getRuntime(ruid);
if (runtime) {
runtime.clients++;
return runtime;
} else {
// there should be a runtime and there's none - weird case
throw new x.RuntimeError(x.RuntimeError.NOT_INIT_ERR);
}
}
// initialize a fresh one, that fits runtime list and required features best
initialize((options.runtime_order || Runtime.order).split(/\s*,\s*/));
},
/**
Returns the runtime to which the client is currently connected.
@method getRuntime
@return {Runtime} Runtime or null if client is not connected
*/
getRuntime: function() {
if (runtime && runtime.uid) {
return runtime;
}
runtime = null; // make sure we do not leave zombies rambling around
return null;
},
/**
Disconnects from the runtime. Decrements number of clients connected to the specified runtime.
@method disconnectRuntime
*/
disconnectRuntime: function() {
if (runtime && --runtime.clients <= 0) {
runtime.destroy();
runtime = null;
}
}
});
};
});
// Included from: src/javascript/file/Blob.js
/**
* Blob.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/file/Blob', [
'moxie/core/utils/Basic',
'moxie/core/utils/Encode',
'moxie/runtime/RuntimeClient'
], function(Basic, Encode, RuntimeClient) {
var blobpool = {};
/**
@class Blob
@constructor
@param {String} ruid Unique id of the runtime, to which this blob belongs to
@param {Object} blob Object "Native" blob object, as it is represented in the runtime
*/
function Blob(ruid, blob) {
function _sliceDetached(start, end, type) {
var blob, data = blobpool[this.uid];
if (Basic.typeOf(data) !== 'string' || !data.length) {
return null; // or throw exception
}
blob = new Blob(null, {
type: type,
size: end - start
});
blob.detach(data.substr(start, blob.size));
return blob;
}
RuntimeClient.call(this);
if (ruid) {
this.connectRuntime(ruid);
}
if (!blob) {
blob = {};
} else if (Basic.typeOf(blob) === 'string') { // dataUrl or binary string
blob = { data: blob };
}
Basic.extend(this, {
/**
Unique id of the component
@property uid
@type {String}
*/
uid: blob.uid || Basic.guid('uid_'),
/**
Unique id of the connected runtime, if falsy, then runtime will have to be initialized
before this Blob can be used, modified or sent
@property ruid
@type {String}
*/
ruid: ruid,
/**
Size of blob
@property size
@type {Number}
@default 0
*/
size: blob.size || 0,
/**
Mime type of blob
@property type
@type {String}
@default ''
*/
type: blob.type || '',
/**
@method slice
@param {Number} [start=0]
*/
slice: function(start, end, type) {
if (this.isDetached()) {
return _sliceDetached.apply(this, arguments);
}
return this.getRuntime().exec.call(this, 'Blob', 'slice', this.getSource(), start, end, type);
},
/**
Returns "native" blob object (as it is represented in connected runtime) or null if not found
@method getSource
@return {Blob} Returns "native" blob object or null if not found
*/
getSource: function() {
if (!blobpool[this.uid]) {
return null;
}
return blobpool[this.uid];
},
/**
Detaches blob from any runtime that it depends on and initialize with standalone value
@method detach
@protected
@param {DOMString} [data=''] Standalone value
*/
detach: function(data) {
if (this.ruid) {
this.getRuntime().exec.call(this, 'Blob', 'destroy');
this.disconnectRuntime();
this.ruid = null;
}
data = data || '';
// if dataUrl, convert to binary string
var matches = data.match(/^data:([^;]*);base64,/);
if (matches) {
this.type = matches[1];
data = Encode.atob(data.substring(data.indexOf('base64,') + 7));
}
this.size = data.length;
blobpool[this.uid] = data;
},
/**
Checks if blob is standalone (detached of any runtime)
@method isDetached
@protected
@return {Boolean}
*/
isDetached: function() {
return !this.ruid && Basic.typeOf(blobpool[this.uid]) === 'string';
},
/**
Destroy Blob and free any resources it was using
@method destroy
*/
destroy: function() {
this.detach();
delete blobpool[this.uid];
}
});
if (blob.data) {
this.detach(blob.data); // auto-detach if payload has been passed
} else {
blobpool[this.uid] = blob;
}
}
return Blob;
});
// Included from: src/javascript/file/File.js
/**
* File.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/file/File', [
'moxie/core/utils/Basic',
'moxie/core/utils/Mime',
'moxie/file/Blob'
], function(Basic, Mime, Blob) {
/**
@class File
@extends Blob
@constructor
@param {String} ruid Unique id of the runtime, to which this blob belongs to
@param {Object} file Object "Native" file object, as it is represented in the runtime
*/
function File(ruid, file) {
var name, type;
if (!file) { // avoid extra errors in case we overlooked something
file = {};
}
// figure out the type
if (file.type && file.type !== '') {
type = file.type;
} else {
type = Mime.getFileMime(file.name);
}
// sanitize file name or generate new one
if (file.name) {
name = file.name.replace(/\\/g, '/');
name = name.substr(name.lastIndexOf('/') + 1);
} else {
var prefix = type.split('/')[0];
name = Basic.guid((prefix !== '' ? prefix : 'file') + '_');
if (Mime.extensions[type]) {
name += '.' + Mime.extensions[type][0]; // append proper extension if possible
}
}
Blob.apply(this, arguments);
Basic.extend(this, {
/**
File mime type
@property type
@type {String}
@default ''
*/
type: type || '',
/**
File name
@property name
@type {String}
@default UID
*/
name: name || Basic.guid('file_'),
/**
Relative path to the file inside a directory
@property relativePath
@type {String}
@default ''
*/
relativePath: '',
/**
Date of last modification
@property lastModifiedDate
@type {String}
@default now
*/
lastModifiedDate: file.lastModifiedDate || (new Date()).toLocaleString() // Thu Aug 23 2012 19:40:00 GMT+0400 (GET)
});
}
File.prototype = Blob.prototype;
return File;
});
// Included from: src/javascript/file/FileInput.js
/**
* FileInput.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/file/FileInput', [
'moxie/core/utils/Basic',
'moxie/core/utils/Mime',
'moxie/core/utils/Dom',
'moxie/core/Exceptions',
'moxie/core/EventTarget',
'moxie/core/I18n',
'moxie/file/File',
'moxie/runtime/Runtime',
'moxie/runtime/RuntimeClient'
], function(Basic, Mime, Dom, x, EventTarget, I18n, File, Runtime, RuntimeClient) {
/**
Provides a convenient way to create cross-browser file-picker. Generates file selection dialog on click,
converts selected files to _File_ objects, to be used in conjunction with _Image_, preloaded in memory
with _FileReader_ or uploaded to a server through _XMLHttpRequest_.
@class FileInput
@constructor
@extends EventTarget
@uses RuntimeClient
@param {Object|String|DOMElement} options If options is string or node, argument is considered as _browse\_button_.
@param {String|DOMElement} options.browse_button DOM Element to turn into file picker.
@param {Array} [options.accept] Array of mime types to accept. By default accepts all.
@param {String} [options.file='file'] Name of the file field (not the filename).
@param {Boolean} [options.multiple=false] Enable selection of multiple files.
@param {Boolean} [options.directory=false] Turn file input into the folder input (cannot be both at the same time).
@param {String|DOMElement} [options.container] DOM Element to use as a container for file-picker. Defaults to parentNode
for _browse\_button_.
@param {Object|String} [options.required_caps] Set of required capabilities, that chosen runtime must support.
@example
<div id="container">
<a id="file-picker" href="javascript:;">Browse...</a>
</div>
<script>
var fileInput = new mOxie.FileInput({
browse_button: 'file-picker', // or document.getElementById('file-picker')
container: 'container',
accept: [
{title: "Image files", extensions: "jpg,gif,png"} // accept only images
],
multiple: true // allow multiple file selection
});
fileInput.onchange = function(e) {
// do something to files array
console.info(e.target.files); // or this.files or fileInput.files
};
fileInput.init(); // initialize
</script>
*/
var dispatches = [
/**
Dispatched when runtime is connected and file-picker is ready to be used.
@event ready
@param {Object} event
*/
'ready',
/**
Dispatched right after [ready](#event_ready) event, and whenever [refresh()](#method_refresh) is invoked.
Check [corresponding documentation entry](#method_refresh) for more info.
@event refresh
@param {Object} event
*/
/**
Dispatched when selection of files in the dialog is complete.
@event change
@param {Object} event
*/
'change',
'cancel', // TODO: might be useful
/**
Dispatched when mouse cursor enters file-picker area. Can be used to style element
accordingly.
@event mouseenter
@param {Object} event
*/
'mouseenter',
/**
Dispatched when mouse cursor leaves file-picker area. Can be used to style element
accordingly.
@event mouseleave
@param {Object} event
*/
'mouseleave',
/**
Dispatched when functional mouse button is pressed on top of file-picker area.
@event mousedown
@param {Object} event
*/
'mousedown',
/**
Dispatched when functional mouse button is released on top of file-picker area.
@event mouseup
@param {Object} event
*/
'mouseup'
];
function FileInput(options) {
var self = this,
container, browseButton, defaults;
// if flat argument passed it should be browse_button id
if (Basic.inArray(Basic.typeOf(options), ['string', 'node']) !== -1) {
options = { browse_button : options };
}
// this will help us to find proper default container
browseButton = Dom.get(options.browse_button);
if (!browseButton) {
// browse button is required
throw new x.DOMException(x.DOMException.NOT_FOUND_ERR);
}
// figure out the options
defaults = {
accept: [{
title: I18n.translate('All Files'),
extensions: '*'
}],
name: 'file',
multiple: false,
required_caps: false,
container: browseButton.parentNode || document.body
};
options = Basic.extend({}, defaults, options);
// convert to object representation
if (typeof(options.required_caps) === 'string') {
options.required_caps = Runtime.parseCaps(options.required_caps);
}
// normalize accept option (could be list of mime types or array of title/extensions pairs)
if (typeof(options.accept) === 'string') {
options.accept = Mime.mimes2extList(options.accept);
}
container = Dom.get(options.container);
// make sure we have container
if (!container) {
container = document.body;
}
// make container relative, if it's not
if (Dom.getStyle(container, 'position') === 'static') {
container.style.position = 'relative';
}
container = browseButton = null; // IE
RuntimeClient.call(self);
Basic.extend(self, {
/**
Unique id of the component
@property uid
@protected
@readOnly
@type {String}
@default UID
*/
uid: Basic.guid('uid_'),
/**
Unique id of the connected runtime, if any.
@property ruid
@protected
@type {String}
*/
ruid: null,
/**
Unique id of the runtime container. Useful to get hold of it for various manipulations.
@property shimid
@protected
@type {String}
*/
shimid: null,
/**
Array of selected mOxie.File objects
@property files
@type {Array}
@default null
*/
files: null,
/**
Initializes the file-picker, connects it to runtime and dispatches event ready when done.
@method init
*/
init: function() {
self.convertEventPropsToHandlers(dispatches);
self.bind('RuntimeInit', function(e, runtime) {
self.ruid = runtime.uid;
self.shimid = runtime.shimid;
self.bind("Ready", function() {
self.trigger("Refresh");
}, 999);
self.bind("Change", function() {
var files = runtime.exec.call(self, 'FileInput', 'getFiles');
self.files = [];
Basic.each(files, function(file) {
// ignore empty files (IE10 for example hangs if you try to send them via XHR)
if (file.size === 0) {
return true;
}
self.files.push(new File(self.ruid, file));
});
}, 999);
// re-position and resize shim container
self.bind('Refresh', function() {
var pos, size, browseButton, shimContainer;
browseButton = Dom.get(options.browse_button);
shimContainer = Dom.get(runtime.shimid); // do not use runtime.getShimContainer(), since it will create container if it doesn't exist
if (browseButton) {
pos = Dom.getPos(browseButton, Dom.get(options.container));
size = Dom.getSize(browseButton);
if (shimContainer) {
Basic.extend(shimContainer.style, {
top : pos.y + 'px',
left : pos.x + 'px',
width : size.w + 'px',
height : size.h + 'px'
});
}
}
shimContainer = browseButton = null;
});
runtime.exec.call(self, 'FileInput', 'init', options);
});
// runtime needs: options.required_features, options.runtime_order and options.container
self.connectRuntime(Basic.extend({}, options, {
required_caps: {
select_file: true
}
}));
},
/**
Disables file-picker element, so that it doesn't react to mouse clicks.
@method disable
@param {Boolean} [state=true] Disable component if - true, enable if - false
*/
disable: function(state) {
var runtime = this.getRuntime();
if (runtime) {
runtime.exec.call(this, 'FileInput', 'disable', Basic.typeOf(state) === 'undefined' ? true : state);
}
},
/**
Reposition and resize dialog trigger to match the position and size of browse_button element.
@method refresh
*/
refresh: function() {
self.trigger("Refresh");
},
/**
Destroy component.
@method destroy
*/
destroy: function() {
var runtime = this.getRuntime();
if (runtime) {
runtime.exec.call(this, 'FileInput', 'destroy');
this.disconnectRuntime();
}
if (Basic.typeOf(this.files) === 'array') {
// no sense in leaving associated files behind
Basic.each(this.files, function(file) {
file.destroy();
});
}
this.files = null;
}
});
}
FileInput.prototype = EventTarget.instance;
return FileInput;
});
// Included from: src/javascript/runtime/RuntimeTarget.js
/**
* RuntimeTarget.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/runtime/RuntimeTarget', [
'moxie/core/utils/Basic',
'moxie/runtime/RuntimeClient',
"moxie/core/EventTarget"
], function(Basic, RuntimeClient, EventTarget) {
/**
Instance of this class can be used as a target for the events dispatched by shims,
when allowing them onto components is for either reason inappropriate
@class RuntimeTarget
@constructor
@protected
@extends EventTarget
*/
function RuntimeTarget() {
this.uid = Basic.guid('uid_');
RuntimeClient.call(this);
this.destroy = function() {
this.disconnectRuntime();
this.unbindAll();
};
}
RuntimeTarget.prototype = EventTarget.instance;
return RuntimeTarget;
});
// Included from: src/javascript/file/FileReader.js
/**
* FileReader.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/file/FileReader', [
'moxie/core/utils/Basic',
'moxie/core/utils/Encode',
'moxie/core/Exceptions',
'moxie/core/EventTarget',
'moxie/file/Blob',
'moxie/file/File',
'moxie/runtime/RuntimeTarget'
], function(Basic, Encode, x, EventTarget, Blob, File, RuntimeTarget) {
/**
Utility for preloading o.Blob/o.File objects in memory. By design closely follows [W3C FileReader](http://www.w3.org/TR/FileAPI/#dfn-filereader)
interface. Where possible uses native FileReader, where - not falls back to shims.
@class FileReader
@constructor FileReader
@extends EventTarget
@uses RuntimeClient
*/
var dispatches = [
/**
Dispatched when the read starts.
@event loadstart
@param {Object} event
*/
'loadstart',
/**
Dispatched while reading (and decoding) blob, and reporting partial Blob data (progess.loaded/progress.total).
@event progress
@param {Object} event
*/
'progress',
/**
Dispatched when the read has successfully completed.
@event load
@param {Object} event
*/
'load',
/**
Dispatched when the read has been aborted. For instance, by invoking the abort() method.
@event abort
@param {Object} event
*/
'abort',
/**
Dispatched when the read has failed.
@event error
@param {Object} event
*/
'error',
/**
Dispatched when the request has completed (either in success or failure).
@event loadend
@param {Object} event
*/
'loadend'
];
function FileReader() {
var self = this, _fr;
Basic.extend(this, {
/**
UID of the component instance.
@property uid
@type {String}
*/
uid: Basic.guid('uid_'),
/**
Contains current state of FileReader object. Can take values of FileReader.EMPTY, FileReader.LOADING
and FileReader.DONE.
@property readyState
@type {Number}
@default FileReader.EMPTY
*/
readyState: FileReader.EMPTY,
/**
Result of the successful read operation.
@property result
@type {String}
*/
result: null,
/**
Stores the error of failed asynchronous read operation.
@property error
@type {DOMError}
*/
error: null,
/**
Initiates reading of File/Blob object contents to binary string.
@method readAsBinaryString
@param {Blob|File} blob Object to preload
*/
readAsBinaryString: function(blob) {
_read.call(this, 'readAsBinaryString', blob);
},
/**
Initiates reading of File/Blob object contents to dataURL string.
@method readAsDataURL
@param {Blob|File} blob Object to preload
*/
readAsDataURL: function(blob) {
_read.call(this, 'readAsDataURL', blob);
},
/**
Initiates reading of File/Blob object contents to string.
@method readAsText
@param {Blob|File} blob Object to preload
*/
readAsText: function(blob) {
_read.call(this, 'readAsText', blob);
},
/**
Aborts preloading process.
@method abort
*/
abort: function() {
this.result = null;
if (Basic.inArray(this.readyState, [FileReader.EMPTY, FileReader.DONE]) !== -1) {
return;
} else if (this.readyState === FileReader.LOADING) {
this.readyState = FileReader.DONE;
}
if (_fr) {
_fr.getRuntime().exec.call(this, 'FileReader', 'abort');
}
this.trigger('abort');
this.trigger('loadend');
},
/**
Destroy component and release resources.
@method destroy
*/
destroy: function() {
this.abort();
if (_fr) {
_fr.getRuntime().exec.call(this, 'FileReader', 'destroy');
_fr.disconnectRuntime();
}
self = _fr = null;
}
});
function _read(op, blob) {
_fr = new RuntimeTarget();
function error(err) {
self.readyState = FileReader.DONE;
self.error = err;
self.trigger('error');
loadEnd();
}
function loadEnd() {
_fr.destroy();
_fr = null;
self.trigger('loadend');
}
function exec(runtime) {
_fr.bind('Error', function(e, err) {
error(err);
});
_fr.bind('Progress', function(e) {
self.result = runtime.exec.call(_fr, 'FileReader', 'getResult');
self.trigger(e);
});
_fr.bind('Load', function(e) {
self.readyState = FileReader.DONE;
self.result = runtime.exec.call(_fr, 'FileReader', 'getResult');
self.trigger(e);
loadEnd();
});
runtime.exec.call(_fr, 'FileReader', 'read', op, blob);
}
this.convertEventPropsToHandlers(dispatches);
if (this.readyState === FileReader.LOADING) {
return error(new x.DOMException(x.DOMException.INVALID_STATE_ERR));
}
this.readyState = FileReader.LOADING;
this.trigger('loadstart');
// if source is o.Blob/o.File
if (blob instanceof Blob) {
if (blob.isDetached()) {
var src = blob.getSource();
switch (op) {
case 'readAsText':
case 'readAsBinaryString':
this.result = src;
break;
case 'readAsDataURL':
this.result = 'data:' + blob.type + ';base64,' + Encode.btoa(src);
break;
}
this.readyState = FileReader.DONE;
this.trigger('load');
loadEnd();
} else {
exec(_fr.connectRuntime(blob.ruid));
}
} else {
error(new x.DOMException(x.DOMException.NOT_FOUND_ERR));
}
}
}
/**
Initial FileReader state
@property EMPTY
@type {Number}
@final
@static
@default 0
*/
FileReader.EMPTY = 0;
/**
FileReader switches to this state when it is preloading the source
@property LOADING
@type {Number}
@final
@static
@default 1
*/
FileReader.LOADING = 1;
/**
Preloading is complete, this is a final state
@property DONE
@type {Number}
@final
@static
@default 2
*/
FileReader.DONE = 2;
FileReader.prototype = EventTarget.instance;
return FileReader;
});
// Included from: src/javascript/core/utils/Url.js
/**
* Url.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/core/utils/Url', [], function() {
/**
Parse url into separate components and fill in absent parts with parts from current url,
based on https://raw.github.com/kvz/phpjs/master/functions/url/parse_url.js
@method parseUrl
@for Utils
@static
@param {String} url Url to parse (defaults to empty string if undefined)
@return {Object} Hash containing extracted uri components
*/
var parseUrl = function(url, currentUrl) {
var key = ['source', 'scheme', 'authority', 'userInfo', 'user', 'pass', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'fragment']
, i = key.length
, ports = {
http: 80,
https: 443
}
, uri = {}
, regex = /^(?:([^:\/?#]+):)?(?:\/\/()(?:(?:()(?:([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?()(?:(()(?:(?:[^?#\/]*\/)*)()(?:[^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/
, m = regex.exec(url || '')
;
while (i--) {
if (m[i]) {
uri[key[i]] = m[i];
}
}
// when url is relative, we set the origin and the path ourselves
if (!uri.scheme) {
// come up with defaults
if (!currentUrl || typeof(currentUrl) === 'string') {
currentUrl = parseUrl(currentUrl || document.location.href);
}
uri.scheme = currentUrl.scheme;
uri.host = currentUrl.host;
uri.port = currentUrl.port;
var path = '';
// for urls without trailing slash we need to figure out the path
if (/^[^\/]/.test(uri.path)) {
path = currentUrl.path;
// if path ends with a filename, strip it
if (!/(\/|\/[^\.]+)$/.test(path)) {
path = path.replace(/\/[^\/]+$/, '/');
} else {
path += '/';
}
}
uri.path = path + (uri.path || ''); // site may reside at domain.com or domain.com/subdir
}
if (!uri.port) {
uri.port = ports[uri.scheme] || 80;
}
uri.port = parseInt(uri.port, 10);
if (!uri.path) {
uri.path = "/";
}
delete uri.source;
return uri;
};
/**
Resolve url - among other things will turn relative url to absolute
@method resolveUrl
@static
@param {String} url Either absolute or relative
@return {String} Resolved, absolute url
*/
var resolveUrl = function(url) {
var ports = { // we ignore default ports
http: 80,
https: 443
}
, urlp = parseUrl(url)
;
return urlp.scheme + '://' + urlp.host + (urlp.port !== ports[urlp.scheme] ? ':' + urlp.port : '') + urlp.path + (urlp.query ? urlp.query : '');
};
/**
Check if specified url has the same origin as the current document
@method hasSameOrigin
@param {String|Object} url
@return {Boolean}
*/
var hasSameOrigin = function(url) {
function origin(url) {
return [url.scheme, url.host, url.port].join('/');
}
if (typeof url === 'string') {
url = parseUrl(url);
}
return origin(parseUrl()) === origin(url);
};
return {
parseUrl: parseUrl,
resolveUrl: resolveUrl,
hasSameOrigin: hasSameOrigin
};
});
// Included from: src/javascript/file/FileReaderSync.js
/**
* FileReaderSync.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/file/FileReaderSync', [
'moxie/core/utils/Basic',
'moxie/runtime/RuntimeClient',
'moxie/core/utils/Encode'
], function(Basic, RuntimeClient, Encode) {
/**
Synchronous FileReader implementation. Something like this is available in WebWorkers environment, here
it can be used to read only preloaded blobs/files and only below certain size (not yet sure what that'd be,
but probably < 1mb). Not meant to be used directly by user.
@class FileReaderSync
@private
@constructor
*/
return function() {
RuntimeClient.call(this);
Basic.extend(this, {
uid: Basic.guid('uid_'),
readAsBinaryString: function(blob) {
return _read.call(this, 'readAsBinaryString', blob);
},
readAsDataURL: function(blob) {
return _read.call(this, 'readAsDataURL', blob);
},
/*readAsArrayBuffer: function(blob) {
return _read.call(this, 'readAsArrayBuffer', blob);
},*/
readAsText: function(blob) {
return _read.call(this, 'readAsText', blob);
}
});
function _read(op, blob) {
if (blob.isDetached()) {
var src = blob.getSource();
switch (op) {
case 'readAsBinaryString':
return src;
case 'readAsDataURL':
return 'data:' + blob.type + ';base64,' + Encode.btoa(src);
case 'readAsText':
var txt = '';
for (var i = 0, length = src.length; i < length; i++) {
txt += String.fromCharCode(src[i]);
}
return txt;
}
} else {
var result = this.connectRuntime(blob.ruid).exec.call(this, 'FileReaderSync', 'read', op, blob);
this.disconnectRuntime();
return result;
}
}
};
});
// Included from: src/javascript/xhr/FormData.js
/**
* FormData.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define("moxie/xhr/FormData", [
"moxie/core/Exceptions",
"moxie/core/utils/Basic",
"moxie/file/Blob"
], function(x, Basic, Blob) {
/**
FormData
@class FormData
@constructor
*/
function FormData() {
var _blob, _fields = [];
Basic.extend(this, {
/**
Append another key-value pair to the FormData object
@method append
@param {String} name Name for the new field
@param {String|Blob|Array|Object} value Value for the field
*/
append: function(name, value) {
var self = this, valueType = Basic.typeOf(value);
// according to specs value might be either Blob or String
if (value instanceof Blob) {
_blob = {
name: name,
value: value // unfortunately we can only send single Blob in one FormData
};
} else if ('array' === valueType) {
name += '[]';
Basic.each(value, function(value) {
self.append(name, value);
});
} else if ('object' === valueType) {
Basic.each(value, function(value, key) {
self.append(name + '[' + key + ']', value);
});
} else if ('null' === valueType || 'undefined' === valueType || 'number' === valueType && isNaN(value)) {
self.append(name, "false");
} else {
_fields.push({
name: name,
value: value.toString()
});
}
},
/**
Checks if FormData contains Blob.
@method hasBlob
@return {Boolean}
*/
hasBlob: function() {
return !!this.getBlob();
},
/**
Retrieves blob.
@method getBlob
@return {Object} Either Blob if found or null
*/
getBlob: function() {
return _blob && _blob.value || null;
},
/**
Retrieves blob field name.
@method getBlobName
@return {String} Either Blob field name or null
*/
getBlobName: function() {
return _blob && _blob.name || null;
},
/**
Loop over the fields in FormData and invoke the callback for each of them.
@method each
@param {Function} cb Callback to call for each field
*/
each: function(cb) {
Basic.each(_fields, function(field) {
cb(field.value, field.name);
});
if (_blob) {
cb(_blob.value, _blob.name);
}
},
destroy: function() {
_blob = null;
_fields = [];
}
});
}
return FormData;
});
// Included from: src/javascript/xhr/XMLHttpRequest.js
/**
* XMLHttpRequest.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define("moxie/xhr/XMLHttpRequest", [
"moxie/core/utils/Basic",
"moxie/core/Exceptions",
"moxie/core/EventTarget",
"moxie/core/utils/Encode",
"moxie/core/utils/Url",
"moxie/runtime/Runtime",
"moxie/runtime/RuntimeTarget",
"moxie/file/Blob",
"moxie/file/FileReaderSync",
"moxie/xhr/FormData",
"moxie/core/utils/Env",
"moxie/core/utils/Mime"
], function(Basic, x, EventTarget, Encode, Url, Runtime, RuntimeTarget, Blob, FileReaderSync, FormData, Env, Mime) {
var httpCode = {
100: 'Continue',
101: 'Switching Protocols',
102: 'Processing',
200: 'OK',
201: 'Created',
202: 'Accepted',
203: 'Non-Authoritative Information',
204: 'No Content',
205: 'Reset Content',
206: 'Partial Content',
207: 'Multi-Status',
226: 'IM Used',
300: 'Multiple Choices',
301: 'Moved Permanently',
302: 'Found',
303: 'See Other',
304: 'Not Modified',
305: 'Use Proxy',
306: 'Reserved',
307: 'Temporary Redirect',
400: 'Bad Request',
401: 'Unauthorized',
402: 'Payment Required',
403: 'Forbidden',
404: 'Not Found',
405: 'Method Not Allowed',
406: 'Not Acceptable',
407: 'Proxy Authentication Required',
408: 'Request Timeout',
409: 'Conflict',
410: 'Gone',
411: 'Length Required',
412: 'Precondition Failed',
413: 'Request Entity Too Large',
414: 'Request-URI Too Long',
415: 'Unsupported Media Type',
416: 'Requested Range Not Satisfiable',
417: 'Expectation Failed',
422: 'Unprocessable Entity',
423: 'Locked',
424: 'Failed Dependency',
426: 'Upgrade Required',
500: 'Internal Server Error',
501: 'Not Implemented',
502: 'Bad Gateway',
503: 'Service Unavailable',
504: 'Gateway Timeout',
505: 'HTTP Version Not Supported',
506: 'Variant Also Negotiates',
507: 'Insufficient Storage',
510: 'Not Extended'
};
function XMLHttpRequestUpload() {
this.uid = Basic.guid('uid_');
}
XMLHttpRequestUpload.prototype = EventTarget.instance;
/**
Implementation of XMLHttpRequest
@class XMLHttpRequest
@constructor
@uses RuntimeClient
@extends EventTarget
*/
var dispatches = ['loadstart', 'progress', 'abort', 'error', 'load', 'timeout', 'loadend']; // & readystatechange (for historical reasons)
var NATIVE = 1, RUNTIME = 2;
function XMLHttpRequest() {
var self = this,
// this (together with _p() @see below) is here to gracefully upgrade to setter/getter syntax where possible
props = {
/**
The amount of milliseconds a request can take before being terminated. Initially zero. Zero means there is no timeout.
@property timeout
@type Number
@default 0
*/
timeout: 0,
/**
Current state, can take following values:
UNSENT (numeric value 0)
The object has been constructed.
OPENED (numeric value 1)
The open() method has been successfully invoked. During this state request headers can be set using setRequestHeader() and the request can be made using the send() method.
HEADERS_RECEIVED (numeric value 2)
All redirects (if any) have been followed and all HTTP headers of the final response have been received. Several response members of the object are now available.
LOADING (numeric value 3)
The response entity body is being received.
DONE (numeric value 4)
@property readyState
@type Number
@default 0 (UNSENT)
*/
readyState: XMLHttpRequest.UNSENT,
/**
True when user credentials are to be included in a cross-origin request. False when they are to be excluded
in a cross-origin request and when cookies are to be ignored in its response. Initially false.
@property withCredentials
@type Boolean
@default false
*/
withCredentials: false,
/**
Returns the HTTP status code.
@property status
@type Number
@default 0
*/
status: 0,
/**
Returns the HTTP status text.
@property statusText
@type String
*/
statusText: "",
/**
Returns the response type. Can be set to change the response type. Values are:
the empty string (default), "arraybuffer", "blob", "document", "json", and "text".
@property responseType
@type String
*/
responseType: "",
/**
Returns the document response entity body.
Throws an "InvalidStateError" exception if responseType is not the empty string or "document".
@property responseXML
@type Document
*/
responseXML: null,
/**
Returns the text response entity body.
Throws an "InvalidStateError" exception if responseType is not the empty string or "text".
@property responseText
@type String
*/
responseText: null,
/**
Returns the response entity body (http://www.w3.org/TR/XMLHttpRequest/#response-entity-body).
Can become: ArrayBuffer, Blob, Document, JSON, Text
@property response
@type Mixed
*/
response: null
},
_async = true,
_url,
_method,
_headers = {},
_user,
_password,
_encoding = null,
_mimeType = null,
// flags
_sync_flag = false,
_send_flag = false,
_upload_events_flag = false,
_upload_complete_flag = false,
_error_flag = false,
_same_origin_flag = false,
// times
_start_time,
_timeoutset_time,
_finalMime = null,
_finalCharset = null,
_options = {},
_xhr,
_responseHeaders = '',
_responseHeadersBag
;
Basic.extend(this, props, {
/**
Unique id of the component
@property uid
@type String
*/
uid: Basic.guid('uid_'),
/**
Target for Upload events
@property upload
@type XMLHttpRequestUpload
*/
upload: new XMLHttpRequestUpload(),
/**
Sets the request method, request URL, synchronous flag, request username, and request password.
Throws a "SyntaxError" exception if one of the following is true:
method is not a valid HTTP method.
url cannot be resolved.
url contains the "user:password" format in the userinfo production.
Throws a "SecurityError" exception if method is a case-insensitive match for CONNECT, TRACE or TRACK.
Throws an "InvalidAccessError" exception if one of the following is true:
Either user or password is passed as argument and the origin of url does not match the XMLHttpRequest origin.
There is an associated XMLHttpRequest document and either the timeout attribute is not zero,
the withCredentials attribute is true, or the responseType attribute is not the empty string.
@method open
@param {String} method HTTP method to use on request
@param {String} url URL to request
@param {Boolean} [async=true] If false request will be done in synchronous manner. Asynchronous by default.
@param {String} [user] Username to use in HTTP authentication process on server-side
@param {String} [password] Password to use in HTTP authentication process on server-side
*/
open: function(method, url, async, user, password) {
var urlp;
// first two arguments are required
if (!method || !url) {
throw new x.DOMException(x.DOMException.SYNTAX_ERR);
}
// 2 - check if any code point in method is higher than U+00FF or after deflating method it does not match the method
if (/[\u0100-\uffff]/.test(method) || Encode.utf8_encode(method) !== method) {
throw new x.DOMException(x.DOMException.SYNTAX_ERR);
}
// 3
if (!!~Basic.inArray(method.toUpperCase(), ['CONNECT', 'DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT', 'TRACE', 'TRACK'])) {
_method = method.toUpperCase();
}
// 4 - allowing these methods poses a security risk
if (!!~Basic.inArray(_method, ['CONNECT', 'TRACE', 'TRACK'])) {
throw new x.DOMException(x.DOMException.SECURITY_ERR);
}
// 5
url = Encode.utf8_encode(url);
// 6 - Resolve url relative to the XMLHttpRequest base URL. If the algorithm returns an error, throw a "SyntaxError".
urlp = Url.parseUrl(url);
_same_origin_flag = Url.hasSameOrigin(urlp);
// 7 - manually build up absolute url
_url = Url.resolveUrl(url);
// 9-10, 12-13
if ((user || password) && !_same_origin_flag) {
throw new x.DOMException(x.DOMException.INVALID_ACCESS_ERR);
}
_user = user || urlp.user;
_password = password || urlp.pass;
// 11
_async = async || true;
if (_async === false && (_p('timeout') || _p('withCredentials') || _p('responseType') !== "")) {
throw new x.DOMException(x.DOMException.INVALID_ACCESS_ERR);
}
// 14 - terminate abort()
// 15 - terminate send()
// 18
_sync_flag = !_async;
_send_flag = false;
_headers = {};
_reset.call(this);
// 19
_p('readyState', XMLHttpRequest.OPENED);
// 20
this.convertEventPropsToHandlers(['readystatechange']); // unify event handlers
this.dispatchEvent('readystatechange');
},
/**
Appends an header to the list of author request headers, or if header is already
in the list of author request headers, combines its value with value.
Throws an "InvalidStateError" exception if the state is not OPENED or if the send() flag is set.
Throws a "SyntaxError" exception if header is not a valid HTTP header field name or if value
is not a valid HTTP header field value.
@method setRequestHeader
@param {String} header
@param {String|Number} value
*/
setRequestHeader: function(header, value) {
var uaHeaders = [ // these headers are controlled by the user agent
"accept-charset",
"accept-encoding",
"access-control-request-headers",
"access-control-request-method",
"connection",
"content-length",
"cookie",
"cookie2",
"content-transfer-encoding",
"date",
"expect",
"host",
"keep-alive",
"origin",
"referer",
"te",
"trailer",
"transfer-encoding",
"upgrade",
"user-agent",
"via"
];
// 1-2
if (_p('readyState') !== XMLHttpRequest.OPENED || _send_flag) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
// 3
if (/[\u0100-\uffff]/.test(header) || Encode.utf8_encode(header) !== header) {
throw new x.DOMException(x.DOMException.SYNTAX_ERR);
}
// 4
/* this step is seemingly bypassed in browsers, probably to allow various unicode characters in header values
if (/[\u0100-\uffff]/.test(value) || Encode.utf8_encode(value) !== value) {
throw new x.DOMException(x.DOMException.SYNTAX_ERR);
}*/
header = Basic.trim(header).toLowerCase();
// setting of proxy-* and sec-* headers is prohibited by spec
if (!!~Basic.inArray(header, uaHeaders) || /^(proxy\-|sec\-)/.test(header)) {
return false;
}
// camelize
// browsers lowercase header names (at least for custom ones)
// header = header.replace(/\b\w/g, function($1) { return $1.toUpperCase(); });
if (!_headers[header]) {
_headers[header] = value;
} else {
// http://tools.ietf.org/html/rfc2616#section-4.2 (last paragraph)
_headers[header] += ', ' + value;
}
return true;
},
/**
Returns all headers from the response, with the exception of those whose field name is Set-Cookie or Set-Cookie2.
@method getAllResponseHeaders
@return {String} reponse headers or empty string
*/
getAllResponseHeaders: function() {
return _responseHeaders || '';
},
/**
Returns the header field value from the response of which the field name matches header,
unless the field name is Set-Cookie or Set-Cookie2.
@method getResponseHeader
@param {String} header
@return {String} value(s) for the specified header or null
*/
getResponseHeader: function(header) {
header = header.toLowerCase();
if (_error_flag || !!~Basic.inArray(header, ['set-cookie', 'set-cookie2'])) {
return null;
}
if (_responseHeaders && _responseHeaders !== '') {
// if we didn't parse response headers until now, do it and keep for later
if (!_responseHeadersBag) {
_responseHeadersBag = {};
Basic.each(_responseHeaders.split(/\r\n/), function(line) {
var pair = line.split(/:\s+/);
if (pair.length === 2) { // last line might be empty, omit
pair[0] = Basic.trim(pair[0]); // just in case
_responseHeadersBag[pair[0].toLowerCase()] = { // simply to retain header name in original form
header: pair[0],
value: Basic.trim(pair[1])
};
}
});
}
if (_responseHeadersBag.hasOwnProperty(header)) {
return _responseHeadersBag[header].header + ': ' + _responseHeadersBag[header].value;
}
}
return null;
},
/**
Sets the Content-Type header for the response to mime.
Throws an "InvalidStateError" exception if the state is LOADING or DONE.
Throws a "SyntaxError" exception if mime is not a valid media type.
@method overrideMimeType
@param String mime Mime type to set
*/
overrideMimeType: function(mime) {
var matches, charset;
// 1
if (!!~Basic.inArray(_p('readyState'), [XMLHttpRequest.LOADING, XMLHttpRequest.DONE])) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
// 2
mime = Basic.trim(mime.toLowerCase());
if (/;/.test(mime) && (matches = mime.match(/^([^;]+)(?:;\scharset\=)?(.*)$/))) {
mime = matches[1];
if (matches[2]) {
charset = matches[2];
}
}
if (!Mime.mimes[mime]) {
throw new x.DOMException(x.DOMException.SYNTAX_ERR);
}
// 3-4
_finalMime = mime;
_finalCharset = charset;
},
/**
Initiates the request. The optional argument provides the request entity body.
The argument is ignored if request method is GET or HEAD.
Throws an "InvalidStateError" exception if the state is not OPENED or if the send() flag is set.
@method send
@param {Blob|Document|String|FormData} [data] Request entity body
@param {Object} [options] Set of requirements and pre-requisities for runtime initialization
*/
send: function(data, options) {
if (Basic.typeOf(options) === 'string') {
_options = { ruid: options };
} else if (!options) {
_options = {};
} else {
_options = options;
}
this.convertEventPropsToHandlers(dispatches);
this.upload.convertEventPropsToHandlers(dispatches);
// 1-2
if (this.readyState !== XMLHttpRequest.OPENED || _send_flag) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
// 3
// sending Blob
if (data instanceof Blob) {
_options.ruid = data.ruid;
_mimeType = data.type || 'application/octet-stream';
}
// FormData
else if (data instanceof FormData) {
if (data.hasBlob()) {
var blob = data.getBlob();
_options.ruid = blob.ruid;
_mimeType = blob.type || 'application/octet-stream';
}
}
// DOMString
else if (typeof data === 'string') {
_encoding = 'UTF-8';
_mimeType = 'text/plain;charset=UTF-8';
// data should be converted to Unicode and encoded as UTF-8
data = Encode.utf8_encode(data);
}
// if withCredentials not set, but requested, set it automatically
if (!this.withCredentials) {
this.withCredentials = (_options.required_caps && _options.required_caps.send_browser_cookies) && !_same_origin_flag;
}
// 4 - storage mutex
// 5
_upload_events_flag = (!_sync_flag && this.upload.hasEventListener()); // DSAP
// 6
_error_flag = false;
// 7
_upload_complete_flag = !data;
// 8 - Asynchronous steps
if (!_sync_flag) {
// 8.1
_send_flag = true;
// 8.2
// this.dispatchEvent('loadstart'); // will be dispatched either by native or runtime xhr
// 8.3
//if (!_upload_complete_flag) {
// this.upload.dispatchEvent('loadstart'); // will be dispatched either by native or runtime xhr
//}
}
// 8.5 - Return the send() method call, but continue running the steps in this algorithm.
_doXHR.call(this, data);
},
/**
Cancels any network activity.
@method abort
*/
abort: function() {
_error_flag = true;
_sync_flag = false;
if (!~Basic.inArray(_p('readyState'), [XMLHttpRequest.UNSENT, XMLHttpRequest.OPENED, XMLHttpRequest.DONE])) {
_p('readyState', XMLHttpRequest.DONE);
_send_flag = false;
if (_xhr) {
_xhr.getRuntime().exec.call(_xhr, 'XMLHttpRequest', 'abort', _upload_complete_flag);
} else {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
_upload_complete_flag = true;
} else {
_p('readyState', XMLHttpRequest.UNSENT);
}
},
destroy: function() {
if (_xhr) {
if (Basic.typeOf(_xhr.destroy) === 'function') {
_xhr.destroy();
}
_xhr = null;
}
this.unbindAll();
if (this.upload) {
this.upload.unbindAll();
this.upload = null;
}
}
});
/* this is nice, but maybe too lengthy
// if supported by JS version, set getters/setters for specific properties
o.defineProperty(this, 'readyState', {
configurable: false,
get: function() {
return _p('readyState');
}
});
o.defineProperty(this, 'timeout', {
configurable: false,
get: function() {
return _p('timeout');
},
set: function(value) {
if (_sync_flag) {
throw new x.DOMException(x.DOMException.INVALID_ACCESS_ERR);
}
// timeout still should be measured relative to the start time of request
_timeoutset_time = (new Date).getTime();
_p('timeout', value);
}
});
// the withCredentials attribute has no effect when fetching same-origin resources
o.defineProperty(this, 'withCredentials', {
configurable: false,
get: function() {
return _p('withCredentials');
},
set: function(value) {
// 1-2
if (!~o.inArray(_p('readyState'), [XMLHttpRequest.UNSENT, XMLHttpRequest.OPENED]) || _send_flag) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
// 3-4
if (_anonymous_flag || _sync_flag) {
throw new x.DOMException(x.DOMException.INVALID_ACCESS_ERR);
}
// 5
_p('withCredentials', value);
}
});
o.defineProperty(this, 'status', {
configurable: false,
get: function() {
return _p('status');
}
});
o.defineProperty(this, 'statusText', {
configurable: false,
get: function() {
return _p('statusText');
}
});
o.defineProperty(this, 'responseType', {
configurable: false,
get: function() {
return _p('responseType');
},
set: function(value) {
// 1
if (!!~o.inArray(_p('readyState'), [XMLHttpRequest.LOADING, XMLHttpRequest.DONE])) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
// 2
if (_sync_flag) {
throw new x.DOMException(x.DOMException.INVALID_ACCESS_ERR);
}
// 3
_p('responseType', value.toLowerCase());
}
});
o.defineProperty(this, 'responseText', {
configurable: false,
get: function() {
// 1
if (!~o.inArray(_p('responseType'), ['', 'text'])) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
// 2-3
if (_p('readyState') !== XMLHttpRequest.DONE && _p('readyState') !== XMLHttpRequest.LOADING || _error_flag) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
return _p('responseText');
}
});
o.defineProperty(this, 'responseXML', {
configurable: false,
get: function() {
// 1
if (!~o.inArray(_p('responseType'), ['', 'document'])) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
// 2-3
if (_p('readyState') !== XMLHttpRequest.DONE || _error_flag) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
return _p('responseXML');
}
});
o.defineProperty(this, 'response', {
configurable: false,
get: function() {
if (!!~o.inArray(_p('responseType'), ['', 'text'])) {
if (_p('readyState') !== XMLHttpRequest.DONE && _p('readyState') !== XMLHttpRequest.LOADING || _error_flag) {
return '';
}
}
if (_p('readyState') !== XMLHttpRequest.DONE || _error_flag) {
return null;
}
return _p('response');
}
});
*/
function _p(prop, value) {
if (!props.hasOwnProperty(prop)) {
return;
}
if (arguments.length === 1) { // get
return Env.can('define_property') ? props[prop] : self[prop];
} else { // set
if (Env.can('define_property')) {
props[prop] = value;
} else {
self[prop] = value;
}
}
}
/*
function _toASCII(str, AllowUnassigned, UseSTD3ASCIIRules) {
// TODO: http://tools.ietf.org/html/rfc3490#section-4.1
return str.toLowerCase();
}
*/
function _doXHR(data) {
var self = this;
_start_time = new Date().getTime();
_xhr = new RuntimeTarget();
function loadEnd() {
if (_xhr) { // it could have been destroyed by now
_xhr.destroy();
_xhr = null;
}
self.dispatchEvent('loadend');
self = null;
}
function exec(runtime) {
_xhr.bind('LoadStart', function(e) {
_p('readyState', XMLHttpRequest.LOADING);
self.dispatchEvent('readystatechange');
self.dispatchEvent(e);
if (_upload_events_flag) {
self.upload.dispatchEvent(e);
}
});
_xhr.bind('Progress', function(e) {
if (_p('readyState') !== XMLHttpRequest.LOADING) {
_p('readyState', XMLHttpRequest.LOADING); // LoadStart unreliable (in Flash for example)
self.dispatchEvent('readystatechange');
}
self.dispatchEvent(e);
});
_xhr.bind('UploadProgress', function(e) {
if (_upload_events_flag) {
self.upload.dispatchEvent({
type: 'progress',
lengthComputable: false,
total: e.total,
loaded: e.loaded
});
}
});
_xhr.bind('Load', function(e) {
_p('readyState', XMLHttpRequest.DONE);
_p('status', Number(runtime.exec.call(_xhr, 'XMLHttpRequest', 'getStatus') || 0));
_p('statusText', httpCode[_p('status')] || "");
_p('response', runtime.exec.call(_xhr, 'XMLHttpRequest', 'getResponse', _p('responseType')));
if (!!~Basic.inArray(_p('responseType'), ['text', ''])) {
_p('responseText', _p('response'));
} else if (_p('responseType') === 'document') {
_p('responseXML', _p('response'));
}
_responseHeaders = runtime.exec.call(_xhr, 'XMLHttpRequest', 'getAllResponseHeaders');
self.dispatchEvent('readystatechange');
if (_p('status') > 0) { // status 0 usually means that server is unreachable
if (_upload_events_flag) {
self.upload.dispatchEvent(e);
}
self.dispatchEvent(e);
} else {
_error_flag = true;
self.dispatchEvent('error');
}
loadEnd();
});
_xhr.bind('Abort', function(e) {
self.dispatchEvent(e);
loadEnd();
});
_xhr.bind('Error', function(e) {
_error_flag = true;
_p('readyState', XMLHttpRequest.DONE);
self.dispatchEvent('readystatechange');
_upload_complete_flag = true;
self.dispatchEvent(e);
loadEnd();
});
runtime.exec.call(_xhr, 'XMLHttpRequest', 'send', {
url: _url,
method: _method,
async: _async,
user: _user,
password: _password,
headers: _headers,
mimeType: _mimeType,
encoding: _encoding,
responseType: self.responseType,
withCredentials: self.withCredentials,
options: _options
}, data);
}
// clarify our requirements
if (typeof(_options.required_caps) === 'string') {
_options.required_caps = Runtime.parseCaps(_options.required_caps);
}
_options.required_caps = Basic.extend({}, _options.required_caps, {
return_response_type: self.responseType
});
if (data instanceof FormData) {
_options.required_caps.send_multipart = true;
}
if (!_same_origin_flag) {
_options.required_caps.do_cors = true;
}
if (_options.ruid) { // we do not need to wait if we can connect directly
exec(_xhr.connectRuntime(_options));
} else {
_xhr.bind('RuntimeInit', function(e, runtime) {
exec(runtime);
});
_xhr.bind('RuntimeError', function(e, err) {
self.dispatchEvent('RuntimeError', err);
});
_xhr.connectRuntime(_options);
}
}
function _reset() {
_p('responseText', "");
_p('responseXML', null);
_p('response', null);
_p('status', 0);
_p('statusText', "");
_start_time = _timeoutset_time = null;
}
}
XMLHttpRequest.UNSENT = 0;
XMLHttpRequest.OPENED = 1;
XMLHttpRequest.HEADERS_RECEIVED = 2;
XMLHttpRequest.LOADING = 3;
XMLHttpRequest.DONE = 4;
XMLHttpRequest.prototype = EventTarget.instance;
return XMLHttpRequest;
});
// Included from: src/javascript/runtime/Transporter.js
/**
* Transporter.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define("moxie/runtime/Transporter", [
"moxie/core/utils/Basic",
"moxie/core/utils/Encode",
"moxie/runtime/RuntimeClient",
"moxie/core/EventTarget"
], function(Basic, Encode, RuntimeClient, EventTarget) {
function Transporter() {
var mod, _runtime, _data, _size, _pos, _chunk_size;
RuntimeClient.call(this);
Basic.extend(this, {
uid: Basic.guid('uid_'),
state: Transporter.IDLE,
result: null,
transport: function(data, type, options) {
var self = this;
options = Basic.extend({
chunk_size: 204798
}, options);
// should divide by three, base64 requires this
if ((mod = options.chunk_size % 3)) {
options.chunk_size += 3 - mod;
}
_chunk_size = options.chunk_size;
_reset.call(this);
_data = data;
_size = data.length;
if (Basic.typeOf(options) === 'string' || options.ruid) {
_run.call(self, type, this.connectRuntime(options));
} else {
// we require this to run only once
var cb = function(e, runtime) {
self.unbind("RuntimeInit", cb);
_run.call(self, type, runtime);
};
this.bind("RuntimeInit", cb);
this.connectRuntime(options);
}
},
abort: function() {
var self = this;
self.state = Transporter.IDLE;
if (_runtime) {
_runtime.exec.call(self, 'Transporter', 'clear');
self.trigger("TransportingAborted");
}
_reset.call(self);
},
destroy: function() {
this.unbindAll();
_runtime = null;
this.disconnectRuntime();
_reset.call(this);
}
});
function _reset() {
_size = _pos = 0;
_data = this.result = null;
}
function _run(type, runtime) {
var self = this;
_runtime = runtime;
//self.unbind("RuntimeInit");
self.bind("TransportingProgress", function(e) {
_pos = e.loaded;
if (_pos < _size && Basic.inArray(self.state, [Transporter.IDLE, Transporter.DONE]) === -1) {
_transport.call(self);
}
}, 999);
self.bind("TransportingComplete", function() {
_pos = _size;
self.state = Transporter.DONE;
_data = null; // clean a bit
self.result = _runtime.exec.call(self, 'Transporter', 'getAsBlob', type || '');
}, 999);
self.state = Transporter.BUSY;
self.trigger("TransportingStarted");
_transport.call(self);
}
function _transport() {
var self = this,
chunk,
bytesLeft = _size - _pos;
if (_chunk_size > bytesLeft) {
_chunk_size = bytesLeft;
}
chunk = Encode.btoa(_data.substr(_pos, _chunk_size));
_runtime.exec.call(self, 'Transporter', 'receive', chunk, _size);
}
}
Transporter.IDLE = 0;
Transporter.BUSY = 1;
Transporter.DONE = 2;
Transporter.prototype = EventTarget.instance;
return Transporter;
});
// Included from: src/javascript/image/Image.js
/**
* Image.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define("moxie/image/Image", [
"moxie/core/utils/Basic",
"moxie/core/utils/Dom",
"moxie/core/Exceptions",
"moxie/file/FileReaderSync",
"moxie/xhr/XMLHttpRequest",
"moxie/runtime/Runtime",
"moxie/runtime/RuntimeClient",
"moxie/runtime/Transporter",
"moxie/core/utils/Env",
"moxie/core/EventTarget",
"moxie/file/Blob",
"moxie/file/File",
"moxie/core/utils/Encode"
], function(Basic, Dom, x, FileReaderSync, XMLHttpRequest, Runtime, RuntimeClient, Transporter, Env, EventTarget, Blob, File, Encode) {
/**
Image preloading and manipulation utility. Additionally it provides access to image meta info (Exif, GPS) and raw binary data.
@class Image
@constructor
@extends EventTarget
*/
var dispatches = [
'progress',
/**
Dispatched when loading is complete.
@event load
@param {Object} event
*/
'load',
'error',
/**
Dispatched when resize operation is complete.
@event resize
@param {Object} event
*/
'resize',
/**
Dispatched when visual representation of the image is successfully embedded
into the corresponsing container.
@event embedded
@param {Object} event
*/
'embedded'
];
function Image() {
RuntimeClient.call(this);
Basic.extend(this, {
/**
Unique id of the component
@property uid
@type {String}
*/
uid: Basic.guid('uid_'),
/**
Unique id of the connected runtime, if any.
@property ruid
@type {String}
*/
ruid: null,
/**
Name of the file, that was used to create an image, if available. If not equals to empty string.
@property name
@type {String}
@default ""
*/
name: "",
/**
Size of the image in bytes. Actual value is set only after image is preloaded.
@property size
@type {Number}
@default 0
*/
size: 0,
/**
Width of the image. Actual value is set only after image is preloaded.
@property width
@type {Number}
@default 0
*/
width: 0,
/**
Height of the image. Actual value is set only after image is preloaded.
@property height
@type {Number}
@default 0
*/
height: 0,
/**
Mime type of the image. Currently only image/jpeg and image/png are supported. Actual value is set only after image is preloaded.
@property type
@type {String}
@default ""
*/
type: "",
/**
Holds meta info (Exif, GPS). Is populated only for image/jpeg. Actual value is set only after image is preloaded.
@property meta
@type {Object}
@default {}
*/
meta: {},
/**
Alias for load method, that takes another mOxie.Image object as a source (see load).
@method clone
@param {Image} src Source for the image
@param {Boolean} [exact=false] Whether to activate in-depth clone mode
*/
clone: function() {
this.load.apply(this, arguments);
},
/**
Loads image from various sources. Currently the source for new image can be: mOxie.Image, mOxie.Blob/mOxie.File,
native Blob/File, dataUrl or URL. Depending on the type of the source, arguments - differ. When source is URL,
Image will be downloaded from remote destination and loaded in memory.
@example
var img = new mOxie.Image();
img.onload = function() {
var blob = img.getAsBlob();
var formData = new mOxie.FormData();
formData.append('file', blob);
var xhr = new mOxie.XMLHttpRequest();
xhr.onload = function() {
// upload complete
};
xhr.open('post', 'upload.php');
xhr.send(formData);
};
img.load("http://www.moxiecode.com/images/mox-logo.jpg"); // notice file extension (.jpg)
@method load
@param {Image|Blob|File|String} src Source for the image
@param {Boolean|Object} [mixed]
*/
load: function() {
// this is here because to bind properly we need an uid first, which is created above
this.bind('Load Resize', function() {
_updateInfo.call(this);
}, 999);
this.convertEventPropsToHandlers(dispatches);
_load.apply(this, arguments);
},
/**
Downsizes the image to fit the specified width/height. If crop is supplied, image will be cropped to exact dimensions.
@method downsize
@param {Number} width Resulting width
@param {Number} [height=width] Resulting height (optional, if not supplied will default to width)
@param {Boolean} [crop=false] Whether to crop the image to exact dimensions
@param {Boolean} [preserveHeaders=true] Whether to preserve meta headers (on JPEGs after resize)
*/
downsize: function(opts) {
var defaults = {
width: this.width,
height: this.height,
crop: false,
preserveHeaders: true
};
if (typeof(opts) === 'object') {
opts = Basic.extend(defaults, opts);
} else {
opts = Basic.extend(defaults, {
width: arguments[0],
height: arguments[1],
crop: arguments[2],
preserveHeaders: arguments[3]
});
}
try {
if (!this.size) { // only preloaded image objects can be used as source
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
// no way to reliably intercept the crash due to high resolution, so we simply avoid it
if (this.width > Image.MAX_RESIZE_WIDTH || this.height > Image.MAX_RESIZE_HEIGHT) {
throw new x.ImageError(x.ImageError.MAX_RESOLUTION_ERR);
}
this.getRuntime().exec.call(this, 'Image', 'downsize', opts.width, opts.height, opts.crop, opts.preserveHeaders);
} catch(ex) {
// for now simply trigger error event
this.trigger('error', ex.code);
}
},
/**
Alias for downsize(width, height, true). (see downsize)
@method crop
@param {Number} width Resulting width
@param {Number} [height=width] Resulting height (optional, if not supplied will default to width)
@param {Boolean} [preserveHeaders=true] Whether to preserve meta headers (on JPEGs after resize)
*/
crop: function(width, height, preserveHeaders) {
this.downsize(width, height, true, preserveHeaders);
},
getAsCanvas: function() {
if (!Env.can('create_canvas')) {
throw new x.RuntimeError(x.RuntimeError.NOT_SUPPORTED_ERR);
}
var runtime = this.connectRuntime(this.ruid);
return runtime.exec.call(this, 'Image', 'getAsCanvas');
},
/**
Retrieves image in it's current state as mOxie.Blob object. Cannot be run on empty or image in progress (throws
DOMException.INVALID_STATE_ERR).
@method getAsBlob
@param {String} [type="image/jpeg"] Mime type of resulting blob. Can either be image/jpeg or image/png
@param {Number} [quality=90] Applicable only together with mime type image/jpeg
@return {Blob} Image as Blob
*/
getAsBlob: function(type, quality) {
if (!this.size) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
if (!type) {
type = 'image/jpeg';
}
if (type === 'image/jpeg' && !quality) {
quality = 90;
}
return this.getRuntime().exec.call(this, 'Image', 'getAsBlob', type, quality);
},
/**
Retrieves image in it's current state as dataURL string. Cannot be run on empty or image in progress (throws
DOMException.INVALID_STATE_ERR).
@method getAsDataURL
@param {String} [type="image/jpeg"] Mime type of resulting blob. Can either be image/jpeg or image/png
@param {Number} [quality=90] Applicable only together with mime type image/jpeg
@return {String} Image as dataURL string
*/
getAsDataURL: function(type, quality) {
if (!this.size) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
return this.getRuntime().exec.call(this, 'Image', 'getAsDataURL', type, quality);
},
/**
Retrieves image in it's current state as binary string. Cannot be run on empty or image in progress (throws
DOMException.INVALID_STATE_ERR).
@method getAsBinaryString
@param {String} [type="image/jpeg"] Mime type of resulting blob. Can either be image/jpeg or image/png
@param {Number} [quality=90] Applicable only together with mime type image/jpeg
@return {String} Image as binary string
*/
getAsBinaryString: function(type, quality) {
var dataUrl = this.getAsDataURL(type, quality);
return Encode.atob(dataUrl.substring(dataUrl.indexOf('base64,') + 7));
},
/**
Embeds a visual representation of the image into the specified node. Depending on the runtime,
it might be a canvas, an img node or a thrid party shim object (Flash or SilverLight - very rare,
can be used in legacy browsers that do not have canvas or proper dataURI support).
@method embed
@param {DOMElement} el DOM element to insert the image object into
@param {Object} [options]
@param {Number} [options.width] The width of an embed (defaults to the image width)
@param {Number} [options.height] The height of an embed (defaults to the image height)
@param {String} [type="image/jpeg"] Mime type
@param {Number} [quality=90] Quality of an embed, if mime type is image/jpeg
@param {Boolean} [crop=false] Whether to crop an embed to the specified dimensions
*/
embed: function(el) {
var self = this
, imgCopy
, type, quality, crop
, options = arguments[1] || {}
, width = this.width
, height = this.height
, runtime // this has to be outside of all the closures to contain proper runtime
;
function onResize() {
// if possible, embed a canvas element directly
if (Env.can('create_canvas')) {
var canvas = imgCopy.getAsCanvas();
if (canvas) {
el.appendChild(canvas);
canvas = null;
imgCopy.destroy();
self.trigger('embedded');
return;
}
}
var dataUrl = imgCopy.getAsDataURL(type, quality);
if (!dataUrl) {
throw new x.ImageError(x.ImageError.WRONG_FORMAT);
}
if (Env.can('use_data_uri_of', dataUrl.length)) {
el.innerHTML = '<img src="' + dataUrl + '" width="' + imgCopy.width + '" height="' + imgCopy.height + '" />';
imgCopy.destroy();
self.trigger('embedded');
} else {
var tr = new Transporter();
tr.bind("TransportingComplete", function() {
runtime = self.connectRuntime(this.result.ruid);
self.bind("Embedded", function() {
// position and size properly
Basic.extend(runtime.getShimContainer().style, {
//position: 'relative',
top: '0px',
left: '0px',
width: imgCopy.width + 'px',
height: imgCopy.height + 'px'
});
// some shims (Flash/SilverLight) reinitialize, if parent element is hidden, reordered or it's
// position type changes (in Gecko), but since we basically need this only in IEs 6/7 and
// sometimes 8 and they do not have this problem, we can comment this for now
/*tr.bind("RuntimeInit", function(e, runtime) {
tr.destroy();
runtime.destroy();
onResize.call(self); // re-feed our image data
});*/
runtime = null;
}, 999);
runtime.exec.call(self, "ImageView", "display", this.result.uid, width, height);
imgCopy.destroy();
});
tr.transport(Encode.atob(dataUrl.substring(dataUrl.indexOf('base64,') + 7)), type, Basic.extend({}, options, {
required_caps: {
display_media: true
},
runtime_order: 'flash,silverlight',
container: el
}));
}
}
try {
if (!(el = Dom.get(el))) {
throw new x.DOMException(x.DOMException.INVALID_NODE_TYPE_ERR);
}
if (!this.size) { // only preloaded image objects can be used as source
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
if (this.width > Image.MAX_RESIZE_WIDTH || this.height > Image.MAX_RESIZE_HEIGHT) {
throw new x.ImageError(x.ImageError.MAX_RESOLUTION_ERR);
}
type = options.type || this.type || 'image/jpeg';
quality = options.quality || 90;
crop = Basic.typeOf(options.crop) !== 'undefined' ? options.crop : false;
// figure out dimensions for the thumb
if (options.width) {
width = options.width;
height = options.height || width;
} else {
// if container element has measurable dimensions, use them
var dimensions = Dom.getSize(el);
if (dimensions.w && dimensions.h) { // both should be > 0
width = dimensions.w;
height = dimensions.h;
}
}
imgCopy = new Image();
imgCopy.bind("Resize", function() {
onResize.call(self);
});
imgCopy.bind("Load", function() {
imgCopy.downsize(width, height, crop, false);
});
imgCopy.clone(this, false);
return imgCopy;
} catch(ex) {
// for now simply trigger error event
this.trigger('error', ex.code);
}
},
/**
Properly destroys the image and frees resources in use. If any. Recommended way to dispose mOxie.Image object.
@method destroy
*/
destroy: function() {
if (this.ruid) {
this.getRuntime().exec.call(this, 'Image', 'destroy');
this.disconnectRuntime();
}
this.unbindAll();
}
});
function _updateInfo(info) {
if (!info) {
info = this.getRuntime().exec.call(this, 'Image', 'getInfo');
}
this.size = info.size;
this.width = info.width;
this.height = info.height;
this.type = info.type;
this.meta = info.meta;
// update file name, only if empty
if (this.name === '') {
this.name = info.name;
}
}
function _load(src) {
var srcType = Basic.typeOf(src);
try {
// if source is Image
if (src instanceof Image) {
if (!src.size) { // only preloaded image objects can be used as source
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
_loadFromImage.apply(this, arguments);
}
// if source is o.Blob/o.File
else if (src instanceof Blob) {
if (!~Basic.inArray(src.type, ['image/jpeg', 'image/png'])) {
throw new x.ImageError(x.ImageError.WRONG_FORMAT);
}
_loadFromBlob.apply(this, arguments);
}
// if native blob/file
else if (Basic.inArray(srcType, ['blob', 'file']) !== -1) {
_load.call(this, new File(null, src), arguments[1]);
}
// if String
else if (srcType === 'string') {
// if dataUrl String
if (/^data:[^;]*;base64,/.test(src)) {
_load.call(this, new Blob(null, { data: src }), arguments[1]);
}
// else assume Url, either relative or absolute
else {
_loadFromUrl.apply(this, arguments);
}
}
// if source seems to be an img node
else if (srcType === 'node' && src.nodeName.toLowerCase() === 'img') {
_load.call(this, src.src, arguments[1]);
}
else {
throw new x.DOMException(x.DOMException.TYPE_MISMATCH_ERR);
}
} catch(ex) {
// for now simply trigger error event
this.trigger('error', ex.code);
}
}
function _loadFromImage(img, exact) {
var runtime = this.connectRuntime(img.ruid);
this.ruid = runtime.uid;
runtime.exec.call(this, 'Image', 'loadFromImage', img, (Basic.typeOf(exact) === 'undefined' ? true : exact));
}
function _loadFromBlob(blob, options) {
var self = this;
self.name = blob.name || '';
function exec(runtime) {
self.ruid = runtime.uid;
runtime.exec.call(self, 'Image', 'loadFromBlob', blob);
}
if (blob.isDetached()) {
this.bind('RuntimeInit', function(e, runtime) {
exec(runtime);
});
// convert to object representation
if (options && typeof(options.required_caps) === 'string') {
options.required_caps = Runtime.parseCaps(options.required_caps);
}
this.connectRuntime(Basic.extend({
required_caps: {
access_image_binary: true,
resize_image: true
}
}, options));
} else {
exec(this.connectRuntime(blob.ruid));
}
}
function _loadFromUrl(url, options) {
var self = this, xhr;
xhr = new XMLHttpRequest();
xhr.open('get', url);
xhr.responseType = 'blob';
xhr.onprogress = function(e) {
self.trigger(e);
};
xhr.onload = function() {
_loadFromBlob.call(self, xhr.response, true);
};
xhr.onerror = function(e) {
self.trigger(e);
};
xhr.onloadend = function() {
xhr.destroy();
};
xhr.bind('RuntimeError', function(e, err) {
self.trigger('RuntimeError', err);
});
xhr.send(null, options);
}
}
// virtual world will crash on you if image has a resolution higher than this:
Image.MAX_RESIZE_WIDTH = 6500;
Image.MAX_RESIZE_HEIGHT = 6500;
Image.prototype = EventTarget.instance;
return Image;
});
// Included from: src/javascript/runtime/html4/Runtime.js
/**
* Runtime.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/*global File:true */
/**
Defines constructor for HTML4 runtime.
@class moxie/runtime/html4/Runtime
@private
*/
define("moxie/runtime/html4/Runtime", [
"moxie/core/utils/Basic",
"moxie/core/Exceptions",
"moxie/runtime/Runtime",
"moxie/core/utils/Env"
], function(Basic, x, Runtime, Env) {
var type = 'html4', extensions = {};
function Html4Runtime(options) {
var I = this
, Test = Runtime.capTest
, True = Runtime.capTrue
;
Runtime.call(this, options, type, {
access_binary: Test(window.FileReader || window.File && File.getAsDataURL),
access_image_binary: false,
display_media: Test(extensions.Image && (Env.can('create_canvas') || Env.can('use_data_uri_over32kb'))),
do_cors: false,
drag_and_drop: false,
filter_by_extension: Test(function() { // if you know how to feature-detect this, please suggest
return (Env.browser === 'Chrome' && Env.version >= 28) || (Env.browser === 'IE' && Env.version >= 10);
}()),
resize_image: function() {
return extensions.Image && I.can('access_binary') && Env.can('create_canvas');
},
report_upload_progress: false,
return_response_headers: false,
return_response_type: function(responseType) {
if (responseType === 'json' && !!window.JSON) {
return true;
}
return !!~Basic.inArray(responseType, ['text', 'document', '']);
},
return_status_code: function(code) {
return !Basic.arrayDiff(code, [200, 404]);
},
select_file: function() {
return Env.can('use_fileinput');
},
select_multiple: false,
send_binary_string: false,
send_custom_headers: false,
send_multipart: true,
slice_blob: false,
stream_upload: function() {
return I.can('select_file');
},
summon_file_dialog: Test(function() { // yeah... some dirty sniffing here...
return (Env.browser === 'Firefox' && Env.version >= 4) ||
(Env.browser === 'Opera' && Env.version >= 12) ||
!!~Basic.inArray(Env.browser, ['Chrome', 'Safari']);
}()),
upload_filesize: True,
use_http_method: function(methods) {
return !Basic.arrayDiff(methods, ['GET', 'POST']);
}
});
Basic.extend(this, {
init : function() {
this.trigger("Init");
},
destroy: (function(destroy) { // extend default destroy method
return function() {
destroy.call(I);
destroy = I = null;
};
}(this.destroy))
});
Basic.extend(this.getShim(), extensions);
}
Runtime.addConstructor(type, Html4Runtime);
return extensions;
});
// Included from: src/javascript/core/utils/Events.js
/**
* Events.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/core/utils/Events', [
'moxie/core/utils/Basic'
], function(Basic) {
var eventhash = {}, uid = 'moxie_' + Basic.guid();
// IE W3C like event funcs
function preventDefault() {
this.returnValue = false;
}
function stopPropagation() {
this.cancelBubble = true;
}
/**
Adds an event handler to the specified object and store reference to the handler
in objects internal Plupload registry (@see removeEvent).
@method addEvent
@for Utils
@static
@param {Object} obj DOM element like object to add handler to.
@param {String} name Name to add event listener to.
@param {Function} callback Function to call when event occurs.
@param {String} [key] that might be used to add specifity to the event record.
*/
var addEvent = function(obj, name, callback, key) {
var func, events;
name = name.toLowerCase();
// Add event listener
if (obj.addEventListener) {
func = callback;
obj.addEventListener(name, func, false);
} else if (obj.attachEvent) {
func = function() {
var evt = window.event;
if (!evt.target) {
evt.target = evt.srcElement;
}
evt.preventDefault = preventDefault;
evt.stopPropagation = stopPropagation;
callback(evt);
};
obj.attachEvent('on' + name, func);
}
// Log event handler to objects internal mOxie registry
if (!obj[uid]) {
obj[uid] = Basic.guid();
}
if (!eventhash.hasOwnProperty(obj[uid])) {
eventhash[obj[uid]] = {};
}
events = eventhash[obj[uid]];
if (!events.hasOwnProperty(name)) {
events[name] = [];
}
events[name].push({
func: func,
orig: callback, // store original callback for IE
key: key
});
};
/**
Remove event handler from the specified object. If third argument (callback)
is not specified remove all events with the specified name.
@method removeEvent
@static
@param {Object} obj DOM element to remove event listener(s) from.
@param {String} name Name of event listener to remove.
@param {Function|String} [callback] might be a callback or unique key to match.
*/
var removeEvent = function(obj, name, callback) {
var type, undef;
name = name.toLowerCase();
if (obj[uid] && eventhash[obj[uid]] && eventhash[obj[uid]][name]) {
type = eventhash[obj[uid]][name];
} else {
return;
}
for (var i = type.length - 1; i >= 0; i--) {
// undefined or not, key should match
if (type[i].orig === callback || type[i].key === callback) {
if (obj.removeEventListener) {
obj.removeEventListener(name, type[i].func, false);
} else if (obj.detachEvent) {
obj.detachEvent('on'+name, type[i].func);
}
type[i].orig = null;
type[i].func = null;
type.splice(i, 1);
// If callback was passed we are done here, otherwise proceed
if (callback !== undef) {
break;
}
}
}
// If event array got empty, remove it
if (!type.length) {
delete eventhash[obj[uid]][name];
}
// If mOxie registry has become empty, remove it
if (Basic.isEmptyObj(eventhash[obj[uid]])) {
delete eventhash[obj[uid]];
// IE doesn't let you remove DOM object property with - delete
try {
delete obj[uid];
} catch(e) {
obj[uid] = undef;
}
}
};
/**
Remove all kind of events from the specified object
@method removeAllEvents
@static
@param {Object} obj DOM element to remove event listeners from.
@param {String} [key] unique key to match, when removing events.
*/
var removeAllEvents = function(obj, key) {
if (!obj || !obj[uid]) {
return;
}
Basic.each(eventhash[obj[uid]], function(events, name) {
removeEvent(obj, name, key);
});
};
return {
addEvent: addEvent,
removeEvent: removeEvent,
removeAllEvents: removeAllEvents
};
});
// Included from: src/javascript/runtime/html4/file/FileInput.js
/**
* FileInput.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/html4/file/FileInput
@private
*/
define("moxie/runtime/html4/file/FileInput", [
"moxie/runtime/html4/Runtime",
"moxie/core/utils/Basic",
"moxie/core/utils/Dom",
"moxie/core/utils/Events",
"moxie/core/utils/Mime",
"moxie/core/utils/Env"
], function(extensions, Basic, Dom, Events, Mime, Env) {
function FileInput() {
var _uid, _files = [], _mimes = [], _options;
function addInput() {
var comp = this, I = comp.getRuntime(), shimContainer, browseButton, currForm, form, input, uid;
uid = Basic.guid('uid_');
shimContainer = I.getShimContainer(); // we get new ref everytime to avoid memory leaks in IE
if (_uid) { // move previous form out of the view
currForm = Dom.get(_uid + '_form');
if (currForm) {
Basic.extend(currForm.style, { top: '100%' });
}
}
// build form in DOM, since innerHTML version not able to submit file for some reason
form = document.createElement('form');
form.setAttribute('id', uid + '_form');
form.setAttribute('method', 'post');
form.setAttribute('enctype', 'multipart/form-data');
form.setAttribute('encoding', 'multipart/form-data');
Basic.extend(form.style, {
overflow: 'hidden',
position: 'absolute',
top: 0,
left: 0,
width: '100%',
height: '100%'
});
input = document.createElement('input');
input.setAttribute('id', uid);
input.setAttribute('type', 'file');
input.setAttribute('name', _options.name || 'Filedata');
input.setAttribute('accept', _mimes.join(','));
Basic.extend(input.style, {
fontSize: '999px',
opacity: 0
});
form.appendChild(input);
shimContainer.appendChild(form);
// prepare file input to be placed underneath the browse_button element
Basic.extend(input.style, {
position: 'absolute',
top: 0,
left: 0,
width: '100%',
height: '100%'
});
if (Env.browser === 'IE' && Env.version < 10) {
Basic.extend(input.style, {
filter : "progid:DXImageTransform.Microsoft.Alpha(opacity=0)"
});
}
input.onchange = function() { // there should be only one handler for this
var file;
if (!this.value) {
return;
}
if (this.files) {
file = this.files[0];
} else {
file = {
name: this.value
};
}
_files = [file];
this.onchange = function() {}; // clear event handler
addInput.call(comp);
// after file is initialized as o.File, we need to update form and input ids
comp.bind('change', function onChange() {
var input = Dom.get(uid), form = Dom.get(uid + '_form'), file;
comp.unbind('change', onChange);
if (comp.files.length && input && form) {
file = comp.files[0];
input.setAttribute('id', file.uid);
form.setAttribute('id', file.uid + '_form');
// set upload target
form.setAttribute('target', file.uid + '_iframe');
}
input = form = null;
}, 998);
input = form = null;
comp.trigger('change');
};
// route click event to the input
if (I.can('summon_file_dialog')) {
browseButton = Dom.get(_options.browse_button);
Events.removeEvent(browseButton, 'click', comp.uid);
Events.addEvent(browseButton, 'click', function(e) {
if (input && !input.disabled) { // for some reason FF (up to 8.0.1 so far) lets to click disabled input[type=file]
input.click();
}
e.preventDefault();
}, comp.uid);
}
_uid = uid;
shimContainer = currForm = browseButton = null;
}
Basic.extend(this, {
init: function(options) {
var comp = this, I = comp.getRuntime(), shimContainer;
// figure out accept string
_options = options;
_mimes = options.accept.mimes || Mime.extList2mimes(options.accept, I.can('filter_by_extension'));
shimContainer = I.getShimContainer();
(function() {
var browseButton, zIndex, top;
browseButton = Dom.get(options.browse_button);
// Route click event to the input[type=file] element for browsers that support such behavior
if (I.can('summon_file_dialog')) {
if (Dom.getStyle(browseButton, 'position') === 'static') {
browseButton.style.position = 'relative';
}
zIndex = parseInt(Dom.getStyle(browseButton, 'z-index'), 10) || 1;
browseButton.style.zIndex = zIndex;
shimContainer.style.zIndex = zIndex - 1;
}
/* Since we have to place input[type=file] on top of the browse_button for some browsers,
browse_button loses interactivity, so we restore it here */
top = I.can('summon_file_dialog') ? browseButton : shimContainer;
Events.addEvent(top, 'mouseover', function() {
comp.trigger('mouseenter');
}, comp.uid);
Events.addEvent(top, 'mouseout', function() {
comp.trigger('mouseleave');
}, comp.uid);
Events.addEvent(top, 'mousedown', function() {
comp.trigger('mousedown');
}, comp.uid);
Events.addEvent(Dom.get(options.container), 'mouseup', function() {
comp.trigger('mouseup');
}, comp.uid);
browseButton = null;
}());
addInput.call(this);
shimContainer = null;
// trigger ready event asynchronously
comp.trigger({
type: 'ready',
async: true
});
},
getFiles: function() {
return _files;
},
disable: function(state) {
var input;
if ((input = Dom.get(_uid))) {
input.disabled = !!state;
}
},
destroy: function() {
var I = this.getRuntime()
, shim = I.getShim()
, shimContainer = I.getShimContainer()
;
Events.removeAllEvents(shimContainer, this.uid);
Events.removeAllEvents(_options && Dom.get(_options.container), this.uid);
Events.removeAllEvents(_options && Dom.get(_options.browse_button), this.uid);
if (shimContainer) {
shimContainer.innerHTML = '';
}
shim.removeInstance(this.uid);
_uid = _files = _mimes = _options = shimContainer = shim = null;
}
});
}
return (extensions.FileInput = FileInput);
});
// Included from: src/javascript/runtime/html5/Runtime.js
/**
* Runtime.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/*global File:true */
/**
Defines constructor for HTML5 runtime.
@class moxie/runtime/html5/Runtime
@private
*/
define("moxie/runtime/html5/Runtime", [
"moxie/core/utils/Basic",
"moxie/core/Exceptions",
"moxie/runtime/Runtime",
"moxie/core/utils/Env"
], function(Basic, x, Runtime, Env) {
var type = "html5", extensions = {};
function Html5Runtime(options) {
var I = this
, Test = Runtime.capTest
, True = Runtime.capTrue
;
var caps = Basic.extend({
access_binary: Test(window.FileReader || window.File && window.File.getAsDataURL),
access_image_binary: function() {
return I.can('access_binary') && !!extensions.Image;
},
display_media: Test(Env.can('create_canvas') || Env.can('use_data_uri_over32kb')),
do_cors: Test(window.XMLHttpRequest && 'withCredentials' in new XMLHttpRequest()),
drag_and_drop: Test(function() {
// this comes directly from Modernizr: http://www.modernizr.com/
var div = document.createElement('div');
// IE has support for drag and drop since version 5, but doesn't support dropping files from desktop
return (('draggable' in div) || ('ondragstart' in div && 'ondrop' in div)) && (Env.browser !== 'IE' || Env.version > 9);
}()),
filter_by_extension: Test(function() { // if you know how to feature-detect this, please suggest
return (Env.browser === 'Chrome' && Env.version >= 28) || (Env.browser === 'IE' && Env.version >= 10);
}()),
return_response_headers: True,
return_response_type: function(responseType) {
if (responseType === 'json' && !!window.JSON) { // we can fake this one even if it's not supported
return true;
}
return Env.can('return_response_type', responseType);
},
return_status_code: True,
report_upload_progress: Test(window.XMLHttpRequest && new XMLHttpRequest().upload),
resize_image: function() {
return I.can('access_binary') && Env.can('create_canvas');
},
select_file: function() {
return Env.can('use_fileinput') && window.File;
},
select_folder: function() {
return I.can('select_file') && Env.browser === 'Chrome' && Env.version >= 21;
},
select_multiple: function() {
// it is buggy on Safari Windows and iOS
return I.can('select_file') &&
!(Env.browser === 'Safari' && Env.os === 'Windows') &&
!(Env.os === 'iOS' && Env.verComp(Env.osVersion, "7.0.4", '<'));
},
send_binary_string: Test(window.XMLHttpRequest && (new XMLHttpRequest().sendAsBinary || (window.Uint8Array && window.ArrayBuffer))),
send_custom_headers: Test(window.XMLHttpRequest),
send_multipart: function() {
return !!(window.XMLHttpRequest && new XMLHttpRequest().upload && window.FormData) || I.can('send_binary_string');
},
slice_blob: Test(window.File && (File.prototype.mozSlice || File.prototype.webkitSlice || File.prototype.slice)),
stream_upload: function(){
return I.can('slice_blob') && I.can('send_multipart');
},
summon_file_dialog: Test(function() { // yeah... some dirty sniffing here...
return (Env.browser === 'Firefox' && Env.version >= 4) ||
(Env.browser === 'Opera' && Env.version >= 12) ||
(Env.browser === 'IE' && Env.version >= 10) ||
!!~Basic.inArray(Env.browser, ['Chrome', 'Safari']);
}()),
upload_filesize: True
},
arguments[2]
);
Runtime.call(this, options, (arguments[1] || type), caps);
Basic.extend(this, {
init : function() {
this.trigger("Init");
},
destroy: (function(destroy) { // extend default destroy method
return function() {
destroy.call(I);
destroy = I = null;
};
}(this.destroy))
});
Basic.extend(this.getShim(), extensions);
}
Runtime.addConstructor(type, Html5Runtime);
return extensions;
});
// Included from: src/javascript/runtime/html5/file/FileReader.js
/**
* FileReader.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/html5/file/FileReader
@private
*/
define("moxie/runtime/html5/file/FileReader", [
"moxie/runtime/html5/Runtime",
"moxie/core/utils/Encode",
"moxie/core/utils/Basic"
], function(extensions, Encode, Basic) {
function FileReader() {
var _fr, _convertToBinary = false;
Basic.extend(this, {
read: function(op, blob) {
var target = this;
_fr = new window.FileReader();
_fr.addEventListener('progress', function(e) {
target.trigger(e);
});
_fr.addEventListener('load', function(e) {
target.trigger(e);
});
_fr.addEventListener('error', function(e) {
target.trigger(e, _fr.error);
});
_fr.addEventListener('loadend', function() {
_fr = null;
});
if (Basic.typeOf(_fr[op]) === 'function') {
_convertToBinary = false;
_fr[op](blob.getSource());
} else if (op === 'readAsBinaryString') { // readAsBinaryString is depricated in general and never existed in IE10+
_convertToBinary = true;
_fr.readAsDataURL(blob.getSource());
}
},
getResult: function() {
return _fr && _fr.result ? (_convertToBinary ? _toBinary(_fr.result) : _fr.result) : null;
},
abort: function() {
if (_fr) {
_fr.abort();
}
},
destroy: function() {
_fr = null;
}
});
function _toBinary(str) {
return Encode.atob(str.substring(str.indexOf('base64,') + 7));
}
}
return (extensions.FileReader = FileReader);
});
// Included from: src/javascript/runtime/html4/file/FileReader.js
/**
* FileReader.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/html4/file/FileReader
@private
*/
define("moxie/runtime/html4/file/FileReader", [
"moxie/runtime/html4/Runtime",
"moxie/runtime/html5/file/FileReader"
], function(extensions, FileReader) {
return (extensions.FileReader = FileReader);
});
// Included from: src/javascript/runtime/html4/xhr/XMLHttpRequest.js
/**
* XMLHttpRequest.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/html4/xhr/XMLHttpRequest
@private
*/
define("moxie/runtime/html4/xhr/XMLHttpRequest", [
"moxie/runtime/html4/Runtime",
"moxie/core/utils/Basic",
"moxie/core/utils/Dom",
"moxie/core/utils/Url",
"moxie/core/Exceptions",
"moxie/core/utils/Events",
"moxie/file/Blob",
"moxie/xhr/FormData"
], function(extensions, Basic, Dom, Url, x, Events, Blob, FormData) {
function XMLHttpRequest() {
var _status, _response, _iframe;
function cleanup(cb) {
var target = this, uid, form, inputs, i, hasFile = false;
if (!_iframe) {
return;
}
uid = _iframe.id.replace(/_iframe$/, '');
form = Dom.get(uid + '_form');
if (form) {
inputs = form.getElementsByTagName('input');
i = inputs.length;
while (i--) {
switch (inputs[i].getAttribute('type')) {
case 'hidden':
inputs[i].parentNode.removeChild(inputs[i]);
break;
case 'file':
hasFile = true; // flag the case for later
break;
}
}
inputs = [];
if (!hasFile) { // we need to keep the form for sake of possible retries
form.parentNode.removeChild(form);
}
form = null;
}
// without timeout, request is marked as canceled (in console)
setTimeout(function() {
Events.removeEvent(_iframe, 'load', target.uid);
if (_iframe.parentNode) { // #382
_iframe.parentNode.removeChild(_iframe);
}
// check if shim container has any other children, if - not, remove it as well
var shimContainer = target.getRuntime().getShimContainer();
if (!shimContainer.children.length) {
shimContainer.parentNode.removeChild(shimContainer);
}
shimContainer = _iframe = null;
cb();
}, 1);
}
Basic.extend(this, {
send: function(meta, data) {
var target = this, I = target.getRuntime(), uid, form, input, blob;
_status = _response = null;
function createIframe() {
var container = I.getShimContainer() || document.body
, temp = document.createElement('div')
;
// IE 6 won't be able to set the name using setAttribute or iframe.name
temp.innerHTML = '<iframe id="' + uid + '_iframe" name="' + uid + '_iframe" src="javascript:""" style="display:none"></iframe>';
_iframe = temp.firstChild;
container.appendChild(_iframe);
/* _iframe.onreadystatechange = function() {
console.info(_iframe.readyState);
};*/
Events.addEvent(_iframe, 'load', function() { // _iframe.onload doesn't work in IE lte 8
var el;
try {
el = _iframe.contentWindow.document || _iframe.contentDocument || window.frames[_iframe.id].document;
// try to detect some standard error pages
if (/^4(0[0-9]|1[0-7]|2[2346])\s/.test(el.title)) { // test if title starts with 4xx HTTP error
_status = el.title.replace(/^(\d+).*$/, '$1');
} else {
_status = 200;
// get result
_response = Basic.trim(el.body.innerHTML);
// we need to fire these at least once
target.trigger({
type: 'progress',
loaded: _response.length,
total: _response.length
});
if (blob) { // if we were uploading a file
target.trigger({
type: 'uploadprogress',
loaded: blob.size || 1025,
total: blob.size || 1025
});
}
}
} catch (ex) {
if (Url.hasSameOrigin(meta.url)) {
// if response is sent with error code, iframe in IE gets redirected to res://ieframe.dll/http_x.htm
// which obviously results to cross domain error (wtf?)
_status = 404;
} else {
cleanup.call(target, function() {
target.trigger('error');
});
return;
}
}
cleanup.call(target, function() {
target.trigger('load');
});
}, target.uid);
} // end createIframe
// prepare data to be sent and convert if required
if (data instanceof FormData && data.hasBlob()) {
blob = data.getBlob();
uid = blob.uid;
input = Dom.get(uid);
form = Dom.get(uid + '_form');
if (!form) {
throw new x.DOMException(x.DOMException.NOT_FOUND_ERR);
}
} else {
uid = Basic.guid('uid_');
form = document.createElement('form');
form.setAttribute('id', uid + '_form');
form.setAttribute('method', meta.method);
form.setAttribute('enctype', 'multipart/form-data');
form.setAttribute('encoding', 'multipart/form-data');
form.setAttribute('target', uid + '_iframe');
I.getShimContainer().appendChild(form);
}
if (data instanceof FormData) {
data.each(function(value, name) {
if (value instanceof Blob) {
if (input) {
input.setAttribute('name', name);
}
} else {
var hidden = document.createElement('input');
Basic.extend(hidden, {
type : 'hidden',
name : name,
value : value
});
// make sure that input[type="file"], if it's there, comes last
if (input) {
form.insertBefore(hidden, input);
} else {
form.appendChild(hidden);
}
}
});
}
// set destination url
form.setAttribute("action", meta.url);
createIframe();
form.submit();
target.trigger('loadstart');
},
getStatus: function() {
return _status;
},
getResponse: function(responseType) {
if ('json' === responseType) {
// strip off <pre>..</pre> tags that might be enclosing the response
if (Basic.typeOf(_response) === 'string' && !!window.JSON) {
try {
return JSON.parse(_response.replace(/^\s*<pre[^>]*>/, '').replace(/<\/pre>\s*$/, ''));
} catch (ex) {
return null;
}
}
} else if ('document' === responseType) {
}
return _response;
},
abort: function() {
var target = this;
if (_iframe && _iframe.contentWindow) {
if (_iframe.contentWindow.stop) { // FireFox/Safari/Chrome
_iframe.contentWindow.stop();
} else if (_iframe.contentWindow.document.execCommand) { // IE
_iframe.contentWindow.document.execCommand('Stop');
} else {
_iframe.src = "about:blank";
}
}
cleanup.call(this, function() {
// target.dispatchEvent('readystatechange');
target.dispatchEvent('abort');
});
}
});
}
return (extensions.XMLHttpRequest = XMLHttpRequest);
});
// Included from: src/javascript/runtime/html5/utils/BinaryReader.js
/**
* BinaryReader.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/html5/utils/BinaryReader
@private
*/
define("moxie/runtime/html5/utils/BinaryReader", [], function() {
return function() {
var II = false, bin;
// Private functions
function read(idx, size) {
var mv = II ? 0 : -8 * (size - 1), sum = 0, i;
for (i = 0; i < size; i++) {
sum |= (bin.charCodeAt(idx + i) << Math.abs(mv + i*8));
}
return sum;
}
function putstr(segment, idx, length) {
length = arguments.length === 3 ? length : bin.length - idx - 1;
bin = bin.substr(0, idx) + segment + bin.substr(length + idx);
}
function write(idx, num, size) {
var str = '', mv = II ? 0 : -8 * (size - 1), i;
for (i = 0; i < size; i++) {
str += String.fromCharCode((num >> Math.abs(mv + i*8)) & 255);
}
putstr(str, idx, size);
}
// Public functions
return {
II: function(order) {
if (order === undefined) {
return II;
} else {
II = order;
}
},
init: function(binData) {
II = false;
bin = binData;
},
SEGMENT: function(idx, length, segment) {
switch (arguments.length) {
case 1:
return bin.substr(idx, bin.length - idx - 1);
case 2:
return bin.substr(idx, length);
case 3:
putstr(segment, idx, length);
break;
default: return bin;
}
},
BYTE: function(idx) {
return read(idx, 1);
},
SHORT: function(idx) {
return read(idx, 2);
},
LONG: function(idx, num) {
if (num === undefined) {
return read(idx, 4);
} else {
write(idx, num, 4);
}
},
SLONG: function(idx) { // 2's complement notation
var num = read(idx, 4);
return (num > 2147483647 ? num - 4294967296 : num);
},
STRING: function(idx, size) {
var str = '';
for (size += idx; idx < size; idx++) {
str += String.fromCharCode(read(idx, 1));
}
return str;
}
};
};
});
// Included from: src/javascript/runtime/html5/image/JPEGHeaders.js
/**
* JPEGHeaders.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/html5/image/JPEGHeaders
@private
*/
define("moxie/runtime/html5/image/JPEGHeaders", [
"moxie/runtime/html5/utils/BinaryReader"
], function(BinaryReader) {
return function JPEGHeaders(data) {
var headers = [], read, idx, marker, length = 0;
read = new BinaryReader();
read.init(data);
// Check if data is jpeg
if (read.SHORT(0) !== 0xFFD8) {
return;
}
idx = 2;
while (idx <= data.length) {
marker = read.SHORT(idx);
// omit RST (restart) markers
if (marker >= 0xFFD0 && marker <= 0xFFD7) {
idx += 2;
continue;
}
// no headers allowed after SOS marker
if (marker === 0xFFDA || marker === 0xFFD9) {
break;
}
length = read.SHORT(idx + 2) + 2;
// APPn marker detected
if (marker >= 0xFFE1 && marker <= 0xFFEF) {
headers.push({
hex: marker,
name: 'APP' + (marker & 0x000F),
start: idx,
length: length,
segment: read.SEGMENT(idx, length)
});
}
idx += length;
}
read.init(null); // free memory
return {
headers: headers,
restore: function(data) {
var max, i;
read.init(data);
idx = read.SHORT(2) == 0xFFE0 ? 4 + read.SHORT(4) : 2;
for (i = 0, max = headers.length; i < max; i++) {
read.SEGMENT(idx, 0, headers[i].segment);
idx += headers[i].length;
}
data = read.SEGMENT();
read.init(null);
return data;
},
strip: function(data) {
var headers, jpegHeaders, i;
jpegHeaders = new JPEGHeaders(data);
headers = jpegHeaders.headers;
jpegHeaders.purge();
read.init(data);
i = headers.length;
while (i--) {
read.SEGMENT(headers[i].start, headers[i].length, '');
}
data = read.SEGMENT();
read.init(null);
return data;
},
get: function(name) {
var array = [];
for (var i = 0, max = headers.length; i < max; i++) {
if (headers[i].name === name.toUpperCase()) {
array.push(headers[i].segment);
}
}
return array;
},
set: function(name, segment) {
var array = [], i, ii, max;
if (typeof(segment) === 'string') {
array.push(segment);
} else {
array = segment;
}
for (i = ii = 0, max = headers.length; i < max; i++) {
if (headers[i].name === name.toUpperCase()) {
headers[i].segment = array[ii];
headers[i].length = array[ii].length;
ii++;
}
if (ii >= array.length) {
break;
}
}
},
purge: function() {
headers = [];
read.init(null);
read = null;
}
};
};
});
// Included from: src/javascript/runtime/html5/image/ExifParser.js
/**
* ExifParser.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/html5/image/ExifParser
@private
*/
define("moxie/runtime/html5/image/ExifParser", [
"moxie/core/utils/Basic",
"moxie/runtime/html5/utils/BinaryReader"
], function(Basic, BinaryReader) {
return function ExifParser() {
// Private ExifParser fields
var data, tags, Tiff, offsets = {}, tagDescs;
data = new BinaryReader();
tags = {
tiff : {
/*
The image orientation viewed in terms of rows and columns.
1 = The 0th row is at the visual top of the image, and the 0th column is the visual left-hand side.
2 = The 0th row is at the visual top of the image, and the 0th column is the visual right-hand side.
3 = The 0th row is at the visual bottom of the image, and the 0th column is the visual right-hand side.
4 = The 0th row is at the visual bottom of the image, and the 0th column is the visual left-hand side.
5 = The 0th row is the visual left-hand side of the image, and the 0th column is the visual top.
6 = The 0th row is the visual right-hand side of the image, and the 0th column is the visual top.
7 = The 0th row is the visual right-hand side of the image, and the 0th column is the visual bottom.
8 = The 0th row is the visual left-hand side of the image, and the 0th column is the visual bottom.
*/
0x0112: 'Orientation',
0x010E: 'ImageDescription',
0x010F: 'Make',
0x0110: 'Model',
0x0131: 'Software',
0x8769: 'ExifIFDPointer',
0x8825: 'GPSInfoIFDPointer'
},
exif : {
0x9000: 'ExifVersion',
0xA001: 'ColorSpace',
0xA002: 'PixelXDimension',
0xA003: 'PixelYDimension',
0x9003: 'DateTimeOriginal',
0x829A: 'ExposureTime',
0x829D: 'FNumber',
0x8827: 'ISOSpeedRatings',
0x9201: 'ShutterSpeedValue',
0x9202: 'ApertureValue' ,
0x9207: 'MeteringMode',
0x9208: 'LightSource',
0x9209: 'Flash',
0x920A: 'FocalLength',
0xA402: 'ExposureMode',
0xA403: 'WhiteBalance',
0xA406: 'SceneCaptureType',
0xA404: 'DigitalZoomRatio',
0xA408: 'Contrast',
0xA409: 'Saturation',
0xA40A: 'Sharpness'
},
gps : {
0x0000: 'GPSVersionID',
0x0001: 'GPSLatitudeRef',
0x0002: 'GPSLatitude',
0x0003: 'GPSLongitudeRef',
0x0004: 'GPSLongitude'
}
};
tagDescs = {
'ColorSpace': {
1: 'sRGB',
0: 'Uncalibrated'
},
'MeteringMode': {
0: 'Unknown',
1: 'Average',
2: 'CenterWeightedAverage',
3: 'Spot',
4: 'MultiSpot',
5: 'Pattern',
6: 'Partial',
255: 'Other'
},
'LightSource': {
1: 'Daylight',
2: 'Fliorescent',
3: 'Tungsten',
4: 'Flash',
9: 'Fine weather',
10: 'Cloudy weather',
11: 'Shade',
12: 'Daylight fluorescent (D 5700 - 7100K)',
13: 'Day white fluorescent (N 4600 -5400K)',
14: 'Cool white fluorescent (W 3900 - 4500K)',
15: 'White fluorescent (WW 3200 - 3700K)',
17: 'Standard light A',
18: 'Standard light B',
19: 'Standard light C',
20: 'D55',
21: 'D65',
22: 'D75',
23: 'D50',
24: 'ISO studio tungsten',
255: 'Other'
},
'Flash': {
0x0000: 'Flash did not fire.',
0x0001: 'Flash fired.',
0x0005: 'Strobe return light not detected.',
0x0007: 'Strobe return light detected.',
0x0009: 'Flash fired, compulsory flash mode',
0x000D: 'Flash fired, compulsory flash mode, return light not detected',
0x000F: 'Flash fired, compulsory flash mode, return light detected',
0x0010: 'Flash did not fire, compulsory flash mode',
0x0018: 'Flash did not fire, auto mode',
0x0019: 'Flash fired, auto mode',
0x001D: 'Flash fired, auto mode, return light not detected',
0x001F: 'Flash fired, auto mode, return light detected',
0x0020: 'No flash function',
0x0041: 'Flash fired, red-eye reduction mode',
0x0045: 'Flash fired, red-eye reduction mode, return light not detected',
0x0047: 'Flash fired, red-eye reduction mode, return light detected',
0x0049: 'Flash fired, compulsory flash mode, red-eye reduction mode',
0x004D: 'Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected',
0x004F: 'Flash fired, compulsory flash mode, red-eye reduction mode, return light detected',
0x0059: 'Flash fired, auto mode, red-eye reduction mode',
0x005D: 'Flash fired, auto mode, return light not detected, red-eye reduction mode',
0x005F: 'Flash fired, auto mode, return light detected, red-eye reduction mode'
},
'ExposureMode': {
0: 'Auto exposure',
1: 'Manual exposure',
2: 'Auto bracket'
},
'WhiteBalance': {
0: 'Auto white balance',
1: 'Manual white balance'
},
'SceneCaptureType': {
0: 'Standard',
1: 'Landscape',
2: 'Portrait',
3: 'Night scene'
},
'Contrast': {
0: 'Normal',
1: 'Soft',
2: 'Hard'
},
'Saturation': {
0: 'Normal',
1: 'Low saturation',
2: 'High saturation'
},
'Sharpness': {
0: 'Normal',
1: 'Soft',
2: 'Hard'
},
// GPS related
'GPSLatitudeRef': {
N: 'North latitude',
S: 'South latitude'
},
'GPSLongitudeRef': {
E: 'East longitude',
W: 'West longitude'
}
};
function extractTags(IFD_offset, tags2extract) {
var length = data.SHORT(IFD_offset), i, ii,
tag, type, count, tagOffset, offset, value, values = [], hash = {};
for (i = 0; i < length; i++) {
// Set binary reader pointer to beginning of the next tag
offset = tagOffset = IFD_offset + 12 * i + 2;
tag = tags2extract[data.SHORT(offset)];
if (tag === undefined) {
continue; // Not the tag we requested
}
type = data.SHORT(offset+=2);
count = data.LONG(offset+=2);
offset += 4;
values = [];
switch (type) {
case 1: // BYTE
case 7: // UNDEFINED
if (count > 4) {
offset = data.LONG(offset) + offsets.tiffHeader;
}
for (ii = 0; ii < count; ii++) {
values[ii] = data.BYTE(offset + ii);
}
break;
case 2: // STRING
if (count > 4) {
offset = data.LONG(offset) + offsets.tiffHeader;
}
hash[tag] = data.STRING(offset, count - 1);
continue;
case 3: // SHORT
if (count > 2) {
offset = data.LONG(offset) + offsets.tiffHeader;
}
for (ii = 0; ii < count; ii++) {
values[ii] = data.SHORT(offset + ii*2);
}
break;
case 4: // LONG
if (count > 1) {
offset = data.LONG(offset) + offsets.tiffHeader;
}
for (ii = 0; ii < count; ii++) {
values[ii] = data.LONG(offset + ii*4);
}
break;
case 5: // RATIONAL
offset = data.LONG(offset) + offsets.tiffHeader;
for (ii = 0; ii < count; ii++) {
values[ii] = data.LONG(offset + ii*4) / data.LONG(offset + ii*4 + 4);
}
break;
case 9: // SLONG
offset = data.LONG(offset) + offsets.tiffHeader;
for (ii = 0; ii < count; ii++) {
values[ii] = data.SLONG(offset + ii*4);
}
break;
case 10: // SRATIONAL
offset = data.LONG(offset) + offsets.tiffHeader;
for (ii = 0; ii < count; ii++) {
values[ii] = data.SLONG(offset + ii*4) / data.SLONG(offset + ii*4 + 4);
}
break;
default:
continue;
}
value = (count == 1 ? values[0] : values);
if (tagDescs.hasOwnProperty(tag) && typeof value != 'object') {
hash[tag] = tagDescs[tag][value];
} else {
hash[tag] = value;
}
}
return hash;
}
function getIFDOffsets() {
var idx = offsets.tiffHeader;
// Set read order of multi-byte data
data.II(data.SHORT(idx) == 0x4949);
// Check if always present bytes are indeed present
if (data.SHORT(idx+=2) !== 0x002A) {
return false;
}
offsets.IFD0 = offsets.tiffHeader + data.LONG(idx += 2);
Tiff = extractTags(offsets.IFD0, tags.tiff);
if ('ExifIFDPointer' in Tiff) {
offsets.exifIFD = offsets.tiffHeader + Tiff.ExifIFDPointer;
delete Tiff.ExifIFDPointer;
}
if ('GPSInfoIFDPointer' in Tiff) {
offsets.gpsIFD = offsets.tiffHeader + Tiff.GPSInfoIFDPointer;
delete Tiff.GPSInfoIFDPointer;
}
return true;
}
// At the moment only setting of simple (LONG) values, that do not require offset recalculation, is supported
function setTag(ifd, tag, value) {
var offset, length, tagOffset, valueOffset = 0;
// If tag name passed translate into hex key
if (typeof(tag) === 'string') {
var tmpTags = tags[ifd.toLowerCase()];
for (var hex in tmpTags) {
if (tmpTags[hex] === tag) {
tag = hex;
break;
}
}
}
offset = offsets[ifd.toLowerCase() + 'IFD'];
length = data.SHORT(offset);
for (var i = 0; i < length; i++) {
tagOffset = offset + 12 * i + 2;
if (data.SHORT(tagOffset) == tag) {
valueOffset = tagOffset + 8;
break;
}
}
if (!valueOffset) {
return false;
}
data.LONG(valueOffset, value);
return true;
}
// Public functions
return {
init: function(segment) {
// Reset internal data
offsets = {
tiffHeader: 10
};
if (segment === undefined || !segment.length) {
return false;
}
data.init(segment);
// Check if that's APP1 and that it has EXIF
if (data.SHORT(0) === 0xFFE1 && data.STRING(4, 5).toUpperCase() === "EXIF\0") {
return getIFDOffsets();
}
return false;
},
TIFF: function() {
return Tiff;
},
EXIF: function() {
var Exif;
// Populate EXIF hash
Exif = extractTags(offsets.exifIFD, tags.exif);
// Fix formatting of some tags
if (Exif.ExifVersion && Basic.typeOf(Exif.ExifVersion) === 'array') {
for (var i = 0, exifVersion = ''; i < Exif.ExifVersion.length; i++) {
exifVersion += String.fromCharCode(Exif.ExifVersion[i]);
}
Exif.ExifVersion = exifVersion;
}
return Exif;
},
GPS: function() {
var GPS;
GPS = extractTags(offsets.gpsIFD, tags.gps);
// iOS devices (and probably some others) do not put in GPSVersionID tag (why?..)
if (GPS.GPSVersionID && Basic.typeOf(GPS.GPSVersionID) === 'array') {
GPS.GPSVersionID = GPS.GPSVersionID.join('.');
}
return GPS;
},
setExif: function(tag, value) {
// Right now only setting of width/height is possible
if (tag !== 'PixelXDimension' && tag !== 'PixelYDimension') {return false;}
return setTag('exif', tag, value);
},
getBinary: function() {
return data.SEGMENT();
},
purge: function() {
data.init(null);
data = Tiff = null;
offsets = {};
}
};
};
});
// Included from: src/javascript/runtime/html5/image/JPEG.js
/**
* JPEG.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/html5/image/JPEG
@private
*/
define("moxie/runtime/html5/image/JPEG", [
"moxie/core/utils/Basic",
"moxie/core/Exceptions",
"moxie/runtime/html5/image/JPEGHeaders",
"moxie/runtime/html5/utils/BinaryReader",
"moxie/runtime/html5/image/ExifParser"
], function(Basic, x, JPEGHeaders, BinaryReader, ExifParser) {
function JPEG(binstr) {
var _binstr, _br, _hm, _ep, _info, hasExif;
function _getDimensions() {
var idx = 0, marker, length;
// examine all through the end, since some images might have very large APP segments
while (idx <= _binstr.length) {
marker = _br.SHORT(idx += 2);
if (marker >= 0xFFC0 && marker <= 0xFFC3) { // SOFn
idx += 5; // marker (2 bytes) + length (2 bytes) + Sample precision (1 byte)
return {
height: _br.SHORT(idx),
width: _br.SHORT(idx += 2)
};
}
length = _br.SHORT(idx += 2);
idx += length - 2;
}
return null;
}
_binstr = binstr;
_br = new BinaryReader();
_br.init(_binstr);
// check if it is jpeg
if (_br.SHORT(0) !== 0xFFD8) {
throw new x.ImageError(x.ImageError.WRONG_FORMAT);
}
// backup headers
_hm = new JPEGHeaders(binstr);
// extract exif info
_ep = new ExifParser();
hasExif = !!_ep.init(_hm.get('app1')[0]);
// get dimensions
_info = _getDimensions.call(this);
Basic.extend(this, {
type: 'image/jpeg',
size: _binstr.length,
width: _info && _info.width || 0,
height: _info && _info.height || 0,
setExif: function(tag, value) {
if (!hasExif) {
return false; // or throw an exception
}
if (Basic.typeOf(tag) === 'object') {
Basic.each(tag, function(value, tag) {
_ep.setExif(tag, value);
});
} else {
_ep.setExif(tag, value);
}
// update internal headers
_hm.set('app1', _ep.getBinary());
},
writeHeaders: function() {
if (!arguments.length) {
// if no arguments passed, update headers internally
return (_binstr = _hm.restore(_binstr));
}
return _hm.restore(arguments[0]);
},
stripHeaders: function(binstr) {
return _hm.strip(binstr);
},
purge: function() {
_purge.call(this);
}
});
if (hasExif) {
this.meta = {
tiff: _ep.TIFF(),
exif: _ep.EXIF(),
gps: _ep.GPS()
};
}
function _purge() {
if (!_ep || !_hm || !_br) {
return; // ignore any repeating purge requests
}
_ep.purge();
_hm.purge();
_br.init(null);
_binstr = _info = _hm = _ep = _br = null;
}
}
return JPEG;
});
// Included from: src/javascript/runtime/html5/image/PNG.js
/**
* PNG.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/html5/image/PNG
@private
*/
define("moxie/runtime/html5/image/PNG", [
"moxie/core/Exceptions",
"moxie/core/utils/Basic",
"moxie/runtime/html5/utils/BinaryReader"
], function(x, Basic, BinaryReader) {
function PNG(binstr) {
var _binstr, _br, _hm, _ep, _info;
_binstr = binstr;
_br = new BinaryReader();
_br.init(_binstr);
// check if it's png
(function() {
var idx = 0, i = 0
, signature = [0x8950, 0x4E47, 0x0D0A, 0x1A0A]
;
for (i = 0; i < signature.length; i++, idx += 2) {
if (signature[i] != _br.SHORT(idx)) {
throw new x.ImageError(x.ImageError.WRONG_FORMAT);
}
}
}());
function _getDimensions() {
var chunk, idx;
chunk = _getChunkAt.call(this, 8);
if (chunk.type == 'IHDR') {
idx = chunk.start;
return {
width: _br.LONG(idx),
height: _br.LONG(idx += 4)
};
}
return null;
}
function _purge() {
if (!_br) {
return; // ignore any repeating purge requests
}
_br.init(null);
_binstr = _info = _hm = _ep = _br = null;
}
_info = _getDimensions.call(this);
Basic.extend(this, {
type: 'image/png',
size: _binstr.length,
width: _info.width,
height: _info.height,
purge: function() {
_purge.call(this);
}
});
// for PNG we can safely trigger purge automatically, as we do not keep any data for later
_purge.call(this);
function _getChunkAt(idx) {
var length, type, start, CRC;
length = _br.LONG(idx);
type = _br.STRING(idx += 4, 4);
start = idx += 4;
CRC = _br.LONG(idx + length);
return {
length: length,
type: type,
start: start,
CRC: CRC
};
}
}
return PNG;
});
// Included from: src/javascript/runtime/html5/image/ImageInfo.js
/**
* ImageInfo.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/html5/image/ImageInfo
@private
*/
define("moxie/runtime/html5/image/ImageInfo", [
"moxie/core/utils/Basic",
"moxie/core/Exceptions",
"moxie/runtime/html5/image/JPEG",
"moxie/runtime/html5/image/PNG"
], function(Basic, x, JPEG, PNG) {
/**
Optional image investigation tool for HTML5 runtime. Provides the following features:
- ability to distinguish image type (JPEG or PNG) by signature
- ability to extract image width/height directly from it's internals, without preloading in memory (fast)
- ability to extract APP headers from JPEGs (Exif, GPS, etc)
- ability to replace width/height tags in extracted JPEG headers
- ability to restore APP headers, that were for example stripped during image manipulation
@class ImageInfo
@constructor
@param {String} binstr Image source as binary string
*/
return function(binstr) {
var _cs = [JPEG, PNG], _img;
// figure out the format, throw: ImageError.WRONG_FORMAT if not supported
_img = (function() {
for (var i = 0; i < _cs.length; i++) {
try {
return new _cs[i](binstr);
} catch (ex) {
// console.info(ex);
}
}
throw new x.ImageError(x.ImageError.WRONG_FORMAT);
}());
Basic.extend(this, {
/**
Image Mime Type extracted from it's depths
@property type
@type {String}
@default ''
*/
type: '',
/**
Image size in bytes
@property size
@type {Number}
@default 0
*/
size: 0,
/**
Image width extracted from image source
@property width
@type {Number}
@default 0
*/
width: 0,
/**
Image height extracted from image source
@property height
@type {Number}
@default 0
*/
height: 0,
/**
Sets Exif tag. Currently applicable only for width and height tags. Obviously works only with JPEGs.
@method setExif
@param {String} tag Tag to set
@param {Mixed} value Value to assign to the tag
*/
setExif: function() {},
/**
Restores headers to the source.
@method writeHeaders
@param {String} data Image source as binary string
@return {String} Updated binary string
*/
writeHeaders: function(data) {
return data;
},
/**
Strip all headers from the source.
@method stripHeaders
@param {String} data Image source as binary string
@return {String} Updated binary string
*/
stripHeaders: function(data) {
return data;
},
/**
Dispose resources.
@method purge
*/
purge: function() {}
});
Basic.extend(this, _img);
this.purge = function() {
_img.purge();
_img = null;
};
};
});
// Included from: src/javascript/runtime/html5/image/MegaPixel.js
/**
(The MIT License)
Copyright (c) 2012 Shinichi Tomita <shinichi.tomita@gmail.com>;
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.
*/
/**
* Mega pixel image rendering library for iOS6 Safari
*
* Fixes iOS6 Safari's image file rendering issue for large size image (over mega-pixel),
* which causes unexpected subsampling when drawing it in canvas.
* By using this library, you can safely render the image with proper stretching.
*
* Copyright (c) 2012 Shinichi Tomita <shinichi.tomita@gmail.com>
* Released under the MIT license
*/
/**
@class moxie/runtime/html5/image/MegaPixel
@private
*/
define("moxie/runtime/html5/image/MegaPixel", [], function() {
/**
* Rendering image element (with resizing) into the canvas element
*/
function renderImageToCanvas(img, canvas, options) {
var iw = img.naturalWidth, ih = img.naturalHeight;
var width = options.width, height = options.height;
var x = options.x || 0, y = options.y || 0;
var ctx = canvas.getContext('2d');
if (detectSubsampling(img)) {
iw /= 2;
ih /= 2;
}
var d = 1024; // size of tiling canvas
var tmpCanvas = document.createElement('canvas');
tmpCanvas.width = tmpCanvas.height = d;
var tmpCtx = tmpCanvas.getContext('2d');
var vertSquashRatio = detectVerticalSquash(img, iw, ih);
var sy = 0;
while (sy < ih) {
var sh = sy + d > ih ? ih - sy : d;
var sx = 0;
while (sx < iw) {
var sw = sx + d > iw ? iw - sx : d;
tmpCtx.clearRect(0, 0, d, d);
tmpCtx.drawImage(img, -sx, -sy);
var dx = (sx * width / iw + x) << 0;
var dw = Math.ceil(sw * width / iw);
var dy = (sy * height / ih / vertSquashRatio + y) << 0;
var dh = Math.ceil(sh * height / ih / vertSquashRatio);
ctx.drawImage(tmpCanvas, 0, 0, sw, sh, dx, dy, dw, dh);
sx += d;
}
sy += d;
}
tmpCanvas = tmpCtx = null;
}
/**
* Detect subsampling in loaded image.
* In iOS, larger images than 2M pixels may be subsampled in rendering.
*/
function detectSubsampling(img) {
var iw = img.naturalWidth, ih = img.naturalHeight;
if (iw * ih > 1024 * 1024) { // subsampling may happen over megapixel image
var canvas = document.createElement('canvas');
canvas.width = canvas.height = 1;
var ctx = canvas.getContext('2d');
ctx.drawImage(img, -iw + 1, 0);
// subsampled image becomes half smaller in rendering size.
// check alpha channel value to confirm image is covering edge pixel or not.
// if alpha value is 0 image is not covering, hence subsampled.
return ctx.getImageData(0, 0, 1, 1).data[3] === 0;
} else {
return false;
}
}
/**
* Detecting vertical squash in loaded image.
* Fixes a bug which squash image vertically while drawing into canvas for some images.
*/
function detectVerticalSquash(img, iw, ih) {
var canvas = document.createElement('canvas');
canvas.width = 1;
canvas.height = ih;
var ctx = canvas.getContext('2d');
ctx.drawImage(img, 0, 0);
var data = ctx.getImageData(0, 0, 1, ih).data;
// search image edge pixel position in case it is squashed vertically.
var sy = 0;
var ey = ih;
var py = ih;
while (py > sy) {
var alpha = data[(py - 1) * 4 + 3];
if (alpha === 0) {
ey = py;
} else {
sy = py;
}
py = (ey + sy) >> 1;
}
canvas = null;
var ratio = (py / ih);
return (ratio === 0) ? 1 : ratio;
}
return {
isSubsampled: detectSubsampling,
renderTo: renderImageToCanvas
};
});
// Included from: src/javascript/runtime/html5/image/Image.js
/**
* Image.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/html5/image/Image
@private
*/
define("moxie/runtime/html5/image/Image", [
"moxie/runtime/html5/Runtime",
"moxie/core/utils/Basic",
"moxie/core/Exceptions",
"moxie/core/utils/Encode",
"moxie/file/File",
"moxie/runtime/html5/image/ImageInfo",
"moxie/runtime/html5/image/MegaPixel",
"moxie/core/utils/Mime",
"moxie/core/utils/Env"
], function(extensions, Basic, x, Encode, File, ImageInfo, MegaPixel, Mime, Env) {
function HTML5Image() {
var me = this
, _img, _imgInfo, _canvas, _binStr, _blob
, _modified = false // is set true whenever image is modified
, _preserveHeaders = true
;
Basic.extend(this, {
loadFromBlob: function(blob) {
var comp = this, I = comp.getRuntime()
, asBinary = arguments.length > 1 ? arguments[1] : true
;
if (!I.can('access_binary')) {
throw new x.RuntimeError(x.RuntimeError.NOT_SUPPORTED_ERR);
}
_blob = blob;
if (blob.isDetached()) {
_binStr = blob.getSource();
_preload.call(this, _binStr);
return;
} else {
_readAsDataUrl.call(this, blob.getSource(), function(dataUrl) {
if (asBinary) {
_binStr = _toBinary(dataUrl);
}
_preload.call(comp, dataUrl);
});
}
},
loadFromImage: function(img, exact) {
this.meta = img.meta;
_blob = new File(null, {
name: img.name,
size: img.size,
type: img.type
});
_preload.call(this, exact ? (_binStr = img.getAsBinaryString()) : img.getAsDataURL());
},
getInfo: function() {
var I = this.getRuntime(), info;
if (!_imgInfo && _binStr && I.can('access_image_binary')) {
_imgInfo = new ImageInfo(_binStr);
}
info = {
width: _getImg().width || 0,
height: _getImg().height || 0,
type: _blob.type || Mime.getFileMime(_blob.name),
size: _binStr && _binStr.length || _blob.size || 0,
name: _blob.name || '',
meta: _imgInfo && _imgInfo.meta || this.meta || {}
};
return info;
},
downsize: function() {
_downsize.apply(this, arguments);
},
getAsCanvas: function() {
if (_canvas) {
_canvas.id = this.uid + '_canvas';
}
return _canvas;
},
getAsBlob: function(type, quality) {
if (type !== this.type) {
// if different mime type requested prepare image for conversion
_downsize.call(this, this.width, this.height, false);
}
return new File(null, {
name: _blob.name || '',
type: type,
data: me.getAsBinaryString.call(this, type, quality)
});
},
getAsDataURL: function(type) {
var quality = arguments[1] || 90;
// if image has not been modified, return the source right away
if (!_modified) {
return _img.src;
}
if ('image/jpeg' !== type) {
return _canvas.toDataURL('image/png');
} else {
try {
// older Geckos used to result in an exception on quality argument
return _canvas.toDataURL('image/jpeg', quality/100);
} catch (ex) {
return _canvas.toDataURL('image/jpeg');
}
}
},
getAsBinaryString: function(type, quality) {
// if image has not been modified, return the source right away
if (!_modified) {
// if image was not loaded from binary string
if (!_binStr) {
_binStr = _toBinary(me.getAsDataURL(type, quality));
}
return _binStr;
}
if ('image/jpeg' !== type) {
_binStr = _toBinary(me.getAsDataURL(type, quality));
} else {
var dataUrl;
// if jpeg
if (!quality) {
quality = 90;
}
try {
// older Geckos used to result in an exception on quality argument
dataUrl = _canvas.toDataURL('image/jpeg', quality/100);
} catch (ex) {
dataUrl = _canvas.toDataURL('image/jpeg');
}
_binStr = _toBinary(dataUrl);
if (_imgInfo) {
_binStr = _imgInfo.stripHeaders(_binStr);
if (_preserveHeaders) {
// update dimensions info in exif
if (_imgInfo.meta && _imgInfo.meta.exif) {
_imgInfo.setExif({
PixelXDimension: this.width,
PixelYDimension: this.height
});
}
// re-inject the headers
_binStr = _imgInfo.writeHeaders(_binStr);
}
// will be re-created from fresh on next getInfo call
_imgInfo.purge();
_imgInfo = null;
}
}
_modified = false;
return _binStr;
},
destroy: function() {
me = null;
_purge.call(this);
this.getRuntime().getShim().removeInstance(this.uid);
}
});
function _getImg() {
if (!_canvas && !_img) {
throw new x.ImageError(x.DOMException.INVALID_STATE_ERR);
}
return _canvas || _img;
}
function _toBinary(str) {
return Encode.atob(str.substring(str.indexOf('base64,') + 7));
}
function _toDataUrl(str, type) {
return 'data:' + (type || '') + ';base64,' + Encode.btoa(str);
}
function _preload(str) {
var comp = this;
_img = new Image();
_img.onerror = function() {
_purge.call(this);
comp.trigger('error', x.ImageError.WRONG_FORMAT);
};
_img.onload = function() {
comp.trigger('load');
};
_img.src = /^data:[^;]*;base64,/.test(str) ? str : _toDataUrl(str, _blob.type);
}
function _readAsDataUrl(file, callback) {
var comp = this, fr;
// use FileReader if it's available
if (window.FileReader) {
fr = new FileReader();
fr.onload = function() {
callback(this.result);
};
fr.onerror = function() {
comp.trigger('error', x.ImageError.WRONG_FORMAT);
};
fr.readAsDataURL(file);
} else {
return callback(file.getAsDataURL());
}
}
function _downsize(width, height, crop, preserveHeaders) {
var self = this
, scale
, mathFn
, x = 0
, y = 0
, img
, destWidth
, destHeight
, orientation
;
_preserveHeaders = preserveHeaders; // we will need to check this on export (see getAsBinaryString())
// take into account orientation tag
orientation = (this.meta && this.meta.tiff && this.meta.tiff.Orientation) || 1;
if (Basic.inArray(orientation, [5,6,7,8]) !== -1) { // values that require 90 degree rotation
// swap dimensions
var tmp = width;
width = height;
height = tmp;
}
img = _getImg();
// unify dimensions
if (!crop) {
scale = Math.min(width/img.width, height/img.height);
} else {
// one of the dimensions may exceed the actual image dimensions - we need to take the smallest value
width = Math.min(width, img.width);
height = Math.min(height, img.height);
scale = Math.max(width/img.width, height/img.height);
}
// we only downsize here
if (scale > 1 && !crop && preserveHeaders) {
this.trigger('Resize');
return;
}
// prepare canvas if necessary
if (!_canvas) {
_canvas = document.createElement("canvas");
}
// calculate dimensions of proportionally resized image
destWidth = Math.round(img.width * scale);
destHeight = Math.round(img.height * scale);
// scale image and canvas
if (crop) {
_canvas.width = width;
_canvas.height = height;
// if dimensions of the resulting image still larger than canvas, center it
if (destWidth > width) {
x = Math.round((destWidth - width) / 2);
}
if (destHeight > height) {
y = Math.round((destHeight - height) / 2);
}
} else {
_canvas.width = destWidth;
_canvas.height = destHeight;
}
// rotate if required, according to orientation tag
if (!_preserveHeaders) {
_rotateToOrientaion(_canvas.width, _canvas.height, orientation);
}
_drawToCanvas.call(this, img, _canvas, -x, -y, destWidth, destHeight);
this.width = _canvas.width;
this.height = _canvas.height;
_modified = true;
self.trigger('Resize');
}
function _drawToCanvas(img, canvas, x, y, w, h) {
if (Env.OS === 'iOS') {
// avoid squish bug in iOS6
MegaPixel.renderTo(img, canvas, { width: w, height: h, x: x, y: y });
} else {
var ctx = canvas.getContext('2d');
ctx.drawImage(img, x, y, w, h);
}
}
/**
* Transform canvas coordination according to specified frame size and orientation
* Orientation value is from EXIF tag
* @author Shinichi Tomita <shinichi.tomita@gmail.com>
*/
function _rotateToOrientaion(width, height, orientation) {
switch (orientation) {
case 5:
case 6:
case 7:
case 8:
_canvas.width = height;
_canvas.height = width;
break;
default:
_canvas.width = width;
_canvas.height = height;
}
/**
1 = The 0th row is at the visual top of the image, and the 0th column is the visual left-hand side.
2 = The 0th row is at the visual top of the image, and the 0th column is the visual right-hand side.
3 = The 0th row is at the visual bottom of the image, and the 0th column is the visual right-hand side.
4 = The 0th row is at the visual bottom of the image, and the 0th column is the visual left-hand side.
5 = The 0th row is the visual left-hand side of the image, and the 0th column is the visual top.
6 = The 0th row is the visual right-hand side of the image, and the 0th column is the visual top.
7 = The 0th row is the visual right-hand side of the image, and the 0th column is the visual bottom.
8 = The 0th row is the visual left-hand side of the image, and the 0th column is the visual bottom.
*/
var ctx = _canvas.getContext('2d');
switch (orientation) {
case 2:
// horizontal flip
ctx.translate(width, 0);
ctx.scale(-1, 1);
break;
case 3:
// 180 rotate left
ctx.translate(width, height);
ctx.rotate(Math.PI);
break;
case 4:
// vertical flip
ctx.translate(0, height);
ctx.scale(1, -1);
break;
case 5:
// vertical flip + 90 rotate right
ctx.rotate(0.5 * Math.PI);
ctx.scale(1, -1);
break;
case 6:
// 90 rotate right
ctx.rotate(0.5 * Math.PI);
ctx.translate(0, -height);
break;
case 7:
// horizontal flip + 90 rotate right
ctx.rotate(0.5 * Math.PI);
ctx.translate(width, -height);
ctx.scale(-1, 1);
break;
case 8:
// 90 rotate left
ctx.rotate(-0.5 * Math.PI);
ctx.translate(-width, 0);
break;
}
}
function _purge() {
if (_imgInfo) {
_imgInfo.purge();
_imgInfo = null;
}
_binStr = _img = _canvas = _blob = null;
_modified = false;
}
}
return (extensions.Image = HTML5Image);
});
// Included from: src/javascript/runtime/html4/image/Image.js
/**
* Image.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/html4/image/Image
@private
*/
define("moxie/runtime/html4/image/Image", [
"moxie/runtime/html4/Runtime",
"moxie/runtime/html5/image/Image"
], function(extensions, Image) {
return (extensions.Image = Image);
});
expose(["moxie/core/utils/Basic","moxie/core/I18n","moxie/core/utils/Mime","moxie/core/utils/Env","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/core/EventTarget","moxie/core/utils/Encode","moxie/runtime/Runtime","moxie/runtime/RuntimeClient","moxie/file/Blob","moxie/file/File","moxie/file/FileInput","moxie/runtime/RuntimeTarget","moxie/file/FileReader","moxie/core/utils/Url","moxie/file/FileReaderSync","moxie/xhr/FormData","moxie/xhr/XMLHttpRequest","moxie/runtime/Transporter","moxie/image/Image","moxie/core/utils/Events"]);
})(this);/**
* o.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/*global moxie:true */
/**
Globally exposed namespace with the most frequently used public classes and handy methods.
@class o
@static
@private
*/
(function(exports) {
"use strict";
var o = {}, inArray = exports.moxie.core.utils.Basic.inArray;
// directly add some public classes
// (we do it dynamically here, since for custom builds we cannot know beforehand what modules were included)
(function addAlias(ns) {
var name, itemType;
for (name in ns) {
itemType = typeof(ns[name]);
if (itemType === 'object' && !~inArray(name, ['Exceptions', 'Env', 'Mime'])) {
addAlias(ns[name]);
} else if (itemType === 'function') {
o[name] = ns[name];
}
}
})(exports.moxie);
// add some manually
o.Env = exports.moxie.core.utils.Env;
o.Mime = exports.moxie.core.utils.Mime;
o.Exceptions = exports.moxie.core.Exceptions;
// expose globally
exports.mOxie = o;
if (!exports.o) {
exports.o = o;
}
return o;
})(this);
|
server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/ActionsCell-test.js | lbndev/sonarqube | /*
* SonarQube
* Copyright (C) 2009-2017 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { shallow } from 'enzyme';
import React from 'react';
import ActionsCell from '../ActionsCell';
const SAMPLE = {
id: 'id',
name: 'name',
permissions: [],
defaultFor: []
};
function renderActionsCell(props) {
return shallow(
<ActionsCell
permissionTemplate={SAMPLE}
topQualifiers={['TRK', 'VW']}
refresh={() => true}
{...props}
/>
);
}
it('should set default', () => {
const setDefault = renderActionsCell().find('.js-set-default');
expect(setDefault.length).toBe(2);
expect(setDefault.at(0).prop('data-qualifier')).toBe('TRK');
expect(setDefault.at(1).prop('data-qualifier')).toBe('VW');
});
it('should not set default', () => {
const permissionTemplate = { ...SAMPLE, defaultFor: ['TRK', 'VW'] };
const setDefault = renderActionsCell({ permissionTemplate }).find('.js-set-default');
expect(setDefault.length).toBe(0);
});
it('should display all qualifiers for default organization', () => {
const organization = { isDefault: true };
const setDefault = renderActionsCell({ organization }).find('.js-set-default');
expect(setDefault.length).toBe(2);
expect(setDefault.at(0).prop('data-qualifier')).toBe('TRK');
expect(setDefault.at(1).prop('data-qualifier')).toBe('VW');
});
it('should display only projects for custom organization', () => {
const organization = { isDefault: false };
const setDefault = renderActionsCell({ organization }).find('.js-set-default');
expect(setDefault.length).toBe(1);
expect(setDefault.at(0).prop('data-qualifier')).toBe('TRK');
});
|
jspm_packages/npm/babel-core@5.8.35/browser.min.js | bitfly-p2p/bitfly-client | /* */
"format amd";
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.babel=e()}}(function(){var e,t,r;return function n(e,t,r){function i(s,o){if(!t[s]){if(!e[s]){var u="function"==typeof require&&require;if(!o&&u)return u(s,!0);if(a)return a(s,!0);var p=new Error("Cannot find module '"+s+"'");throw p.code="MODULE_NOT_FOUND",p}var l=t[s]={exports:{}};e[s][0].call(l.exports,function(t){var r=e[s][1][t];return i(r?r:t)},l,l.exports,n,e,t,r)}return t[s].exports}for(var a="function"==typeof require&&require,s=0;s<r.length;s++)i(r[s]);return i}({1:[function(e,t,r){function n(e,t){return d.isUndefined(t)?""+t:d.isNumber(t)&&!isFinite(t)?t.toString():d.isFunction(t)||d.isRegExp(t)?t.toString():t}function i(e,t){return d.isString(e)?e.length<t?e:e.slice(0,t):e}function a(e){return i(JSON.stringify(e.actual,n),128)+" "+e.operator+" "+i(JSON.stringify(e.expected,n),128)}function s(e,t,r,n,i){throw new y.AssertionError({message:r,actual:e,expected:t,operator:n,stackStartFunction:i})}function o(e,t){e||s(e,!0,t,"==",y.ok)}function u(e,t){if(e===t)return!0;if(d.isBuffer(e)&&d.isBuffer(t)){if(e.length!=t.length)return!1;for(var r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}return d.isDate(e)&&d.isDate(t)?e.getTime()===t.getTime():d.isRegExp(e)&&d.isRegExp(t)?e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.lastIndex===t.lastIndex&&e.ignoreCase===t.ignoreCase:d.isObject(e)||d.isObject(t)?l(e,t):e==t}function p(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function l(e,t){if(d.isNullOrUndefined(e)||d.isNullOrUndefined(t))return!1;if(e.prototype!==t.prototype)return!1;if(d.isPrimitive(e)||d.isPrimitive(t))return e===t;var r=p(e),n=p(t);if(r&&!n||!r&&n)return!1;if(r)return e=h.call(e),t=h.call(t),u(e,t);var i,a,s=g(e),o=g(t);if(s.length!=o.length)return!1;for(s.sort(),o.sort(),a=s.length-1;a>=0;a--)if(s[a]!=o[a])return!1;for(a=s.length-1;a>=0;a--)if(i=s[a],!u(e[i],t[i]))return!1;return!0}function c(e,t){return e&&t?"[object RegExp]"==Object.prototype.toString.call(t)?t.test(e):e instanceof t?!0:t.call({},e)===!0?!0:!1:!1}function f(e,t,r,n){var i;d.isString(r)&&(n=r,r=null);try{t()}catch(a){i=a}if(n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),e&&!i&&s(i,r,"Missing expected exception"+n),!e&&c(i,r)&&s(i,r,"Got unwanted exception"+n),e&&i&&r&&!c(i,r)||!e&&i)throw i}var d=e(13),h=Array.prototype.slice,m=Object.prototype.hasOwnProperty,y=t.exports=o;y.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=a(this),this.generatedMessage=!0);var t=e.stackStartFunction||s;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var r=new Error;if(r.stack){var n=r.stack,i=t.name,o=n.indexOf("\n"+i);if(o>=0){var u=n.indexOf("\n",o+1);n=n.substring(u+1)}this.stack=n}}},d.inherits(y.AssertionError,Error),y.fail=s,y.ok=o,y.equal=function(e,t,r){e!=t&&s(e,t,r,"==",y.equal)},y.notEqual=function(e,t,r){e==t&&s(e,t,r,"!=",y.notEqual)},y.deepEqual=function(e,t,r){u(e,t)||s(e,t,r,"deepEqual",y.deepEqual)},y.notDeepEqual=function(e,t,r){u(e,t)&&s(e,t,r,"notDeepEqual",y.notDeepEqual)},y.strictEqual=function(e,t,r){e!==t&&s(e,t,r,"===",y.strictEqual)},y.notStrictEqual=function(e,t,r){e===t&&s(e,t,r,"!==",y.notStrictEqual)},y["throws"]=function(e,t,r){f.apply(this,[!0].concat(h.call(arguments)))},y.doesNotThrow=function(e,t){f.apply(this,[!1].concat(h.call(arguments)))},y.ifError=function(e){if(e)throw e};var g=Object.keys||function(e){var t=[];for(var r in e)m.call(e,r)&&t.push(r);return t}},{13:13}],2:[function(e,t,r){var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(e){"use strict";function t(e){var t=e.charCodeAt(0);return t===s||t===c?62:t===o||t===f?63:u>t?-1:u+10>t?t-u+26+26:l+26>t?t-l:p+26>t?t-p+26:void 0}function r(e){function r(e){p[c++]=e}var n,i,s,o,u,p;if(e.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var l=e.length;u="="===e.charAt(l-2)?2:"="===e.charAt(l-1)?1:0,p=new a(3*e.length/4-u),s=u>0?e.length-4:e.length;var c=0;for(n=0,i=0;s>n;n+=4,i+=3)o=t(e.charAt(n))<<18|t(e.charAt(n+1))<<12|t(e.charAt(n+2))<<6|t(e.charAt(n+3)),r((16711680&o)>>16),r((65280&o)>>8),r(255&o);return 2===u?(o=t(e.charAt(n))<<2|t(e.charAt(n+1))>>4,r(255&o)):1===u&&(o=t(e.charAt(n))<<10|t(e.charAt(n+1))<<4|t(e.charAt(n+2))>>2,r(o>>8&255),r(255&o)),p}function i(e){function t(e){return n.charAt(e)}function r(e){return t(e>>18&63)+t(e>>12&63)+t(e>>6&63)+t(63&e)}var i,a,s,o=e.length%3,u="";for(i=0,s=e.length-o;s>i;i+=3)a=(e[i]<<16)+(e[i+1]<<8)+e[i+2],u+=r(a);switch(o){case 1:a=e[e.length-1],u+=t(a>>2),u+=t(a<<4&63),u+="==";break;case 2:a=(e[e.length-2]<<8)+e[e.length-1],u+=t(a>>10),u+=t(a>>4&63),u+=t(a<<2&63),u+="="}return u}var a="undefined"!=typeof Uint8Array?Uint8Array:Array,s="+".charCodeAt(0),o="/".charCodeAt(0),u="0".charCodeAt(0),p="a".charCodeAt(0),l="A".charCodeAt(0),c="-".charCodeAt(0),f="_".charCodeAt(0);e.toByteArray=r,e.fromByteArray=i}("undefined"==typeof r?this.base64js={}:r)},{}],3:[function(e,t,r){},{}],4:[function(e,t,r){(function(t){"use strict";function n(){function e(){}try{var t=new Uint8Array(1);return t.foo=function(){return 42},t.constructor=e,42===t.foo()&&t.constructor===e&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(r){return!1}}function i(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e){return this instanceof a?(a.TYPED_ARRAY_SUPPORT||(this.length=0,this.parent=void 0),"number"==typeof e?s(this,e):"string"==typeof e?o(this,e,arguments.length>1?arguments[1]:"utf8"):u(this,e)):arguments.length>1?new a(e,arguments[1]):new a(e)}function s(e,t){if(e=m(e,0>t?0:0|y(t)),!a.TYPED_ARRAY_SUPPORT)for(var r=0;t>r;r++)e[r]=0;return e}function o(e,t,r){("string"!=typeof r||""===r)&&(r="utf8");var n=0|v(t,r);return e=m(e,n),e.write(t,r),e}function u(e,t){if(a.isBuffer(t))return p(e,t);if(K(t))return l(e,t);if(null==t)throw new TypeError("must start with number, buffer, array or string");if("undefined"!=typeof ArrayBuffer){if(t.buffer instanceof ArrayBuffer)return c(e,t);if(t instanceof ArrayBuffer)return f(e,t)}return t.length?d(e,t):h(e,t)}function p(e,t){var r=0|y(t.length);return e=m(e,r),t.copy(e,0,0,r),e}function l(e,t){var r=0|y(t.length);e=m(e,r);for(var n=0;r>n;n+=1)e[n]=255&t[n];return e}function c(e,t){var r=0|y(t.length);e=m(e,r);for(var n=0;r>n;n+=1)e[n]=255&t[n];return e}function f(e,t){return a.TYPED_ARRAY_SUPPORT?(t.byteLength,e=a._augment(new Uint8Array(t))):e=c(e,new Uint8Array(t)),e}function d(e,t){var r=0|y(t.length);e=m(e,r);for(var n=0;r>n;n+=1)e[n]=255&t[n];return e}function h(e,t){var r,n=0;"Buffer"===t.type&&K(t.data)&&(r=t.data,n=0|y(r.length)),e=m(e,n);for(var i=0;n>i;i+=1)e[i]=255&r[i];return e}function m(e,t){a.TYPED_ARRAY_SUPPORT?(e=a._augment(new Uint8Array(t)),e.__proto__=a.prototype):(e.length=t,e._isBuffer=!0);var r=0!==t&&t<=a.poolSize>>>1;return r&&(e.parent=$),e}function y(e){if(e>=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|e}function g(e,t){if(!(this instanceof g))return new g(e,t);var r=new a(e,t);return delete r.parent,r}function v(e,t){"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"binary":case"raw":case"raws":return r;case"utf8":case"utf-8":return G(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return X(e).length;default:if(n)return G(e).length;t=(""+t).toLowerCase(),n=!0}}function b(e,t,r){var n=!1;if(t=0|t,r=void 0===r||r===1/0?this.length:0|r,e||(e="utf8"),0>t&&(t=0),r>this.length&&(r=this.length),t>=r)return"";for(;;)switch(e){case"hex":return P(this,t,r);case"utf8":case"utf-8":return I(this,t,r);case"ascii":return F(this,t,r);case"binary":return k(this,t,r);case"base64":return w(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function E(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;var a=t.length;if(a%2!==0)throw new Error("Invalid hex string");n>a/2&&(n=a/2);for(var s=0;n>s;s++){var o=parseInt(t.substr(2*s,2),16);if(isNaN(o))throw new Error("Invalid hex string");e[r+s]=o}return s}function x(e,t,r,n){return Y(G(t,e.length-r),e,r,n)}function S(e,t,r,n){return Y(H(t),e,r,n)}function A(e,t,r,n){return S(e,t,r,n)}function D(e,t,r,n){return Y(X(t),e,r,n)}function C(e,t,r,n){return Y(W(t,e.length-r),e,r,n)}function w(e,t,r){return 0===t&&r===e.length?J.fromByteArray(e):J.fromByteArray(e.slice(t,r))}function I(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;r>i;){var a=e[i],s=null,o=a>239?4:a>223?3:a>191?2:1;if(r>=i+o){var u,p,l,c;switch(o){case 1:128>a&&(s=a);break;case 2:u=e[i+1],128===(192&u)&&(c=(31&a)<<6|63&u,c>127&&(s=c));break;case 3:u=e[i+1],p=e[i+2],128===(192&u)&&128===(192&p)&&(c=(15&a)<<12|(63&u)<<6|63&p,c>2047&&(55296>c||c>57343)&&(s=c));break;case 4:u=e[i+1],p=e[i+2],l=e[i+3],128===(192&u)&&128===(192&p)&&128===(192&l)&&(c=(15&a)<<18|(63&u)<<12|(63&p)<<6|63&l,c>65535&&1114112>c&&(s=c))}}null===s?(s=65533,o=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s),i+=o}return _(n)}function _(e){var t=e.length;if(Q>=t)return String.fromCharCode.apply(String,e);for(var r="",n=0;t>n;)r+=String.fromCharCode.apply(String,e.slice(n,n+=Q));return r}function F(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;r>i;i++)n+=String.fromCharCode(127&e[i]);return n}function k(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;r>i;i++)n+=String.fromCharCode(e[i]);return n}function P(e,t,r){var n=e.length;(!t||0>t)&&(t=0),(!r||0>r||r>n)&&(r=n);for(var i="",a=t;r>a;a++)i+=q(e[a]);return i}function B(e,t,r){for(var n=e.slice(t,r),i="",a=0;a<n.length;a+=2)i+=String.fromCharCode(n[a]+256*n[a+1]);return i}function T(e,t,r){if(e%1!==0||0>e)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function M(e,t,r,n,i,s){if(!a.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");if(t>i||s>t)throw new RangeError("value is out of bounds");if(r+n>e.length)throw new RangeError("index out of range")}function O(e,t,r,n){0>t&&(t=65535+t+1);for(var i=0,a=Math.min(e.length-r,2);a>i;i++)e[r+i]=(t&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function j(e,t,r,n){0>t&&(t=4294967295+t+1);for(var i=0,a=Math.min(e.length-r,4);a>i;i++)e[r+i]=t>>>8*(n?i:3-i)&255}function L(e,t,r,n,i,a){if(t>i||a>t)throw new RangeError("value is out of bounds");if(r+n>e.length)throw new RangeError("index out of range");if(0>r)throw new RangeError("index out of range")}function N(e,t,r,n,i){return i||L(e,t,r,4,3.4028234663852886e38,-3.4028234663852886e38),z.write(e,t,r,n,23,4),r+4}function R(e,t,r,n,i){return i||L(e,t,r,8,1.7976931348623157e308,-1.7976931348623157e308),z.write(e,t,r,n,52,8),r+8}function V(e){if(e=U(e).replace(ee,""),e.length<2)return"";for(;e.length%4!==0;)e+="=";return e}function U(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function q(e){return 16>e?"0"+e.toString(16):e.toString(16)}function G(e,t){t=t||1/0;for(var r,n=e.length,i=null,a=[],s=0;n>s;s++){if(r=e.charCodeAt(s),r>55295&&57344>r){if(!i){if(r>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(56320>r){(t-=3)>-1&&a.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,128>r){if((t-=1)<0)break;a.push(r)}else if(2048>r){if((t-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(65536>r){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(1114112>r))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function H(e){for(var t=[],r=0;r<e.length;r++)t.push(255&e.charCodeAt(r));return t}function W(e,t){for(var r,n,i,a=[],s=0;s<e.length&&!((t-=2)<0);s++)r=e.charCodeAt(s),n=r>>8,i=r%256,a.push(i),a.push(n);return a}function X(e){return J.toByteArray(V(e))}function Y(e,t,r,n){for(var i=0;n>i&&!(i+r>=t.length||i>=e.length);i++)t[i+r]=e[i];return i}var J=e(2),z=e(6),K=e(5);r.Buffer=a,r.SlowBuffer=g,r.INSPECT_MAX_BYTES=50,a.poolSize=8192;var $={};a.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:n(),a.TYPED_ARRAY_SUPPORT?(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array):(a.prototype.length=void 0,a.prototype.parent=void 0),a.isBuffer=function(e){return!(null==e||!e._isBuffer)},a.compare=function(e,t){if(!a.isBuffer(e)||!a.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,i=0,s=Math.min(r,n);s>i&&e[i]===t[i];)++i;return i!==s&&(r=e[i],n=t[i]),n>r?-1:r>n?1:0},a.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}},a.concat=function(e,t){if(!K(e))throw new TypeError("list argument must be an Array of Buffers.");if(0===e.length)return new a(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;r++)t+=e[r].length;var n=new a(t),i=0;for(r=0;r<e.length;r++){var s=e[r];s.copy(n,i),i+=s.length}return n},a.byteLength=v,a.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?I(this,0,e):b.apply(this,arguments)},a.prototype.equals=function(e){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:0===a.compare(this,e)},a.prototype.inspect=function(){var e="",t=r.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),"<Buffer "+e+">"},a.prototype.compare=function(e){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?0:a.compare(this,e)},a.prototype.indexOf=function(e,t){function r(e,t,r){for(var n=-1,i=0;r+i<e.length;i++)if(e[r+i]===t[-1===n?0:i-n]){if(-1===n&&(n=i),i-n+1===t.length)return r+n}else n=-1;return-1}if(t>2147483647?t=2147483647:-2147483648>t&&(t=-2147483648),t>>=0,0===this.length)return-1;if(t>=this.length)return-1;if(0>t&&(t=Math.max(this.length+t,0)),"string"==typeof e)return 0===e.length?-1:String.prototype.indexOf.call(this,e,t);if(a.isBuffer(e))return r(this,e,t);if("number"==typeof e)return a.TYPED_ARRAY_SUPPORT&&"function"===Uint8Array.prototype.indexOf?Uint8Array.prototype.indexOf.call(this,e,t):r(this,[e],t);throw new TypeError("val must be string, number or Buffer")},a.prototype.get=function(e){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(e)},a.prototype.set=function(e,t){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(e,t)},a.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else if(isFinite(t))t=0|t,isFinite(r)?(r=0|r,void 0===n&&(n="utf8")):(n=r,r=void 0);else{var i=n;n=t,t=0|r,r=i}var a=this.length-t;if((void 0===r||r>a)&&(r=a),e.length>0&&(0>r||0>t)||t>this.length)throw new RangeError("attempt to write outside buffer bounds");n||(n="utf8");for(var s=!1;;)switch(n){case"hex":return E(this,e,t,r);case"utf8":case"utf-8":return x(this,e,t,r);case"ascii":return S(this,e,t,r);case"binary":return A(this,e,t,r);case"base64":return D(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,e,t,r);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Q=4096;a.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,0>e?(e+=r,0>e&&(e=0)):e>r&&(e=r),0>t?(t+=r,0>t&&(t=0)):t>r&&(t=r),e>t&&(t=e);var n;if(a.TYPED_ARRAY_SUPPORT)n=a._augment(this.subarray(e,t));else{var i=t-e;n=new a(i,void 0);for(var s=0;i>s;s++)n[s]=this[s+e]}return n.length&&(n.parent=this.parent||this),n},a.prototype.readUIntLE=function(e,t,r){e=0|e,t=0|t,r||T(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return n},a.prototype.readUIntBE=function(e,t,r){e=0|e,t=0|t,r||T(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},a.prototype.readUInt8=function(e,t){return t||T(e,1,this.length),this[e]},a.prototype.readUInt16LE=function(e,t){return t||T(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUInt16BE=function(e,t){return t||T(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUInt32LE=function(e,t){return t||T(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},a.prototype.readUInt32BE=function(e,t){return t||T(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readIntLE=function(e,t,r){e=0|e,t=0|t,r||T(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*t)),n},a.prototype.readIntBE=function(e,t,r){e=0|e,t=0|t,r||T(e,t,this.length);for(var n=t,i=1,a=this[e+--n];n>0&&(i*=256);)a+=this[e+--n]*i;return i*=128,a>=i&&(a-=Math.pow(2,8*t)),a},a.prototype.readInt8=function(e,t){return t||T(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},a.prototype.readInt16LE=function(e,t){t||T(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(e,t){t||T(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(e,t){return t||T(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return t||T(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readFloatLE=function(e,t){return t||T(e,4,this.length),z.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return t||T(e,4,this.length),z.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return t||T(e,8,this.length),z.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return t||T(e,8,this.length),z.read(this,e,!1,52,8)},a.prototype.writeUIntLE=function(e,t,r,n){e=+e,t=0|t,r=0|r,n||M(this,e,t,r,Math.pow(2,8*r),0);var i=1,a=0;for(this[t]=255&e;++a<r&&(i*=256);)this[t+a]=e/i&255;return t+r},a.prototype.writeUIntBE=function(e,t,r,n){e=+e,t=0|t,r=0|r,n||M(this,e,t,r,Math.pow(2,8*r),0);var i=r-1,a=1;for(this[t+i]=255&e;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+r},a.prototype.writeUInt8=function(e,t,r){return e=+e,t=0|t,r||M(this,e,t,1,255,0),a.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},a.prototype.writeUInt16LE=function(e,t,r){return e=+e,t=0|t,r||M(this,e,t,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):O(this,e,t,!0),t+2},a.prototype.writeUInt16BE=function(e,t,r){return e=+e,t=0|t,r||M(this,e,t,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):O(this,e,t,!1),t+2},a.prototype.writeUInt32LE=function(e,t,r){return e=+e,t=0|t,r||M(this,e,t,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):j(this,e,t,!0),t+4},a.prototype.writeUInt32BE=function(e,t,r){return e=+e,t=0|t,r||M(this,e,t,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):j(this,e,t,!1),t+4},a.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t=0|t,!n){var i=Math.pow(2,8*r-1);M(this,e,t,r,i-1,-i)}var a=0,s=1,o=0>e?1:0;for(this[t]=255&e;++a<r&&(s*=256);)this[t+a]=(e/s>>0)-o&255;return t+r},a.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t=0|t,!n){var i=Math.pow(2,8*r-1);M(this,e,t,r,i-1,-i)}var a=r-1,s=1,o=0>e?1:0;for(this[t+a]=255&e;--a>=0&&(s*=256);)this[t+a]=(e/s>>0)-o&255;return t+r},a.prototype.writeInt8=function(e,t,r){return e=+e,t=0|t,r||M(this,e,t,1,127,-128),a.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),0>e&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,r){return e=+e,t=0|t,r||M(this,e,t,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):O(this,e,t,!0),t+2},a.prototype.writeInt16BE=function(e,t,r){return e=+e,t=0|t,r||M(this,e,t,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):O(this,e,t,!1),t+2},a.prototype.writeInt32LE=function(e,t,r){return e=+e,t=0|t,r||M(this,e,t,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):j(this,e,t,!0),t+4},a.prototype.writeInt32BE=function(e,t,r){return e=+e,t=0|t,r||M(this,e,t,4,2147483647,-2147483648),0>e&&(e=4294967295+e+1),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):j(this,e,t,!1),t+4},a.prototype.writeFloatLE=function(e,t,r){return N(this,e,t,!0,r)},a.prototype.writeFloatBE=function(e,t,r){return N(this,e,t,!1,r)},a.prototype.writeDoubleLE=function(e,t,r){return R(this,e,t,!0,r)},a.prototype.writeDoubleBE=function(e,t,r){return R(this,e,t,!1,r)},a.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&r>n&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(0>t)throw new RangeError("targetStart out of bounds");if(0>r||r>=this.length)throw new RangeError("sourceStart out of bounds");if(0>n)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i,s=n-r;if(this===e&&t>r&&n>t)for(i=s-1;i>=0;i--)e[i+t]=this[i+r];else if(1e3>s||!a.TYPED_ARRAY_SUPPORT)for(i=0;s>i;i++)e[i+t]=this[i+r];else e._set(this.subarray(r,r+s),t);return s},a.prototype.fill=function(e,t,r){if(e||(e=0),t||(t=0),r||(r=this.length),t>r)throw new RangeError("end < start");if(r!==t&&0!==this.length){if(0>t||t>=this.length)throw new RangeError("start out of bounds");if(0>r||r>this.length)throw new RangeError("end out of bounds");var n;if("number"==typeof e)for(n=t;r>n;n++)this[n]=e;else{var i=G(e.toString()),a=i.length;for(n=t;r>n;n++)this[n]=i[n%a]}return this}},a.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(a.TYPED_ARRAY_SUPPORT)return new a(this).buffer;for(var e=new Uint8Array(this.length),t=0,r=e.length;r>t;t+=1)e[t]=this[t];return e.buffer}throw new TypeError("Buffer.toArrayBuffer not supported in this browser")};var Z=a.prototype;a._augment=function(e){return e.constructor=a,e._isBuffer=!0,e._set=e.set,e.get=Z.get,e.set=Z.set,e.write=Z.write,e.toString=Z.toString,e.toLocaleString=Z.toString,e.toJSON=Z.toJSON,e.equals=Z.equals,e.compare=Z.compare,e.indexOf=Z.indexOf,e.copy=Z.copy,e.slice=Z.slice,e.readUIntLE=Z.readUIntLE,e.readUIntBE=Z.readUIntBE,e.readUInt8=Z.readUInt8,e.readUInt16LE=Z.readUInt16LE,e.readUInt16BE=Z.readUInt16BE,e.readUInt32LE=Z.readUInt32LE,e.readUInt32BE=Z.readUInt32BE,e.readIntLE=Z.readIntLE,e.readIntBE=Z.readIntBE,e.readInt8=Z.readInt8,e.readInt16LE=Z.readInt16LE,e.readInt16BE=Z.readInt16BE,e.readInt32LE=Z.readInt32LE,e.readInt32BE=Z.readInt32BE,e.readFloatLE=Z.readFloatLE,e.readFloatBE=Z.readFloatBE,e.readDoubleLE=Z.readDoubleLE,e.readDoubleBE=Z.readDoubleBE,e.writeUInt8=Z.writeUInt8,e.writeUIntLE=Z.writeUIntLE,e.writeUIntBE=Z.writeUIntBE,e.writeUInt16LE=Z.writeUInt16LE,e.writeUInt16BE=Z.writeUInt16BE,e.writeUInt32LE=Z.writeUInt32LE,e.writeUInt32BE=Z.writeUInt32BE,e.writeIntLE=Z.writeIntLE,e.writeIntBE=Z.writeIntBE,e.writeInt8=Z.writeInt8,e.writeInt16LE=Z.writeInt16LE,e.writeInt16BE=Z.writeInt16BE,e.writeInt32LE=Z.writeInt32LE,e.writeInt32BE=Z.writeInt32BE,e.writeFloatLE=Z.writeFloatLE,e.writeFloatBE=Z.writeFloatBE,e.writeDoubleLE=Z.writeDoubleLE,e.writeDoubleBE=Z.writeDoubleBE,e.fill=Z.fill,e.inspect=Z.inspect,e.toArrayBuffer=Z.toArrayBuffer,e};var ee=/[^+\/0-9A-Za-z-_]/g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{2:2,5:5,6:6}],5:[function(e,t,r){var n={}.toString;t.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},{}],6:[function(e,t,r){r.read=function(e,t,r,n,i){var a,s,o=8*i-n-1,u=(1<<o)-1,p=u>>1,l=-7,c=r?i-1:0,f=r?-1:1,d=e[t+c];for(c+=f,a=d&(1<<-l)-1,d>>=-l,l+=o;l>0;a=256*a+e[t+c],c+=f,l-=8);for(s=a&(1<<-l)-1,a>>=-l,l+=n;l>0;s=256*s+e[t+c],c+=f,l-=8);if(0===a)a=1-p;else{if(a===u)return s?NaN:(d?-1:1)*(1/0);s+=Math.pow(2,n),a-=p}return(d?-1:1)*s*Math.pow(2,a-n)},r.write=function(e,t,r,n,i,a){var s,o,u,p=8*a-i-1,l=(1<<p)-1,c=l>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:a-1,h=n?1:-1,m=0>t||0===t&&0>1/t?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),t+=s+c>=1?f/u:f*Math.pow(2,1-c),t*u>=2&&(s++,u/=2),s+c>=l?(o=0,s=l):s+c>=1?(o=(t*u-1)*Math.pow(2,i),s+=c):(o=t*Math.pow(2,c-1)*Math.pow(2,i),s=0));i>=8;e[r+d]=255&o,d+=h,o/=256,i-=8);for(s=s<<i|o,p+=i;p>0;e[r+d]=255&s,d+=h,s/=256,p-=8);e[r+d-h]|=128*m}},{}],7:[function(e,t,r){"function"==typeof Object.create?t.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}},{}],8:[function(e,t,r){r.endianness=function(){return"LE"},r.hostname=function(){return"undefined"!=typeof location?location.hostname:""},r.loadavg=function(){return[]},r.uptime=function(){return 0},r.freemem=function(){return Number.MAX_VALUE},r.totalmem=function(){return Number.MAX_VALUE},r.cpus=function(){return[]},r.type=function(){return"Browser"},r.release=function(){return"undefined"!=typeof navigator?navigator.appVersion:""},r.networkInterfaces=r.getNetworkInterfaces=function(){return{}},r.arch=function(){return"javascript"},r.platform=function(){return"browser"},r.tmpdir=r.tmpDir=function(){return"/tmp"},r.EOL="\n"},{}],9:[function(e,t,r){(function(e){function t(e,t){for(var r=0,n=e.length-1;n>=0;n--){var i=e[n];"."===i?e.splice(n,1):".."===i?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r--;r)e.unshift("..");return e}function n(e,t){if(e.filter)return e.filter(t);for(var r=[],n=0;n<e.length;n++)t(e[n],n,e)&&r.push(e[n]);return r}var i=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,a=function(e){return i.exec(e).slice(1)};r.resolve=function(){for(var r="",i=!1,a=arguments.length-1;a>=-1&&!i;a--){var s=a>=0?arguments[a]:e.cwd();if("string"!=typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(r=s+"/"+r,i="/"===s.charAt(0))}return r=t(n(r.split("/"),function(e){return!!e}),!i).join("/"),(i?"/":"")+r||"."},r.normalize=function(e){var i=r.isAbsolute(e),a="/"===s(e,-1);return e=t(n(e.split("/"),function(e){return!!e}),!i).join("/"),e||i||(e="."),e&&a&&(e+="/"),(i?"/":"")+e},r.isAbsolute=function(e){return"/"===e.charAt(0)},r.join=function(){var e=Array.prototype.slice.call(arguments,0);return r.normalize(n(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},r.relative=function(e,t){function n(e){for(var t=0;t<e.length&&""===e[t];t++);for(var r=e.length-1;r>=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=r.resolve(e).substr(1),t=r.resolve(t).substr(1);for(var i=n(e.split("/")),a=n(t.split("/")),s=Math.min(i.length,a.length),o=s,u=0;s>u;u++)if(i[u]!==a[u]){o=u;break}for(var p=[],u=o;u<i.length;u++)p.push("..");return p=p.concat(a.slice(o)),p.join("/")},r.sep="/",r.delimiter=":",r.dirname=function(e){var t=a(e),r=t[0],n=t[1];return r||n?(n&&(n=n.substr(0,n.length-1)),r+n):"."},r.basename=function(e,t){var r=a(e)[2];return t&&r.substr(-1*t.length)===t&&(r=r.substr(0,r.length-t.length)),r},r.extname=function(e){return a(e)[3]};var s="b"==="ab".substr(-1)?function(e,t,r){return e.substr(t,r)}:function(e,t,r){return 0>t&&(t=e.length+t),e.substr(t,r)}}).call(this,e(10))},{10:10}],10:[function(e,t,r){function n(){l=!1,o.length?p=o.concat(p):c=-1,p.length&&i()}function i(){if(!l){var e=setTimeout(n);l=!0;for(var t=p.length;t;){for(o=p,p=[];++c<t;)o&&o[c].run();c=-1,t=p.length}o=null,l=!1,clearTimeout(e)}}function a(e,t){this.fun=e,this.array=t}function s(){}var o,u=t.exports={},p=[],l=!1,c=-1;u.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];p.push(new a(e,t)),1!==p.length||l||setTimeout(i,0)},a.prototype.run=function(){this.fun.apply(null,this.array)},u.title="browser",u.browser=!0,u.env={},u.argv=[],u.version="",u.versions={},u.on=s,u.addListener=s,u.once=s,u.off=s,u.removeListener=s,u.removeAllListeners=s,u.emit=s,u.binding=function(e){throw new Error("process.binding is not supported")},u.cwd=function(){return"/"},u.chdir=function(e){throw new Error("process.chdir is not supported")},u.umask=function(){return 0}},{}],11:[function(e,t,r){function n(){throw new Error("tty.ReadStream is not implemented")}function i(){throw new Error("tty.ReadStream is not implemented")}r.isatty=function(){return!1},r.ReadStream=n,r.WriteStream=i},{}],12:[function(e,t,r){t.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},{}],13:[function(e,t,r){(function(t,n){function i(e,t){var n={seen:[],stylize:s};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),m(t)?n.showHidden=t:t&&r._extend(n,t),x(n.showHidden)&&(n.showHidden=!1),x(n.depth)&&(n.depth=2),x(n.colors)&&(n.colors=!1),x(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=a),u(n,e,n.depth)}function a(e,t){var r=i.styles[t];return r?"["+i.colors[r][0]+"m"+e+"["+i.colors[r][1]+"m":e}function s(e,t){return e}function o(e){var t={};return e.forEach(function(e,r){t[e]=!0}),t}function u(e,t,n){if(e.customInspect&&t&&w(t.inspect)&&t.inspect!==r.inspect&&(!t.constructor||t.constructor.prototype!==t)){var i=t.inspect(n,e);return b(i)||(i=u(e,i,n)),i}var a=p(e,t);if(a)return a;var s=Object.keys(t),m=o(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(t)),C(t)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return l(t);if(0===s.length){if(w(t)){var y=t.name?": "+t.name:"";return e.stylize("[Function"+y+"]","special")}if(S(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(D(t))return e.stylize(Date.prototype.toString.call(t),"date");if(C(t))return l(t)}var g="",v=!1,E=["{","}"];if(h(t)&&(v=!0,E=["[","]"]),w(t)){var x=t.name?": "+t.name:"";g=" [Function"+x+"]"}if(S(t)&&(g=" "+RegExp.prototype.toString.call(t)),D(t)&&(g=" "+Date.prototype.toUTCString.call(t)),C(t)&&(g=" "+l(t)),0===s.length&&(!v||0==t.length))return E[0]+g+E[1];if(0>n)return S(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);var A;return A=v?c(e,t,n,m,s):s.map(function(r){return f(e,t,n,m,r,v)}),e.seen.pop(),d(A,g,E)}function p(e,t){if(x(t))return e.stylize("undefined","undefined");if(b(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}return v(t)?e.stylize(""+t,"number"):m(t)?e.stylize(""+t,"boolean"):y(t)?e.stylize("null","null"):void 0}function l(e){return"["+Error.prototype.toString.call(e)+"]"}function c(e,t,r,n,i){for(var a=[],s=0,o=t.length;o>s;++s)P(t,String(s))?a.push(f(e,t,r,n,String(s),!0)):a.push("");return i.forEach(function(i){i.match(/^\d+$/)||a.push(f(e,t,r,n,i,!0))}),a}function f(e,t,r,n,i,a){var s,o,p;if(p=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]},p.get?o=p.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):p.set&&(o=e.stylize("[Setter]","special")),P(n,i)||(s="["+i+"]"),o||(e.seen.indexOf(p.value)<0?(o=y(r)?u(e,p.value,null):u(e,p.value,r-1),o.indexOf("\n")>-1&&(o=a?o.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+o.split("\n").map(function(e){return" "+e}).join("\n"))):o=e.stylize("[Circular]","special")),x(s)){
if(a&&i.match(/^\d+$/))return o;s=JSON.stringify(""+i),s.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+o}function d(e,t,r){var n=0,i=e.reduce(function(e,t){return n++,t.indexOf("\n")>=0&&n++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1]:r[0]+t+" "+e.join(", ")+" "+r[1]}function h(e){return Array.isArray(e)}function m(e){return"boolean"==typeof e}function y(e){return null===e}function g(e){return null==e}function v(e){return"number"==typeof e}function b(e){return"string"==typeof e}function E(e){return"symbol"==typeof e}function x(e){return void 0===e}function S(e){return A(e)&&"[object RegExp]"===_(e)}function A(e){return"object"==typeof e&&null!==e}function D(e){return A(e)&&"[object Date]"===_(e)}function C(e){return A(e)&&("[object Error]"===_(e)||e instanceof Error)}function w(e){return"function"==typeof e}function I(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function _(e){return Object.prototype.toString.call(e)}function F(e){return 10>e?"0"+e.toString(10):e.toString(10)}function k(){var e=new Date,t=[F(e.getHours()),F(e.getMinutes()),F(e.getSeconds())].join(":");return[e.getDate(),O[e.getMonth()],t].join(" ")}function P(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var B=/%[sdj%]/g;r.format=function(e){if(!b(e)){for(var t=[],r=0;r<arguments.length;r++)t.push(i(arguments[r]));return t.join(" ")}for(var r=1,n=arguments,a=n.length,s=String(e).replace(B,function(e){if("%%"===e)return"%";if(r>=a)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(t){return"[Circular]"}default:return e}}),o=n[r];a>r;o=n[++r])s+=y(o)||!A(o)?" "+o:" "+i(o);return s},r.deprecate=function(e,i){function a(){if(!s){if(t.throwDeprecation)throw new Error(i);t.traceDeprecation?console.trace(i):console.error(i),s=!0}return e.apply(this,arguments)}if(x(n.process))return function(){return r.deprecate(e,i).apply(this,arguments)};if(t.noDeprecation===!0)return e;var s=!1;return a};var T,M={};r.debuglog=function(e){if(x(T)&&(T=t.env.NODE_DEBUG||""),e=e.toUpperCase(),!M[e])if(new RegExp("\\b"+e+"\\b","i").test(T)){var n=t.pid;M[e]=function(){var t=r.format.apply(r,arguments);console.error("%s %d: %s",e,n,t)}}else M[e]=function(){};return M[e]},r.inspect=i,i.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]},i.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},r.isArray=h,r.isBoolean=m,r.isNull=y,r.isNullOrUndefined=g,r.isNumber=v,r.isString=b,r.isSymbol=E,r.isUndefined=x,r.isRegExp=S,r.isObject=A,r.isDate=D,r.isError=C,r.isFunction=w,r.isPrimitive=I,r.isBuffer=e(12);var O=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];r.log=function(){console.log("%s - %s",k(),r.format.apply(r,arguments))},r.inherits=e(7),r._extend=function(e,t){if(!t||!A(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e}}).call(this,e(10),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{10:10,12:12,7:7}],14:[function(e,t,r){(function(r){"use strict";e(15);var n=t.exports=e(66);n.options=e(49),n.version=e(611).version,n.transform=n,n.run=function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return t.sourceMaps="inline",new Function(n(e,t).code)()},n.load=function(e,t,i,a){void 0===i&&(i={}),i.filename=i.filename||e;var s=r.ActiveXObject?new r.ActiveXObject("Microsoft.XMLHTTP"):new r.XMLHttpRequest;s.open("GET",e,!0),"overrideMimeType"in s&&s.overrideMimeType("text/plain"),s.onreadystatechange=function(){if(4===s.readyState){var r=s.status;if(0!==r&&200!==r)throw new Error("Could not load "+e);var o=[s.responseText,i];a||n.run.apply(n,o),t&&t(o)}},s.send(null)};var i=function(){for(var e=[],t=["text/ecmascript-6","text/6to5","text/babel","module"],i=0,a=function l(){var t=e[i];t instanceof Array&&(n.run.apply(n,t),i++,l())},s=function(t,r){var i={};t.src?n.load(t.src,function(t){e[r]=t,a()},i,!0):(i.filename="embedded",e[r]=[t.innerHTML,i])},o=r.document.getElementsByTagName("script"),u=0;u<o.length;++u){var p=o[u];t.indexOf(p.type)>=0&&e.push(p)}for(u in e)s(e[u],u);a()};r.addEventListener?r.addEventListener("DOMContentLoaded",i,!1):r.attachEvent&&r.attachEvent("onload",i)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{15:15,49:49,611:611,66:66}],15:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e["default"]:e}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function a(e){return e&&e.__esModule?e:{"default":e}}function s(t){var r=e(17);return null!=t&&r(t),r}function o(){e(44)}function u(e,t,r){f["default"](t)&&(r=t,t={}),t.filename=e,E["default"].readFile(e,function(e,n){if(e)return r(e);var i;try{i=h["default"](n,t)}catch(e){return r(e)}r(null,i)})}function p(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return t.filename=e,h["default"](E["default"].readFileSync(e,"utf8"),t)}function l(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];t.allowHashBang=!0,t.sourceType="module",t.ecmaVersion=1/0,t.plugins={jsx:!0,flow:!0},t.features={};for(var r in h["default"].pipeline.transformers)t.features[r]=!0;var n=y.parse(e,t);if(t.onToken){var i;(i=t.onToken).push.apply(i,n.tokens)}if(t.onComment){var a;(a=t.onComment).push.apply(a,n.comments)}return n.program}r.__esModule=!0,r.register=s,r.polyfill=o,r.transformFile=u,r.transformFileSync=p,r.parse=l;var c=e(508),f=a(c),d=e(66),h=a(d),m=e(613),y=i(m),g=e(182),v=i(g),b=e(3),E=a(b),x=e(179),S=i(x);r.util=v,r.acorn=y,r.transform=h["default"],r.pipeline=d.pipeline,r.canCompile=g.canCompile;var A=e(46);r.File=n(A);var D=e(48);r.options=n(D);var C=e(82);r.Plugin=n(C);var w=e(83);r.Transformer=n(w);var I=e(80);r.Pipeline=n(I);var _=e(148);r.traverse=n(_);var F=e(45);r.buildExternalHelpers=n(F);var k=e(611);r.version=k.version,r.types=S},{148:148,17:17,179:179,182:182,3:3,44:44,45:45,46:46,48:48,508:508,611:611,613:613,66:66,80:80,82:82,83:83}],16:[function(e,t,r){"use strict";r.__esModule=!0,e(44),r["default"]=function(){},t.exports=r["default"]},{44:44}],17:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e["default"]:e}r.__esModule=!0,e(44);var i=e(16);r["default"]=n(i),t.exports=r["default"]},{16:16,44:44}],18:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var a=e(592),s=n(a),o=e(609),u=n(o),p=e(506),l=n(p),c=e(421),f=n(c),d=e(510),h=n(d),m=function(){function e(t,r){i(this,e),this.parenPushNewlineState=null,this.position=t,this._indent=r.indent.base,this.format=r,this.buf=""}return e.prototype.get=function(){return u["default"](this.buf)},e.prototype.getIndent=function(){return this.format.compact||this.format.concise?"":s["default"](this.format.indent.style,this._indent)},e.prototype.indentSize=function(){return this.getIndent().length},e.prototype.indent=function(){this._indent++},e.prototype.dedent=function(){this._indent--},e.prototype.semicolon=function(){this.push(";")},e.prototype.ensureSemicolon=function(){this.isLast(";")||this.semicolon()},e.prototype.rightBrace=function(){this.newline(!0),this.push("}")},e.prototype.keyword=function(e){this.push(e),this.space()},e.prototype.space=function(e){(e||!this.format.compact)&&(e||this.buf&&!this.isLast(" ")&&!this.isLast("\n"))&&this.push(" ")},e.prototype.removeLast=function(e){return this.format.compact?void 0:this._removeLast(e)},e.prototype._removeLast=function(e){this._isLast(e)&&(this.buf=this.buf.substr(0,this.buf.length-1),this.position.unshift(e))},e.prototype.startTerminatorless=function(){return this.parenPushNewlineState={printed:!1}},e.prototype.endTerminatorless=function(e){e.printed&&(this.dedent(),this.newline(),this.push(")"))},e.prototype.newline=function(e,t){if(!this.format.compact&&!this.format.retainLines){if(this.format.concise)return void this.space();if(t=t||!1,h["default"](e)){if(e=Math.min(2,e),(this.endsWith("{\n")||this.endsWith(":\n"))&&e--,0>=e)return;for(;e>0;)this._newline(t),e--}else l["default"](e)&&(t=e),this._newline(t)}},e.prototype._newline=function(e){this.endsWith("\n\n")||(e&&this.isLast("\n")&&this.removeLast("\n"),this.removeLast(" "),this._removeSpacesAfterLastNewline(),this._push("\n"))},e.prototype._removeSpacesAfterLastNewline=function(){var e=this.buf.lastIndexOf("\n");if(-1!==e){for(var t=this.buf.length-1;t>e&&" "===this.buf[t];)t--;t===e&&(this.buf=this.buf.substring(0,t+1))}},e.prototype.push=function(e,t){if(!this.format.compact&&this._indent&&!t&&"\n"!==e){var r=this.getIndent();e=e.replace(/\n/g,"\n"+r),this.isLast("\n")&&this._push(r)}this._push(e)},e.prototype._push=function(e){var t=this.parenPushNewlineState;if(t)for(var r=0;r<e.length;r++){var n=e[r];if(" "!==n){this.parenPushNewlineState=null,("\n"===n||"/"===n)&&(this._push("("),this.indent(),t.printed=!0);break}}this.position.push(e),this.buf+=e},e.prototype.endsWith=function(e){var t=arguments.length<=1||void 0===arguments[1]?this.buf:arguments[1];return 1===e.length?t[t.length-1]===e:t.slice(-e.length)===e},e.prototype.isLast=function(e){return this.format.compact?!1:this._isLast(e)},e.prototype._isLast=function(e){var t=this.buf,r=t[t.length-1];return Array.isArray(e)?f["default"](e,r):e===r},e}();r["default"]=m,t.exports=r["default"]},{421:421,506:506,510:510,592:592,609:609}],19:[function(e,t,r){"use strict";function n(e,t){t.plain(e.program)}function i(e,t){t.sequence(e.body)}function a(e,t){this.push("{"),e.body.length?(this.newline(),t.sequence(e.body,{indent:!0}),this.format.retainLines||this.removeLast("\n"),this.rightBrace()):(t.printInnerComments(),this.push("}"))}function s(){}r.__esModule=!0,r.File=n,r.Program=i,r.BlockStatement=a,r.Noop=s},{}],20:[function(e,t,r){"use strict";function n(e,t){t.list(e.decorators,{separator:""}),this.push("class"),e.id&&(this.push(" "),t.plain(e.id)),t.plain(e.typeParameters),e.superClass&&(this.push(" extends "),t.plain(e.superClass),t.plain(e.superTypeParameters)),e["implements"]&&(this.push(" implements "),t.join(e["implements"],{separator:", "})),this.space(),t.plain(e.body)}function i(e,t){this.push("{"),0===e.body.length?(t.printInnerComments(),this.push("}")):(this.newline(),this.indent(),t.sequence(e.body),this.dedent(),this.rightBrace())}function a(e,t){t.list(e.decorators,{separator:""}),e["static"]&&this.push("static "),t.plain(e.key),t.plain(e.typeAnnotation),e.value&&(this.space(),this.push("="),this.space(),t.plain(e.value)),this.semicolon()}function s(e,t){t.list(e.decorators,{separator:""}),e["static"]&&this.push("static "),this._method(e,t)}r.__esModule=!0,r.ClassDeclaration=n,r.ClassBody=i,r.ClassProperty=a,r.MethodDefinition=s,r.ClassExpression=n},{}],21:[function(e,t,r){"use strict";function n(e,t){this.keyword("for"),this.push("("),t.plain(e.left),this.push(" of "),t.plain(e.right),this.push(")")}function i(e,t){this.push(e.generator?"(":"["),t.join(e.blocks,{separator:" "}),this.space(),e.filter&&(this.keyword("if"),this.push("("),t.plain(e.filter),this.push(")"),this.space()),t.plain(e.body),this.push(e.generator?")":"]")}r.__esModule=!0,r.ComprehensionBlock=n,r.ComprehensionExpression=i},{}],22:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){var r=/[a-z]$/.test(e.operator),n=e.argument;(k.isUpdateExpression(n)||k.isUnaryExpression(n))&&(r=!0),k.isUnaryExpression(n)&&"!"===n.operator&&(r=!1),this.push(e.operator),r&&this.push(" "),t.plain(e.argument)}function s(e,t){this.push("do"),this.space(),t.plain(e.body)}function o(e,t){this.push("("),t.plain(e.expression),this.push(")")}function u(e,t){e.prefix?(this.push(e.operator),t.plain(e.argument)):(t.plain(e.argument),this.push(e.operator))}function p(e,t){t.plain(e.test),this.space(),this.push("?"),this.space(),t.plain(e.consequent),this.space(),this.push(":"),this.space(),t.plain(e.alternate)}function l(e,t){this.push("new "),t.plain(e.callee),this.push("("),t.list(e.arguments),this.push(")")}function c(e,t){t.list(e.expressions)}function f(){this.push("this")}function d(){this.push("super")}function h(e,t){this.push("@"),t.plain(e.expression),this.newline()}function m(e,t){t.plain(e.callee),this.push("(");var r,n=e._prettyCall&&!this.format.retainLines&&!this.format.compact;n&&(r=",\n",this.newline(),this.indent()),t.list(e.arguments,{separator:r}),n&&(this.newline(),this.dedent()),this.push(")")}function y(){this.semicolon()}function g(e,t){t.plain(e.expression),this.semicolon()}function v(e,t){t.plain(e.left),this.push(" = "),t.plain(e.right)}function b(e,t,r){var n=this._inForStatementInit&&"in"===e.operator&&!_["default"].needsParens(e,r);n&&this.push("("),t.plain(e.left);var i="in"===e.operator||"instanceof"===e.operator;i=!0,this.space(i),this.push(e.operator),i||(i="<"===e.operator&&k.isUnaryExpression(e.right,{prefix:!0,operator:"!"})&&k.isUnaryExpression(e.right.argument,{prefix:!0,operator:"--"})),this.space(i),t.plain(e.right),n&&this.push(")")}function E(e,t){t.plain(e.object),this.push("::"),t.plain(e.callee)}function x(e,t){var r=e.object;if(t.plain(r),!e.computed&&k.isMemberExpression(e.property))throw new TypeError("Got a MemberExpression for MemberExpression property");var n=e.computed;if(k.isLiteral(e.property)&&w["default"](e.property.value)&&(n=!0),n)this.push("["),t.plain(e.property),this.push("]");else{if(k.isLiteral(e.object)){var i=this._Literal(e.object);!D["default"](+i)||B.test(i)||P.test(i)||this.endsWith(".")||T.test(i)||this.push(".")}this.push("."),t.plain(e.property)}}function S(e,t){t.plain(e.meta),this.push("."),t.plain(e.property)}r.__esModule=!0,r.UnaryExpression=a,r.DoExpression=s,r.ParenthesizedExpression=o,r.UpdateExpression=u,r.ConditionalExpression=p,r.NewExpression=l,r.SequenceExpression=c,r.ThisExpression=f,r.Super=d,r.Decorator=h,r.CallExpression=m,r.EmptyStatement=y,r.ExpressionStatement=g,r.AssignmentPattern=v,r.AssignmentExpression=b,r.BindExpression=E,r.MemberExpression=x,r.MetaProperty=S;var A=e(406),D=i(A),C=e(510),w=i(C),I=e(31),_=i(I),F=e(179),k=n(F),P=/e/i,B=/\.0+$/,T=/^0(b|o|x)/i,M=function(e){return function(t,r){if(this.push(e),(t.delegate||t.all)&&this.push("*"),t.argument){this.push(" ");var n=this.startTerminatorless();r.plain(t.argument),this.endTerminatorless(n)}}},O=M("yield");r.YieldExpression=O;var j=M("await");r.AwaitExpression=j,r.BinaryExpression=b,r.LogicalExpression=b},{179:179,31:31,406:406,510:510}],23:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(){this.push("any")}function a(e,t){t.plain(e.elementType),this.push("["),this.push("]")}function s(){this.push("bool")}function o(e){this.push(e.value?"true":"false")}function u(e,t){this.push("declare class "),this._interfaceish(e,t)}function p(e,t){this.push("declare function "),t.plain(e.id),t.plain(e.id.typeAnnotation.typeAnnotation),this.semicolon()}function l(e,t){this.push("declare "),this.InterfaceDeclaration(e,t)}function c(e,t){this.push("declare module "),t.plain(e.id),this.space(),t.plain(e.body)}function f(e,t){this.push("declare "),this.TypeAlias(e,t)}function d(e,t){this.push("declare var "),t.plain(e.id),t.plain(e.id.typeAnnotation),this.semicolon()}function h(e,t,r){t.plain(e.typeParameters),this.push("("),t.list(e.params),e.rest&&(e.params.length&&(this.push(","),this.space()),this.push("..."),t.plain(e.rest)),this.push(")"),"ObjectTypeProperty"===r.type||"ObjectTypeCallProperty"===r.type||"DeclareFunction"===r.type?this.push(":"):(this.space(),this.push("=>")),this.space(),t.plain(e.returnType)}function m(e,t){t.plain(e.name),e.optional&&this.push("?"),this.push(":"),this.space(),t.plain(e.typeAnnotation)}function y(e,t){t.plain(e.id),t.plain(e.typeParameters)}function g(e,t){t.plain(e.id),t.plain(e.typeParameters),e["extends"].length&&(this.push(" extends "),t.join(e["extends"],{separator:", "})),e.mixins&&e.mixins.length&&(this.push(" mixins "),t.join(e.mixins,{separator:", "})),this.space(),t.plain(e.body)}function v(e,t){this.push("interface "),this._interfaceish(e,t)}function b(e,t){t.join(e.types,{separator:" & "})}function E(){this.push("mixed")}function x(e,t){this.push("?"),t.plain(e.typeAnnotation)}function S(){this.push("null")}function A(){this.push("number")}function D(e){this.push(this._stringLiteral(e.value))}function C(){this.push("string")}function w(){this.push("this")}function I(e,t){this.push("["),t.join(e.types,{separator:", "}),this.push("]")}function _(e,t){this.push("typeof "),t.plain(e.argument)}function F(e,t){this.push("type "),t.plain(e.id),t.plain(e.typeParameters),this.space(),this.push("="),this.space(),t.plain(e.right),this.semicolon()}function k(e,t){this.push(":"),this.space(),e.optional&&this.push("?"),t.plain(e.typeAnnotation)}function P(e,t){this.push("<"),t.join(e.params,{separator:", ",iterator:function(e){t.plain(e.typeAnnotation)}}),this.push(">")}function B(e,t){var r=this;this.push("{");var n=e.properties.concat(e.callProperties,e.indexers);n.length&&(this.space(),t.list(n,{separator:!1,indent:!0,iterator:function(){1!==n.length&&(r.semicolon(),r.space())}}),this.space()),this.push("}")}function T(e,t){e["static"]&&this.push("static "),t.plain(e.value)}function M(e,t){e["static"]&&this.push("static "),this.push("["),t.plain(e.id),this.push(":"),this.space(),t.plain(e.key),this.push("]"),this.push(":"),this.space(),t.plain(e.value)}function O(e,t){e["static"]&&this.push("static "),t.plain(e.key),e.optional&&this.push("?"),U.isFunctionTypeAnnotation(e.value)||(this.push(":"),this.space()),t.plain(e.value)}function j(e,t){t.plain(e.qualification),this.push("."),t.plain(e.id)}function L(e,t){t.join(e.types,{separator:" | "})}function N(e,t){this.push("("),t.plain(e.expression),t.plain(e.typeAnnotation),this.push(")")}function R(){this.push("void")}r.__esModule=!0,r.AnyTypeAnnotation=i,r.ArrayTypeAnnotation=a,r.BooleanTypeAnnotation=s,r.BooleanLiteralTypeAnnotation=o,r.DeclareClass=u,r.DeclareFunction=p,r.DeclareInterface=l,r.DeclareModule=c,r.DeclareTypeAlias=f,r.DeclareVariable=d,r.FunctionTypeAnnotation=h,r.FunctionTypeParam=m,r.InterfaceExtends=y,r._interfaceish=g,r.InterfaceDeclaration=v,r.IntersectionTypeAnnotation=b,r.MixedTypeAnnotation=E,r.NullableTypeAnnotation=x,r.NullLiteralTypeAnnotation=S,r.NumberTypeAnnotation=A,r.StringLiteralTypeAnnotation=D,r.StringTypeAnnotation=C,r.ThisTypeAnnotation=w,r.TupleTypeAnnotation=I,r.TypeofTypeAnnotation=_,r.TypeAlias=F,r.TypeAnnotation=k,r.TypeParameterInstantiation=P,r.ObjectTypeAnnotation=B,r.ObjectTypeCallProperty=T,r.ObjectTypeIndexer=M,r.ObjectTypeProperty=O,r.QualifiedTypeIdentifier=j,r.UnionTypeAnnotation=L,r.TypeCastExpression=N,r.VoidTypeAnnotation=R;var V=e(179),U=n(V);r.ClassImplements=y,r.GenericTypeAnnotation=y;var q=e(29);r.NumberLiteralTypeAnnotation=q.Literal,r.TypeParameterDeclaration=P},{179:179,29:29}],24:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){t.plain(e.name),e.value&&(this.push("="),t.plain(e.value))}function a(e){this.push(e.name)}function s(e,t){t.plain(e.namespace),this.push(":"),t.plain(e.name)}function o(e,t){t.plain(e.object),this.push("."),t.plain(e.property)}function u(e,t){this.push("{..."),t.plain(e.argument),this.push("}")}function p(e,t){this.push("{"),t.plain(e.expression),this.push("}")}function l(e,t){var r=e.openingElement;if(t.plain(r),!r.selfClosing){this.indent();for(var n=e.children,i=0;i<n.length;i++){var a=n[i];m.isLiteral(a)?this.push(a.value,!0):t.plain(a)}this.dedent(),t.plain(e.closingElement)}}function c(e,t){this.push("<"),t.plain(e.name),e.attributes.length>0&&(this.push(" "),t.join(e.attributes,{separator:" "})),this.push(e.selfClosing?" />":">")}function f(e,t){this.push("</"),t.plain(e.name),this.push(">")}function d(){}r.__esModule=!0,r.JSXAttribute=i,r.JSXIdentifier=a,r.JSXNamespacedName=s,r.JSXMemberExpression=o,r.JSXSpreadAttribute=u,r.JSXExpressionContainer=p,r.JSXElement=l,r.JSXOpeningElement=c,r.JSXClosingElement=f,r.JSXEmptyExpression=d;var h=e(179),m=n(h)},{179:179}],25:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){var r=this;t.plain(e.typeParameters),this.push("("),t.list(e.params,{iterator:function(e){e.optional&&r.push("?"),t.plain(e.typeAnnotation)}}),this.push(")"),e.returnType&&t.plain(e.returnType)}function a(e,t){var r=e.value,n=e.kind,i=e.key;("method"===n||"init"===n)&&r.generator&&this.push("*"),("get"===n||"set"===n)&&this.push(n+" "),r.async&&this.push("async "),e.computed?(this.push("["),t.plain(i),this.push("]")):t.plain(i),this._params(r,t),this.space(),t.plain(r.body)}function s(e,t){e.async&&this.push("async "),this.push("function"),e.generator&&this.push("*"),e.id?(this.push(" "),t.plain(e.id)):this.space(),this._params(e,t),this.space(),t.plain(e.body)}function o(e,t){e.async&&this.push("async "),1===e.params.length&&p.isIdentifier(e.params[0])?t.plain(e.params[0]):this._params(e,t),this.push(" => ");var r=p.isObjectExpression(e.body);r&&this.push("("),t.plain(e.body),r&&this.push(")")}r.__esModule=!0,r._params=i,r._method=a,r.FunctionExpression=s,r.ArrowFunctionExpression=o;var u=e(179),p=n(u);r.FunctionDeclaration=s},{179:179}],26:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){t.plain(e.imported),e.local&&e.local.name!==e.imported.name&&(this.push(" as "),t.plain(e.local))}function a(e,t){t.plain(e.local)}function s(e,t){t.plain(e.exported)}function o(e,t){t.plain(e.local),e.exported&&e.local.name!==e.exported.name&&(this.push(" as "),t.plain(e.exported))}function u(e,t){this.push("* as "),t.plain(e.exported)}function p(e,t){this.push("export *"),e.exported&&(this.push(" as "),t.plain(e.exported)),this.push(" from "),t.plain(e.source),this.semicolon()}function l(e,t){this.push("export "),f.call(this,e,t)}function c(e,t){this.push("export default "),f.call(this,e,t)}function f(e,t){var r=e.specifiers;if(e.declaration){var n=e.declaration;if(t.plain(n),y.isStatement(n)||y.isFunction(n)||y.isClass(n))return}else{"type"===e.exportKind&&this.push("type ");var i=r[0],a=!1;(y.isExportDefaultSpecifier(i)||y.isExportNamespaceSpecifier(i))&&(a=!0,t.plain(r.shift()),r.length&&this.push(", ")),(r.length||!r.length&&!a)&&(this.push("{"),r.length&&(this.space(),t.join(r,{separator:", "}),this.space()),this.push("}")),e.source&&(this.push(" from "),t.plain(e.source))}this.ensureSemicolon()}function d(e,t){this.push("import "),("type"===e.importKind||"typeof"===e.importKind)&&this.push(e.importKind+" ");var r=e.specifiers;if(r&&r.length){var n=e.specifiers[0];(y.isImportDefaultSpecifier(n)||y.isImportNamespaceSpecifier(n))&&(t.plain(e.specifiers.shift()),e.specifiers.length&&this.push(", ")),e.specifiers.length&&(this.push("{"),this.space(),t.join(e.specifiers,{separator:", "}),this.space(),this.push("}")),this.push(" from ")}t.plain(e.source),this.semicolon()}function h(e,t){this.push("* as "),t.plain(e.local)}r.__esModule=!0,r.ImportSpecifier=i,r.ImportDefaultSpecifier=a,r.ExportDefaultSpecifier=s,r.ExportSpecifier=o,r.ExportNamespaceSpecifier=u,r.ExportAllDeclaration=p,r.ExportNamedDeclaration=l,r.ExportDefaultDeclaration=c,r.ImportDeclaration=d,r.ImportNamespaceSpecifier=h;var m=e(179),y=n(m)},{179:179}],27:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){this.keyword("with"),this.push("("),t.plain(e.object),this.push(")"),t.block(e.body)}function s(e,t){this.keyword("if"),this.push("("),t.plain(e.test),this.push(")"),this.space(),t.indentOnComments(e.consequent),e.alternate&&(this.isLast("}")&&this.space(),this.push("else "),t.indentOnComments(e.alternate))}function o(e,t){this.keyword("for"),this.push("("),this._inForStatementInit=!0,t.plain(e.init),this._inForStatementInit=!1,this.push(";"),e.test&&(this.space(),t.plain(e.test)),this.push(";"),e.update&&(this.space(),t.plain(e.update)),this.push(")"),t.block(e.body)}function u(e,t){this.keyword("while"),this.push("("),t.plain(e.test),this.push(")"),t.block(e.body)}function p(e,t){this.push("do "),t.plain(e.body),this.space(),this.keyword("while"),this.push("("),t.plain(e.test),this.push(");")}function l(e,t){t.plain(e.label),this.push(": "),t.plain(e.body)}function c(e,t){this.keyword("try"),t.plain(e.block),this.space(),e.handlers?t.plain(e.handlers[0]):t.plain(e.handler),e.finalizer&&(this.space(),this.push("finally "),t.plain(e.finalizer))}function f(e,t){this.keyword("catch"),this.push("("),t.plain(e.param),this.push(") "),t.plain(e.body)}function d(e,t){this.keyword("switch"),this.push("("),t.plain(e.discriminant),this.push(")"),this.space(),this.push("{"),t.sequence(e.cases,{indent:!0,addNewlines:function(t,r){return t||e.cases[e.cases.length-1]!==r?void 0:-1}}),this.push("}")}function h(e,t){e.test?(this.push("case "),t.plain(e.test),this.push(":")):this.push("default:"),e.consequent.length&&(this.newline(),t.sequence(e.consequent,{indent:!0}))}function m(){this.push("debugger;")}function y(e,t,r){this.push(e.kind+" ");var n=!1;if(!x.isFor(r))for(var i=e.declarations,a=0;a<i.length;a++){var s=i[a];s.init&&(n=!0)}var o;this.format.compact||this.format.concise||!n||this.format.retainLines||(o=",\n"+b["default"](" ",e.kind.length+1)),t.list(e.declarations,{separator:o}),(!x.isFor(r)||r.left!==e&&r.init!==e)&&this.semicolon()}function g(e,t){t.plain(e.id),t.plain(e.id.typeAnnotation),e.init&&(this.space(),this.push("="),this.space(),t.plain(e.init))}r.__esModule=!0,r.WithStatement=a,r.IfStatement=s,r.ForStatement=o,r.WhileStatement=u,r.DoWhileStatement=p,r.LabeledStatement=l,r.TryStatement=c,r.CatchClause=f,r.SwitchStatement=d,r.SwitchCase=h,r.DebuggerStatement=m,r.VariableDeclaration=y,r.VariableDeclarator=g;var v=e(592),b=i(v),E=e(179),x=n(E),S=function(e){return function(t,r){this.keyword("for"),this.push("("),r.plain(t.left),this.push(" "+e+" "),r.plain(t.right),this.push(")"),r.block(t.body)}},A=S("in");r.ForInStatement=A;var D=S("of");r.ForOfStatement=D;var C=function(e){var t=arguments.length<=1||void 0===arguments[1]?"label":arguments[1];return function(r,n){this.push(e);var i=r[t];if(i){this.push(" ");var a=this.startTerminatorless();n.plain(i),this.endTerminatorless(a)}this.semicolon()}},w=C("continue");r.ContinueStatement=w;var I=C("return","argument");r.ReturnStatement=I;var _=C("break");r.BreakStatement=_;var F=C("throw","argument");r.ThrowStatement=F},{179:179,592:592}],28:[function(e,t,r){"use strict";function n(e,t){t.plain(e.tag),t.plain(e.quasi)}function i(e){this._push(e.value.raw)}function a(e,t){this.push("`");for(var r=e.quasis,n=r.length,i=0;n>i;i++)t.plain(r[i]),n>i+1&&(this.push("${ "),t.plain(e.expressions[i]),this.push(" }"));this._push("`")}r.__esModule=!0,r.TaggedTemplateExpression=n,r.TemplateElement=i,r.TemplateLiteral=a},{}],29:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){this.push(e.name)}function a(e,t){this.push("..."),t.plain(e.argument)}function s(e,t){var r=e.properties;this.push("{"),t.printInnerComments(),r.length&&(this.space(),t.list(r,{indent:!0}),this.space()),this.push("}")}function o(e,t){if(t.list(e.decorators,{separator:""}),e.method||"get"===e.kind||"set"===e.kind)this._method(e,t);else{if(e.computed)this.push("["),t.plain(e.key),this.push("]");else{if(d.isAssignmentPattern(e.value)&&d.isIdentifier(e.key)&&e.key.name===e.value.left.name)return void t.plain(e.value);if(t.plain(e.key),e.shorthand&&d.isIdentifier(e.key)&&d.isIdentifier(e.value)&&e.key.name===e.value.name)return}this.push(":"),this.space(),t.plain(e.value)}}function u(e,t){var r=e.elements,n=r.length;this.push("["),t.printInnerComments();for(var i=0;i<r.length;i++){var a=r[i];a?(i>0&&this.space(),t.plain(a),n-1>i&&this.push(",")):this.push(",")}this.push("]")}function p(e){this.push(""),this._push(this._Literal(e))}function l(e){var t=e.value;if(e.regex)return"/"+e.regex.pattern+"/"+e.regex.flags;if(null!=e.raw&&null!=e.rawValue&&t===e.rawValue)return e.raw;switch(typeof t){case"string":return this._stringLiteral(t);case"number":return t+"";case"boolean":return t?"true":"false";default:if(null===t)return"null";throw new Error("Invalid Literal type")}}function c(e){return e=JSON.stringify(e),e=e.replace(/[\u000A\u000D\u2028\u2029]/g,function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)}),"single"===this.format.quotes&&(e=e.slice(1,-1),e=e.replace(/\\"/g,'"'),e=e.replace(/'/g,"\\'"),e="'"+e+"'"),e}r.__esModule=!0,r.Identifier=i,r.RestElement=a,r.ObjectExpression=s,r.Property=o,r.ArrayExpression=u,r.Literal=p,r._Literal=l,r._stringLiteral=c;var f=e(179),d=n(f);r.SpreadElement=a,r.SpreadProperty=a,r.ObjectPattern=s,r.ArrayPattern=u},{179:179}],30:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var s=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=e(399),u=i(o),p=e(37),l=i(p),c=e(33),f=i(c),d=e(592),h=i(d),m=e(36),y=i(m),g=e(35),v=i(g),b=e(43),E=n(b),x=e(18),S=i(x),A=e(519),D=i(A),C=e(419),w=i(C),I=e(31),_=i(I),F=e(179),k=n(F),P=function(){function t(e,r,n){a(this,t),r=r||{},this.comments=e.comments||[],this.tokens=e.tokens||[],this.format=t.normalizeOptions(n,r,this.tokens),this.opts=r,this.ast=e,this.whitespace=new l["default"](this.tokens),this.position=new v["default"],this.map=new y["default"](this.position,r,n),this.buffer=new S["default"](this.position,this.format)}return t.normalizeOptions=function(e,r,n){var i=" ";if(e){var a=u["default"](e).indent;a&&" "!==a&&(i=a)}var s={shouldPrintComment:r.shouldPrintComment,retainLines:r.retainLines,comments:null==r.comments||r.comments,compact:r.compact,quotes:t.findCommonStringDelimiter(e,n),indent:{adjustMultilineComment:!0,style:i,base:0}};return"auto"===s.compact&&(s.compact=e.length>1e5,s.compact&&console.error("[BABEL] "+E.get("codeGeneratorDeopt",r.filename,"100KB"))),s.compact&&(s.indent.adjustMultilineComment=!1),s},t.findCommonStringDelimiter=function(e,t){for(var r={single:0,"double":0},n=0,i=0;i<t.length;i++){var a=t[i];if("string"===a.type.label){var s=e.slice(a.start,a.end);if("'"===s[0]?r.single++:r["double"]++,n++,n>=3)break}}return r.single>r["double"]?"single":"double";
},t.prototype.generate=function(){var e=this.ast;if(this.print(e),e.comments){for(var t=[],r=e.comments,n=0;n<r.length;n++){var i=r[n];i._displayed||t.push(i)}this._printComments(t)}return{map:this.map.get(),code:this.buffer.get()}},t.prototype.buildPrint=function(e){return new f["default"](this,e)},t.prototype.catchUp=function(e){if(e.loc&&this.format.retainLines&&this.buffer.buf)for(;this.position.line<e.loc.start.line;)this._push("\n")},t.prototype._printNewline=function(e,t,r,n){if(n.statement||_["default"].isUserWhitespacable(t,r)){var i=0;if(null==t.start||t._ignoreUserWhitespace){e||i++,n.addNewlines&&(i+=n.addNewlines(e,t)||0);var a=_["default"].needsWhitespaceAfter;e&&(a=_["default"].needsWhitespaceBefore),a(t,r)&&i++,this.buffer.buf||(i=0)}else i=e?this.whitespace.getNewlinesBefore(t):this.whitespace.getNewlinesAfter(t);this.newline(i)}},t.prototype.print=function(e,t){var r=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];if(e){t&&t._compact&&(e._compact=!0);var n=this.format.concise;if(e._compact&&(this.format.concise=!0),!this[e.type])throw new ReferenceError("unknown node of type "+JSON.stringify(e.type)+" with constructor "+JSON.stringify(e&&e.constructor.name));var i=_["default"].needsParens(e,t);i&&this.push("("),this.printLeadingComments(e,t),this.catchUp(e),this._printNewline(!0,e,t,r),r.before&&r.before(),this.map.mark(e,"start"),this[e.type](e,this.buildPrint(e),t),i&&this.push(")"),this.map.mark(e,"end"),r.after&&r.after(),this.format.concise=n,this._printNewline(!1,e,t,r),this.printTrailingComments(e,t)}},t.prototype.printJoin=function(e,t){var r=this,n=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];if(t&&t.length){var i=t.length;n.indent&&this.indent();for(var a={statement:n.statement,addNewlines:n.addNewlines,after:function(){n.iterator&&n.iterator(o,s),n.separator&&i-1>s&&r.push(n.separator)}},s=0;s<t.length;s++){var o=t[s];e.plain(o,a)}n.indent&&this.dedent()}},t.prototype.printAndIndentOnComments=function(e,t){var r=!!t.leadingComments;r&&this.indent(),e.plain(t),r&&this.dedent()},t.prototype.printBlock=function(e,t){k.isEmptyStatement(t)?this.semicolon():(this.push(" "),e.plain(t))},t.prototype.generateComment=function(e){var t=e.value;return t="CommentLine"===e.type?"//"+t:"/*"+t+"*/"},t.prototype.printTrailingComments=function(e,t){this._printComments(this.getComments("trailingComments",e,t))},t.prototype.printLeadingComments=function(e,t){this._printComments(this.getComments("leadingComments",e,t))},t.prototype.getComments=function(e,t,r){if(k.isExpressionStatement(r))return[];var n=[],i=[t];k.isExpressionStatement(t)&&i.push(t.argument);for(var a=i,s=0;s<a.length;s++){var o=a[s];n=n.concat(this._getComments(e,o))}return n},t.prototype._getComments=function(e,t){return t&&t[e]||[]},t.prototype.shouldPrintComment=function(e){return this.format.shouldPrintComment?this.format.shouldPrintComment(e.value):e.value.indexOf("@license")>=0||e.value.indexOf("@preserve")>=0?!0:this.format.comments},t.prototype._printComments=function(e){if(e&&e.length)for(var t=e,r=0;r<t.length;r++){var n=t[r];if(this.shouldPrintComment(n)&&!n._displayed){n._displayed=!0,this.catchUp(n),this.newline(this.whitespace.getNewlinesBefore(n));var i=this.position.column,a=this.generateComment(n);if(i&&!this.isLast(["\n"," ","[","{"])&&(this._push(" "),i++),"CommentBlock"===n.type&&this.format.indent.adjustMultilineComment){var s=n.loc&&n.loc.start.column;if(s){var o=new RegExp("\\n\\s{1,"+s+"}","g");a=a.replace(o,"\n")}var u=Math.max(this.indentSize(),i);a=a.replace(/\n/g,"\n"+h["default"](" ",u))}0===i&&(a=this.getIndent()+a),(this.format.compact||this.format.retainLines)&&"CommentLine"===n.type&&(a+="\n"),this._push(a),this.newline(this.whitespace.getNewlinesAfter(n))}}},s(t,null,[{key:"generators",value:{templateLiterals:e(28),comprehensions:e(21),expressions:e(22),statements:e(27),classes:e(20),methods:e(25),modules:e(26),types:e(29),flow:e(23),base:e(19),jsx:e(24)},enumerable:!0}]),t}();w["default"](S["default"].prototype,function(e,t){P.prototype[t]=function(){return e.apply(this.buffer,arguments)}}),w["default"](P.generators,function(e){D["default"](P.prototype,e)}),t.exports=function(e,t,r){var n=new P(e,t,r);return n.generate()},t.exports.CodeGenerator=P},{179:179,18:18,19:19,20:20,21:21,22:22,23:23,24:24,25:25,26:26,27:27,28:28,29:29,31:31,33:33,35:35,36:36,37:37,399:399,419:419,43:43,519:519,592:592}],31:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var s=e(34),o=i(s),u=e(32),p=n(u),l=e(419),c=i(l),f=e(424),d=i(f),h=e(179),m=n(h),y=function(e,t,r){if(e){for(var n,i=Object.keys(e),a=0;a<i.length;a++){var s=i[a];if(m.is(s,t)){var o=e[s];if(n=o(t,r),null!=n)break}}return n}},g=function(){function e(t,r){a(this,e),this.parent=r,this.node=t}return e.isUserWhitespacable=function(e){return m.isUserWhitespacable(e)},e.needsWhitespace=function(t,r,n){if(!t)return 0;m.isExpressionStatement(t)&&(t=t.expression);var i=y(o["default"].nodes,t,r);if(!i){var a=y(o["default"].list,t,r);if(a)for(var s=0;s<a.length&&!(i=e.needsWhitespace(a[s],t,n));s++);}return i&&i[n]||0},e.needsWhitespaceBefore=function(t,r){return e.needsWhitespace(t,r,"before")},e.needsWhitespaceAfter=function(t,r){return e.needsWhitespace(t,r,"after")},e.needsParens=function(e,t){if(!t)return!1;if(m.isNewExpression(t)&&t.callee===e){if(m.isCallExpression(e))return!0;var r=d["default"](e,function(e){return m.isCallExpression(e)});if(r)return!0}return y(p,e,t)},e}();r["default"]=g,c["default"](g,function(e,t){g.prototype[t]=function(){var e=new Array(arguments.length+2);e[0]=this.node,e[1]=this.parent;for(var r=0;r<e.length;r++)e[r+2]=arguments[r];return g[t].apply(null,e)}}),t.exports=r["default"]},{179:179,32:32,34:34,419:419,424:424}],32:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){return E.isArrayTypeAnnotation(t)}function s(e,t){return E.isMemberExpression(t)&&t.object===e?!0:void 0}function o(e,t){return E.isExpressionStatement(t)?!0:E.isMemberExpression(t)&&t.object===e?!0:!1}function u(e,t){if((E.isCallExpression(t)||E.isNewExpression(t))&&t.callee===e)return!0;if(E.isUnaryLike(t))return!0;if(E.isMemberExpression(t)&&t.object===e)return!0;if(E.isBinary(t)){var r=t.operator,n=x[r],i=e.operator,a=x[i];if(n>a)return!0;if(n===a&&t.right===e&&!E.isLogicalExpression(t))return!0}}function p(e,t){if("in"===e.operator){if(E.isVariableDeclarator(t))return!0;if(E.isFor(t))return!0}}function l(e,t){return E.isForStatement(t)?!1:E.isExpressionStatement(t)&&t.expression===e?!1:E.isReturnStatement(t)?!1:!0}function c(e,t){return E.isBinary(t)||E.isUnaryLike(t)||E.isCallExpression(t)||E.isMemberExpression(t)||E.isNewExpression(t)||E.isConditionalExpression(t)||E.isYieldExpression(t)}function f(e,t){return E.isExpressionStatement(t)}function d(e,t){return E.isMemberExpression(t)&&t.object===e}function h(e,t){return E.isExpressionStatement(t)?!0:E.isMemberExpression(t)&&t.object===e?!0:E.isCallExpression(t)&&t.callee===e?!0:void 0}function m(e,t){return E.isUnaryLike(t)?!0:E.isBinary(t)?!0:(E.isCallExpression(t)||E.isNewExpression(t))&&t.callee===e?!0:E.isConditionalExpression(t)&&t.test===e?!0:E.isMemberExpression(t)&&t.object===e?!0:!1}function y(e){return E.isObjectPattern(e.left)?!0:m.apply(void 0,arguments)}r.__esModule=!0,r.NullableTypeAnnotation=a,r.UpdateExpression=s,r.ObjectExpression=o,r.Binary=u,r.BinaryExpression=p,r.SequenceExpression=l,r.YieldExpression=c,r.ClassExpression=f,r.UnaryLike=d,r.FunctionExpression=h,r.ConditionalExpression=m,r.AssignmentExpression=y;var g=e(419),v=i(g),b=e(179),E=n(b),x={};v["default"]([["||"],["&&"],["|"],["^"],["&"],["==","===","!=","!=="],["<",">","<=",">=","in","instanceof"],[">>","<<",">>>"],["+","-"],["*","/","%"],["**"]],function(e,t){v["default"](e,function(e){x[e]=t})}),r.FunctionTypeAnnotation=a},{179:179,419:419}],33:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var i=function(){function e(t,r){n(this,e),this.generator=t,this.parent=r}return e.prototype.printInnerComments=function(){if(this.parent.innerComments){var e=this.generator;e.indent(),e._printComments(this.parent.innerComments),e.dedent()}},e.prototype.plain=function(e,t){return this.generator.print(e,this.parent,t)},e.prototype.sequence=function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return t.statement=!0,this.generator.printJoin(this,e,t)},e.prototype.join=function(e,t){return this.generator.printJoin(this,e,t)},e.prototype.list=function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return null==t.separator&&(t.separator=",",this.generator.format.compact||(t.separator+=" ")),this.join(e,t)},e.prototype.block=function(e){return this.generator.printBlock(this,e)},e.prototype.indentOnComments=function(e){return this.generator.printAndIndentOnComments(this,e)},e}();r["default"]=i,t.exports=r["default"]},{}],34:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return m.isMemberExpression(e)?(a(e.object,t),e.computed&&a(e.property,t)):m.isBinary(e)||m.isAssignmentExpression(e)?(a(e.left,t),a(e.right,t)):m.isCallExpression(e)?(t.hasCall=!0,a(e.callee,t)):m.isFunction(e)?t.hasFunction=!0:m.isIdentifier(e)&&(t.hasHelper=t.hasHelper||s(e.callee)),t}function s(e){return m.isMemberExpression(e)?s(e.object)||s(e.property):m.isIdentifier(e)?"require"===e.name||"_"===e.name[0]:m.isCallExpression(e)?s(e.callee):m.isBinary(e)||m.isAssignmentExpression(e)?m.isIdentifier(e.left)&&s(e.left)||s(e.right):!1}function o(e){return m.isLiteral(e)||m.isObjectExpression(e)||m.isArrayExpression(e)||m.isIdentifier(e)||m.isMemberExpression(e)}var u=e(506),p=i(u),l=e(419),c=i(l),f=e(422),d=i(f),h=e(179),m=n(h);r.nodes={AssignmentExpression:function(e){var t=a(e.right);return t.hasCall&&t.hasHelper||t.hasFunction?{before:t.hasFunction,after:!0}:void 0},SwitchCase:function(e,t){return{before:e.consequent.length||t.cases[0]===e}},LogicalExpression:function(e){return m.isFunction(e.left)||m.isFunction(e.right)?{after:!0}:void 0},Literal:function(e){return"use strict"===e.value?{after:!0}:void 0},CallExpression:function(e){return m.isFunction(e.callee)||s(e)?{before:!0,after:!0}:void 0},VariableDeclaration:function(e){for(var t=0;t<e.declarations.length;t++){var r=e.declarations[t],n=s(r.id)&&!o(r.init);if(!n){var i=a(r.init);n=s(r.init)&&i.hasCall||i.hasFunction}if(n)return{before:!0,after:!0}}},IfStatement:function(e){return m.isBlockStatement(e.consequent)?{before:!0,after:!0}:void 0}},r.nodes.Property=r.nodes.SpreadProperty=function(e,t){return t.properties[0]===e?{before:!0}:void 0},r.list={VariableDeclaration:function(e){return d["default"](e.declarations,"init")},ArrayExpression:function(e){return e.elements},ObjectExpression:function(e){return e.properties}},c["default"]({Function:!0,Class:!0,Loop:!0,LabeledStatement:!0,SwitchStatement:!0,TryStatement:!0},function(e,t){p["default"](e)&&(e={after:e,before:e}),c["default"]([t].concat(m.FLIPPED_ALIAS_KEYS[t]||[]),function(t){r.nodes[t]=function(){return e}})})},{179:179,419:419,422:422,506:506}],35:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var i=function(){function e(){n(this,e),this.line=1,this.column=0}return e.prototype.push=function(e){for(var t=0;t<e.length;t++)"\n"===e[t]?(this.line++,this.column=0):this.column++},e.prototype.unshift=function(e){for(var t=0;t<e.length;t++)"\n"===e[t]?this.line--:this.column--},e}();r["default"]=i,t.exports=r["default"]},{}],36:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var s=e(607),o=i(s),u=e(179),p=n(u),l=function(){function e(t,r,n){a(this,e),this.position=t,this.opts=r,r.sourceMaps?(this.map=new o["default"].SourceMapGenerator({file:r.sourceMapTarget,sourceRoot:r.sourceRoot}),this.map.setSourceContent(r.sourceFileName,n)):this.map=null}return e.prototype.get=function(){var e=this.map;return e?e.toJSON():e},e.prototype.mark=function(e,t){var r=e.loc;if(r){var n=this.map;if(n&&!p.isProgram(e)&&!p.isFile(e)){var i=this.position,a={line:i.line,column:i.column},s=r[t];n.addMapping({source:this.opts.sourceFileName,generated:a,original:s})}}},e}();r["default"]=l,t.exports=r["default"]},{179:179,607:607}],37:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t,r){return e+=t,e>=r&&(e-=r),e}r.__esModule=!0;var a=function(){function e(t){n(this,e),this.tokens=t,this.used={},this._lastFoundIndex=0}return e.prototype.getNewlinesBefore=function(e){for(var t,r,n=this.tokens,a=0;a<n.length;a++){var s=i(a,this._lastFoundIndex,this.tokens.length),o=n[s];if(e.start===o.start){t=n[s-1],r=o,this._lastFoundIndex=s;break}}return this.getNewlinesBetween(t,r)},e.prototype.getNewlinesAfter=function(e){for(var t,r,n=this.tokens,a=0;a<n.length;a++){var s=i(a,this._lastFoundIndex,this.tokens.length),o=n[s];if(e.end===o.end){t=o,r=n[s+1],","===r.type.label&&(r=n[s+2]),this._lastFoundIndex=s;break}}if(r&&"eof"===r.type.label)return 1;var u=this.getNewlinesBetween(t,r);return"CommentLine"!==e.type||u?u:1},e.prototype.getNewlinesBetween=function(e,t){if(!t||!t.loc)return 0;for(var r=e?e.loc.end.line:1,n=t.loc.start.line,i=0,a=r;n>a;a++)"undefined"==typeof this.used[a]&&(this.used[a]=!0,i++);return i},e}();r["default"]=a,t.exports=r["default"]},{}],38:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e){var t=c["default"].matchToToken(e);if("name"===t.type&&d["default"].keyword.isReservedWordES6(t.value))return"keyword";if("punctuator"===t.type)switch(t.value){case"{":case"}":return"curly";case"(":case")":return"parens";case"[":case"]":return"square"}return t.type}function a(e){return e.replace(c["default"],function(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];var n=i(t),a=y[n];return a?t[0].split(g).map(function(e){return a(e)}).join("\n"):t[0]})}r.__esModule=!0;var s=e(411),o=n(s),u=e(592),p=n(u),l=e(409),c=n(l),f=e(403),d=n(f),h=e(200),m=n(h),y={string:m["default"].red,punctuator:m["default"].bold,curly:m["default"].green,parens:m["default"].blue.bold,square:m["default"].yellow,keyword:m["default"].cyan,number:m["default"].magenta,regex:m["default"].magenta,comment:m["default"].grey,invalid:m["default"].inverse},g=/\r\n|[\n\r\u2028\u2029]/;r["default"]=function(e,t,r){var n=arguments.length<=3||void 0===arguments[3]?{}:arguments[3];r=Math.max(r,0);var i=n.highlightCode&&m["default"].supportsColor;i&&(e=a(e)),e=e.split(g);var s=Math.max(t-3,0),u=Math.min(e.length,t+3);t||r||(s=0,u=e.length);var l=o["default"](e.slice(s,u),{start:s+1,before:" ",after:" | ",transform:function(e){e.number===t&&(r&&(e.line+="\n"+e.before+p["default"](" ",e.width)+e.after+p["default"](" ",r-1)+"^"),e.before=e.before.replace(/^./,">"))}}).join("\n");return i?m["default"].reset(l):l},t.exports=r["default"]},{200:200,403:403,409:409,411:411,592:592}],39:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var i=e(523),a=n(i);r["default"]=function(e,t){return e&&t?a["default"](e,t,function(e,t){if(t&&Array.isArray(e)){for(var r=e.slice(0),n=t,i=Array.isArray(n),a=0,n=i?n:n[Symbol.iterator]();;){var s;if(i){if(a>=n.length)break;s=n[a++]}else{if(a=n.next(),a.done)break;s=a.value}var o=s;e.indexOf(o)<0&&r.push(o)}return r}}):void 0},t.exports=r["default"]},{523:523}],40:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i);r["default"]=function(e,t,r){if(e&&"Program"===e.type)return a.file(e,t||[],r||[]);throw new Error("Not a valid ast?")},t.exports=r["default"]},{179:179}],41:[function(e,t,r){"use strict";r.__esModule=!0,r["default"]=function(){return Object.create(null)},t.exports=r["default"]},{}],42:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(613),a=n(i);r["default"]=function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],r={allowImportExportEverywhere:t.looseModules,allowReturnOutsideFunction:t.looseModules,allowHashBang:!0,ecmaVersion:6,strictMode:t.strictMode,sourceType:t.sourceType,locations:!0,features:t.features||{},plugins:t.plugins||{}};return t.nonStandard&&(r.plugins.jsx=!0,r.plugins.flow=!0),a.parse(e,r)},t.exports=r["default"]},{613:613}],43:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;t>n;n++)r[n-1]=arguments[n];var i=u[e];if(!i)throw new ReferenceError("Unknown message "+JSON.stringify(e));return r=a(r),i.replace(/\$(\d+)/g,function(e,t){return r[--t]})}function a(e){return e.map(function(e){if(null!=e&&e.inspect)return e.inspect();try{return JSON.stringify(e)||e+""}catch(t){return o.inspect(e)}})}r.__esModule=!0,r.get=i,r.parseArgs=a;var s=e(13),o=n(s),u={tailCallReassignmentDeopt:"Function reference has been reassigned, so it will probably be dereferenced, therefore 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",scopeDuplicateDeclaration:"Duplicate declaration $1",settersNoRest:"Setters aren't allowed to have a rest",noAssignmentsInForHead:"No assignments allowed in for-in/of head",expectedMemberExpressionOrIdentifier:"Expected type MemberExpression 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",unknownForHead:"Unknown node type $1 in ForStatement",didYouMean:"Did you mean $1?",codeGeneratorDeopt:"Note: The code generator has deoptimised the styling of $1 as it exceeds the max of $2.",missingTemplatesDirectory:"no templates directory - this is most likely the result of a broken `npm publish`. Please report to https://github.com/babel/babel/issues",unsupportedOutputType:"Unsupported output type $1",illegalMethodName:"Illegal method name $1",lostTrackNodePath:"We lost track of this node's position, likely because the AST was directly manipulated",modulesIllegalExportName:"Illegal export $1",modulesDuplicateDeclarations:"Duplicate module declarations with the same source but in different scopes",undeclaredVariable:"Reference to undeclared variable $1",undeclaredVariableType:"Referencing a type alias outside of a type annotation",undeclaredVariableSuggestion:"Reference to undeclared variable $1 - did you mean $2?",traverseNeedsParent:"You must pass a scope and parentPath unless traversing a Program/File got a $1 node",traverseVerifyRootFunction:"You passed `traverse()` a function when it expected a visitor object, are you sure you didn't mean `{ enter: Function }`?",traverseVerifyVisitorProperty:"You passed `traverse()` a visitor object with the property $1 that has the invalid property $2",traverseVerifyNodeType:"You gave us a visitor for the node type $1 but it's not a valid type",pluginIllegalKind:"Illegal kind $1 for plugin $2",pluginIllegalPosition:"Illegal position $1 for plugin $2",pluginKeyCollision:"The plugin $1 collides with another of the same name",pluginNotTransformer:"The plugin $1 didn't export a Plugin instance",pluginUnknown:"Unknown plugin $1",pluginNotFile:"Plugin $1 is resolving to a different Babel version than what is performing the transformation.",pluginInvalidProperty:"Plugin $1 provided an invalid property of $2.",pluginInvalidPropertyVisitor:'Define your visitor methods inside a `visitor` property like so:\n\n new Plugin("foobar", {\n visitor: {\n // define your visitor methods here!\n }\n });\n'};r.MESSAGES=u},{13:13}],44:[function(e,t,r){(function(t){"use strict";if(e(395),e(585),t._babelPolyfill)throw new Error("only one instance of babel/polyfill is allowed");t._babelPolyfill=!0}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{395:395,585:585}],45:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){var r=[],n=E.functionExpression(null,[E.identifier("global")],E.blockStatement(r)),i=E.program([E.expressionStatement(E.callExpression(n,[h.template("helper-self-global")]))]);return r.push(E.variableDeclaration("var",[E.variableDeclarator(e,E.assignmentExpression("=",E.memberExpression(E.identifier("global"),e),E.objectExpression([])))])),t(r),i}function s(e,t){var r=[];r.push(E.variableDeclaration("var",[E.variableDeclarator(e,E.identifier("global"))])),t(r);var n=h.template("umd-commonjs-strict",{FACTORY_PARAMETERS:E.identifier("global"),BROWSER_ARGUMENTS:E.assignmentExpression("=",E.memberExpression(E.identifier("root"),e),E.objectExpression({})),COMMON_ARGUMENTS:E.identifier("exports"),AMD_ARGUMENTS:E.arrayExpression([E.literal("exports")]),FACTORY_BODY:r,UMD_ROOT:E.identifier("this")});return E.program([n])}function o(e,t){var r=[];return r.push(E.variableDeclaration("var",[E.variableDeclarator(e,E.objectExpression({}))])),t(r),E.program(r)}function u(e,t,r){v["default"](y["default"].helpers,function(n){if(!r||-1!==r.indexOf(n)){var i=E.identifier(E.toIdentifier(n));e.push(E.expressionStatement(E.assignmentExpression("=",E.memberExpression(t,i),h.template("helper-"+n))))}})}r.__esModule=!0;var p=e(30),l=i(p),c=e(43),f=n(c),d=e(182),h=n(d),m=e(46),y=i(m),g=e(419),v=i(g),b=e(179),E=n(b);r["default"]=function(e){var t,r=arguments.length<=1||void 0===arguments[1]?"global":arguments[1],n=E.identifier("babelHelpers"),i=function(t){return u(t,n,e)},p={global:a,umd:s,"var":o}[r];if(!p)throw new Error(f.get("unsupportedOutputType",r));return t=p(n,i),l["default"](t).code},t.exports=r["default"]},{179:179,182:182,30:30,419:419,43:43,46:46}],46:[function(e,t,r){(function(n){"use strict";function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function a(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),u=e(208),p=a(u),l=e(74),c=a(l),f=e(50),d=a(f),h=e(52),m=a(h),y=e(595),g=a(y),v=e(155),b=a(v),E=e(508),x=a(E),S=e(607),A=a(S),D=e(30),C=a(D),w=e(38),I=a(w),_=e(518),F=a(_),k=e(421),P=a(k),B=e(148),T=a(B),M=e(610),O=a(M),j=e(47),L=a(j),N=e(82),R=a(N),V=e(42),U=a(V),q=e(147),G=a(q),H=e(182),W=i(H),X=e(9),Y=a(X),J=e(179),z=i(J),K=function(){function t(e,r){void 0===e&&(e={}),s(this,t),this.transformerDependencies={},this.dynamicImportTypes={},this.dynamicImportIds={},this.dynamicImports=[],this.declarations={},this.usedHelpers={},this.dynamicData={},this.data={},this.ast={},this.metadata={modules:{imports:[],exports:{exported:[],specifiers:[]}}},this.hub=new G["default"](this),this.pipeline=r,this.log=new L["default"](this,e.filename||"unknown"),this.opts=this.initOptions(e),this.buildTransformers()}return t.prototype.initOptions=function(e){return e=new d["default"](this.log,this.pipeline).init(e),e.inputSourceMap&&(e.sourceMaps=!0),e.moduleId&&(e.moduleIds=!0),e.basename=Y["default"].basename(e.filename,Y["default"].extname(e.filename)),e.ignore=W.arrayify(e.ignore,W.regexify),e.only&&(e.only=W.arrayify(e.only,W.regexify)),F["default"](e,{moduleRoot:e.sourceRoot}),F["default"](e,{sourceRoot:e.moduleRoot}),F["default"](e,{filenameRelative:e.filename}),F["default"](e,{sourceFileName:e.filenameRelative,sourceMapTarget:e.filenameRelative}),e.externalHelpers&&this.set("helpersNamespace",z.identifier("babelHelpers")),e},t.prototype.isLoose=function(e){return P["default"](this.opts.loose,e)},t.prototype.buildTransformers=function(){var e=this,t=this.transformers={},r=[],n=[];for(var i in this.pipeline.transformers){var a=this.pipeline.transformers[i],s=t[i]=a.buildPass(e);s.canTransform()&&(n.push(s),a.metadata.secondPass&&r.push(s),a.manipulateOptions&&a.manipulateOptions(e.opts,e))}for(var o=[],u=[],p=new m["default"]({file:this,transformers:this.transformers,before:o,after:u}),l=0;l<e.opts.plugins.length;l++)p.add(e.opts.plugins[l]);n=o.concat(n,u),this.uncollapsedTransformerStack=n=n.concat(r);for(var c=n,f=0;f<c.length;f++)for(var s=c[f],d=s.plugin.dependencies,h=0;h<d.length;h++){var y=d[h];this.transformerDependencies[y]=s.key}this.transformerStack=this.collapseStack(n)},t.prototype.collapseStack=function(e){for(var t=[],r=[],n=e,i=0;i<n.length;i++){var a=n[i];if(!(r.indexOf(a)>=0)){var s=a.plugin.metadata.group;if(a.canTransform()&&s){for(var o=[],u=e,p=0;p<u.length;p++){var l=u[p];l.plugin.metadata.group===s&&(o.push(l),r.push(l))}for(var c=[],f=o,d=0;d<f.length;d++){var h=f[d];c.push(h.plugin.visitor)}var m=T["default"].visitors.merge(c),y=new R["default"](s,{visitor:m});t.push(y.buildPass(this))}else t.push(a)}}return t},t.prototype.set=function(e,t){return this.data[e]=t},t.prototype.setDynamic=function(e,t){this.dynamicData[e]=t},t.prototype.get=function(e){var t=this.data[e];if(t)return t;var r=this.dynamicData[e];return r?this.set(e,r()):void 0},t.prototype.resolveModuleSource=function r(e){var r=this.opts.resolveModuleSource;return r&&(e=r(e,this.opts.filename)),e},t.prototype.addImport=function(e,t,r){t=t||e;var n=this.dynamicImportIds[t];if(!n){e=this.resolveModuleSource(e),n=this.dynamicImportIds[t]=this.scope.generateUidIdentifier(t);var i=[z.importDefaultSpecifier(n)],a=z.importDeclaration(i,z.literal(e));if(a._blockHoist=3,r){var s=this.dynamicImportTypes[r]=this.dynamicImportTypes[r]||[];s.push(a)}this.transformers["es6.modules"].canTransform()?(this.moduleFormatter.importSpecifier(i[0],a,this.dynamicImports,this.scope),this.moduleFormatter.hasLocalImports=!0):this.dynamicImports.push(a)}return n},t.prototype.attachAuxiliaryComment=function(e){var t=this.opts.auxiliaryCommentBefore;t&&(e.leadingComments=e.leadingComments||[],e.leadingComments.push({type:"CommentLine",value:" "+t}));var r=this.opts.auxiliaryCommentAfter;return r&&(e.trailingComments=e.trailingComments||[],e.trailingComments.push({type:"CommentLine",value:" "+r})),e},t.prototype.addHelper=function(e){var r=P["default"](t.soloHelpers,e);if(!r&&!P["default"](t.helpers,e))throw new ReferenceError("Unknown helper "+e);var n=this.declarations[e];if(n)return n;if(this.usedHelpers[e]=!0,!r){var i=this.get("helperGenerator"),a=this.get("helpersNamespace");if(i)return i(e);if(a){var s=z.identifier(z.toIdentifier(e));return z.memberExpression(a,s)}}var o=W.template("helper-"+e),u=this.declarations[e]=this.scope.generateUidIdentifier(e);return z.isFunctionExpression(o)&&!o.id?(o.body._compact=!0,o._generated=!0,o.id=u,o.type="FunctionDeclaration",this.attachAuxiliaryComment(o),this.path.unshiftContainer("body",o)):(o._compact=!0,this.scope.push({id:u,init:o,unique:!0})),u},t.prototype.addTemplateObject=function(e,t,r){var n=r.elements.map(function(e){return e.value}),i=e+"_"+r.elements.length+"_"+n.join(","),a=this.declarations[i];if(a)return a;var s=this.declarations[i]=this.scope.generateUidIdentifier("templateObject"),o=this.addHelper(e),u=z.callExpression(o,[t,r]);return u._compact=!0,this.scope.push({id:s,init:u,_blockHoist:1.9}),s},t.prototype.errorWithNode=function(e,t){var r,n=arguments.length<=2||void 0===arguments[2]?SyntaxError:arguments[2],i=e&&(e.loc||e._loc);return i?(r=new n("Line "+i.start.line+": "+t),r.loc=i.start):r=new n("There's been an error on a dynamic node. This is almost certainly an internal error. Please report it."),r},t.prototype.mergeSourceMap=function(e){var t=this.opts,r=t.inputSourceMap;if(r){e.sources[0]=r.file;var n=new A["default"].SourceMapConsumer(r),i=new A["default"].SourceMapConsumer(e),a=A["default"].SourceMapGenerator.fromSourceMap(i);a.applySourceMap(n);var s=a.toJSON();return s.sources=r.sources,s.file=r.file,s}return e},t.prototype.getModuleFormatter=function(t){(x["default"](t)||!c["default"][t])&&this.log.deprecate("Custom module formatters are deprecated and will be removed in the next major. Please use Babel plugins instead.");var r=x["default"](t)?t:c["default"][t];if(!r){var n=O["default"].relative(t);n&&(r=e(n))}if(!r)throw new ReferenceError("Unknown module formatter type "+JSON.stringify(t));return new r(this)},t.prototype.parse=function(e){var t=this.opts,r={highlightCode:t.highlightCode,nonStandard:t.nonStandard,sourceType:t.sourceType,filename:t.filename,plugins:{}},n=r.features={};for(var i in this.transformers){var a=this.transformers[i];n[i]=a.canTransform()}r.looseModules=this.isLoose("es6.modules"),r.strictMode=n.strict,this.log.debug("Parse start");var s=U["default"](e,r);return this.log.debug("Parse stop"),s},t.prototype._addAst=function(e){this.path=b["default"].get({hub:this.hub,parentPath:null,parent:e,container:e,key:"program"}).setContext(),this.scope=this.path.scope,this.ast=e},t.prototype.addAst=function(e){this.log.debug("Start set AST"),this._addAst(e),this.log.debug("End set AST"),this.log.debug("Start module formatter init");var t=this.moduleFormatter=this.getModuleFormatter(this.opts.modules);t.init&&this.transformers["es6.modules"].canTransform()&&t.init(),this.log.debug("End module formatter init")},t.prototype.transform=function(){this.call("pre");for(var e=this.transformerStack,t=0;t<e.length;t++){var r=e[t];r.transform()}return this.call("post"),this.generate()},t.prototype.wrap=function(e,t){e+="";try{return this.shouldIgnore()?this.makeResult({code:e,ignored:!0}):t()}catch(r){if(r._babel)throw r;r._babel=!0;var i=r.message=this.opts.filename+": "+r.message,a=r.loc;if(a&&(r.codeFrame=I["default"](e,a.line,a.column+1,this.opts),i+="\n"+r.codeFrame),n.browser&&(r.message=i),r.stack){var s=r.stack.replace(r.message,i);try{r.stack=s}catch(o){}}throw r}},t.prototype.addCode=function(e){e=(e||"")+"",e=this.parseInputSourceMap(e),this.code=e},t.prototype.parseCode=function(){this.parseShebang();var e=this.parse(this.code);this.addAst(e)},t.prototype.shouldIgnore=function(){var e=this.opts;return W.shouldIgnore(e.filename,e.ignore,e.only)},t.prototype.call=function(e){for(var t=this.uncollapsedTransformerStack,r=0;r<t.length;r++){var n=t[r],i=n.plugin[e];i&&i(this)}},t.prototype.parseInputSourceMap=function(e){var t=this.opts;
if(t.inputSourceMap!==!1){var r=p["default"].fromSource(e);r&&(t.inputSourceMap=r.toObject(),e=p["default"].removeComments(e))}return e},t.prototype.parseShebang=function(){var e=g["default"].exec(this.code);e&&(this.shebang=e[0],this.code=this.code.replace(g["default"],""))},t.prototype.makeResult=function(e){var t=e.code,r=e.map,n=void 0===r?null:r,i=e.ast,a=e.ignored,s={metadata:null,ignored:!!a,code:null,ast:null,map:n};return this.opts.code&&(s.code=t),this.opts.ast&&(s.ast=i),this.opts.metadata&&(s.metadata=this.metadata,s.metadata.usedHelpers=Object.keys(this.usedHelpers)),s},t.prototype.generate=function(){var e=this.opts,t=this.ast,r={ast:t};if(!e.code)return this.makeResult(r);this.log.debug("Generation start");var n=C["default"](t,e,this.code);return r.code=n.code,r.map=n.map,this.log.debug("Generation end"),this.shebang&&(r.code=this.shebang+"\n"+r.code),r.map&&(r.map=this.mergeSourceMap(r.map)),("inline"===e.sourceMaps||"both"===e.sourceMaps)&&(r.code+="\n"+p["default"].fromObject(r.map).toComment()),"inline"===e.sourceMaps&&(r.map=null),this.makeResult(r)},o(t,null,[{key:"helpers",value:["inherits","defaults","create-class","create-decorated-class","create-decorated-object","define-decorated-property-descriptor","tagged-template-literal","tagged-template-literal-loose","to-array","to-consumable-array","sliced-to-array","sliced-to-array-loose","object-without-properties","has-own","slice","bind","define-property","async-to-generator","interop-export-wildcard","interop-require-wildcard","interop-require-default","typeof","extends","get","set","new-arrow-check","class-call-check","object-destructuring-empty","temporal-undefined","temporal-assert-defined","self-global","typeof-react-element","default-props","instanceof","interop-require"],enumerable:!0},{key:"soloHelpers",value:[],enumerable:!0}]),t}();r["default"]=K,t.exports=r["default"]}).call(this,e(10))},{10:10,147:147,148:148,155:155,179:179,182:182,208:208,30:30,38:38,42:42,421:421,47:47,50:50,508:508,518:518,52:52,595:595,607:607,610:610,74:74,82:82,9:9}],47:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var a=e(397),s=n(a),o=s["default"]("babel:verbose"),u=s["default"]("babel"),p=[],l=function(){function e(t,r){i(this,e),this.filename=r,this.file=t}return e.prototype._buildMessage=function(e){var t="[BABEL] "+this.filename;return e&&(t+=": "+e),t},e.prototype.warn=function(e){console.warn(this._buildMessage(e))},e.prototype.error=function(e){var t=arguments.length<=1||void 0===arguments[1]?Error:arguments[1];throw new t(this._buildMessage(e))},e.prototype.deprecate=function(e){this.file.opts&&this.file.opts.suppressDeprecationMessages||(e=this._buildMessage(e),p.indexOf(e)>=0||(p.push(e),console.error(e)))},e.prototype.verbose=function(e){o.enabled&&o(this._buildMessage(e))},e.prototype.debug=function(e){u.enabled&&u(this._buildMessage(e))},e.prototype.deopt=function(e,t){this.debug(t)},e}();r["default"]=l,t.exports=r["default"]},{397:397}],48:[function(e,t,r){t.exports={filename:{type:"filename",description:"filename to use when reading from stdin - this will be used in source-maps, errors etc","default":"unknown",shorthand:"f"},filenameRelative:{hidden:!0,type:"string"},inputSourceMap:{hidden:!0},extra:{hidden:!0,"default":{}},env:{hidden:!0,"default":{}},moduleId:{description:"specify a custom name for module ids",type:"string"},getModuleId:{hidden:!0},retainLines:{type:"boolean","default":!1,description:"retain line numbers - will result in really ugly code"},nonStandard:{type:"boolean","default":!0,description:"enable/disable support for JSX and Flow (on by default)"},experimental:{type:"boolean",description:"allow use of experimental transformers","default":!1},highlightCode:{description:"enable/disable ANSI syntax highlighting of code frames (on by default)",type:"boolean","default":!0},suppressDeprecationMessages:{type:"boolean","default":!1,hidden:!0},resolveModuleSource:{hidden:!0},stage:{description:"ECMAScript proposal stage version to allow [0-4]",shorthand:"e",type:"number","default":2},blacklist:{type:"transformerList",description:"blacklist of transformers to NOT use",shorthand:"b","default":[]},whitelist:{type:"transformerList",optional:!0,description:"whitelist of transformers to ONLY use",shorthand:"l"},optional:{type:"transformerList",description:"list of optional transformers to enable","default":[]},modules:{type:"string",description:"module formatter type to use [common]","default":"common",shorthand:"m"},moduleIds:{type:"boolean","default":!1,shorthand:"M",description:"insert an explicit id for modules"},loose:{type:"transformerList",description:"list of transformers to enable loose mode ON",shorthand:"L"},jsxPragma:{type:"string",description:"custom pragma to use with JSX (same functionality as @jsx comments)","default":"React.createElement",shorthand:"P"},plugins:{type:"list",description:"","default":[]},ignore:{type:"list",description:"list of glob paths to **not** compile","default":[]},only:{type:"list",description:"list of glob paths to **only** compile"},code:{hidden:!0,"default":!0,type:"boolean"},metadata:{hidden:!0,"default":!0,type:"boolean"},ast:{hidden:!0,"default":!0,type:"boolean"},comments:{type:"boolean","default":!0,description:"strip/output comments in generated output (on by default)"},shouldPrintComment:{hidden:!0,description:"optional callback to control whether a comment should be inserted, when this is used the comments option is ignored"},compact:{type:"booleanString","default":"auto",description:"do not include superfluous whitespace characters and line terminators [true|false|auto]"},keepModuleIdExtensions:{type:"boolean",description:"keep extensions when generating module ids","default":!1,shorthand:"k"},auxiliaryComment:{deprecated:"renamed to auxiliaryCommentBefore",shorthand:"a",alias:"auxiliaryCommentBefore"},auxiliaryCommentBefore:{type:"string","default":"",description:"attach a comment before all helper declarations and auxiliary code"},auxiliaryCommentAfter:{type:"string","default":"",description:"attach a comment after all helper declarations and auxiliary code"},externalHelpers:{type:"boolean","default":!1,shorthand:"r",description:"uses a reference to `babelHelpers` instead of placing helpers at the top of your code."},metadataUsedHelpers:{deprecated:"Not required anymore as this is enabled by default",type:"boolean","default":!1,hidden:!0},sourceMap:{alias:"sourceMaps",hidden:!0},sourceMaps:{type:"booleanString",description:"[true|false|inline]","default":!1,shorthand:"s"},sourceMapName:{alias:"sourceMapTarget",description:"DEPRECATED - Please use sourceMapTarget"},sourceMapTarget:{type:"string",description:"set `file` on returned source map"},sourceFileName:{type:"string",description:"set `sources[0]` on returned source map"},sourceRoot:{type:"filename",description:"the root from which all sources are relative"},moduleRoot:{type:"filename",description:"optional prefix for the AMD module formatter that will be prepend to the filename on module definitions"},breakConfig:{type:"boolean","default":!1,hidden:!0,description:"stop trying to load .babelrc files"},babelrc:{description:"Specify a custom list of babelrc files to use",type:"list"},sourceType:{description:"","default":"module"}}},{}],49:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function a(e,t,r){var n=l["default"][e],i=n&&u[n.type];return i&&i.validate?i.validate(e,t,r):t}function s(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];for(var t in e){var r=e[t];if(null!=r){var n=l["default"][t];if(n){var i=u[n.type];i&&(r=i(r)),e[t]=r}}}return e}r.__esModule=!0,r.validateOption=a,r.normaliseOptions=s;var o=e(51),u=i(o),p=e(48),l=n(p);r.config=l["default"]},{48:48,51:51}],50:[function(e,t,r){(function(n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e){var t=D[e];return null!=t?t:D[e]=d["default"].sync(e)}r.__esModule=!0;var o=e(49),u=e(410),p=i(u),l=e(535),c=i(l),f=e(534),d=i(f),h=e(502),m=i(h),y=e(39),g=i(y),v=e(48),b=i(v),E=e(9),x=i(E),S=e(3),A=i(S),D={},C={},w=".babelignore",I=".babelrc",_="package.json",F=function(){function e(t,r){a(this,e),this.resolvedConfigs=[],this.options=e.createBareOptions(),this.pipeline=r,this.log=t}return e.createBareOptions=function(){var e={};for(var t in b["default"]){var r=b["default"][t];e[t]=m["default"](r["default"])}return e},e.prototype.addConfig=function(e,t){var r=arguments.length<=2||void 0===arguments[2]?p["default"]:arguments[2];if(!(this.resolvedConfigs.indexOf(e)>=0)){var n,i=A["default"].readFileSync(e,"utf8");try{n=C[i]=C[i]||r.parse(i),t&&(n=n[t])}catch(a){throw a.message=e+": Error while parsing JSON - "+a.message,a}this.mergeOptions(n,e),this.resolvedConfigs.push(e)}},e.prototype.mergeOptions=function(e){var t=arguments.length<=1||void 0===arguments[1]?"foreign":arguments[1];if(e){for(var r in e)if("_"!==r[0]){var n=b["default"][r];n||this.log.error("Unknown option: "+t+"."+r,ReferenceError)}o.normaliseOptions(e),g["default"](this.options,e)}},e.prototype.addIgnoreConfig=function(e){var t=A["default"].readFileSync(e,"utf8"),r=t.split("\n");r=r.map(function(e){return e.replace(/#(.*?)$/,"").trim()}).filter(function(e){return!!e}),this.mergeOptions({ignore:r},e)},e.prototype.findConfigs=function(e){if(e)for(c["default"](e)||(e=x["default"].join(n.cwd(),e));e!==(e=x["default"].dirname(e));){if(this.options.breakConfig)return;var t=x["default"].join(e,I);s(t)&&this.addConfig(t);var r=x["default"].join(e,_);s(r)&&this.addConfig(r,"babel",JSON);var i=x["default"].join(e,w);s(i)&&this.addIgnoreConfig(i)}},e.prototype.normaliseOptions=function(){var e=this.options;for(var t in b["default"]){var r=b["default"][t],n=e[t];(n||!r.optional)&&(this.log&&n&&r.deprecated&&this.log.deprecate("Deprecated option "+t+": "+r.deprecated),this.pipeline&&n&&(n=o.validateOption(t,n,this.pipeline)),r.alias?e[r.alias]=e[r.alias]||n:e[t]=n)}},e.prototype.init=function(e){if(this.mergeOptions(e,"direct"),e.babelrc)for(var t=e.babelrc,r=0;r<t.length;r++){var i=t[r];this.addConfig(i)}e.babelrc!==!1&&this.findConfigs(e.filename);var a=n.env.BABEL_ENV||n.env.NODE_ENV||"development";return this.options.env&&this.mergeOptions(this.options.env[a],"direct.env."+a),this.normaliseOptions(e),this.options},e}();r["default"]=F,t.exports=r["default"]}).call(this,e(10))},{10:10,3:3,39:39,410:410,48:48,49:49,502:502,534:534,535:535,9:9}],51:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e){return d.arrayify(e)}function s(e){return+e}function o(e){return!!e}function u(e){return d.booleanify(e)}function p(e){return d.list(e)}r.__esModule=!0,r.transformerList=a,r.number=s,r["boolean"]=o,r.booleanString=u,r.list=p;var l=e(596),c=i(l),f=e(182),d=n(f);a.validate=function(e,t,r){return(t.indexOf("all")>=0||t.indexOf(!0)>=0)&&(t=Object.keys(r.transformers)),r._ensureTransformerNames(e,t)};var h=c["default"];r.filename=h},{182:182,596:596}],52:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var s=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=e(83),u=i(o),p=e(82),l=i(p),c=e(179),f=n(c),d=e(43),h=n(d),m=e(610),y=i(m),g=e(148),v=i(g),b=e(42),E=i(b),x={messages:h,Transformer:u["default"],Plugin:l["default"],types:f,parse:E["default"],traverse:v["default"]},S=function(){function t(){var e=arguments.length<=0||void 0===arguments[0]?{transformers:{},before:[],after:[]}:arguments[0],r=e.file,n=e.transformers,i=e.before,s=e.after;a(this,t),this.transformers=n,this.file=r,this.before=i,this.after=s}return t.memoisePluginContainer=function(e){for(var r=0;r<t.memoisedPlugins.length;r++){var n=t.memoisedPlugins[r];if(n.container===e)return n.transformer}var i=e(x);return t.memoisedPlugins.push({container:e,transformer:i}),i},s(t,null,[{key:"memoisedPlugins",value:[],enumerable:!0},{key:"positions",value:["before","after"],enumerable:!0}]),t.prototype.subnormaliseString=function(t,r){var n=t.match(/^(.*?):(after|before)$/);n&&(t=n[1],r=n[2]);var i=y["default"].relative("babel-plugin-"+t)||y["default"].relative(t);if(i){var a=e(i);return{position:r,plugin:a["default"]||a}}throw new ReferenceError(h.get("pluginUnknown",t))},t.prototype.validate=function(e,t){var r=t.key;if(this.transformers[r])throw new ReferenceError(h.get("pluginKeyCollision",r));if(!t.buildPass||"Plugin"!==t.constructor.name)throw new TypeError(h.get("pluginNotTransformer",e));t.metadata.plugin=!0},t.prototype.add=function(e){var r,n;if(!e)throw new TypeError(h.get("pluginIllegalKind",typeof e,e));if("object"==typeof e&&e.transformer?(n=e.transformer,r=e.position):"string"!=typeof e&&(n=e),"string"==typeof e){var i=this.subnormaliseString(e,r);n=i.plugin,r=i.position}if(r=r||"before",t.positions.indexOf(r)<0)throw new TypeError(h.get("pluginIllegalPosition",r,e));"function"==typeof n&&(n=t.memoisePluginContainer(n)),this.validate(e,n);var a=this.transformers[n.key]=n.buildPass(this.file);if(a.canTransform()){var s="before"===r?this.before:this.after;s.push(a)}},t}();r["default"]=S,t.exports=r["default"]},{148:148,179:179,42:42,43:43,610:610,82:82,83:83}],53:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var a=e(58),s=i(a),o=e(179),u=n(o);r["default"]=function(e){var t={},r=function(t){return t.operator===e.operator+"="},n=function(e,t){return u.assignmentExpression("=",e,t)};return t.ExpressionStatement=function(t,i,a,o){if(!this.isCompletionRecord()){var p=t.expression;if(r(p)){var l=[],c=s["default"](p.left,l,o,a,!0);return l.push(u.expressionStatement(n(c.ref,e.build(c.uid,p.right)))),l}}},t.AssignmentExpression=function(t,i,a,o){if(r(t)){var u=[],p=s["default"](t.left,u,o,a);return u.push(n(p.ref,e.build(p.uid,t.right))),u}},t.BinaryExpression=function(t){return t.operator===e.operator?e.build(t.left,t.right):void 0},t},t.exports=r["default"]},{179:179,58:58}],54:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){var r=e.blocks.shift();if(r){var n=i(e,t);return n||(n=t(),e.filter&&(n=s.ifStatement(e.filter,s.blockStatement([n])))),s.forOfStatement(s.variableDeclaration("let",[s.variableDeclarator(r.left)]),r.right,s.blockStatement([n]))}}r.__esModule=!0,r["default"]=i;var a=e(179),s=n(a);t.exports=r["default"]},{179:179}],55:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var a=e(514),s=i(a),o=e(43),u=n(o),p=e(403),l=i(p),c=e(62),f=n(c),d=e(179),h=n(d);r["default"]=function(e){var t={};t.JSXIdentifier=function(e){return"this"===e.name&&this.isReferenced()?h.thisExpression():l["default"].keyword.isIdentifierNameES6(e.name)?void(e.type="Identifier"):h.literal(e.name)},t.JSXNamespacedName=function(){throw this.errorWithNode(u.get("JSXNamespacedTags"))},t.JSXMemberExpression={exit:function(e){e.computed=h.isLiteral(e.property),e.type="MemberExpression"}},t.JSXExpressionContainer=function(e){return e.expression},t.JSXAttribute={enter:function(e){var t=e.value;h.isLiteral(t)&&s["default"](t.value)&&(t.value=t.value.replace(/\n\s+/g," "))},exit:function(e){var t=e.value||h.literal(!0);return h.inherits(h.property("init",e.name,t),e)}},t.JSXOpeningElement={exit:function(t,n,i,a){n.children=f.buildChildren(n);var s,o=t.name,u=[];h.isIdentifier(o)?s=o.name:h.isLiteral(o)&&(s=o.value);var p={tagExpr:o,tagName:s,args:u};e.pre&&e.pre(p,a);var l=t.attributes;return l=l.length?r(l,a):h.literal(null),u.push(l),e.post&&e.post(p,a),p.call||h.callExpression(p.callee,u)}};var r=function(e,t){for(var r=[],n=[],i=function(){r.length&&(n.push(h.objectExpression(r)),r=[])};e.length;){var a=e.shift();h.isJSXSpreadAttribute(a)?(i(),n.push(a.argument)):r.push(a)}return i(),1===n.length?e=n[0]:(h.isObjectExpression(n[0])||n.unshift(h.objectExpression([])),e=h.callExpression(t.addHelper("extends"),n)),e};return t.JSXElement={exit:function(e){var t=e.openingElement;return t.arguments=t.arguments.concat(e.children),t.arguments.length>=3&&(t._prettyCall=!0),h.inherits(t,e)}},t},t.exports=r["default"]},{179:179,403:403,43:43,514:514,62:62}],56:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i),s={enter:function(e,t,r,n){(this.isThisExpression()||this.isReferencedIdentifier({name:"arguments"}))&&(n.found=!0,this.stop())},Function:function(){this.skip()}};r["default"]=function(e,t){var r=a.functionExpression(null,[],e.body,e.generator,e.async),n=r,i=[],o={found:!1};t.traverse(e,s,o),o.found&&(n=a.memberExpression(r,a.identifier("apply")),i=[a.thisExpression(),a.identifier("arguments")]);var u=a.callExpression(n,i);return e.generator&&(u=a.yieldExpression(u,!0)),a.returnStatement(u)},t.exports=r["default"]},{179:179}],57:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,r,n){var i=m.toKeyAlias(t),a={};if(d["default"](e,i)&&(a=e[i]),e[i]=a,a._inherits=a._inherits||[],a._inherits.push(t),a._key=t.key,t.computed&&(a._computed=!0),t.decorators){var s=a.decorators=a.decorators||m.arrayExpression([]);s.elements=s.elements.concat(t.decorators.map(function(e){return e.expression}).reverse())}if(a.value||a.initializer)throw n.errorWithNode(t,"Key conflict with sibling node");return t.value&&("init"===t.kind&&(r="value"),"get"===t.kind&&(r="get"),"set"===t.kind&&(r="set"),m.inheritsComments(t.value,t),a[r]=t.value),a}function s(e){for(var t in e)if(e[t]._computed)return!0;return!1}function o(e){for(var t=m.arrayExpression([]),r=0;r<e.properties.length;r++){var n=e.properties[r],i=n.value;i.properties.unshift(m.property("init",m.identifier("key"),m.toComputedKey(n))),t.elements.push(i)}return t}function u(e){var t=m.objectExpression([]);return c["default"](e,function(e){var r=m.objectExpression([]),n=m.property("init",e._key,r,e._computed);c["default"](e,function(e,t){if("_"!==t[0]){var n=e;(m.isMethodDefinition(e)||m.isClassProperty(e))&&(e=e.value);var i=m.property("init",m.identifier(t),e);m.inheritsComments(i,n),m.removeComments(n),r.properties.push(i)}}),t.properties.push(n)}),t}function p(e){return c["default"](e,function(e){e.value&&(e.writable=m.literal(!0)),e.configurable=m.literal(!0),e.enumerable=m.literal(!0)}),u(e)}r.__esModule=!0,r.push=a,r.hasComputed=s,r.toComputedObjectFromClass=o,r.toClassObject=u,r.toDefineObject=p;var l=e(419),c=i(l),f=e(520),d=i(f),h=e(179),m=n(h)},{179:179,419:419,520:520}],58:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i),s=function(e,t,r,n){var i;if(a.isIdentifier(e)){if(n.hasBinding(e.name))return e;i=e}else{if(!a.isMemberExpression(e))throw new Error("We can't explode this node type "+e.type);if(i=e.object,a.isIdentifier(i)&&n.hasGlobal(i.name))return i}var s=n.generateUidIdentifierBasedOnNode(i);return t.push(a.variableDeclaration("var",[a.variableDeclarator(s,i)])),s},o=function(e,t,r,n){var i=e.property,s=a.toComputedKey(e,i);if(a.isLiteral(s))return s;var o=n.generateUidIdentifierBasedOnNode(i);return t.push(a.variableDeclaration("var",[a.variableDeclarator(o,i)])),o};r["default"]=function(e,t,r,n,i){var u;u=a.isIdentifier(e)&&i?e:s(e,t,r,n);var p,l;if(a.isIdentifier(e))p=e,l=u;else{var c=o(e,t,r,n),f=e.computed||a.isLiteral(c);l=p=a.memberExpression(u,c,f)}return{uid:l,ref:p}},t.exports=r["default"]},{179:179}],59:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i);r["default"]=function(e){for(var t=0,r=0;r<e.params.length;r++){var n=e.params[r];a.isAssignmentPattern(n)||a.isRestElement(n)||(t=r+1)}return t},t.exports=r["default"]},{179:179}],60:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i);r["default"]=function(e,t){for(var r=0;r<e.length;r++){var n=e[r],i=n.expression;if(a.isMemberExpression(i)){var s,o=t.maybeGenerateMemoised(i.object),u=[];o?(s=o,u.push(a.assignmentExpression("=",o,i.object))):s=i.object,u.push(a.callExpression(a.memberExpression(a.memberExpression(s,i.property,i.computed),a.identifier("bind")),[s])),1===u.length?n.expression=u[0]:n.expression=a.sequenceExpression(u)}}return e},t.exports=r["default"]},{179:179}],61:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,r,n){if(t.name===n.name){var i=r.getBindingIdentifier(n.name);i===n.outerDeclar&&(n.selfReference=!0,e.stop())}}function s(e,t,r){var n=g(e,t.name,r);return y(n,e,t,r)}function o(e,t,r){var n=h.toComputedKey(e,e.key);if(h.isLiteral(n)){var i=h.toBindingIdentifierName(n.value),a=h.identifier(i),s=e.value,o=g(s,i,r);e.value=y(o,s,a,r)||s}}function u(e,t,r){if(!e.id){var n;if(!h.isProperty(t)||"init"!==t.kind||t.computed&&!h.isLiteral(t.key)){if(!h.isVariableDeclarator(t))return;if(n=t.id,h.isIdentifier(n)){var i=r.parent.getBinding(n.name);if(i&&i.constant&&r.getBinding(n.name)===i)return void(e.id=n)}}else n=t.key;var a;if(h.isLiteral(n))a=n.value;else{if(!h.isIdentifier(n))return;a=n.name}a=h.toBindingIdentifierName(a),n=h.identifier(a);var s=g(e,a,r);return y(s,e,n,r)}}r.__esModule=!0,r.custom=s,r.property=o,r.bare=u;var p=e(59),l=i(p),c=e(182),f=n(c),d=e(179),h=n(d),m={ReferencedIdentifier:function(e,t,r,n){a(this,e,r,n)},BindingIdentifier:function(e,t,r,n){a(this,e,r,n)}},y=function(e,t,r,n){if(e.selfReference){if(!n.hasBinding(r.name)||n.hasGlobal(r.name)){var i="property-method-assignment-wrapper";t.generator&&(i+="-generator");var a=f.template(i,{FUNCTION:t,FUNCTION_ID:r,FUNCTION_KEY:n.generateUidIdentifier(r.name)});a.callee._skipModulesRemap=!0;for(var s=a.callee.body.body[0].params,o=0,u=l["default"](t);u>o;o++)s.push(n.generateUidIdentifier("x"));return a}n.rename(r.name)}t.id=r,n.getProgramParent().references[r.name]=!0},g=function(e,t,r){var n={selfAssignment:!1,selfReference:!1,outerDeclar:r.getBindingIdentifier(t),references:[],name:t},i=r.getOwnBinding(t);return i?"param"===i.kind&&(n.selfReference=!0):(n.outerDeclar||r.hasGlobal(t))&&r.traverse(e,m,n),n}},{179:179,182:182,59:59}],62:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&/^[a-z]|\-/.test(e)}function a(e,t){for(var r=e.value.split(/\r\n|\n|\r/),n=0,i=0;i<r.length;i++)r[i].match(/[^ \t]/)&&(n=i);for(var a="",i=0;i<r.length;i++){var s=r[i],o=0===i,p=i===r.length-1,l=i===n,c=s.replace(/\t/g," ");o||(c=c.replace(/^[ ]+/,"")),p||(c=c.replace(/[ ]+$/,"")),c&&(l||(c+=" "),a+=c)}a&&t.push(u.literal(a))}function s(e){for(var t=[],r=0;r<e.children.length;r++){var n=e.children[r];u.isLiteral(n)&&"string"==typeof n.value?a(n,t):(u.isJSXExpressionContainer(n)&&(n=n.expression),u.isJSXEmptyExpression(n)||t.push(n))}return t}r.__esModule=!0,r.isCompatTag=i,r.buildChildren=s;var o=e(179),u=n(o),p=u.buildMatchMemberExpression("React.Component");r.isReactComponent=p},{179:179}],63:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){return l.isLiteral(e)&&e.regex&&e.regex.flags.indexOf(t)>=0}function s(e,t){var r=e.regex.flags.split("");e.regex.flags.indexOf(t)<0||(u["default"](r,t),e.regex.flags=r.join(""))}r.__esModule=!0,r.is=a,r.pullFlag=s;var o=e(416),u=i(o),p=e(179),l=n(p)},{179:179,416:416}],64:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i),s={Function:function(){this.skip()},AwaitExpression:function(e){e.type="YieldExpression",e.all&&(e.all=!1,e.argument=a.callExpression(a.memberExpression(a.identifier("Promise"),a.identifier("all")),[e.argument]))}},o={ReferencedIdentifier:function(e,t,r,n){var i=n.id.name;return e.name===i&&r.bindingIdentifierEquals(i,n.id)?n.ref=n.ref||r.generateUidIdentifier(i):void 0}};r["default"]=function(e,t){var r=e.node;r.async=!1,r.generator=!0,e.traverse(s,p);var n=a.callExpression(t,[r]),i=r.id;if(r.id=null,a.isFunctionDeclaration(r)){var u=a.variableDeclaration("let",[a.variableDeclarator(i,n)]);return u._blockHoist=!0,u}if(i){var p={id:i};if(e.traverse(o,p),p.ref)return e.scope.parent.push({id:p.ref}),a.assignmentExpression("=",p.ref,n)}return n},t.exports=r["default"]},{179:179}],65:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){return l.isSuper(e)?l.isMemberExpression(t,{computed:!1})?!1:l.isCallExpression(t,{callee:e})?!1:!0:!1}function s(e){return l.isMemberExpression(e)&&l.isSuper(e.object)}r.__esModule=!0;var o=e(43),u=n(o),p=e(179),l=n(p),c={enter:function(e,t,r,n){var i=n.topLevel,a=n.self;if(l.isFunction(e)&&!l.isArrowFunctionExpression(e))return a.traverseLevel(this,!1),this.skip();if(l.isProperty(e,{method:!0})||l.isMethodDefinition(e))return this.skip();var s=i?l.thisExpression:a.getThisReference.bind(a),o=a.specHandle;a.isLoose&&(o=a.looseHandle);var u=o.call(a,this,s);return u&&(this.hasSuper=!0),u!==!0?u:void 0}},f=function(){function e(t){var r=arguments.length<=1||void 0===arguments[1]?!1:arguments[1];i(this,e),this.topLevelThisReference=t.topLevelThisReference,this.methodPath=t.methodPath,this.methodNode=t.methodNode,this.superRef=t.superRef,this.isStatic=t.isStatic,this.hasSuper=!1,this.inClass=r,this.isLoose=t.isLoose,this.scope=t.scope,this.file=t.file,this.opts=t}return e.prototype.getObjectRef=function(){return this.opts.objectRef||this.opts.getObjectRef()},e.prototype.setSuperProperty=function(e,t,r,n){return l.callExpression(this.file.addHelper("set"),[l.callExpression(l.memberExpression(l.identifier("Object"),l.identifier("getPrototypeOf")),[this.isStatic?this.getObjectRef():l.memberExpression(this.getObjectRef(),l.identifier("prototype"))]),r?e:l.literal(e.name),t,n])},e.prototype.getSuperProperty=function(e,t,r){return l.callExpression(this.file.addHelper("get"),[l.callExpression(l.memberExpression(l.identifier("Object"),l.identifier("getPrototypeOf")),[this.isStatic?this.getObjectRef():l.memberExpression(this.getObjectRef(),l.identifier("prototype"))]),t?e:l.literal(e.name),r])},e.prototype.replace=function(){this.traverseLevel(this.methodPath.get("value"),!0)},e.prototype.traverseLevel=function(e,t){var r={self:this,topLevel:t};e.traverse(c,r)},e.prototype.getThisReference=function(){if(this.topLevelThisReference)return this.topLevelThisReference;var e=this.topLevelThisReference=this.scope.generateUidIdentifier("this");return this.methodNode.value.body.body.unshift(l.variableDeclaration("var",[l.variableDeclarator(this.topLevelThisReference,l.thisExpression())])),e},e.prototype.getLooseSuperProperty=function(e,t){var r=this.methodNode,n=r.key,i=this.superRef||l.identifier("Function");return t.property===e?void 0:l.isCallExpression(t,{callee:e})?(t.arguments.unshift(l.thisExpression()),"constructor"===n.name?2===t.arguments.length&&l.isSpreadElement(t.arguments[1])&&l.isIdentifier(t.arguments[1].argument,{name:"arguments"})?(t.arguments[1]=t.arguments[1].argument,l.memberExpression(i,l.identifier("apply"))):l.memberExpression(i,l.identifier("call")):(e=i,r["static"]||(e=l.memberExpression(e,l.identifier("prototype"))),e=l.memberExpression(e,n,r.computed),l.memberExpression(e,l.identifier("call")))):l.isMemberExpression(t)&&!r["static"]?l.memberExpression(i,l.identifier("prototype")):i},e.prototype.looseHandle=function(e,t){var r=e.node;if(e.isSuper())return this.getLooseSuperProperty(r,e.parent);if(e.isCallExpression()){var n=r.callee;if(!l.isMemberExpression(n))return;if(!l.isSuper(n.object))return;return l.appendToMemberExpression(n,l.identifier("call")),r.arguments.unshift(t()),!0}},e.prototype.specHandleAssignmentExpression=function(e,t,r,n){return"="===r.operator?this.setSuperProperty(r.left.property,r.right,r.left.computed,n()):(e=e||t.scope.generateUidIdentifier("ref"),[l.variableDeclaration("var",[l.variableDeclarator(e,r.left)]),l.expressionStatement(l.assignmentExpression("=",r.left,l.binaryExpression(r.operator[0],e,r.right)))])},e.prototype.specHandle=function(e,t){var r,n,i,o,p=this.methodNode,c=e.parent,f=e.node;if(a(f,c))throw e.errorWithNode(u.get("classesIllegalBareSuper"));if(l.isCallExpression(f)){var d=f.callee;if(l.isSuper(d)){if(r=p.key,n=p.computed,i=f.arguments,"constructor"!==p.key.name||!this.inClass){var h=p.key.name||"METHOD_NAME";throw this.file.errorWithNode(f,u.get("classesIllegalSuperCall",h))}}else s(d)&&(r=d.property,n=d.computed,i=f.arguments)}else if(l.isMemberExpression(f)&&l.isSuper(f.object))r=f.property,n=f.computed;else{if(l.isUpdateExpression(f)&&s(f.argument)){var m=l.binaryExpression(f.operator[0],f.argument,l.literal(1));if(f.prefix)return this.specHandleAssignmentExpression(null,e,m,t);var y=e.scope.generateUidIdentifier("ref");return this.specHandleAssignmentExpression(y,e,m,t).concat(l.expressionStatement(y))}if(l.isAssignmentExpression(f)&&s(f.left))return this.specHandleAssignmentExpression(null,e,f,t)}if(r){o=t();var g=this.getSuperProperty(r,n,o);return i?1===i.length&&l.isSpreadElement(i[0])?l.callExpression(l.memberExpression(g,l.identifier("apply")),[o,i[0].argument]):l.callExpression(l.memberExpression(g,l.identifier("call")),[o].concat(i)):g}},e}();r["default"]=f,t.exports=r["default"]},{179:179,43:43}],66:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{
"default":e}}r.__esModule=!0;var a=e(80),s=i(a),o=e(126),u=i(o),p=e(85),l=i(p),c=e(84),f=i(c),d=e(125),h=n(d),m=new s["default"];for(var y in u["default"]){var g=u["default"][y];if("object"==typeof g){var v=g.metadata=g.metadata||{};v.group=v.group||"builtin-basic"}}m.addTransformers(u["default"]),m.addDeprecated(l["default"]),m.addAliases(f["default"]),m.addFilter(h.internal),m.addFilter(h.blacklist),m.addFilter(h.whitelist),m.addFilter(h.stage),m.addFilter(h.optional);var b=m.transform.bind(m);b.fromAst=m.transformFromAst.bind(m),b.pipeline=m,r["default"]=b,t.exports=r["default"]},{125:125,126:126,80:80,84:84,85:85}],67:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var s=e(75),o=i(s),u=e(43),p=i(u),l=e(76),c=n(l),f=e(41),d=n(f),h=e(182),m=i(h),y=e(179),g=i(y),v=function(){function e(t){a(this,e),this.sourceScopes=d["default"](),this.defaultIds=d["default"](),this.ids=d["default"](),this.remaps=new c["default"](t,this),this.scope=t.scope,this.file=t,this.hasNonDefaultExports=!1,this.hasLocalExports=!1,this.hasLocalImports=!1,this.localExports=d["default"](),this.localImports=d["default"](),this.metadata=t.metadata.modules,this.getMetadata()}return e.prototype.addScope=function(e){var t=e.node.source&&e.node.source.value;if(t){var r=this.sourceScopes[t];if(r&&r!==e.scope)throw e.errorWithNode(p.get("modulesDuplicateDeclarations"));this.sourceScopes[t]=e.scope}},e.prototype.isModuleType=function(e,t){var r=this.file.dynamicImportTypes[t];return r&&r.indexOf(e)>=0},e.prototype.transform=function(){this.remapAssignments()},e.prototype.doDefaultExportInterop=function(e){return(g.isExportDefaultDeclaration(e)||g.isSpecifierDefault(e))&&!this.noInteropRequireExport&&!this.hasNonDefaultExports},e.prototype.getMetadata=function(){for(var e=!1,t=this.file.ast.program.body,r=0;r<t.length;r++){var n=t[r];if(g.isModuleDeclaration(n)){e=!0;break}}(e||this.isLoose())&&this.file.path.traverse(o,this)},e.prototype.remapAssignments=function(){(this.hasLocalExports||this.hasLocalImports)&&this.remaps.run()},e.prototype.remapExportAssignment=function(e,t){for(var r=e,n=0;n<t.length;n++)r=g.assignmentExpression("=",g.memberExpression(g.identifier("exports"),t[n]),r);return r},e.prototype._addExport=function(e,t){var r=this.localExports[e]=this.localExports[e]||{binding:this.scope.getBindingIdentifier(e),exported:[]};r.exported.push(t)},e.prototype.getExport=function(e,t){if(g.isIdentifier(e)){var r=this.localExports[e.name];return r&&r.binding===t.getBindingIdentifier(e.name)?r.exported:void 0}},e.prototype.getModuleName=function(){var e=this.file.opts;if(null!=e.moduleId&&!e.getModuleId)return e.moduleId;var t=e.filenameRelative,r="";if(null!=e.moduleRoot&&(r=e.moduleRoot+"/"),!e.filenameRelative)return r+e.filename.replace(/^\//,"");if(null!=e.sourceRoot){var n=new RegExp("^"+e.sourceRoot+"/?");t=t.replace(n,"")}return e.keepModuleIdExtensions||(t=t.replace(/\.(\w*?)$/,"")),r+=t,r=r.replace(/\\/g,"/"),e.getModuleId?e.getModuleId(r)||r:r},e.prototype._pushStatement=function(e,t){return(g.isClass(e)||g.isFunction(e))&&e.id&&(t.push(g.toStatement(e)),e=e.id),e},e.prototype._hoistExport=function(e,t,r){return g.isFunctionDeclaration(e)&&(t._blockHoist=r||2),t},e.prototype.getExternalReference=function(e,t){var r=this.ids,n=e.source.value;return r[n]?r[n]:this.ids[n]=this._getExternalReference(e,t)},e.prototype.checkExportIdentifier=function(e){if(g.isIdentifier(e,{name:"__esModule"}))throw this.file.errorWithNode(e,p.get("modulesIllegalExportName",e.name))},e.prototype.exportAllDeclaration=function(e,t){var r=this.getExternalReference(e,t);t.push(this.buildExportsWildcard(r,e))},e.prototype.isLoose=function(){return this.file.isLoose("es6.modules")},e.prototype.exportSpecifier=function(e,t,r){if(t.source){var n=this.getExternalReference(t,r);if("default"!==e.local.name||this.noInteropRequireExport){if(n=g.memberExpression(n,e.local),!this.isLoose())return void r.push(this.buildExportsFromAssignment(e.exported,n,t))}else n=g.callExpression(this.file.addHelper("interop-require"),[n]);r.push(this.buildExportsAssignment(e.exported,n,t))}else r.push(this.buildExportsAssignment(e.exported,e.local,t))},e.prototype.buildExportsWildcard=function(e){return g.expressionStatement(g.callExpression(this.file.addHelper("defaults"),[g.identifier("exports"),g.callExpression(this.file.addHelper("interop-export-wildcard"),[e,this.file.addHelper("defaults")])]))},e.prototype.buildExportsFromAssignment=function(e,t){return this.checkExportIdentifier(e),m.template("exports-from-assign",{INIT:t,ID:g.literal(e.name)},!0)},e.prototype.buildExportsAssignment=function(e,t){return this.checkExportIdentifier(e),m.template("exports-assign",{VALUE:t,KEY:e},!0)},e.prototype.exportDeclaration=function(e,t){var r=e.declaration,n=r.id;g.isExportDefaultDeclaration(e)&&(n=g.identifier("default"));var i;if(g.isVariableDeclaration(r))for(var a=0;a<r.declarations.length;a++){var s=r.declarations[a];s.init=this.buildExportsAssignment(s.id,s.init,e).expression;var o=g.variableDeclaration(r.kind,[s]);0===a&&g.inherits(o,r),t.push(o)}else{var u=r;(g.isFunctionDeclaration(r)||g.isClassDeclaration(r))&&(u=r.id,t.push(r)),i=this.buildExportsAssignment(n,u,e),t.push(i),this._hoistExport(r,i)}},e}();r["default"]=v,t.exports=r["default"]},{179:179,182:182,41:41,43:43,75:75,76:76}],68:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(182),a=n(i);r["default"]=function(e){var t=function(){this.noInteropRequireImport=!0,this.noInteropRequireExport=!0,e.apply(this,arguments)};return a.inherits(t,e),t},t.exports=r["default"]},{182:182}],69:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var i=e(70),a=n(i),s=e(68),o=n(s);r["default"]=o["default"](a["default"]),t.exports=r["default"]},{68:68,70:70}],70:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}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)}r.__esModule=!0;var o=e(67),u=i(o),p=e(72),l=i(p),c=e(421),f=i(c),d=e(525),h=i(d),m=e(182),y=n(m),g=e(179),v=n(g),b=function(e){function t(){a(this,t),e.apply(this,arguments)}return s(t,e),t.prototype.setup=function(){l["default"].prototype._setup.call(this,this.hasNonDefaultExports)},t.prototype.buildDependencyLiterals=function(){var e=[];for(var t in this.ids)e.push(v.literal(t));return e},t.prototype.transform=function(e){l["default"].prototype.transform.apply(this,arguments);var t=e.body,r=[v.literal("exports")];this.passModuleArg&&r.push(v.literal("module")),r=r.concat(this.buildDependencyLiterals()),r=v.arrayExpression(r);var n=h["default"](this.ids);this.passModuleArg&&n.unshift(v.identifier("module")),n.unshift(v.identifier("exports"));var i=v.functionExpression(null,n,v.blockStatement(t)),a=[r,i],s=this.getModuleName();s&&a.unshift(v.literal(s));var o=v.callExpression(v.identifier("define"),a);e.body=[v.expressionStatement(o)]},t.prototype.getModuleName=function(){return this.file.opts.moduleIds?u["default"].prototype.getModuleName.apply(this,arguments):null},t.prototype._getExternalReference=function(e){return this.scope.generateUidIdentifier(e.source.value)},t.prototype.importDeclaration=function(e){this.getExternalReference(e)},t.prototype.importSpecifier=function(e,t,r,n){var i=t.source.value,a=this.getExternalReference(t);if((v.isImportNamespaceSpecifier(e)||v.isImportDefaultSpecifier(e))&&(this.defaultIds[i]=e.local),this.isModuleType(t,"absolute"));else if(this.isModuleType(t,"absoluteDefault"))this.ids[t.source.value]=a,a=v.memberExpression(a,v.identifier("default"));else if(v.isImportNamespaceSpecifier(e));else if(f["default"](this.file.dynamicImported,t)||!v.isSpecifierDefault(e)||this.noInteropRequireImport){var s=e.imported;v.isSpecifierDefault(e)&&(s=v.identifier("default")),a=v.memberExpression(a,s)}else{var o=n.generateUidIdentifier(e.local.name);r.push(v.variableDeclaration("var",[v.variableDeclarator(o,v.callExpression(this.file.addHelper("interop-require-default"),[a]))])),a=v.memberExpression(o,v.identifier("default"))}this.remaps.add(n,e.local.name,a)},t.prototype.exportSpecifier=function(e,t,r){return this.doDefaultExportInterop(e)&&(this.passModuleArg=!0,e.exported!==e.local&&!t.source)?void r.push(y.template("exports-default-assign",{VALUE:e.local},!0)):void l["default"].prototype.exportSpecifier.apply(this,arguments)},t.prototype.exportDeclaration=function(e,t){if(this.doDefaultExportInterop(e)){this.passModuleArg=!0;var r=e.declaration,n=y.template("exports-default-assign",{VALUE:this._pushStatement(r,t)},!0);return v.isFunctionDeclaration(r)&&(n._blockHoist=3),void t.push(n)}u["default"].prototype.exportDeclaration.apply(this,arguments)},t}(u["default"]);r["default"]=b,t.exports=r["default"]},{179:179,182:182,421:421,525:525,67:67,72:72}],71:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var i=e(72),a=n(i),s=e(68),o=n(s);r["default"]=o["default"](a["default"]),t.exports=r["default"]},{68:68,72:72}],72:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}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)}r.__esModule=!0;var o=e(67),u=i(o),p=e(182),l=n(p),c=e(179),f=n(c),d=function(e){function t(){a(this,t),e.apply(this,arguments)}return s(t,e),t.prototype.setup=function(){this._setup(this.hasLocalExports)},t.prototype._setup=function(e){var t=this.file,r=t.scope;if(r.rename("module"),r.rename("exports"),!this.noInteropRequireImport&&e){var n="exports-module-declaration";this.file.isLoose("es6.modules")&&(n+="-loose");var i=l.template(n,!0);i._blockHoist=3,t.path.unshiftContainer("body",[i])}},t.prototype.transform=function(e){u["default"].prototype.transform.apply(this,arguments),this.hasDefaultOnlyExport&&e.body.push(f.expressionStatement(f.assignmentExpression("=",f.memberExpression(f.identifier("module"),f.identifier("exports")),f.memberExpression(f.identifier("exports"),f.identifier("default")))))},t.prototype.importSpecifier=function(e,t,r,n){var i=e.local,a=this.getExternalReference(t,r);if(f.isSpecifierDefault(e))if(this.isModuleType(t,"absolute"));else if(this.isModuleType(t,"absoluteDefault"))this.remaps.add(n,i.name,a);else if(this.noInteropRequireImport)this.remaps.add(n,i.name,f.memberExpression(a,f.identifier("default")));else{var s=this.scope.generateUidIdentifierBasedOnNode(t,"import");r.push(f.variableDeclaration("var",[f.variableDeclarator(s,f.callExpression(this.file.addHelper("interop-require-default"),[a]))])),this.remaps.add(n,i.name,f.memberExpression(s,f.identifier("default")))}else f.isImportNamespaceSpecifier(e)?(this.noInteropRequireImport||(a=f.callExpression(this.file.addHelper("interop-require-wildcard"),[a])),r.push(f.variableDeclaration("var",[f.variableDeclarator(i,a)]))):this.remaps.add(n,i.name,f.memberExpression(a,f.identifier(e.imported.name)))},t.prototype.importDeclaration=function(e,t){t.push(l.template("require",{MODULE_NAME:e.source},!0))},t.prototype.exportSpecifier=function(e){this.doDefaultExportInterop(e)&&(this.hasDefaultOnlyExport=!0),u["default"].prototype.exportSpecifier.apply(this,arguments)},t.prototype.exportDeclaration=function(e){this.doDefaultExportInterop(e)&&(this.hasDefaultOnlyExport=!0),u["default"].prototype.exportDeclaration.apply(this,arguments)},t.prototype._getExternalReference=function(e,t){var r,n=f.callExpression(f.identifier("require"),[e.source]);this.isModuleType(e,"absolute")||(this.isModuleType(e,"absoluteDefault")?n=f.memberExpression(n,f.identifier("default")):r=this.scope.generateUidIdentifierBasedOnNode(e,"import")),r=r||e.specifiers[0].local;var i=f.variableDeclaration("var",[f.variableDeclarator(r,n)]);return t.push(i),r},t}(u["default"]);r["default"]=d,t.exports=r["default"]},{179:179,182:182,67:67}],73:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}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)}r.__esModule=!0;var o=e(67),u=i(o),p=e(179),l=n(p),c=function(e){function t(){a(this,t),e.apply(this,arguments)}return s(t,e),t.prototype.exportDeclaration=function(e,t){var r=l.toStatement(e.declaration,!0);r&&t.push(l.inherits(r,e))},t.prototype.exportAllDeclaration=function(){},t.prototype.importDeclaration=function(){},t.prototype.importSpecifier=function(){},t.prototype.exportSpecifier=function(){},t.prototype.transform=function(){},t}(u["default"]);r["default"]=c,t.exports=r["default"]},{179:179,67:67}],74:[function(e,t,r){"use strict";r.__esModule=!0,r["default"]={commonStrict:e(71),amdStrict:e(69),umdStrict:e(78),common:e(72),system:e(77),ignore:e(73),amd:e(70),umd:e(79)},t.exports=r["default"]},{69:69,70:70,71:71,72:72,73:73,77:77,78:78,79:79}],75:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,r,n){n.hasLocalExports=!0;var i=e.source?e.source.value:null,a=n.metadata.exports,s=this.get("declaration");if(s.isStatement()){var o=s.getBindingIdentifiers();for(var u in o){var p=o[u];n._addExport(u,p),a.exported.push(u),a.specifiers.push({kind:"local",local:u,exported:this.isExportDefaultDeclaration()?"default":u})}}if(this.isExportNamedDeclaration()&&e.specifiers)for(var c=e.specifiers,f=0;f<c.length;f++){var d=c[f],h=d.exported.name;a.exported.push(h),l.isExportDefaultSpecifier(d)&&a.specifiers.push({kind:"external",local:h,exported:h,source:i}),l.isExportNamespaceSpecifier(d)&&a.specifiers.push({kind:"external-namespace",exported:h,source:i});var m=d.local;m&&(n._addExport(m.name,d.exported),i&&a.specifiers.push({kind:"external",local:m.name,exported:h,source:i}),i||a.specifiers.push({kind:"local",local:m.name,exported:h}))}if(this.isExportAllDeclaration()&&a.specifiers.push({kind:"external-all",source:i}),!l.isExportDefaultDeclaration(e)&&!s.isTypeAlias()){var y=e.specifiers&&1===e.specifiers.length&&l.isSpecifierDefault(e.specifiers[0]);y||(n.hasNonDefaultExports=!0)}}function s(e,t,r,n){n.isLoose()||this.skip()}r.__esModule=!0,r.ExportDeclaration=a,r.Scope=s;var o=e(519),u=i(o),p=e(179),l=n(p),c={enter:function(e,t,r,n){e.source&&(e.source.value=n.file.resolveModuleSource(e.source.value),n.addScope(this))}};r.ModuleDeclaration=c;var f={exit:function(e,t,r,n){n.hasLocalImports=!0;var i=[],a=[];n.metadata.imports.push({source:e.source.value,imported:a,specifiers:i});for(var s=this.get("specifiers"),o=0;o<s.length;o++){var p=s[o],l=p.getBindingIdentifiers();u["default"](n.localImports,l);var c=p.node.local.name;if(p.isImportDefaultSpecifier()&&(a.push("default"),i.push({kind:"named",imported:"default",local:c})),p.isImportSpecifier()){var f=p.node.imported.name;a.push(f),i.push({kind:"named",imported:f,local:c})}p.isImportNamespaceSpecifier()&&(a.push("*"),i.push({kind:"namespace",local:c}))}}};r.ImportDeclaration=f},{179:179,519:519}],76:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var a=e(179),s=n(a),o={enter:function(e){return e._skipModulesRemap?this.skip():void 0},ReferencedIdentifier:function(e,t,r,n){var i=n.formatter,a=n.get(r,e.name);return a&&e!==a&&(!r.hasBinding(e.name)||r.bindingIdentifierEquals(e.name,i.localImports[e.name]))?!i.isLoose()&&"callee"===this.key&&this.parentPath.isCallExpression()?s.sequenceExpression([s.literal(0),a]):a:void 0},AssignmentExpression:{exit:function(e,t,r,n){var i=n.formatter;if(!e._ignoreModulesRemap){var a=i.getExport(e.left,r);if(a)return i.remapExportAssignment(e,a)}}},UpdateExpression:function(e,t,r,n){var i=n.formatter,a=i.getExport(e.argument,r);if(a){this.skip();var o=s.assignmentExpression(e.operator[0]+"=",e.argument,s.literal(1)),u=i.remapExportAssignment(o,a);if(s.isExpressionStatement(t)||e.prefix)return u;var p=[];p.push(u);var l;return l="--"===e.operator?"+":"-",p.push(s.binaryExpression(l,e.argument,s.literal(1))),s.sequenceExpression(p)}}},u=function(){function e(t,r){i(this,e),this.formatter=r,this.file=t}return e.prototype.run=function(){this.file.path.traverse(o,this)},e.prototype._getKey=function(e){return e+":moduleRemap"},e.prototype.get=function(e,t){return e.getData(this._getKey(t))},e.prototype.add=function(e,t,r){return this.all&&this.all.push({name:t,scope:e,node:r}),e.setData(this._getKey(t),r)},e.prototype.remove=function(e,t){return e.removeData(this._getKey(t))},e.prototype.getAll=function(){return this.all},e.prototype.clearAll=function(){if(this.all)for(var e=this.all,t=0;t<e.length;t++){var r=e[t];r.scope.removeData(this._getKey(r.name))}this.all=[]},e}();r["default"]=u,t.exports=r["default"]},{179:179}],77:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}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)}r.__esModule=!0;var o=e(67),u=i(o),p=e(70),l=i(p),c=e(182),f=n(c),d=e(415),h=i(d),m=e(422),y=i(m),g=e(179),v=n(g),b={Function:function(){this.skip()},VariableDeclaration:function(e,t,r,n){if(("var"===e.kind||v.isProgram(t))&&!n.formatter._canHoist(e)){for(var i=[],a=0;a<e.declarations.length;a++){var s=e.declarations[a];if(n.hoistDeclarators.push(v.variableDeclarator(s.id)),s.init){var o=v.expressionStatement(v.assignmentExpression("=",s.id,s.init));i.push(o)}}return v.isFor(t)&&t.left===e?e.declarations[0].id:i}}},E={Function:function(){this.skip()},enter:function(e,t,r,n){(v.isFunctionDeclaration(e)||n.formatter._canHoist(e))&&(n.handlerBody.push(e),this.dangerouslyRemove())}},x={enter:function(e,t,r,n){if(e._importSource===n.source){if(v.isVariableDeclaration(e))for(var i=e.declarations,a=0;a<i.length;a++){var s=i[a];n.hoistDeclarators.push(v.variableDeclarator(s.id)),n.nodes.push(v.expressionStatement(v.assignmentExpression("=",s.id,s.init)))}else n.nodes.push(e);this.dangerouslyRemove()}}},S=function(e){function t(r){a(this,t),e.call(this,r),this._setters=null,this.exportIdentifier=r.scope.generateUidIdentifier("export"),this.noInteropRequireExport=!0,this.noInteropRequireImport=!0,this.remaps.clearAll()}return s(t,e),t.prototype._addImportSource=function(e,t){return e&&(e._importSource=t.source&&t.source.value),e},t.prototype.buildExportsWildcard=function(e,t){var r=this.scope.generateUidIdentifier("key"),n=v.memberExpression(e,r,!0),i=v.variableDeclaration("var",[v.variableDeclarator(r)]),a=e,s=v.blockStatement([v.ifStatement(v.binaryExpression("!==",r,v.literal("default")),v.expressionStatement(this._buildExportCall(r,n)))]);return this._addImportSource(v.forInStatement(i,a,s),t)},t.prototype.buildExportsAssignment=function(e,t,r){var n=this._buildExportCall(v.literal(e.name),t,!0);return this._addImportSource(n,r)},t.prototype.buildExportsFromAssignment=function(){return this.buildExportsAssignment.apply(this,arguments)},t.prototype.remapExportAssignment=function(e,t){for(var r=e,n=0;n<t.length;n++)r=this._buildExportCall(v.literal(t[n].name),r);return r},t.prototype._buildExportCall=function(e,t,r){var n=v.callExpression(this.exportIdentifier,[e,t]);return r?v.expressionStatement(n):n},t.prototype.importSpecifier=function(e,t,r){l["default"].prototype.importSpecifier.apply(this,arguments);for(var n=this.remaps.getAll(),i=0;i<n.length;i++){var a=n[i];r.push(v.variableDeclaration("var",[v.variableDeclarator(v.identifier(a.name),a.node)]))}this.remaps.clearAll(),this._addImportSource(h["default"](r),t)},t.prototype._buildRunnerSetters=function(e,t){var r=this.file.scope;return v.arrayExpression(y["default"](this.ids,function(n,i){var a={hoistDeclarators:t,source:i,nodes:[]};return r.traverse(e,x,a),v.functionExpression(null,[n],v.blockStatement(a.nodes))}))},t.prototype._canHoist=function(e){return e._blockHoist&&!this.file.dynamicImports.length},t.prototype.transform=function(e){u["default"].prototype.transform.apply(this,arguments);var t=[],r=this.getModuleName(),n=v.literal(r),i=v.blockStatement(e.body),a=this._buildRunnerSetters(i,t);this._setters=a;var s=f.template("system",{MODULE_DEPENDENCIES:v.arrayExpression(this.buildDependencyLiterals()),EXPORT_IDENTIFIER:this.exportIdentifier,MODULE_NAME:n,SETTERS:a,EXECUTE:v.functionExpression(null,[],i)},!0),o=s.expression.arguments[2].body.body;r||s.expression.arguments.shift();var p=o.pop();if(this.file.scope.traverse(i,b,{formatter:this,hoistDeclarators:t}),t.length){var l=v.variableDeclaration("var",t);l._blockHoist=!0,o.unshift(l)}this.file.scope.traverse(i,E,{formatter:this,handlerBody:o}),o.push(p),e.body=[s]},t}(l["default"]);r["default"]=S,t.exports=r["default"]},{179:179,182:182,415:415,422:422,67:67,70:70}],78:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var i=e(79),a=n(i),s=e(68),o=n(s);r["default"]=o["default"](a["default"]),t.exports=r["default"]},{68:68,79:79}],79:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}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)}r.__esModule=!0;var o=e(67),u=i(o),p=e(70),l=i(p),c=e(525),f=i(c),d=e(9),h=i(d),m=e(182),y=n(m),g=e(179),v=n(g),b=function(e){function t(){a(this,t),e.apply(this,arguments)}return s(t,e),t.prototype.transform=function(e){u["default"].prototype.transform.apply(this,arguments);var t=e.body,r=[];for(var n in this.ids)r.push(v.literal(n));var i=f["default"](this.ids),a=[v.identifier("exports")];this.passModuleArg&&a.push(v.identifier("module")),a=a.concat(i);var s=v.functionExpression(null,a,v.blockStatement(t)),o=[v.literal("exports")];this.passModuleArg&&o.push(v.literal("module")),o=o.concat(r),o=[v.arrayExpression(o)];var p=y.template("test-exports"),l=y.template("test-module"),c=this.passModuleArg?v.logicalExpression("&&",p,l):p,d=[v.identifier("exports")];this.passModuleArg&&d.push(v.identifier("module")),d=d.concat(r.map(function(e){return v.callExpression(v.identifier("require"),[e])}));var m=[];this.passModuleArg&&m.push(v.identifier("mod"));for(var g in this.ids){var b=this.defaultIds[g]||v.identifier(v.toIdentifier(h["default"].basename(g,h["default"].extname(g))));m.push(v.memberExpression(v.identifier("global"),b))}var E=this.getModuleName();E&&o.unshift(v.literal(E));var x=this.file.opts.basename;E&&(x=E),x=v.identifier(v.toIdentifier(x));var S=y.template("umd-runner-body",{AMD_ARGUMENTS:o,COMMON_TEST:c,COMMON_ARGUMENTS:d,BROWSER_ARGUMENTS:m,GLOBAL_ARG:x});e.body=[v.expressionStatement(v.callExpression(S,[v.thisExpression(),s]))]},t}(l["default"]);r["default"]=b,t.exports=r["default"]},{179:179,182:182,525:525,67:67,70:70,9:9}],80:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var a=e(52),s=n(a),o=e(40),u=n(o),p=e(82),l=n(p),c=e(517),f=n(c),d=e(41),h=n(d),m=e(46),y=n(m),g=function(){function e(){i(this,e),this.transformers=h["default"](),this.namespaces=h["default"](),this.deprecated=h["default"](),this.aliases=h["default"](),this.filters=[]}return e.prototype.addTransformers=function(e){for(var t in e)this.addTransformer(t,e[t]);return this},e.prototype.addTransformer=function(e,t){if(this.transformers[e])throw new Error;var r=e.split(".")[0];this.namespaces[r]=this.namespaces[r]||[],this.namespaces[r].push(e),this.namespaces[e]=r,"function"==typeof t?(t=s["default"].memoisePluginContainer(t),t.key=e,t.metadata.optional=!0,"react.displayName"===e&&(t.metadata.optional=!1)):t=new l["default"](e,t),this.transformers[e]=t},e.prototype.addAliases=function(e){return f["default"](this.aliases,e),this},e.prototype.addDeprecated=function(e){return f["default"](this.deprecated,e),this},e.prototype.addFilter=function(e){return this.filters.push(e),this},e.prototype.canTransform=function(e,t){if(e.metadata.plugin)return!0;for(var r=this.filters,n=0;n<r.length;n++){var i=r[n],a=i(e,t);if(null!=a)return a}return!0},e.prototype.analyze=function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return t.code=!1,this.transform(e,t)},e.prototype.pretransform=function(e,t){var r=new y["default"](t,this);return r.wrap(e,function(){return r.addCode(e),r.parseCode(e),r})},e.prototype.transform=function(e,t){var r=new y["default"](t,this);return r.wrap(e,function(){return r.addCode(e),r.parseCode(e),r.transform()})},e.prototype.transformFromAst=function(e,t,r){e=u["default"](e);var n=new y["default"](r,this);return n.wrap(t,function(){return n.addCode(t),n.addAst(e),n.transform()})},e.prototype._ensureTransformerNames=function(e,t){for(var r=[],n=0;n<t.length;n++){var i=t[n],a=this.deprecated[i],s=this.aliases[i];if(s)r.push(s);else if(a)console.error("[BABEL] The transformer "+i+" has been renamed to "+a),t.push(a);else if(this.transformers[i])r.push(i);else{if(!this.namespaces[i])throw new ReferenceError("Unknown transformer "+i+" specified in "+e);r=r.concat(this.namespaces[i])}}return r},e}();r["default"]=g,t.exports=r["default"]},{40:40,41:41,46:46,517:517,52:52,82:82}],81:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var a=e(148),s=n(a),o=function(){function e(t,r){i(this,e),this.plugin=r,this.file=t,this.key=r.key,this.canTransform()&&r.metadata.experimental&&!t.opts.experimental&&t.log.warn("THE TRANSFORMER "+this.key+" HAS BEEN MARKED AS EXPERIMENTAL AND IS WIP. USE AT YOUR OWN RISK. THIS WILL HIGHLY LIKELY BREAK YOUR CODE SO USE WITH **EXTREME** CAUTION. ENABLE THE `experimental` OPTION TO IGNORE THIS WARNING.")}return e.prototype.canTransform=function(){return this.file.transformerDependencies[this.key]||this.file.pipeline.canTransform(this.plugin,this.file.opts)},e.prototype.transform=function(){var e=this.file;e.log.debug("Start transformer "+this.key),s["default"](e.ast,this.plugin.visitor,e.scope,e),e.log.debug("Finish transformer "+this.key)},e}();r["default"]=o,t.exports=r["default"]},{148:148}],82:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var s=e(81),o=i(s),u=e(43),p=n(u),l=e(148),c=i(l),f=e(517),d=i(f),h=e(502),m=i(h),y=e(46),g=i(y),v=e(179),b=n(v),E=["visitor","metadata","manipulateOptions","post","pre"],x=["dependencies","optional","stage","group","experimental","secondPass"],S=function(){function e(t,r){a(this,e),e.validate(t,r),r=d["default"]({},r);var n=function(e){var t=r[e];return delete r[e],t};this.manipulateOptions=n("manipulateOptions"),this.metadata=n("metadata")||{},this.dependencies=this.metadata.dependencies||[],this.post=n("post"),this.pre=n("pre"),null!=this.metadata.stage&&(this.metadata.optional=!0),this.visitor=this.normalize(m["default"](n("visitor"))||{}),this.key=t}return e.validate=function(e,t){for(var r in t)if("_"!==r[0]&&!(E.indexOf(r)>=0)){var n="pluginInvalidProperty";throw b.TYPES.indexOf(r)>=0&&(n="pluginInvalidPropertyVisitor"),new Error(p.get(n,e,r))}for(var r in t.metadata)if(!(x.indexOf(r)>=0))throw new Error(p.get("pluginInvalidProperty",e,"metadata."+r))},e.prototype.normalize=function(e){return c["default"].explode(e),e},e.prototype.buildPass=function(e){if(!(e instanceof g["default"]))throw new TypeError(p.get("pluginNotFile",this.key));return new o["default"](e,this)},e}();r["default"]=S,t.exports=r["default"]},{148:148,179:179,43:43,46:46,502:502,517:517,81:81}],83:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var a=e(82),s=n(a),o=function u(e,t){i(this,u);var r={};return r.metadata=t.metadata,delete t.metadata,r.visitor=t,new s["default"](e,r)};r["default"]=o,t.exports=r["default"]},{82:82}],84:[function(e,t,r){t.exports={useStrict:"strict","es5.runtime":"runtime","es6.runtime":"runtime","minification.inlineExpressions":"minification.constantFolding"}},{}],85:[function(e,t,r){t.exports={selfContained:"runtime","unicode-regex":"regex.unicode","spec.typeofSymbol":"es6.spec.symbols","es6.symbols":"es6.spec.symbols","es6.blockScopingTDZ":"es6.spec.blockScoping","utility.inlineExpressions":"minification.constantFolding","utility.deadCodeElimination":"minification.deadCodeElimination","utility.removeConsoleCalls":"minification.removeConsole","utility.removeDebugger":"minification.removeDebugger","es6.parameters.rest":"es6.parameters","es6.parameters.default":"es6.parameters"}},{}],86:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i),s={group:"builtin-trailing"
};r.metadata=s;var o={MemberExpression:{exit:function(e){var t=e.property;e.computed||!a.isIdentifier(t)||a.isValidIdentifier(t.name)||(e.property=a.literal(t.name),e.computed=!0)}}};r.visitor=o},{179:179}],87:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i),s={group:"builtin-trailing"};r.metadata=s;var o={Property:{exit:function(e){var t=e.key;e.computed||!a.isIdentifier(t)||a.isValidIdentifier(t.name)||(e.key=a.literal(t.name))}}};r.visitor=o},{179:179}],88:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(57),a=n(i),s=e(179),o=n(s),u={ObjectExpression:function(e,t,r,n){for(var i=!1,s=e.properties,u=0;u<s.length;u++){var p=s[u];if("get"===p.kind||"set"===p.kind){i=!0;break}}if(i){var l={};return e.properties=e.properties.filter(function(e){return"get"===e.kind||"set"===e.kind?(a.push(l,e,e.kind,n),!1):!0}),o.callExpression(o.memberExpression(o.identifier("Object"),o.identifier("defineProperties")),[e,a.toDefineObject(l)])}}};r.visitor=u},{179:179,57:57}],89:[function(e,t,r){"use strict";r.__esModule=!0;var n={ArrowFunctionExpression:function(e){this.ensureBlock(),e.expression=!1,e.type="FunctionExpression",e.shadow=e.shadow||!0}};r.visitor=n},{}],90:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!b.isVariableDeclaration(e))return!1;if(e._let)return!0;if("let"!==e.kind)return!1;if(o(e,t))for(var r=0;r<e.declarations.length;r++){var n=e.declarations[r];n.init=n.init||b.identifier("undefined")}return e._let=!0,e.kind="var",!0}function o(e,t){return!b.isFor(t)||!b.isFor(t,{left:e})}function u(e,t){return b.isVariableDeclaration(e,{kind:"var"})&&!s(e,t)}function p(e){for(var t=e,r=0;r<t.length;r++){var n=t[r];delete n._let}}function l(e,t,r,n){var i=n[e.name];if(i){var a=r.getBindingIdentifier(e.name);a===i.binding?e.name=i.uid:this&&this.skip()}}function c(e,t,r,n){if(b.isIdentifier(e)&&l(e,t,r,n),b.isAssignmentExpression(e)){var i=b.getBindingIdentifiers(e);for(var a in i)l(i[a],t,r,n)}r.traverse(e,w,n)}r.__esModule=!0;var f=e(148),d=i(f),h=e(41),m=i(h),y=e(182),g=n(y),v=e(179),b=n(v),E=e(525),x=i(E),S=e(519),A=i(S),D={group:"builtin-advanced"};r.metadata=D;var C={VariableDeclaration:function(e,t,r,n){if(s(e,t)&&o(e)&&n.transformers["es6.spec.blockScoping"].canTransform()){for(var i=[e],a=0;a<e.declarations.length;a++){var u=e.declarations[a];if(u.init){var p=b.assignmentExpression("=",u.id,u.init);p._ignoreBlockScopingTDZ=!0,i.push(b.expressionStatement(p))}u.init=n.addHelper("temporal-undefined")}return e._blockHoist=2,i}},Loop:function(e,t,r,n){var i=e.left||e.init;s(i,e)&&(b.ensureBlock(e),e.body._letDeclarators=[i]);var a=new M(this,this.get("body"),t,r,n);return a.run()},"BlockStatement|Program":function(e,t,r,n){if(!b.isLoop(t)){var i=new M(null,this,t,r,n);i.run()}}};r.visitor=C;var w={ReferencedIdentifier:l,AssignmentExpression:function(e,t,r,n){var i=this.getBindingIdentifiers();for(var a in i)l(i[a],e,r,n)}},I={Function:function(e,t,r,n){return this.traverse(_,n),this.skip()}},_={ReferencedIdentifier:function(e,t,r,n){var i=n.letReferences[e.name];if(i){var a=r.getBindingIdentifier(e.name);a&&a!==i||(n.closurify=!0)}}},F={enter:function(e,t,r,n){if(this.isForStatement()){if(u(e.init,e)){var i=n.pushDeclar(e.init);1===i.length?e.init=i[0]:e.init=b.sequenceExpression(i)}}else if(this.isFor())u(e.left,e)&&(n.pushDeclar(e.left),e.left=e.left.declarations[0].id);else{if(u(e,t))return n.pushDeclar(e).map(b.expressionStatement);if(this.isFunction())return this.skip()}}},k={LabeledStatement:function(e,t,r,n){n.innerLabels.push(e.label.name)}},P={enter:function(e,t,r,n){if(this.isAssignmentExpression()||this.isUpdateExpression()){var i=this.getBindingIdentifiers();for(var a in i)n.outsideReferences[a]===r.getBindingIdentifier(a)&&(n.reassignments[a]=!0)}}},B=function(e){return b.isBreakStatement(e)?"break":b.isContinueStatement(e)?"continue":void 0},T={Loop:function(e,t,r,n){var i=n.ignoreLabeless;n.ignoreLabeless=!0,this.traverse(T,n),n.ignoreLabeless=i,this.skip()},Function:function(){this.skip()},SwitchCase:function(e,t,r,n){var i=n.inSwitchCase;n.inSwitchCase=!0,this.traverse(T,n),n.inSwitchCase=i,this.skip()},enter:function(e,t,r,n){var i,a=B(e);if(a){if(e.label){if(n.innerLabels.indexOf(e.label.name)>=0)return;a=a+"|"+e.label.name}else{if(n.ignoreLabeless)return;if(n.inSwitchCase)return;if(b.isBreakStatement(e)&&b.isSwitchCase(t))return}n.hasBreakContinue=!0,n.map[a]=e,i=b.literal(a)}return this.isReturnStatement()&&(n.hasReturn=!0,i=b.objectExpression([b.property("init",b.identifier("v"),e.argument||b.identifier("undefined"))])),i?(i=b.returnStatement(i),this.skip(),b.inherits(i,e)):void 0}},M=function(){function e(t,r,n,i,s){a(this,e),this.parent=n,this.scope=i,this.file=s,this.blockPath=r,this.block=r.node,this.outsideLetReferences=m["default"](),this.hasLetReferences=!1,this.letReferences=this.block._letReferences=m["default"](),this.body=[],t&&(this.loopParent=t.parent,this.loopLabel=b.isLabeledStatement(this.loopParent)&&this.loopParent.label,this.loopPath=t,this.loop=t.node)}return e.prototype.run=function(){var e=this.block;if(!e._letDone){e._letDone=!0;var t=this.getLetReferences();if(!b.isFunction(this.parent)&&!b.isProgram(this.block)&&this.hasLetReferences)return t?this.wrapClosure():this.remap(),this.loopLabel&&!b.isLabeledStatement(this.loopParent)?b.labeledStatement(this.loopLabel,this.loop):void 0}},e.prototype.remap=function(){var e=!1,t=this.letReferences,r=this.scope,n=m["default"]();for(var i in t){var a=t[i];if(r.parentHasBinding(i)||r.hasGlobal(i)){var s=r.generateUidIdentifier(a.name).name;a.name=s,e=!0,n[i]=n[s]={binding:a,uid:s}}}if(e){var o=this.loop;o&&(c(o.right,o,r,n),c(o.test,o,r,n),c(o.update,o,r,n)),this.blockPath.traverse(w,n)}},e.prototype.wrapClosure=function(){var e=this.block,t=this.outsideLetReferences;if(this.loop)for(var r in t){var n=t[r];(this.scope.hasGlobal(n.name)||this.scope.parentHasBinding(n.name))&&(delete t[n.name],delete this.letReferences[n.name],this.scope.rename(n.name),this.letReferences[n.name]=n,t[n.name]=n)}this.has=this.checkLoop(),this.hoistVarDeclarations();var i=x["default"](t),a=x["default"](t),s=b.functionExpression(null,i,b.blockStatement(e.body));s.shadow=!0,this.addContinuations(s),e.body=this.body;var o=s;this.loop&&(o=this.scope.generateUidIdentifier("loop"),this.loopPath.insertBefore(b.variableDeclaration("var",[b.variableDeclarator(o,s)])));var u=b.callExpression(o,a),p=this.scope.generateUidIdentifier("ret"),l=d["default"].hasType(s.body,this.scope,"YieldExpression",b.FUNCTION_TYPES);l&&(s.generator=!0,u=b.yieldExpression(u,!0));var c=d["default"].hasType(s.body,this.scope,"AwaitExpression",b.FUNCTION_TYPES);c&&(s.async=!0,u=b.awaitExpression(u)),this.buildClosure(p,u)},e.prototype.buildClosure=function(e,t){var r=this.has;r.hasReturn||r.hasBreakContinue?this.buildHas(e,t):this.body.push(b.expressionStatement(t))},e.prototype.addContinuations=function(e){var t={reassignments:{},outsideReferences:this.outsideLetReferences};this.scope.traverse(e,P,t);for(var r=0;r<e.params.length;r++){var n=e.params[r];if(t.reassignments[n.name]){var i=this.scope.generateUidIdentifier(n.name);e.params[r]=i,this.scope.rename(n.name,i.name,e),e.body.body.push(b.expressionStatement(b.assignmentExpression("=",n,i)))}}},e.prototype.getLetReferences=function(){for(var e=this.block,t=e._letDeclarators||[],r=0;r<t.length;r++){var n=t[r];A["default"](this.outsideLetReferences,b.getBindingIdentifiers(n))}if(e.body)for(var r=0;r<e.body.length;r++){var n=e.body[r];s(n,e)&&(t=t.concat(n.declarations))}for(var r=0;r<t.length;r++){var n=t[r],i=b.getBindingIdentifiers(n);A["default"](this.letReferences,i),this.hasLetReferences=!0}if(this.hasLetReferences){p(t);var a={letReferences:this.letReferences,closurify:!1};return this.blockPath.traverse(I,a),a.closurify}},e.prototype.checkLoop=function(){var e={hasBreakContinue:!1,ignoreLabeless:!1,inSwitchCase:!1,innerLabels:[],hasReturn:!1,isLoop:!!this.loop,map:{}};return this.blockPath.traverse(k,e),this.blockPath.traverse(T,e),e},e.prototype.hoistVarDeclarations=function(){this.blockPath.traverse(F,this)},e.prototype.pushDeclar=function(e){var t=[],r=b.getBindingIdentifiers(e);for(var n in r)t.push(b.variableDeclarator(r[n]));this.body.push(b.variableDeclaration(e.kind,t));for(var i=[],a=0;a<e.declarations.length;a++){var s=e.declarations[a];if(s.init){var o=b.assignmentExpression("=",s.id,s.init);i.push(b.inherits(o,s))}}return i},e.prototype.buildHas=function(e,t){var r=this.body;r.push(b.variableDeclaration("var",[b.variableDeclarator(e,t)]));var n,i=this.has,a=[];if(i.hasReturn&&(n=g.template("let-scoping-return",{RETURN:e})),i.hasBreakContinue){for(var s in i.map)a.push(b.switchCase(b.literal(s),[i.map[s]]));if(i.hasReturn&&a.push(b.switchCase(null,[n])),1===a.length){var o=a[0];r.push(this.file.attachAuxiliaryComment(b.ifStatement(b.binaryExpression("===",e,o.test),o.consequent[0])))}else{for(var u=0;u<a.length;u++){var p=a[u].consequent[0];b.isBreakStatement(p)&&!p.label&&(p.label=this.loopLabel=this.loopLabel||this.file.scope.generateUidIdentifier("loop"))}r.push(this.file.attachAuxiliaryComment(b.switchStatement(e,a)))}}else i.hasReturn&&r.push(this.file.attachAuxiliaryComment(n))},e}()},{148:148,179:179,182:182,41:41,519:519,525:525}],91:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var a=e(92),s=i(a),o=e(93),u=i(o),p=e(179),l=n(p),c=e(61),f={ClassDeclaration:function(e){return l.variableDeclaration("let",[l.variableDeclarator(e.id,l.toExpression(e))])},ClassExpression:function(e,t,r,n){var i=c.bare(e,t,r);return i?i:n.isLoose("es6.classes")?new s["default"](this,n).run():new u["default"](this,n).run()}};r.visitor=f},{179:179,61:61,92:92,93:93}],92:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}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)}r.__esModule=!0;var o=e(93),u=i(o),p=e(179),l=n(p),c=function(e){function t(){a(this,t),e.apply(this,arguments),this.isLoose=!0}return s(t,e),t.prototype._processMethod=function(e){if(!e.decorators){var t=this.classRef;e["static"]||(t=l.memberExpression(t,l.identifier("prototype")));var r=l.memberExpression(t,e.key,e.computed||l.isLiteral(e.key)),n=l.expressionStatement(l.assignmentExpression("=",r,e.value));return l.inheritsComments(n,e),this.body.push(n),!0}},t}(u["default"]);r["default"]=c,t.exports=r["default"]},{179:179,93:93}],93:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var s=e(60),o=i(s),u=e(65),p=i(u),l=e(61),c=n(l),f=e(57),d=n(f),h=e(43),m=n(h),y=e(182),g=n(y),v=e(179),b=n(v),E="__initializeProperties",x={Identifier:{enter:function(e,t,r,n){this.parentPath.isClassProperty({key:e})||this.isReferenced()&&r.getBinding(e.name)===n.scope.getBinding(e.name)&&(n.references[e.name]=!0)}}},S={MethodDefinition:function(){this.skip()},Property:function(e){e.method&&this.skip()},CallExpression:{exit:function(e,t,r,n){if(this.get("callee").isSuper()&&(n.hasBareSuper=!0,n.bareSuper=this,!n.isDerived))throw this.errorWithNode("super call is only allowed in derived constructor")}},"FunctionDeclaration|FunctionExpression":function(){this.skip()},ThisExpression:function(e,t,r,n){if(n.isDerived&&!n.hasBareSuper){if(this.inShadow()){var i=n.constructorPath.getData("this");return i||(i=n.constructorPath.setData("this",n.constructorPath.scope.generateUidIdentifier("this"))),i}throw this.errorWithNode("'this' is not allowed before super()")}},Super:function(e,t,r,n){if(n.isDerived&&!n.hasBareSuper&&!this.parentPath.isCallExpression({callee:e}))throw this.errorWithNode("'super.*' is not allowed before super()")}},A=function(){function e(t,r){a(this,e),this.parent=t.parent,this.scope=t.scope,this.node=t.node,this.path=t,this.file=r,this.clearDescriptors(),this.instancePropBody=[],this.instancePropRefs={},this.staticPropBody=[],this.body=[],this.pushedConstructor=!1,this.pushedInherits=!1,this.hasDecorators=!1,this.isLoose=!1,this.classId=this.node.id,this.classRef=this.node.id||this.scope.generateUidIdentifier("class"),this.directRef=null,this.superName=this.node.superClass||b.identifier("Function"),this.isDerived=!!this.node.superClass}return e.prototype.run=function(){var e=this.superName,t=this.file,r=this.body,n=this.constructorBody=b.blockStatement([]);this.constructor=this.buildConstructor();var i=[],a=[];this.isDerived&&(a.push(e),e=this.scope.generateUidIdentifierBasedOnNode(e),i.push(e),this.superName=e);var s=this.node.decorators;if(s?this.directRef=this.scope.generateUidIdentifier(this.classRef):this.directRef=this.classRef,this.buildBody(),n.body.unshift(b.expressionStatement(b.callExpression(t.addHelper("class-call-check"),[b.thisExpression(),this.directRef]))),this.pushDecorators(),r=r.concat(this.staticPropBody),this.classId&&1===r.length)return b.toExpression(r[0]);r.push(b.returnStatement(this.classRef));var o=b.functionExpression(null,i,b.blockStatement(r));return o.shadow=!0,b.callExpression(o,a)},e.prototype.buildConstructor=function(){var e=b.functionDeclaration(this.classRef,[],this.constructorBody);return b.inherits(e,this.node),e},e.prototype.pushToMap=function(e,t){var r,n=arguments.length<=2||void 0===arguments[2]?"value":arguments[2];e["static"]?(this.hasStaticDescriptors=!0,r=this.staticMutatorMap):(this.hasInstanceDescriptors=!0,r=this.instanceMutatorMap);var i=d.push(r,e,n,this.file);t&&(i.enumerable=b.literal(!0)),i.decorators&&(this.hasDecorators=!0)},e.prototype.constructorMeMaybe=function(){for(var e=!1,t=this.path.get("body.body"),r=t,n=0;n<r.length;n++){var i=r[n];if(e=i.equals("kind","constructor"))break}if(!e){var a;a=this.isDerived?g.template("class-derived-default-constructor"):b.functionExpression(null,[],b.blockStatement([])),this.path.get("body").unshiftContainer("body",b.methodDefinition(b.identifier("constructor"),a,"constructor"))}},e.prototype.buildBody=function(){if(this.constructorMeMaybe(),this.pushBody(),this.placePropertyInitializers(),this.userConstructor){var e=this.constructorBody;e.body=e.body.concat(this.userConstructor.body.body),b.inherits(this.constructor,this.userConstructor),b.inherits(e,this.userConstructor.body)}this.pushDescriptors()},e.prototype.pushBody=function(){for(var e=this.path.get("body.body"),t=e,r=0;r<t.length;r++){var n=t[r],i=n.node;if(i.decorators&&o["default"](i.decorators,this.scope),b.isMethodDefinition(i)){var a="constructor"===i.kind;a&&this.verifyConstructor(n);var s=new p["default"]({methodPath:n,methodNode:i,objectRef:this.directRef,superRef:this.superName,isStatic:i["static"],isLoose:this.isLoose,scope:this.scope,file:this.file},!0);s.replace(),a?this.pushConstructor(i,n):this.pushMethod(i,n)}else b.isClassProperty(i)&&this.pushProperty(i,n)}},e.prototype.clearDescriptors=function(){this.hasInstanceDescriptors=!1,this.hasStaticDescriptors=!1,this.instanceMutatorMap={},this.staticMutatorMap={}},e.prototype.pushDescriptors=function(){this.pushInherits();var e,t,r=this.body,n="create-class";if(this.hasDecorators&&(n="create-decorated-class"),this.hasInstanceDescriptors&&(e=d.toClassObject(this.instanceMutatorMap)),this.hasStaticDescriptors&&(t=d.toClassObject(this.staticMutatorMap)),e||t){e&&(e=d.toComputedObjectFromClass(e)),t&&(t=d.toComputedObjectFromClass(t));var i=b.literal(null),a=[this.classRef,i,i,i,i];e&&(a[1]=e),t&&(a[2]=t),this.instanceInitializersId&&(a[3]=this.instanceInitializersId,r.unshift(this.buildObjectAssignment(this.instanceInitializersId))),this.staticInitializersId&&(a[4]=this.staticInitializersId,r.unshift(this.buildObjectAssignment(this.staticInitializersId)));for(var s=0,o=0;o<a.length;o++)a[o]!==i&&(s=o);a=a.slice(0,s+1),r.push(b.expressionStatement(b.callExpression(this.file.addHelper(n),a)))}this.clearDescriptors()},e.prototype.buildObjectAssignment=function(e){return b.variableDeclaration("var",[b.variableDeclarator(e,b.objectExpression([]))])},e.prototype.placePropertyInitializers=function(){var e=this.instancePropBody;if(e.length)if(this.hasPropertyCollision()){var t=b.expressionStatement(b.callExpression(b.memberExpression(b.thisExpression(),b.identifier(E)),[]));this.pushMethod(b.methodDefinition(b.identifier(E),b.functionExpression(null,[],b.blockStatement(e))),null,!0),this.isDerived?this.bareSuper.insertAfter(t):this.constructorBody.body.unshift(t)}else this.isDerived?this.bareSuper.insertAfter(e):this.constructorBody.body=e.concat(this.constructorBody.body)},e.prototype.hasPropertyCollision=function(){if(this.userConstructorPath)for(var e in this.instancePropRefs)if(this.userConstructorPath.scope.hasOwnBinding(e))return!0;return!1},e.prototype.verifyConstructor=function(e){var t={constructorPath:e.get("value"),hasBareSuper:!1,bareSuper:null,isDerived:this.isDerived,file:this.file};t.constructorPath.traverse(S,t);var r=t.constructorPath.getData("this");if(r&&t.bareSuper&&t.bareSuper.insertAfter(b.variableDeclaration("var",[b.variableDeclarator(r,b.thisExpression())])),this.bareSuper=t.bareSuper,!t.hasBareSuper&&this.isDerived)throw e.errorWithNode("Derived constructor must call super()")},e.prototype.pushMethod=function(e,t,r){if(!r&&b.isLiteral(b.toComputedKey(e),{value:E}))throw this.file.errorWithNode(e,m.get("illegalMethodName",E));"method"===e.kind&&(c.property(e,this.file,t?t.get("value").scope:this.scope),this._processMethod(e))||this.pushToMap(e)},e.prototype._processMethod=function(){return!1},e.prototype.pushProperty=function(e,t){if(t.traverse(x,{references:this.instancePropRefs,scope:this.scope}),e.decorators){var r=[];e.value?(r.push(b.returnStatement(e.value)),e.value=b.functionExpression(null,[],b.blockStatement(r))):e.value=b.literal(null),this.pushToMap(e,!0,"initializer");var n,i;e["static"]?(n=this.staticInitializersId=this.staticInitializersId||this.scope.generateUidIdentifier("staticInitializers"),r=this.staticPropBody,i=this.classRef):(n=this.instanceInitializersId=this.instanceInitializersId||this.scope.generateUidIdentifier("instanceInitializers"),r=this.instancePropBody,i=b.thisExpression()),r.push(b.expressionStatement(b.callExpression(this.file.addHelper("define-decorated-property-descriptor"),[i,b.literal(e.key.name),n])))}else{if(!e.value&&!e.decorators)return;e["static"]?this.pushToMap(e,!0):e.value&&this.instancePropBody.push(b.expressionStatement(b.assignmentExpression("=",b.memberExpression(b.thisExpression(),e.key),e.value)))}},e.prototype.pushConstructor=function(e,t){var r=t.get("value");r.scope.hasOwnBinding(this.classRef.name)&&r.scope.rename(this.classRef.name);var n=this.constructor,i=e.value;this.userConstructorPath=r,this.userConstructor=i,this.hasConstructor=!0,b.inheritsComments(n,e),n._ignoreUserWhitespace=!0,n.params=i.params,b.inherits(n.body,i.body),this._pushConstructor()},e.prototype._pushConstructor=function(){this.pushedConstructor||(this.pushedConstructor=!0,(this.hasInstanceDescriptors||this.hasStaticDescriptors)&&this.pushDescriptors(),this.body.push(this.constructor),this.pushInherits())},e.prototype.pushInherits=function(){this.isDerived&&!this.pushedInherits&&(this.pushedInherits=!0,this.body.unshift(b.expressionStatement(b.callExpression(this.file.addHelper("inherits"),[this.classRef,this.superName]))))},e.prototype.pushDecorators=function(){var e=this.node.decorators;if(e){this.body.push(b.variableDeclaration("var",[b.variableDeclarator(this.directRef,this.classRef)])),e=e.reverse();for(var t=e,r=0;r<t.length;r++){var n=t[r],i=g.template("class-decorator",{DECORATOR:n.expression,CLASS_REF:this.classRef},!0);i.expression._ignoreModulesRemap=!0,this.body.push(i)}}},e}();r["default"]=A,t.exports=r["default"]},{179:179,182:182,43:43,57:57,60:60,61:61,65:65}],94:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(43),a=n(i),s={Scope:function(e,t,r){for(var n in r.bindings){var i=r.bindings[n];if("const"===i.kind||"module"===i.kind)for(var s=i.constantViolations,o=0;o<s.length;o++){var u=s[o];throw u.errorWithNode(a.get("readOnly",n))}}},VariableDeclaration:function(e){"const"===e.kind&&(e.kind="let")}};r.visitor=s},{43:43}],95:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e){for(var t=0;t<e.declarations.length;t++)if(l.isPattern(e.declarations[t].id))return!0;return!1}function s(e){for(var t=0;t<e.elements.length;t++)if(l.isRestElement(e.elements[t]))return!0;return!1}r.__esModule=!0;var o=e(43),u=n(o),p=e(179),l=n(p),c={group:"builtin-advanced"};r.metadata=c;var f={ForXStatement:function(e,t,r,n){var i=e.left;if(l.isPattern(i)){var a=r.generateUidIdentifier("ref");return e.left=l.variableDeclaration("var",[l.variableDeclarator(a)]),this.ensureBlock(),void e.body.body.unshift(l.variableDeclaration("var",[l.variableDeclarator(i,a)]))}if(l.isVariableDeclaration(i)){var s=i.declarations[0].id;if(l.isPattern(s)){var o=r.generateUidIdentifier("ref");e.left=l.variableDeclaration(i.kind,[l.variableDeclarator(o,null)]);var u=[],p=new h({kind:i.kind,file:n,scope:r,nodes:u});p.init(s,o),this.ensureBlock();var c=e.body;c.body=u.concat(c.body)}}},Function:function(e,t,r,n){for(var i=!1,a=e.params,s=0;s<a.length;s++){var o=a[s];if(l.isPattern(o)){i=!0;break}}if(i){for(var u=[],p=0;p<e.params.length;p++){var o=e.params[p];if(l.isPattern(o)){var c=r.generateUidIdentifier("ref");if(l.isAssignmentPattern(o)){var f=o;o=o.left,f.left=c}else e.params[p]=c;l.inherits(c,o);var d=new h({blockHoist:e.params.length-p,nodes:u,scope:r,file:n,kind:"let"});d.init(o,c)}}this.ensureBlock();var m=e.body;m.body=u.concat(m.body)}},CatchClause:function(e,t,r,n){var i=e.param;if(l.isPattern(i)){var a=r.generateUidIdentifier("ref");e.param=a;var s=[],o=new h({kind:"let",file:n,scope:r,nodes:s});o.init(i,a),e.body.body=s.concat(e.body.body)}},AssignmentExpression:function(e,t,r,n){if(l.isPattern(e.left)){var i,a=[],s=new h({operator:e.operator,file:n,scope:r,nodes:a});return(this.isCompletionRecord()||!this.parentPath.isExpressionStatement())&&(i=r.generateUidIdentifierBasedOnNode(e.right,"ref"),a.push(l.variableDeclaration("var",[l.variableDeclarator(i,e.right)])),l.isArrayExpression(e.right)&&(s.arrays[i.name]=!0)),s.init(e.left,i||e.right),i&&a.push(l.expressionStatement(i)),a}},VariableDeclaration:function(e,t,r,n){if(!l.isForXStatement(t)&&a(e)){for(var i,s=[],o=0;o<e.declarations.length;o++){i=e.declarations[o];var p=i.init,c=i.id,f=new h({nodes:s,scope:r,kind:e.kind,file:n});l.isPattern(c)?(f.init(c,p),+o!==e.declarations.length-1&&l.inherits(s[s.length-1],i)):s.push(l.inherits(f.buildVariableAssignment(i.id,i.init),i))}if(!l.isProgram(t)&&!l.isBlockStatement(t)){for(i=null,o=0;o<s.length;o++){if(e=s[o],i=i||l.variableDeclaration(e.kind,[]),!l.isVariableDeclaration(e)&&i.kind!==e.kind)throw n.errorWithNode(e,u.get("invalidParentForThisNode"));i.declarations=i.declarations.concat(e.declarations)}return i}return s}}};r.visitor=f;var d={ReferencedIdentifier:function(e,t,r,n){n.bindings[e.name]&&(n.deopt=!0,this.stop())}},h=function(){function e(t){i(this,e),this.blockHoist=t.blockHoist,this.operator=t.operator,this.arrays={},this.nodes=t.nodes||[],this.scope=t.scope,this.file=t.file,this.kind=t.kind}return e.prototype.buildVariableAssignment=function(e,t){var r=this.operator;l.isMemberExpression(e)&&(r="=");var n;return n=r?l.expressionStatement(l.assignmentExpression(r,e,t)):l.variableDeclaration(this.kind,[l.variableDeclarator(e,t)]),n._blockHoist=this.blockHoist,n},e.prototype.buildVariableDeclaration=function(e,t){var r=l.variableDeclaration("var",[l.variableDeclarator(e,t)]);return r._blockHoist=this.blockHoist,r},e.prototype.push=function(e,t){l.isObjectPattern(e)?this.pushObjectPattern(e,t):l.isArrayPattern(e)?this.pushArrayPattern(e,t):l.isAssignmentPattern(e)?this.pushAssignmentPattern(e,t):this.nodes.push(this.buildVariableAssignment(e,t))},e.prototype.toArray=function(e,t){return this.file.isLoose("es6.destructuring")||l.isIdentifier(e)&&this.arrays[e.name]?e:this.scope.toArray(e,t)},e.prototype.pushAssignmentPattern=function(e,t){var r=this.scope.generateUidIdentifierBasedOnNode(t),n=l.variableDeclaration("var",[l.variableDeclarator(r,t)]);n._blockHoist=this.blockHoist,this.nodes.push(n);var i=l.conditionalExpression(l.binaryExpression("===",r,l.identifier("undefined")),e.right,r),a=e.left;if(l.isPattern(a)){var s=l.expressionStatement(l.assignmentExpression("=",r,i));s._blockHoist=this.blockHoist,this.nodes.push(s),this.push(a,r)}else this.nodes.push(this.buildVariableAssignment(a,i))},e.prototype.pushObjectSpread=function(e,t,r,n){for(var i=[],a=0;a<e.properties.length;a++){var s=e.properties[a];if(a>=n)break;if(!l.isSpreadProperty(s)){var o=s.key;l.isIdentifier(o)&&!s.computed&&(o=l.literal(s.key.name)),i.push(o)}}i=l.arrayExpression(i);var u=l.callExpression(this.file.addHelper("object-without-properties"),[t,i]);this.nodes.push(this.buildVariableAssignment(r.argument,u))},e.prototype.pushObjectProperty=function(e,t){l.isLiteral(e.key)&&(e.computed=!0);var r=e.value,n=l.memberExpression(t,e.key,e.computed);l.isPattern(r)?this.push(r,n):this.nodes.push(this.buildVariableAssignment(r,n))},e.prototype.pushObjectPattern=function(e,t){if(e.properties.length||this.nodes.push(l.expressionStatement(l.callExpression(this.file.addHelper("object-destructuring-empty"),[t]))),e.properties.length>1&&!this.scope.isStatic(t)){var r=this.scope.generateUidIdentifierBasedOnNode(t);this.nodes.push(this.buildVariableDeclaration(r,t)),t=r}for(var n=0;n<e.properties.length;n++){var i=e.properties[n];l.isSpreadProperty(i)?this.pushObjectSpread(e,t,i,n):this.pushObjectProperty(i,t)}},e.prototype.canUnpackArrayPattern=function(e,t){if(!l.isArrayExpression(t))return!1;if(!(e.elements.length>t.elements.length)){if(e.elements.length<t.elements.length&&!s(e))return!1;for(var r=e.elements,n=0;n<r.length;n++){var i=r[n];if(!i)return!1;if(l.isMemberExpression(i))return!1}for(var a=t.elements,o=0;o<a.length;o++){var i=a[o];if(l.isSpreadElement(i))return!1}var u=l.getBindingIdentifiers(e),p={deopt:!1,bindings:u};return this.scope.traverse(t,d,p),!p.deopt}},e.prototype.pushUnpackedArrayPattern=function(e,t){for(var r=0;r<e.elements.length;r++){var n=e.elements[r];l.isRestElement(n)?this.push(n.argument,l.arrayExpression(t.elements.slice(r))):this.push(n,t.elements[r])}},e.prototype.pushArrayPattern=function(e,t){if(e.elements){if(this.canUnpackArrayPattern(e,t))return this.pushUnpackedArrayPattern(e,t);var r=!s(e)&&e.elements.length,n=this.toArray(t,r);l.isIdentifier(n)?t=n:(t=this.scope.generateUidIdentifierBasedOnNode(t),this.arrays[t.name]=!0,this.nodes.push(this.buildVariableDeclaration(t,n)));for(var i=0;i<e.elements.length;i++){var a=e.elements[i];if(a){var o;l.isRestElement(a)?(o=this.toArray(t),i>0&&(o=l.callExpression(l.memberExpression(o,l.identifier("slice")),[l.literal(i)])),a=a.argument):o=l.memberExpression(t,l.literal(i),!0),this.push(a,o)}}}},e.prototype.init=function(e,t){if(!l.isArrayExpression(t)&&!l.isMemberExpression(t)){var r=this.scope.maybeGenerateMemoised(t,!0);r&&(this.nodes.push(this.buildVariableDeclaration(r,t)),t=r)}return this.push(e,t),this.nodes},e}()},{179:179,43:43}],96:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){var r=[],n=e.right;if(!l.isIdentifier(n)||!t.hasBinding(n.name)){var i=t.generateUidIdentifier("arr");r.push(l.variableDeclaration("var",[l.variableDeclarator(i,n)])),n=i}var a=t.generateUidIdentifier("i"),s=u.template("for-of-array",{BODY:e.body,KEY:a,ARR:n});l.inherits(s,e),l.ensureBlock(s);var o=l.memberExpression(n,a,!0),p=e.left;return l.isVariableDeclaration(p)?(p.declarations[0].init=o,s.body.body.unshift(p)):s.body.body.unshift(l.expressionStatement(l.assignmentExpression("=",p,o))),this.parentPath.isLabeledStatement()&&(s=l.labeledStatement(this.parentPath.node.label,s)),r.push(s),r}r.__esModule=!0,r._ForOfStatementArray=i;var a=e(43),s=n(a),o=e(182),u=n(o),p=e(179),l=n(p),c={ForOfStatement:function(e,t,r,n){if(this.get("right").isArrayExpression())return i.call(this,e,r,n);var a=d;n.isLoose("es6.forOf")&&(a=f);var s=a(e,t,r,n),o=s.declar,u=s.loop,p=u.body;return this.ensureBlock(),o&&p.body.push(o),p.body=p.body.concat(e.body.body),l.inherits(u,e),l.inherits(u.body,e.body),s.replaceParent?(this.parentPath.replaceWithMultiple(s.node),void this.dangerouslyRemove()):s.node}};r.visitor=c;var f=function(e,t,r,n){var i,a,o=e.left;if(l.isIdentifier(o)||l.isPattern(o)||l.isMemberExpression(o))a=o;else{if(!l.isVariableDeclaration(o))throw n.errorWithNode(o,s.get("unknownForHead",o.type));a=r.generateUidIdentifier("ref"),i=l.variableDeclaration(o.kind,[l.variableDeclarator(o.declarations[0].id,a)])}var p=r.generateUidIdentifier("iterator"),c=r.generateUidIdentifier("isArray"),f=u.template("for-of-loose",{LOOP_OBJECT:p,IS_ARRAY:c,OBJECT:e.right,INDEX:r.generateUidIdentifier("i"),ID:a});return i||f.body.body.shift(),{declar:i,node:f,loop:f}},d=function(e,t,r,n){var i,a=e.left,o=r.generateUidIdentifier("step"),p=l.memberExpression(o,l.identifier("value"));if(l.isIdentifier(a)||l.isPattern(a)||l.isMemberExpression(a))i=l.expressionStatement(l.assignmentExpression("=",a,p));else{if(!l.isVariableDeclaration(a))throw n.errorWithNode(a,s.get("unknownForHead",a.type));i=l.variableDeclaration(a.kind,[l.variableDeclarator(a.declarations[0].id,p)])}var c=r.generateUidIdentifier("iterator"),f=u.template("for-of",{ITERATOR_HAD_ERROR_KEY:r.generateUidIdentifier("didIteratorError"),ITERATOR_COMPLETION:r.generateUidIdentifier("iteratorNormalCompletion"),ITERATOR_ERROR_KEY:r.generateUidIdentifier("iteratorError"),ITERATOR_KEY:c,STEP_KEY:o,OBJECT:e.right,BODY:null}),d=l.isLabeledStatement(t),h=f[3].block.body,m=h[0];return d&&(h[0]=l.labeledStatement(t.label,m)),{replaceParent:d,declar:i,loop:m,node:f}}},{179:179,182:182,43:43}],97:[function(e,t,r){"use strict";r.__esModule=!0;var n={group:"builtin-pre"};r.metadata=n;var i={Literal:function(e){"number"==typeof e.value&&/^0[ob]/i.test(e.raw)&&(e.raw=void 0),"string"==typeof e.value&&/\\[u]/gi.test(e.raw)&&(e.raw=void 0)}};r.visitor=i},{}],98:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);
return t["default"]=e,t}function i(e,t){if(e._blockHoist)for(var r=0;r<t.length;r++)t[r]._blockHoist=e._blockHoist}r.__esModule=!0;var a=e(179),s=n(a),o={group:"builtin-modules"};r.metadata=o;var u={ImportDeclaration:function(e,t,r,n){if("type"!==e.importKind&&"typeof"!==e.importKind){var i=[];if(e.specifiers.length)for(var a=e.specifiers,s=0;s<a.length;s++){var o=a[s];n.moduleFormatter.importSpecifier(o,e,i,r)}else n.moduleFormatter.importDeclaration(e,i,r);return 1===i.length&&(i[0]._blockHoist=e._blockHoist),i}},ExportAllDeclaration:function(e,t,r,n){var a=[];return n.moduleFormatter.exportAllDeclaration(e,a,r),i(e,a),a},ExportDefaultDeclaration:function(e,t,r,n){var a=[];return n.moduleFormatter.exportDeclaration(e,a,r),i(e,a),a},ExportNamedDeclaration:function(e,t,r,n){if(!this.get("declaration").isTypeAlias()){var a=[];if(e.declaration){if(s.isVariableDeclaration(e.declaration)){var o=e.declaration.declarations[0];o.init=o.init||s.identifier("undefined")}n.moduleFormatter.exportDeclaration(e,a,r)}else if(e.specifiers)for(var u=0;u<e.specifiers.length;u++)n.moduleFormatter.exportSpecifier(e.specifiers[u],e,a,r);return i(e,a),a}}};r.visitor=u},{179:179}],99:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,r,n,i){if((t.method||"init"!==t.kind)&&p.isFunction(t.value)){var a=new o["default"]({getObjectRef:n,methodNode:t,methodPath:e,isStatic:!0,scope:r,file:i});a.replace()}}r.__esModule=!0;var s=e(65),o=i(s),u=e(179),p=n(u),l={ObjectExpression:function(e,t,r,n){for(var i,s=function(){return i=i||r.generateUidIdentifier("obj")},o=this.get("properties"),u=0;u<e.properties.length;u++)a(o[u],e.properties[u],r,s,n);return i?(r.push({id:i}),p.assignmentExpression("=",i,e)):void 0}};r.visitor=l},{179:179,65:65}],100:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var a=e(56),s=i(a),o=e(59),u=i(o),p=e(182),l=n(p),c=e(179),f=n(c),d=function(e){for(var t=0;t<e.params.length;t++)if(!f.isIdentifier(e.params[t]))return!0;return!1},h={ReferencedIdentifier:function(e,t,r,n){if("eval"!==e.name){if(!n.scope.hasOwnBinding(e.name))return;if(n.scope.bindingIdentifierEquals(e.name,e))return}n.iife=!0,this.stop()}},m={Function:function(e,t,r,n){function i(t,r,i){var s;s=a(i)||f.isPattern(t)||n.transformers["es6.spec.blockScoping"].canTransform()?l.template("default-parameter",{VARIABLE_NAME:t,DEFAULT_VALUE:r,ARGUMENT_KEY:f.literal(i),ARGUMENTS:c},!0):l.template("default-parameter-assign",{VARIABLE_NAME:t,DEFAULT_VALUE:r},!0),s._blockHoist=e.params.length-i,p.push(s)}function a(e){return e+1>m}if(d(e)){this.ensureBlock();var o={iife:!1,scope:r},p=[],c=f.identifier("arguments");c._shadowedFunctionLiteral=this;for(var m=u["default"](e),y=this.get("params"),g=0;g<y.length;g++){var v=y[g];if(v.isAssignmentPattern()){var b=v.get("left"),E=v.get("right");if(a(g)||b.isPattern()){var x=r.generateUidIdentifier("x");x._isDefaultPlaceholder=!0,e.params[g]=x}else e.params[g]=b.node;o.iife||(E.isIdentifier()&&r.hasOwnBinding(E.node.name)?o.iife=!0:E.traverse(h,o)),i(b.node,E.node,g)}else v.isIdentifier()||v.traverse(h,o),n.transformers["es6.spec.blockScoping"].canTransform()&&v.isIdentifier()&&i(v.node,f.identifier("undefined"),g)}e.params=e.params.slice(0,m),o.iife?(p.push(s["default"](e,r)),e.body=f.blockStatement(p)):e.body.body=p.concat(e.body.body)}}};r.visitor=m},{179:179,182:182,56:56,59:59}],101:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(168),a=n(i),s=e(100),o=n(s),u=e(102),p=n(u),l={group:"builtin-advanced"};r.metadata=l;var c=a.merge([p.visitor,o.visitor]);r.visitor=c},{100:100,102:102,168:168}],102:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){if(0!==t){var r,n=e.property;p.isLiteral(n)?(n.value+=t,n.raw=String(n.value)):(r=p.binaryExpression("+",n,p.literal(t)),e.property=r)}}function a(e){return p.isRestElement(e.params[e.params.length-1])}r.__esModule=!0;var s=e(182),o=n(s),u=e(179),p=n(u),l={Scope:function(e,t,r,n){r.bindingIdentifierEquals(n.name,n.outerBinding)||this.skip()},Flow:function(){this.skip()},Function:function(e,t,r,n){var i=n.noOptimise;n.noOptimise=!0,this.traverse(l,n),n.noOptimise=i,this.skip()},ReferencedIdentifier:function(e,t,r,n){if("arguments"===e.name&&(n.deopted=!0),e.name===n.name)if(n.noOptimise)n.deopted=!0;else{if(this.parentPath.isMemberExpression({computed:!0,object:e})){var i=this.parentPath.get("property");if(i.isBaseType("number"))return void n.candidates.push(this)}if(this.parentPath.isSpreadElement()&&0===n.offset){var a=this.parentPath.parentPath;if(a.isCallExpression()&&1===a.node.arguments.length)return void n.candidates.push(this)}n.references.push(this)}},BindingIdentifier:function(e,t,r,n){e.name===n.name&&(n.deopted=!0)}},c={Function:function(e,t,r){if(a(e)){var n=e.params.pop(),s=n.argument,u=p.identifier("arguments");if(u._shadowedFunctionLiteral=this,p.isPattern(s)){var c=s;s=r.generateUidIdentifier("ref");var f=p.variableDeclaration("let",c.elements.map(function(e,t){var r=p.memberExpression(s,p.literal(t),!0);return p.variableDeclarator(e,r)}));e.body.body.unshift(f)}var d={references:[],offset:e.params.length,argumentsNode:u,outerBinding:r.getBindingIdentifier(s.name),candidates:[],name:s.name,deopted:!1};if(this.traverse(l,d),d.deopted||d.references.length){d.references=d.references.concat(d.candidates),d.deopted=d.deopted||!!e.shadow;var h=p.literal(e.params.length),m=r.generateUidIdentifier("key"),y=r.generateUidIdentifier("len"),g=m,v=y;e.params.length&&(g=p.binaryExpression("-",m,h),v=p.conditionalExpression(p.binaryExpression(">",y,h),p.binaryExpression("-",y,h),p.literal(0)));var b=o.template("rest",{ARRAY_TYPE:n.typeAnnotation,ARGUMENTS:u,ARRAY_KEY:g,ARRAY_LEN:v,START:h,ARRAY:s,KEY:m,LEN:y});if(d.deopted)b._blockHoist=e.params.length+1,e.body.body.unshift(b);else{b._blockHoist=1;var E,x=this.getEarliestCommonAncestorFrom(d.references).getStatementParent();x.findParent(function(e){if(e.isLoop())E=e;else if(e.isFunction())return!0}),E&&(x=E),x.insertBefore(b)}}else if(d.candidates.length)for(var S=d.candidates,A=0;A<S.length;A++){var D=S[A];D.replaceWith(u),D.parentPath.isMemberExpression()&&i(D.parent,d.offset)}}}};r.visitor=c},{179:179,182:182}],103:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t,r){for(var n=e.properties,i=0;i<n.length;i++){var a=n[i];t.push(o.expressionStatement(o.assignmentExpression("=",o.memberExpression(r,a.key,a.computed||o.isLiteral(a.key)),a.value)))}}function a(e,t,r,n,i){for(var a=e.properties,s=0;s<a.length;s++){var u=a[s];if(o.isLiteral(o.toComputedKey(u),{value:"__proto__"}))n.push(u);else{var p=u.key;o.isIdentifier(p)&&!u.computed&&(p=o.literal(p.name));var l=o.callExpression(i.addHelper("define-property"),[r,p,u.value]);t.push(o.expressionStatement(l))}}if(1===t.length){var c=t[0].expression;if(o.isCallExpression(c))return c.arguments[0]=o.objectExpression(n),c}}r.__esModule=!0;var s=e(179),o=n(s),u={ObjectExpression:{exit:function(e,t,r,n){for(var s=!1,u=e.properties,p=0;p<u.length;p++){var l=u[p];if(s=o.isProperty(l,{computed:!0,kind:"init"}))break}if(s){var c=[],f=!1;e.properties=e.properties.filter(function(e){return e.computed&&(f=!0),"init"===e.kind&&f?!0:(c.push(e),!1)});var d=r.generateUidIdentifierBasedOnNode(t),h=[],m=a;n.isLoose("es6.properties.computed")&&(m=i);var y=m(e,h,d,c,n);return y?y:(h.unshift(o.variableDeclaration("var",[o.variableDeclarator(d,o.objectExpression(c))])),h.push(o.expressionStatement(d)),h)}}}};r.visitor=u},{179:179}],104:[function(e,t,r){"use strict";r.__esModule=!0;var n={Property:function(e){e.method&&(e.method=!1),e.shorthand&&(e.shorthand=!1)}};r.visitor=n},{}],105:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(63),a=n(i),s=e(179),o=n(s),u={Literal:function(e){return a.is(e,"y")?o.newExpression(o.identifier("RegExp"),[o.literal(e.regex.pattern),o.literal(e.regex.flags)]):void 0}};r.visitor=u},{179:179,63:63}],106:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var a=e(591),s=i(a),o=e(63),u=n(o),p={Literal:function(e){u.is(e,"u")&&(e.regex.pattern=s["default"](e.regex.pattern,e.regex.flags),u.pullFlag(e,"u"))}};r.visitor=p},{591:591,63:63}],107:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i),s={group:"builtin-pre",optional:!0};r.metadata=s;var o={ArrowFunctionExpression:function(e,t,r,n){if(!e.shadow){e.shadow={"this":!1};var i=a.thisExpression();return i._forceShadow=this,a.ensureBlock(e),this.get("body").unshiftContainer("body",a.expressionStatement(a.callExpression(n.addHelper("new-arrow-check"),[a.thisExpression(),i]))),a.callExpression(a.memberExpression(e,a.identifier("bind")),[a.thisExpression()])}}};r.visitor=o},{179:179}],108:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){return o.callExpression(t.addHelper("temporal-assert-defined"),[e,o.literal(e.name),t.addHelper("temporal-undefined")])}function a(e,t,r){var n=r.letRefs[e.name];return n?t.getBindingIdentifier(e.name)===n:!1}r.__esModule=!0;var s=e(179),o=n(s),u={ReferencedIdentifier:function(e,t,r,n){if((!o.isFor(t)||t.left!==e)&&a(e,r,n)){var s=i(e,n.file);return this.skip(),o.isUpdateExpression(t)?void(t._ignoreBlockScopingTDZ||this.parentPath.replaceWith(o.sequenceExpression([s,t]))):o.logicalExpression("&&",s,e)}},AssignmentExpression:{exit:function(e,t,r,n){if(!e._ignoreBlockScopingTDZ){var s=[],u=this.getBindingIdentifiers();for(var p in u){var l=u[p];a(l,r,n)&&s.push(i(l,n.file))}return s.length?(e._ignoreBlockScopingTDZ=!0,s.push(e),s.map(o.expressionStatement)):void 0}}}},p={optional:!0,group:"builtin-advanced"};r.metadata=p;var l={"Program|Loop|BlockStatement":{exit:function(e,t,r,n){var i=e._letReferences;i&&this.traverse(u,{letRefs:i,file:n})}}};r.visitor=l},{179:179}],109:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i),s={group:"builtin-pre",optional:!0};r.metadata=s;var o={Program:function(){var e=this.scope.generateUidIdentifier("null");this.unshiftContainer("body",[a.variableDeclaration("var",[a.variableDeclarator(e,a.literal(null))]),a.exportNamedDeclaration(null,[a.exportSpecifier(e,a.identifier("__proto__"))])])}};r.visitor=o},{179:179}],110:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i),s={optional:!0};r.metadata=s;var o={UnaryExpression:function(e,t,r,n){if(!e._ignoreSpecSymbols){if(this.parentPath.isBinaryExpression()&&a.EQUALITY_BINARY_OPERATORS.indexOf(t.operator)>=0){var i=this.getOpposite();if(i.isLiteral()&&"symbol"!==i.node.value&&"object"!==i.node.value)return}if("typeof"===e.operator){var s=a.callExpression(n.addHelper("typeof"),[e.argument]);if(this.get("argument").isIdentifier()){var o=a.literal("undefined"),u=a.unaryExpression("typeof",e.argument);return u._ignoreSpecSymbols=!0,a.conditionalExpression(a.binaryExpression("===",u,o),o,s)}return s}}},BinaryExpression:function(e,t,r,n){return"instanceof"===e.operator?a.callExpression(n.addHelper("instanceof"),[e.left,e.right]):void 0},"VariableDeclaration|FunctionDeclaration":function(e){e._generated&&this.skip()}};r.visitor=o},{179:179}],111:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i),s={optional:!0,group:"builtin-pre"};r.metadata=s;var o={TemplateLiteral:function(e,t){if(!a.isTaggedTemplateExpression(t))for(var r=0;r<e.expressions.length;r++)e.expressions[r]=a.callExpression(a.identifier("String"),[e.expressions[r]])}};r.visitor=o},{179:179}],112:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){return t.hub.file.isLoose("es6.spread")&&!u.isIdentifier(e.argument,{name:"arguments"})?e.argument:t.toArray(e.argument,!0)}function a(e){for(var t=0;t<e.length;t++)if(u.isSpreadElement(e[t]))return!0;return!1}function s(e,t){for(var r=[],n=[],a=function(){n.length&&(r.push(u.arrayExpression(n)),n=[])},s=0;s<e.length;s++){var o=e[s];u.isSpreadElement(o)?(a(),r.push(i(o,t))):n.push(o)}return a(),r}r.__esModule=!0;var o=e(179),u=n(o),p={group:"builtin-advanced"};r.metadata=p;var l={ArrayExpression:function(e,t,r){var n=e.elements;if(a(n)){var i=s(n,r),o=i.shift();return u.isArrayExpression(o)||(i.unshift(o),o=u.arrayExpression([])),u.callExpression(u.memberExpression(o,u.identifier("concat")),i)}},CallExpression:function(e,t,r){var n=e.arguments;if(a(n)){var i=u.identifier("undefined");e.arguments=[];var o;o=1===n.length&&"arguments"===n[0].argument.name?[n[0].argument]:s(n,r);var p=o.shift();o.length?e.arguments.push(u.callExpression(u.memberExpression(p,u.identifier("concat")),o)):e.arguments.push(p);var l=e.callee;if(this.get("callee").isMemberExpression()){var c=r.maybeGenerateMemoised(l.object);c?(l.object=u.assignmentExpression("=",c,l.object),i=c):i=l.object,u.appendToMemberExpression(l,u.identifier("apply"))}else e.callee=u.memberExpression(e.callee,u.identifier("apply"));e.arguments.unshift(i)}},NewExpression:function(e,t,r,n){var i=e.arguments;if(a(i)){var o=s(i,r),p=u.arrayExpression([u.literal(null)]);return i=u.callExpression(u.memberExpression(p,u.identifier("concat")),o),u.newExpression(u.callExpression(u.memberExpression(n.addHelper("bind"),u.identifier("apply")),[e.callee,i]),[])}}};r.visitor=l},{179:179}],113:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e){return v.blockStatement([v.returnStatement(e)])}r.__esModule=!0;var o=e(423),u=i(o),p=e(43),l=n(p),c=e(414),f=i(c),d=e(182),h=n(d),m=e(422),y=i(m),g=e(179),v=n(g),b={group:"builtin-trailing"};r.metadata=b;var E={Function:function(e,t,r,n){if(!e.generator&&!e.async){var i=new x(this,r,n);i.run()}}};r.visitor=E;var E={enter:function(e,t){v.isTryStatement(t)&&(e===t.block?this.skip():t.finalizer&&e!==t.finalizer&&this.skip())},ReturnStatement:function(e,t,r,n){return n.subTransform(e.argument)},Function:function(){this.skip()},VariableDeclaration:function(e,t,r,n){n.vars.push(e)},ThisExpression:function(e,t,r,n){n.isShadowed||(n.needsThis=!0,n.thisPaths.push(this))},ReferencedIdentifier:function(e,t,r,n){"arguments"!==e.name||n.isShadowed&&!e._shadowedFunctionLiteral||(n.needsArguments=!0,n.argumentsPaths.push(this))}},x=function(){function e(t,r,n){a(this,e),this.hasTailRecursion=!1,this.needsArguments=!1,this.argumentsPaths=[],this.setsArguments=!1,this.needsThis=!1,this.thisPaths=[],this.isShadowed=t.isArrowFunctionExpression()||t.is("shadow"),this.ownerId=t.node.id,this.vars=[],this.scope=r,this.path=t,this.file=n,this.node=t.node}return e.prototype.getArgumentsId=function(){return this.argumentsId=this.argumentsId||this.scope.generateUidIdentifier("arguments")},e.prototype.getThisId=function(){return this.thisId=this.thisId||this.scope.generateUidIdentifier("this")},e.prototype.getLeftId=function(){return this.leftId=this.leftId||this.scope.generateUidIdentifier("left")},e.prototype.getFunctionId=function(){return this.functionId=this.functionId||this.scope.generateUidIdentifier("function")},e.prototype.getAgainId=function(){return this.againId=this.againId||this.scope.generateUidIdentifier("again")},e.prototype.getParams=function(){var e=this.params;if(!e){e=this.node.params,this.paramDecls=[];for(var t=0;t<e.length;t++){var r=e[t];r._isDefaultPlaceholder||this.paramDecls.push(v.variableDeclarator(r,e[t]=this.scope.generateUidIdentifier("x")))}}return this.params=e},e.prototype.hasDeopt=function(){var e=this.scope.getBinding(this.ownerId.name);return e&&!e.constant},e.prototype.run=function(){var e=this.node,t=this.ownerId;if(t&&(this.path.traverse(E,this),this.hasTailRecursion)){if(this.hasDeopt())return void this.file.log.deopt(e,l.get("tailCallReassignmentDeopt"));for(var r=this.path.ensureBlock().body,n=0;n<r.length;n++){var i=r[n];v.isFunctionDeclaration(i)&&(i=r[n]=v.variableDeclaration("var",[v.variableDeclarator(i.id,v.toExpression(i))]),i._blockHoist=2)}var a=this.paramDecls;if(a.length>0){var s=v.variableDeclaration("var",a);s._blockHoist=1/0,r.unshift(s)}r.unshift(v.expressionStatement(v.assignmentExpression("=",this.getAgainId(),v.literal(!1)))),e.body=h.template("tail-call-body",{FUNCTION_ID:this.getFunctionId(),AGAIN_ID:this.getAgainId(),BLOCK:e.body});var o=[];if(this.needsThis){for(var u=this.thisPaths,p=0;p<u.length;p++){var c=u[p];c.replaceWith(this.getThisId())}o.push(v.variableDeclarator(this.getThisId(),v.thisExpression()))}if(this.needsArguments||this.setsArguments){for(var f=this.argumentsPaths,d=0;d<f.length;d++){var m=f[d];m.replaceWith(this.argumentsId)}var y=v.variableDeclarator(this.argumentsId);this.argumentsId&&(y.init=v.identifier("arguments"),y.init._shadowedFunctionLiteral=this.path),o.push(y)}var g=this.leftId;g&&o.push(v.variableDeclarator(g)),o.length>0&&e.body.body.unshift(v.variableDeclaration("var",o))}},e.prototype.subTransform=function(e){if(e){var t=this["subTransform"+e.type];return t?t.call(this,e):void 0}},e.prototype.subTransformConditionalExpression=function(e){var t=this.subTransform(e.consequent),r=this.subTransform(e.alternate);return t||r?(e.type="IfStatement",e.consequent=t?v.toBlock(t):s(e.consequent),r?e.alternate=v.isIfStatement(r)?r:v.toBlock(r):e.alternate=s(e.alternate),[e]):void 0},e.prototype.subTransformLogicalExpression=function(e){var t=this.subTransform(e.right);if(t){var r=this.getLeftId(),n=v.assignmentExpression("=",r,e.left);return"&&"===e.operator&&(n=v.unaryExpression("!",n)),[v.ifStatement(n,s(r))].concat(t)}},e.prototype.subTransformSequenceExpression=function(e){var t=e.expressions,r=this.subTransform(t[t.length-1]);return r?(1===--t.length&&(e=t[0]),[v.expressionStatement(e)].concat(r)):void 0},e.prototype.subTransformCallExpression=function(e){var t,r,n=e.callee;if(v.isMemberExpression(n,{computed:!1})&&v.isIdentifier(n.property)){switch(n.property.name){case"call":r=v.arrayExpression(e.arguments.slice(1));break;case"apply":r=e.arguments[1]||v.identifier("undefined"),this.needsArguments=!0;break;default:return}t=e.arguments[0],n=n.object}if(v.isIdentifier(n)&&this.scope.bindingIdentifierEquals(n.name,this.ownerId)&&(this.hasTailRecursion=!0,!this.hasDeopt())){var i=[];this.needsThis&&!v.isThisExpression(t)&&i.push(v.expressionStatement(v.assignmentExpression("=",this.getThisId(),t||v.identifier("undefined")))),r||(r=v.arrayExpression(e.arguments));var a=this.getArgumentsId(),s=this.getParams();if(this.needsArguments&&i.push(v.expressionStatement(v.assignmentExpression("=",a,r))),v.isArrayExpression(r)){for(var o=r.elements;o.length<s.length;)o.push(v.identifier("undefined"));for(var p=0;p<o.length;p++){var l=s[p],c=o[p];l&&!l._isDefaultPlaceholder&&(o[p]=v.assignmentExpression("=",l,c))}if(!this.needsArguments)for(var d=o,h=0;h<d.length;h++){var c=d[h];this.scope.isPure(c)||i.push(v.expressionStatement(c))}}else{this.setsArguments=!0;for(var p=0;p<s.length;p++){var l=s[p];l._isDefaultPlaceholder||i.push(v.expressionStatement(v.assignmentExpression("=",l,v.memberExpression(a,v.literal(p),!0))))}}if(i.push(v.expressionStatement(v.assignmentExpression("=",this.getAgainId(),v.literal(!0)))),this.vars.length>0){var m=f["default"](y["default"](this.vars,function(e){return e.declarations})),g=u["default"](m,function(e,t){return v.assignmentExpression("=",t.id,e)},v.identifier("undefined")),b=v.expressionStatement(g);i.push(b)}return i.push(v.continueStatement(this.getFunctionId())),i}},e}()},{179:179,182:182,414:414,422:422,423:423,43:43}],114:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return o.isLiteral(e)&&"string"==typeof e.value}function a(e,t){var r=o.binaryExpression("+",e,t);return r._templateLiteralProduced=!0,r}r.__esModule=!0;var s=e(179),o=n(s),u={group:"builtin-pre"};r.metadata=u;var p={TaggedTemplateExpression:function(e,t,r,n){for(var i=e.quasi,a=[],s=[],u=[],p=i.quasis,l=0;l<p.length;l++){var c=p[l];s.push(o.literal(c.value.cooked)),u.push(o.literal(c.value.raw))}s=o.arrayExpression(s),u=o.arrayExpression(u);var f="tagged-template-literal";n.isLoose("es6.templateLiterals")&&(f+="-loose");var d=n.addTemplateObject(f,s,u);return a.push(d),a=a.concat(i.expressions),o.callExpression(e.tag,a)},TemplateLiteral:function(e,t,r,n){for(var s=[],u=e.quasis,p=0;p<u.length;p++){var l=u[p];s.push(o.literal(l.value.cooked));var c=e.expressions.shift();c&&s.push(c)}if(s=s.filter(function(e){return!o.isLiteral(e,{value:""})}),i(s[0])||i(s[1])||s.unshift(o.literal("")),!(s.length>1))return s[0];for(var f=a(s.shift(),s.shift()),d=s,h=0;h<d.length;h++){var m=d[h];f=a(f,m)}this.replaceWith(f)}};r.visitor=p},{179:179}],115:[function(e,t,r){"use strict";r.__esModule=!0;var n={stage:3};r.metadata=n},{}],116:[function(e,t,r){"use strict";r.__esModule=!0;var n={stage:1,dependencies:["es6.classes"]};r.metadata=n},{}],117:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e){var t=[],r=h.functionExpression(null,[],h.blockStatement(t),!0);return r.shadow=!0,t.push(u["default"](e,function(){return h.expressionStatement(h.yieldExpression(e.body))})),h.callExpression(r,[])}function s(e,t,r){var n=r.generateUidIdentifierBasedOnNode(t),i=f.template("array-comprehension-container",{KEY:n});i.callee.shadow=!0;var a=i.callee.body,s=a.body;l["default"].hasType(e,r,"YieldExpression",h.FUNCTION_TYPES)&&(i.callee.generator=!0,i=h.yieldExpression(i,!0));var o=s.pop();return s.push(u["default"](e,function(){return f.template("array-push",{STATEMENT:e.body,KEY:n},!0)})),s.push(o),i}r.__esModule=!0;var o=e(54),u=i(o),p=e(148),l=i(p),c=e(182),f=n(c),d=e(179),h=n(d),m={stage:0};r.metadata=m;var y={ComprehensionExpression:function(e,t,r){var n=s;return e.generator&&(n=a),n(e,t,r)}};r.visitor=y},{148:148,179:179,182:182,54:54}],118:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var a=e(60),s=i(a),o=e(57),u=n(o),p=e(179),l=n(p),c={dependencies:["es6.classes"],optional:!0,stage:1};r.metadata=c;var f={ObjectExpression:function(e,t,r,n){for(var i=!1,a=0;a<e.properties.length;a++){var o=e.properties[a];if(o.decorators){i=!0;break}}if(i){for(var p={},a=0;a<e.properties.length;a++){var o=e.properties[a];o.decorators&&s["default"](o.decorators,r),"init"!==o.kind||o.method||(o.kind="",o.value=l.functionExpression(null,[],l.blockStatement([l.returnStatement(o.value)]))),u.push(p,o,"initializer",n)}var c=u.toClassObject(p);return c=u.toComputedObjectFromClass(c),l.callExpression(n.addHelper("create-decorated-object"),[c])}}};r.visitor=f},{179:179,57:57,60:60}],119:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i),s={optional:!0,stage:0};r.metadata=s;var o={DoExpression:function(e){var t=e.body.body;return t.length?t:a.identifier("undefined")}};r.visitor=o},{179:179}],120:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var a=e(53),s=i(a),o=e(179),u=n(o),p={stage:3};r.metadata=p;var l=u.memberExpression(u.identifier("Math"),u.identifier("pow")),c=s["default"]({operator:"**",build:function(e,t){return u.callExpression(l,[e,t])}});r.visitor=c},{179:179,53:53}],121:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t,r){var n=e.specifiers[0];if(s.isExportNamespaceSpecifier(n)||s.isExportDefaultSpecifier(n)){var a,o=e.specifiers.shift(),u=r.generateUidIdentifier(o.exported.name);a=s.isExportNamespaceSpecifier(o)?s.importNamespaceSpecifier(u):s.importDefaultSpecifier(u),t.push(s.importDeclaration([a],e.source)),t.push(s.exportNamedDeclaration(null,[s.exportSpecifier(u,o.exported)])),i(e,t,r)}}r.__esModule=!0;var a=e(179),s=n(a),o={stage:1};r.metadata=o;var u={ExportNamedDeclaration:function(e,t,r){var n=[];return i(e,n,r),n.length?(e.specifiers.length>=1&&n.push(e),n):void 0}};r.visitor=u},{179:179}],122:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){var t=e.path.getData("functionBind");return t?t:(t=e.generateDeclaredUidIdentifier("context"),e.path.setData("functionBind",t))}function a(e,t){var r=e.object||e.callee.object;return t.isStatic(r)&&r}function s(e,t){var r=a(e,t);if(r)return r;var n=i(t);return e.object?e.callee=u.sequenceExpression([u.assignmentExpression("=",n,e.object),e.callee]):e.callee.object=u.assignmentExpression("=",n,e.callee.object),n}r.__esModule=!0;var o=e(179),u=n(o),p={optional:!0,stage:0};r.metadata=p;var l={CallExpression:function(e,t,r){var n=e.callee;if(u.isBindExpression(n)){var i=s(n,r);e.callee=u.memberExpression(n.callee,u.identifier("call")),e.arguments.unshift(i)}},BindExpression:function(e,t,r){var n=s(e,r);return u.callExpression(u.memberExpression(e.callee,u.identifier("bind")),[n])}};r.visitor=l},{179:179}],123:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i),s={stage:2,dependencies:["es6.destructuring"]};r.metadata=s;var o=function(e){for(var t=0;t<e.properties.length;t++)if(a.isSpreadProperty(e.properties[t]))return!0;return!1},u={ObjectExpression:function(e,t,r,n){if(o(e)){for(var i=[],s=[],u=function(){s.length&&(i.push(a.objectExpression(s)),s=[])},p=0;p<e.properties.length;p++){var l=e.properties[p];a.isSpreadProperty(l)?(u(),i.push(l.argument)):s.push(l)}return u(),a.isObjectExpression(i[0])||i.unshift(a.objectExpression([])),a.callExpression(n.addHelper("extends"),i)}}};r.visitor=u},{179:179}],124:[function(e,t,r){"use strict";r.__esModule=!0;var n={stage:2};r.metadata=n},{}],125:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e){return"_"===e.key[0]?!0:void 0}function a(e,t){var r=t.blacklist;return r.length&&l["default"](r,e.key)?!1:void 0}function s(e,t){var r=t.whitelist;return r?l["default"](r,e.key):void 0}function o(e,t){var r=e.metadata.stage;return null!=r&&r>=t.stage?!0:void 0}function u(e,t){return e.metadata.optional&&!l["default"](t.optional,e.key)?!1:void 0}r.__esModule=!0,r.internal=i,r.blacklist=a,r.whitelist=s,r.stage=o,r.optional=u;var p=e(421),l=n(p)},{421:421}],126:[function(e,t,r){"use strict";r.__esModule=!0,r["default"]={"minification.constantFolding":e(183),strict:e(142),eval:e(185),_validation:e(132),_hoistDirectives:e(128),"minification.removeDebugger":e(194),"minification.removeConsole":e(193),"utility.inlineEnvironmentVariables":e(186),"minification.deadCodeElimination":e(184),_modules:e(130),"react.displayName":e(192),"es6.spec.modules":e(109),"es6.spec.arrowFunctions":e(107),"es6.spec.templateLiterals":e(111),"es6.templateLiterals":e(114),"es6.literals":e(97),"validation.undeclaredVariableCheck":e(197),"spec.functionName":e(144),"es7.classProperties":e(116),"es7.trailingFunctionCommas":e(124),"es7.asyncFunctions":e(115),"es7.decorators":e(118),"validation.react":e(145),"es6.arrowFunctions":e(89),"spec.blockScopedFunctions":e(143),"optimisation.react.constantElements":e(191),"optimisation.react.inlineElements":e(135),"es7.comprehensions":e(117),"es6.classes":e(91),asyncToGenerator:e(136),bluebirdCoroutines:e(137),"es6.objectSuper":e(99),"es7.objectRestSpread":e(123),"es7.exponentiationOperator":e(120),"es5.properties.mutators":e(88),"es6.properties.shorthand":e(104),"es6.properties.computed":e(103),"optimisation.flow.forOf":e(133),"es6.forOf":e(96),"es6.regex.sticky":e(105),"es6.regex.unicode":e(106),"es6.constants":e(94),"es7.exportExtensions":e(121),"spec.protoToAssign":e(190),"es7.doExpressions":e(119),"es6.spec.symbols":e(110),"es7.functionBind":e(122),"spec.undefinedToVoid":e(199),"es6.spread":e(112),"es6.parameters":e(101),"es6.destructuring":e(95),"es6.blockScoping":e(90),"es6.spec.blockScoping":e(108),reactCompat:e(139),react:e(140),regenerator:e(141),runtime:e(196),"es6.modules":e(98),_moduleFormatter:e(129),"es6.tailCall":e(113),_shadowFunctions:e(131),"es3.propertyLiterals":e(87),"es3.memberExpressionLiterals":e(86),"minification.memberExpressionLiterals":e(188),"minification.propertyLiterals":e(189),_blockHoist:e(127),jscript:e(187),flow:e(138),"optimisation.modules.system":e(134)},t.exports=r["default"]},{101:101,103:103,104:104,105:105,106:106,107:107,108:108,109:109,110:110,111:111,112:112,113:113,114:114,115:115,116:116,117:117,118:118,119:119,120:120,121:121,122:122,123:123,124:124,127:127,128:128,129:129,130:130,131:131,132:132,133:133,134:134,135:135,136:136,137:137,138:138,139:139,140:140,141:141,142:142,143:143,144:144,145:145,183:183,184:184,185:185,186:186,187:187,188:188,189:189,190:190,191:191,192:192,193:193,194:194,196:196,197:197,199:199,86:86,87:87,88:88,89:89,90:90,91:91,94:94,95:95,96:96,97:97,98:98,99:99}],127:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var i=e(425),a=n(i),s={group:"builtin-trailing"};r.metadata=s;var o={Block:{exit:function(e){for(var t=!1,r=0;r<e.body.length;r++){var n=e.body[r];if(n&&null!=n._blockHoist){t=!0;break}}t&&(e.body=a["default"](e.body,function(e){var t=e&&e._blockHoist;return null==t&&(t=1),t===!0&&(t=2),-1*t}));
}}};r.visitor=o},{425:425}],128:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i),s={group:"builtin-pre"};r.metadata=s;var o={Block:{exit:function(e){for(var t=0;t<e.body.length;t++){var r=e.body[t];if(!a.isExpressionStatement(r)||!a.isLiteral(r.expression))return;r._blockHoist=1/0}}}};r.visitor=o},{179:179}],129:[function(e,t,r){"use strict";r.__esModule=!0;var n={group:"builtin-modules"};r.metadata=n;var i={Program:{exit:function(e,t,r,n){for(var i=n.dynamicImports,a=0;a<i.length;a++){var s=i[a];s._blockHoist=3}e.body=n.dynamicImports.concat(e.body),n.transformers["es6.modules"].canTransform()&&n.moduleFormatter.transform&&n.moduleFormatter.transform(e)}}};r.visitor=i},{}],130:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){var t=e.declaration;return u.inheritsComments(t,e),u.removeComments(e),t._ignoreUserWhitespace=!0,t}function a(e){return u.exportSpecifier(s(e),s(e))}function s(e){var t=e.name,r=e.loc,n=u.identifier(t);return n._loc=r,n}r.__esModule=!0;var o=e(179),u=n(o),p={group:"builtin-pre"};r.metadata=p;var l={ExportDefaultDeclaration:function(e,t,r){var n=e.declaration;if(u.isClassDeclaration(n)){var a=[i(e),e];return e.declaration=n.id,a}if(u.isClassExpression(n)){var s=r.generateUidIdentifier("default");e.declaration=u.variableDeclaration("var",[u.variableDeclarator(s,n)]);var a=[i(e),e];return e.declaration=s,a}if(u.isFunctionDeclaration(n)){e._blockHoist=2;var a=[i(e),e];return e.declaration=n.id,a}},ExportNamedDeclaration:function(e){var t=e.declaration;if(u.isClassDeclaration(t)){e.specifiers=[a(t.id)];var r=[i(e),e];return e.declaration=null,r}if(u.isFunctionDeclaration(t)){var n=u.exportNamedDeclaration(null,[a(t.id)]);return n._blockHoist=2,[i(e),n]}if(u.isVariableDeclaration(t)){var s=[],o=this.get("declaration").getBindingIdentifiers();for(var p in o)s.push(a(o[p]));return[t,u.exportNamedDeclaration(null,s)]}},Program:{enter:function(e){for(var t=[],r=[],n=0;n<e.body.length;n++){var i=e.body[n];u.isImportDeclaration(i)?t.push(i):r.push(i)}e.body=t.concat(r)},exit:function(e,t,r,n){n.transformers["es6.modules"].canTransform()&&n.moduleFormatter.setup&&n.moduleFormatter.setup()}}};r.visitor=l},{179:179}],131:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){return e.is("_forceShadow")?!0:t&&!t.isArrowFunctionExpression()}function a(e,t,r){var n=e.inShadow(t);if(i(e,n)){var a,s=e.node._shadowedFunctionLiteral,o=e.findParent(function(e){return(e.isProgram()||e.isFunction())&&(a=a||e),e.isProgram()?!0:e.isFunction()?s?e===s||e.node===s.node:!e.is("shadow"):!1});if(o!==a){var u=o.getData(t);if(u)return u;var p=r(),l=e.scope.generateUidIdentifier(t);return o.setData(t,l),o.scope.push({id:l,init:p}),l}}}r.__esModule=!0;var s=e(179),o=n(s),u={group:"builtin-trailing"};r.metadata=u;var p={ThisExpression:function(){return a(this,"this",function(){return o.thisExpression()})},ReferencedIdentifier:function(e){return"arguments"===e.name?a(this,"arguments",function(){return o.identifier("arguments")}):void 0}};r.visitor=p},{179:179}],132:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(43),a=n(i),s=e(179),o=n(s),u={group:"builtin-pre"};r.metadata=u;var p={ForXStatement:function(e,t,r,n){var i=e.left;if(o.isVariableDeclaration(i)){var s=i.declarations[0];if(s.init)throw n.errorWithNode(s,a.get("noAssignmentsInForHead"))}},Property:function(e,t,r,n){if("set"===e.kind){var i=e.value.params[0];if(o.isRestElement(i))throw n.errorWithNode(i,a.get("settersNoRest"))}}};r.visitor=p},{179:179,43:43}],133:[function(e,t,r){"use strict";r.__esModule=!0;var n=e(96),i={optional:!0};r.metadata=i;var a={ForOfStatement:function(e,t,r,i){return this.get("right").isGenericType("Array")?n._ForOfStatementArray.call(this,e,r,i):void 0}};r.visitor=a},{96:96}],134:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i),s={optional:!0,group:"builtin-trailing"};r.metadata=s;var o={Program:function(e,t,r,n){n.moduleFormatter._setters&&r.traverse(n.moduleFormatter._setters,u,{exportFunctionIdentifier:n.moduleFormatter.exportIdentifier})}};r.visitor=o;var u={FunctionExpression:{enter:function(e,t,r,n){n.hasExports=!1,n.exportObjectIdentifier=r.generateUidIdentifier("exportObj")},exit:function(e,t,r,n){n.hasExports&&(e.body.body.unshift(a.variableDeclaration("var",[a.variableDeclarator(a.cloneDeep(n.exportObjectIdentifier),a.objectExpression([]))])),e.body.body.push(a.expressionStatement(a.callExpression(a.cloneDeep(n.exportFunctionIdentifier),[a.cloneDeep(n.exportObjectIdentifier)]))))}},CallExpression:function(e,t,r,n){if(a.isIdentifier(e.callee,{name:n.exportFunctionIdentifier.name})){n.hasExports=!0;var i=a.memberExpression(a.cloneDeep(n.exportObjectIdentifier),e.arguments[0],!0);return a.assignmentExpression("=",i,e.arguments[1])}}}},{179:179}],135:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){for(var t=0;t<e.length;t++){var r=e[t];if(p.isJSXSpreadAttribute(r))return!0;if(a(r,"ref"))return!0}return!1}function a(e,t){return p.isJSXAttribute(e)&&p.isJSXIdentifier(e.name,{name:t})}r.__esModule=!0;var s=e(62),o=n(s),u=e(179),p=n(u),l={optional:!0};r.metadata=l;var c={JSXElement:function(e,t,r,n){function s(e,t){u(d.properties,p.identifier(e),t)}function u(e,t,r){e.push(p.property("init",t,r))}var l=e.openingElement;if(!i(l.attributes)){var c=!0,f=p.objectExpression([]),d=p.objectExpression([]),h=p.literal(null),m=l.name;if(p.isJSXIdentifier(m)&&o.isCompatTag(m.name)&&(m=p.literal(m.name),c=!1),e.children.length){var y=o.buildChildren(e);y=1===y.length?y[0]:p.arrayExpression(y),u(f.properties,p.identifier("children"),y)}for(var g=0;g<l.attributes.length;g++){var v=l.attributes[g];a(v,"key")?h=v.value:u(f.properties,v.name,v.value||p.identifier("true"))}return c&&(f=p.callExpression(n.addHelper("default-props"),[p.memberExpression(m,p.identifier("defaultProps")),f])),s("$$typeof",n.addHelper("typeof-react-element")),s("type",m),s("key",h),s("ref",p.literal(null)),s("props",f),s("_owner",p.literal(null)),d}}};r.visitor=c},{179:179,62:62}],136:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var i=e(64),a=n(i),s=e(137);r.manipulateOptions=s.manipulateOptions;var o={optional:!0,dependencies:["es7.asyncFunctions","es6.classes"]};r.metadata=o;var u={Function:function(e,t,r,n){return e.async&&!e.generator?a["default"](this,n.addHelper("async-to-generator")):void 0}};r.visitor=u},{137:137,64:64}],137:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e){e.blacklist.push("regenerator")}r.__esModule=!0,r.manipulateOptions=a;var s=e(64),o=i(s),u=e(179),p=n(u),l={optional:!0,dependencies:["es7.asyncFunctions","es6.classes"]};r.metadata=l;var c={Function:function(e,t,r,n){return e.async&&!e.generator?o["default"](this,p.memberExpression(n.addImport("bluebird",null,"absolute"),p.identifier("coroutine"))):void 0}};r.visitor=c},{179:179,64:64}],138:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i),s={group:"builtin-trailing"};r.metadata=s;var o="@flow",u={Program:function(e,t,r,n){for(var i=n.ast.comments,a=0;a<i.length;a++){var s=i[a];s.value.indexOf(o)>=0&&(s.value=s.value.replace(o,""),s.value.replace(/\*/g,"").trim()||(s._displayed=!0))}},Flow:function(){this.dangerouslyRemove()},ClassProperty:function(e){e.typeAnnotation=null,e.value||this.dangerouslyRemove()},Class:function(e){e["implements"]=null},Function:function(e){for(var t=0;t<e.params.length;t++){var r=e.params[t];r.optional=!1}},TypeCastExpression:function(e){do e=e.expression;while(a.isTypeCastExpression(e));return e}};r.visitor=u},{179:179}],139:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){e.blacklist.push("react")}r.__esModule=!0,r.manipulateOptions=i;var a=e(62),s=n(a),o=e(179),u=n(o),p={optional:!0,group:"builtin-advanced"};r.metadata=p;var l=e(55)({pre:function(e){e.callee=e.tagExpr},post:function(e){s.isCompatTag(e.tagName)&&(e.call=u.callExpression(u.memberExpression(u.memberExpression(u.identifier("React"),u.identifier("DOM")),e.tagExpr,u.isLiteral(e.tagExpr)),e.args))}});r.visitor=l},{179:179,55:55,62:62}],140:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(62),a=n(i),s=e(179),o=n(s),u=/^\*\s*@jsx\s+([^\s]+)/,p={group:"builtin-advanced"};r.metadata=p;var l=e(55)({pre:function(e){var t=e.tagName,r=e.args;a.isCompatTag(t)?r.push(o.literal(t)):r.push(e.tagExpr)},post:function(e,t){e.callee=t.get("jsxIdentifier")}});r.visitor=l,l.Program=function(e,t,r,n){for(var i=n.opts.jsxPragma,a=0;a<n.ast.comments.length;a++){var s=n.ast.comments[a],p=u.exec(s.value);if(p){if(i=p[1],"React.DOM"===i)throw n.errorWithNode(s,"The @jsx React.DOM pragma has been deprecated as of React 0.12");break}}n.set("jsxIdentifier",i.split(".").map(o.identifier).reduce(function(e,t){return o.memberExpression(e,t)}))}},{179:179,55:55,62:62}],141:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e){for(var t,r=[];e;){var n=e.parentPath,i=n&&n.node;if(i){if(r.push(e.key),i!==e.container){var a=Object.keys(i).some(function(t){return i[t]===e.container?(r.push(t),!0):void 0});if(!a)throw new Error("Failed to find container object in parent node")}if(p.isProgram(i)){t=i;break}}e=n}if(!t)throw new Error("Failed to find root Program node");for(var s=new l(t);r.length>0;)s=s.get(r.pop());return s}r.__esModule=!0;var s=e(543),o=i(s),u=e(179),p=n(u),l=o["default"].types.NodePath,c={group:"builtin-advanced"};r.metadata=c;var f={Function:{exit:function(e){(e.async||e.generator)&&o["default"].transform(a(this))}}};r.visitor=f},{179:179,543:543}],142:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return s.isLiteral(e)?e.raw&&e.rawValue===e.value?"use strict"===e.rawValue:"use strict"===e.value:!1}r.__esModule=!0;var a=e(179),s=n(a),o={group:"builtin-pre"};r.metadata=o;var u=["FunctionExpression","FunctionDeclaration","ClassProperty"],p={Program:{enter:function(e){var t,r=e.body[0];s.isExpressionStatement(r)&&i(r.expression)?t=r:(t=s.expressionStatement(s.literal("use strict")),this.unshiftContainer("body",t),r&&(t.leadingComments=r.leadingComments,r.leadingComments=[])),t._blockHoist=1/0}},ThisExpression:function(){return this.findParent(function(e){return!e.is("shadow")&&u.indexOf(e.type)>=0})?void 0:s.identifier("undefined")}};r.visitor=p},{179:179}],143:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){for(var r=t.get(e),n=0;n<r.length;n++){var i=r[n],a=i.node;if(s.isFunctionDeclaration(a)){var o=s.variableDeclaration("let",[s.variableDeclarator(a.id,s.toExpression(a))]);o._blockHoist=2,a.id=null,i.replaceWith(o)}}}r.__esModule=!0;var a=e(179),s=n(a),o={BlockStatement:function(e,t){s.isFunction(t)&&t.body===e||s.isExportDeclaration(t)||i("body",this)},SwitchCase:function(){i("consequent",this)}};r.visitor=o},{179:179}],144:[function(e,t,r){"use strict";r.__esModule=!0;var n=e(61),i={group:"builtin-basic"};r.metadata=i;var a={"ArrowFunctionExpression|FunctionExpression":{exit:function(){return this.parentPath.isProperty()?void 0:n.bare.apply(this,arguments)}},ObjectExpression:function(){for(var e=this.get("properties"),t=e,r=0;r<t.length;r++){var i=t[r],a=i.get("value");if(a.isFunction()){var s=n.bare(a.node,i.node,a.scope);s&&a.replaceWith(s)}}}};r.visitor=a},{61:61}],145:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){if(u.isLiteral(e)){var r=e.value,n=r.toLowerCase();if("react"===n&&r!==n)throw t.errorWithNode(e,s.get("didYouMean","react"))}}r.__esModule=!0;var a=e(43),s=n(a),o=e(179),u=n(o),p={CallExpression:function(e,t,r,n){this.get("callee").isIdentifier({name:"require"})&&1===e.arguments.length&&i(e.arguments[0],n)},ModuleDeclaration:function(e,t,r,n){i(e.source,n)}};r.visitor=p},{179:179,43:43}],146:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var s=e(155),o=i(s),u=e(179),p=n(u),l=function(){function e(t,r,n,i){a(this,e),this.queue=null,this.parentPath=i,this.scope=t,this.state=n,this.opts=r}return e.prototype.shouldVisit=function(e){var t=this.opts;if(t.enter||t.exit)return!0;if(t[e.type])return!0;var r=p.VISITOR_KEYS[e.type];if(!r||!r.length)return!1;for(var n=r,i=0;i<n.length;i++){var a=n[i];if(e[a])return!0}return!1},e.prototype.create=function(e,t,r,n){var i=o["default"].get({parentPath:this.parentPath,parent:e,container:t,key:r,listKey:n});return i.unshiftContext(this),i},e.prototype.visitMultiple=function(e,t,r){if(0===e.length)return!1;for(var n=[],i=this.queue=[],a=!1,s=0;s<e.length;s++){var o=e[s];o&&this.shouldVisit(o)&&i.push(this.create(t,e,s,r))}for(var u=i,p=0;p<u.length;p++){var l=u[p];if(l.resync(),!(n.indexOf(l.node)>=0)&&(n.push(l.node),l.visit())){a=!0;break}}for(var c=i,f=0;f<c.length;f++){var l=c[f];l.shiftContext()}return this.queue=null,a},e.prototype.visitSingle=function(e,t){if(this.shouldVisit(e[t])){var r=this.create(e,e,t);r.visit(),r.shiftContext()}},e.prototype.visit=function(e,t){var r=e[t];if(r)return Array.isArray(r)?this.visitMultiple(r,e,t):this.visitSingle(e,t)},e}();r["default"]=l,t.exports=r["default"]},{155:155,179:179}],147:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var i=function a(e){n(this,a),this.file=e};r["default"]=i,t.exports=r["default"]},{}],148:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,r,n,i){if(e){if(t||(t={}),!t.noScope&&!r&&"Program"!==e.type&&"File"!==e.type)throw new Error(f.get("traverseNeedsParent",e.type));if(l.explode(t),Array.isArray(e))for(var s=0;s<e.length;s++)a.node(e[s],t,r,n,i);else a.node(e,t,r,n,i)}}function s(e,t,r,n){e.type===n.type&&(n.has=!0,this.skip())}r.__esModule=!0,r["default"]=a;var o=e(146),u=i(o),p=e(168),l=n(p),c=e(43),f=n(c),d=e(421),h=i(d),m=e(179),y=n(m);a.visitors=l,a.verify=l.verify,a.explode=l.explode,a.node=function(e,t,r,n,i,a){var s=y.VISITOR_KEYS[e.type];if(s)for(var o=new u["default"](r,t,n,i),p=s,l=0;l<p.length;l++){var c=p[l];if((!a||!a[c])&&o.visit(e,c))return}};var g=y.COMMENT_KEYS.concat(["_scopeInfo","_paths","tokens","comments","start","end","loc","raw","rawValue"]);a.clearNode=function(e){for(var t=0;t<g.length;t++){var r=g[t];null!=e[r]&&(e[r]=void 0)}};var v={noScope:!0,exit:a.clearNode};a.removeProperties=function(e){return a(e,v),a.clearNode(e),e},a.hasType=function(e,t,r,n){if(h["default"](n,e.type))return!1;if(e.type===r)return!0;var i={has:!1,type:r};return a(e,{blacklist:n,enter:s},t,i),i.has},t.exports=r["default"]},{146:146,168:168,179:179,421:421,43:43}],149:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function a(e){for(var t=this;t=t.parentPath;)if(e(t))return t;return null}function s(){return this.findParent(function(e){return e.isFunction()||e.isProgram()})}function o(){var e=this;do if(Array.isArray(e.container))return e;while(e=e.parentPath)}function u(e){return this.getDeepestCommonAncestorFrom(e,function(e,t,r){for(var n,i=h.VISITOR_KEYS[e.type],a=r,s=0;s<a.length;s++){var o=a[s],u=o[t+1];if(n)if(u.listKey&&n.listKey===u.listKey&&u.key<n.key)n=u;else{var p=i.indexOf(n.parentKey),l=i.indexOf(u.parentKey);p>l&&(n=u)}else n=u}return n})}function p(e,t){var r=this;if(!e.length)return this;if(1===e.length)return e[0];var n,i,a=1/0,s=e.map(function(e){var t=[];do t.unshift(e);while((e=e.parentPath)&&e!==r);return t.length<a&&(a=t.length),t}),o=s[0];e:for(var u=0;a>u;u++){for(var p=o[u],l=s,c=0;c<l.length;c++){var f=l[c];if(f[u]!==p)break e}n=u,i=p}if(i)return t?t(i,n,s):i;throw new Error("Couldn't find intersection")}function l(){var e=this,t=[];do t.push(e);while(e=e.parentPath);return t}function c(){for(var e=this;e;){for(var t=arguments,r=0;r<t.length;r++){var n=t[r];if(e.node.type===n)return!0}e=e.parentPath}return!1}function f(e){var t=this;do if(t.isFunction()){var r=t.node.shadow;if(r){if(!e||r[e]!==!1)return t}else if(t.isArrowFunctionExpression())return t;return null}while(t=t.parentPath);return null}r.__esModule=!0,r.findParent=a,r.getFunctionParent=s,r.getStatementParent=o,r.getEarliestCommonAncestorFrom=u,r.getDeepestCommonAncestorFrom=p,r.getAncestry=l,r.inType=c,r.inShadow=f;var d=e(179),h=i(d),m=e(155);n(m)},{155:155,179:179}],150:[function(e,t,r){"use strict";function n(){var e=this.node;if(e){var t=e.trailingComments,r=e.leadingComments;if(t||r){var n=this.getSibling(this.key-1),i=this.getSibling(this.key+1);n.node||(n=i),i.node||(i=n),n.addComments("trailing",r),i.addComments("leading",t)}}}function i(e,t,r){this.addComments(e,[{type:r?"CommentLine":"CommentBlock",value:t}])}function a(e,t){if(t){var r=this.node;if(r){var n=e+"Comments";r[n]?r[n]=r[n].concat(t):r[n]=t}}}r.__esModule=!0,r.shareCommentsWithSiblings=n,r.addComment=i,r.addComments=a},{}],151:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e){var t=this.node;if(t)for(var r=this.opts,n=[r[e],r[t.type]&&r[t.type][e]],i=0;i<n.length;i++){var a=n[i];if(a)for(var s=a,o=0;o<s.length;o++){var u=s[o];if(u){var p=this.node;if(!p)return;var l=this.type,c=u.call(this,p,this.parent,this.scope,this.state);if(c&&this.replaceWith(c,!0),this.shouldStop||this.shouldSkip||this.removed)return;if(l!==this.type)return void this.queueNode(this)}}}}function a(){var e=this.opts.blacklist;return e&&e.indexOf(this.node.type)>-1}function s(){if(this.isBlacklisted())return!1;if(this.opts.shouldSkip&&this.opts.shouldSkip(this))return!1;if(this.call("enter"),this.shouldSkip)return this.shouldStop;var e=this.node,t=this.opts;if(e)if(Array.isArray(e))for(var r=0;r<e.length;r++)A["default"].node(e[r],t,this.scope,this.state,this,this.skipKeys);else A["default"].node(e,t,this.scope,this.state,this,this.skipKeys),this.call("exit");return this.shouldStop}function o(){this.shouldSkip=!0}function u(e){this.skipKeys[e]=!0}function p(){this.shouldStop=!0,this.shouldSkip=!0}function l(){if(!this.opts||!this.opts.noScope){var e=this.context||this.parentPath;this.scope=this.getScope(e&&e.scope),this.scope&&this.scope.init()}}function c(e){return this.shouldSkip=!1,this.shouldStop=!1,this.removed=!1,this.skipKeys={},e&&(this.context=e,this.state=e.state,this.opts=e.opts),this.setScope(),this}function f(){this.removed||(this._resyncParent(),this._resyncList(),this._resyncKey())}function d(){this.parentPath&&(this.parent=this.parentPath.node)}function h(){if(this.container&&this.node!==this.container[this.key]){if(Array.isArray(this.container)){for(var e=0;e<this.container.length;e++)if(this.container[e]===this.node)return this.setKey(e)}else for(var t in this.container)if(this.container[t]===this.node)return this.setKey(t);this.key=null}}function m(){var e=this.listKey,t=this.parentPath;if(e&&t){var r=t.node[e];this.container!==r&&(r?this.container=r:this.container=null)}}function y(){null!=this.key&&this.container&&this.container[this.key]===this.node||this._markRemoved()}function g(){this.contexts.shift(),this.setContext(this.contexts[0])}function v(e){this.contexts.unshift(e),this.setContext(e)}function b(e,t,r,n){this.inList=!!r,this.listKey=r,this.parentKey=r||n,this.container=t,this.parentPath=e||this.parentPath,this.setKey(n)}function E(e){this.key=e,this.node=this.container[this.key],this.type=this.node&&this.node.type}function x(e){for(var t=this.contexts,r=0;r<t.length;r++){var n=t[r];n.queue&&n.queue.push(e)}}r.__esModule=!0,r.call=i,r.isBlacklisted=a,r.visit=s,r.skip=o,r.skipKey=u,r.stop=p,r.setScope=l,r.setContext=c,r.resync=f,r._resyncParent=d,r._resyncKey=h,r._resyncList=m,r._resyncRemoved=y,r.shiftContext=g,r.unshiftContext=v,r.setup=b,r.setKey=E,r.queueNode=x;var S=e(148),A=n(S)},{148:148}],152:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(){var e,t=this.node;if(this.isMemberExpression())e=t.property;else{if(!this.isProperty())throw new ReferenceError("todo");e=t.key}return t.computed||o.isIdentifier(e)&&(e=o.literal(e.name)),e}function a(){return o.ensureBlock(this.node)}r.__esModule=!0,r.toComputedKey=i,r.ensureBlock=a;var s=e(179),o=n(s)},{179:179}],153:[function(e,t,r){(function(e){"use strict";function t(){var e=this.evaluate();return e.confident?!!e.value:void 0}function n(){function t(n){if(r){var a=n.node;if(n.isSequenceExpression()){var s=n.get("expressions");return t(s[s.length-1])}if(n.isLiteral()&&!a.regex)return a.value;if(n.isConditionalExpression())return t(t(n.get("test"))?n.get("consequent"):n.get("alternate"));if(n.isTypeCastExpression())return t(n.get("expression"));if(n.isIdentifier()&&!n.scope.hasBinding(a.name,!0)){if("undefined"===a.name)return;if("Infinity"===a.name)return 1/0;if("NaN"===a.name)return NaN}if(n.isMemberExpression()&&!n.parentPath.isCallExpression({callee:a})){var o=n.get("property"),u=n.get("object");if(u.isLiteral()&&o.isIdentifier()){var p=u.node.value,l=typeof p;if("number"===l||"string"===l)return p[o.node.name]}}if(n.isReferencedIdentifier()){var c=n.scope.getBinding(a.name);if(c&&c.hasValue)return c.value;var f=n.resolve();return f===n?r=!1:t(f)}if(n.isUnaryExpression({prefix:!0})){var d=n.get("argument"),h=t(d);switch(a.operator){case"void":return;case"!":return!h;case"+":return+h;case"-":return-h;case"~":return~h;case"typeof":return d.isFunction()?"function":typeof h}}if(n.isArrayExpression()||n.isObjectExpression(),n.isLogicalExpression()){var m=r,y=t(n.get("left")),g=r;r=m;var v=t(n.get("right")),b=r,E=g!==b;switch(r=g&&b,a.operator){case"||":return(y||v)&&E&&(r=!0),y||v;case"&&":return(!y&&g||!v&&b)&&(r=!0),y&&v}}if(n.isBinaryExpression()){var y=t(n.get("left")),v=t(n.get("right"));switch(a.operator){case"-":return y-v;case"+":return y+v;case"/":return y/v;case"*":return y*v;case"%":return y%v;case"**":return Math.pow(y,v);case"<":return v>y;case">":return y>v;case"<=":return v>=y;case">=":return y>=v;case"==":return y==v;case"!=":return y!=v;case"===":return y===v;case"!==":return y!==v;case"|":return y|v;case"&":return y&v;case"^":return y^v;case"<<":return y<<v;case">>":return y>>v;case">>>":return y>>>v}}if(n.isCallExpression()){var x,S,A=n.get("callee");if(A.isIdentifier()&&!n.scope.getBinding(A.node.name,!0)&&i.indexOf(A.node.name)>=0&&(S=e[a.callee.name]),A.isMemberExpression()){var u=A.get("object"),D=A.get("property");if(u.isIdentifier()&&D.isIdentifier()&&i.indexOf(u.node.name)>=0&&(x=e[u.node.name],S=x[D.node.name]),u.isLiteral()&&D.isIdentifier()){var l=typeof u.node.value;("string"===l||"number"===l)&&(x=u.node.value,S=x[D.node.name])}}if(S){var C=n.get("arguments").map(t);if(!r)return;return S.apply(x,C)}}r=!1}}var r=!0,n=t(this);return r||(n=void 0),{confident:r,value:n}}r.__esModule=!0,r.evaluateTruthy=t,r.evaluate=n;var i=["String","Number","Math"]}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],154:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(){var e=this;do{if(!e.parentPath||Array.isArray(e.container)&&e.isStatement())break;e=e.parentPath}while(e);if(e&&(e.isProgram()||e.isFile()))throw new Error("File/Program node, we can't possibly find a statement parent to this");return e}function s(){return"left"===this.key?this.getSibling("right"):"right"===this.key?this.getSibling("left"):void 0}function o(){var e=[],t=function(t){t&&(e=e.concat(t.getCompletionRecords()))};if(this.isIfStatement())t(this.get("consequent")),t(this.get("alternate"));else if(this.isDoExpression()||this.isFor()||this.isWhile())t(this.get("body"));else if(this.isProgram()||this.isBlockStatement())t(this.get("body").pop());else{if(this.isFunction())return this.get("body").getCompletionRecords();this.isTryStatement()?(t(this.get("block")),t(this.get("handler")),t(this.get("finalizer"))):e.push(this)}return e}function u(e){return h["default"].get({parentPath:this.parentPath,parent:this.parent,container:this.container,listKey:this.listKey,key:e})}function p(e,t){t===!0&&(t=this.context);var r=e.split(".");return 1===r.length?this._getKey(e,t):this._getPattern(r,t)}function l(e,t){var r=this,n=this.node,i=n[e];return Array.isArray(i)?i.map(function(a,s){return h["default"].get({listKey:e,parentPath:r,parent:n,container:i,key:s}).setContext(t)}):h["default"].get({parentPath:this,parent:n,container:n,key:e}).setContext(t)}function c(e,t){for(var r=this,n=e,i=0;i<n.length;i++){var a=n[i];r="."===a?r.parentPath:Array.isArray(r)?r[a]:r.get(a,t)}return r}function f(e){return y.getBindingIdentifiers(this.node,e)}r.__esModule=!0,r.getStatementParent=a,r.getOpposite=s,r.getCompletionRecords=o,r.getSibling=u,r.get=p,r._getKey=l,r._getPattern=c,r.getBindingIdentifiers=f;var d=e(155),h=i(d),m=e(179),y=n(m)},{155:155,179:179}],155:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var s=e(162),o=i(s),u=e(148),p=n(u),l=e(517),c=n(l),f=e(167),d=n(f),h=e(179),m=i(h),y=function(){function e(t,r){a(this,e),this.contexts=[],this.parent=r,this.data={},this.hub=t,this.shouldSkip=!1,this.shouldStop=!1,this.removed=!1,this.state=null,this.opts=null,this.skipKeys=null,this.parentPath=null,this.context=null,this.container=null,this.listKey=null,this.inList=!1,this.parentKey=null,this.key=null,this.node=null,this.scope=null,this.type=null,this.typeAnnotation=null}return e.get=function(t){var r=t.hub,n=t.parentPath,i=t.parent,a=t.container,s=t.listKey,o=t.key;!r&&n&&(r=n.hub);for(var u,p=a[o],l=i._paths=i._paths||[],c=0;c<l.length;c++){var f=l[c];if(f.node===p){u=f;break}}return u||(u=new e(r,i),l.push(u)),u.setup(n,a,s,o),u},e.prototype.getScope=function(e){var t=e;return this.isScope()&&(t=new d["default"](this,e)),t},e.prototype.setData=function(e,t){return this.data[e]=t},e.prototype.getData=function(e,t){var r=this.data[e];return!r&&t&&(r=this.data[e]=t),r},e.prototype.errorWithNode=function(e){var t=arguments.length<=1||void 0===arguments[1]?SyntaxError:arguments[1];return this.hub.file.errorWithNode(this.node,e,t)},e.prototype.traverse=function(e,t){p["default"](this.node,e,this.scope,t,this)},e}();r["default"]=y,c["default"](y.prototype,e(149)),c["default"](y.prototype,e(156)),c["default"](y.prototype,e(165)),c["default"](y.prototype,e(153)),c["default"](y.prototype,e(152)),c["default"](y.prototype,e(159)),c["default"](y.prototype,e(151)),c["default"](y.prototype,e(164)),c["default"](y.prototype,e(163)),c["default"](y.prototype,e(154)),c["default"](y.prototype,e(150));for(var g=m.TYPES,v=function(){var e=g[b],t="is"+e;y.prototype[t]=function(e){return m[t](this.node,e)}},b=0;b<g.length;b++)v();var E=function(e){return"_"===e[0]?"continue":(m.TYPES.indexOf(e)<0&&m.TYPES.push(e),void(y.prototype["is"+e]=function(t){return o[e].checkPath(this,t)}))};for(var x in o){E(x)}t.exports=r["default"]},{148:148,149:149,150:150,151:151,152:152,153:153,154:154,156:156,159:159,162:162,163:163,164:164,165:165,167:167,179:179,517:517}],156:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(){if(this.typeAnnotation)return this.typeAnnotation;var e=this._getTypeAnnotation()||h.anyTypeAnnotation();return h.isTypeAnnotation(e)&&(e=e.typeAnnotation),this.typeAnnotation=e}function a(){var e=this.node;{if(e){if(e.typeAnnotation)return e.typeAnnotation;var t=f[e.type];return t?t.call(this,e):(t=f[this.parentPath.type],t&&t.validParent?this.parentPath.getTypeAnnotation():void 0)}if("init"===this.key&&this.parentPath.isVariableDeclarator()){var r=this.parentPath.parentPath,n=r.parentPath;return"left"===r.key&&n.isForInStatement()?h.stringTypeAnnotation():"left"===r.key&&n.isForOfStatement()?h.anyTypeAnnotation():h.voidTypeAnnotation()}}}function s(e,t){return o(e,this.getTypeAnnotation(),t)}function o(e,t,r){if("string"===e)return h.isStringTypeAnnotation(t);if("number"===e)return h.isNumberTypeAnnotation(t);if("boolean"===e)return h.isBooleanTypeAnnotation(t);if("any"===e)return h.isAnyTypeAnnotation(t);if("mixed"===e)return h.isMixedTypeAnnotation(t);if("void"===e)return h.isVoidTypeAnnotation(t);if(r)return!1;throw new Error("Unknown base type "+e)}function u(e){var t=this.getTypeAnnotation();if(h.isAnyTypeAnnotation(t))return!0;if(h.isUnionTypeAnnotation(t)){for(var r=t.types,n=0;n<r.length;n++){var i=r[n];if(h.isAnyTypeAnnotation(i)||o(e,i,!0))return!0}return!1}return o(e,t,!0)}function p(e){var t=this.getTypeAnnotation();return e=e.getTypeAnnotation(),!h.isAnyTypeAnnotation()&&h.isFlowBaseAnnotation(t)?e.type===t.type:void 0}function l(e){var t=this.getTypeAnnotation();return h.isGenericTypeAnnotation(t)&&h.isIdentifier(t.id,{name:e})}r.__esModule=!0,r.getTypeAnnotation=i,r._getTypeAnnotation=a,r.isBaseType=s,r.couldBeBaseType=u,r.baseTypeStrictlyMatches=p,r.isGenericType=l;var c=e(158),f=n(c),d=e(179),h=n(d)},{158:158,179:179}],157:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);
return t["default"]=e,t}function i(e,t){var r=e.scope.getBinding(t),n=[];e.typeAnnotation=l.unionTypeAnnotation(n);var i=[],s=a(r,e,i),o=u(e,t);if(o){var p=a(r,o.ifStatement);s=s.filter(function(e){return p.indexOf(e)<0}),n.push(o.typeAnnotation)}if(s.length){var c=s.reverse(),f=[];s=[];for(var d=c,h=0;h<d.length;h++){var m=d[h],y=m.scope;if(!(f.indexOf(y)>=0)&&(f.push(y),s.push(m),y===e.scope)){s=[m];break}}s=s.concat(i);for(var g=s,v=0;v<g.length;v++){var m=g[v];n.push(m.getTypeAnnotation())}}return n.length?l.createUnionTypeAnnotation(n):void 0}function a(e,t,r){var n=e.constantViolations.slice();return n.unshift(e.path),n.filter(function(e){e=e.resolve();var n=e._guessExecutionStatusRelativeTo(t);return r&&"function"===n&&r.push(e),"before"===n})}function s(e,t){var r,n=t.node.operator,i=t.get("right").resolve(),a=t.get("left").resolve();if(a.isIdentifier({name:e})?r=i:i.isIdentifier({name:e})&&(r=a),r)return"==="===n?r.getTypeAnnotation():l.BOOLEAN_NUMBER_BINARY_OPERATORS.indexOf(n)>=0?l.numberTypeAnnotation():void 0;if("==="===n){var s,o;if(a.isUnaryExpression({operator:"typeof"})?(s=a,o=i):i.isUnaryExpression({operator:"typeof"})&&(s=i,o=a),(o||s)&&(o=o.resolve(),o.isLiteral())){var u=o.node.value;if("string"==typeof u&&s.get("argument").isIdentifier({name:e}))return l.createTypeAnnotationBasedOnTypeof(o.node.value)}}}function o(e){for(var t;t=e.parentPath;){if(t.isIfStatement()||t.isConditionalExpression())return"test"===e.key?void 0:t;e=t}}function u(e,t){var r=o(e);if(r){var n=r.get("test"),i=[n],a=[];do{var p=i.shift().resolve();if(p.isLogicalExpression()&&(i.push(p.get("left")),i.push(p.get("right"))),p.isBinaryExpression()){var c=s(t,p);c&&a.push(c)}}while(i.length);return a.length?{typeAnnotation:l.createUnionTypeAnnotation(a),ifStatement:r}:u(r,t)}}r.__esModule=!0;var p=e(179),l=n(p);r["default"]=function(e){if(this.isReferenced()){var t=this.scope.getBinding(e.name);return t?t.identifier.typeAnnotation?t.identifier.typeAnnotation:i(this,e.name):"undefined"===e.name?l.voidTypeAnnotation():"NaN"===e.name||"Infinity"===e.name?l.numberTypeAnnotation():void("arguments"===e.name)}},t.exports=r["default"]},{179:179}],158:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e["default"]:e}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function a(){var e=this.get("id");return e.isIdentifier()?this.get("init").getTypeAnnotation():void 0}function s(e){return e.typeAnnotation}function o(e){return this.get("callee").isIdentifier()?C.genericTypeAnnotation(e.callee):void 0}function u(){return C.stringTypeAnnotation()}function p(e){var t=e.operator;return"void"===t?C.voidTypeAnnotation():C.NUMBER_UNARY_OPERATORS.indexOf(t)>=0?C.numberTypeAnnotation():C.STRING_UNARY_OPERATORS.indexOf(t)>=0?C.stringTypeAnnotation():C.BOOLEAN_UNARY_OPERATORS.indexOf(t)>=0?C.booleanTypeAnnotation():void 0}function l(e){var t=e.operator;if(C.NUMBER_BINARY_OPERATORS.indexOf(t)>=0)return C.numberTypeAnnotation();if(C.BOOLEAN_BINARY_OPERATORS.indexOf(t)>=0)return C.booleanTypeAnnotation();if("+"===t){var r=this.get("right"),n=this.get("left");return n.isBaseType("number")&&r.isBaseType("number")?C.numberTypeAnnotation():n.isBaseType("string")||r.isBaseType("string")?C.stringTypeAnnotation():C.unionTypeAnnotation([C.stringTypeAnnotation(),C.numberTypeAnnotation()])}}function c(){return C.createUnionTypeAnnotation([this.get("left").getTypeAnnotation(),this.get("right").getTypeAnnotation()])}function f(){return C.createUnionTypeAnnotation([this.get("consequent").getTypeAnnotation(),this.get("alternate").getTypeAnnotation()])}function d(){return this.get("expressions").pop().getTypeAnnotation()}function h(){return this.get("right").getTypeAnnotation()}function m(e){var t=e.operator;return"++"===t||"--"===t?C.numberTypeAnnotation():void 0}function y(e){var t=e.value;return"string"==typeof t?C.stringTypeAnnotation():"number"==typeof t?C.numberTypeAnnotation():"boolean"==typeof t?C.booleanTypeAnnotation():null===t?C.voidTypeAnnotation():e.regex?C.genericTypeAnnotation(C.identifier("RegExp")):void 0}function g(){return C.genericTypeAnnotation(C.identifier("Object"))}function v(){return C.genericTypeAnnotation(C.identifier("Array"))}function b(){return v()}function E(){return C.genericTypeAnnotation(C.identifier("Function"))}function x(){return A(this.get("callee"))}function S(){return A(this.get("tag"))}function A(e){if(e=e.resolve(),e.isFunction()){if(e.is("async"))return e.is("generator")?C.genericTypeAnnotation(C.identifier("AsyncIterator")):C.genericTypeAnnotation(C.identifier("Promise"));if(e.node.returnType)return e.node.returnType}}r.__esModule=!0,r.VariableDeclarator=a,r.TypeCastExpression=s,r.NewExpression=o,r.TemplateLiteral=u,r.UnaryExpression=p,r.BinaryExpression=l,r.LogicalExpression=c,r.ConditionalExpression=f,r.SequenceExpression=d,r.AssignmentExpression=h,r.UpdateExpression=m,r.Literal=y,r.ObjectExpression=g,r.ArrayExpression=v,r.RestElement=b,r.CallExpression=x,r.TaggedTemplateExpression=S;var D=e(179),C=i(D),w=e(157);r.Identifier=n(w),s.validParent=!0,b.validParent=!0,r.Function=E,r.Class=E},{157:157,179:179}],159:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){function r(e){var t=n[a];return"*"===t||e===t}if(!this.isMemberExpression())return!1;for(var n=e.split("."),i=[this.node],a=0;i.length;){var s=i.shift();if(t&&a===n.length)return!0;if(A.isIdentifier(s)){if(!r(s.name))return!1}else if(A.isLiteral(s)){if(!r(s.value))return!1}else{if(A.isMemberExpression(s)){if(s.computed&&!A.isLiteral(s.property))return!1;i.unshift(s.property),i.unshift(s.object);continue}if(!A.isThisExpression(s))return!1;if(!r("this"))return!1}if(++a>n.length)return!1}return a===n.length}function s(e){var t=this.node[e];return t&&Array.isArray(t)?!!t.length:!!t}function o(e){return!this.has(e)}function u(e,t){return this.node[e]===t}function p(e){return A.isType(this.type,e)}function l(){return("init"===this.key||"left"===this.key)&&this.parentPath.isFor()}function c(e){return"body"===this.key&&this.parentPath.isArrowFunctionExpression()?this.isExpression()?A.isBlockStatement(e):this.isBlockStatement()?A.isExpression(e):!1:!1}function f(e){var t=this,r=!0;do{var n=t.container;if(t.isFunction()&&!r)return!!e;if(r=!1,Array.isArray(n)&&t.key!==n.length-1)return!1}while((t=t.parentPath)&&!t.isProgram());return!0}function d(){return this.parentPath.isLabeledStatement()||A.isBlockStatement(this.container)?!1:x["default"](A.STATEMENT_OR_BLOCK_KEYS,this.key)}function h(e,t){if(!this.isReferencedIdentifier())return!1;var r=this.scope.getBinding(this.node.name);if(!r||"module"!==r.kind)return!1;var n=r.path,i=n.parentPath;return i.isImportDeclaration()?i.node.source.value!==e?!1:t?n.isImportDefaultSpecifier()&&"default"===t?!0:n.isImportNamespaceSpecifier()&&"*"===t?!0:n.isImportSpecifier()&&n.node.imported.name===t?!0:!1:!0:!1}function m(){var e=this.node;return e.end?this.hub.file.code.slice(e.start,e.end):""}function y(e){return"after"!==this._guessExecutionStatusRelativeTo(e)}function g(e){var t=e.scope.getFunctionParent(),r=this.scope.getFunctionParent();if(t!==r)return"function";var n,i,a,s=e.getAncestry(),o=this.getAncestry();for(a=0;a<o.length;a++){var u=o[a];if(i=s.indexOf(u),i>=0){n=u;break}}if(!n)return"before";var p=s[i-1],l=o[a-1];if(!p||!l)return"before";if(p.listKey&&p.container===l.container)return p.key>l.key?"before":"after";var c=A.VISITOR_KEYS[p.type].indexOf(p.key),f=A.VISITOR_KEYS[l.type].indexOf(l.key);return c>f?"before":"after"}function v(e,t){return this._resolve(e,t)||this}function b(e,t){if(!(t&&t.indexOf(this)>=0))if(t=t||[],t.push(this),this.isVariableDeclarator()){if(this.get("id").isIdentifier())return this.get("init").resolve(e,t)}else if(this.isReferencedIdentifier()){var r=this.scope.getBinding(this.node.name);if(!r)return;if(!r.constant)return;if("module"===r.kind)return;if(r.path!==this)return r.path.resolve(e,t)}else{if(this.isTypeCastExpression())return this.get("expression").resolve(e,t);if(e&&this.isMemberExpression()){var n=this.toComputedKey();if(!A.isLiteral(n))return;var i=n.value,a=this.get("object").resolve(e,t);if(a.isObjectExpression())for(var s=a.get("properties"),o=s,u=0;u<o.length;u++){var p=o[u];if(p.isProperty()){var l=p.get("key"),c=p.isnt("computed")&&l.isIdentifier({name:i});if(c=c||l.isLiteral({value:i}))return p.get("value").resolve(e,t)}}else if(a.isArrayExpression()&&!isNaN(+i)){var f=a.get("elements"),d=f[i];if(d)return d.resolve(e,t)}}}}r.__esModule=!0,r.matchesPattern=a,r.has=s,r.isnt=o,r.equals=u,r.isNodeType=p,r.canHaveVariableDeclarationOrExpression=l,r.canSwapBetweenExpressionAndStatement=c,r.isCompletionRecord=f,r.isStatementOrBlock=d,r.referencesImport=h,r.getSource=m,r.willIMaybeExecuteBefore=y,r._guessExecutionStatusRelativeTo=g,r.resolve=v,r._resolve=b;var E=e(421),x=i(E),S=e(179),A=n(S),D=s;r.is=D},{179:179,421:421}],160:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var a=e(62),s=n(a),o=e(179),u=n(o),p={ReferencedIdentifier:function(e,t,r,n){if(!this.isJSXIdentifier()||!s.isCompatTag(e.name)){var i=r.getBinding(e.name);if(i&&i===n.scope.getBinding(e.name))if(i.constant)n.bindings[e.name]=i;else for(var a=i.constantViolations,o=0;o<a.length;o++){var u=a[o];n.breakOnScopePaths=n.breakOnScopePaths.concat(u.getAncestry())}}}},l=function(){function e(t,r){i(this,e),this.breakOnScopePaths=[],this.bindings={},this.scopes=[],this.scope=r,this.path=t}return e.prototype.isCompatibleScope=function(e){for(var t in this.bindings){var r=this.bindings[t];if(!e.bindingIdentifierEquals(t,r.identifier))return!1}return!0},e.prototype.getCompatibleScopes=function(){var e=this.path.scope;do{if(!this.isCompatibleScope(e))break;if(this.scopes.push(e),this.breakOnScopePaths.indexOf(e.path)>=0)break}while(e=e.parent)},e.prototype.getAttachmentPath=function(){var e=this.scopes,t=e.pop();if(t){if(t.path.isFunction()){if(this.hasOwnParamBindings(t)){if(this.scope===t)return;return t.path.get("body").get("body")[0]}return this.getNextScopeStatementParent()}return t.path.isProgram()?this.getNextScopeStatementParent():void 0}},e.prototype.getNextScopeStatementParent=function(){var e=this.scopes.pop();return e?e.path.getStatementParent():void 0},e.prototype.hasOwnParamBindings=function(e){for(var t in this.bindings)if(e.hasOwnBinding(t)){var r=this.bindings[t];if("param"===r.kind)return!0}return!1},e.prototype.run=function(){var e=this.path.node;if(!e._hoisted){e._hoisted=!0,this.path.traverse(p,this),this.getCompatibleScopes();var t=this.getAttachmentPath();if(t&&t.getFunctionParent()!==this.path.getFunctionParent()){var r=t.scope.generateUidIdentifier("ref");t.insertBefore([u.variableDeclaration("var",[u.variableDeclarator(r,this.path.node)])]);var n=this.path.parentPath;n.isJSXElement()&&this.path.container===n.node.children&&(r=u.JSXExpressionContainer(r)),this.path.replaceWith(r)}}},e}();r["default"]=l,t.exports=r["default"]},{179:179,62:62}],161:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i),s=[function(e){return"body"===e.key&&(e.isBlockStatement()||e.isClassBody())?(e.node.body=[],!0):void 0},function(e,t){var r=!1;return r=r||"body"===e.key&&t.isArrowFunctionExpression(),r=r||"argument"===e.key&&t.isThrowStatement(),r?(e.replaceWith(a.identifier("undefined")),!0):void 0}];r.pre=s;var o=[function(e,t){var r=!1;return r=r||"test"===e.key&&(t.isWhile()||t.isSwitchCase()),r=r||"declaration"===e.key&&t.isExportDeclaration(),r=r||"body"===e.key&&t.isLabeledStatement(),r=r||"declarations"===e.listKey&&t.isVariableDeclaration()&&0===t.node.declarations.length,r=r||"expression"===e.key&&t.isExpressionStatement(),r=r||"test"===e.key&&t.isIfStatement(),r?(t.dangerouslyRemove(),!0):void 0},function(e,t){return t.isSequenceExpression()&&1===t.node.expressions.length?(t.replaceWith(t.node.expressions[0]),!0):void 0},function(e,t){return t.isBinary()?("left"===e.key?t.replaceWith(t.node.right):t.replaceWith(t.node.left),!0):void 0}];r.post=o},{179:179}],162:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(62),a=n(i),s=e(179),o=n(s),u={types:["Identifier","JSXIdentifier"],checkPath:function(e,t){var r=e.node,n=e.parent;if(!o.isIdentifier(r,t)){if(!o.isJSXIdentifier(r,t))return!1;if(a.isCompatTag(r.name))return!1}return o.isReferenced(r,n)}};r.ReferencedIdentifier=u;var p={types:["Identifier"],checkPath:function(e){var t=e.node,r=e.parent;return o.isBinding(t,r)}};r.BindingIdentifier=p;var l={types:["Statement"],checkPath:function(e){var t=e.node,r=e.parent;if(o.isStatement(t)){if(o.isVariableDeclaration(t)){if(o.isForXStatement(r,{left:t}))return!1;if(o.isForStatement(r,{init:t}))return!1}return!0}return!1}};r.Statement=l;var c={types:["Expression"],checkPath:function(e){return e.isIdentifier()?e.isReferencedIdentifier():o.isExpression(e.node)}};r.Expression=c;var f={types:["Scopable"],checkPath:function(e){return o.isScope(e.node,e.parent)}};r.Scope=f;var d={checkPath:function(e){return o.isReferenced(e.node,e.parent)}};r.Referenced=d;var h={checkPath:function(e){return o.isBlockScoped(e.node)}};r.BlockScoped=h;var m={types:["VariableDeclaration"],checkPath:function(e){return o.isVar(e.node)}};r.Var=m;var y={types:["Literal"],checkPath:function(e){return e.isLiteral()&&e.parentPath.isExpressionStatement()}};r.DirectiveLiteral=y;var g={types:["ExpressionStatement"],checkPath:function(e){return e.get("expression").isLiteral()}};r.Directive=g;var v={checkPath:function(e){return e.node&&!!e.node.loc}};r.User=v;var b={checkPath:function(e){return!e.isUser()}};r.Generated=b;var E={types:["Flow","ImportDeclaration","ExportDeclaration"],checkPath:function(e){var t=e.node;return o.isFlow(t)?!0:o.isImportDeclaration(t)?"type"===t.importKind||"typeof"===t.importKind:o.isExportDeclaration(t)?"type"===t.exportKind:!1}};r.Flow=E},{179:179,62:62}],163:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e){if(this._assertUnremoved(),e=this._verifyNodeList(e),this.parentPath.isExpressionStatement()||this.parentPath.isLabeledStatement())return this.parentPath.insertBefore(e);if(this.isNodeType("Expression")||this.parentPath.isForStatement()&&"init"===this.key)this.node&&e.push(this.node),this.replaceExpressionWithStatements(e);else{if(this._maybePopFromStatements(e),Array.isArray(this.container))return this._containerInsertBefore(e);if(!this.isStatementOrBlock())throw new Error("We don't know what to do with this node type. We were previously a Statement but we can't fit in here?");this.node&&e.push(this.node),this.node=this.container[this.key]=x.blockStatement(e)}return[this]}function s(e,t){this.updateSiblingKeys(e,t.length);for(var r=[],n=0;n<t.length;n++){var i=e+n,a=t[n];if(this.container.splice(i,0,a),this.context){var s=this.context.create(this.parent,this.container,i,this.listKey);r.push(s),this.queueNode(s)}else r.push(b["default"].get({parentPath:this,parent:a,container:this.container,listKey:this.listKey,key:i}))}return r}function o(e){return this._containerInsert(this.key,e)}function u(e){return this._containerInsert(this.key+1,e)}function p(e){var t=e[e.length-1];x.isExpressionStatement(t)&&x.isIdentifier(t.expression)&&!this.isCompletionRecord()&&e.pop()}function l(e){if(this._assertUnremoved(),e=this._verifyNodeList(e),this.parentPath.isExpressionStatement()||this.parentPath.isLabeledStatement())return this.parentPath.insertAfter(e);if(this.isNodeType("Expression")||this.parentPath.isForStatement()&&"init"===this.key){if(this.node){var t=this.scope.generateDeclaredUidIdentifier();e.unshift(x.expressionStatement(x.assignmentExpression("=",t,this.node))),e.push(x.expressionStatement(t))}this.replaceExpressionWithStatements(e)}else{if(this._maybePopFromStatements(e),Array.isArray(this.container))return this._containerInsertAfter(e);if(!this.isStatementOrBlock())throw new Error("We don't know what to do with this node type. We were previously a Statement but we can't fit in here?");this.node&&e.unshift(this.node),this.node=this.container[this.key]=x.blockStatement(e)}return[this]}function c(e,t){for(var r=this.parent._paths,n=0;n<r.length;n++){var i=r[n];i.key>=e&&(i.key+=t)}}function f(e){e.constructor!==Array&&(e=[e]);for(var t=0;t<e.length;t++){var r=e[t];if(!r)throw new Error("Node list has falsy node with the index of "+t);if("object"!=typeof r)throw new Error("Node list contains a non-object node with the index of "+t);if(!r.type)throw new Error("Node list contains a node without a type with the index of "+t);r instanceof b["default"]&&(e[t]=r.node)}return e}function d(e,t){this._assertUnremoved(),t=this._verifyNodeList(t);var r=this.node[e],n=b["default"].get({parentPath:this,parent:this.node,container:r,listKey:e,key:0});return n.insertBefore(t)}function h(e,t){this._assertUnremoved(),t=this._verifyNodeList(t);var r=this.node[e],n=r.length,i=b["default"].get({parentPath:this,parent:this.node,container:r,listKey:e,key:n});return i.replaceWith(t,!0)}function m(){var e=arguments.length<=0||void 0===arguments[0]?this.scope:arguments[0],t=new g["default"](this,e);return t.run()}r.__esModule=!0,r.insertBefore=a,r._containerInsert=s,r._containerInsertBefore=o,r._containerInsertAfter=u,r._maybePopFromStatements=p,r.insertAfter=l,r.updateSiblingKeys=c,r._verifyNodeList=f,r.unshiftContainer=d,r.pushContainer=h,r.hoist=m;var y=e(160),g=i(y),v=e(155),b=i(v),E=e(179),x=n(E)},{155:155,160:160,179:179}],164:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(){return console.trace("Path#remove has been renamed to Path#dangerouslyRemove, removing a node is extremely dangerous so please refrain using it."),this.dangerouslyRemove()}function a(){return this._assertUnremoved(),this.resync(),this._callRemovalHooks("pre")?void this._markRemoved():(this.shareCommentsWithSiblings(),this._remove(),this._markRemoved(),void this._callRemovalHooks("post"))}function s(e){for(var t=c[e],r=0;r<t.length;r++){var n=t[r];if(n(this,this.parentPath))return!0}}function o(){Array.isArray(this.container)?(this.container.splice(this.key,1),this.updateSiblingKeys(this.key,-1)):this.container[this.key]=null}function u(){this.shouldSkip=!0,this.removed=!0,this.node=null}function p(){if(this.removed)throw this.errorWithNode("NodePath has been removed so is read-only.")}r.__esModule=!0,r.remove=i,r.dangerouslyRemove=a,r._callRemovalHooks=s,r._remove=o,r._markRemoved=u,r._assertUnremoved=p;var l=e(161),c=n(l)},{161:161}],165:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e){this.resync(),e=this._verifyNodeList(e),b.inheritLeadingComments(e[0],this.node),b.inheritTrailingComments(e[e.length-1],this.node),this.node=this.container[this.key]=null,this.insertAfter(e),this.node||this.dangerouslyRemove()}function s(e){this.resync();try{e="("+e+")",e=g["default"](e)}catch(t){var r=t.loc;throw r&&(t.message+=" - make sure this is an expression.",t.message+="\n"+c["default"](e,r.line,r.column+1)),t}return e=e.program.body[0].expression,d["default"].removeProperties(e),this.replaceWith(e)}function o(e,t){if(this.resync(),this.removed)throw new Error("You can't replace this node, we've already removed it");if(e instanceof m["default"]&&(e=e.node),!e)throw new Error("You passed `path.replaceWith()` a falsy node, use `path.dangerouslyRemove()` instead");if(this.node!==e){if(this.isProgram()&&!b.isProgram(e))throw new Error("You can only replace a Program root node with another Program node");if(b.isProgram(e)&&!this.isProgram()&&(e=e.body,t=!0),Array.isArray(e)){if(t)return this.replaceWithMultiple(e);throw new Error("Don't use `path.replaceWith()` with an array of nodes, use `path.replaceWithMultiple()`")}if("string"==typeof e)return this.replaceWithSourceString();if(this.isNodeType("Statement")&&b.isExpression(e)&&(this.canHaveVariableDeclarationOrExpression()||this.canSwapBetweenExpressionAndStatement(e)||(e=b.expressionStatement(e))),this.isNodeType("Expression")&&b.isStatement(e)&&!this.canSwapBetweenExpressionAndStatement(e))return this.replaceExpressionWithStatements([e]);var r=this.node;r&&b.inheritsComments(e,r),this.node=this.container[this.key]=e,this.type=e.type,this.setScope()}}function u(e){this.resync();var t=b.toSequenceExpression(e,this.scope);if(t)return this.replaceWith(t);var r=b.functionExpression(null,[],b.blockStatement(e));r.shadow=!0,this.replaceWith(b.callExpression(r,[])),this.traverse(E);for(var n=this.get("callee").getCompletionRecords(),i=n,a=0;a<i.length;a++){var s=i[a];if(s.isExpressionStatement()){var o=s.findParent(function(e){return e.isLoop()});if(o){var u=this.get("callee").scope.generateDeclaredUidIdentifier("ret");this.get("callee.body").pushContainer("body",b.returnStatement(u)),s.get("expression").replaceWith(b.assignmentExpression("=",u,s.node.expression))}else s.replaceWith(b.returnStatement(s.node.expression))}}return this.node}function p(e){return this.resync(),Array.isArray(e)?Array.isArray(this.container)?(e=this._verifyNodeList(e),this._containerInsertAfter(e),this.dangerouslyRemove()):this.replaceWithMultiple(e):this.replaceWith(e)}r.__esModule=!0,r.replaceWithMultiple=a,r.replaceWithSourceString=s,r.replaceWith=o,r.replaceExpressionWithStatements=u,r.replaceInline=p;var l=e(38),c=i(l),f=e(148),d=i(f),h=e(155),m=i(h),y=e(42),g=i(y),v=e(179),b=n(v),E={Function:function(){this.skip()},VariableDeclaration:function(e,t,r){if("var"===e.kind){var n=this.getBindingIdentifiers();for(var i in n)r.push({id:n[i]});for(var a=[],s=e.declarations,o=0;o<s.length;o++){var u=s[o];u.init&&a.push(b.expressionStatement(b.assignmentExpression("=",u.id,u.init)))}return a}}}},{148:148,155:155,179:179,38:38,42:42}],166:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var i=function(){function e(t){var r=t.existing,i=t.identifier,a=t.scope,s=t.path,o=t.kind;n(this,e),this.constantViolations=[],this.constant=!0,this.identifier=i,this.references=0,this.referenced=!1,this.scope=a,this.path=s,this.kind=o,this.hasValue=!1,this.hasDeoptedValue=!1,this.value=null,this.clearValue(),r&&(this.constantViolations=[].concat(r.path,r.constantViolations,this.constantViolations))}return e.prototype.deoptValue=function(){this.clearValue(),this.hasDeoptedValue=!0},e.prototype.setValue=function(e){this.hasDeoptedValue||(this.hasValue=!0,this.value=e)},e.prototype.clearValue=function(){this.hasDeoptedValue=!1,this.hasValue=!1,this.value=null},e.prototype.reassign=function(e){this.constant=!1,this.constantViolations.push(e)},e.prototype.reference=function(){this.referenced=!0,this.references++},e.prototype.dereference=function(){this.references--,this.referenced=!!this.references},e}();r["default"]=i,t.exports=r["default"]},{}],167:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var s=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=e(421),u=i(o),p=e(592),l=i(p),c=e(148),f=i(c),d=e(518),h=i(d),m=e(43),y=n(m),g=e(166),v=i(g),b=e(405),E=i(b),x=e(414),S=i(x),A=e(519),D=i(A),C=e(41),w=i(C),I=e(179),_=n(I),F={For:function(){for(var e=_.FOR_INIT_KEYS,t=0;t<e.length;t++){var r=e[t],n=this.get(r);n.isVar()&&this.scope.getFunctionParent().registerBinding("var",n)}},Declaration:function(){this.isBlockScoped()||this.isExportDeclaration()&&this.get("declaration").isDeclaration()||this.scope.getFunctionParent().registerDeclaration(this)},ReferencedIdentifier:function(e,t,r,n){n.references.push(this)},ForXStatement:function(e,t,r,n){var i=this.get("left");(i.isPattern()||i.isIdentifier())&&n.constantViolations.push(i)},ExportDeclaration:{exit:function(e,t,r){var n=e.declaration;if(_.isClassDeclaration(n)||_.isFunctionDeclaration(n)){var i=r.getBinding(n.id.name);i&&i.reference()}else if(_.isVariableDeclaration(n))for(var a=n.declarations,s=0;s<a.length;s++){var o=a[s],u=_.getBindingIdentifiers(o);for(var p in u){var i=r.getBinding(p);i&&i.reference()}}}},LabeledStatement:function(){this.scope.getProgramParent().addGlobal(this.node),this.scope.getBlockParent().registerDeclaration(this)},AssignmentExpression:function(e,t,r,n){n.assignments.push(this)},UpdateExpression:function(e,t,r,n){n.constantViolations.push(this.get("argument"))},UnaryExpression:function(e,t,r,n){"delete"===this.node.operator&&n.constantViolations.push(this.get("argument"))},BlockScoped:function(){var e=this.scope;e.path===this&&(e=e.parent),e.getBlockParent().registerDeclaration(this)},ClassDeclaration:function(){var e=this.node.id.name;this.scope.bindings[e]=this.scope.getBinding(e)},Block:function(){for(var e=this.get("body"),t=e,r=0;r<t.length;r++){var n=t[r];n.isFunctionDeclaration()&&this.scope.getBlockParent().registerDeclaration(n)}}},k={ReferencedIdentifier:function(e,t,r,n){e.name===n.oldName&&(e.name=n.newName)},Scope:function(e,t,r,n){r.bindingIdentifierEquals(n.oldName,n.binding)||this.skip()},"AssignmentExpression|Declaration":function(e,t,r,n){var i=this.getBindingIdentifiers();for(var a in i)a===n.oldName&&(i[a].name=n.newName)}},P=function(){function e(t,r){if(a(this,e),r&&r.block===t.node)return r;var n=t.getData("scope");return n&&n.parent===r&&n.block===t.node?n:(t.setData("scope",this),this.parent=r,this.hub=t.hub,this.parentBlock=t.parent,this.block=t.node,void(this.path=t))}return e.prototype.traverse=function(e,t,r){f["default"](e,t,this,r,this.path)},e.prototype.generateDeclaredUidIdentifier=function(){var e=arguments.length<=0||void 0===arguments[0]?"temp":arguments[0],t=this.generateUidIdentifier(e);return this.push({id:t}),t},e.prototype.generateUidIdentifier=function(e){return _.identifier(this.generateUid(e))},e.prototype.generateUid=function(e){e=_.toIdentifier(e).replace(/^_+/,"");var t,r=0;do t=this._generateUid(e,r),r++;while(this.hasBinding(t)||this.hasGlobal(t)||this.hasReference(t));var n=this.getProgramParent();return n.references[t]=!0,n.uids[t]=!0,t},e.prototype._generateUid=function(e,t){var r=e;return t>1&&(r+=t),"_"+r},e.prototype.generateUidIdentifierBasedOnNode=function(e,t){var r=e;_.isAssignmentExpression(e)?r=e.left:_.isVariableDeclarator(e)?r=e.id:_.isProperty(r)&&(r=r.key);var n=[],i=function s(e){if(_.isModuleDeclaration(e))if(e.source)s(e.source);else if(e.specifiers&&e.specifiers.length)for(var t=e.specifiers,r=0;r<t.length;r++){var i=t[r];s(i)}else e.declaration&&s(e.declaration);else if(_.isModuleSpecifier(e))s(e.local);else if(_.isMemberExpression(e))s(e.object),s(e.property);else if(_.isIdentifier(e))n.push(e.name);else if(_.isLiteral(e))n.push(e.value);else if(_.isCallExpression(e))s(e.callee);else if(_.isObjectExpression(e)||_.isObjectPattern(e))for(var a=e.properties,o=0;o<a.length;o++){var u=a[o];s(u.key||u.argument)}};i(r);var a=n.join("$");return a=a.replace(/^_/,"")||t||"ref",this.generateUidIdentifier(a)},e.prototype.isStatic=function(e){if(_.isThisExpression(e)||_.isSuper(e))return!0;if(_.isIdentifier(e)){var t=this.getBinding(e.name);return t?t.constant:this.hasBinding(e.name)}return!1},e.prototype.maybeGenerateMemoised=function(e,t){if(this.isStatic(e))return null;var r=this.generateUidIdentifierBasedOnNode(e);return t||this.push({id:r}),r},e.prototype.checkBlockScopedCollisions=function(e,t,r,n){if("param"!==t&&("hoisted"!==t||"let"!==e.kind)){var i=!1;if(i||(i="let"===t||"let"===e.kind||"const"===e.kind||"module"===e.kind),i||(i="param"===e.kind&&("let"===t||"const"===t)),i)throw this.hub.file.errorWithNode(n,y.get("scopeDuplicateDeclaration",r),TypeError)}},e.prototype.rename=function(e,t,r){t=t||this.generateUidIdentifier(e).name;var n=this.getBinding(e);if(n){var i={newName:t,oldName:e,binding:n.identifier,info:n},a=n.scope;a.traverse(r||a.block,k,i),r||(a.removeOwnBinding(e),a.bindings[t]=n,i.binding.name=t);var s=this.hub.file;s&&this._renameFromMap(s.moduleFormatter.localImports,e,t,i.binding)}},e.prototype._renameFromMap=function(e,t,r,n){e[t]&&(e[r]=n,e[t]=null)},e.prototype.dump=function(){var e=l["default"]("-",60);console.log(e);var t=this;do{console.log("#",t.block.type);for(var r in t.bindings){var n=t.bindings[r];console.log(" -",r,{constant:n.constant,references:n.references,kind:n.kind})}}while(t=t.parent);console.log(e)},e.prototype.toArray=function(e,t){var r=this.hub.file;if(_.isIdentifier(e)){var n=this.getBinding(e.name);if(n&&n.constant&&n.path.isGenericType("Array"))return e}if(_.isArrayExpression(e))return e;if(_.isIdentifier(e,{name:"arguments"}))return _.callExpression(_.memberExpression(r.addHelper("slice"),_.identifier("call")),[e]);var i="to-array",a=[e];return t===!0?i="to-consumable-array":t&&(a.push(_.literal(t)),i="sliced-to-array",this.hub.file.isLoose("es6.forOf")&&(i+="-loose")),_.callExpression(r.addHelper(i),a)},e.prototype.registerDeclaration=function(e){if(e.isLabeledStatement())this.registerBinding("label",e);else if(e.isFunctionDeclaration())this.registerBinding("hoisted",e.get("id"),e);else if(e.isVariableDeclaration())for(var t=e.get("declarations"),r=t,n=0;n<r.length;n++){var i=r[n];this.registerBinding(e.node.kind,i)}else if(e.isClassDeclaration())this.registerBinding("let",e);else if(e.isImportDeclaration())for(var a=e.get("specifiers"),s=a,o=0;o<s.length;o++){var u=s[o];this.registerBinding("module",u)}else if(e.isExportDeclaration()){var i=e.get("declaration");(i.isClassDeclaration()||i.isFunctionDeclaration()||i.isVariableDeclaration())&&this.registerDeclaration(i)}else this.registerBinding("unknown",e)},e.prototype.registerConstantViolation=function(e){var t=e.getBindingIdentifiers();for(var r in t){var n=this.getBinding(r);n&&n.reassign(e)}},e.prototype.registerBinding=function(e,t){var r=arguments.length<=2||void 0===arguments[2]?t:arguments[2];return function(){if(!e)throw new ReferenceError("no `kind`");if(t.isVariableDeclaration())for(var n=t.get("declarations"),i=n,a=0;a<i.length;a++){var s=i[a];this.registerBinding(e,s)}else{var o=this.getProgramParent(),u=t.getBindingIdentifiers(!0);for(var p in u)for(var l=u[p],c=0;c<l.length;c++){var f=l[c],d=this.getOwnBinding(p);if(d){if(d.identifier===f)continue;this.checkBlockScopedCollisions(d,e,p,f)}o.references[p]=!0,this.bindings[p]=new v["default"]({identifier:f,existing:d,scope:this,path:r,kind:e})}}}.apply(this,arguments)},e.prototype.addGlobal=function(e){this.globals[e.name]=e},e.prototype.hasUid=function(e){var t=this;do if(t.uids[e])return!0;while(t=t.parent);return!1},e.prototype.hasGlobal=function(e){var t=this;
do if(t.globals[e])return!0;while(t=t.parent);return!1},e.prototype.hasReference=function(e){var t=this;do if(t.references[e])return!0;while(t=t.parent);return!1},e.prototype.isPure=function(e,t){if(_.isIdentifier(e)){var r=this.getBinding(e.name);return r?t?r.constant:!0:!1}if(_.isClass(e))return!e.superClass||this.isPure(e.superClass,t);if(_.isBinary(e))return this.isPure(e.left,t)&&this.isPure(e.right,t);if(_.isArrayExpression(e)){for(var n=e.elements,i=0;i<n.length;i++){var a=n[i];if(!this.isPure(a,t))return!1}return!0}if(_.isObjectExpression(e)){for(var s=e.properties,o=0;o<s.length;o++){var u=s[o];if(!this.isPure(u,t))return!1}return!0}return _.isProperty(e)?e.computed&&!this.isPure(e.key,t)?!1:this.isPure(e.value,t):_.isPure(e)},e.prototype.setData=function(e,t){return this.data[e]=t},e.prototype.getData=function(e){var t=this;do{var r=t.data[e];if(null!=r)return r}while(t=t.parent)},e.prototype.removeData=function(e){var t=this;do{var r=t.data[e];null!=r&&(t.data[e]=null)}while(t=t.parent)},e.prototype.init=function(){this.references||this.crawl()},e.prototype.crawl=function(){var e=this.path,t=this.block._scopeInfo;if(t)return D["default"](this,t);if(t=this.block._scopeInfo={references:w["default"](),bindings:w["default"](),globals:w["default"](),uids:w["default"](),data:w["default"]()},D["default"](this,t),e.isLoop())for(var r=_.FOR_INIT_KEYS,n=0;n<r.length;n++){var i=r[n],a=e.get(i);a.isBlockScoped()&&this.registerBinding(a.node.kind,a)}if(e.isFunctionExpression()&&e.has("id")&&this.registerBinding("local",e.get("id"),e),e.isClassExpression()&&e.has("id")&&this.registerBinding("local",e),e.isFunction())for(var s=e.get("params"),o=s,u=0;u<o.length;u++){var p=o[u];this.registerBinding("param",p)}e.isCatchClause()&&this.registerBinding("let",e),e.isComprehensionExpression()&&this.registerBinding("let",e);var l=this.getProgramParent();if(!l.crawling){var c={references:[],constantViolations:[],assignments:[]};this.crawling=!0,e.traverse(F,c),this.crawling=!1;for(var f=c.assignments,d=Array.isArray(f),h=0,f=d?f:f[Symbol.iterator]();;){var m;if(d){if(h>=f.length)break;m=f[h++]}else{if(h=f.next(),h.done)break;m=h.value}var y=m,g=y.getBindingIdentifiers(),v=void 0;for(var b in g)y.scope.getBinding(b)||(v=v||y.scope.getProgramParent(),v.addGlobal(g[b]));y.scope.registerConstantViolation(y)}for(var E=c.references,x=Array.isArray(E),S=0,E=x?E:E[Symbol.iterator]();;){var A;if(x){if(S>=E.length)break;A=E[S++]}else{if(S=E.next(),S.done)break;A=S.value}var C=A,I=C.scope.getBinding(C.node.name);I?I.reference(C):C.scope.getProgramParent().addGlobal(C.node)}for(var k=c.constantViolations,P=Array.isArray(k),B=0,k=P?k:k[Symbol.iterator]();;){var T;if(P){if(B>=k.length)break;T=k[B++]}else{if(B=k.next(),B.done)break;T=B.value}var M=T;M.scope.registerConstantViolation(M)}}},e.prototype.push=function(e){var t=this.path;t.isSwitchStatement()&&(t=this.getFunctionParent().path),(t.isLoop()||t.isCatchClause()||t.isFunction())&&(_.ensureBlock(t.node),t=t.get("body")),t.isBlockStatement()||t.isProgram()||(t=this.getBlockParent().path);var r=e.unique,n=e.kind||"var",i=null==e._blockHoist?2:e._blockHoist,a="declaration:"+n+":"+i,s=!r&&t.getData(a);if(!s){var o=_.variableDeclaration(n,[]);o._generated=!0,o._blockHoist=i,this.hub.file.attachAuxiliaryComment(o);var u=t.unshiftContainer("body",[o]);s=u[0],r||t.setData(a,s)}var p=_.variableDeclarator(e.id,e.init);s.node.declarations.push(p),this.registerBinding(n,s.get("declarations").pop())},e.prototype.getProgramParent=function(){var e=this;do if(e.path.isProgram())return e;while(e=e.parent);throw new Error("We couldn't find a Function or Program...")},e.prototype.getFunctionParent=function(){var e=this;do if(e.path.isFunctionParent())return e;while(e=e.parent);throw new Error("We couldn't find a Function or Program...")},e.prototype.getBlockParent=function(){var e=this;do if(e.path.isBlockParent())return e;while(e=e.parent);throw new Error("We couldn't find a BlockStatement, For, Switch, Function, Loop or Program...")},e.prototype.getAllBindings=function(){var e=w["default"](),t=this;do h["default"](e,t.bindings),t=t.parent;while(t);return e},e.prototype.getAllBindingsOfKind=function(){for(var e=w["default"](),t=arguments,r=0;r<t.length;r++){var n=t[r],i=this;do{for(var a in i.bindings){var s=i.bindings[a];s.kind===n&&(e[a]=s)}i=i.parent}while(i)}return e},e.prototype.bindingIdentifierEquals=function(e,t){return this.getBindingIdentifier(e)===t},e.prototype.getBinding=function(e){var t=this;do{var r=t.getOwnBinding(e);if(r)return r}while(t=t.parent)},e.prototype.getOwnBinding=function(e){return this.bindings[e]},e.prototype.getBindingIdentifier=function(e){var t=this.getBinding(e);return t&&t.identifier},e.prototype.getOwnBindingIdentifier=function(e){var t=this.bindings[e];return t&&t.identifier},e.prototype.hasOwnBinding=function(e){return!!this.getOwnBinding(e)},e.prototype.hasBinding=function(t,r){return t?this.hasOwnBinding(t)?!0:this.parentHasBinding(t,r)?!0:this.hasUid(t)?!0:!r&&u["default"](e.globals,t)?!0:!r&&u["default"](e.contextVariables,t)?!0:!1:!1},e.prototype.parentHasBinding=function(e,t){return this.parent&&this.parent.hasBinding(e,t)},e.prototype.moveBindingTo=function(e,t){var r=this.getBinding(e);r&&(r.scope.removeOwnBinding(e),r.scope=t,t.bindings[e]=r)},e.prototype.removeOwnBinding=function(e){delete this.bindings[e]},e.prototype.removeBinding=function(e){var t=this.getBinding(e);t&&t.scope.removeOwnBinding(e);var r=this;do r.uids[e]&&(r.uids[e]=!1);while(r=r.parent)},s(e,null,[{key:"globals",value:S["default"]([E["default"].builtin,E["default"].browser,E["default"].node].map(Object.keys)),enumerable:!0},{key:"contextVariables",value:["arguments","undefined","Infinity","NaN"],enumerable:!0}]),e}();r["default"]=P,t.exports=r["default"]},{148:148,166:166,179:179,405:405,41:41,414:414,421:421,43:43,518:518,519:519,592:592}],168:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function a(e){if(e._exploded)return e;e._exploded=!0;for(var t in e)if(!c(t)){var r=t.split("|");if(1!==r.length){var n=e[t];delete e[t];for(var i=r,a=0;a<i.length;a++){var o=i[a];e[o]=n}}}s(e),delete e.__esModule,u(e),p(e);for(var d=Object.keys(e),m=0;m<d.length;m++){var t=d[m];if(!c(t)){var y=h[t];if(y){var n=e[t];for(var g in n)n[g]=l(y,n[g]);if(delete e[t],y.types)for(var b=y.types,x=0;x<b.length;x++){var g=b[x];e[g]?f(e[g],n):e[g]=n}else f(e,n)}}}for(var t in e)if(!c(t)){var n=e[t],S=v.FLIPPED_ALIAS_KEYS[t];if(S){delete e[t];for(var A=S,D=0;D<A.length;D++){var C=A[D],w=e[C];w?f(w,n):e[C]=E["default"](n)}}}for(var t in e)c(t)||p(e[t]);return e}function s(e){if(!e._verified){if("function"==typeof e)throw new Error(y.get("traverseVerifyRootFunction"));for(var t in e)if(!c(t)){if(v.TYPES.indexOf(t)<0)throw new Error(y.get("traverseVerifyNodeType",t));var r=e[t];if("object"==typeof r)for(var n in r)if("enter"!==n&&"exit"!==n)throw new Error(y.get("traverseVerifyVisitorProperty",t,n))}e._verified=!0}}function o(e){for(var t={},r=e,n=0;n<r.length;n++){var i=r[n];a(i);for(var s in i){var o=t[s]=t[s]||{};f(o,i[s])}}return t}function u(e){for(var t in e)if(!c(t)){var r=e[t];"function"==typeof r&&(e[t]={enter:r})}}function p(e){e.enter&&!Array.isArray(e.enter)&&(e.enter=[e.enter]),e.exit&&!Array.isArray(e.exit)&&(e.exit=[e.exit])}function l(e,t){return function(){return e.checkPath(this)?t.apply(this,arguments):void 0}}function c(e){return"_"===e[0]?!0:"enter"===e||"exit"===e||"shouldSkip"===e?!0:"blacklist"===e||"noScope"===e||"skipKeys"===e?!0:!1}function f(e,t){for(var r in t)e[r]=[].concat(e[r]||[],t[r])}r.__esModule=!0,r.explode=a,r.verify=s,r.merge=o;var d=e(162),h=i(d),m=e(43),y=i(m),g=e(179),v=i(g),b=e(502),E=n(b)},{162:162,179:179,43:43,502:502}],169:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e){var t=arguments.length<=1||void 0===arguments[1]?e.key||e.property:arguments[1];return function(){return e.computed||C.isIdentifier(t)&&(t=C.literal(t.name)),t}()}function s(e,t){function r(e){for(var t=!1,a=[],s=e,o=0;o<s.length;o++){var u=s[o];if(C.isExpression(u))a.push(u);else if(C.isExpressionStatement(u))a.push(u.expression);else{if(C.isVariableDeclaration(u)){if("var"!==u.kind)return i=!0;for(var p=u.declarations,l=0;l<p.length;l++){var c=p[l],f=C.getBindingIdentifiers(c);for(var d in f)n.push({kind:u.kind,id:f[d]});c.init&&a.push(C.assignmentExpression("=",c.id,c.init))}t=!0;continue}if(C.isIfStatement(u)){var h=u.consequent?r([u.consequent]):C.identifier("undefined"),m=u.alternate?r([u.alternate]):C.identifier("undefined");if(!h||!m)return i=!0;a.push(C.conditionalExpression(u.test,h,m))}else{if(!C.isBlockStatement(u)){if(C.isEmptyStatement(u)){t=!0;continue}return i=!0}a.push(r(u.body))}}t=!1}return t&&a.push(C.identifier("undefined")),1===a.length?a[0]:C.sequenceExpression(a)}var n=[],i=!1,a=r(e);if(!i){for(var s=0;s<n.length;s++)t.push(n[s]);return a}}function o(e){var t=arguments.length<=1||void 0===arguments[1]?e.key:arguments[1];return function(){var r;return"method"===e.kind?o.uid++:(r=C.isIdentifier(t)?t.name:C.isLiteral(t)?JSON.stringify(t.value):JSON.stringify(A["default"].removeProperties(C.cloneDeep(t))),e.computed&&(r="["+r+"]"),r)}()}function u(e){return C.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,t){return t?t.toUpperCase():""}),C.isValidIdentifier(e)||(e="_"+e),e||"_")}function p(e){return e=u(e),("eval"===e||"arguments"===e)&&(e="_"+e),e}function l(e,t){if(C.isStatement(e))return e;var r,n=!1;if(C.isClass(e))n=!0,r="ClassDeclaration";else if(C.isFunction(e))n=!0,r="FunctionDeclaration";else if(C.isAssignmentExpression(e))return C.expressionStatement(e);if(n&&!e.id&&(r=!1),!r){if(t)return!1;throw new Error("cannot turn "+e.type+" to a statement")}return e.type=r,e}function c(e){if(C.isExpressionStatement(e)&&(e=e.expression),C.isClass(e)?e.type="ClassExpression":C.isFunction(e)&&(e.type="FunctionExpression"),C.isExpression(e))return e;throw new Error("cannot turn "+e.type+" to an expression")}function f(e,t){return C.isBlockStatement(e)?e:(C.isEmptyStatement(e)&&(e=[]),Array.isArray(e)||(C.isStatement(e)||(e=C.isFunction(t)?C.returnStatement(e):C.expressionStatement(e)),e=[e]),C.blockStatement(e))}function d(e){if(void 0===e)return C.identifier("undefined");if(e===!0||e===!1||null===e||x["default"](e)||g["default"](e)||b["default"](e))return C.literal(e);if(Array.isArray(e))return C.arrayExpression(e.map(C.valueToNode));if(m["default"](e)){var t=[];for(var r in e){var n;n=C.isValidIdentifier(r)?C.identifier(r):C.literal(r),t.push(C.property("init",n,C.valueToNode(e[r])))}return C.objectExpression(t)}throw new Error("don't know how to turn this value into a node")}r.__esModule=!0,r.toComputedKey=a,r.toSequenceExpression=s,r.toKeyAlias=o,r.toIdentifier=u,r.toBindingIdentifierName=p,r.toStatement=l,r.toExpression=c,r.toBlock=f,r.valueToNode=d;var h=e(512),m=i(h),y=e(510),g=i(y),v=e(513),b=i(v),E=e(514),x=i(E),S=e(148),A=i(S),D=e(179),C=n(D);o.uid=0},{148:148,179:179,510:510,512:512,513:513,514:514}],170:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var i=e(174),a=n(i);a["default"]("ArrayExpression",{visitor:["elements"],aliases:["Expression"]}),a["default"]("AssignmentExpression",{builder:["operator","left","right"],visitor:["left","right"],aliases:["Expression"]}),a["default"]("BinaryExpression",{builder:["operator","left","right"],visitor:["left","right"],aliases:["Binary","Expression"]}),a["default"]("BlockStatement",{visitor:["body"],aliases:["Scopable","BlockParent","Block","Statement"]}),a["default"]("BreakStatement",{visitor:["label"],aliases:["Statement","Terminatorless","CompletionStatement"]}),a["default"]("CallExpression",{visitor:["callee","arguments"],aliases:["Expression"]}),a["default"]("CatchClause",{visitor:["param","body"],aliases:["Scopable"]}),a["default"]("ConditionalExpression",{visitor:["test","consequent","alternate"],aliases:["Expression"]}),a["default"]("ContinueStatement",{visitor:["label"],aliases:["Statement","Terminatorless","CompletionStatement"]}),a["default"]("DebuggerStatement",{aliases:["Statement"]}),a["default"]("DoWhileStatement",{visitor:["body","test"],aliases:["Statement","BlockParent","Loop","While","Scopable"]}),a["default"]("EmptyStatement",{aliases:["Statement"]}),a["default"]("ExpressionStatement",{visitor:["expression"],aliases:["Statement"]}),a["default"]("File",{builder:["program","comments","tokens"],visitor:["program"]}),a["default"]("ForInStatement",{visitor:["left","right","body"],aliases:["Scopable","Statement","For","BlockParent","Loop","ForXStatement"]}),a["default"]("ForStatement",{visitor:["init","test","update","body"],aliases:["Scopable","Statement","For","BlockParent","Loop"]}),a["default"]("FunctionDeclaration",{builder:{id:null,params:null,body:null,generator:!1,async:!1},visitor:["id","params","body","returnType","typeParameters"],aliases:["Scopable","Function","Func","BlockParent","FunctionParent","Statement","Pure","Declaration"]}),a["default"]("FunctionExpression",{builder:{id:null,params:null,body:null,generator:!1,async:!1},visitor:["id","params","body","returnType","typeParameters"],aliases:["Scopable","Function","Func","BlockParent","FunctionParent","Expression","Pure"]}),a["default"]("Identifier",{builder:["name"],visitor:["typeAnnotation"],aliases:["Expression"]}),a["default"]("IfStatement",{visitor:["test","consequent","alternate"],aliases:["Statement"]}),a["default"]("LabeledStatement",{visitor:["label","body"],aliases:["Statement"]}),a["default"]("Literal",{builder:["value"],aliases:["Expression","Pure"]}),a["default"]("LogicalExpression",{builder:["operator","left","right"],visitor:["left","right"],aliases:["Binary","Expression"]}),a["default"]("MemberExpression",{builder:{object:null,property:null,computed:!1},visitor:["object","property"],aliases:["Expression"]}),a["default"]("NewExpression",{visitor:["callee","arguments"],aliases:["Expression"]}),a["default"]("ObjectExpression",{visitor:["properties"],aliases:["Expression"]}),a["default"]("Program",{visitor:["body"],aliases:["Scopable","BlockParent","Block","FunctionParent"]}),a["default"]("Property",{builder:{kind:"init",key:null,value:null,computed:!1},visitor:["key","value","decorators"],aliases:["UserWhitespacable"]}),a["default"]("RestElement",{visitor:["argument","typeAnnotation"]}),a["default"]("ReturnStatement",{visitor:["argument"],aliases:["Statement","Terminatorless","CompletionStatement"]}),a["default"]("SequenceExpression",{visitor:["expressions"],aliases:["Expression"]}),a["default"]("SwitchCase",{visitor:["test","consequent"]}),a["default"]("SwitchStatement",{visitor:["discriminant","cases"],aliases:["Statement","BlockParent","Scopable"]}),a["default"]("ThisExpression",{aliases:["Expression"]}),a["default"]("ThrowStatement",{visitor:["argument"],aliases:["Statement","Terminatorless","CompletionStatement"]}),a["default"]("TryStatement",{builder:["block","handler","finalizer"],visitor:["block","handlers","handler","guardedHandlers","finalizer"],aliases:["Statement"]}),a["default"]("UnaryExpression",{builder:{operator:null,argument:null,prefix:!1},visitor:["argument"],aliases:["UnaryLike","Expression"]}),a["default"]("UpdateExpression",{builder:{operator:null,argument:null,prefix:!1},visitor:["argument"],aliases:["Expression"]}),a["default"]("VariableDeclaration",{builder:["kind","declarations"],visitor:["declarations"],aliases:["Statement","Declaration"]}),a["default"]("VariableDeclarator",{visitor:["id","init"]}),a["default"]("WhileStatement",{visitor:["test","body"],aliases:["Statement","BlockParent","Loop","While","Scopable"]}),a["default"]("WithStatement",{visitor:["object","body"],aliases:["Statement"]})},{174:174}],171:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var i=e(174),a=n(i);a["default"]("AssignmentPattern",{visitor:["left","right"],aliases:["Pattern"]}),a["default"]("ArrayPattern",{visitor:["elements","typeAnnotation"],aliases:["Pattern"]}),a["default"]("ArrowFunctionExpression",{builder:["params","body","async"],visitor:["params","body","returnType"],aliases:["Scopable","Function","Func","BlockParent","FunctionParent","Expression","Pure"]}),a["default"]("ClassBody",{visitor:["body"]}),a["default"]("ClassDeclaration",{visitor:["id","body","superClass","mixins","typeParameters","superTypeParameters","implements","decorators"],aliases:["Scopable","Class","Statement","Declaration"]}),a["default"]("ClassExpression",{visitor:["id","body","superClass","typeParameters","superTypeParameters","implements","decorators"],aliases:["Scopable","Class","Expression"]}),a["default"]("ExportAllDeclaration",{visitor:["source","exported"],aliases:["Statement","Declaration","ModuleDeclaration","ExportDeclaration"]}),a["default"]("ExportDefaultDeclaration",{visitor:["declaration"],aliases:["Statement","Declaration","ModuleDeclaration","ExportDeclaration"]}),a["default"]("ExportNamedDeclaration",{visitor:["declaration","specifiers","source"],aliases:["Statement","Declaration","ModuleDeclaration","ExportDeclaration"]}),a["default"]("ExportDefaultSpecifier",{visitor:["exported"],aliases:["ModuleSpecifier"]}),a["default"]("ExportNamespaceSpecifier",{visitor:["exported"],aliases:["ModuleSpecifier"]}),a["default"]("ExportSpecifier",{visitor:["local","exported"],aliases:["ModuleSpecifier"]}),a["default"]("ForOfStatement",{visitor:["left","right","body"],aliases:["Scopable","Statement","For","BlockParent","Loop","ForXStatement"]}),a["default"]("ImportDeclaration",{visitor:["specifiers","source"],aliases:["Statement","Declaration","ModuleDeclaration"]}),a["default"]("ImportDefaultSpecifier",{visitor:["local"],aliases:["ModuleSpecifier"]}),a["default"]("ImportNamespaceSpecifier",{visitor:["local"],aliases:["ModuleSpecifier"]}),a["default"]("ImportSpecifier",{visitor:["local","imported"],aliases:["ModuleSpecifier"]}),a["default"]("MetaProperty",{visitor:["meta","property"],aliases:["Expression"]}),a["default"]("MethodDefinition",{builder:{key:null,value:null,kind:"method",computed:!1,"static":!1},visitor:["key","value","decorators"]}),a["default"]("ObjectPattern",{visitor:["properties","typeAnnotation"],aliases:["Pattern"]}),a["default"]("SpreadElement",{visitor:["argument"],aliases:["UnaryLike"]}),a["default"]("Super",{aliases:["Expression"]}),a["default"]("TaggedTemplateExpression",{visitor:["tag","quasi"],aliases:["Expression"]}),a["default"]("TemplateElement"),a["default"]("TemplateLiteral",{visitor:["quasis","expressions"],aliases:["Expression"]}),a["default"]("YieldExpression",{builder:["argument","delegate"],visitor:["argument"],aliases:["Expression","Terminatorless"]})},{174:174}],172:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var i=e(174),a=n(i);a["default"]("AwaitExpression",{builder:["argument","all"],visitor:["argument"],aliases:["Expression","Terminatorless"]}),a["default"]("BindExpression",{visitor:["object","callee"]}),a["default"]("ComprehensionBlock",{visitor:["left","right"]}),a["default"]("ComprehensionExpression",{visitor:["filter","blocks","body"],aliases:["Expression","Scopable"]}),a["default"]("Decorator",{visitor:["expression"]}),a["default"]("DoExpression",{visitor:["body"],aliases:["Expression"]}),a["default"]("SpreadProperty",{visitor:["argument"],aliases:["UnaryLike"]})},{174:174}],173:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var i=e(174),a=n(i);a["default"]("AnyTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"]}),a["default"]("ArrayTypeAnnotation",{visitor:["elementType"],aliases:["Flow"]}),a["default"]("BooleanTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"]}),a["default"]("BooleanLiteralTypeAnnotation",{aliases:["Flow"]}),a["default"]("ClassImplements",{visitor:["id","typeParameters"],aliases:["Flow"]}),a["default"]("ClassProperty",{visitor:["key","value","typeAnnotation","decorators"],aliases:["Flow"]}),a["default"]("DeclareClass",{visitor:["id","typeParameters","extends","body"],aliases:["Flow","FlowDeclaration","Statement","Declaration"]}),a["default"]("DeclareFunction",{visitor:["id"],aliases:["Flow","FlowDeclaration","Statement","Declaration"]}),a["default"]("DeclareInterface",{visitor:["id","typeParameters","extends","body"],aliases:["Flow","FlowDeclaration","Statement","Declaration"]}),a["default"]("DeclareModule",{visitor:["id","body"],aliases:["Flow","FlowDeclaration","Statement","Declaration"]}),a["default"]("DeclareTypeAlias",{visitor:["id","typeParameters","right"],aliases:["Flow","FlowDeclaration","Statement","Declaration"]}),a["default"]("DeclareVariable",{visitor:["id"],aliases:["Flow","FlowDeclaration","Statement","Declaration"]}),a["default"]("FunctionTypeAnnotation",{visitor:["typeParameters","params","rest","returnType"],aliases:["Flow"]}),a["default"]("FunctionTypeParam",{visitor:["name","typeAnnotation"],aliases:["Flow"]}),a["default"]("GenericTypeAnnotation",{visitor:["id","typeParameters"],aliases:["Flow"]}),a["default"]("InterfaceExtends",{visitor:["id","typeParameters"],aliases:["Flow"]}),a["default"]("InterfaceDeclaration",{visitor:["id","typeParameters","extends","body"],aliases:["Flow","FlowDeclaration","Statement","Declaration"]}),a["default"]("IntersectionTypeAnnotation",{visitor:["types"],aliases:["Flow"]}),a["default"]("MixedTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"]}),a["default"]("NullableTypeAnnotation",{visitor:["typeAnnotation"],aliases:["Flow"]}),a["default"]("NullLiteralTypeAnnotation",{aliases:["Flow"]}),a["default"]("NumberLiteralTypeAnnotation",{aliases:["Flow"]}),a["default"]("NumberTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"]}),a["default"]("StringLiteralTypeAnnotation",{aliases:["Flow"]}),a["default"]("StringTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"]}),a["default"]("ThisTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"]}),a["default"]("TupleTypeAnnotation",{visitor:["types"],aliases:["Flow"]}),a["default"]("TypeofTypeAnnotation",{visitor:["argument"],aliases:["Flow"]}),a["default"]("TypeAlias",{visitor:["id","typeParameters","right"],aliases:["Flow","FlowDeclaration","Statement","Declaration"]}),a["default"]("TypeAnnotation",{visitor:["typeAnnotation"],aliases:["Flow"]}),a["default"]("TypeCastExpression",{visitor:["expression","typeAnnotation"],aliases:["Flow"]}),a["default"]("TypeParameterDeclaration",{visitor:["params"],aliases:["Flow"]}),a["default"]("TypeParameterInstantiation",{visitor:["params"],aliases:["Flow"]}),a["default"]("ObjectTypeAnnotation",{visitor:["properties","indexers","callProperties"],aliases:["Flow"]}),a["default"]("ObjectTypeCallProperty",{visitor:["value"],aliases:["Flow","UserWhitespacable"]}),a["default"]("ObjectTypeIndexer",{visitor:["id","key","value"],aliases:["Flow","UserWhitespacable"]}),a["default"]("ObjectTypeProperty",{visitor:["key","value"],aliases:["Flow","UserWhitespacable"]}),a["default"]("QualifiedTypeIdentifier",{visitor:["id","qualification"],aliases:["Flow"]}),a["default"]("UnionTypeAnnotation",{visitor:["types"],aliases:["Flow"]}),a["default"]("VoidTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"]})},{174:174}],174:[function(e,t,r){"use strict";function n(e){for(var t={},r=e,n=0;n<r.length;n++){var i=r[n];t[i]=null}return t}function i(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];t.visitor=t.visitor||[],t.aliases=t.aliases||[],t.builder||(t.builder=n(t.visitor)),Array.isArray(t.builder)&&(t.builder=n(t.builder)),a[e]=t.visitor,s[e]=t.aliases,o[e]=t.builder}r.__esModule=!0,r["default"]=i;var a={};r.VISITOR_KEYS=a;var s={};r.ALIAS_KEYS=s;var o={};r.BUILDER_KEYS=o},{}],175:[function(e,t,r){"use strict";e(174),e(170),e(171),e(173),e(176),e(177),e(172)},{170:170,171:171,172:172,173:173,174:174,176:176,177:177}],176:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var i=e(174),a=n(i);a["default"]("JSXAttribute",{visitor:["name","value"],aliases:["JSX","Immutable"]}),a["default"]("JSXClosingElement",{visitor:["name"],aliases:["JSX","Immutable"]}),a["default"]("JSXElement",{visitor:["openingElement","closingElement","children"],aliases:["JSX","Immutable","Expression"]}),a["default"]("JSXEmptyExpression",{aliases:["JSX","Expression"]}),a["default"]("JSXExpressionContainer",{visitor:["expression"],aliases:["JSX","Immutable"]}),a["default"]("JSXIdentifier",{aliases:["JSX","Expression"]}),a["default"]("JSXMemberExpression",{visitor:["object","property"],aliases:["JSX","Expression"]}),a["default"]("JSXNamespacedName",{visitor:["namespace","name"],aliases:["JSX"]}),a["default"]("JSXOpeningElement",{visitor:["name","attributes"],aliases:["JSX","Immutable"]}),a["default"]("JSXSpreadAttribute",{visitor:["argument"],aliases:["JSX"]})},{174:174}],177:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var i=e(174),a=n(i);a["default"]("Noop",{visitor:[]}),a["default"]("ParenthesizedExpression",{visitor:["expression"],aliases:["Expression"]})},{174:174}],178:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){var t=a(e);return 1===t.length?t[0]:u.unionTypeAnnotation(t)}function a(e){for(var t={},r={},n=[],i=[],s=0;s<e.length;s++){var o=e[s];if(o&&!(i.indexOf(o)>=0)){if(u.isAnyTypeAnnotation(o))return[o];if(u.isFlowBaseAnnotation(o))r[o.type]=o;else if(u.isUnionTypeAnnotation(o))n.indexOf(o.types)<0&&(e=e.concat(o.types),n.push(o.types));else if(u.isGenericTypeAnnotation(o)){var p=o.id.name;if(t[p]){var l=t[p];l.typeParameters?o.typeParameters&&(l.typeParameters.params=a(l.typeParameters.params.concat(o.typeParameters.params))):l=o.typeParameters}else t[p]=o}else i.push(o)}}for(var c in r)i.push(r[c]);for(var f in t)i.push(t[f]);return i}function s(e){if("string"===e)return u.stringTypeAnnotation();if("number"===e)return u.numberTypeAnnotation();if("undefined"===e)return u.voidTypeAnnotation();if("boolean"===e)return u.booleanTypeAnnotation();if("function"===e)return u.genericTypeAnnotation(u.identifier("Function"));if("object"===e)return u.genericTypeAnnotation(u.identifier("Object"));if("symbol"===e)return u.genericTypeAnnotation(u.identifier("Symbol"));throw new Error("Invalid typeof value")}r.__esModule=!0,r.createUnionTypeAnnotation=i,r.removeTypeDuplicates=a,r.createTypeAnnotationBasedOnTypeof=s;var o=e(179),u=n(o)},{179:179}],179:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){var r=B["is"+e]=function(r,n){return B.is(e,r,n,t)};B["assert"+e]=function(t,n){if(n=n||{},!r(t,n))throw new Error("Expected type "+JSON.stringify(e)+" with option "+JSON.stringify(n))}}function a(e,t,r,n){if(!t)return!1;var i=s(t.type,e);return i?"undefined"==typeof r?!0:B.shallowEqual(t,r):!1}function s(e,t){if(e===t)return!0;var r=B.FLIPPED_ALIAS_KEYS[t];if(r){if(r[0]===e)return!0;for(var n=r,i=0;i<n.length;i++){var a=n[i];if(e===a)return!0}}return!1}function o(e,t){for(var r=Object.keys(t),n=r,i=0;i<n.length;i++){var a=n[i];if(e[a]!==t[a])return!1}return!0}function u(e,t,r){return e.object=B.memberExpression(e.object,e.property,e.computed),e.property=t,e.computed=!!r,e}function p(e,t){return e.object=B.memberExpression(t,e.object),e}function l(e){var t=arguments.length<=1||void 0===arguments[1]?"body":arguments[1];return e[t]=B.toBlock(e[t],e)}function c(e){var t={};for(var r in e)"_"!==r[0]&&(t[r]=e[r]);return t}function f(e){var t={};for(var r in e)if("_"!==r[0]){var n=e[r];n&&(n.type?n=B.cloneDeep(n):Array.isArray(n)&&(n=n.map(B.cloneDeep))),t[r]=n}return t}function d(e,t){var r=e.split(".");return function(e){if(!B.isMemberExpression(e))return!1;for(var n=[e],i=0;n.length;){var a=n.shift();if(t&&i===r.length)return!0;if(B.isIdentifier(a)){if(r[i]!==a.name)return!1}else{if(!B.isLiteral(a)){if(B.isMemberExpression(a)){if(a.computed&&!B.isLiteral(a.property))return!1;n.push(a.object),n.push(a.property);continue}return!1}if(r[i]!==a.value)return!1}if(++i>r.length)return!1}return!0}}function h(e){for(var t=j,r=0;r<t.length;r++){var n=t[r];delete e[n]}return e}function m(e,t){return y(e,t),g(e,t),v(e,t),e}function y(e,t){b("trailingComments",e,t)}function g(e,t){b("leadingComments",e,t)}function v(e,t){b("innerComments",e,t)}function b(e,t,r){t&&r&&(t[e]=k["default"](D["default"]([].concat(t[e],r[e]))))}function E(e,t){if(!e||!t)return e;for(var r=B.INHERIT_KEYS.optional,n=0;n<r.length;n++){var i=r[n];null==e[i]&&(e[i]=t[i])}for(var a=B.INHERIT_KEYS.force,s=0;s<a.length;s++){var i=a[s];e[i]=t[i]}return B.inheritsComments(e,t),e}r.__esModule=!0,r.is=a,r.isType=s,r.shallowEqual=o,r.appendToMemberExpression=u,r.prependToMemberExpression=p,r.ensureBlock=l,r.clone=c,r.cloneDeep=f,r.buildMatchMemberExpression=d,r.removeComments=h,r.inheritsComments=m,r.inheritTrailingComments=y,r.inheritLeadingComments=g,r.inheritInnerComments=v,r.inherits=E;var x=e(608),S=n(x),A=e(413),D=n(A),C=e(517),w=n(C),I=e(419),_=n(I),F=e(417),k=n(F);e(175);var P=e(174),B=r,T=["consequent","body","alternate"];r.STATEMENT_OR_BLOCK_KEYS=T;var M=["body","expressions"];r.FLATTENABLE_KEYS=M;var O=["left","init"];r.FOR_INIT_KEYS=O;var j=["leadingComments","trailingComments","innerComments"];r.COMMENT_KEYS=j;var L={optional:["typeAnnotation","typeParameters","returnType"],force:["_scopeInfo","_paths","start","loc","end"]};r.INHERIT_KEYS=L;var N=[">","<",">=","<="];r.BOOLEAN_NUMBER_BINARY_OPERATORS=N;var R=["==","===","!=","!=="];r.EQUALITY_BINARY_OPERATORS=R;var V=R.concat(["in","instanceof"]);r.COMPARISON_BINARY_OPERATORS=V;var U=[].concat(V,N);r.BOOLEAN_BINARY_OPERATORS=U;var q=["-","/","*","**","&","|",">>",">>>","<<","^"];r.NUMBER_BINARY_OPERATORS=q;var G=["delete","!"];r.BOOLEAN_UNARY_OPERATORS=G;var H=["+","-","++","--","~"];r.NUMBER_UNARY_OPERATORS=H;var W=["typeof"];r.STRING_UNARY_OPERATORS=W,r.VISITOR_KEYS=P.VISITOR_KEYS,r.BUILDER_KEYS=P.BUILDER_KEYS,r.ALIAS_KEYS=P.ALIAS_KEYS,_["default"](B.VISITOR_KEYS,function(e,t){i(t,!0)}),B.FLIPPED_ALIAS_KEYS={},_["default"](B.ALIAS_KEYS,function(e,t){_["default"](e,function(e){var r=B.FLIPPED_ALIAS_KEYS[e]=B.FLIPPED_ALIAS_KEYS[e]||[];r.push(t)})}),_["default"](B.FLIPPED_ALIAS_KEYS,function(e,t){B[t.toUpperCase()+"_TYPES"]=e,i(t,!1)});var X=Object.keys(B.VISITOR_KEYS).concat(Object.keys(B.FLIPPED_ALIAS_KEYS));r.TYPES=X,_["default"](B.VISITOR_KEYS,function(e,t){if(!B.BUILDER_KEYS[t]){var r={};_["default"](e,function(e){r[e]=null}),B.BUILDER_KEYS[t]=r}}),_["default"](B.BUILDER_KEYS,function(e,t){var r=function(){var r={};r.type=t;var n=0;for(var i in e){var a=arguments[n++];void 0===a&&(a=e[i]),r[i]=a}return r};B[t]=r,B[t[0].toLowerCase()+t.slice(1)]=r}),S["default"](B),S["default"](B.VISITOR_KEYS),w["default"](B,e(180)),w["default"](B,e(181)),w["default"](B,e(169)),w["default"](B,e(178))},{169:169,174:174,175:175,178:178,180:180,181:181,413:413,417:417,419:419,517:517,608:608}],180:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){for(var r=[].concat(e),n=Object.create(null);r.length;){var i=r.shift();if(i){var a=s.getBindingIdentifiers.keys[i.type];if(s.isIdentifier(i))if(t){var o=n[i.name]=n[i.name]||[];o.push(i)}else n[i.name]=i;else if(s.isExportDeclaration(i))s.isDeclaration(e.declaration)&&r.push(e.declaration);else if(a)for(var u=0;u<a.length;u++){var p=a[u];i[p]&&(r=r.concat(i[p]))}}}return n}r.__esModule=!0,r.getBindingIdentifiers=i;var a=e(179),s=n(a);i.keys={DeclareClass:["id"],DeclareFunction:["id"],DeclareModule:["id"],
DeclareVariable:["id"],InterfaceDeclaration:["id"],TypeAlias:["id"],ComprehensionExpression:["blocks"],ComprehensionBlock:["left"],CatchClause:["param"],LabeledStatement:["label"],UnaryExpression:["argument"],AssignmentExpression:["left"],ImportSpecifier:["local"],ImportNamespaceSpecifier:["local"],ImportDefaultSpecifier:["local"],ImportDeclaration:["specifiers"],FunctionDeclaration:["id","params"],FunctionExpression:["id","params"],ClassDeclaration:["id"],ClassExpression:["id"],RestElement:["argument"],UpdateExpression:["argument"],SpreadProperty:["argument"],Property:["value"],AssignmentPattern:["left"],ArrayPattern:["elements"],ObjectPattern:["properties"],VariableDeclaration:["declarations"],VariableDeclarator:["id"]}},{179:179}],181:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){var r=h.getBindingIdentifiers.keys[t.type];if(r)for(var n=0;n<r.length;n++){var i=r[n],a=t[i];if(Array.isArray(a)){if(a.indexOf(e)>=0)return!0}else if(a===e)return!0}return!1}function s(e,t){switch(t.type){case"MemberExpression":case"JSXMemberExpression":return t.property===e&&t.computed?!0:t.object===e?!0:!1;case"MetaProperty":return!1;case"Property":if(t.key===e)return t.computed;case"VariableDeclarator":return t.id!==e;case"ArrowFunctionExpression":case"FunctionDeclaration":case"FunctionExpression":for(var r=t.params,n=0;n<r.length;n++){var i=r[n];if(i===e)return!1}return t.id!==e;case"ExportSpecifier":return t.source?!1:t.local===e;case"JSXAttribute":return t.name!==e;case"ClassProperty":return t.value===e;case"ImportDefaultSpecifier":case"ImportNamespaceSpecifier":case"ImportSpecifier":return!1;case"ClassDeclaration":case"ClassExpression":return t.id!==e;case"MethodDefinition":return t.key===e&&t.computed;case"LabeledStatement":return!1;case"CatchClause":return t.param!==e;case"RestElement":return!1;case"AssignmentExpression":return t.right===e;case"AssignmentPattern":return t.right===e;case"ObjectPattern":case"ArrayPattern":return!1}return!0}function o(e){return"string"!=typeof e||y["default"].keyword.isReservedWordES6(e,!0)?!1:y["default"].keyword.isIdentifierNameES6(e)}function u(e){return v.isVariableDeclaration(e)&&("var"!==e.kind||e._let)}function p(e){return v.isFunctionDeclaration(e)||v.isClassDeclaration(e)||v.isLet(e)}function l(e){return v.isVariableDeclaration(e,{kind:"var"})&&!e._let}function c(e){return v.isImportDefaultSpecifier(e)||v.isIdentifier(e.imported||e.exported,{name:"default"})}function f(e,t){return v.isBlockStatement(e)&&v.isFunction(t,{body:e})?!1:v.isScopable(e)}function d(e){return v.isType(e.type,"Immutable")?!0:v.isLiteral(e)?e.regex?!1:!0:v.isIdentifier(e)&&"undefined"===e.name?!0:!1}r.__esModule=!0,r.isBinding=a,r.isReferenced=s,r.isValidIdentifier=o,r.isLet=u,r.isBlockScoped=p,r.isVar=l,r.isSpecifierDefault=c,r.isScope=f,r.isImmutable=d;var h=e(180),m=e(403),y=i(m),g=e(179),v=n(g)},{179:179,180:180,403:403}],182:[function(e,t,r){(function(t){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){var r=t||a.EXTENSIONS,n=V["default"].extname(e);return _["default"](r,n)}function s(e){return e?Array.isArray(e)?e:"string"==typeof e?e.split(","):[e]:[]}function o(e){if(!e)return new RegExp(/.^/);if(Array.isArray(e)&&(e=new RegExp(e.map(y["default"]).join("|"),"i")),B["default"](e)){e=J["default"](e),(v["default"](e,"./")||v["default"](e,"*/"))&&(e=e.slice(2)),v["default"](e,"**/")&&(e=e.slice(3));var t=w["default"].makeRe(e,{nocase:!0});return new RegExp(t.source.slice(1,-1),"i")}if(M["default"](e))return e;throw new TypeError("illegal type for regexify")}function u(e,t){return e?S["default"](e)?u([e],t):B["default"](e)?u(s(e),t):Array.isArray(e)?(t&&(e=e.map(t)),e):[e]:[]}function p(e){return"true"===e?!0:"false"===e?!1:e}function l(e,t,r){if(e=J["default"](e),r){for(var n=r,i=0;i<n.length;i++){var a=n[i];if(c(a,e))return!1}return!0}if(t.length)for(var s=t,o=0;o<s.length;o++){var a=s[o];if(c(a,e))return!0}return!1}function c(e,t){return"function"==typeof e?e(t):e.test(t)}function f(e,t,n){var i=r.templates[e];if(!i)throw new ReferenceError("unknown template "+e);if(t===!0&&(n=!0,t=null),i=E["default"](i),j["default"](t)||k["default"](i,Q,null,t),i.body.length>1)return i.body;var a=i.body[0];return!n&&X.isExpressionStatement(a)?a.expression:a}function d(e,t){var r=N["default"](t,{filename:e,looseModules:!0}).program;return r=k["default"].removeProperties(r)}function h(){var e={},r=V["default"].join(t,"transformation/templates");if(!K["default"].sync(r))throw new ReferenceError(D.get("missingTemplatesDirectory"));for(var n=H["default"].readdirSync(r),i=0;i<n.length;i++){var a=n[i];if("."===a[0])return;var s=V["default"].basename(a,V["default"].extname(a)),o=V["default"].join(r,a),u=H["default"].readFileSync(o,"utf8");e[s]=d(o,u)}return e}r.__esModule=!0,r.canCompile=a,r.list=s,r.regexify=o,r.arrayify=u,r.booleanify=p,r.shouldIgnore=l,r.template=f,r.parseTemplate=d;var m=e(526),y=i(m),g=e(527),v=i(g),b=e(503),E=i(b),x=e(506),S=i(x),A=e(43),D=n(A),C=e(530),w=i(C),I=e(418),_=i(I),F=e(148),k=i(F),P=e(514),B=i(P),T=e(513),M=i(T),O=e(507),j=i(O),L=e(42),N=i(L),R=e(9),V=i(R),U=e(520),q=i(U),G=e(3),H=i(G),W=e(179),X=n(W),Y=e(596),J=i(Y),z=e(534),K=i(z),$=e(13);r.inherits=$.inherits,r.inspect=$.inspect,a.EXTENSIONS=[".js",".jsx",".es6",".es"];var Q={noScope:!0,enter:function(e,t,r,n){X.isExpressionStatement(e)&&(e=e.expression),X.isIdentifier(e)&&q["default"](n,e.name)&&(this.skip(),this.replaceInline(n[e.name]))},exit:function(e){k["default"].clearNode(e)}};try{r.templates=e(612)}catch(Z){if("MODULE_NOT_FOUND"!==Z.code)throw Z;r.templates=h()}}).call(this,"/lib")},{13:13,148:148,179:179,3:3,418:418,42:42,43:43,503:503,506:506,507:507,513:513,514:514,520:520,526:526,527:527,530:530,534:534,596:596,612:612,9:9}],183:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=function(e){var t=e.Plugin,r=e.types;return new t("constant-folding",{metadata:{group:"builtin-prepass",experimental:!0},visitor:{AssignmentExpression:function(){var e=this.get("left");if(e.isIdentifier()){var t=this.scope.getBinding(e.node.name);if(t&&!t.hasDeoptValue){var r=this.get("right").evaluate();r.confident?t.setValue(r.value):t.deoptValue()}}},IfStatement:function(){var e=this.get("test").evaluate();return e.confident?void(e.value?this.skipKey("alternate"):this.skipKey("consequent")):this.skip()},Scopable:{enter:function(){var e=this.scope.getFunctionParent();for(var t in this.scope.bindings){var r=this.scope.bindings[t],n=!1,i=!0,a=!1,s=void 0;try{for(var o,u=r.constantViolations[Symbol.iterator]();!(i=(o=u.next()).done);i=!0){var p=o.value,l=p.scope.getFunctionParent();if(l!==e){n=!0;break}}}catch(c){a=!0,s=c}finally{try{!i&&u["return"]&&u["return"]()}finally{if(a)throw s}}n&&r.deoptValue()}},exit:function(){for(var e in this.scope.bindings){var t=this.scope.bindings[e];t.clearValue()}}},Expression:{exit:function(){var e=this.evaluate();return e.confident?r.valueToNode(e.value):void 0}}}})},t.exports=r["default"]},{}],184:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=function(e){function t(e){if(n.isBlockStatement(e)){for(var t=!1,r=0;r<e.body.length;r++){var i=e.body[r];n.isBlockScoped(i)&&(t=!0)}if(!t)return e.body}return e}var r=e.Plugin,n=e.types,i={ReferencedIdentifier:function(e,t,r){var i=r.getBinding(e.name);if(i&&!(i.references>1)&&i.constant&&"param"!==i.kind&&"module"!==i.kind){var a=i.path.node;if(n.isVariableDeclarator(a)&&(a=a.init),a&&r.isPure(a,!0)&&(!n.isClass(a)&&!n.isFunction(a)||i.path.scope.parent===r)&&!this.findParent(function(e){return e.node===a}))return n.toExpression(a),r.removeBinding(e.name),i.path.dangerouslyRemove(),a}},"ClassDeclaration|FunctionDeclaration":function(e,t,r){var n=r.getBinding(e.id.name);n&&!n.referenced&&this.dangerouslyRemove()},VariableDeclarator:function(e,t,r){n.isIdentifier(e.id)&&r.isPure(e.init,!0)&&i["ClassDeclaration|FunctionDeclaration"].apply(this,arguments)},ConditionalExpression:function(e){var t=this.get("test").evaluateTruthy();return t===!0?e.consequent:t===!1?e.alternate:void 0},BlockStatement:function(){for(var e=this.get("body"),t=!1,r=0;r<e.length;r++){var n=e[r];t||!n.isCompletionStatement()?t&&!n.isFunctionDeclaration()&&n.dangerouslyRemove():t=!0}},IfStatement:{exit:function(e){var r=e.consequent,i=e.alternate,a=e.test,s=this.get("test").evaluateTruthy();return s===!0?t(r):s===!1?i?t(i):this.dangerouslyRemove():(n.isBlockStatement(i)&&!i.body.length&&(i=e.alternate=null),void(n.isBlockStatement(r)&&!r.body.length&&n.isBlockStatement(i)&&i.body.length&&(e.consequent=e.alternate,e.alternate=null,e.test=n.unaryExpression("!",a,!0))))}}};return new r("dead-code-elimination",{metadata:{group:"builtin-pre",experimental:!0},visitor:i})},t.exports=r["default"]},{}],185:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=function(e){var t=e.Plugin,r=e.parse,n=e.traverse;return new t("eval",{metadata:{group:"builtin-pre"},visitor:{CallExpression:function(e){if(this.get("callee").isIdentifier({name:"eval"})&&1===e.arguments.length){var t=this.get("arguments")[0].evaluate();if(!t.confident)return;var i=t.value;if("string"!=typeof i)return;var a=r(i);return n.removeProperties(a),a.program}}}})},t.exports=r["default"]},{}],186:[function(e,t,r){(function(e){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=function(t){var r=t.Plugin,n=t.types;return new r("inline-environment-variables",{metadata:{group:"builtin-pre"},visitor:{MemberExpression:function(t){if(this.get("object").matchesPattern("process.env")){var r=this.toComputedKey();if(n.isLiteral(r))return n.valueToNode(e.env[r.value])}}}})},t.exports=r["default"]}).call(this,e(10))},{10:10}],187:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=function(e){var t=e.Plugin,r=e.types;return new t("jscript",{metadata:{group:"builtin-trailing"},visitor:{FunctionExpression:{exit:function(e){return e.id?(e._ignoreUserWhitespace=!0,r.callExpression(r.functionExpression(null,[],r.blockStatement([r.toStatement(e),r.returnStatement(e.id)])),[])):void 0}}}})},t.exports=r["default"]},{}],188:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=function(e){var t=e.Plugin,r=e.types;return new t("member-expression-literals",{metadata:{group:"builtin-trailing"},visitor:{MemberExpression:{exit:function(e){var t=e.property;e.computed&&r.isLiteral(t)&&r.isValidIdentifier(t.value)&&(e.property=r.identifier(t.value),e.computed=!1)}}}})},t.exports=r["default"]},{}],189:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=function(e){var t=e.Plugin,r=e.types;return new t("property-literals",{metadata:{group:"builtin-trailing"},visitor:{Property:{exit:function(e){var t=e.key;r.isLiteral(t)&&r.isValidIdentifier(t.value)&&(e.key=r.identifier(t.value),e.computed=!1)}}}})},t.exports=r["default"]},{}],190:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e(416),a=n(i);r["default"]=function(e){function t(e){return s.isLiteral(s.toComputedKey(e,e.key),{value:"__proto__"})}function r(e){var t=e.left;return s.isMemberExpression(t)&&s.isLiteral(s.toComputedKey(t,t.property),{value:"__proto__"})}function n(e,t,r){return s.expressionStatement(s.callExpression(r.addHelper("defaults"),[t,e.right]))}var i=e.Plugin,s=e.types;return new i("proto-to-assign",{metadata:{secondPass:!0},visitor:{AssignmentExpression:function(e,t,i,a){if(r(e)){var o=[],u=e.left.object,p=i.maybeGenerateMemoised(u);return p&&o.push(s.expressionStatement(s.assignmentExpression("=",p,u))),o.push(n(e,p||u,a)),p&&o.push(p),o}},ExpressionStatement:function(e,t,i,a){var o=e.expression;if(s.isAssignmentExpression(o,{operator:"="}))return r(o)?n(o,o.left.object,a):void 0},ObjectExpression:function(e,r,n,i){for(var o,u=0;u<e.properties.length;u++){var p=e.properties[u];t(p)&&(o=p.value,(0,a["default"])(e.properties,p))}if(o){var l=[s.objectExpression([]),o];return e.properties.length&&l.push(e),s.callExpression(i.addHelper("extends"),l)}}}})},t.exports=r["default"]},{416:416}],191:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=function(e){var t=e.Plugin,r={enter:function(e,t,r,n){var i=this,a=function(){n.isImmutable=!1,i.stop()};return this.isJSXClosingElement()?void this.skip():this.isJSXIdentifier({name:"ref"})&&this.parentPath.isJSXAttribute({name:e})?a():void(this.isJSXIdentifier()||this.isIdentifier()||this.isJSXMemberExpression()||this.isImmutable()||a())}};return new t("react-constant-elements",{metadata:{group:"builtin-basic"},visitor:{JSXElement:function(e){if(!e._hoisted){var t={isImmutable:!0};this.traverse(r,t),t.isImmutable?this.hoist():e._hoisted=!0}}}})},t.exports=r["default"]},{}],192:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=function(e){function t(e,t){for(var r=t.arguments[0].properties,n=!0,a=0;a<r.length;a++){var s=r[a],o=i.toComputedKey(s);if(i.isLiteral(o,{value:"displayName"})){n=!1;break}}n&&r.unshift(i.property("init",i.identifier("displayName"),i.literal(e)))}function r(e){if(!e||!i.isCallExpression(e))return!1;if(!a(e.callee))return!1;var t=e.arguments;if(1!==t.length)return!1;var r=t[0];return i.isObjectExpression(r)?!0:!1}var n=e.Plugin,i=e.types,a=i.buildMatchMemberExpression("React.createClass");return new n("react-display-name",{metadata:{group:"builtin-pre"},visitor:{ExportDefaultDeclaration:function(e,n,i,a){r(e.declaration)&&t(a.opts.basename,e.declaration)},"AssignmentExpression|Property|VariableDeclarator":function(e){var n,a;i.isAssignmentExpression(e)?(n=e.left,a=e.right):i.isProperty(e)?(n=e.key,a=e.value):i.isVariableDeclarator(e)&&(n=e.id,a=e.init),i.isMemberExpression(n)&&(n=n.property),i.isIdentifier(n)&&r(a)&&t(n.name,a)}}})},t.exports=r["default"]},{}],193:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=function(e){var t=e.Plugin;e.types;return new t("remove-console",{metadata:{group:"builtin-pre"},visitor:{CallExpression:function(){this.get("callee").matchesPattern("console",!0)&&this.dangerouslyRemove()}}})},t.exports=r["default"]},{}],194:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=function(e){var t=e.Plugin;e.types;return new t("remove-debugger",{metadata:{group:"builtin-pre"},visitor:{DebuggerStatement:function(){this.dangerouslyRemove()}}})},t.exports=r["default"]},{}],195:[function(e,t,r){t.exports={builtins:{Symbol:"symbol",Promise:"promise",Map:"map",WeakMap:"weak-map",Set:"set",WeakSet:"weak-set"},methods:{Array:{concat:"array/concat",copyWithin:"array/copy-within",entries:"array/entries",every:"array/every",fill:"array/fill",filter:"array/filter",findIndex:"array/find-index",find:"array/find",forEach:"array/for-each",from:"array/from",includes:"array/includes",indexOf:"array/index-of",join:"array/join",keys:"array/keys",lastIndexOf:"array/last-index-of",map:"array/map",of:"array/of",pop:"array/pop",push:"array/push",reduceRight:"array/reduce-right",reduce:"array/reduce",reverse:"array/reverse",shift:"array/shift",slice:"array/slice",some:"array/some",sort:"array/sort",splice:"array/splice",turn:"array/turn",unshift:"array/unshift",values:"array/values"},Object:{assign:"object/assign",classof:"object/classof",create:"object/create",define:"object/define",defineProperties:"object/define-properties",defineProperty:"object/define-property",entries:"object/entries",freeze:"object/freeze",getOwnPropertyDescriptor:"object/get-own-property-descriptor",getOwnPropertyDescriptors:"object/get-own-property-descriptors",getOwnPropertyNames:"object/get-own-property-names",getOwnPropertySymbols:"object/get-own-property-symbols",getPrototypePf:"object/get-prototype-of",index:"object/index",isExtensible:"object/is-extensible",isFrozen:"object/is-frozen",isObject:"object/is-object",isSealed:"object/is-sealed",is:"object/is",keys:"object/keys",make:"object/make",preventExtensions:"object/prevent-extensions",seal:"object/seal",setPrototypeOf:"object/set-prototype-of",values:"object/values"},RegExp:{escape:"regexp/escape"},Function:{only:"function/only",part:"function/part"},Math:{acosh:"math/acosh",asinh:"math/asinh",atanh:"math/atanh",cbrt:"math/cbrt",clz32:"math/clz32",cosh:"math/cosh",expm1:"math/expm1",fround:"math/fround",hypot:"math/hypot",pot:"math/pot",imul:"math/imul",log10:"math/log10",log1p:"math/log1p",log2:"math/log2",sign:"math/sign",sinh:"math/sinh",tanh:"math/tanh",trunc:"math/trunc"},Date:{addLocale:"date/add-locale",formatUTC:"date/format-utc",format:"date/format"},Symbol:{"for":"symbol/for",hasInstance:"symbol/has-instance","is-concat-spreadable":"symbol/is-concat-spreadable",iterator:"symbol/iterator",keyFor:"symbol/key-for",match:"symbol/match",replace:"symbol/replace",search:"symbol/search",species:"symbol/species",split:"symbol/split",toPrimitive:"symbol/to-primitive",toStringTag:"symbol/to-string-tag",unscopables:"symbol/unscopables"},String:{at:"string/at",codePointAt:"string/code-point-at",endsWith:"string/ends-with",escapeHTML:"string/escape-html",fromCodePoint:"string/from-code-point",includes:"string/includes",raw:"string/raw",repeat:"string/repeat",startsWith:"string/starts-with",unescapeHTML:"string/unescape-html"},Number:{EPSILON:"number/epsilon",isFinite:"number/is-finite",isInteger:"number/is-integer",isNaN:"number/is-nan",isSafeInteger:"number/is-safe-integer",MAX_SAFE_INTEGER:"number/max-safe-integer",MIN_SAFE_INTEGER:"number/min-safe-integer",parseFloat:"number/parse-float",parseInt:"number/parse-int",random:"number/random"},Reflect:{apply:"reflect/apply",construct:"reflect/construct",defineProperty:"reflect/define-property",deleteProperty:"reflect/delete-property",enumerate:"reflect/enumerate",getOwnPropertyDescriptor:"reflect/get-own-property-descriptor",getPrototypeOf:"reflect/get-prototype-of",get:"reflect/get",has:"reflect/has",isExtensible:"reflect/is-extensible",ownKeys:"reflect/own-keys",preventExtensions:"reflect/prevent-extensions",setPrototypeOf:"reflect/set-prototype-of",set:"reflect/set"}}}},{}],196:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e(195),a=n(i);r["default"]=function(e){function t(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var r=e.Plugin,n=e.types,i="babel-runtime";return new r("runtime",{metadata:{group:"builtin-post-modules"},pre:function(e){e.set("helperGenerator",function(t){return e.addImport(i+"/helpers/"+t,t,"absoluteDefault")}),e.setDynamic("regeneratorIdentifier",function(){return e.addImport(i+"/regenerator","regeneratorRuntime","absoluteDefault")})},visitor:{ReferencedIdentifier:function(e,r,s,o){if("regeneratorRuntime"===e.name)return o.get("regeneratorIdentifier");if(!n.isMemberExpression(r)&&t(a["default"].builtins,e.name)&&!s.getBindingIdentifier(e.name)){var u=a["default"].builtins[e.name];return o.addImport(i+"/core-js/"+u,e.name,"absoluteDefault")}},CallExpression:function(e,t,r,a){if(!e.arguments.length){var s=e.callee;if(n.isMemberExpression(s)&&s.computed&&this.get("callee.property").matchesPattern("Symbol.iterator"))return n.callExpression(a.addImport(i+"/core-js/get-iterator","getIterator","absoluteDefault"),[s.object])}},BinaryExpression:function(e,t,r,a){return"in"===e.operator&&this.get("left").matchesPattern("Symbol.iterator")?n.callExpression(a.addImport(i+"/core-js/is-iterable","isIterable","absoluteDefault"),[e.right]):void 0},MemberExpression:{enter:function(e,r,s,o){if(this.isReferenced()){var u=e.object,p=e.property;if(n.isReferenced(u,e)&&!e.computed&&t(a["default"].methods,u.name)){var l=a["default"].methods[u.name];if(t(l,p.name)&&!s.getBindingIdentifier(u.name)){if("Object"===u.name&&"defineProperty"===p.name&&this.parentPath.isCallExpression()){var c=this.parentPath.node;if(3===c.arguments.length&&n.isLiteral(c.arguments[1]))return}var f=l[p.name];return o.addImport(i+"/core-js/"+f,u.name+"$"+p.name,"absoluteDefault")}}}},exit:function(e,r,s,o){if(this.isReferenced()){var u=e.property,p=e.object;if(t(a["default"].builtins,p.name)&&!s.getBindingIdentifier(p.name)){var l=a["default"].builtins[p.name];return n.memberExpression(o.addImport(i+"/core-js/"+l,""+p.name,"absoluteDefault"),u)}}}}}})},t.exports=r["default"]},{195:195}],197:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e(198),a=n(i);r["default"]=function(e){var t=e.Plugin,r=(e.types,e.messages);return new t("undeclared-variables-check",{metadata:{group:"builtin-pre"},visitor:{ReferencedIdentifier:function(e,t,n){var i=n.getBinding(e.name);if(i&&"type"===i.kind&&!this.parentPath.isFlow())throw this.errorWithNode(r.get("undeclaredVariableType",e.name),ReferenceError);if(!n.hasBinding(e.name)){var s,o=n.getAllBindings(),u=-1;for(var p in o){var l=(0,a["default"])(e.name,p);0>=l||l>3||u>=l||(s=p,u=l)}var c;throw c=s?r.get("undeclaredVariableSuggestion",e.name,s):r.get("undeclaredVariable",e.name),this.errorWithNode(c,ReferenceError)}}}})},t.exports=r["default"]},{198:198}],198:[function(e,t,r){"use strict";var n=[],i=[];t.exports=function(e,t){if(e===t)return 0;var r=e.length,a=t.length;if(0===r)return a;if(0===a)return r;for(var s,o,u,p,l=0,c=0;r>l;)i[l]=e.charCodeAt(l),n[l]=++l;for(;a>c;)for(s=t.charCodeAt(c),u=c++,o=c,l=0;r>l;l++)p=s===i[l]?u:u+1,u=n[l],o=n[l]=u>o?p>o?o+1:p:p>u?u+1:p;return o}},{}],199:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=function(e){var t=e.Plugin,r=e.types;return new t("undefined-to-void",{metadata:{group:"builtin-basic"},visitor:{ReferencedIdentifier:function(e,t){return"undefined"===e.name?r.unaryExpression("void",r.literal(0),!0):void 0}}})},t.exports=r["default"]},{}],200:[function(e,t,r){(function(r){"use strict";function n(e){this.enabled=e&&void 0!==e.enabled?e.enabled:c}function i(e){var t=function(){return a.apply(t,arguments)};return t._styles=e,t.enabled=this.enabled,t.__proto__=m,t}function a(){var e=arguments,t=e.length,r=0!==t&&String(arguments[0]);if(t>1)for(var n=1;t>n;n++)r+=" "+e[n];if(!this.enabled||!r)return r;var i=this._styles,a=i.length,s=u.dim.open;for(!d||-1===i.indexOf("gray")&&-1===i.indexOf("grey")||(u.dim.open="");a--;){var o=u[i[a]];r=o.open+r.replace(o.closeRe,o.open)+o.close}return u.dim.open=s,r}function s(){var e={};return Object.keys(h).forEach(function(t){e[t]={get:function(){return i.call(this,[t])}}}),e}var o=e(202),u=e(201),p=e(205),l=e(203),c=e(207),f=Object.defineProperties,d="win32"===r.platform&&!/^xterm/i.test(r.env.TERM);d&&(u.blue.open="[94m");var h=function(){var e={};return Object.keys(u).forEach(function(t){u[t].closeRe=new RegExp(o(u[t].close),"g"),e[t]={get:function(){return i.call(this,this._styles.concat(t))}}}),e}(),m=f(function(){},h);f(n.prototype,s()),t.exports=new n,t.exports.styles=u,t.exports.hasColor=l,t.exports.stripColor=p,t.exports.supportsColor=c}).call(this,e(10))},{10:10,201:201,202:202,203:203,205:205,207:207}],201:[function(e,t,r){"use strict";function n(){var e={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]}};return e.colors.grey=e.colors.gray,Object.keys(e).forEach(function(t){var r=e[t];Object.keys(r).forEach(function(t){var n=r[t];e[t]=r[t]={open:"["+n[0]+"m",close:"["+n[1]+"m"}}),Object.defineProperty(e,t,{value:r,enumerable:!1})}),e}Object.defineProperty(t,"exports",{enumerable:!0,get:n})},{}],202:[function(e,t,r){"use strict";var n=/[|\\{}()[\]^$+*?.]/g;t.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(n,"\\$&")}},{}],203:[function(e,t,r){"use strict";var n=e(204),i=new RegExp(n().source);t.exports=i.test.bind(i)},{204:204}],204:[function(e,t,r){"use strict";t.exports=function(){return/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g}},{}],205:[function(e,t,r){"use strict";var n=e(206)();t.exports=function(e){return"string"==typeof e?e.replace(n,""):e}},{206:206}],206:[function(e,t,r){arguments[4][204][0].apply(r,arguments)},{204:204}],207:[function(e,t,r){(function(e){"use strict";var r=e.argv,n=r.indexOf("--"),i=function(e){e="--"+e;var t=r.indexOf(e);return-1!==t&&(-1!==n?n>t:!0)};t.exports=function(){return"FORCE_COLOR"in e.env?!0:i("no-color")||i("no-colors")||i("color=false")?!1:i("color")||i("colors")||i("color=true")||i("color=always")?!0:e.stdout&&!e.stdout.isTTY?!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(10))},{10:10}],208:[function(e,t,r){(function(t){"use strict";function n(e){return new t(e,"base64").toString()}function i(e){return e.split(",").pop()}function a(e,t){var r=c.exec(e);c.lastIndex=0;var n=r[1]||r[2],i=p.join(t,n);try{return u.readFileSync(i,"utf8")}catch(a){throw new Error("An error occurred while trying to read the map file at "+i+"\n"+a)}}function s(e,t){t=t||{},t.isFileComment&&(e=a(e,t.commentFileDir)),t.hasComment&&(e=i(e)),t.isEncoded&&(e=n(e)),(t.isJSON||t.isEncoded)&&(e=JSON.parse(e)),this.sourcemap=e}function o(e){for(var t,n=e.split("\n"),i=n.length-1;i>0;i--)if(t=n[i],~t.indexOf("sourceMappingURL=data:"))return r.fromComment(t)}var u=e(3),p=e(9),l=/^\s*\/(?:\/|\*)[@#]\s+sourceMappingURL=data:(?:application|text)\/json;(?:charset[:=]\S+;)?base64,(.*)$/gm,c=/(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^\*]+?)[ \t]*(?:\*\/){1}[ \t]*$)/gm;s.prototype.toJSON=function(e){return JSON.stringify(this.sourcemap,null,e)},s.prototype.toBase64=function(){var e=this.toJSON();return new t(e).toString("base64")},s.prototype.toComment=function(e){var t=this.toBase64(),r="sourceMappingURL=data:application/json;base64,"+t;return e&&e.multiline?"/*# "+r+" */":"//# "+r},s.prototype.toObject=function(){return JSON.parse(this.toJSON())},s.prototype.addProperty=function(e,t){if(this.sourcemap.hasOwnProperty(e))throw new Error("property %s already exists on the sourcemap, use set property instead");return this.setProperty(e,t)},s.prototype.setProperty=function(e,t){return this.sourcemap[e]=t,this},s.prototype.getProperty=function(e){return this.sourcemap[e]},r.fromObject=function(e){return new s(e)},r.fromJSON=function(e){return new s(e,{isJSON:!0})},r.fromBase64=function(e){return new s(e,{isEncoded:!0})},r.fromComment=function(e){return e=e.replace(/^\/\*/g,"//").replace(/\*\/$/g,""),new s(e,{isEncoded:!0,hasComment:!0})},r.fromMapFileComment=function(e,t){return new s(e,{commentFileDir:t,isFileComment:!0,isJSON:!0})},r.fromSource=function(e,t){if(t){var n=o(e);return n?n:null}var i=e.match(l);return l.lastIndex=0,i?r.fromComment(i.pop()):null},r.fromMapFileSource=function(e,t){var n=e.match(c);return c.lastIndex=0,n?r.fromMapFileComment(n.pop(),t):null},r.removeComments=function(e){return l.lastIndex=0,e.replace(l,"")},r.removeMapFileComments=function(e){return c.lastIndex=0,e.replace(c,"")},Object.defineProperty(r,"commentRegex",{get:function(){return l.lastIndex=0,l}}),Object.defineProperty(r,"mapFileCommentRegex",{get:function(){return c.lastIndex=0,c}})}).call(this,e(4).Buffer)},{3:3,4:4,9:9}],209:[function(e,t,r){t.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},{}],210:[function(e,t,r){var n=e(290)("unscopables"),i=Array.prototype;void 0==i[n]&&e(238)(i,n,{}),t.exports=function(e){i[n][e]=!0}},{238:238,290:290}],211:[function(e,t,r){var n=e(245);t.exports=function(e){if(!n(e))throw TypeError(e+" is not an object!");return e}},{245:245}],212:[function(e,t,r){"use strict";var n=e(287),i=e(283),a=e(286);t.exports=[].copyWithin||function(e,t){var r=n(this),s=a(r.length),o=i(e,s),u=i(t,s),p=arguments,l=p.length>2?p[2]:void 0,c=Math.min((void 0===l?s:i(l,s))-u,s-o),f=1;for(o>u&&u+c>o&&(f=-1,u+=c-1,o+=c-1);c-- >0;)u in r?r[o]=r[u]:delete r[o],o+=f,u+=f;return r}},{283:283,286:286,287:287}],213:[function(e,t,r){"use strict";var n=e(287),i=e(283),a=e(286);t.exports=[].fill||function(e){for(var t=n(this),r=a(t.length),s=arguments,o=s.length,u=i(o>1?s[1]:void 0,r),p=o>2?s[2]:void 0,l=void 0===p?r:i(p,r);l>u;)t[u++]=e;return t}},{283:283,286:286,287:287}],214:[function(e,t,r){var n=e(285),i=e(286),a=e(283);t.exports=function(e){return function(t,r,s){var o,u=n(t),p=i(u.length),l=a(s,p);if(e&&r!=r){for(;p>l;)if(o=u[l++],o!=o)return!0}else for(;p>l;l++)if((e||l in u)&&u[l]===r)return e||l;return!e&&-1}}},{283:283,285:285,286:286}],215:[function(e,t,r){var n=e(224),i=e(241),a=e(287),s=e(286),o=e(216);t.exports=function(e){var t=1==e,r=2==e,u=3==e,p=4==e,l=6==e,c=5==e||l;return function(f,d,h){for(var m,y,g=a(f),v=i(g),b=n(d,h,3),E=s(v.length),x=0,S=t?o(f,E):r?o(f,0):void 0;E>x;x++)if((c||x in v)&&(m=v[x],y=b(m,x,g),e))if(t)S[x]=y;else if(y)switch(e){case 3:return!0;case 5:return m;case 6:return x;case 2:S.push(m)}else if(p)return!1;return l?-1:u||p?p:S}}},{216:216,224:224,241:241,286:286,287:287}],216:[function(e,t,r){var n=e(245),i=e(243),a=e(290)("species");t.exports=function(e,t){var r;return i(e)&&(r=e.constructor,"function"!=typeof r||r!==Array&&!i(r.prototype)||(r=void 0),n(r)&&(r=r[a],null===r&&(r=void 0))),new(void 0===r?Array:r)(t)}},{243:243,245:245,290:290}],217:[function(e,t,r){var n=e(218),i=e(290)("toStringTag"),a="Arguments"==n(function(){return arguments}());t.exports=function(e){var t,r,s;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=(t=Object(e))[i])?r:a?n(t):"Object"==(s=n(t))&&"function"==typeof t.callee?"Arguments":s}},{218:218,290:290}],218:[function(e,t,r){var n={}.toString;t.exports=function(e){return n.call(e).slice(8,-1)}},{}],219:[function(e,t,r){"use strict";var n=e(253),i=e(238),a=e(267),s=e(224),o=e(276),u=e(225),p=e(234),l=e(249),c=e(251),f=e(289)("id"),d=e(237),h=e(245),m=e(272),y=e(226),g=Object.isExtensible||h,v=y?"_s":"size",b=0,E=function(e,t){if(!h(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!d(e,f)){if(!g(e))return"F";if(!t)return"E";i(e,f,++b)}return"O"+e[f]},x=function(e,t){var r,n=E(t);if("F"!==n)return e._i[n];for(r=e._f;r;r=r.n)if(r.k==t)return r};t.exports={getConstructor:function(e,t,r,i){var l=e(function(e,a){o(e,l,t),e._i=n.create(null),e._f=void 0,e._l=void 0,e[v]=0,void 0!=a&&p(a,r,e[i],e)});return a(l.prototype,{clear:function(){for(var e=this,t=e._i,r=e._f;r;r=r.n)r.r=!0,r.p&&(r.p=r.p.n=void 0),delete t[r.i];e._f=e._l=void 0,e[v]=0},"delete":function(e){var t=this,r=x(t,e);if(r){var n=r.n,i=r.p;delete t._i[r.i],r.r=!0,i&&(i.n=n),n&&(n.p=i),t._f==r&&(t._f=n),t._l==r&&(t._l=i),t[v]--}return!!r},forEach:function(e){for(var t,r=s(e,arguments.length>1?arguments[1]:void 0,3);t=t?t.n:this._f;)for(r(t.v,t.k,this);t&&t.r;)t=t.p},has:function(e){return!!x(this,e)}}),y&&n.setDesc(l.prototype,"size",{get:function(){return u(this[v])}}),l},def:function(e,t,r){var n,i,a=x(e,t);return a?a.v=r:(e._l=a={i:i=E(t,!0),k:t,v:r,p:n=e._l,n:void 0,r:!1},e._f||(e._f=a),n&&(n.n=a),e[v]++,"F"!==i&&(e._i[i]=a)),e},getEntry:x,setStrong:function(e,t,r){l(e,t,function(e,t){this._t=e,this._k=t,this._l=void 0},function(){for(var e=this,t=e._k,r=e._l;r&&r.r;)r=r.p;return e._t&&(e._l=r=r?r.n:e._t._f)?"keys"==t?c(0,r.k):"values"==t?c(0,r.v):c(0,[r.k,r.v]):(e._t=void 0,
c(1))},r?"entries":"values",!r,!0),m(t)}}},{224:224,225:225,226:226,234:234,237:237,238:238,245:245,249:249,251:251,253:253,267:267,272:272,276:276,289:289}],220:[function(e,t,r){var n=e(234),i=e(217);t.exports=function(e){return function(){if(i(this)!=e)throw TypeError(e+"#toJSON isn't generic");var t=[];return n(this,!1,t.push,t),t}}},{217:217,234:234}],221:[function(e,t,r){"use strict";var n=e(238),i=e(267),a=e(211),s=e(245),o=e(276),u=e(234),p=e(215),l=e(237),c=e(289)("weak"),f=Object.isExtensible||s,d=p(5),h=p(6),m=0,y=function(e){return e._l||(e._l=new g)},g=function(){this.a=[]},v=function(e,t){return d(e.a,function(e){return e[0]===t})};g.prototype={get:function(e){var t=v(this,e);return t?t[1]:void 0},has:function(e){return!!v(this,e)},set:function(e,t){var r=v(this,e);r?r[1]=t:this.a.push([e,t])},"delete":function(e){var t=h(this.a,function(t){return t[0]===e});return~t&&this.a.splice(t,1),!!~t}},t.exports={getConstructor:function(e,t,r,n){var a=e(function(e,i){o(e,a,t),e._i=m++,e._l=void 0,void 0!=i&&u(i,r,e[n],e)});return i(a.prototype,{"delete":function(e){return s(e)?f(e)?l(e,c)&&l(e[c],this._i)&&delete e[c][this._i]:y(this)["delete"](e):!1},has:function(e){return s(e)?f(e)?l(e,c)&&l(e[c],this._i):y(this).has(e):!1}}),a},def:function(e,t,r){return f(a(t))?(l(t,c)||n(t,c,{}),t[c][e._i]=r):y(e).set(t,r),e},frozenStore:y,WEAK:c}},{211:211,215:215,234:234,237:237,238:238,245:245,267:267,276:276,289:289}],222:[function(e,t,r){"use strict";var n=e(236),i=e(229),a=e(268),s=e(267),o=e(234),u=e(276),p=e(245),l=e(231),c=e(250),f=e(273);t.exports=function(e,t,r,d,h,m){var y=n[e],g=y,v=h?"set":"add",b=g&&g.prototype,E={},x=function(e){var t=b[e];a(b,e,"delete"==e?function(e){return m&&!p(e)?!1:t.call(this,0===e?0:e)}:"has"==e?function(e){return m&&!p(e)?!1:t.call(this,0===e?0:e)}:"get"==e?function(e){return m&&!p(e)?void 0:t.call(this,0===e?0:e)}:"add"==e?function(e){return t.call(this,0===e?0:e),this}:function(e,r){return t.call(this,0===e?0:e,r),this})};if("function"==typeof g&&(m||b.forEach&&!l(function(){(new g).entries().next()}))){var S,A=new g,D=A[v](m?{}:-0,1)!=A,C=l(function(){A.has(1)}),w=c(function(e){new g(e)});w||(g=t(function(t,r){u(t,g,e);var n=new y;return void 0!=r&&o(r,h,n[v],n),n}),g.prototype=b,b.constructor=g),m||A.forEach(function(e,t){S=1/t===-(1/0)}),(C||S)&&(x("delete"),x("has"),h&&x("get")),(S||D)&&x(v),m&&b.clear&&delete b.clear}else g=d.getConstructor(t,e,h,v),s(g.prototype,r);return f(g,e),E[e]=g,i(i.G+i.W+i.F*(g!=y),E),m||d.setStrong(g,e,h),g}},{229:229,231:231,234:234,236:236,245:245,250:250,267:267,268:268,273:273,276:276}],223:[function(e,t,r){var n=t.exports={version:"1.2.6"};"number"==typeof __e&&(__e=n)},{}],224:[function(e,t,r){var n=e(209);t.exports=function(e,t,r){if(n(e),void 0===t)return e;switch(r){case 1:return function(r){return e.call(t,r)};case 2:return function(r,n){return e.call(t,r,n)};case 3:return function(r,n,i){return e.call(t,r,n,i)}}return function(){return e.apply(t,arguments)}}},{209:209}],225:[function(e,t,r){t.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},{}],226:[function(e,t,r){t.exports=!e(231)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},{231:231}],227:[function(e,t,r){var n=e(245),i=e(236).document,a=n(i)&&n(i.createElement);t.exports=function(e){return a?i.createElement(e):{}}},{236:236,245:245}],228:[function(e,t,r){var n=e(253);t.exports=function(e){var t=n.getKeys(e),r=n.getSymbols;if(r)for(var i,a=r(e),s=n.isEnum,o=0;a.length>o;)s.call(e,i=a[o++])&&t.push(i);return t}},{253:253}],229:[function(e,t,r){var n=e(236),i=e(223),a=e(238),s=e(268),o=e(224),u="prototype",p=function(e,t,r){var l,c,f,d,h=e&p.F,m=e&p.G,y=e&p.S,g=e&p.P,v=e&p.B,b=m?n:y?n[t]||(n[t]={}):(n[t]||{})[u],E=m?i:i[t]||(i[t]={}),x=E[u]||(E[u]={});m&&(r=t);for(l in r)c=!h&&b&&l in b,f=(c?b:r)[l],d=v&&c?o(f,n):g&&"function"==typeof f?o(Function.call,f):f,b&&!c&&s(b,l,f),E[l]!=f&&a(E,l,d),g&&x[l]!=f&&(x[l]=f)};n.core=i,p.F=1,p.G=2,p.S=4,p.P=8,p.B=16,p.W=32,t.exports=p},{223:223,224:224,236:236,238:238,268:268}],230:[function(e,t,r){var n=e(290)("match");t.exports=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[n]=!1,!"/./"[e](t)}catch(i){}}return!0}},{290:290}],231:[function(e,t,r){t.exports=function(e){try{return!!e()}catch(t){return!0}}},{}],232:[function(e,t,r){"use strict";var n=e(238),i=e(268),a=e(231),s=e(225),o=e(290);t.exports=function(e,t,r){var u=o(e),p=""[e];a(function(){var t={};return t[u]=function(){return 7},7!=""[e](t)})&&(i(String.prototype,e,r(s,u,p)),n(RegExp.prototype,u,2==t?function(e,t){return p.call(e,this,t)}:function(e){return p.call(e,this)}))}},{225:225,231:231,238:238,268:268,290:290}],233:[function(e,t,r){"use strict";var n=e(211);t.exports=function(){var e=n(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t}},{211:211}],234:[function(e,t,r){var n=e(224),i=e(247),a=e(242),s=e(211),o=e(286),u=e(291);t.exports=function(e,t,r,p){var l,c,f,d=u(e),h=n(r,p,t?2:1),m=0;if("function"!=typeof d)throw TypeError(e+" is not iterable!");if(a(d))for(l=o(e.length);l>m;m++)t?h(s(c=e[m])[0],c[1]):h(e[m]);else for(f=d.call(e);!(c=f.next()).done;)i(f,h,c.value,t)}},{211:211,224:224,242:242,247:247,286:286,291:291}],235:[function(e,t,r){var n=e(285),i=e(253).getNames,a={}.toString,s="object"==typeof window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],o=function(e){try{return i(e)}catch(t){return s.slice()}};t.exports.get=function(e){return s&&"[object Window]"==a.call(e)?o(e):i(n(e))}},{253:253,285:285}],236:[function(e,t,r){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},{}],237:[function(e,t,r){var n={}.hasOwnProperty;t.exports=function(e,t){return n.call(e,t)}},{}],238:[function(e,t,r){var n=e(253),i=e(266);t.exports=e(226)?function(e,t,r){return n.setDesc(e,t,i(1,r))}:function(e,t,r){return e[t]=r,e}},{226:226,253:253,266:266}],239:[function(e,t,r){t.exports=e(236).document&&document.documentElement},{236:236}],240:[function(e,t,r){t.exports=function(e,t,r){var n=void 0===r;switch(t.length){case 0:return n?e():e.call(r);case 1:return n?e(t[0]):e.call(r,t[0]);case 2:return n?e(t[0],t[1]):e.call(r,t[0],t[1]);case 3:return n?e(t[0],t[1],t[2]):e.call(r,t[0],t[1],t[2]);case 4:return n?e(t[0],t[1],t[2],t[3]):e.call(r,t[0],t[1],t[2],t[3])}return e.apply(r,t)}},{}],241:[function(e,t,r){var n=e(218);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==n(e)?e.split(""):Object(e)}},{218:218}],242:[function(e,t,r){var n=e(252),i=e(290)("iterator"),a=Array.prototype;t.exports=function(e){return void 0!==e&&(n.Array===e||a[i]===e)}},{252:252,290:290}],243:[function(e,t,r){var n=e(218);t.exports=Array.isArray||function(e){return"Array"==n(e)}},{218:218}],244:[function(e,t,r){var n=e(245),i=Math.floor;t.exports=function(e){return!n(e)&&isFinite(e)&&i(e)===e}},{245:245}],245:[function(e,t,r){t.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},{}],246:[function(e,t,r){var n=e(245),i=e(218),a=e(290)("match");t.exports=function(e){var t;return n(e)&&(void 0!==(t=e[a])?!!t:"RegExp"==i(e))}},{218:218,245:245,290:290}],247:[function(e,t,r){var n=e(211);t.exports=function(e,t,r,i){try{return i?t(n(r)[0],r[1]):t(r)}catch(a){var s=e["return"];throw void 0!==s&&n(s.call(e)),a}}},{211:211}],248:[function(e,t,r){"use strict";var n=e(253),i=e(266),a=e(273),s={};e(238)(s,e(290)("iterator"),function(){return this}),t.exports=function(e,t,r){e.prototype=n.create(s,{next:i(1,r)}),a(e,t+" Iterator")}},{238:238,253:253,266:266,273:273,290:290}],249:[function(e,t,r){"use strict";var n=e(255),i=e(229),a=e(268),s=e(238),o=e(237),u=e(252),p=e(248),l=e(273),c=e(253).getProto,f=e(290)("iterator"),d=!([].keys&&"next"in[].keys()),h="@@iterator",m="keys",y="values",g=function(){return this};t.exports=function(e,t,r,v,b,E,x){p(r,t,v);var S,A,D=function(e){if(!d&&e in _)return _[e];switch(e){case m:return function(){return new r(this,e)};case y:return function(){return new r(this,e)}}return function(){return new r(this,e)}},C=t+" Iterator",w=b==y,I=!1,_=e.prototype,F=_[f]||_[h]||b&&_[b],k=F||D(b);if(F){var P=c(k.call(new e));l(P,C,!0),!n&&o(_,h)&&s(P,f,g),w&&F.name!==y&&(I=!0,k=function(){return F.call(this)})}if(n&&!x||!d&&!I&&_[f]||s(_,f,k),u[t]=k,u[C]=g,b)if(S={values:w?k:D(y),keys:E?k:D(m),entries:w?D("entries"):k},x)for(A in S)A in _||a(_,A,S[A]);else i(i.P+i.F*(d||I),t,S);return S}},{229:229,237:237,238:238,248:248,252:252,253:253,255:255,268:268,273:273,290:290}],250:[function(e,t,r){var n=e(290)("iterator"),i=!1;try{var a=[7][n]();a["return"]=function(){i=!0},Array.from(a,function(){throw 2})}catch(s){}t.exports=function(e,t){if(!t&&!i)return!1;var r=!1;try{var a=[7],s=a[n]();s.next=function(){r=!0},a[n]=function(){return s},e(a)}catch(o){}return r}},{290:290}],251:[function(e,t,r){t.exports=function(e,t){return{value:t,done:!!e}}},{}],252:[function(e,t,r){t.exports={}},{}],253:[function(e,t,r){var n=Object;t.exports={create:n.create,getProto:n.getPrototypeOf,isEnum:{}.propertyIsEnumerable,getDesc:n.getOwnPropertyDescriptor,setDesc:n.defineProperty,setDescs:n.defineProperties,getKeys:n.keys,getNames:n.getOwnPropertyNames,getSymbols:n.getOwnPropertySymbols,each:[].forEach}},{}],254:[function(e,t,r){var n=e(253),i=e(285);t.exports=function(e,t){for(var r,a=i(e),s=n.getKeys(a),o=s.length,u=0;o>u;)if(a[r=s[u++]]===t)return r}},{253:253,285:285}],255:[function(e,t,r){t.exports=!1},{}],256:[function(e,t,r){t.exports=Math.expm1||function(e){return 0==(e=+e)?e:e>-1e-6&&1e-6>e?e+e*e/2:Math.exp(e)-1}},{}],257:[function(e,t,r){t.exports=Math.log1p||function(e){return(e=+e)>-1e-8&&1e-8>e?e-e*e/2:Math.log(1+e)}},{}],258:[function(e,t,r){t.exports=Math.sign||function(e){return 0==(e=+e)||e!=e?e:0>e?-1:1}},{}],259:[function(e,t,r){var n,i,a,s=e(236),o=e(282).set,u=s.MutationObserver||s.WebKitMutationObserver,p=s.process,l=s.Promise,c="process"==e(218)(p),f=function(){var e,t,r;for(c&&(e=p.domain)&&(p.domain=null,e.exit());n;)t=n.domain,r=n.fn,t&&t.enter(),r(),t&&t.exit(),n=n.next;i=void 0,e&&e.enter()};if(c)a=function(){p.nextTick(f)};else if(u){var d=1,h=document.createTextNode("");new u(f).observe(h,{characterData:!0}),a=function(){h.data=d=-d}}else a=l&&l.resolve?function(){l.resolve().then(f)}:function(){o.call(s,f)};t.exports=function(e){var t={fn:e,next:void 0,domain:c&&p.domain};i&&(i.next=t),n||(n=t,a()),i=t}},{218:218,236:236,282:282}],260:[function(e,t,r){var n=e(253),i=e(287),a=e(241);t.exports=e(231)(function(){var e=Object.assign,t={},r={},n=Symbol(),i="abcdefghijklmnopqrst";return t[n]=7,i.split("").forEach(function(e){r[e]=e}),7!=e({},t)[n]||Object.keys(e({},r)).join("")!=i})?function(e,t){for(var r=i(e),s=arguments,o=s.length,u=1,p=n.getKeys,l=n.getSymbols,c=n.isEnum;o>u;)for(var f,d=a(s[u++]),h=l?p(d).concat(l(d)):p(d),m=h.length,y=0;m>y;)c.call(d,f=h[y++])&&(r[f]=d[f]);return r}:Object.assign},{231:231,241:241,253:253,287:287}],261:[function(e,t,r){var n=e(229),i=e(223),a=e(231);t.exports=function(e,t){var r=(i.Object||{})[e]||Object[e],s={};s[e]=t(r),n(n.S+n.F*a(function(){r(1)}),"Object",s)}},{223:223,229:229,231:231}],262:[function(e,t,r){var n=e(253),i=e(285),a=n.isEnum;t.exports=function(e){return function(t){for(var r,s=i(t),o=n.getKeys(s),u=o.length,p=0,l=[];u>p;)a.call(s,r=o[p++])&&l.push(e?[r,s[r]]:s[r]);return l}}},{253:253,285:285}],263:[function(e,t,r){var n=e(253),i=e(211),a=e(236).Reflect;t.exports=a&&a.ownKeys||function(e){var t=n.getNames(i(e)),r=n.getSymbols;return r?t.concat(r(e)):t}},{211:211,236:236,253:253}],264:[function(e,t,r){"use strict";var n=e(265),i=e(240),a=e(209);t.exports=function(){for(var e=a(this),t=arguments.length,r=Array(t),s=0,o=n._,u=!1;t>s;)(r[s]=arguments[s++])===o&&(u=!0);return function(){var n,a=this,s=arguments,p=s.length,l=0,c=0;if(!u&&!p)return i(e,r,a);if(n=r.slice(),u)for(;t>l;l++)n[l]===o&&(n[l]=s[c++]);for(;p>c;)n.push(s[c++]);return i(e,n,a)}}},{209:209,240:240,265:265}],265:[function(e,t,r){t.exports=e(236)},{236:236}],266:[function(e,t,r){t.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},{}],267:[function(e,t,r){var n=e(268);t.exports=function(e,t){for(var r in t)n(e,r,t[r]);return e}},{268:268}],268:[function(e,t,r){var n=e(236),i=e(238),a=e(289)("src"),s="toString",o=Function[s],u=(""+o).split(s);e(223).inspectSource=function(e){return o.call(e)},(t.exports=function(e,t,r,s){"function"==typeof r&&(r.hasOwnProperty(a)||i(r,a,e[t]?""+e[t]:u.join(String(t))),r.hasOwnProperty("name")||i(r,"name",t)),e===n?e[t]=r:(s||delete e[t],i(e,t,r))})(Function.prototype,s,function(){return"function"==typeof this&&this[a]||o.call(this)})},{223:223,236:236,238:238,289:289}],269:[function(e,t,r){t.exports=function(e,t){var r=t===Object(t)?function(e){return t[e]}:t;return function(t){return String(t).replace(e,r)}}},{}],270:[function(e,t,r){t.exports=Object.is||function(e,t){return e===t?0!==e||1/e===1/t:e!=e&&t!=t}},{}],271:[function(e,t,r){var n=e(253).getDesc,i=e(245),a=e(211),s=function(e,t){if(a(e),!i(t)&&null!==t)throw TypeError(t+": can't set as prototype!")};t.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(t,r,i){try{i=e(224)(Function.call,n(Object.prototype,"__proto__").set,2),i(t,[]),r=!(t instanceof Array)}catch(a){r=!0}return function(e,t){return s(e,t),r?e.__proto__=t:i(e,t),e}}({},!1):void 0),check:s}},{211:211,224:224,245:245,253:253}],272:[function(e,t,r){"use strict";var n=e(236),i=e(253),a=e(226),s=e(290)("species");t.exports=function(e){var t=n[e];a&&t&&!t[s]&&i.setDesc(t,s,{configurable:!0,get:function(){return this}})}},{226:226,236:236,253:253,290:290}],273:[function(e,t,r){var n=e(253).setDesc,i=e(237),a=e(290)("toStringTag");t.exports=function(e,t,r){e&&!i(e=r?e:e.prototype,a)&&n(e,a,{configurable:!0,value:t})}},{237:237,253:253,290:290}],274:[function(e,t,r){var n=e(236),i="__core-js_shared__",a=n[i]||(n[i]={});t.exports=function(e){return a[e]||(a[e]={})}},{236:236}],275:[function(e,t,r){var n=e(211),i=e(209),a=e(290)("species");t.exports=function(e,t){var r,s=n(e).constructor;return void 0===s||void 0==(r=n(s)[a])?t:i(r)}},{209:209,211:211,290:290}],276:[function(e,t,r){t.exports=function(e,t,r){if(!(e instanceof t))throw TypeError(r+": use the 'new' operator!");return e}},{}],277:[function(e,t,r){var n=e(284),i=e(225);t.exports=function(e){return function(t,r){var a,s,o=String(i(t)),u=n(r),p=o.length;return 0>u||u>=p?e?"":void 0:(a=o.charCodeAt(u),55296>a||a>56319||u+1===p||(s=o.charCodeAt(u+1))<56320||s>57343?e?o.charAt(u):a:e?o.slice(u,u+2):(a-55296<<10)+(s-56320)+65536)}}},{225:225,284:284}],278:[function(e,t,r){var n=e(246),i=e(225);t.exports=function(e,t,r){if(n(t))throw TypeError("String#"+r+" doesn't accept regex!");return String(i(e))}},{225:225,246:246}],279:[function(e,t,r){var n=e(286),i=e(280),a=e(225);t.exports=function(e,t,r,s){var o=String(a(e)),u=o.length,p=void 0===r?" ":String(r),l=n(t);if(u>=l)return o;""==p&&(p=" ");var c=l-u,f=i.call(p,Math.ceil(c/p.length));return f.length>c&&(f=f.slice(0,c)),s?f+o:o+f}},{225:225,280:280,286:286}],280:[function(e,t,r){"use strict";var n=e(284),i=e(225);t.exports=function(e){var t=String(i(this)),r="",a=n(e);if(0>a||a==1/0)throw RangeError("Count can't be negative");for(;a>0;(a>>>=1)&&(t+=t))1&a&&(r+=t);return r}},{225:225,284:284}],281:[function(e,t,r){var n=e(229),i=e(225),a=e(231),s=" \n\x0B\f\r \u2028\u2029\ufeff",o="["+s+"]",u="
",p=RegExp("^"+o+o+"*"),l=RegExp(o+o+"*$"),c=function(e,t){var r={};r[e]=t(f),n(n.P+n.F*a(function(){return!!s[e]()||u[e]()!=u}),"String",r)},f=c.trim=function(e,t){return e=String(i(e)),1&t&&(e=e.replace(p,"")),2&t&&(e=e.replace(l,"")),e};t.exports=c},{225:225,229:229,231:231}],282:[function(e,t,r){var n,i,a,s=e(224),o=e(240),u=e(239),p=e(227),l=e(236),c=l.process,f=l.setImmediate,d=l.clearImmediate,h=l.MessageChannel,m=0,y={},g="onreadystatechange",v=function(){var e=+this;if(y.hasOwnProperty(e)){var t=y[e];delete y[e],t()}},b=function(e){v.call(e.data)};f&&d||(f=function(e){for(var t=[],r=1;arguments.length>r;)t.push(arguments[r++]);return y[++m]=function(){o("function"==typeof e?e:Function(e),t)},n(m),m},d=function(e){delete y[e]},"process"==e(218)(c)?n=function(e){c.nextTick(s(v,e,1))}:h?(i=new h,a=i.port2,i.port1.onmessage=b,n=s(a.postMessage,a,1)):l.addEventListener&&"function"==typeof postMessage&&!l.importScripts?(n=function(e){l.postMessage(e+"","*")},l.addEventListener("message",b,!1)):n=g in p("script")?function(e){u.appendChild(p("script"))[g]=function(){u.removeChild(this),v.call(e)}}:function(e){setTimeout(s(v,e,1),0)}),t.exports={set:f,clear:d}},{218:218,224:224,227:227,236:236,239:239,240:240}],283:[function(e,t,r){var n=e(284),i=Math.max,a=Math.min;t.exports=function(e,t){return e=n(e),0>e?i(e+t,0):a(e,t)}},{284:284}],284:[function(e,t,r){var n=Math.ceil,i=Math.floor;t.exports=function(e){return isNaN(e=+e)?0:(e>0?i:n)(e)}},{}],285:[function(e,t,r){var n=e(241),i=e(225);t.exports=function(e){return n(i(e))}},{225:225,241:241}],286:[function(e,t,r){var n=e(284),i=Math.min;t.exports=function(e){return e>0?i(n(e),9007199254740991):0}},{284:284}],287:[function(e,t,r){var n=e(225);t.exports=function(e){return Object(n(e))}},{225:225}],288:[function(e,t,r){var n=e(245);t.exports=function(e,t){if(!n(e))return e;var r,i;if(t&&"function"==typeof(r=e.toString)&&!n(i=r.call(e)))return i;if("function"==typeof(r=e.valueOf)&&!n(i=r.call(e)))return i;if(!t&&"function"==typeof(r=e.toString)&&!n(i=r.call(e)))return i;throw TypeError("Can't convert object to primitive value")}},{245:245}],289:[function(e,t,r){var n=0,i=Math.random();t.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+i).toString(36))}},{}],290:[function(e,t,r){var n=e(274)("wks"),i=e(289),a=e(236).Symbol;t.exports=function(e){return n[e]||(n[e]=a&&a[e]||(a||i)("Symbol."+e))}},{236:236,274:274,289:289}],291:[function(e,t,r){var n=e(217),i=e(290)("iterator"),a=e(252);t.exports=e(223).getIteratorMethod=function(e){return void 0!=e?e[i]||e["@@iterator"]||a[n(e)]:void 0}},{217:217,223:223,252:252,290:290}],292:[function(e,t,r){"use strict";var n,i=e(253),a=e(229),s=e(226),o=e(266),u=e(239),p=e(227),l=e(237),c=e(218),f=e(240),d=e(231),h=e(211),m=e(209),y=e(245),g=e(287),v=e(285),b=e(284),E=e(283),x=e(286),S=e(241),A=e(289)("__proto__"),D=e(215),C=e(214)(!1),w=Object.prototype,I=Array.prototype,_=I.slice,F=I.join,k=i.setDesc,P=i.getDesc,B=i.setDescs,T={};s||(n=!d(function(){return 7!=k(p("div"),"a",{get:function(){return 7}}).a}),i.setDesc=function(e,t,r){if(n)try{return k(e,t,r)}catch(i){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(h(e)[t]=r.value),e},i.getDesc=function(e,t){if(n)try{return P(e,t)}catch(r){}return l(e,t)?o(!w.propertyIsEnumerable.call(e,t),e[t]):void 0},i.setDescs=B=function(e,t){h(e);for(var r,n=i.getKeys(t),a=n.length,s=0;a>s;)i.setDesc(e,r=n[s++],t[r]);return e}),a(a.S+a.F*!s,"Object",{getOwnPropertyDescriptor:i.getDesc,defineProperty:i.setDesc,defineProperties:B});var M="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),O=M.concat("length","prototype"),j=M.length,L=function(){var e,t=p("iframe"),r=j,n=">";for(t.style.display="none",u.appendChild(t),t.src="javascript:",e=t.contentWindow.document,e.open(),e.write("<script>document.F=Object</script"+n),e.close(),L=e.F;r--;)delete L.prototype[M[r]];return L()},N=function(e,t){return function(r){var n,i=v(r),a=0,s=[];for(n in i)n!=A&&l(i,n)&&s.push(n);for(;t>a;)l(i,n=e[a++])&&(~C(s,n)||s.push(n));return s}},R=function(){};a(a.S,"Object",{getPrototypeOf:i.getProto=i.getProto||function(e){return e=g(e),l(e,A)?e[A]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?w:null},getOwnPropertyNames:i.getNames=i.getNames||N(O,O.length,!0),create:i.create=i.create||function(e,t){var r;return null!==e?(R.prototype=h(e),r=new R,R.prototype=null,r[A]=e):r=L(),void 0===t?r:B(r,t)},keys:i.getKeys=i.getKeys||N(M,j,!1)});var V=function(e,t,r){if(!(t in T)){for(var n=[],i=0;t>i;i++)n[i]="a["+i+"]";T[t]=Function("F,a","return new F("+n.join(",")+")")}return T[t](e,r)};a(a.P,"Function",{bind:function(e){var t=m(this),r=_.call(arguments,1),n=function(){var i=r.concat(_.call(arguments));return this instanceof n?V(t,i.length,i):f(t,i,e)};return y(t.prototype)&&(n.prototype=t.prototype),n}}),a(a.P+a.F*d(function(){u&&_.call(u)}),"Array",{slice:function(e,t){var r=x(this.length),n=c(this);if(t=void 0===t?r:t,"Array"==n)return _.call(this,e,t);for(var i=E(e,r),a=E(t,r),s=x(a-i),o=Array(s),u=0;s>u;u++)o[u]="String"==n?this.charAt(i+u):this[i+u];return o}}),a(a.P+a.F*(S!=Object),"Array",{join:function(e){return F.call(S(this),void 0===e?",":e)}}),a(a.S,"Array",{isArray:e(243)});var U=function(e){return function(t,r){m(t);var n=S(this),i=x(n.length),a=e?i-1:0,s=e?-1:1;if(arguments.length<2)for(;;){if(a in n){r=n[a],a+=s;break}if(a+=s,e?0>a:a>=i)throw TypeError("Reduce of empty array with no initial value")}for(;e?a>=0:i>a;a+=s)a in n&&(r=t(r,n[a],a,this));return r}},q=function(e){return function(t){return e(this,t,arguments[1])}};a(a.P,"Array",{forEach:i.each=i.each||q(D(0)),map:q(D(1)),filter:q(D(2)),some:q(D(3)),every:q(D(4)),reduce:U(!1),reduceRight:U(!0),indexOf:q(C),lastIndexOf:function(e,t){var r=v(this),n=x(r.length),i=n-1;for(arguments.length>1&&(i=Math.min(i,b(t))),0>i&&(i=x(n+i));i>=0;i--)if(i in r&&r[i]===e)return i;return-1}}),a(a.S,"Date",{now:function(){return+new Date}});var G=function(e){return e>9?e:"0"+e};a(a.P+a.F*(d(function(){return"0385-07-25T07:06:39.999Z"!=new Date(-5e13-1).toISOString()})||!d(function(){new Date(NaN).toISOString()})),"Date",{toISOString:function(){if(!isFinite(this))throw RangeError("Invalid time value");var e=this,t=e.getUTCFullYear(),r=e.getUTCMilliseconds(),n=0>t?"-":t>9999?"+":"";return n+("00000"+Math.abs(t)).slice(n?-6:-4)+"-"+G(e.getUTCMonth()+1)+"-"+G(e.getUTCDate())+"T"+G(e.getUTCHours())+":"+G(e.getUTCMinutes())+":"+G(e.getUTCSeconds())+"."+(r>99?r:"0"+G(r))+"Z"}})},{209:209,211:211,214:214,215:215,218:218,226:226,227:227,229:229,231:231,237:237,239:239,240:240,241:241,243:243,245:245,253:253,266:266,283:283,284:284,285:285,286:286,287:287,289:289}],293:[function(e,t,r){var n=e(229);n(n.P,"Array",{copyWithin:e(212)}),e(210)("copyWithin")},{210:210,212:212,229:229}],294:[function(e,t,r){var n=e(229);n(n.P,"Array",{fill:e(213)}),e(210)("fill")},{210:210,213:213,229:229}],295:[function(e,t,r){"use strict";var n=e(229),i=e(215)(6),a="findIndex",s=!0;a in[]&&Array(1)[a](function(){s=!1}),n(n.P+n.F*s,"Array",{findIndex:function(e){return i(this,e,arguments.length>1?arguments[1]:void 0)}}),e(210)(a)},{210:210,215:215,229:229}],296:[function(e,t,r){"use strict";var n=e(229),i=e(215)(5),a="find",s=!0;a in[]&&Array(1)[a](function(){s=!1}),n(n.P+n.F*s,"Array",{find:function(e){return i(this,e,arguments.length>1?arguments[1]:void 0)}}),e(210)(a)},{210:210,215:215,229:229}],297:[function(e,t,r){"use strict";var n=e(224),i=e(229),a=e(287),s=e(247),o=e(242),u=e(286),p=e(291);i(i.S+i.F*!e(250)(function(e){Array.from(e)}),"Array",{from:function(e){var t,r,i,l,c=a(e),f="function"==typeof this?this:Array,d=arguments,h=d.length,m=h>1?d[1]:void 0,y=void 0!==m,g=0,v=p(c);if(y&&(m=n(m,h>2?d[2]:void 0,2)),void 0==v||f==Array&&o(v))for(t=u(c.length),r=new f(t);t>g;g++)r[g]=y?m(c[g],g):c[g];else for(l=v.call(c),r=new f;!(i=l.next()).done;g++)r[g]=y?s(l,m,[i.value,g],!0):i.value;return r.length=g,r}})},{224:224,229:229,242:242,247:247,250:250,286:286,287:287,291:291}],298:[function(e,t,r){"use strict";var n=e(210),i=e(251),a=e(252),s=e(285);t.exports=e(249)(Array,"Array",function(e,t){this._t=s(e),this._i=0,this._k=t},function(){var e=this._t,t=this._k,r=this._i++;return!e||r>=e.length?(this._t=void 0,i(1)):"keys"==t?i(0,r):"values"==t?i(0,e[r]):i(0,[r,e[r]])},"values"),a.Arguments=a.Array,n("keys"),n("values"),n("entries")},{210:210,249:249,251:251,252:252,285:285}],299:[function(e,t,r){"use strict";var n=e(229);n(n.S+n.F*e(231)(function(){function e(){}return!(Array.of.call(e)instanceof e)}),"Array",{of:function(){for(var e=0,t=arguments,r=t.length,n=new("function"==typeof this?this:Array)(r);r>e;)n[e]=t[e++];return n.length=r,n}})},{229:229,231:231}],300:[function(e,t,r){e(272)("Array")},{272:272}],301:[function(e,t,r){"use strict";var n=e(253),i=e(245),a=e(290)("hasInstance"),s=Function.prototype;a in s||n.setDesc(s,a,{value:function(e){if("function"!=typeof this||!i(e))return!1;if(!i(this.prototype))return e instanceof this;for(;e=n.getProto(e);)if(this.prototype===e)return!0;return!1}})},{245:245,253:253,290:290}],302:[function(e,t,r){var n=e(253).setDesc,i=e(266),a=e(237),s=Function.prototype,o=/^\s*function ([^ (]*)/,u="name";u in s||e(226)&&n(s,u,{configurable:!0,get:function(){var e=(""+this).match(o),t=e?e[1]:"";return a(this,u)||n(this,u,i(5,t)),t}})},{226:226,237:237,253:253,266:266}],303:[function(e,t,r){"use strict";var n=e(219);e(222)("Map",function(e){return function(){return e(this,arguments.length>0?arguments[0]:void 0)}},{get:function(e){var t=n.getEntry(this,e);return t&&t.v},set:function(e,t){return n.def(this,0===e?0:e,t)}},n,!0)},{219:219,222:222}],304:[function(e,t,r){var n=e(229),i=e(257),a=Math.sqrt,s=Math.acosh;n(n.S+n.F*!(s&&710==Math.floor(s(Number.MAX_VALUE))),"Math",{acosh:function(e){return(e=+e)<1?NaN:e>94906265.62425156?Math.log(e)+Math.LN2:i(e-1+a(e-1)*a(e+1))}})},{229:229,257:257}],305:[function(e,t,r){function n(e){return isFinite(e=+e)&&0!=e?0>e?-n(-e):Math.log(e+Math.sqrt(e*e+1)):e}var i=e(229);i(i.S,"Math",{asinh:n})},{229:229}],306:[function(e,t,r){var n=e(229);n(n.S,"Math",{atanh:function(e){return 0==(e=+e)?e:Math.log((1+e)/(1-e))/2}})},{229:229}],307:[function(e,t,r){var n=e(229),i=e(258);n(n.S,"Math",{cbrt:function(e){return i(e=+e)*Math.pow(Math.abs(e),1/3)}})},{229:229,258:258}],308:[function(e,t,r){var n=e(229);n(n.S,"Math",{clz32:function(e){return(e>>>=0)?31-Math.floor(Math.log(e+.5)*Math.LOG2E):32}})},{229:229}],309:[function(e,t,r){var n=e(229),i=Math.exp;n(n.S,"Math",{cosh:function(e){return(i(e=+e)+i(-e))/2}})},{229:229}],310:[function(e,t,r){var n=e(229);n(n.S,"Math",{expm1:e(256)})},{229:229,256:256}],311:[function(e,t,r){var n=e(229),i=e(258),a=Math.pow,s=a(2,-52),o=a(2,-23),u=a(2,127)*(2-o),p=a(2,-126),l=function(e){return e+1/s-1/s};n(n.S,"Math",{fround:function(e){var t,r,n=Math.abs(e),a=i(e);return p>n?a*l(n/p/o)*p*o:(t=(1+o/s)*n,r=t-(t-n),r>u||r!=r?a*(1/0):a*r)}})},{229:229,258:258}],312:[function(e,t,r){var n=e(229),i=Math.abs;n(n.S,"Math",{hypot:function(e,t){for(var r,n,a=0,s=0,o=arguments,u=o.length,p=0;u>s;)r=i(o[s++]),r>p?(n=p/r,a=a*n*n+1,p=r):r>0?(n=r/p,a+=n*n):a+=r;return p===1/0?1/0:p*Math.sqrt(a)}})},{229:229}],313:[function(e,t,r){var n=e(229),i=Math.imul;n(n.S+n.F*e(231)(function(){return-5!=i(4294967295,5)||2!=i.length}),"Math",{imul:function(e,t){var r=65535,n=+e,i=+t,a=r&n,s=r&i;return 0|a*s+((r&n>>>16)*s+a*(r&i>>>16)<<16>>>0)}})},{229:229,231:231}],314:[function(e,t,r){var n=e(229);n(n.S,"Math",{log10:function(e){return Math.log(e)/Math.LN10}})},{229:229}],315:[function(e,t,r){var n=e(229);n(n.S,"Math",{log1p:e(257)})},{229:229,257:257}],316:[function(e,t,r){var n=e(229);n(n.S,"Math",{log2:function(e){return Math.log(e)/Math.LN2}})},{229:229}],317:[function(e,t,r){var n=e(229);n(n.S,"Math",{sign:e(258)})},{229:229,258:258}],318:[function(e,t,r){var n=e(229),i=e(256),a=Math.exp;n(n.S+n.F*e(231)(function(){return-2e-17!=!Math.sinh(-2e-17)}),"Math",{sinh:function(e){return Math.abs(e=+e)<1?(i(e)-i(-e))/2:(a(e-1)-a(-e-1))*(Math.E/2)}})},{229:229,231:231,256:256}],319:[function(e,t,r){var n=e(229),i=e(256),a=Math.exp;n(n.S,"Math",{tanh:function(e){var t=i(e=+e),r=i(-e);return t==1/0?1:r==1/0?-1:(t-r)/(a(e)+a(-e))}})},{229:229,256:256}],320:[function(e,t,r){var n=e(229);n(n.S,"Math",{trunc:function(e){return(e>0?Math.floor:Math.ceil)(e)}})},{229:229}],321:[function(e,t,r){"use strict";var n=e(253),i=e(236),a=e(237),s=e(218),o=e(288),u=e(231),p=e(281).trim,l="Number",c=i[l],f=c,d=c.prototype,h=s(n.create(d))==l,m="trim"in String.prototype,y=function(e){var t=o(e,!1);if("string"==typeof t&&t.length>2){t=m?t.trim():p(t,3);var r,n,i,a=t.charCodeAt(0);if(43===a||45===a){if(r=t.charCodeAt(2),88===r||120===r)return NaN}else if(48===a){switch(t.charCodeAt(1)){case 66:case 98:n=2,i=49;break;case 79:case 111:n=8,i=55;break;default:return+t}for(var s,u=t.slice(2),l=0,c=u.length;c>l;l++)if(s=u.charCodeAt(l),48>s||s>i)return NaN;return parseInt(u,n)}}return+t};c(" 0o1")&&c("0b1")&&!c("+0x1")||(c=function(e){var t=arguments.length<1?0:e,r=this;return r instanceof c&&(h?u(function(){d.valueOf.call(r)}):s(r)!=l)?new f(y(t)):y(t)},n.each.call(e(226)?n.getNames(f):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","),function(e){a(f,e)&&!a(c,e)&&n.setDesc(c,e,n.getDesc(f,e))}),c.prototype=d,d.constructor=c,e(268)(i,l,c))},{218:218,226:226,231:231,236:236,237:237,253:253,268:268,281:281,288:288}],322:[function(e,t,r){var n=e(229);n(n.S,"Number",{EPSILON:Math.pow(2,-52)})},{229:229}],323:[function(e,t,r){var n=e(229),i=e(236).isFinite;n(n.S,"Number",{isFinite:function(e){return"number"==typeof e&&i(e)}})},{229:229,236:236}],324:[function(e,t,r){var n=e(229);n(n.S,"Number",{isInteger:e(244)})},{229:229,244:244}],325:[function(e,t,r){var n=e(229);n(n.S,"Number",{isNaN:function(e){return e!=e}})},{229:229}],326:[function(e,t,r){var n=e(229),i=e(244),a=Math.abs;n(n.S,"Number",{isSafeInteger:function(e){return i(e)&&a(e)<=9007199254740991}})},{229:229,244:244}],327:[function(e,t,r){var n=e(229);n(n.S,"Number",{MAX_SAFE_INTEGER:9007199254740991})},{229:229}],328:[function(e,t,r){var n=e(229);n(n.S,"Number",{MIN_SAFE_INTEGER:-9007199254740991})},{229:229}],329:[function(e,t,r){var n=e(229);n(n.S,"Number",{parseFloat:parseFloat})},{229:229}],330:[function(e,t,r){var n=e(229);n(n.S,"Number",{parseInt:parseInt})},{229:229}],331:[function(e,t,r){var n=e(229);n(n.S+n.F,"Object",{assign:e(260)})},{229:229,260:260}],332:[function(e,t,r){var n=e(245);e(261)("freeze",function(e){return function(t){return e&&n(t)?e(t):t}})},{245:245,261:261}],333:[function(e,t,r){var n=e(285);e(261)("getOwnPropertyDescriptor",function(e){return function(t,r){return e(n(t),r)}})},{261:261,285:285}],334:[function(e,t,r){e(261)("getOwnPropertyNames",function(){return e(235).get})},{235:235,261:261}],335:[function(e,t,r){var n=e(287);e(261)("getPrototypeOf",function(e){return function(t){return e(n(t))}})},{261:261,287:287}],336:[function(e,t,r){var n=e(245);e(261)("isExtensible",function(e){return function(t){return n(t)?e?e(t):!0:!1}})},{245:245,261:261}],337:[function(e,t,r){var n=e(245);e(261)("isFrozen",function(e){return function(t){return n(t)?e?e(t):!1:!0}})},{245:245,261:261}],338:[function(e,t,r){var n=e(245);e(261)("isSealed",function(e){return function(t){return n(t)?e?e(t):!1:!0}})},{245:245,261:261}],339:[function(e,t,r){var n=e(229);n(n.S,"Object",{is:e(270)})},{229:229,270:270}],340:[function(e,t,r){var n=e(287);e(261)("keys",function(e){return function(t){return e(n(t))}})},{261:261,287:287}],341:[function(e,t,r){var n=e(245);e(261)("preventExtensions",function(e){return function(t){return e&&n(t)?e(t):t}})},{245:245,261:261}],342:[function(e,t,r){var n=e(245);e(261)("seal",function(e){return function(t){return e&&n(t)?e(t):t}})},{245:245,261:261}],343:[function(e,t,r){var n=e(229);n(n.S,"Object",{setPrototypeOf:e(271).set})},{229:229,271:271}],344:[function(e,t,r){"use strict";var n=e(217),i={};i[e(290)("toStringTag")]="z",i+""!="[object z]"&&e(268)(Object.prototype,"toString",function(){return"[object "+n(this)+"]"},!0)},{217:217,268:268,290:290}],345:[function(e,t,r){"use strict";var n,i=e(253),a=e(255),s=e(236),o=e(224),u=e(217),p=e(229),l=e(245),c=e(211),f=e(209),d=e(276),h=e(234),m=e(271).set,y=e(270),g=e(290)("species"),v=e(275),b=e(259),E="Promise",x=s.process,S="process"==u(x),A=s[E],D=function(e){
var t=new A(function(){});return e&&(t.constructor=Object),A.resolve(t)===t},C=function(){function t(e){var r=new A(e);return m(r,t.prototype),r}var r=!1;try{if(r=A&&A.resolve&&D(),m(t,A),t.prototype=i.create(A.prototype,{constructor:{value:t}}),t.resolve(5).then(function(){})instanceof t||(r=!1),r&&e(226)){var n=!1;A.resolve(i.setDesc({},"then",{get:function(){n=!0}})),r=n}}catch(a){r=!1}return r}(),w=function(e,t){return a&&e===A&&t===n?!0:y(e,t)},I=function(e){var t=c(e)[g];return void 0!=t?t:e},_=function(e){var t;return l(e)&&"function"==typeof(t=e.then)?t:!1},F=function(e){var t,r;this.promise=new e(function(e,n){if(void 0!==t||void 0!==r)throw TypeError("Bad Promise constructor");t=e,r=n}),this.resolve=f(t),this.reject=f(r)},k=function(e){try{e()}catch(t){return{error:t}}},P=function(e,t){if(!e.n){e.n=!0;var r=e.c;b(function(){for(var n=e.v,i=1==e.s,a=0,o=function(t){var r,a,s=i?t.ok:t.fail,o=t.resolve,u=t.reject;try{s?(i||(e.h=!0),r=s===!0?n:s(n),r===t.promise?u(TypeError("Promise-chain cycle")):(a=_(r))?a.call(r,o,u):o(r)):u(n)}catch(p){u(p)}};r.length>a;)o(r[a++]);r.length=0,e.n=!1,t&&setTimeout(function(){var t,r,i=e.p;B(i)&&(S?x.emit("unhandledRejection",n,i):(t=s.onunhandledrejection)?t({promise:i,reason:n}):(r=s.console)&&r.error&&r.error("Unhandled promise rejection",n)),e.a=void 0},1)})}},B=function(e){var t,r=e._d,n=r.a||r.c,i=0;if(r.h)return!1;for(;n.length>i;)if(t=n[i++],t.fail||!B(t.promise))return!1;return!0},T=function(e){var t=this;t.d||(t.d=!0,t=t.r||t,t.v=e,t.s=2,t.a=t.c.slice(),P(t,!0))},M=function(e){var t,r=this;if(!r.d){r.d=!0,r=r.r||r;try{if(r.p===e)throw TypeError("Promise can't be resolved itself");(t=_(e))?b(function(){var n={r:r,d:!1};try{t.call(e,o(M,n,1),o(T,n,1))}catch(i){T.call(n,i)}}):(r.v=e,r.s=1,P(r,!1))}catch(n){T.call({r:r,d:!1},n)}}};C||(A=function(e){f(e);var t=this._d={p:d(this,A,E),c:[],a:void 0,s:0,d:!1,v:void 0,h:!1,n:!1};try{e(o(M,t,1),o(T,t,1))}catch(r){T.call(t,r)}},e(267)(A.prototype,{then:function(e,t){var r=new F(v(this,A)),n=r.promise,i=this._d;return r.ok="function"==typeof e?e:!0,r.fail="function"==typeof t&&t,i.c.push(r),i.a&&i.a.push(r),i.s&&P(i,!1),n},"catch":function(e){return this.then(void 0,e)}})),p(p.G+p.W+p.F*!C,{Promise:A}),e(273)(A,E),e(272)(E),n=e(223)[E],p(p.S+p.F*!C,E,{reject:function(e){var t=new F(this),r=t.reject;return r(e),t.promise}}),p(p.S+p.F*(!C||D(!0)),E,{resolve:function(e){if(e instanceof A&&w(e.constructor,this))return e;var t=new F(this),r=t.resolve;return r(e),t.promise}}),p(p.S+p.F*!(C&&e(250)(function(e){A.all(e)["catch"](function(){})})),E,{all:function(e){var t=I(this),r=new F(t),n=r.resolve,a=r.reject,s=[],o=k(function(){h(e,!1,s.push,s);var r=s.length,o=Array(r);r?i.each.call(s,function(e,i){var s=!1;t.resolve(e).then(function(e){s||(s=!0,o[i]=e,--r||n(o))},a)}):n(o)});return o&&a(o.error),r.promise},race:function(e){var t=I(this),r=new F(t),n=r.reject,i=k(function(){h(e,!1,function(e){t.resolve(e).then(r.resolve,n)})});return i&&n(i.error),r.promise}})},{209:209,211:211,217:217,223:223,224:224,226:226,229:229,234:234,236:236,245:245,250:250,253:253,255:255,259:259,267:267,270:270,271:271,272:272,273:273,275:275,276:276,290:290}],346:[function(e,t,r){var n=e(229),i=Function.apply;n(n.S,"Reflect",{apply:function(e,t,r){return i.call(e,t,r)}})},{229:229}],347:[function(e,t,r){var n=e(253),i=e(229),a=e(209),s=e(211),o=e(245),u=Function.bind||e(223).Function.prototype.bind;i(i.S+i.F*e(231)(function(){function e(){}return!(Reflect.construct(function(){},[],e)instanceof e)}),"Reflect",{construct:function(e,t){a(e);var r=arguments.length<3?e:a(arguments[2]);if(e==r){if(void 0!=t)switch(s(t).length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3])}var i=[null];return i.push.apply(i,t),new(u.apply(e,i))}var p=r.prototype,l=n.create(o(p)?p:Object.prototype),c=Function.apply.call(e,l,t);return o(c)?c:l}})},{209:209,211:211,223:223,229:229,231:231,245:245,253:253}],348:[function(e,t,r){var n=e(253),i=e(229),a=e(211);i(i.S+i.F*e(231)(function(){Reflect.defineProperty(n.setDesc({},1,{value:1}),1,{value:2})}),"Reflect",{defineProperty:function(e,t,r){a(e);try{return n.setDesc(e,t,r),!0}catch(i){return!1}}})},{211:211,229:229,231:231,253:253}],349:[function(e,t,r){var n=e(229),i=e(253).getDesc,a=e(211);n(n.S,"Reflect",{deleteProperty:function(e,t){var r=i(a(e),t);return r&&!r.configurable?!1:delete e[t]}})},{211:211,229:229,253:253}],350:[function(e,t,r){"use strict";var n=e(229),i=e(211),a=function(e){this._t=i(e),this._i=0;var t,r=this._k=[];for(t in e)r.push(t)};e(248)(a,"Object",function(){var e,t=this,r=t._k;do if(t._i>=r.length)return{value:void 0,done:!0};while(!((e=r[t._i++])in t._t));return{value:e,done:!1}}),n(n.S,"Reflect",{enumerate:function(e){return new a(e)}})},{211:211,229:229,248:248}],351:[function(e,t,r){var n=e(253),i=e(229),a=e(211);i(i.S,"Reflect",{getOwnPropertyDescriptor:function(e,t){return n.getDesc(a(e),t)}})},{211:211,229:229,253:253}],352:[function(e,t,r){var n=e(229),i=e(253).getProto,a=e(211);n(n.S,"Reflect",{getPrototypeOf:function(e){return i(a(e))}})},{211:211,229:229,253:253}],353:[function(e,t,r){function n(e,t){var r,s,p=arguments.length<3?e:arguments[2];return u(e)===p?e[t]:(r=i.getDesc(e,t))?a(r,"value")?r.value:void 0!==r.get?r.get.call(p):void 0:o(s=i.getProto(e))?n(s,t,p):void 0}var i=e(253),a=e(237),s=e(229),o=e(245),u=e(211);s(s.S,"Reflect",{get:n})},{211:211,229:229,237:237,245:245,253:253}],354:[function(e,t,r){var n=e(229);n(n.S,"Reflect",{has:function(e,t){return t in e}})},{229:229}],355:[function(e,t,r){var n=e(229),i=e(211),a=Object.isExtensible;n(n.S,"Reflect",{isExtensible:function(e){return i(e),a?a(e):!0}})},{211:211,229:229}],356:[function(e,t,r){var n=e(229);n(n.S,"Reflect",{ownKeys:e(263)})},{229:229,263:263}],357:[function(e,t,r){var n=e(229),i=e(211),a=Object.preventExtensions;n(n.S,"Reflect",{preventExtensions:function(e){i(e);try{return a&&a(e),!0}catch(t){return!1}}})},{211:211,229:229}],358:[function(e,t,r){var n=e(229),i=e(271);i&&n(n.S,"Reflect",{setPrototypeOf:function(e,t){i.check(e,t);try{return i.set(e,t),!0}catch(r){return!1}}})},{229:229,271:271}],359:[function(e,t,r){function n(e,t,r){var s,l,c=arguments.length<4?e:arguments[3],f=i.getDesc(u(e),t);if(!f){if(p(l=i.getProto(e)))return n(l,t,r,c);f=o(0)}return a(f,"value")?f.writable!==!1&&p(c)?(s=i.getDesc(c,t)||o(0),s.value=r,i.setDesc(c,t,s),!0):!1:void 0===f.set?!1:(f.set.call(c,r),!0)}var i=e(253),a=e(237),s=e(229),o=e(266),u=e(211),p=e(245);s(s.S,"Reflect",{set:n})},{211:211,229:229,237:237,245:245,253:253,266:266}],360:[function(e,t,r){var n=e(253),i=e(236),a=e(246),s=e(233),o=i.RegExp,u=o,p=o.prototype,l=/a/g,c=/a/g,f=new o(l)!==l;!e(226)||f&&!e(231)(function(){return c[e(290)("match")]=!1,o(l)!=l||o(c)==c||"/a/i"!=o(l,"i")})||(o=function(e,t){var r=a(e),n=void 0===t;return this instanceof o||!r||e.constructor!==o||!n?f?new u(r&&!n?e.source:e,t):u((r=e instanceof o)?e.source:e,r&&n?s.call(e):t):e},n.each.call(n.getNames(u),function(e){e in o||n.setDesc(o,e,{configurable:!0,get:function(){return u[e]},set:function(t){u[e]=t}})}),p.constructor=o,o.prototype=p,e(268)(i,"RegExp",o)),e(272)("RegExp")},{226:226,231:231,233:233,236:236,246:246,253:253,268:268,272:272,290:290}],361:[function(e,t,r){var n=e(253);e(226)&&"g"!=/./g.flags&&n.setDesc(RegExp.prototype,"flags",{configurable:!0,get:e(233)})},{226:226,233:233,253:253}],362:[function(e,t,r){e(232)("match",1,function(e,t){return function(r){"use strict";var n=e(this),i=void 0==r?void 0:r[t];return void 0!==i?i.call(r,n):new RegExp(r)[t](String(n))}})},{232:232}],363:[function(e,t,r){e(232)("replace",2,function(e,t,r){return function(n,i){"use strict";var a=e(this),s=void 0==n?void 0:n[t];return void 0!==s?s.call(n,a,i):r.call(String(a),n,i)}})},{232:232}],364:[function(e,t,r){e(232)("search",1,function(e,t){return function(r){"use strict";var n=e(this),i=void 0==r?void 0:r[t];return void 0!==i?i.call(r,n):new RegExp(r)[t](String(n))}})},{232:232}],365:[function(e,t,r){e(232)("split",2,function(e,t,r){return function(n,i){"use strict";var a=e(this),s=void 0==n?void 0:n[t];return void 0!==s?s.call(n,a,i):r.call(String(a),n,i)}})},{232:232}],366:[function(e,t,r){"use strict";var n=e(219);e(222)("Set",function(e){return function(){return e(this,arguments.length>0?arguments[0]:void 0)}},{add:function(e){return n.def(this,e=0===e?0:e,e)}},n)},{219:219,222:222}],367:[function(e,t,r){"use strict";var n=e(229),i=e(277)(!1);n(n.P,"String",{codePointAt:function(e){return i(this,e)}})},{229:229,277:277}],368:[function(e,t,r){"use strict";var n=e(229),i=e(286),a=e(278),s="endsWith",o=""[s];n(n.P+n.F*e(230)(s),"String",{endsWith:function(e){var t=a(this,e,s),r=arguments,n=r.length>1?r[1]:void 0,u=i(t.length),p=void 0===n?u:Math.min(i(n),u),l=String(e);return o?o.call(t,l,p):t.slice(p-l.length,p)===l}})},{229:229,230:230,278:278,286:286}],369:[function(e,t,r){var n=e(229),i=e(283),a=String.fromCharCode,s=String.fromCodePoint;n(n.S+n.F*(!!s&&1!=s.length),"String",{fromCodePoint:function(e){for(var t,r=[],n=arguments,s=n.length,o=0;s>o;){if(t=+n[o++],i(t,1114111)!==t)throw RangeError(t+" is not a valid code point");r.push(65536>t?a(t):a(((t-=65536)>>10)+55296,t%1024+56320))}return r.join("")}})},{229:229,283:283}],370:[function(e,t,r){"use strict";var n=e(229),i=e(278),a="includes";n(n.P+n.F*e(230)(a),"String",{includes:function(e){return!!~i(this,e,a).indexOf(e,arguments.length>1?arguments[1]:void 0)}})},{229:229,230:230,278:278}],371:[function(e,t,r){"use strict";var n=e(277)(!0);e(249)(String,"String",function(e){this._t=String(e),this._i=0},function(){var e,t=this._t,r=this._i;return r>=t.length?{value:void 0,done:!0}:(e=n(t,r),this._i+=e.length,{value:e,done:!1})})},{249:249,277:277}],372:[function(e,t,r){var n=e(229),i=e(285),a=e(286);n(n.S,"String",{raw:function(e){for(var t=i(e.raw),r=a(t.length),n=arguments,s=n.length,o=[],u=0;r>u;)o.push(String(t[u++])),s>u&&o.push(String(n[u]));return o.join("")}})},{229:229,285:285,286:286}],373:[function(e,t,r){var n=e(229);n(n.P,"String",{repeat:e(280)})},{229:229,280:280}],374:[function(e,t,r){"use strict";var n=e(229),i=e(286),a=e(278),s="startsWith",o=""[s];n(n.P+n.F*e(230)(s),"String",{startsWith:function(e){var t=a(this,e,s),r=arguments,n=i(Math.min(r.length>1?r[1]:void 0,t.length)),u=String(e);return o?o.call(t,u,n):t.slice(n,n+u.length)===u}})},{229:229,230:230,278:278,286:286}],375:[function(e,t,r){"use strict";e(281)("trim",function(e){return function(){return e(this,3)}})},{281:281}],376:[function(e,t,r){"use strict";var n=e(253),i=e(236),a=e(237),s=e(226),o=e(229),u=e(268),p=e(231),l=e(274),c=e(273),f=e(289),d=e(290),h=e(254),m=e(235),y=e(228),g=e(243),v=e(211),b=e(285),E=e(266),x=n.getDesc,S=n.setDesc,A=n.create,D=m.get,C=i.Symbol,w=i.JSON,I=w&&w.stringify,_=!1,F=d("_hidden"),k=n.isEnum,P=l("symbol-registry"),B=l("symbols"),T="function"==typeof C,M=Object.prototype,O=s&&p(function(){return 7!=A(S({},"a",{get:function(){return S(this,"a",{value:7}).a}})).a})?function(e,t,r){var n=x(M,t);n&&delete M[t],S(e,t,r),n&&e!==M&&S(M,t,n)}:S,j=function(e){var t=B[e]=A(C.prototype);return t._k=e,s&&_&&O(M,e,{configurable:!0,set:function(t){a(this,F)&&a(this[F],e)&&(this[F][e]=!1),O(this,e,E(1,t))}}),t},L=function(e){return"symbol"==typeof e},N=function(e,t,r){return r&&a(B,t)?(r.enumerable?(a(e,F)&&e[F][t]&&(e[F][t]=!1),r=A(r,{enumerable:E(0,!1)})):(a(e,F)||S(e,F,E(1,{})),e[F][t]=!0),O(e,t,r)):S(e,t,r)},R=function(e,t){v(e);for(var r,n=y(t=b(t)),i=0,a=n.length;a>i;)N(e,r=n[i++],t[r]);return e},V=function(e,t){return void 0===t?A(e):R(A(e),t)},U=function(e){var t=k.call(this,e);return t||!a(this,e)||!a(B,e)||a(this,F)&&this[F][e]?t:!0},q=function(e,t){var r=x(e=b(e),t);return!r||!a(B,t)||a(e,F)&&e[F][t]||(r.enumerable=!0),r},G=function(e){for(var t,r=D(b(e)),n=[],i=0;r.length>i;)a(B,t=r[i++])||t==F||n.push(t);return n},H=function(e){for(var t,r=D(b(e)),n=[],i=0;r.length>i;)a(B,t=r[i++])&&n.push(B[t]);return n},W=function(e){if(void 0!==e&&!L(e)){for(var t,r,n=[e],i=1,a=arguments;a.length>i;)n.push(a[i++]);return t=n[1],"function"==typeof t&&(r=t),(r||!g(t))&&(t=function(e,t){return r&&(t=r.call(this,e,t)),L(t)?void 0:t}),n[1]=t,I.apply(w,n)}},X=p(function(){var e=C();return"[null]"!=I([e])||"{}"!=I({a:e})||"{}"!=I(Object(e))});T||(C=function(){if(L(this))throw TypeError("Symbol is not a constructor");return j(f(arguments.length>0?arguments[0]:void 0))},u(C.prototype,"toString",function(){return this._k}),L=function(e){return e instanceof C},n.create=V,n.isEnum=U,n.getDesc=q,n.setDesc=N,n.setDescs=R,n.getNames=m.get=G,n.getSymbols=H,s&&!e(255)&&u(M,"propertyIsEnumerable",U,!0));var Y={"for":function(e){return a(P,e+="")?P[e]:P[e]=C(e)},keyFor:function(e){return h(P,e)},useSetter:function(){_=!0},useSimple:function(){_=!1}};n.each.call("hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),function(e){var t=d(e);Y[e]=T?t:j(t)}),_=!0,o(o.G+o.W,{Symbol:C}),o(o.S,"Symbol",Y),o(o.S+o.F*!T,"Object",{create:V,defineProperty:N,defineProperties:R,getOwnPropertyDescriptor:q,getOwnPropertyNames:G,getOwnPropertySymbols:H}),w&&o(o.S+o.F*(!T||X),"JSON",{stringify:W}),c(C,"Symbol"),c(Math,"Math",!0),c(i.JSON,"JSON",!0)},{211:211,226:226,228:228,229:229,231:231,235:235,236:236,237:237,243:243,253:253,254:254,255:255,266:266,268:268,273:273,274:274,285:285,289:289,290:290}],377:[function(e,t,r){"use strict";var n=e(253),i=e(268),a=e(221),s=e(245),o=e(237),u=a.frozenStore,p=a.WEAK,l=Object.isExtensible||s,c={},f=e(222)("WeakMap",function(e){return function(){return e(this,arguments.length>0?arguments[0]:void 0)}},{get:function(e){if(s(e)){if(!l(e))return u(this).get(e);if(o(e,p))return e[p][this._i]}},set:function(e,t){return a.def(this,e,t)}},a,!0,!0);7!=(new f).set((Object.freeze||Object)(c),7).get(c)&&n.each.call(["delete","has","get","set"],function(e){var t=f.prototype,r=t[e];i(t,e,function(t,n){if(s(t)&&!l(t)){var i=u(this)[e](t,n);return"set"==e?this:i}return r.call(this,t,n)})})},{221:221,222:222,237:237,245:245,253:253,268:268}],378:[function(e,t,r){"use strict";var n=e(221);e(222)("WeakSet",function(e){return function(){return e(this,arguments.length>0?arguments[0]:void 0)}},{add:function(e){return n.def(this,e,!0)}},n,!1,!0)},{221:221,222:222}],379:[function(e,t,r){"use strict";var n=e(229),i=e(214)(!0);n(n.P,"Array",{includes:function(e){return i(this,e,arguments.length>1?arguments[1]:void 0)}}),e(210)("includes")},{210:210,214:214,229:229}],380:[function(e,t,r){var n=e(229);n(n.P,"Map",{toJSON:e(220)("Map")})},{220:220,229:229}],381:[function(e,t,r){var n=e(229),i=e(262)(!0);n(n.S,"Object",{entries:function(e){return i(e)}})},{229:229,262:262}],382:[function(e,t,r){var n=e(253),i=e(229),a=e(263),s=e(285),o=e(266);i(i.S,"Object",{getOwnPropertyDescriptors:function(e){for(var t,r,i=s(e),u=n.setDesc,p=n.getDesc,l=a(i),c={},f=0;l.length>f;)r=p(i,t=l[f++]),t in c?u(c,t,o(0,r)):c[t]=r;return c}})},{229:229,253:253,263:263,266:266,285:285}],383:[function(e,t,r){var n=e(229),i=e(262)(!1);n(n.S,"Object",{values:function(e){return i(e)}})},{229:229,262:262}],384:[function(e,t,r){var n=e(229),i=e(269)(/[\\^$*+?.()|[\]{}]/g,"\\$&");n(n.S,"RegExp",{escape:function(e){return i(e)}})},{229:229,269:269}],385:[function(e,t,r){var n=e(229);n(n.P,"Set",{toJSON:e(220)("Set")})},{220:220,229:229}],386:[function(e,t,r){"use strict";var n=e(229),i=e(277)(!0);n(n.P,"String",{at:function(e){return i(this,e)}})},{229:229,277:277}],387:[function(e,t,r){"use strict";var n=e(229),i=e(279);n(n.P,"String",{padLeft:function(e){return i(this,e,arguments.length>1?arguments[1]:void 0,!0)}})},{229:229,279:279}],388:[function(e,t,r){"use strict";var n=e(229),i=e(279);n(n.P,"String",{padRight:function(e){return i(this,e,arguments.length>1?arguments[1]:void 0,!1)}})},{229:229,279:279}],389:[function(e,t,r){"use strict";e(281)("trimLeft",function(e){return function(){return e(this,1)}})},{281:281}],390:[function(e,t,r){"use strict";e(281)("trimRight",function(e){return function(){return e(this,2)}})},{281:281}],391:[function(e,t,r){var n=e(253),i=e(229),a=e(224),s=e(223).Array||Array,o={},u=function(e,t){n.each.call(e.split(","),function(e){void 0==t&&e in s?o[e]=s[e]:e in[]&&(o[e]=a(Function.call,[][e],t))})};u("pop,reverse,shift,keys,values,entries",1),u("indexOf,every,some,forEach,map,filter,find,findIndex,includes",3),u("join,slice,concat,push,splice,unshift,sort,lastIndexOf,reduce,reduceRight,copyWithin,fill"),i(i.S,"Array",o)},{223:223,224:224,229:229,253:253}],392:[function(e,t,r){e(298);var n=e(236),i=e(238),a=e(252),s=e(290)("iterator"),o=n.NodeList,u=n.HTMLCollection,p=o&&o.prototype,l=u&&u.prototype,c=a.NodeList=a.HTMLCollection=a.Array;p&&!p[s]&&i(p,s,c),l&&!l[s]&&i(l,s,c)},{236:236,238:238,252:252,290:290,298:298}],393:[function(e,t,r){var n=e(229),i=e(282);n(n.G+n.B,{setImmediate:i.set,clearImmediate:i.clear})},{229:229,282:282}],394:[function(e,t,r){var n=e(236),i=e(229),a=e(240),s=e(264),o=n.navigator,u=!!o&&/MSIE .\./.test(o.userAgent),p=function(e){return u?function(t,r){return e(a(s,[].slice.call(arguments,2),"function"==typeof t?t:Function(t)),r)}:e};i(i.G+i.B+i.F*u,{setTimeout:p(n.setTimeout),setInterval:p(n.setInterval)})},{229:229,236:236,240:240,264:264}],395:[function(e,t,r){e(292),e(376),e(331),e(339),e(343),e(344),e(332),e(342),e(341),e(337),e(338),e(336),e(333),e(335),e(340),e(334),e(302),e(301),e(321),e(322),e(323),e(324),e(325),e(326),e(327),e(328),e(329),e(330),e(304),e(305),e(306),e(307),e(308),e(309),e(310),e(311),e(312),e(313),e(314),e(315),e(316),e(317),e(318),e(319),e(320),e(369),e(372),e(375),e(371),e(367),e(368),e(370),e(373),e(374),e(297),e(299),e(298),e(300),e(293),e(294),e(296),e(295),e(360),e(361),e(362),e(363),e(364),e(365),e(345),e(303),e(366),e(377),e(378),e(346),e(347),e(348),e(349),e(350),e(353),e(351),e(352),e(354),e(355),e(356),e(357),e(359),e(358),e(379),e(386),e(387),e(388),e(389),e(390),e(384),e(382),e(383),e(381),e(380),e(385),e(391),e(394),e(393),e(392),t.exports=e(223)},{223:223,292:292,293:293,294:294,295:295,296:296,297:297,298:298,299:299,300:300,301:301,302:302,303:303,304:304,305:305,306:306,307:307,308:308,309:309,310:310,311:311,312:312,313:313,314:314,315:315,316:316,317:317,318:318,319:319,320:320,321:321,322:322,323:323,324:324,325:325,326:326,327:327,328:328,329:329,330:330,331:331,332:332,333:333,334:334,335:335,336:336,337:337,338:338,339:339,340:340,341:341,342:342,343:343,344:344,345:345,346:346,347:347,348:348,349:349,350:350,351:351,352:352,353:353,354:354,355:355,356:356,357:357,358:358,359:359,360:360,361:361,362:362,363:363,364:364,365:365,366:366,367:367,368:368,369:369,370:370,371:371,372:372,373:373,374:374,375:375,376:376,377:377,378:378,379:379,380:380,381:381,382:382,383:383,384:384,385:385,386:386,387:387,388:388,389:389,390:390,391:391,392:392,393:393,394:394}],396:[function(e,t,r){function n(){return r.colors[l++%r.colors.length]}function i(e){function t(){}function i(){var e=i,t=+new Date,a=t-(p||t);e.diff=a,e.prev=p,e.curr=t,p=t,null==e.useColors&&(e.useColors=r.useColors()),null==e.color&&e.useColors&&(e.color=n());var s=Array.prototype.slice.call(arguments);s[0]=r.coerce(s[0]),"string"!=typeof s[0]&&(s=["%o"].concat(s));var o=0;s[0]=s[0].replace(/%([a-z%])/g,function(t,n){if("%%"===t)return t;o++;var i=r.formatters[n];if("function"==typeof i){var a=s[o];t=i.call(e,a),s.splice(o,1),o--}return t}),"function"==typeof r.formatArgs&&(s=r.formatArgs.apply(e,s));var u=i.log||r.log||console.log.bind(console);u.apply(e,s)}t.enabled=!1,i.enabled=!0;var a=r.enabled(e)?i:t;return a.namespace=e,a}function a(e){r.save(e);for(var t=(e||"").split(/[\s,]+/),n=t.length,i=0;n>i;i++)t[i]&&(e=t[i].replace(/\*/g,".*?"),"-"===e[0]?r.skips.push(new RegExp("^"+e.substr(1)+"$")):r.names.push(new RegExp("^"+e+"$")))}function s(){r.enable("")}function o(e){var t,n;for(t=0,n=r.skips.length;n>t;t++)if(r.skips[t].test(e))return!1;for(t=0,n=r.names.length;n>t;t++)if(r.names[t].test(e))return!0;return!1}function u(e){return e instanceof Error?e.stack||e.message:e}r=t.exports=i,r.coerce=u,r.disable=s,r.enable=a,r.enabled=o,r.humanize=e(398),r.names=[],r.skips=[],r.formatters={};var p,l=0},{398:398}],397:[function(e,t,r){(function(n){function i(){var e=(n.env.DEBUG_COLORS||"").trim().toLowerCase();return 0===e.length?l.isatty(f):"0"!==e&&"no"!==e&&"false"!==e&&"disabled"!==e}function a(){var e=arguments,t=this.useColors,n=this.namespace;if(t){var i=this.color;e[0]=" [3"+i+";1m"+n+" [0m"+e[0]+"[3"+i+"m +"+r.humanize(this.diff)+"[0m"}else e[0]=(new Date).toUTCString()+" "+n+" "+e[0];return e}function s(){return d.write(c.format.apply(this,arguments)+"\n")}function o(e){null==e?delete n.env.DEBUG:n.env.DEBUG=e}function u(){return n.env.DEBUG}function p(t){var r,i=n.binding("tty_wrap");switch(i.guessHandleType(t)){case"TTY":r=new l.WriteStream(t),r._type="tty",r._handle&&r._handle.unref&&r._handle.unref();break;case"FILE":var a=e(3);r=new a.SyncWriteStream(t,{autoClose:!1}),r._type="fs";break;case"PIPE":case"TCP":var s=e(3);r=new s.Socket({fd:t,readable:!1,writable:!0}),r.readable=!1,r.read=null,r._type="pipe",r._handle&&r._handle.unref&&r._handle.unref();break;default:throw new Error("Implement me. Unknown stream file type!")}return r.fd=t,r._isStdio=!0,r}var l=e(11),c=e(13);r=t.exports=e(396),r.log=s,r.formatArgs=a,r.save=o,r.load=u,r.useColors=i,r.colors=[6,2,3,4,5,1];var f=parseInt(n.env.DEBUG_FD,10)||2,d=1===f?n.stdout:2===f?n.stderr:p(f),h=4===c.inspect.length?function(e,t){return c.inspect(e,void 0,void 0,t)}:function(e,t){return c.inspect(e,{colors:t})};r.formatters.o=function(e){return h(e,this.useColors).replace(/\s*\n\s*/g," ")},r.enable(u())}).call(this,e(10))},{10:10,11:11,13:13,3:3,396:396}],398:[function(e,t,r){function n(e){if(e=""+e,!(e.length>1e4)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*c;case"days":case"day":case"d":return r*l;case"hours":case"hour":case"hrs":case"hr":case"h":return r*p;case"minutes":case"minute":case"mins":case"min":case"m":return r*u;case"seconds":case"second":case"secs":case"sec":case"s":return r*o;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r}}}}function i(e){return e>=l?Math.round(e/l)+"d":e>=p?Math.round(e/p)+"h":e>=u?Math.round(e/u)+"m":e>=o?Math.round(e/o)+"s":e+"ms"}function a(e){return s(e,l,"day")||s(e,p,"hour")||s(e,u,"minute")||s(e,o,"second")||e+" ms"}function s(e,t,r){return t>e?void 0:1.5*t>e?Math.floor(e/t)+" "+r:Math.ceil(e/t)+" "+r+"s"}var o=1e3,u=60*o,p=60*u,l=24*p,c=365.25*l;t.exports=function(e,t){return t=t||{},"string"==typeof e?n(e):t["long"]?a(e):i(e)}},{}],399:[function(e,t,r){"use strict";function n(e){var t=0,r=0,n=0;for(var i in e){var a=e[i],s=a[0],o=a[1];(s>r||s===r&&o>n)&&(r=s,n=o,t=+i)}return t}var i=e(592),a=/^(?:( )+|\t+)/;t.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected a string");var t,r,s=0,o=0,u=0,p={};e.split(/\n/g).forEach(function(e){if(e){var n,i=e.match(a);i?(n=i[0].length,i[1]?o++:s++):n=0;var l=n-u;u=n,l?(r=l>0,t=p[r?l:-l],t?t[0]++:t=p[l]=[1,0]):t&&(t[1]+=+r)}});var l,c,f=n(p);return f?o>=s?(l="space",c=i(" ",f)):(l="tab",c=i(" ",f)):(l=null,c=""),{amount:f,type:l,indent:c}}},{592:592}],400:[function(e,t,r){!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 r(e){if(null==e)return!1;switch(e.type){case"DoWhileStatement":case"ForInStatement":case"ForStatement":case"WhileStatement":return!0}return!1}function n(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 i(e){return n(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 s(e){var t;if("IfStatement"!==e.type)return!1;if(null==e.alternate)return!1;t=e.consequent;do{if("IfStatement"===t.type&&null==t.alternate)return!0;t=a(t)}while(t);return!1}t.exports={isExpression:e,isStatement:n,isIterationStatement:r,isSourceElement:i,isProblematicIfStatement:s,trailingStatement:a}}()},{}],401:[function(e,t,r){!function(){"use strict";function e(e){return e>=48&&57>=e}function r(e){return e>=48&&57>=e||e>=97&&102>=e||e>=65&&70>=e}function n(e){return e>=48&&55>=e}function i(e){return 32===e||9===e||11===e||12===e||160===e||e>=5760&&d.indexOf(e)>=0}function a(e){return 10===e||13===e||8232===e||8233===e}function s(e){if(65535>=e)return String.fromCharCode(e);var t=String.fromCharCode(Math.floor((e-65536)/1024)+55296),r=String.fromCharCode((e-65536)%1024+56320);return t+r}function o(e){return 128>e?h[e]:f.NonAsciiIdentifierStart.test(s(e))}function u(e){return 128>e?m[e]:f.NonAsciiIdentifierPart.test(s(e))}function p(e){return 128>e?h[e]:c.NonAsciiIdentifierStart.test(s(e))}function l(e){return 128>e?m[e]:c.NonAsciiIdentifierPart.test(s(e))}var c,f,d,h,m,y;for(f={NonAsciiIdentifierStart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B2\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,NonAsciiIdentifierPart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B2\u08E4-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D60-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA69D\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2D\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/
},c={NonAsciiIdentifierStart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B2\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDE00-\uDE11\uDE13-\uDE2B\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDE00-\uDE2F\uDE44\uDE80-\uDEAA]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF98]|\uD809[\uDC00-\uDC6E]|[\uD80C\uD840-\uD868\uD86A-\uD86C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D]|\uD87E[\uDC00-\uDE1D]/,NonAsciiIdentifierPart:/[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B2\u08E4-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D60-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA69D\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2D\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDD0-\uDDDA\uDE00-\uDE11\uDE13-\uDE37\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF01-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF98]|\uD809[\uDC00-\uDC6E]|[\uD80C\uD840-\uD868\uD86A-\uD86C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/},d=[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279],h=new Array(128),y=0;128>y;++y)h[y]=y>=97&&122>=y||y>=65&&90>=y||36===y||95===y;for(m=new Array(128),y=0;128>y;++y)m[y]=y>=97&&122>=y||y>=65&&90>=y||y>=48&&57>=y||36===y||95===y;t.exports={isDecimalDigit:e,isHexDigit:r,isOctalDigit:n,isWhiteSpace:i,isLineTerminator:a,isIdentifierStartES5:o,isIdentifierPartES5:u,isIdentifierStartES6:p,isIdentifierPartES6:l}}()},{}],402:[function(e,t,r){!function(){"use strict";function r(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 n(e,t){return t||"yield"!==e?i(e,t):!1}function i(e,t){if(t&&r(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,t){return"null"===e||"true"===e||"false"===e||n(e,t)}function s(e,t){return"null"===e||"true"===e||"false"===e||i(e,t)}function o(e){return"eval"===e||"arguments"===e}function u(e){var t,r,n;if(0===e.length)return!1;if(n=e.charCodeAt(0),!d.isIdentifierStartES5(n))return!1;for(t=1,r=e.length;r>t;++t)if(n=e.charCodeAt(t),!d.isIdentifierPartES5(n))return!1;return!0}function p(e,t){return 1024*(e-55296)+(t-56320)+65536}function l(e){var t,r,n,i,a;if(0===e.length)return!1;for(a=d.isIdentifierStartES6,t=0,r=e.length;r>t;++t){if(n=e.charCodeAt(t),n>=55296&&56319>=n){if(++t,t>=r)return!1;if(i=e.charCodeAt(t),!(i>=56320&&57343>=i))return!1;n=p(n,i)}if(!a(n))return!1;a=d.isIdentifierPartES6}return!0}function c(e,t){return u(e)&&!a(e,t)}function f(e,t){return l(e)&&!s(e,t)}var d=e(401);t.exports={isKeywordES5:n,isKeywordES6:i,isReservedWordES5:a,isReservedWordES6:s,isRestrictedWord:o,isIdentifierNameES5:u,isIdentifierNameES6:l,isIdentifierES5:c,isIdentifierES6:f}}()},{401:401}],403:[function(e,t,r){!function(){"use strict";r.ast=e(400),r.code=e(401),r.keyword=e(402)}()},{400:400,401:401,402:402}],404:[function(e,t,r){t.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,fetch:!1,find:!1,focus:!1,FocusEvent:!1,FormData:!1,frameElement:!1,frames:!1,GamepadEvent:!1,getComputedStyle:!1,getSelection:!1,HashChangeEvent:!1,Headers:!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,Request:!1,Response:!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},applescript:{$:!1,Application:!1,Automation:!1,console:!1,delay:!1,Library:!1,ObjC:!1,ObjectSpecifier:!1,Path:!1,Progress:!1,Ref:!1}}},{}],405:[function(e,t,r){t.exports=e(404)},{404:404}],406:[function(e,t,r){var n=e(407);t.exports=Number.isInteger||function(e){return"number"==typeof e&&n(e)&&Math.floor(e)===e}},{407:407}],407:[function(e,t,r){"use strict";var n=e(408);t.exports=Number.isFinite||function(e){return!("number"!=typeof e||n(e)||e===1/0||e===-(1/0))}},{408:408}],408:[function(e,t,r){"use strict";t.exports=Number.isNaN||function(e){return e!==e}},{}],409:[function(e,t,r){t.exports=/((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\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,t.exports.matchToToken=function(e){var t={type:"invalid",value:e[0]};return e[1]?(t.type="string",t.closed=!(!e[3]&&!e[4])):e[5]?t.type="comment":e[6]?(t.type="comment",t.closed=!!e[7]):e[8]?t.type="regex":e[9]?t.type="number":e[10]?t.type="name":e[11]?t.type="punctuator":e[12]&&(t.type="whitespace"),t}},{}],410:[function(e,t,r){var n="object"==typeof r?r:{};n.parse=function(){"use strict";var e,t,r,n,i={"'":"'",'"':'"',"\\":"\\","/":"/","\n":"",b:"\b",f:"\f",n:"\n",r:"\r",t:" "},a=[" "," ","\r","\n","\x0B","\f"," ","\ufeff"],s=function(t){var n=new SyntaxError;throw n.message=t,n.at=e,n.text=r,n},o=function(n){return n&&n!==t&&s("Expected '"+n+"' instead of '"+t+"'"),t=r.charAt(e),e+=1,t},u=function(){return r.charAt(e)},p=function(){var e=t;for("_"!==t&&"$"!==t&&("a">t||t>"z")&&("A">t||t>"Z")&&s("Bad identifier");o()&&("_"===t||"$"===t||t>="a"&&"z">=t||t>="A"&&"Z">=t||t>="0"&&"9">=t);)e+=t;return e},l=function(){var e,r="",n="",i=10;if(("-"===t||"+"===t)&&(r=t,o(t)),"I"===t)return e=y(),("number"!=typeof e||isNaN(e))&&s("Unexpected word for number"),"-"===r?-e:e;if("N"===t)return e=y(),isNaN(e)||s("expected word to be NaN"),e;switch("0"===t&&(n+=t,o(),"x"===t||"X"===t?(n+=t,o(),i=16):t>="0"&&"9">=t&&s("Octal literal")),i){case 10:for(;t>="0"&&"9">=t;)n+=t,o();if("."===t)for(n+=".";o()&&t>="0"&&"9">=t;)n+=t;if("e"===t||"E"===t)for(n+=t,o(),("-"===t||"+"===t)&&(n+=t,o());t>="0"&&"9">=t;)n+=t,o();break;case 16:for(;t>="0"&&"9">=t||t>="A"&&"F">=t||t>="a"&&"f">=t;)n+=t,o()}return e="-"===r?-n:+n,isFinite(e)?e:void s("Bad number")},c=function(){var e,r,n,a,p="";if('"'===t||"'"===t)for(n=t;o();){if(t===n)return o(),p;if("\\"===t)if(o(),"u"===t){for(a=0,r=0;4>r&&(e=parseInt(o(),16),isFinite(e));r+=1)a=16*a+e;p+=String.fromCharCode(a)}else if("\r"===t)"\n"===u()&&o();else{if("string"!=typeof i[t])break;p+=i[t]}else{if("\n"===t)break;p+=t}}s("Bad string")},f=function(){"/"!==t&&s("Not an inline comment");do if(o(),"\n"===t||"\r"===t)return void o();while(t)},d=function(){"*"!==t&&s("Not a block comment");do for(o();"*"===t;)if(o("*"),"/"===t)return void o("/");while(t);s("Unterminated block comment")},h=function(){"/"!==t&&s("Not a comment"),o("/"),"/"===t?f():"*"===t?d():s("Unrecognized comment")},m=function(){for(;t;)if("/"===t)h();else{if(!(a.indexOf(t)>=0))return;o()}},y=function(){switch(t){case"t":return o("t"),o("r"),o("u"),o("e"),!0;case"f":return o("f"),o("a"),o("l"),o("s"),o("e"),!1;case"n":return o("n"),o("u"),o("l"),o("l"),null;case"I":return o("I"),o("n"),o("f"),o("i"),o("n"),o("i"),o("t"),o("y"),1/0;case"N":return o("N"),o("a"),o("N"),NaN}s("Unexpected '"+t+"'")},g=function(){var e=[];if("["===t)for(o("["),m();t;){if("]"===t)return o("]"),e;if(","===t?s("Missing array element"):e.push(n()),m(),","!==t)return o("]"),e;o(","),m()}s("Bad array")},v=function(){var e,r={};if("{"===t)for(o("{"),m();t;){if("}"===t)return o("}"),r;if(e='"'===t||"'"===t?c():p(),m(),o(":"),r[e]=n(),m(),","!==t)return o("}"),r;o(","),m()}s("Bad object")};return n=function(){switch(m(),t){case"{":return v();case"[":return g();case'"':case"'":return c();case"-":case"+":case".":return l();default:return t>="0"&&"9">=t?l():y()}},function(i,a){var o;return r=String(i),e=0,t=" ",o=n(),m(),t&&s("Syntax error"),"function"==typeof a?function u(e,t){var r,n,i=e[t];if(i&&"object"==typeof i)for(r in i)Object.prototype.hasOwnProperty.call(i,r)&&(n=u(i,r),void 0!==n?i[r]=n:delete i[r]);return a.call(e,t,i)}({"":o},""):o}}(),n.stringify=function(e,t,r){
function i(e){return e>="a"&&"z">=e||e>="A"&&"Z">=e||e>="0"&&"9">=e||"_"===e||"$"===e}function a(e){return e>="a"&&"z">=e||e>="A"&&"Z">=e||"_"===e||"$"===e}function s(e){if("string"!=typeof e)return!1;if(!a(e[0]))return!1;for(var t=1,r=e.length;r>t;){if(!i(e[t]))return!1;t++}return!0}function o(e){return Array.isArray?Array.isArray(e):"[object Array]"===Object.prototype.toString.call(e)}function u(e){return"[object Date]"===Object.prototype.toString.call(e)}function p(e){for(var t=0;t<m.length;t++)if(m[t]===e)throw new TypeError("Converting circular structure to JSON")}function l(e,t,r){if(!e)return"";e.length>10&&(e=e.substring(0,10));for(var n=r?"":"\n",i=0;t>i;i++)n+=e;return n}function c(e){return y.lastIndex=0,y.test(e)?'"'+e.replace(y,function(e){var t=g[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function f(e,t,r){var n,i,a=d(e,t,r);switch(a&&!u(a)&&(a=a.valueOf()),typeof a){case"boolean":return a.toString();case"number":return isNaN(a)||!isFinite(a)?"null":a.toString();case"string":return c(a.toString());case"object":if(null===a)return"null";if(o(a)){p(a),n="[",m.push(a);for(var y=0;y<a.length;y++)i=f(a,y,!1),n+=l(h,m.length),n+=null===i||"undefined"==typeof i?"null":i,y<a.length-1?n+=",":h&&(n+="\n");m.pop(),n+=l(h,m.length,!0)+"]"}else{p(a),n="{";var g=!1;m.push(a);for(var v in a)if(a.hasOwnProperty(v)){var b=f(a,v,!1);if(r=!1,"undefined"!=typeof b&&null!==b){n+=l(h,m.length),g=!0;var t=s(v)?v:c(v);n+=t+":"+(h?" ":"")+b+","}}m.pop(),n=g?n.substring(0,n.length-1)+l(h,m.length)+"}":"{}"}return n;default:return}}if(t&&"function"!=typeof t&&!o(t))throw new Error("Replacer must be a function or an array");var d=function(e,r,n){var i=e[r];return i&&i.toJSON&&"function"==typeof i.toJSON&&(i=i.toJSON()),"function"==typeof t?t.call(e,r,i):t?n||o(e)||t.indexOf(r)>=0?i:void 0:i};n.isWord=s,isNaN=isNaN||function(e){return"number"==typeof e&&e!==e};var h,m=[];r&&("string"==typeof r?h=r:"number"==typeof r&&r>=0&&(h=l(" ",r,!0)));var y=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,g={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},v={"":e};return void 0===e?d(v,"",!0):f(v,"",!0)}},{}],411:[function(e,t,r){function n(e,t,r){return t in e?e[t]:r}function i(e,t){var r=n.bind(null,t||{}),i=r("transform",Function.prototype),s=r("padding"," "),o=r("before"," "),u=r("after"," | "),p=r("start",1),l=Array.isArray(e),c=l?e:e.split("\n"),f=p+c.length-1,d=String(f).length,h=c.map(function(e,t){var r=p+t,n={before:o,number:r,width:d,after:u,line:e};return i(n),n.before+a(n.number,d,s)+n.after+n.line});return l?h:h.join("\n")}var a=e(412);t.exports=i},{412:412}],412:[function(e,t,r){function n(e,t,r){e=String(e);var n=-1;for(r||(r=" "),t-=e.length;++n<t;)e=r+e;return e}t.exports=n},{}],413:[function(e,t,r){function n(e){for(var t=-1,r=e?e.length:0,n=-1,i=[];++t<r;){var a=e[t];a&&(i[++n]=a)}return i}t.exports=n},{}],414:[function(e,t,r){function n(e,t,r){var n=e?e.length:0;return r&&a(e,t,r)&&(t=!1),n?i(e,t):[]}var i=e(443),a=e(493);t.exports=n},{443:443,493:493}],415:[function(e,t,r){function n(e){var t=e?e.length:0;return t?e[t-1]:void 0}t.exports=n},{}],416:[function(e,t,r){function n(){var e=arguments,t=e[0];if(!t||!t.length)return t;for(var r=0,n=i,a=e.length;++r<a;)for(var o=0,u=e[r];(o=n(t,u,o))>-1;)s.call(t,o,1);return t}var i=e(450),a=Array.prototype,s=a.splice;t.exports=n},{450:450}],417:[function(e,t,r){function n(e,t,r,n){var u=e?e.length:0;return u?(null!=t&&"boolean"!=typeof t&&(n=r,r=s(e,t,n)?void 0:t,t=!1),r=null==r?r:i(r,n,3),t?o(e,r):a(e,r)):[]}var i=e(437),a=e(466),s=e(493),o=e(499);t.exports=n},{437:437,466:466,493:493,499:499}],418:[function(e,t,r){t.exports=e(421)},{421:421}],419:[function(e,t,r){t.exports=e(420)},{420:420}],420:[function(e,t,r){var n=e(429),i=e(441),a=e(478),s=a(n,i);t.exports=s},{429:429,441:441,478:478}],421:[function(e,t,r){function n(e,t,r,n){var f=e?a(e):0;return u(f)||(e=l(e),f=e.length),r="number"!=typeof r||n&&o(t,r,n)?0:0>r?c(f+r,0):r||0,"string"==typeof e||!s(e)&&p(e)?f>=r&&e.indexOf(t,r)>-1:!!f&&i(e,t,r)>-1}var i=e(450),a=e(484),s=e(505),o=e(493),u=e(495),p=e(514),l=e(525),c=Math.max;t.exports=n},{450:450,484:484,493:493,495:495,505:505,514:514,525:525}],422:[function(e,t,r){function n(e,t,r){var n=o(e)?i:s;return t=a(t,r,3),n(e,t)}var i=e(430),a=e(437),s=e(454),o=e(505);t.exports=n},{430:430,437:437,454:454,505:505}],423:[function(e,t,r){var n=e(432),i=e(442),a=e(479),s=a(n,i);t.exports=s},{432:432,442:442,479:479}],424:[function(e,t,r){function n(e,t,r){var n=o(e)?i:s;return r&&u(e,t,r)&&(t=void 0),("function"!=typeof t||void 0!==r)&&(t=a(t,r,3)),n(e,t)}var i=e(433),a=e(437),s=e(463),o=e(505),u=e(493);t.exports=n},{433:433,437:437,463:463,493:493,505:505}],425:[function(e,t,r){function n(e,t,r){if(null==e)return[];r&&u(e,t,r)&&(t=void 0);var n=-1;t=i(t,r,3);var p=a(e,function(e,r,i){return{criteria:t(e,r,i),index:++n,value:e}});return s(p,o)}var i=e(437),a=e(454),s=e(464),o=e(472),u=e(493);t.exports=n},{437:437,454:454,464:464,472:472,493:493}],426:[function(e,t,r){function n(e,t){if("function"!=typeof e)throw new TypeError(i);return t=a(void 0===t?e.length-1:+t||0,0),function(){for(var r=arguments,n=-1,i=a(r.length-t,0),s=Array(i);++n<i;)s[n]=r[t+n];switch(t){case 0:return e.call(this,s);case 1:return e.call(this,r[0],s);case 2:return e.call(this,r[0],r[1],s)}var o=Array(t+1);for(n=-1;++n<t;)o[n]=r[n];return o[t]=s,e.apply(this,o)}}var i="Expected a function",a=Math.max;t.exports=n},{}],427:[function(e,t,r){(function(r){function n(e){var t=e?e.length:0;for(this.data={hash:o(null),set:new s};t--;)this.push(e[t])}var i=e(471),a=e(486),s=a(r,"Set"),o=a(Object,"create");n.prototype.push=i,t.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{471:471,486:486}],428:[function(e,t,r){function n(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}t.exports=n},{}],429:[function(e,t,r){function n(e,t){for(var r=-1,n=e.length;++r<n&&t(e[r],r,e)!==!1;);return e}t.exports=n},{}],430:[function(e,t,r){function n(e,t){for(var r=-1,n=e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}t.exports=n},{}],431:[function(e,t,r){function n(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}t.exports=n},{}],432:[function(e,t,r){function n(e,t,r,n){var i=e.length;for(n&&i&&(r=e[--i]);i--;)r=t(r,e[i],i,e);return r}t.exports=n},{}],433:[function(e,t,r){function n(e,t){for(var r=-1,n=e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}t.exports=n},{}],434:[function(e,t,r){function n(e,t){return void 0===e?t:e}t.exports=n},{}],435:[function(e,t,r){function n(e,t,r){for(var n=-1,a=i(t),s=a.length;++n<s;){var o=a[n],u=e[o],p=r(u,t[o],o,e,t);(p===p?p===u:u!==u)&&(void 0!==u||o in e)||(e[o]=p)}return e}var i=e(521);t.exports=n},{521:521}],436:[function(e,t,r){function n(e,t){return null==t?e:i(t,a(t),e)}var i=e(440),a=e(521);t.exports=n},{440:440,521:521}],437:[function(e,t,r){function n(e,t,r){var n=typeof e;return"function"==n?void 0===t?e:s(e,t,r):null==e?o:"object"==n?i(e):void 0===t?u(e):a(e,t)}var i=e(455),a=e(456),s=e(468),o=e(528),u=e(529);t.exports=n},{455:455,456:456,468:468,528:528,529:529}],438:[function(e,t,r){function n(e,t,r,h,m,y,g){var b;if(r&&(b=m?r(e,h,m):r(e)),void 0!==b)return b;if(!f(e))return e;var E=c(e);if(E){if(b=u(e),!t)return i(e,b)}else{var S=N.call(e),A=S==v;if(S!=x&&S!=d&&(!A||m))return j[S]?p(e,S,t):m?e:{};if(b=l(A?{}:e),!t)return s(b,e)}y||(y=[]),g||(g=[]);for(var D=y.length;D--;)if(y[D]==e)return g[D];return y.push(e),g.push(b),(E?a:o)(e,function(i,a){b[a]=n(i,t,r,a,e,y,g)}),b}var i=e(428),a=e(429),s=e(436),o=e(446),u=e(488),p=e(489),l=e(490),c=e(505),f=e(511),d="[object Arguments]",h="[object Array]",m="[object Boolean]",y="[object Date]",g="[object Error]",v="[object Function]",b="[object Map]",E="[object Number]",x="[object Object]",S="[object RegExp]",A="[object Set]",D="[object String]",C="[object WeakMap]",w="[object ArrayBuffer]",I="[object Float32Array]",_="[object Float64Array]",F="[object Int8Array]",k="[object Int16Array]",P="[object Int32Array]",B="[object Uint8Array]",T="[object Uint8ClampedArray]",M="[object Uint16Array]",O="[object Uint32Array]",j={};j[d]=j[h]=j[w]=j[m]=j[y]=j[I]=j[_]=j[F]=j[k]=j[P]=j[E]=j[x]=j[S]=j[D]=j[B]=j[T]=j[M]=j[O]=!0,j[g]=j[v]=j[b]=j[A]=j[C]=!1;var L=Object.prototype,N=L.toString;t.exports=n},{428:428,429:429,436:436,446:446,488:488,489:489,490:490,505:505,511:511}],439:[function(e,t,r){function n(e,t){if(e!==t){var r=null===e,n=void 0===e,i=e===e,a=null===t,s=void 0===t,o=t===t;if(e>t&&!a||!i||r&&!s&&o||n&&o)return 1;if(t>e&&!r||!o||a&&!n&&i||s&&i)return-1}return 0}t.exports=n},{}],440:[function(e,t,r){function n(e,t,r){r||(r={});for(var n=-1,i=t.length;++n<i;){var a=t[n];r[a]=e[a]}return r}t.exports=n},{}],441:[function(e,t,r){var n=e(446),i=e(474),a=i(n);t.exports=a},{446:446,474:474}],442:[function(e,t,r){var n=e(447),i=e(474),a=i(n,!0);t.exports=a},{447:447,474:474}],443:[function(e,t,r){function n(e,t,r,p){p||(p=[]);for(var l=-1,c=e.length;++l<c;){var f=e[l];u(f)&&o(f)&&(r||s(f)||a(f))?t?n(f,t,r,p):i(p,f):r||(p[p.length]=f)}return p}var i=e(431),a=e(504),s=e(505),o=e(491),u=e(496);t.exports=n},{431:431,491:491,496:496,504:504,505:505}],444:[function(e,t,r){var n=e(475),i=n();t.exports=i},{475:475}],445:[function(e,t,r){function n(e,t){return i(e,t,a)}var i=e(444),a=e(522);t.exports=n},{444:444,522:522}],446:[function(e,t,r){function n(e,t){return i(e,t,a)}var i=e(444),a=e(521);t.exports=n},{444:444,521:521}],447:[function(e,t,r){function n(e,t){return i(e,t,a)}var i=e(448),a=e(521);t.exports=n},{448:448,521:521}],448:[function(e,t,r){var n=e(475),i=n(!0);t.exports=i},{475:475}],449:[function(e,t,r){function n(e,t,r){if(null!=e){void 0!==r&&r in i(e)&&(t=[r]);for(var n=0,a=t.length;null!=e&&a>n;)e=e[t[n++]];return n&&n==a?e:void 0}}var i=e(500);t.exports=n},{500:500}],450:[function(e,t,r){function n(e,t,r){if(t!==t)return i(e,r);for(var n=r-1,a=e.length;++n<a;)if(e[n]===t)return n;return-1}var i=e(487);t.exports=n},{487:487}],451:[function(e,t,r){function n(e,t,r,o,u,p){return e===t?!0:null==e||null==t||!a(e)&&!s(t)?e!==e&&t!==t:i(e,t,n,r,o,u,p)}var i=e(452),a=e(511),s=e(496);t.exports=n},{452:452,496:496,511:511}],452:[function(e,t,r){function n(e,t,r,n,f,m,y){var g=o(e),v=o(t),b=l,E=l;g||(b=h.call(e),b==p?b=c:b!=c&&(g=u(e))),v||(E=h.call(t),E==p?E=c:E!=c&&(v=u(t)));var x=b==c,S=E==c,A=b==E;if(A&&!g&&!x)return a(e,t,b);if(!f){var D=x&&d.call(e,"__wrapped__"),C=S&&d.call(t,"__wrapped__");if(D||C)return r(D?e.value():e,C?t.value():t,n,f,m,y)}if(!A)return!1;m||(m=[]),y||(y=[]);for(var w=m.length;w--;)if(m[w]==e)return y[w]==t;m.push(e),y.push(t);var I=(g?i:s)(e,t,r,n,f,m,y);return m.pop(),y.pop(),I}var i=e(480),a=e(481),s=e(482),o=e(505),u=e(515),p="[object Arguments]",l="[object Array]",c="[object Object]",f=Object.prototype,d=f.hasOwnProperty,h=f.toString;t.exports=n},{480:480,481:481,482:482,505:505,515:515}],453:[function(e,t,r){function n(e,t,r){var n=t.length,s=n,o=!r;if(null==e)return!s;for(e=a(e);n--;){var u=t[n];if(o&&u[2]?u[1]!==e[u[0]]:!(u[0]in e))return!1}for(;++n<s;){u=t[n];var p=u[0],l=e[p],c=u[1];if(o&&u[2]){if(void 0===l&&!(p in e))return!1}else{var f=r?r(l,c,p):void 0;if(!(void 0===f?i(c,l,r,!0):f))return!1}}return!0}var i=e(451),a=e(500);t.exports=n},{451:451,500:500}],454:[function(e,t,r){function n(e,t){var r=-1,n=a(e)?Array(e.length):[];return i(e,function(e,i,a){n[++r]=t(e,i,a)}),n}var i=e(441),a=e(491);t.exports=n},{441:441,491:491}],455:[function(e,t,r){function n(e){var t=a(e);if(1==t.length&&t[0][2]){var r=t[0][0],n=t[0][1];return function(e){return null==e?!1:e[r]===n&&(void 0!==n||r in s(e))}}return function(e){return i(e,t)}}var i=e(453),a=e(485),s=e(500);t.exports=n},{453:453,485:485,500:500}],456:[function(e,t,r){function n(e,t){var r=o(e),n=u(e)&&p(t),d=e+"";return e=f(e),function(o){if(null==o)return!1;var u=d;if(o=c(o),(r||!n)&&!(u in o)){if(o=1==e.length?o:i(o,s(e,0,-1)),null==o)return!1;u=l(e),o=c(o)}return o[u]===t?void 0!==t||u in o:a(t,o[u],void 0,!0)}}var i=e(449),a=e(451),s=e(462),o=e(505),u=e(494),p=e(497),l=e(415),c=e(500),f=e(501);t.exports=n},{415:415,449:449,451:451,462:462,494:494,497:497,500:500,501:501,505:505}],457:[function(e,t,r){function n(e,t,r,f,d){if(!u(e))return e;var h=o(t)&&(s(t)||l(t)),m=h?void 0:c(t);return i(m||t,function(i,s){if(m&&(s=i,i=t[s]),p(i))f||(f=[]),d||(d=[]),a(e,t,s,n,r,f,d);else{var o=e[s],u=r?r(o,i,s,e,t):void 0,l=void 0===u;l&&(u=i),void 0===u&&(!h||s in e)||!l&&(u===u?u===o:o!==o)||(e[s]=u)}}),e}var i=e(429),a=e(458),s=e(505),o=e(491),u=e(511),p=e(496),l=e(515),c=e(521);t.exports=n},{429:429,458:458,491:491,496:496,505:505,511:511,515:515,521:521}],458:[function(e,t,r){function n(e,t,r,n,c,f,d){for(var h=f.length,m=t[r];h--;)if(f[h]==m)return void(e[r]=d[h]);var y=e[r],g=c?c(y,m,r,e,t):void 0,v=void 0===g;v&&(g=m,o(m)&&(s(m)||p(m))?g=s(y)?y:o(y)?i(y):[]:u(m)||a(m)?g=a(y)?l(y):u(y)?y:{}:v=!1),f.push(m),d.push(g),v?e[r]=n(g,m,c,f,d):(g===g?g!==y:y===y)&&(e[r]=g)}var i=e(428),a=e(504),s=e(505),o=e(491),u=e(512),p=e(515),l=e(516);t.exports=n},{428:428,491:491,504:504,505:505,512:512,515:515,516:516}],459:[function(e,t,r){function n(e){return function(t){return null==t?void 0:t[e]}}t.exports=n},{}],460:[function(e,t,r){function n(e){var t=e+"";return e=a(e),function(r){return i(r,e,t)}}var i=e(449),a=e(501);t.exports=n},{449:449,501:501}],461:[function(e,t,r){function n(e,t,r,n,i){return i(e,function(e,i,a){r=n?(n=!1,e):t(r,e,i,a)}),r}t.exports=n},{}],462:[function(e,t,r){function n(e,t,r){var n=-1,i=e.length;t=null==t?0:+t||0,0>t&&(t=-t>i?0:i+t),r=void 0===r||r>i?i:+r||0,0>r&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var a=Array(i);++n<i;)a[n]=e[n+t];return a}t.exports=n},{}],463:[function(e,t,r){function n(e,t){var r;return i(e,function(e,n,i){return r=t(e,n,i),!r}),!!r}var i=e(441);t.exports=n},{441:441}],464:[function(e,t,r){function n(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}t.exports=n},{}],465:[function(e,t,r){function n(e){return null==e?"":e+""}t.exports=n},{}],466:[function(e,t,r){function n(e,t){var r=-1,n=i,u=e.length,p=!0,l=p&&u>=o,c=l?s():null,f=[];c?(n=a,p=!1):(l=!1,c=t?[]:f);e:for(;++r<u;){var d=e[r],h=t?t(d,r,e):d;if(p&&d===d){for(var m=c.length;m--;)if(c[m]===h)continue e;t&&c.push(h),f.push(d)}else n(c,h,0)<0&&((t||l)&&c.push(h),f.push(d))}return f}var i=e(450),a=e(470),s=e(476),o=200;t.exports=n},{450:450,470:470,476:476}],467:[function(e,t,r){function n(e,t){for(var r=-1,n=t.length,i=Array(n);++r<n;)i[r]=e[t[r]];return i}t.exports=n},{}],468:[function(e,t,r){function n(e,t,r){if("function"!=typeof e)return i;if(void 0===t)return e;switch(r){case 1:return function(r){return e.call(t,r)};case 3:return function(r,n,i){return e.call(t,r,n,i)};case 4:return function(r,n,i,a){return e.call(t,r,n,i,a)};case 5:return function(r,n,i,a,s){return e.call(t,r,n,i,a,s)}}return function(){return e.apply(t,arguments)}}var i=e(528);t.exports=n},{528:528}],469:[function(e,t,r){(function(e){function r(e){var t=new n(e.byteLength),r=new i(t);return r.set(new i(e)),t}var n=e.ArrayBuffer,i=e.Uint8Array;t.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],470:[function(e,t,r){function n(e,t){var r=e.data,n="string"==typeof t||i(t)?r.set.has(t):r.hash[t];return n?0:-1}var i=e(511);t.exports=n},{511:511}],471:[function(e,t,r){function n(e){var t=this.data;"string"==typeof e||i(e)?t.set.add(e):t.hash[e]=!0}var i=e(511);t.exports=n},{511:511}],472:[function(e,t,r){function n(e,t){return i(e.criteria,t.criteria)||e.index-t.index}var i=e(439);t.exports=n},{439:439}],473:[function(e,t,r){function n(e){return s(function(t,r){var n=-1,s=null==t?0:r.length,o=s>2?r[s-2]:void 0,u=s>2?r[2]:void 0,p=s>1?r[s-1]:void 0;for("function"==typeof o?(o=i(o,p,5),s-=2):(o="function"==typeof p?p:void 0,s-=o?1:0),u&&a(r[0],r[1],u)&&(o=3>s?void 0:o,s=1);++n<s;){var l=r[n];l&&e(t,l,o)}return t})}var i=e(468),a=e(493),s=e(426);t.exports=n},{426:426,468:468,493:493}],474:[function(e,t,r){function n(e,t){return function(r,n){var o=r?i(r):0;if(!a(o))return e(r,n);for(var u=t?o:-1,p=s(r);(t?u--:++u<o)&&n(p[u],u,p)!==!1;);return r}}var i=e(484),a=e(495),s=e(500);t.exports=n},{484:484,495:495,500:500}],475:[function(e,t,r){function n(e){return function(t,r,n){for(var a=i(t),s=n(t),o=s.length,u=e?o:-1;e?u--:++u<o;){var p=s[u];if(r(a[p],p,a)===!1)break}return t}}var i=e(500);t.exports=n},{500:500}],476:[function(e,t,r){(function(r){function n(e){return o&&s?new i(e):null}var i=e(427),a=e(486),s=a(r,"Set"),o=a(Object,"create");t.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{427:427,486:486}],477:[function(e,t,r){function n(e,t){return i(function(r){var n=r[0];return null==n?n:(r.push(t),e.apply(void 0,r))})}var i=e(426);t.exports=n},{426:426}],478:[function(e,t,r){function n(e,t){return function(r,n,s){return"function"==typeof n&&void 0===s&&a(r)?e(r,n):t(r,i(n,s,3))}}var i=e(468),a=e(505);t.exports=n},{468:468,505:505}],479:[function(e,t,r){function n(e,t){return function(r,n,o,u){var p=arguments.length<3;return"function"==typeof n&&void 0===u&&s(r)?e(r,n,o,p):a(r,i(n,u,4),o,p,t)}}var i=e(437),a=e(461),s=e(505);t.exports=n},{437:437,461:461,505:505}],480:[function(e,t,r){function n(e,t,r,n,a,s,o){var u=-1,p=e.length,l=t.length;if(p!=l&&!(a&&l>p))return!1;for(;++u<p;){var c=e[u],f=t[u],d=n?n(a?f:c,a?c:f,u):void 0;if(void 0!==d){if(d)continue;return!1}if(a){if(!i(t,function(e){return c===e||r(c,e,n,a,s,o)}))return!1}else if(c!==f&&!r(c,f,n,a,s,o))return!1}return!0}var i=e(433);t.exports=n},{433:433}],481:[function(e,t,r){function n(e,t,r){switch(r){case i:case a:return+e==+t;case s:return e.name==t.name&&e.message==t.message;case o:return e!=+e?t!=+t:e==+t;case u:case p:return e==t+""}return!1}var i="[object Boolean]",a="[object Date]",s="[object Error]",o="[object Number]",u="[object RegExp]",p="[object String]";t.exports=n},{}],482:[function(e,t,r){function n(e,t,r,n,a,o,u){var p=i(e),l=p.length,c=i(t),f=c.length;if(l!=f&&!a)return!1;for(var d=l;d--;){var h=p[d];if(!(a?h in t:s.call(t,h)))return!1}for(var m=a;++d<l;){h=p[d];var y=e[h],g=t[h],v=n?n(a?g:y,a?y:g,h):void 0;if(!(void 0===v?r(y,g,n,a,o,u):v))return!1;m||(m="constructor"==h)}if(!m){var b=e.constructor,E=t.constructor;if(b!=E&&"constructor"in e&&"constructor"in t&&!("function"==typeof b&&b instanceof b&&"function"==typeof E&&E instanceof E))return!1}return!0}var i=e(521),a=Object.prototype,s=a.hasOwnProperty;t.exports=n},{521:521}],483:[function(e,t,r){function n(e,t,r){return t?e=i[e]:r&&(e=a[e]),"\\"+e}var i={0:"x30",1:"x31",2:"x32",3:"x33",4:"x34",5:"x35",6:"x36",7:"x37",8:"x38",9:"x39",A:"x41",B:"x42",C:"x43",D:"x44",E:"x45",F:"x46",a:"x61",b:"x62",c:"x63",d:"x64",e:"x65",f:"x66",n:"x6e",r:"x72",t:"x74",u:"x75",v:"x76",x:"x78"},a={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"};t.exports=n},{}],484:[function(e,t,r){var n=e(459),i=n("length");t.exports=i},{459:459}],485:[function(e,t,r){function n(e){for(var t=a(e),r=t.length;r--;)t[r][2]=i(t[r][1]);return t}var i=e(497),a=e(524);t.exports=n},{497:497,524:524}],486:[function(e,t,r){function n(e,t){var r=null==e?void 0:e[t];return i(r)?r:void 0}var i=e(509);t.exports=n},{509:509}],487:[function(e,t,r){function n(e,t,r){for(var n=e.length,i=t+(r?0:-1);r?i--:++i<n;){var a=e[i];if(a!==a)return i}return-1}t.exports=n},{}],488:[function(e,t,r){function n(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&a.call(e,"index")&&(r.index=e.index,r.input=e.input),r}var i=Object.prototype,a=i.hasOwnProperty;t.exports=n},{}],489:[function(e,t,r){function n(e,t,r){var n=e.constructor;switch(t){case l:return i(e);case a:case s:return new n(+e);case c:case f:case d:case h:case m:case y:case g:case v:case b:var x=e.buffer;return new n(r?i(x):x,e.byteOffset,e.length);case o:case p:return new n(e);case u:var S=new n(e.source,E.exec(e));S.lastIndex=e.lastIndex}return S}var i=e(469),a="[object Boolean]",s="[object Date]",o="[object Number]",u="[object RegExp]",p="[object String]",l="[object ArrayBuffer]",c="[object Float32Array]",f="[object Float64Array]",d="[object Int8Array]",h="[object Int16Array]",m="[object Int32Array]",y="[object Uint8Array]",g="[object Uint8ClampedArray]",v="[object Uint16Array]",b="[object Uint32Array]",E=/\w*$/;t.exports=n},{469:469}],490:[function(e,t,r){function n(e){var t=e.constructor;return"function"==typeof t&&t instanceof t||(t=Object),new t}t.exports=n},{}],491:[function(e,t,r){function n(e){return null!=e&&a(i(e))}var i=e(484),a=e(495);t.exports=n},{484:484,495:495}],492:[function(e,t,r){function n(e,t){return e="number"==typeof e||i.test(e)?+e:-1,t=null==t?a:t,e>-1&&e%1==0&&t>e}var i=/^\d+$/,a=9007199254740991;t.exports=n},{}],493:[function(e,t,r){function n(e,t,r){if(!s(r))return!1;var n=typeof t;if("number"==n?i(r)&&a(t,r.length):"string"==n&&t in r){var o=r[t];return e===e?e===o:o!==o}return!1}var i=e(491),a=e(492),s=e(511);t.exports=n},{491:491,492:492,511:511}],494:[function(e,t,r){function n(e,t){var r=typeof e;if("string"==r&&o.test(e)||"number"==r)return!0;if(i(e))return!1;var n=!s.test(e);return n||null!=t&&e in a(t)}var i=e(505),a=e(500),s=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,o=/^\w*$/;t.exports=n},{500:500,505:505}],495:[function(e,t,r){function n(e){return"number"==typeof e&&e>-1&&e%1==0&&i>=e}var i=9007199254740991;t.exports=n},{}],496:[function(e,t,r){function n(e){return!!e&&"object"==typeof e}t.exports=n},{}],497:[function(e,t,r){function n(e){return e===e&&!i(e)}var i=e(511);t.exports=n},{511:511}],498:[function(e,t,r){function n(e){for(var t=u(e),r=t.length,n=r&&e.length,p=!!n&&o(n)&&(a(e)||i(e)),c=-1,f=[];++c<r;){var d=t[c];(p&&s(d,n)||l.call(e,d))&&f.push(d)}return f}var i=e(504),a=e(505),s=e(492),o=e(495),u=e(522),p=Object.prototype,l=p.hasOwnProperty;t.exports=n},{492:492,495:495,504:504,505:505,522:522}],499:[function(e,t,r){function n(e,t){for(var r,n=-1,i=e.length,a=-1,s=[];++n<i;){var o=e[n],u=t?t(o,n,e):o;n&&r===u||(r=u,s[++a]=o)}return s}t.exports=n},{}],500:[function(e,t,r){function n(e){return i(e)?e:Object(e)}var i=e(511);t.exports=n},{511:511}],501:[function(e,t,r){function n(e){if(a(e))return e;var t=[];return i(e).replace(s,function(e,r,n,i){t.push(n?i.replace(o,"$1"):r||e)}),t}var i=e(465),a=e(505),s=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g,o=/\\(\\)?/g;t.exports=n},{465:465,505:505}],502:[function(e,t,r){function n(e,t,r,n){return t&&"boolean"!=typeof t&&s(e,t,r)?t=!1:"function"==typeof t&&(n=r,r=t,t=!1),"function"==typeof r?i(e,t,a(r,n,3)):i(e,t)}var i=e(438),a=e(468),s=e(493);t.exports=n},{438:438,468:468,493:493}],503:[function(e,t,r){function n(e,t,r){return"function"==typeof t?i(e,!0,a(t,r,3)):i(e,!0)}var i=e(438),a=e(468);t.exports=n},{438:438,468:468}],504:[function(e,t,r){function n(e){return a(e)&&i(e)&&o.call(e,"callee")&&!u.call(e,"callee")}var i=e(491),a=e(496),s=Object.prototype,o=s.hasOwnProperty,u=s.propertyIsEnumerable;t.exports=n},{491:491,496:496}],505:[function(e,t,r){var n=e(486),i=e(495),a=e(496),s="[object Array]",o=Object.prototype,u=o.toString,p=n(Array,"isArray"),l=p||function(e){return a(e)&&i(e.length)&&u.call(e)==s};t.exports=l},{486:486,495:495,496:496}],506:[function(e,t,r){function n(e){return e===!0||e===!1||i(e)&&o.call(e)==a}var i=e(496),a="[object Boolean]",s=Object.prototype,o=s.toString;t.exports=n},{496:496}],507:[function(e,t,r){function n(e){return null==e?!0:s(e)&&(a(e)||p(e)||i(e)||u(e)&&o(e.splice))?!e.length:!l(e).length}var i=e(504),a=e(505),s=e(491),o=e(508),u=e(496),p=e(514),l=e(521);t.exports=n},{491:491,496:496,504:504,505:505,508:508,514:514,521:521}],508:[function(e,t,r){function n(e){return i(e)&&o.call(e)==a}var i=e(511),a="[object Function]",s=Object.prototype,o=s.toString;t.exports=n},{511:511}],509:[function(e,t,r){function n(e){return null==e?!1:i(e)?l.test(u.call(e)):a(e)&&s.test(e)}var i=e(508),a=e(496),s=/^\[object .+?Constructor\]$/,o=Object.prototype,u=Function.prototype.toString,p=o.hasOwnProperty,l=RegExp("^"+u.call(p).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=n},{496:496,508:508}],510:[function(e,t,r){function n(e){return"number"==typeof e||i(e)&&o.call(e)==a}var i=e(496),a="[object Number]",s=Object.prototype,o=s.toString;t.exports=n},{496:496}],511:[function(e,t,r){function n(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}t.exports=n},{}],512:[function(e,t,r){function n(e){var t;if(!s(e)||l.call(e)!=o||a(e)||!p.call(e,"constructor")&&(t=e.constructor,"function"==typeof t&&!(t instanceof t)))return!1;var r;return i(e,function(e,t){r=t}),void 0===r||p.call(e,r)}var i=e(445),a=e(504),s=e(496),o="[object Object]",u=Object.prototype,p=u.hasOwnProperty,l=u.toString;t.exports=n},{445:445,496:496,504:504}],513:[function(e,t,r){function n(e){return i(e)&&o.call(e)==a}var i=e(511),a="[object RegExp]",s=Object.prototype,o=s.toString;t.exports=n},{511:511}],514:[function(e,t,r){function n(e){return"string"==typeof e||i(e)&&o.call(e)==a}var i=e(496),a="[object String]",s=Object.prototype,o=s.toString;t.exports=n},{496:496}],515:[function(e,t,r){function n(e){return a(e)&&i(e.length)&&!!F[P.call(e)]}var i=e(495),a=e(496),s="[object Arguments]",o="[object Array]",u="[object Boolean]",p="[object Date]",l="[object Error]",c="[object Function]",f="[object Map]",d="[object Number]",h="[object Object]",m="[object RegExp]",y="[object Set]",g="[object String]",v="[object WeakMap]",b="[object ArrayBuffer]",E="[object Float32Array]",x="[object Float64Array]",S="[object Int8Array]",A="[object Int16Array]",D="[object Int32Array]",C="[object Uint8Array]",w="[object Uint8ClampedArray]",I="[object Uint16Array]",_="[object Uint32Array]",F={};F[E]=F[x]=F[S]=F[A]=F[D]=F[C]=F[w]=F[I]=F[_]=!0,F[s]=F[o]=F[b]=F[u]=F[p]=F[l]=F[c]=F[f]=F[d]=F[h]=F[m]=F[y]=F[g]=F[v]=!1;var k=Object.prototype,P=k.toString;t.exports=n},{495:495,496:496}],516:[function(e,t,r){function n(e){return i(e,a(e))}var i=e(440),a=e(522);t.exports=n},{440:440,522:522}],517:[function(e,t,r){var n=e(435),i=e(436),a=e(473),s=a(function(e,t,r){return r?n(e,t,r):i(e,t)});t.exports=s},{435:435,436:436,473:473}],518:[function(e,t,r){var n=e(517),i=e(434),a=e(477),s=a(n,i);t.exports=s},{434:434,477:477,517:517}],519:[function(e,t,r){t.exports=e(517)},{517:517}],520:[function(e,t,r){function n(e,t){if(null==e)return!1;var r=h.call(e,t);if(!r&&!p(t)){if(t=f(t),e=1==t.length?e:i(e,a(t,0,-1)),null==e)return!1;t=c(t),r=h.call(e,t)}return r||l(e.length)&&u(t,e.length)&&(o(e)||s(e))}var i=e(449),a=e(462),s=e(504),o=e(505),u=e(492),p=e(494),l=e(495),c=e(415),f=e(501),d=Object.prototype,h=d.hasOwnProperty;t.exports=n},{415:415,449:449,462:462,492:492,494:494,495:495,501:501,504:504,505:505}],521:[function(e,t,r){var n=e(486),i=e(491),a=e(511),s=e(498),o=n(Object,"keys"),u=o?function(e){var t=null==e?void 0:e.constructor;return"function"==typeof t&&t.prototype===e||"function"!=typeof e&&i(e)?s(e):a(e)?o(e):[]}:s;t.exports=u},{486:486,491:491,498:498,511:511}],522:[function(e,t,r){function n(e){if(null==e)return[];u(e)||(e=Object(e));var t=e.length;t=t&&o(t)&&(a(e)||i(e))&&t||0;for(var r=e.constructor,n=-1,p="function"==typeof r&&r.prototype===e,c=Array(t),f=t>0;++n<t;)c[n]=n+"";for(var d in e)f&&s(d,t)||"constructor"==d&&(p||!l.call(e,d))||c.push(d);return c}var i=e(504),a=e(505),s=e(492),o=e(495),u=e(511),p=Object.prototype,l=p.hasOwnProperty;t.exports=n},{492:492,495:495,504:504,505:505,511:511}],523:[function(e,t,r){var n=e(457),i=e(473),a=i(n);t.exports=a},{457:457,473:473}],524:[function(e,t,r){function n(e){e=a(e);for(var t=-1,r=i(e),n=r.length,s=Array(n);++t<n;){var o=r[t];s[t]=[o,e[o]]}return s}var i=e(521),a=e(500);t.exports=n},{500:500,521:521}],525:[function(e,t,r){function n(e){return i(e,a(e))}var i=e(467),a=e(521);t.exports=n},{467:467,521:521}],526:[function(e,t,r){function n(e){return e=i(e),e&&o.test(e)?e.replace(s,a):e||"(?:)"}var i=e(465),a=e(483),s=/^[:!,]|[\\^$.*+?()[\]{}|\/]|(^[0-9a-fA-Fnrtuvx])|([\n\r\u2028\u2029])/g,o=RegExp(s.source);t.exports=n},{465:465,483:483}],527:[function(e,t,r){function n(e,t,r){return e=i(e),r=null==r?0:a(0>r?0:+r||0,e.length),e.lastIndexOf(t,r)==r}var i=e(465),a=Math.min;t.exports=n},{465:465}],528:[function(e,t,r){function n(e){return e}t.exports=n},{}],529:[function(e,t,r){function n(e){return s(e)?i(e):a(e)}var i=e(459),a=e(460),s=e(494);t.exports=n},{459:459,460:460,494:494}],530:[function(e,t,r){function n(e){return e.split("").reduce(function(e,t){return e[t]=!0,e},{})}function i(e,t){return t=t||{},function(r,n,i){return s(r,e,t)}}function a(e,t){e=e||{},t=t||{};var r={};return Object.keys(t).forEach(function(e){r[e]=t[e]}),Object.keys(e).forEach(function(t){r[t]=e[t]}),r}function s(e,t,r){if("string"!=typeof t)throw new TypeError("glob pattern string required");return r||(r={}),r.nocomment||"#"!==t.charAt(0)?""===t.trim()?""===e:new o(t,r).match(e):!1}function o(e,t){if(!(this instanceof o))return new o(e,t);if("string"!=typeof e)throw new TypeError("glob pattern string required");t||(t={}),e=e.trim(),"/"!==y.sep&&(e=e.split(y.sep).join("/")),this.options=t,this.set=[],this.pattern=e,this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.make()}function u(){if(!this._made){var e=this.pattern,t=this.options;if(!t.nocomment&&"#"===e.charAt(0))return void(this.comment=!0);if(!e)return void(this.empty=!0);this.parseNegate();var r=this.globSet=this.braceExpand();t.debug&&(this.debug=console.error),this.debug(this.pattern,r),r=this.globParts=r.map(function(e){return e.split(C)}),this.debug(this.pattern,r),r=r.map(function(e,t,r){return e.map(this.parse,this)},this),this.debug(this.pattern,r),r=r.filter(function(e){return-1===e.indexOf(!1)}),this.debug(this.pattern,r),this.set=r}}function p(){var e=this.pattern,t=!1,r=this.options,n=0;if(!r.nonegate){for(var i=0,a=e.length;a>i&&"!"===e.charAt(i);i++)t=!t,n++;n&&(this.pattern=e.substr(n)),this.negate=t}}function l(e,t){if(t||(t=this instanceof o?this.options:{}),e="undefined"==typeof e?this.pattern:e,"undefined"==typeof e)throw new Error("undefined pattern");return t.nobrace||!e.match(/\{.*\}/)?[e]:b(e)}function c(e,t){function r(){if(a){switch(a){case"*":o+=x,u=!0;break;case"?":o+=E,u=!0;break;default:o+="\\"+a}g.debug("clearStateChar %j %j",a,o),a=!1}}var n=this.options;if(!n.noglobstar&&"**"===e)return v;if(""===e)return"";for(var i,a,s,o="",u=!!n.nocase,p=!1,l=[],c=[],f=!1,d=-1,m=-1,y="."===e.charAt(0)?"":n.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",g=this,b=0,S=e.length;S>b&&(s=e.charAt(b));b++)if(this.debug("%s %s %s %j",e,b,o,s),p&&D[s])o+="\\"+s,p=!1;else switch(s){case"/":return!1;case"\\":r(),p=!0;continue;case"?":case"*":case"+":case"@":case"!":if(this.debug("%s %s %s %j <-- stateChar",e,b,o,s),f){this.debug(" in class"),"!"===s&&b===m+1&&(s="^"),o+=s;continue}g.debug("call clearStateChar %j",a),r(),a=s,n.noext&&r();continue;case"(":if(f){o+="(";continue}if(!a){o+="\\(";continue}i=a,l.push({type:i,start:b-1,reStart:o.length}),o+="!"===a?"(?:(?!(?:":"(?:",this.debug("plType %j %j",a,o),a=!1;continue;case")":if(f||!l.length){o+="\\)";continue}r(),u=!0,o+=")";var A=l.pop();switch(i=A.type){case"!":c.push(A),o+=")[^/]*?)",A.reEnd=o.length;break;case"?":case"+":case"*":o+=i;break;case"@":}continue;case"|":if(f||!l.length||p){o+="\\|",p=!1;continue}r(),o+="|";continue;case"[":if(r(),f){o+="\\"+s;continue}f=!0,m=b,d=o.length,o+=s;continue;case"]":if(b===m+1||!f){o+="\\"+s,p=!1;continue}if(f){var C=e.substring(m+1,b);try{RegExp("["+C+"]")}catch(I){var _=this.parse(C,w);o=o.substr(0,d)+"\\["+_[0]+"\\]",u=u||_[1],f=!1;continue}}u=!0,f=!1,o+=s;continue;default:r(),p?p=!1:!D[s]||"^"===s&&f||(o+="\\"),o+=s}for(f&&(C=e.substr(m+1),_=this.parse(C,w),o=o.substr(0,d)+"\\["+_[0],u=u||_[1]),A=l.pop();A;A=l.pop()){
var F=o.slice(A.reStart+3);F=F.replace(/((?:\\{2})*)(\\?)\|/g,function(e,t,r){return r||(r="\\"),t+t+r+"|"}),this.debug("tail=%j\n %s",F,F);var k="*"===A.type?x:"?"===A.type?E:"\\"+A.type;u=!0,o=o.slice(0,A.reStart)+k+"\\("+F}r(),p&&(o+="\\\\");var P=!1;switch(o.charAt(0)){case".":case"[":case"(":P=!0}for(var B=c.length-1;B>-1;B--){var T=c[B],M=o.slice(0,T.reStart),O=o.slice(T.reStart,T.reEnd-8),j=o.slice(T.reEnd-8,T.reEnd),L=o.slice(T.reEnd);j+=L;var N=M.split("(").length-1,R=L;for(b=0;N>b;b++)R=R.replace(/\)[+*?]?/,"");L=R;var V="";""===L&&t!==w&&(V="$");var U=M+O+L+V+j;o=U}if(""!==o&&u&&(o="(?=.)"+o),P&&(o=y+o),t===w)return[o,u];if(!u)return h(e);var q=n.nocase?"i":"",G=new RegExp("^"+o+"$",q);return G._glob=e,G._src=o,G}function f(){if(this.regexp||this.regexp===!1)return this.regexp;var e=this.set;if(!e.length)return this.regexp=!1,this.regexp;var t=this.options,r=t.noglobstar?x:t.dot?S:A,n=t.nocase?"i":"",i=e.map(function(e){return e.map(function(e){return e===v?r:"string"==typeof e?m(e):e._src}).join("\\/")}).join("|");i="^(?:"+i+")$",this.negate&&(i="^(?!"+i+").*$");try{this.regexp=new RegExp(i,n)}catch(a){this.regexp=!1}return this.regexp}function d(e,t){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return""===e;if("/"===e&&t)return!0;var r=this.options;"/"!==y.sep&&(e=e.split(y.sep).join("/")),e=e.split(C),this.debug(this.pattern,"split",e);var n=this.set;this.debug(this.pattern,"set",n);var i,a;for(a=e.length-1;a>=0&&!(i=e[a]);a--);for(a=0;a<n.length;a++){var s=n[a],o=e;r.matchBase&&1===s.length&&(o=[i]);var u=this.matchOne(o,s,t);if(u)return r.flipNegate?!0:!this.negate}return r.flipNegate?!1:this.negate}function h(e){return e.replace(/\\(.)/g,"$1")}function m(e){return e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}t.exports=s,s.Minimatch=o;var y={sep:"/"};try{y=e(9)}catch(g){}var v=s.GLOBSTAR=o.GLOBSTAR={},b=e(531),E="[^/]",x=E+"*?",S="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",A="(?:(?!(?:\\/|^)\\.).)*?",D=n("().*{}+?[]^$\\!"),C=/\/+/;s.filter=i,s.defaults=function(e){if(!e||!Object.keys(e).length)return s;var t=s,r=function(r,n,i){return t.minimatch(r,n,a(e,i))};return r.Minimatch=function(r,n){return new t.Minimatch(r,a(e,n))},r},o.defaults=function(e){return e&&Object.keys(e).length?s.defaults(e).Minimatch:o},o.prototype.debug=function(){},o.prototype.make=u,o.prototype.parseNegate=p,s.braceExpand=function(e,t){return l(e,t)},o.prototype.braceExpand=l,o.prototype.parse=c;var w={};s.makeRe=function(e,t){return new o(e,t||{}).makeRe()},o.prototype.makeRe=f,s.match=function(e,t,r){r=r||{};var n=new o(t,r);return e=e.filter(function(e){return n.match(e)}),n.options.nonull&&!e.length&&e.push(t),e},o.prototype.match=d,o.prototype.matchOne=function(e,t,r){var n=this.options;this.debug("matchOne",{"this":this,file:e,pattern:t}),this.debug("matchOne",e.length,t.length);for(var i=0,a=0,s=e.length,o=t.length;s>i&&o>a;i++,a++){this.debug("matchOne loop");var u=t[a],p=e[i];if(this.debug(t,u,p),u===!1)return!1;if(u===v){this.debug("GLOBSTAR",[t,u,p]);var l=i,c=a+1;if(c===o){for(this.debug("** at the end");s>i;i++)if("."===e[i]||".."===e[i]||!n.dot&&"."===e[i].charAt(0))return!1;return!0}for(;s>l;){var f=e[l];if(this.debug("\nglobstar while",e,l,t,c,f),this.matchOne(e.slice(l),t.slice(c),r))return this.debug("globstar found match!",l,s,f),!0;if("."===f||".."===f||!n.dot&&"."===f.charAt(0)){this.debug("dot detected!",e,l,t,c);break}this.debug("globstar swallow a segment, and continue"),l++}return r&&(this.debug("\n>>> no match, partial?",e,l,t,c),l===s)?!0:!1}var d;if("string"==typeof u?(d=n.nocase?p.toLowerCase()===u.toLowerCase():p===u,this.debug("string match",u,p,d)):(d=p.match(u),this.debug("pattern match",u,p,d)),!d)return!1}if(i===s&&a===o)return!0;if(i===s)return r;if(a===o){var h=i===s-1&&""===e[i];return h}throw new Error("wtf?")}},{531:531,9:9}],531:[function(e,t,r){function n(e){return parseInt(e,10)==e?parseInt(e,10):e.charCodeAt(0)}function i(e){return e.split("\\\\").join(m).split("\\{").join(y).split("\\}").join(g).split("\\,").join(v).split("\\.").join(b)}function a(e){return e.split(m).join("\\").split(y).join("{").split(g).join("}").split(v).join(",").split(b).join(".")}function s(e){if(!e)return[""];var t=[],r=h("{","}",e);if(!r)return e.split(",");var n=r.pre,i=r.body,a=r.post,o=n.split(",");o[o.length-1]+="{"+i+"}";var u=s(a);return a.length&&(o[o.length-1]+=u.shift(),o.push.apply(o,u)),t.push.apply(t,o),t}function o(e){return e?f(i(e),!0).map(a):[]}function u(e){return"{"+e+"}"}function p(e){return/^-?0\d/.test(e)}function l(e,t){return t>=e}function c(e,t){return e>=t}function f(e,t){var r=[],i=h("{","}",e);if(!i||/\$$/.test(i.pre))return[e];var a=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),o=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),m=a||o,y=/^(.*,)+(.+)?$/.test(i.body);if(!m&&!y)return i.post.match(/,.*}/)?(e=i.pre+"{"+i.body+g+i.post,f(e)):[e];var v;if(m)v=i.body.split(/\.\./);else if(v=s(i.body),1===v.length&&(v=f(v[0],!1).map(u),1===v.length)){var b=i.post.length?f(i.post,!1):[""];return b.map(function(e){return i.pre+v[0]+e})}var E,x=i.pre,b=i.post.length?f(i.post,!1):[""];if(m){var S=n(v[0]),A=n(v[1]),D=Math.max(v[0].length,v[1].length),C=3==v.length?Math.abs(n(v[2])):1,w=l,I=S>A;I&&(C*=-1,w=c);var _=v.some(p);E=[];for(var F=S;w(F,A);F+=C){var k;if(o)k=String.fromCharCode(F),"\\"===k&&(k="");else if(k=String(F),_){var P=D-k.length;if(P>0){var B=new Array(P+1).join("0");k=0>F?"-"+B+k.slice(1):B+k}}E.push(k)}}else E=d(v,function(e){return f(e,!1)});for(var T=0;T<E.length;T++)for(var M=0;M<b.length;M++){var O=x+E[T]+b[M];(!t||m||O)&&r.push(O)}return r}var d=e(533),h=e(532);t.exports=o;var m="\x00SLASH"+Math.random()+"\x00",y="\x00OPEN"+Math.random()+"\x00",g="\x00CLOSE"+Math.random()+"\x00",v="\x00COMMA"+Math.random()+"\x00",b="\x00PERIOD"+Math.random()+"\x00"},{532:532,533:533}],532:[function(e,t,r){function n(e,t,r){var n=i(e,t,r);return n&&{start:n[0],end:n[1],pre:r.slice(0,n[0]),body:r.slice(n[0]+e.length,n[1]),post:r.slice(n[1]+t.length)}}function i(e,t,r){var n,i,a,s,o,u=r.indexOf(e),p=r.indexOf(t,u+1),l=u;if(u>=0&&p>0){for(n=[],a=r.length;l<r.length&&l>=0&&!o;)l==u?(n.push(l),u=r.indexOf(e,l+1)):1==n.length?o=[n.pop(),p]:(i=n.pop(),a>i&&(a=i,s=p),p=r.indexOf(t,l+1)),l=p>u&&u>=0?u:p;n.length&&(o=[a,s])}return o}t.exports=n,n.range=i},{}],533:[function(e,t,r){t.exports=function(e,t){for(var r=[],i=0;i<e.length;i++){var a=t(e[i],i);n(a)?r.push.apply(r,a):r.push(a)}return r};var n=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},{}],534:[function(e,t,r){"use strict";var n=e(3);t.exports=function(e,t){var r="function"==typeof n.access?n.access:n.stat;r(e,function(e){t(null,!e)})},t.exports.sync=function(e){var t="function"==typeof n.accessSync?n.accessSync:n.statSync;try{return t(e),!0}catch(r){return!1}}},{3:3}],535:[function(e,t,r){(function(e){"use strict";function r(e){return"/"===e.charAt(0)}function n(e){var t=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/,r=t.exec(e),n=r[1]||"",i=!!n&&":"!==n.charAt(1);return!!r[2]||i}t.exports="win32"===e.platform?n:r,t.exports.posix=r,t.exports.win32=n}).call(this,e(10))},{10:10}],536:[function(e,t,r){"use strict";function n(e,t,r){if(c)try{c.call(l,e,t,{value:r})}catch(n){e[t]=r}else e[t]=r}function i(e){return e&&(n(e,"call",e.call),n(e,"apply",e.apply)),e}function a(e){return f?f.call(l,e):(y.prototype=e||null,new y)}function s(){do var e=o(m.call(h.call(g(),36),2));while(d.call(v,e));return v[e]=e}function o(e){var t={};return t[e]=!0,Object.keys(t)[0]}function u(e){return a(null)}function p(e){function t(t){function r(r,n){return r===o?n?a=null:a||(a=e(t)):void 0}var a;n(t,i,r)}function r(e){return d.call(e,i)||t(e),e[i](o)}var i=s(),o=a(null);return e=e||u,r.forget=function(e){d.call(e,i)&&e[i](o,!0)},r}var l=Object,c=Object.defineProperty,f=Object.create;i(c),i(f);var d=i(Object.prototype.hasOwnProperty),h=i(Number.prototype.toString),m=i(String.prototype.slice),y=function(){},g=Math.random,v=a(null);n(r,"makeUniqueKey",s);var b=Object.getOwnPropertyNames;Object.getOwnPropertyNames=function(e){for(var t=b(e),r=0,n=0,i=t.length;i>r;++r)d.call(v,t[r])||(r>n&&(t[n]=t[r]),++n);return t.length=n,t},n(r,"makeAccessor",p)},{}],537:[function(e,t,r){function n(e){u.ok(this instanceof n),c.Identifier.assert(e),this.nextTempId=0,Object.defineProperties(this,{contextId:{value:e},listing:{value:[]},marked:{value:[!0]},finalLoc:{value:i()},tryEntries:{value:[]}}),Object.defineProperties(this,{leapManager:{value:new f.LeapManager(this)}})}function i(){return l.literal(-1)}function a(e){return c.BreakStatement.check(e)||c.ContinueStatement.check(e)||c.ReturnStatement.check(e)||c.ThrowStatement.check(e)}function s(e){return new Error("all declarations should have been transformed into assignments before the Exploder began its work: "+JSON.stringify(e))}function o(e){var t=e.type;return"normal"===t?!y.call(e,"target"):"break"===t||"continue"===t?!y.call(e,"value")&&c.Literal.check(e.target):"return"===t||"throw"===t?y.call(e,"value")&&!y.call(e,"target"):!1}var u=e(1),p=e(568).types,l=(p.builtInTypes.array,p.builders),c=p.namedTypes,f=e(539),d=e(540),h=e(541),m=h.runtimeProperty,y=Object.prototype.hasOwnProperty,g=n.prototype;r.Emitter=n,g.mark=function(e){c.Literal.assert(e);var t=this.listing.length;return-1===e.value?e.value=t:u.strictEqual(e.value,t),this.marked[t]=!0,e},g.emit=function(e){c.Expression.check(e)&&(e=l.expressionStatement(e)),c.Statement.assert(e),this.listing.push(e)},g.emitAssign=function(e,t){return this.emit(this.assign(e,t)),e},g.assign=function(e,t){return l.expressionStatement(l.assignmentExpression("=",e,t))},g.contextProperty=function(e,t){return l.memberExpression(this.contextId,t?l.literal(e):l.identifier(e),!!t)},g.stop=function(e){e&&this.setReturnValue(e),this.jump(this.finalLoc)},g.setReturnValue=function(e){c.Expression.assert(e.value),this.emitAssign(this.contextProperty("rval"),this.explodeExpression(e))},g.clearPendingException=function(e,t){c.Literal.assert(e);var r=l.callExpression(this.contextProperty("catch",!0),[e]);t?this.emitAssign(t,r):this.emit(r)},g.jump=function(e){this.emitAssign(this.contextProperty("next"),e),this.emit(l.breakStatement())},g.jumpIf=function(e,t){c.Expression.assert(e),c.Literal.assert(t),this.emit(l.ifStatement(e,l.blockStatement([this.assign(this.contextProperty("next"),t),l.breakStatement()])))},g.jumpIfNot=function(e,t){c.Expression.assert(e),c.Literal.assert(t);var r;r=c.UnaryExpression.check(e)&&"!"===e.operator?e.argument:l.unaryExpression("!",e),this.emit(l.ifStatement(r,l.blockStatement([this.assign(this.contextProperty("next"),t),l.breakStatement()])))},g.makeTempVar=function(){return this.contextProperty("t"+this.nextTempId++)},g.getContextFunction=function(e){return l.functionExpression(e||null,[this.contextId],l.blockStatement([this.getDispatchLoop()]),!1,!1)},g.getDispatchLoop=function(){var e,t=this,r=[],n=!1;return t.listing.forEach(function(i,s){t.marked.hasOwnProperty(s)&&(r.push(l.switchCase(l.literal(s),e=[])),n=!1),n||(e.push(i),a(i)&&(n=!0))}),this.finalLoc.value=this.listing.length,r.push(l.switchCase(this.finalLoc,[]),l.switchCase(l.literal("end"),[l.returnStatement(l.callExpression(this.contextProperty("stop"),[]))])),l.whileStatement(l.literal(1),l.switchStatement(l.assignmentExpression("=",this.contextProperty("prev"),this.contextProperty("next")),r))},g.getTryLocsList=function(){if(0===this.tryEntries.length)return null;var e=0;return l.arrayExpression(this.tryEntries.map(function(t){var r=t.firstLoc.value;u.ok(r>=e,"try entries out of order"),e=r;var n=t.catchEntry,i=t.finallyEntry,a=[t.firstLoc,n?n.firstLoc:null];return i&&(a[2]=i.firstLoc,a[3]=i.afterLoc),l.arrayExpression(a)}))},g.explode=function(e,t){u.ok(e instanceof p.NodePath);var r=e.value,n=this;if(c.Node.assert(r),c.Statement.check(r))return n.explodeStatement(e);if(c.Expression.check(r))return n.explodeExpression(e,t);if(c.Declaration.check(r))throw s(r);switch(r.type){case"Program":return e.get("body").map(n.explodeStatement,n);case"VariableDeclarator":throw s(r);case"Property":case"SwitchCase":case"CatchClause":throw new Error(r.type+" nodes should be handled by their parents");default:throw new Error("unknown Node of type "+JSON.stringify(r.type))}},g.explodeStatement=function(e,t){u.ok(e instanceof p.NodePath);var r=e.value,n=this;if(c.Statement.assert(r),t?c.Identifier.assert(t):t=null,c.BlockStatement.check(r))return e.get("body").each(n.explodeStatement,n);if(!d.containsLeap(r))return void n.emit(r);switch(r.type){case"ExpressionStatement":n.explodeExpression(e.get("expression"),!0);break;case"LabeledStatement":var a=i();n.leapManager.withEntry(new f.LabeledEntry(a,r.label),function(){n.explodeStatement(e.get("body"),r.label)}),n.mark(a);break;case"WhileStatement":var s=i(),a=i();n.mark(s),n.jumpIfNot(n.explodeExpression(e.get("test")),a),n.leapManager.withEntry(new f.LoopEntry(a,s,t),function(){n.explodeStatement(e.get("body"))}),n.jump(s),n.mark(a);break;case"DoWhileStatement":var o=i(),y=i(),a=i();n.mark(o),n.leapManager.withEntry(new f.LoopEntry(a,y,t),function(){n.explode(e.get("body"))}),n.mark(y),n.jumpIf(n.explodeExpression(e.get("test")),o),n.mark(a);break;case"ForStatement":var g=i(),v=i(),a=i();r.init&&n.explode(e.get("init"),!0),n.mark(g),r.test&&n.jumpIfNot(n.explodeExpression(e.get("test")),a),n.leapManager.withEntry(new f.LoopEntry(a,v,t),function(){n.explodeStatement(e.get("body"))}),n.mark(v),r.update&&n.explode(e.get("update"),!0),n.jump(g),n.mark(a);break;case"ForInStatement":var g=i(),a=i(),b=n.makeTempVar();n.emitAssign(b,l.callExpression(m("keys"),[n.explodeExpression(e.get("right"))])),n.mark(g);var E=n.makeTempVar();n.jumpIf(l.memberExpression(l.assignmentExpression("=",E,l.callExpression(b,[])),l.identifier("done"),!1),a),n.emitAssign(r.left,l.memberExpression(E,l.identifier("value"),!1)),n.leapManager.withEntry(new f.LoopEntry(a,g,t),function(){n.explodeStatement(e.get("body"))}),n.jump(g),n.mark(a);break;case"BreakStatement":n.emitAbruptCompletion({type:"break",target:n.leapManager.getBreakLoc(r.label)});break;case"ContinueStatement":n.emitAbruptCompletion({type:"continue",target:n.leapManager.getContinueLoc(r.label)});break;case"SwitchStatement":for(var x=n.emitAssign(n.makeTempVar(),n.explodeExpression(e.get("discriminant"))),a=i(),S=i(),A=S,D=[],C=r.cases||[],w=C.length-1;w>=0;--w){var I=C[w];c.SwitchCase.assert(I),I.test?A=l.conditionalExpression(l.binaryExpression("===",x,I.test),D[w]=i(),A):D[w]=S}n.jump(n.explodeExpression(new p.NodePath(A,e,"discriminant"))),n.leapManager.withEntry(new f.SwitchEntry(a),function(){e.get("cases").each(function(e){var t=(e.value,e.name);n.mark(D[t]),e.get("consequent").each(n.explodeStatement,n)})}),n.mark(a),-1===S.value&&(n.mark(S),u.strictEqual(a.value,S.value));break;case"IfStatement":var _=r.alternate&&i(),a=i();n.jumpIfNot(n.explodeExpression(e.get("test")),_||a),n.explodeStatement(e.get("consequent")),_&&(n.jump(a),n.mark(_),n.explodeStatement(e.get("alternate"))),n.mark(a);break;case"ReturnStatement":n.emitAbruptCompletion({type:"return",value:n.explodeExpression(e.get("argument"))});break;case"WithStatement":throw new Error(node.type+" not supported in generator functions.");case"TryStatement":var a=i(),F=r.handler;!F&&r.handlers&&(F=r.handlers[0]||null);var k=F&&i(),P=k&&new f.CatchEntry(k,F.param),B=r.finalizer&&i(),T=B&&new f.FinallyEntry(B,a),M=new f.TryEntry(n.getUnmarkedCurrentLoc(),P,T);n.tryEntries.push(M),n.updateContextPrevLoc(M.firstLoc),n.leapManager.withEntry(M,function(){if(n.explodeStatement(e.get("block")),k){B?n.jump(B):n.jump(a),n.updateContextPrevLoc(n.mark(k));var t=e.get("handler","body"),r=n.makeTempVar();n.clearPendingException(M.firstLoc,r);var i=t.scope,s=F.param.name;c.CatchClause.assert(i.node),u.strictEqual(i.lookup(s),i),p.visit(t,{visitIdentifier:function(e){return h.isReference(e,s)&&e.scope.lookup(s)===i?r:void this.traverse(e)},visitFunction:function(e){return e.scope.declares(s)?!1:void this.traverse(e)}}),n.leapManager.withEntry(P,function(){n.explodeStatement(t)})}B&&(n.updateContextPrevLoc(n.mark(B)),n.leapManager.withEntry(T,function(){n.explodeStatement(e.get("finalizer"))}),n.emit(l.returnStatement(l.callExpression(n.contextProperty("finish"),[T.firstLoc]))))}),n.mark(a);break;case"ThrowStatement":n.emit(l.throwStatement(n.explodeExpression(e.get("argument"))));break;default:throw new Error("unknown Statement of type "+JSON.stringify(r.type))}},g.emitAbruptCompletion=function(e){o(e)||u.ok(!1,"invalid completion record: "+JSON.stringify(e)),u.notStrictEqual(e.type,"normal","normal completions are not abrupt");var t=[l.literal(e.type)];"break"===e.type||"continue"===e.type?(c.Literal.assert(e.target),t[1]=e.target):("return"===e.type||"throw"===e.type)&&e.value&&(c.Expression.assert(e.value),t[1]=e.value),this.emit(l.returnStatement(l.callExpression(this.contextProperty("abrupt"),t)))},g.getUnmarkedCurrentLoc=function(){return l.literal(this.listing.length)},g.updateContextPrevLoc=function(e){e?(c.Literal.assert(e),-1===e.value?e.value=this.listing.length:u.strictEqual(e.value,this.listing.length)):e=this.getUnmarkedCurrentLoc(),this.emitAssign(this.contextProperty("prev"),e)},g.explodeExpression=function(e,t){function r(e){return c.Expression.assert(e),t?void o.emit(e):e}function n(e,t,r){u.ok(t instanceof p.NodePath),u.ok(!r||!e,"Ignoring the result of a child expression but forcing it to be assigned to a temporary variable?");var n=o.explodeExpression(t,r);return r||(e||f&&!c.Literal.check(n))&&(n=o.emitAssign(e||o.makeTempVar(),n)),n}u.ok(e instanceof p.NodePath);var a=e.value;if(!a)return a;c.Expression.assert(a);var s,o=this;if(!d.containsLeap(a))return r(a);var f=d.containsLeap.onlyChildren(a);switch(a.type){case"MemberExpression":return r(l.memberExpression(o.explodeExpression(e.get("object")),a.computed?n(null,e.get("property")):a.property,a.computed));case"CallExpression":var h,m=e.get("callee"),y=e.get("arguments"),g=[],v=!1;if(y.each(function(e){v=v||d.containsLeap(e.value)}),c.MemberExpression.check(m.value))if(v){var b=n(o.makeTempVar(),m.get("object")),E=m.value.computed?n(null,m.get("property")):m.value.property;g.unshift(b),h=l.memberExpression(l.memberExpression(b,E,m.value.computed),l.identifier("call"),!1)}else h=o.explodeExpression(m);else h=o.explodeExpression(m),c.MemberExpression.check(h)&&(h=l.sequenceExpression([l.literal(0),h]));return y.each(function(e){g.push(n(null,e))}),r(l.callExpression(h,g));case"NewExpression":return r(l.newExpression(n(null,e.get("callee")),e.get("arguments").map(function(e){return n(null,e)})));case"ObjectExpression":return r(l.objectExpression(e.get("properties").map(function(e){return l.property(e.value.kind,e.value.key,n(null,e.get("value")))})));case"ArrayExpression":return r(l.arrayExpression(e.get("elements").map(function(e){return n(null,e)})));case"SequenceExpression":var x=a.expressions.length-1;return e.get("expressions").each(function(e){e.name===x?s=o.explodeExpression(e,t):o.explodeExpression(e,!0)}),s;case"LogicalExpression":var S=i();t||(s=o.makeTempVar());var A=n(s,e.get("left"));return"&&"===a.operator?o.jumpIfNot(A,S):(u.strictEqual(a.operator,"||"),o.jumpIf(A,S)),n(s,e.get("right"),t),o.mark(S),s;case"ConditionalExpression":var D=i(),S=i(),C=o.explodeExpression(e.get("test"));return o.jumpIfNot(C,D),t||(s=o.makeTempVar()),n(s,e.get("consequent"),t),o.jump(S),o.mark(D),n(s,e.get("alternate"),t),o.mark(S),s;case"UnaryExpression":return r(l.unaryExpression(a.operator,o.explodeExpression(e.get("argument")),!!a.prefix));case"BinaryExpression":return r(l.binaryExpression(a.operator,n(null,e.get("left")),n(null,e.get("right"))));case"AssignmentExpression":return r(l.assignmentExpression(a.operator,o.explodeExpression(e.get("left")),o.explodeExpression(e.get("right"))));case"UpdateExpression":return r(l.updateExpression(a.operator,o.explodeExpression(e.get("argument")),a.prefix));case"YieldExpression":var S=i(),w=a.argument&&o.explodeExpression(e.get("argument"));if(w&&a.delegate){var s=o.makeTempVar();return o.emit(l.returnStatement(l.callExpression(o.contextProperty("delegateYield"),[w,l.literal(s.property.name),S]))),o.mark(S),s}return o.emitAssign(o.contextProperty("next"),S),o.emit(l.returnStatement(w||null)),o.mark(S),o.contextProperty("sent");default:throw new Error("unknown Expression of type "+JSON.stringify(a.type))}}},{1:1,539:539,540:540,541:541,568:568}],538:[function(e,t,r){var n=e(1),i=e(568).types,a=i.namedTypes,s=i.builders,o=Object.prototype.hasOwnProperty;r.hoist=function(e){function t(e,t){a.VariableDeclaration.assert(e);var n=[];return e.declarations.forEach(function(e){r[e.id.name]=e.id,e.init?n.push(s.assignmentExpression("=",e.id,e.init)):t&&n.push(e.id)}),0===n.length?null:1===n.length?n[0]:s.sequenceExpression(n)}n.ok(e instanceof i.NodePath),a.Function.assert(e.value);var r={};i.visit(e.get("body"),{visitVariableDeclaration:function(e){var r=t(e.value,!1);return null!==r?s.expressionStatement(r):(e.replace(),!1)},visitForStatement:function(e){var r=e.value.init;a.VariableDeclaration.check(r)&&e.get("init").replace(t(r,!1)),this.traverse(e)},visitForInStatement:function(e){var r=e.value.left;a.VariableDeclaration.check(r)&&e.get("left").replace(t(r,!0)),this.traverse(e)},visitFunctionDeclaration:function(e){var t=e.value;r[t.id.name]=t.id;var n=(e.parent.node,s.expressionStatement(s.assignmentExpression("=",t.id,s.functionExpression(t.id,t.params,t.body,t.generator,t.expression))));return a.BlockStatement.check(e.parent.node)?(e.parent.get("body").unshift(n),e.replace()):e.replace(n),!1},visitFunctionExpression:function(e){return!1}});var u={};e.get("params").each(function(e){var t=e.value;a.Identifier.check(t)&&(u[t.name]=t)});var p=[];return Object.keys(r).forEach(function(e){o.call(u,e)||p.push(s.variableDeclarator(r[e],null))}),0===p.length?null:s.variableDeclaration("var",p)}},{1:1,568:568}],539:[function(e,t,r){function n(){f.ok(this instanceof n)}function i(e){n.call(this),h.Literal.assert(e),this.returnLoc=e}function a(e,t,r){n.call(this),h.Literal.assert(e),h.Literal.assert(t),r?h.Identifier.assert(r):r=null,this.breakLoc=e,this.continueLoc=t,this.label=r}function s(e){n.call(this),h.Literal.assert(e),this.breakLoc=e}function o(e,t,r){n.call(this),h.Literal.assert(e),t?f.ok(t instanceof u):t=null,r?f.ok(r instanceof p):r=null,f.ok(t||r),this.firstLoc=e,this.catchEntry=t,this.finallyEntry=r}function u(e,t){n.call(this),h.Literal.assert(e),h.Identifier.assert(t),this.firstLoc=e,this.paramId=t}function p(e,t){n.call(this),h.Literal.assert(e),h.Literal.assert(t),this.firstLoc=e,this.afterLoc=t}function l(e,t){n.call(this),h.Literal.assert(e),h.Identifier.assert(t),this.breakLoc=e,this.label=t}function c(t){f.ok(this instanceof c);var r=e(537).Emitter;f.ok(t instanceof r),this.emitter=t,this.entryStack=[new i(t.finalLoc)]}var f=e(1),d=e(568).types,h=d.namedTypes,m=(d.builders,e(13).inherits);Object.prototype.hasOwnProperty;m(i,n),r.FunctionEntry=i,m(a,n),r.LoopEntry=a,m(s,n),r.SwitchEntry=s,m(o,n),r.TryEntry=o,m(u,n),r.CatchEntry=u,m(p,n),r.FinallyEntry=p,m(l,n),r.LabeledEntry=l;var y=c.prototype;r.LeapManager=c,y.withEntry=function(e,t){f.ok(e instanceof n),this.entryStack.push(e);try{t.call(this.emitter)}finally{var r=this.entryStack.pop();f.strictEqual(r,e)}},y._findLeapLocation=function(e,t){for(var r=this.entryStack.length-1;r>=0;--r){var n=this.entryStack[r],i=n[e];if(i)if(t){if(n.label&&n.label.name===t.name)return i}else if(!(n instanceof l))return i}return null},y.getBreakLoc=function(e){return this._findLeapLocation("breakLoc",e)},y.getContinueLoc=function(e){return this._findLeapLocation("continueLoc",e)}},{1:1,13:13,537:537,568:568}],540:[function(e,t,r){function n(e,t){function r(e){function t(e){return r||(o.check(e)?e.some(t):u.Node.check(e)&&(i.strictEqual(r,!1),r=n(e))),r}u.Node.assert(e);var r=!1;return s.eachField(e,function(e,r){t(r)}),r}function n(n){u.Node.assert(n);var i=a(n);return p.call(i,e)?i[e]:p.call(l,n.type)?i[e]=!1:p.call(t,n.type)?i[e]=!0:i[e]=r(n)}return n.onlyChildren=r,n}var i=e(1),a=e(536).makeAccessor(),s=e(568).types,o=s.builtInTypes.array,u=s.namedTypes,p=Object.prototype.hasOwnProperty,l={FunctionExpression:!0},c={CallExpression:!0,ForInStatement:!0,UnaryExpression:!0,BinaryExpression:!0,AssignmentExpression:!0,UpdateExpression:!0,NewExpression:!0},f={YieldExpression:!0,BreakStatement:!0,ContinueStatement:!0,ReturnStatement:!0,ThrowStatement:!0};for(var d in f)p.call(f,d)&&(c[d]=f[d]);r.hasSideEffects=n("hasSideEffects",c),r.containsLeap=n("containsLeap",f)},{1:1,536:536,568:568}],541:[function(e,t,r){var n=(e(1),e(568).types),i=n.namedTypes,a=n.builders,s=Object.prototype.hasOwnProperty;r.defaults=function(e){for(var t,r=arguments.length,n=1;r>n;++n)if(t=arguments[n])for(var i in t)s.call(t,i)&&!s.call(e,i)&&(e[i]=t[i]);return e},r.runtimeProperty=function(e){return a.memberExpression(a.identifier("regeneratorRuntime"),a.identifier(e),!1)},r.isReference=function(e,t){var r=e.value;if(!i.Identifier.check(r))return!1;if(t&&r.name!==t)return!1;var n=e.parent.value;switch(n.type){case"VariableDeclarator":return"init"===e.name;case"MemberExpression":return"object"===e.name||n.computed&&"property"===e.name;case"FunctionExpression":case"FunctionDeclaration":case"ArrowFunctionExpression":return"id"===e.name?!1:"params"===e.parentPath.name&&n.params===e.parentPath.value&&n.params[e.name]===r?!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}}},{1:1,568:568}],542:[function(e,t,r){function n(t){f.Program.assert(t);var r=e(543).runtime.path,n=p.readFileSync(r,"utf8"),i=l.parse(n,{sourceFileName:r}).program.body,a=t.body;a.unshift.apply(a,i)}function i(e){var t=e.value;if(f.Function.assert(t),t.generator&&f.FunctionDeclaration.check(t)){for(var r=e.parent;r&&!f.BlockStatement.check(r.value)&&!f.Program.check(r.value);)r=r.parent;if(!r)return t.id;var n=a(r),i=n.declarations[0].id,s=n.declarations[0].init.callee.object;f.ArrayExpression.assert(s);var o=s.elements.length;return s.elements.push(t.id),d.memberExpression(i,d.literal(o),!0)}return t.id||(t.id=e.scope.parent.declareTemporary("callee$"))}function a(e){u.ok(e instanceof m);var t=e.node;h.assert(t.body);var r=E(t);if(r.decl)return r.decl;r.decl=d.variableDeclaration("var",[d.variableDeclarator(e.scope.declareTemporary("marked"),d.callExpression(d.memberExpression(d.arrayExpression([]),d.identifier("map"),!1),[b("mark")]))]);for(var n=0;n<t.body.length&&s(e.get("body",n));++n);return e.get("body").insertAt(n,r.decl),r.decl}function s(e){var t=e.value;return f.Statement.assert(t),f.ExpressionStatement.check(t)&&f.Literal.check(t.expression)&&"use strict"===t.expression.value}function o(e,t){u.ok(e instanceof c.NodePath);var r=e.value,n=!1;return l.visit(e,{visitFunction:function(e){return e.value!==r?!1:void this.traverse(e)},visitIdentifier:function(e){return"arguments"===e.value.name&&v.isReference(e)?(e.replace(t),n=!0,!1):void this.traverse(e)}}),n}var u=e(1),p=e(3),l=e(568),c=l.types,f=c.namedTypes,d=c.builders,h=c.builtInTypes.array,m=(c.builtInTypes.object,c.NodePath),y=e(538).hoist,g=e(537).Emitter,v=e(541),b=v.runtimeProperty,E=e(536).makeAccessor();r.transform=function(e,t){t=t||{};var r=e instanceof m?e:new m(e);return x.visit(r,t),e=r.value,(t.includeRuntime===!0||"if used"===t.includeRuntime&&x.wasChangeReported())&&n(f.File.check(e)?e.program:e),t.madeChanges=x.wasChangeReported(),e};var x=c.PathVisitor.fromMethodsObject({reset:function(e,t){this.options=t},visitFunction:function(e){this.traverse(e);var t=e.value,r=t.async&&!this.options.disableAsync;if(t.generator||r){this.reportChanged(),t.expression&&(t.expression=!1,t.body=d.blockStatement([d.returnStatement(t.body)])),r&&S.visit(e.get("body"));var n=[],a=[],s=e.get("body","body");s.each(function(e){var t=e.value;t&&null!=t._blockHoist?n.push(t):a.push(t)}),n.length>0&&s.replace(a);var u=i(e);f.Identifier.assert(t.id);var p=d.identifier(t.id.name+"$"),l=e.scope.declareTemporary("context$"),c=e.scope.declareTemporary("args$"),h=y(e),m=o(e,c);m&&(h=h||d.variableDeclaration("var",[]),h.declarations.push(d.variableDeclarator(c,d.identifier("arguments"))));var v=new g(l);v.explode(e.get("body")),h&&h.declarations.length>0&&n.push(h);var E=[v.getContextFunction(p),t.generator?u:d.literal(null),d.thisExpression()],x=v.getTryLocsList();x&&E.push(x);var A=d.callExpression(b(r?"async":"wrap"),E);n.push(d.returnStatement(A)),t.body=d.blockStatement(n);var D=t.generator;return D&&(t.generator=!1),r&&(t.async=!1),D&&f.Expression.check(t)?d.callExpression(b("mark"),[t]):void 0}},visitForOfStatement:function(e){this.traverse(e);var t,r=e.value,n=e.scope.declareTemporary("t$"),i=d.variableDeclarator(n,d.callExpression(b("values"),[r.right])),a=e.scope.declareTemporary("t$"),s=d.variableDeclarator(a,null),o=r.left;f.VariableDeclaration.check(o)?(t=o.declarations[0].id,o.declarations.push(i,s)):(t=o,o=d.variableDeclaration("var",[i,s])),f.Identifier.assert(t);var u=d.expressionStatement(d.assignmentExpression("=",t,d.memberExpression(a,d.identifier("value"),!1)));return f.BlockStatement.check(r.body)?r.body.body.unshift(u):r.body=d.blockStatement([u,r.body]),d.forStatement(o,d.unaryExpression("!",d.memberExpression(d.assignmentExpression("=",a,d.callExpression(d.memberExpression(n,d.identifier("next"),!1),[])),d.identifier("done"),!1)),null,r.body)}}),S=c.PathVisitor.fromMethodsObject({visitFunction:function(e){return!1},visitAwaitExpression:function(e){var t=e.value.argument;return e.value.all&&(t=d.callExpression(d.memberExpression(d.identifier("Promise"),d.identifier("all"),!1),[t])),d.yieldExpression(d.callExpression(b("awrap"),[t]),!1)}})},{1:1,3:3,536:536,537:537,538:538,541:541,543:543,568:568}],543:[function(e,t,r){(function(r){function n(e,t){function r(e){i.push(e)}function n(){this.queue(a(i.join(""),t).code),this.queue(null)}var i=[];return h(r,n)}function i(){e(585)}function a(e,t){if(t=s(t),!b.test(e))return{code:(t.includeRuntime===!0?d.readFileSync(f.join(r,"runtime.js"),"utf-8")+"\n":"")+e};var n=o(t),i=g.parse(e,n),a=new v.NodePath(i),p=a.get("program");return u(e,t)&&l(p.node),m(p,t),g.print(a,n)}function s(t){return t=y.defaults(t||{},{includeRuntime:!1,supportBlockBinding:!0}),t.esprima||(t.esprima=e(3)),c.ok(/harmony/.test(t.esprima.version),"Bad esprima version: "+t.esprima.version),t}function o(e){function t(t){t in e&&(r[t]=e[t])}var r={range:!0};return t("esprima"),t("sourceFileName"),t("sourceMapName"),t("inputSourceMap"),t("sourceRoot"),r}function u(e,t){var r=!!t.supportBlockBinding;return r&&(E.test(e)||(r=!1)),r}function p(e,t){var r=o(s(t)),n=g.parse(e,r);return l(n.program),g.print(n,r).code}function l(t){v.namedTypes.Program.assert(t);var r=e(544)(t,{ast:!0,disallowUnknownReferences:!1,disallowDuplicated:!1,disallowVars:!1,loopClosures:"iife"});if(r.errors)throw new Error(r.errors.join("\n"));return t}var c=e(1),f=e(9),d=e(3),h=e(3),m=e(542).transform,y=e(541),g=e(568),v=g.types,b=/\bfunction\s*\*|\basync\b/,E=/\b(let|const)\s+/;t.exports=n,n.runtime=i,i.path=f.join(r,"runtime.js"),n.varify=p,n.types=v,n.compile=a,n.transform=m}).call(this,"/node_modules/regenerator")},{1:1,3:3,541:541,542:542,544:544,568:568,585:585,9:9}],544:[function(e,t,r){"use strict";function n(e){return D.someof(e,["const","let"])}function i(e){return D.someof(e,["var","const","let"])}function a(e){return"BlockStatement"===e.type&&D.noneof(e.$parent.type,["FunctionDeclaration","FunctionExpression"])}function s(e){return"ForStatement"===e.type&&e.init&&"VariableDeclaration"===e.init.type&&n(e.init.kind)}function o(e){return u(e)&&"VariableDeclaration"===e.left.type&&n(e.left.kind)}function u(e){return D.someof(e.type,["ForInStatement","ForOfStatement"])}function p(e){
return D.someof(e.type,["FunctionDeclaration","FunctionExpression"])}function l(e){return D.someof(e.type,["ForStatement","ForInStatement","ForOfStatement","WhileStatement","DoWhileStatement"])}function c(e){var t=e.$parent;return e.$refToScope||"Identifier"===e.type&&!("VariableDeclarator"===t.type&&t.id===e)&&!("MemberExpression"===t.type&&t.computed===!1&&t.property===e)&&!("Property"===t.type&&t.key===e)&&!("LabeledStatement"===t.type&&t.label===e)&&!("CatchClause"===t.type&&t.param===e)&&!(p(t)&&t.id===e)&&!(p(t)&&D.someof(e,t.params))&&!0}function f(e){return c(e)&&("AssignmentExpression"===e.$parent.type&&e.$parent.left===e||"UpdateExpression"===e.$parent.type&&e.$parent.argument===e)}function d(e,t){if(A(!e.$scope),e.$parent=t,e.$scope=e.$parent?e.$parent.$scope:null,"Program"===e.type)e.$scope=new P({kind:"hoist",node:e,parent:null});else if(p(e))e.$scope=new P({kind:"hoist",node:e,parent:e.$parent.$scope}),e.id&&(A("Identifier"===e.id.type),"FunctionDeclaration"===e.type?e.$parent.$scope.add(e.id.name,"fun",e.id,null):"FunctionExpression"===e.type?e.$scope.add(e.id.name,"fun",e.id,null):A(!1)),e.params.forEach(function(t){e.$scope.add(t.name,"param",t,null)});else if("VariableDeclaration"===e.type)A(i(e.kind)),e.declarations.forEach(function(t){A("VariableDeclarator"===t.type);var r=t.id.name;M.disallowVars&&"var"===e.kind&&B(T(t),"var {0} is not allowed (use let or const)",r),e.$scope.add(r,e.kind,t.id,t.range[1])});else if(s(e)||o(e))e.$scope=new P({kind:"block",node:e,parent:e.$parent.$scope});else if(a(e))e.$scope=new P({kind:"block",node:e,parent:e.$parent.$scope});else if("CatchClause"===e.type){var r=e.param;e.$scope=new P({kind:"catch-block",node:e,parent:e.$parent.$scope}),e.$scope.add(r.name,"caught",r,null),e.$scope.closestHoistScope().markPropagates(r.name)}}function h(e,t,r){function n(e){for(var t in e){var r=e[t],n=r?"var":"const";i.hasOwn(t)&&i.remove(t),i.add(t,n,{loc:{start:{line:-1}}},-1)}}var i=new P({kind:"hoist",node:{},parent:null}),a={undefined:!1,Infinity:!1,console:!1};return n(a),n(j.reservedVars),n(j.ecmaIdentifiers),t&&t.forEach(function(e){j[e]?n(j[e]):B(-1,'environment "{0}" not found',e)}),r&&n(r),e.parent=i,i.children.push(e),i}function m(e,t,r){function n(e){if(c(e)){t.add(e.name);var r=e.$scope.lookup(e.name);if(i&&!r&&M.disallowUnknownReferences&&B(T(e),"reference to unknown global variable {0}",e.name),i&&r&&D.someof(r.getKind(e.name),["const","let"])){var n=r.getFromPos(e.name),a=e.range[0];A(D.finitenumber(n)),A(D.finitenumber(a)),n>a&&(e.$scope.hasFunctionScopeBetween(r)||B(T(e),"{0} is referenced before its declaration",e.name))}e.$refToScope=r}}var i=D.own(r,"analyze")?r.analyze:!0;F(e,{pre:n})}function y(e,t,r,i){function a(e){A(r.has(e));for(var t=0;;t++){var n=e+"$"+String(t);if(!r.has(n))return n}}function s(e){if("VariableDeclaration"===e.type&&n(e.kind)){var s=e.$scope.closestHoistScope(),o=e.$scope;i.push({start:e.range[0],end:e.range[0]+e.kind.length,str:"var"}),e.declarations.forEach(function(n){A("VariableDeclarator"===n.type);var u=n.id.name;t.declarator(e.kind);var p=o!==s&&(s.hasOwn(u)||s.doesPropagate(u)),l=p?a(u):u;o.remove(u),s.add(l,"var",n.id,n.range[1]),o.moves=o.moves||w(),o.moves.set(u,{name:l,scope:s}),r.add(l),l!==u&&(t.rename(u,l,T(n)),n.id.originalName=u,n.id.name=l,i.push({start:n.id.range[0],end:n.id.range[1],str:l}))}),e.kind="var"}}function o(e){if(e.$refToScope){var t=e.$refToScope.moves&&e.$refToScope.moves.get(e.name);if(t&&(e.$refToScope=t.scope,e.name!==t.name))if(e.originalName=e.name,e.name=t.name,e.alterop){for(var r=null,n=0;n<i.length;n++){var a=i[n];if(a.node===e){r=a;break}}A(r),r.str=t.name}else i.push({start:e.range[0],end:e.range[1],str:t.name})}}F(e,{pre:s}),F(e,{pre:o}),e.$scope.traverse({pre:function(e){delete e.moves}})}function g(e){function t(e,t){return k(function(r){return F(e,{pre:function(e){if(p(e))return!1;var n=!0,i="loop-variable {0} is captured by a loop-closure that can't be transformed due to use of {1} at line {2}";"BreakStatement"===e.type?B(T(t),i,t.name,"break",T(e)):"ContinueStatement"===e.type?B(T(t),i,t.name,"continue",T(e)):"ReturnStatement"===e.type?B(T(t),i,t.name,"return",T(e)):"YieldExpression"===e.type?B(T(t),i,t.name,"yield",T(e)):"Identifier"===e.type&&"arguments"===e.name?B(T(t),i,t.name,"arguments",T(e)):"VariableDeclaration"===e.type&&"var"===e.kind?B(T(t),i,t.name,"var",T(e)):n=!1,n&&r(!0)}}),!1})}function r(e){var r=null;if(c(e)&&e.$refToScope&&n(e.$refToScope.getKind(e.name))){for(var i=e.$refToScope.node;;){if(p(i))return;if(l(i)){r=i;break}if(i=i.$parent,!i)return}A(l(r));for(var a=e.$refToScope,s="iife"===M.loopClosures,o=e.$scope;o;o=o.parent){if(o===a)return;if(p(o.node)){if(!s){var u='loop-variable {0} is captured by a loop-closure. Tried "loopClosures": "iife" in defs-config.json?';return B(T(e),u,e.name)}if("ForStatement"===r.type&&a.node===r){var f=a.getNode(e.name);return B(T(f),"Not yet specced ES6 feature. {0} is declared in for-loop header and then captured in loop closure",f.name)}if(t(r.body,e))return;r.$iify=!0}}}}F(e,{pre:r})}function v(e,t,r){function n(e,r,n){var i={start:e,end:e,str:r};n&&(i.node=n),t.push(i)}F(e,{pre:function(e){if(e.$iify){var t="BlockStatement"===e.body.type,i=t?e.body.range[0]+1:e.body.range[0],a=t?e.body.range[1]-1:e.body.range[1],s=u(e)&&e.left.declarations[0].id.name,o=C("(function({0}){",s?s:""),p=C("}).call(this{0});",s?", "+s:""),l=r.parse(o+p),c=l.body[0],f=c.expression.callee.object.body;if(t){var d=e.body,h=d.body;d.body=[c],f.body=h}else{var m=e.body;e.body=c,f.body[0]=m}if(n(i,o),s){n(a,"}).call(this, ");var y=c.expression.arguments,g=y[1];g.alterop=!0,n(a,s,g),n(a,");")}else n(a,p)}}})}function b(e){F(e,{pre:function(e){if(f(e)){var t=e.$scope.lookup(e.name);t&&"const"===t.getKind(e.name)&&B(T(e),"can't assign to const variable {0}",e.name)}}})}function E(e,t){F(e,{pre:d});var r=h(e.$scope,M.environments,M.globals),n=I();return r.traverse({pre:function(e){n.addMany(e.decls.keys())}}),m(e,n,t),n}function x(e){F(e,{pre:function(e){for(var t in e)"$"===t[0]&&delete e[t]}})}function S(e,t){for(var r in t)M[r]=t[r];var n;if(D.object(e)){if(!M.ast)return{errors:["Can't produce string output when input is an AST. Did you forget to set options.ast = true?"]};n=e}else{if(!D.string(e))return{errors:["Input was neither an AST object nor a string."]};try{n=M.parse(e,{loc:!0,range:!0})}catch(i){return{errors:[C("line {0} column {1}: Error during input file parsing\n{2}\n{3}",i.lineNumber,i.column,e.split("\n")[i.lineNumber-1],C.repeat(" ",i.column-1)+"^")]}}}var a=n;B.reset();var s=E(a,{});g(a),b(a);var o=[];if(v(a,o,M),B.errors.length>=1)return{errors:B.errors};o.length>0&&(x(a),s=E(a,{analyze:!1})),A(0===B.errors.length);var u=new O;if(y(a,u,s,o),M.ast)return x(a),{stats:u,ast:a};var p=_(e,o);return{stats:u,src:p}}var A=e(1),D=e(555),C=e(554),w=e(556),I=e(557),_=e(550),F=e(552),k=e(553),P=e(548),B=e(545),T=B.getline,M=e(547),O=e(549),j=e(546);t.exports=S},{1:1,545:545,546:546,547:547,548:548,549:549,550:550,552:552,553:553,554:554,555:555,556:556,557:557}],545:[function(e,t,r){"use strict";function n(e,t){a(arguments.length>=2);var r=2===arguments.length?String(t):i.apply(i,Array.prototype.slice.call(arguments,1));n.errors.push(-1===e?r:i("line {0}: {1}",e,r))}var i=e(554),a=e(1);n.reset=function(){n.errors=[]},n.getline=function(e){return e&&e.loc&&e.loc.start?e.loc.start.line:-1},n.reset(),t.exports=n},{1:1,554:554}],546:[function(e,t,r){"use strict";r.reservedVars={arguments:!1,NaN:!1},r.ecmaIdentifiers={Array:!1,Boolean:!1,Date:!1,decodeURI:!1,decodeURIComponent:!1,encodeURI:!1,encodeURIComponent:!1,Error:!1,eval:!1,EvalError:!1,Function:!1,hasOwnProperty:!1,isFinite:!1,isNaN:!1,JSON:!1,Math:!1,Map:!1,Number:!1,Object:!1,parseInt:!1,parseFloat:!1,RangeError:!1,ReferenceError:!1,RegExp:!1,Set:!1,String:!1,SyntaxError:!1,TypeError:!1,URIError:!1,WeakMap:!1},r.browser={ArrayBuffer:!1,ArrayBufferView:!1,Audio:!1,Blob:!1,addEventListener:!1,applicationCache:!1,atob:!1,blur:!1,btoa:!1,clearInterval:!1,clearTimeout:!1,close:!1,closed:!1,DataView:!1,DOMParser:!1,defaultStatus:!1,document:!1,Element:!1,event:!1,FileReader:!1,Float32Array:!1,Float64Array:!1,FormData:!1,focus:!1,frames:!1,getComputedStyle:!1,HTMLElement:!1,HTMLAnchorElement:!1,HTMLBaseElement:!1,HTMLBlockquoteElement:!1,HTMLBodyElement:!1,HTMLBRElement:!1,HTMLButtonElement:!1,HTMLCanvasElement:!1,HTMLDirectoryElement:!1,HTMLDivElement:!1,HTMLDListElement:!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,history:!1,Int16Array:!1,Int32Array:!1,Int8Array:!1,Image:!1,length:!1,localStorage:!1,location:!1,MessageChannel:!1,MessageEvent:!1,MessagePort:!1,moveBy:!1,moveTo:!1,MutationObserver:!1,name:!1,Node:!1,NodeFilter:!1,navigator:!1,onbeforeunload:!0,onblur:!0,onerror:!0,onfocus:!0,onload:!0,onresize:!0,onunload:!0,open:!1,openDatabase:!1,opener:!1,Option:!1,parent:!1,print:!1,removeEventListener:!1,resizeBy:!1,resizeTo:!1,screen:!1,scroll:!1,scrollBy:!1,scrollTo:!1,sessionStorage:!1,setInterval:!1,setTimeout:!1,SharedWorker:!1,status:!1,top:!1,Uint16Array:!1,Uint32Array:!1,Uint8Array:!1,Uint8ClampedArray:!1,WebSocket:!1,window:!1,Worker:!1,XMLHttpRequest:!1,XMLSerializer:!1,XPathEvaluator:!1,XPathException:!1,XPathExpression:!1,XPathNamespace:!1,XPathNSResolver:!1,XPathResult:!1},r.devel={alert:!1,confirm:!1,console:!1,Debug:!1,opera:!1,prompt:!1},r.worker={importScripts:!0,postMessage:!0,self:!0},r.nonstandard={escape:!1,unescape:!1},r.couch={require:!1,respond:!1,getRow:!1,emit:!1,send:!1,start:!1,sum:!1,log:!1,exports:!1,module:!1,provides:!1},r.node={__filename:!1,__dirname:!1,Buffer:!1,DataView:!1,console:!1,exports:!0,GLOBAL:!1,global:!1,module:!1,process:!1,require:!1,setTimeout:!1,clearTimeout:!1,setInterval:!1,clearInterval:!1},r.phantom={phantom:!0,require:!0,WebPage:!0},r.rhino={defineClass:!1,deserialize:!1,gc:!1,help:!1,importPackage:!1,java:!1,load:!1,loadClass:!1,print:!1,quit:!1,readFile:!1,readUrl:!1,runCommand:!1,seal:!1,serialize:!1,spawn:!1,sync:!1,toint32:!1,version:!1},r.wsh={ActiveXObject:!0,Enumerator:!0,GetObject:!0,ScriptEngine:!0,ScriptEngineBuildVersion:!0,ScriptEngineMajorVersion:!0,ScriptEngineMinorVersion:!0,VBArray:!0,WSH:!0,WScript:!0,XDomainRequest:!0},r.dojo={dojo:!1,dijit:!1,dojox:!1,define:!1,require:!1},r.jquery={$:!1,jQuery:!1},r.mootools={$:!1,$$:!1,Asset:!1,Browser:!1,Chain:!1,Class:!1,Color:!1,Cookie:!1,Core:!1,Document:!1,DomReady:!1,DOMEvent:!1,DOMReady:!1,Drag:!1,Element:!1,Elements:!1,Event:!1,Events:!1,Fx:!1,Group:!1,Hash:!1,HtmlTable:!1,Iframe:!1,IframeShim:!1,InputValidator:!1,instanceOf:!1,Keyboard:!1,Locale:!1,Mask:!1,MooTools:!1,Native:!1,Options:!1,OverText:!1,Request:!1,Scroller:!1,Slick:!1,Slider:!1,Sortables:!1,Spinner:!1,Swiff:!1,Tips:!1,Type:!1,typeOf:!1,URI:!1,Window:!1},r.prototypejs={$:!1,$$:!1,$A:!1,$F:!1,$H:!1,$R:!1,$break:!1,$continue:!1,$w:!1,Abstract:!1,Ajax:!1,Class:!1,Enumerable:!1,Element:!1,Event:!1,Field:!1,Form:!1,Hash:!1,Insertion:!1,ObjectRange:!1,PeriodicalExecuter:!1,Position:!1,Prototype:!1,Selector:!1,Template:!1,Toggle:!1,Try:!1,Autocompleter:!1,Builder:!1,Control:!1,Draggable:!1,Draggables:!1,Droppables:!1,Effect:!1,Sortable:!1,SortableObserver:!1,Sound:!1,Scriptaculous:!1},r.yui={YUI:!1,Y:!1,YUI_config:!1}},{}],547:[function(e,t,r){t.exports={disallowVars:!1,disallowDuplicated:!0,disallowUnknownReferences:!0,parse:e(3).parse}},{3:3}],548:[function(e,t,r){"use strict";function n(e){i(o.someof(e.kind,["hoist","block","catch-block"])),i(o.object(e.node)),i(null===e.parent||o.object(e.parent)),this.kind=e.kind,this.node=e.node,this.parent=e.parent,this.children=[],this.decls=a(),this.written=s(),this.propagates="hoist"===this.kind?s():null,this.parent&&this.parent.children.push(this)}var i=e(1),a=e(556),s=e(557),o=e(555),u=e(554),p=e(545),l=p.getline,c=e(547);n.prototype.print=function(e){e=e||0;var t=this,r=this.decls.keys().map(function(e){return u("{0} [{1}]",e,t.decls.get(e).kind)}).join(", "),n=this.propagates?this.propagates.items().join(", "):"";console.log(u("{0}{1}: {2}. propagates: {3}",u.repeat(" ",e),this.node.type,r,n)),this.children.forEach(function(t){t.print(e+2)})},n.prototype.add=function(e,t,r,n){function a(e){return o.someof(e,["const","let"])}i(o.someof(t,["fun","param","var","caught","const","let"]));var s=this;if(o.someof(t,["fun","param","var"]))for(;"hoist"!==s.kind;){if(s.decls.has(e)&&a(s.decls.get(e).kind))return p(l(r),"{0} is already declared",e);s=s.parent}if(s.decls.has(e)&&(c.disallowDuplicated||a(s.decls.get(e).kind)||a(t)))return p(l(r),"{0} is already declared",e);var u={kind:t,node:r};n&&(i(o.someof(t,["var","const","let"])),u.from=n),s.decls.set(e,u)},n.prototype.getKind=function(e){i(o.string(e));var t=this.decls.get(e);return t?t.kind:null},n.prototype.getNode=function(e){i(o.string(e));var t=this.decls.get(e);return t?t.node:null},n.prototype.getFromPos=function(e){i(o.string(e));var t=this.decls.get(e);return t?t.from:null},n.prototype.hasOwn=function(e){return this.decls.has(e)},n.prototype.remove=function(e){return this.decls.remove(e)},n.prototype.doesPropagate=function(e){return this.propagates.has(e)},n.prototype.markPropagates=function(e){this.propagates.add(e)},n.prototype.closestHoistScope=function(){for(var e=this;"hoist"!==e.kind;)e=e.parent;return e},n.prototype.hasFunctionScopeBetween=function(e){function t(e){return o.someof(e.type,["FunctionDeclaration","FunctionExpression"])}for(var r=this;r;r=r.parent){if(r===e)return!1;if(t(r.node))return!0}throw new Error("wasn't inner scope of outer")},n.prototype.lookup=function(e){for(var t=this;t;t=t.parent){if(t.decls.has(e))return t;"hoist"===t.kind&&t.propagates.add(e)}return null},n.prototype.markWrite=function(e){i(o.string(e)),this.written.add(e)},n.prototype.detectUnmodifiedLets=function(){function e(r){r!==t&&r.decls.keys().forEach(function(e){return"let"!==r.getKind(e)||r.written.has(e)?void 0:p(l(r.getNode(e)),"{0} is declared as let but never modified so could be const",e)}),r.children.forEach(function(t){e(t)})}var t=this;e(this)},n.prototype.traverse=function(e){function t(e){r&&r(e),e.children.forEach(function(e){t(e)}),n&&n(e)}e=e||{};var r=e.pre,n=e.post;t(this)},t.exports=n},{1:1,545:545,547:547,554:554,555:555,556:556,557:557}],549:[function(e,t,r){function n(){this.lets=0,this.consts=0,this.renames=[]}var i=e(554),a=e(555),s=e(1);n.prototype.declarator=function(e){s(a.someof(e,["const","let"])),"const"===e?this.consts++:this.lets++},n.prototype.rename=function(e,t,r){this.renames.push({oldName:e,newName:t,line:r})},n.prototype.toString=function(){var e=this.renames.map(function(e){return e}).sort(function(e,t){return e.line-t.line}),t=e.map(function(e){return i("\nline {0}: {1} => {2}",e.line,e.oldName,e.newName)}).join(""),r=this.consts+this.lets,n=0===r?"can't calculate const coverage (0 consts, 0 lets)":i("{0}% const coverage ({1} consts, {2} lets)",Math.floor(100*this.consts/r),this.consts,this.lets);return n+t+"\n"},t.exports=n},{1:1,554:554,555:555}],550:[function(e,t,r){function n(e,t){"use strict";var r=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};i("string"==typeof e),i(r(t));for(var n=a(t,function(e,t){return e.start-t.start}),s=[],o=0,u=0;u<n.length;u++){var p=n[u];i(o<=p.start),i(p.start<=p.end),s.push(e.slice(o,p.start)),s.push(p.str),o=p.end}return o<e.length&&s.push(e.slice(o)),s.join("")}var i=e(1),a=e(551);"undefined"!=typeof t&&"undefined"!=typeof t.exports&&(t.exports=n)},{1:1,551:551}],551:[function(e,t,r){!function(){function e(e,t){"function"!=typeof t&&(t=function(e,t){return String(e).localeCompare(t)});var r=e.length;if(1>=r)return e;for(var i=new Array(r),a=1;r>a;a*=2){n(e,t,a,i);var s=e;e=i,i=s}return e}var r=function(t,r){return e(t.slice(),r)};r.inplace=function(t,r){var i=e(t,r);return i!==t&&n(i,null,t.length,t),t};var n=function(e,t,r,n){var i,a,s,o,u,p=e.length,l=0,c=2*r;for(i=0;p>i;i+=c)for(a=i+r,s=a+r,a>p&&(a=p),s>p&&(s=p),o=i,u=a;;)if(a>o&&s>u)t(e[o],e[u])<=0?n[l++]=e[o++]:n[l++]=e[u++];else if(a>o)n[l++]=e[o++];else{if(!(s>u))break;n[l++]=e[u++]}};"undefined"!=typeof t?t.exports=r:window.stable=r}()},{}],552:[function(e,t,r){function n(e,t){"use strict";function r(e,t,s,o){if(e&&"string"==typeof e.type){var u=void 0;if(n&&(u=n(e,t,s,o)),u!==!1)for(var s in e)if(a?!a(s,e):"$"!==s[0]){var p=e[s];if(Array.isArray(p))for(var l=0;l<p.length;l++)r(p[l],e,s,l);else r(p,e,s)}i&&i(e,t,s,o)}}t=t||{};var n=t.pre,i=t.post,a=t.skipProperty;r(e,null)}"undefined"!=typeof t&&"undefined"!=typeof t.exports&&(t.exports=n)},{}],553:[function(e,t,r){var n=function(){"use strict";function e(e,t){this.val=e,this.brk=t}function t(){return function t(r){throw new e(r,t)}}function r(r){var n=t();try{return r(n)}catch(i){if(i instanceof e&&i.brk===n)return i.val;throw i}}return r}();"undefined"!=typeof t&&"undefined"!=typeof t.exports&&(t.exports=n)},{}],554:[function(e,t,r){var n=function(){"use strict";function e(e,t){var r=Array.prototype.slice.call(arguments,1);return e.replace(/\{(\d+)\}/g,function(e,t){return t in r?r[t]:e})}function t(e,t){return e.replace(/\{([_$a-zA-Z0-9][_$a-zA-Z0-9]*)\}/g,function(e,r){return r in t?t[r]:e})}function r(e,t){return new Array(t+1).join(e)}return e.fmt=e,e.obj=t,e.repeat=r,e}();"undefined"!=typeof t&&"undefined"!=typeof t.exports&&(t.exports=n)},{}],555:[function(e,t,r){var n=function(){"use strict";var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,r=void 0;return{nan:function(e){return e!==e},"boolean":function(e){return"boolean"==typeof e},number:function(e){return"number"==typeof e},string:function(e){return"string"==typeof e},fn:function(e){return"function"==typeof e},object:function(e){return null!==e&&"object"==typeof e},primitive:function(e){var t=typeof e;return null===e||e===r||"boolean"===t||"number"===t||"string"===t},array:Array.isArray||function(e){return"[object Array]"===t.call(e)},finitenumber:function(e){return"number"==typeof e&&isFinite(e)},someof:function(e,t){return t.indexOf(e)>=0},noneof:function(e,t){return-1===t.indexOf(e)},own:function(t,r){return e.call(t,r)}}}();"undefined"!=typeof t&&"undefined"!=typeof t.exports&&(t.exports=n)},{}],556:[function(e,t,r){var n=function(){"use strict";function e(t){return this instanceof e?(this.obj=r(),this.hasProto=!1,this.proto=void 0,void(t&&this.setMany(t))):new e(t)}var t=Object.prototype.hasOwnProperty,r=function(){function e(e){for(var r in e)if(t.call(e,r))return!0;return!1}function r(e){return t.call(e,"__count__")||t.call(e,"__parent__")}var n=!1;if("function"==typeof Object.create&&(e(Object.create(null))||(n=!0)),n===!1&&e({}))throw new Error("StringMap environment error 0, please file a bug at https://github.com/olov/stringmap/issues");var i=n?Object.create(null):{},a=!1;if(r(i)){if(i.__proto__=null,e(i)||r(i))throw new Error("StringMap environment error 1, please file a bug at https://github.com/olov/stringmap/issues");a=!0}return function(){var e=n?Object.create(null):{};return a&&(e.__proto__=null),e}}();return e.prototype.has=function(e){if("string"!=typeof e)throw new Error("StringMap expected string key");return"__proto__"===e?this.hasProto:t.call(this.obj,e)},e.prototype.get=function(e){if("string"!=typeof e)throw new Error("StringMap expected string key");return"__proto__"===e?this.proto:t.call(this.obj,e)?this.obj[e]:void 0},e.prototype.set=function(e,t){if("string"!=typeof e)throw new Error("StringMap expected string key");"__proto__"===e?(this.hasProto=!0,this.proto=t):this.obj[e]=t},e.prototype.remove=function(e){if("string"!=typeof e)throw new Error("StringMap expected string key");var t=this.has(e);return"__proto__"===e?(this.hasProto=!1,this.proto=void 0):delete this.obj[e],t},e.prototype["delete"]=e.prototype.remove,e.prototype.isEmpty=function(){for(var e in this.obj)if(t.call(this.obj,e))return!1;return!this.hasProto},e.prototype.size=function(){var e=0;for(var r in this.obj)t.call(this.obj,r)&&++e;return this.hasProto?e+1:e},e.prototype.keys=function(){var e=[];for(var r in this.obj)t.call(this.obj,r)&&e.push(r);return this.hasProto&&e.push("__proto__"),e},e.prototype.values=function(){var e=[];for(var r in this.obj)t.call(this.obj,r)&&e.push(this.obj[r]);return this.hasProto&&e.push(this.proto),e},e.prototype.items=function(){var e=[];for(var r in this.obj)t.call(this.obj,r)&&e.push([r,this.obj[r]]);return this.hasProto&&e.push(["__proto__",this.proto]),e},e.prototype.setMany=function(e){if(null===e||"object"!=typeof e&&"function"!=typeof e)throw new Error("StringMap expected Object");for(var r in e)t.call(e,r)&&this.set(r,e[r]);return this},e.prototype.merge=function(e){for(var t=e.keys(),r=0;r<t.length;r++){var n=t[r];this.set(n,e.get(n))}return this},e.prototype.map=function(e){for(var t=this.keys(),r=0;r<t.length;r++){var n=t[r];t[r]=e(this.get(n),n)}return t},e.prototype.forEach=function(e){for(var t=this.keys(),r=0;r<t.length;r++){var n=t[r];e(this.get(n),n)}},e.prototype.clone=function(){var t=e();return t.merge(this)},e.prototype.toString=function(){var e=this;return"{"+this.keys().map(function(t){return JSON.stringify(t)+":"+JSON.stringify(e.get(t))}).join(",")+"}"},e}();"undefined"!=typeof t&&"undefined"!=typeof t.exports&&(t.exports=n)},{}],557:[function(e,t,r){var n=function(){"use strict";function e(t){return this instanceof e?(this.obj=r(),this.hasProto=!1,void(t&&this.addMany(t))):new e(t)}var t=Object.prototype.hasOwnProperty,r=function(){function e(e){for(var r in e)if(t.call(e,r))return!0;return!1}function r(e){return t.call(e,"__count__")||t.call(e,"__parent__")}var n=!1;if("function"==typeof Object.create&&(e(Object.create(null))||(n=!0)),n===!1&&e({}))throw new Error("StringSet environment error 0, please file a bug at https://github.com/olov/stringset/issues");var i=n?Object.create(null):{},a=!1;if(r(i)){if(i.__proto__=null,e(i)||r(i))throw new Error("StringSet environment error 1, please file a bug at https://github.com/olov/stringset/issues");a=!0}return function(){var e=n?Object.create(null):{};return a&&(e.__proto__=null),e}}();return e.prototype.has=function(e){if("string"!=typeof e)throw new Error("StringSet expected string item");return"__proto__"===e?this.hasProto:t.call(this.obj,e)},e.prototype.add=function(e){if("string"!=typeof e)throw new Error("StringSet expected string item");"__proto__"===e?this.hasProto=!0:this.obj[e]=!0},e.prototype.remove=function(e){if("string"!=typeof e)throw new Error("StringSet expected string item");var t=this.has(e);return"__proto__"===e?this.hasProto=!1:delete this.obj[e],t},e.prototype["delete"]=e.prototype.remove,e.prototype.isEmpty=function(){for(var e in this.obj)if(t.call(this.obj,e))return!1;return!this.hasProto},e.prototype.size=function(){var e=0;for(var r in this.obj)t.call(this.obj,r)&&++e;return this.hasProto?e+1:e},e.prototype.items=function(){var e=[];for(var r in this.obj)t.call(this.obj,r)&&e.push(r);return this.hasProto&&e.push("__proto__"),e},e.prototype.addMany=function(e){if(!Array.isArray(e))throw new Error("StringSet expected array");for(var t=0;t<e.length;t++)this.add(e[t]);return this},e.prototype.merge=function(e){return this.addMany(e.items()),this},e.prototype.clone=function(){var t=e();return t.merge(this)},e.prototype.toString=function(){return"{"+this.items().map(JSON.stringify).join(",")+"}"},e}();"undefined"!=typeof t&&"undefined"!=typeof t.exports&&(t.exports=n)},{}],558:[function(e,t,r){function n(e,t){if(e){if(E.fixFaultyLocations(e),t){if(h.Node.check(e)&&h.SourceLocation.check(e.loc)){for(var r=t.length-1;r>=0&&!(x(t[r].loc.end,e.loc.start)<=0);--r);return void t.splice(r+1,0,e)}}else if(e[S])return e[S];var i;if(m.check(e))i=Object.keys(e);else{if(!y.check(e))return;i=d.getFieldNames(e)}t||Object.defineProperty(e,S,{value:t=[],enumerable:!1});for(var r=0,a=i.length;a>r;++r)n(e[i[r]],t);return t}}function i(e,t){for(var r=n(e),a=0,s=r.length;s>a;){var o=a+s>>1,u=r[o];if(x(u.loc.start,t.loc.start)<=0&&x(t.loc.end,u.loc.end)<=0)return void i(t.enclosingNode=u,t);if(x(u.loc.end,t.loc.start)<=0){var p=u;a=o+1}else{if(!(x(t.loc.end,u.loc.start)<=0))throw new Error("Comment location overlaps with node location");var l=u;s=o}}p&&(t.precedingNode=p),l&&(t.followingNode=l)}function a(e,t){var r=e.length;if(0!==r){for(var n=e[0].precedingNode,i=e[0].followingNode,a=i.loc.start,s=r;s>0;--s){var u=e[s-1];f.strictEqual(u.precedingNode,n),f.strictEqual(u.followingNode,i);var l=t.sliceString(u.loc.end,a);if(/\S/.test(l))break;a=u.loc.start}for(;r>=s&&(u=e[s])&&"Line"===u.type&&u.loc.start.column>i.loc.start.column;)++s;e.forEach(function(e,t){s>t?p(n,e):o(i,e)}),e.length=0}}function s(e,t){var r=e.comments||(e.comments=[]);r.push(t)}function o(e,t){t.leading=!0,t.trailing=!1,s(e,t)}function u(e,t){t.leading=!1,t.trailing=!1,s(e,t)}function p(e,t){t.leading=!1,t.trailing=!0,s(e,t)}function l(e,t){var r=e.getValue();h.Comment.assert(r);var n=r.loc,i=n&&n.lines,a=[t(e)];if(r.trailing)a.push("\n");else if(i instanceof v){var s=i.slice(n.end,i.skipSpaces(n.end));1===s.length?a.push(s):a.push(new Array(s.length).join("\n"))}else a.push("\n");return b(a)}function c(e,t){var r=e.getValue(e);h.Comment.assert(r);var n=r.loc,i=n&&n.lines,a=[];if(i instanceof v){var s=i.skipSpaces(n.start,!0)||i.firstPos(),o=i.slice(s,n.start);1===o.length?a.push(o):a.push(new Array(o.length).join("\n"))}return a.push(t(e)),b(a)}var f=e(1),d=e(566),h=d.namedTypes,m=d.builtInTypes.array,y=d.builtInTypes.object,g=e(560),v=(g.fromString,g.Lines),b=g.concat,E=e(567),x=E.comparePos,S=e(536).makeUniqueKey();r.attach=function(e,t,r){if(m.check(e)){var n=[];e.forEach(function(e){e.loc.lines=r,i(t,e);var s=e.precedingNode,l=e.enclosingNode,c=e.followingNode;if(s&&c){var d=n.length;if(d>0){var h=n[d-1];f.strictEqual(h.precedingNode===e.precedingNode,h.followingNode===e.followingNode),h.followingNode!==e.followingNode&&a(n,r)}n.push(e)}else if(s)a(n,r),p(s,e);else if(c)a(n,r),o(c,e);else{if(!l)throw new Error("AST contains no nodes at all?");a(n,r),u(l,e)}}),a(n,r),e.forEach(function(e){delete e.precedingNode,delete e.enclosingNode,delete e.followingNode})}},r.printComments=function(e,t){var r=e.getValue(),n=t(e),i=h.Node.check(r)&&d.getFieldValue(r,"comments");if(!i||0===i.length)return n;var a=[],s=[n];return e.each(function(e){var r=e.getValue(),n=d.getFieldValue(r,"leading"),i=d.getFieldValue(r,"trailing");n||i&&"Block"!==r.type?a.push(l(e,t)):i&&(f.strictEqual(r.type,"Block"),s.push(c(e,t)))},"comments"),a.push.apply(a,s),b(a)}},{1:1,536:536,560:560,566:566,567:567}],559:[function(e,t,r){function n(e){o.ok(this instanceof n),this.stack=[e]}function i(e,t){for(var r=e.stack,n=r.length-1;n>=0;n-=2){var i=r[n];if(p.Node.check(i)&&--t<0)return i}return null}function a(e){return p.BinaryExpression.check(e)||p.LogicalExpression.check(e)}function s(e){return p.CallExpression.check(e)?!0:l.check(e)?e.some(s):p.Node.check(e)?u.someField(e,function(e,t){return s(t)}):!1}var o=e(1),u=e(566),p=u.namedTypes,l=(p.Node,u.builtInTypes.array),c=u.builtInTypes.number,f=n.prototype;t.exports=n,n.from=function(e){if(e instanceof n)return e.copy();if(e instanceof u.NodePath){for(var t,r=Object.create(n.prototype),i=[e.value];t=e.parentPath;e=t)i.push(e.name,t.value);return r.stack=i.reverse(),r}return new n(e)},f.copy=function h(){var h=Object.create(n.prototype);return h.stack=this.stack.slice(0),h},f.getName=function(){var e=this.stack,t=e.length;return t>1?e[t-2]:null},f.getValue=function(){var e=this.stack;return e[e.length-1]},f.getNode=function(e){return i(this,~~e)},f.getParentNode=function(e){return i(this,~~e+1)},f.getRootValue=function(){var e=this.stack;return e.length%2===0?e[1]:e[0]},f.call=function(e){for(var t=this.stack,r=t.length,n=t[r-1],i=arguments.length,a=1;i>a;++a){var s=arguments[a];n=n[s],t.push(s,n)}var o=e(this);return t.length=r,o},f.each=function(e){for(var t=this.stack,r=t.length,n=t[r-1],i=arguments.length,a=1;i>a;++a){var s=arguments[a];n=n[s],t.push(s,n)}for(var a=0;a<n.length;++a)a in n&&(t.push(a,n[a]),e(this),t.length-=2);t.length=r},f.map=function(e){for(var t=this.stack,r=t.length,n=t[r-1],i=arguments.length,a=1;i>a;++a){var s=arguments[a];n=n[s],t.push(s,n)}for(var o=new Array(n.length),a=0;a<n.length;++a)a in n&&(t.push(a,n[a]),o[a]=e(this,a),t.length-=2);return t.length=r,o},f.needsParens=function(e){var t=this.getParentNode();if(!t)return!1;var r=this.getName(),n=this.getNode();if(this.getValue()!==n)return!1;if(!p.Expression.check(n))return!1;if("Identifier"===n.type)return!1;if("ParenthesizedExpression"===t.type)return!1;switch(n.type){case"UnaryExpression":case"SpreadElement":case"SpreadProperty":return"MemberExpression"===t.type&&"object"===r&&t.object===n;case"BinaryExpression":case"LogicalExpression":switch(t.type){case"CallExpression":return"callee"===r&&t.callee===n;case"UnaryExpression":case"SpreadElement":case"SpreadProperty":return!0;case"MemberExpression":return"object"===r&&t.object===n;case"BinaryExpression":case"LogicalExpression":var i=t.operator,u=d[i],l=n.operator,f=d[l];if(u>f)return!0;if(u===f&&"right"===r)return o.strictEqual(t.right,n),!0;default:return!1}case"SequenceExpression":switch(t.type){case"ForStatement":return!1;case"ExpressionStatement":return"expression"!==r;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&&c.check(n.value)&&"object"===r&&t.object===n;case"AssignmentExpression":case"ConditionalExpression":switch(t.type){case"UnaryExpression":case"SpreadElement":case"SpreadProperty":case"BinaryExpression":case"LogicalExpression":return!0;case"CallExpression":return"callee"===r&&t.callee===n;case"ConditionalExpression":return"test"===r&&t.test===n;case"MemberExpression":return"object"===r&&t.object===n;default:return!1}case"ArrowFunctionExpression":return a(t);case"ObjectExpression":if("ArrowFunctionExpression"===t.type&&"body"===r)return!0;default:if("NewExpression"===t.type&&"callee"===r&&t.callee===n)return s(n)}return e!==!0&&!this.canBeFirstInStatement()&&this.firstInStatement()?!0:!1};var d={};[["||"],["&&"],["|"],["^"],["&"],["==","===","!=","!=="],["<",">","<=",">=","in","instanceof"],[">>","<<",">>>"],["+","-"],["*","/","%"]].forEach(function(e,t){e.forEach(function(e){d[e]=t})}),f.canBeFirstInStatement=function(){var e=this.getNode();return!p.FunctionExpression.check(e)&&!p.ObjectExpression.check(e)},f.firstInStatement=function(){for(var e,t,r,n,i=this.stack,s=i.length-1;s>=0;s-=2)if(p.Node.check(i[s])&&(r=e,n=t,e=i[s-1],t=i[s]),t&&n){if(p.BlockStatement.check(t)&&"body"===e&&0===r)return o.strictEqual(t.body[0],n),!0;if(p.ExpressionStatement.check(t)&&"expression"===r)return o.strictEqual(t.expression,n),!0;if(p.SequenceExpression.check(t)&&"expressions"===e&&0===r)o.strictEqual(t.expressions[0],n);else if(p.CallExpression.check(t)&&"callee"===r)o.strictEqual(t.callee,n);else if(p.MemberExpression.check(t)&&"object"===r)o.strictEqual(t.object,n);else if(p.ConditionalExpression.check(t)&&"test"===r)o.strictEqual(t.test,n);else if(a(t)&&"left"===r)o.strictEqual(t.left,n);else{
if(!p.UnaryExpression.check(t)||t.prefix||"argument"!==r)return!1;o.strictEqual(t.argument,n)}}return!0}},{1:1,566:566}],560:[function(e,t,r){function n(e){return e[d]}function i(e,t){l.ok(this instanceof i),l.ok(e.length>0),t?m.assert(t):t=null,Object.defineProperty(this,d,{value:{infos:e,mappings:[],name:t,cachedSourceMap:null}}),t&&n(this).mappings.push(new g(this,{start:this.firstPos(),end:this.lastPos()}))}function a(e){return{line:e.line,indent:e.indent,sliceStart:e.sliceStart,sliceEnd:e.sliceEnd}}function s(e,t){for(var r=0,n=e.length,i=0;n>i;++i)switch(e.charCodeAt(i)){case 9:l.strictEqual(typeof t,"number"),l.ok(t>0);var a=Math.ceil(r/t)*t;a===r?r+=t:r=a;break;case 11:case 12:case 13:case 65279:break;case 32:default:r+=1}return r}function o(e,t){if(e instanceof i)return e;e+="";var r=t&&t.tabWidth,n=e.indexOf(" ")<0,a=!t&&n&&e.length<=x;if(l.ok(r||n,"No tab width specified but encountered tabs in string\n"+e),a&&E.call(b,e))return b[e];var o=new i(e.split(A).map(function(e){var t=S.exec(e)[0];return{line:e,indent:s(t,r),sliceStart:t.length,sliceEnd:e.length}}),f(t).sourceFileName);return a&&(b[e]=o),o}function u(e){return!/\S/.test(e)}function p(e,t,r){var n=e.sliceStart,i=e.sliceEnd,a=Math.max(e.indent,0),s=a+i-n;return"undefined"==typeof r&&(r=s),t=Math.max(t,0),r=Math.min(r,s),r=Math.max(r,t),a>r?(a=r,i=n):i-=s-r,s=r,s-=t,a>t?a-=t:(t-=a,a=0,n+=t),l.ok(a>=0),l.ok(i>=n),l.strictEqual(s,a+i-n),e.indent===a&&e.sliceStart===n&&e.sliceEnd===i?e:{line:e.line,indent:a,sliceStart:n,sliceEnd:i}}var l=e(1),c=e(607),f=e(562).normalize,d=e(536).makeUniqueKey(),h=e(566),m=h.builtInTypes.string,y=e(567).comparePos,g=e(561);r.Lines=i;var v=i.prototype;Object.defineProperties(v,{length:{get:function(){return n(this).infos.length}},name:{get:function(){return n(this).name}}});var b={},E=b.hasOwnProperty,x=10;r.countSpaces=s;var S=/^\s*/,A=/\u000D\u000A|\u000D(?!\u000A)|\u000A|\u2028|\u2029/;r.fromString=o,v.toString=function(e){return this.sliceString(this.firstPos(),this.lastPos(),e)},v.getSourceMap=function(e,t){function r(r){return r=r||{},m.assert(e),r.file=e,t&&(m.assert(t),r.sourceRoot=t),r}if(!e)return null;var i=this,a=n(i);if(a.cachedSourceMap)return r(a.cachedSourceMap.toJSON());var s=new c.SourceMapGenerator(r()),o={};return a.mappings.forEach(function(e){for(var t=e.sourceLines.skipSpaces(e.sourceLoc.start)||e.sourceLines.lastPos(),r=i.skipSpaces(e.targetLoc.start)||i.lastPos();y(t,e.sourceLoc.end)<0&&y(r,e.targetLoc.end)<0;){var n=e.sourceLines.charAt(t),a=i.charAt(r);l.strictEqual(n,a);var u=e.sourceLines.name;if(s.addMapping({source:u,original:{line:t.line,column:t.column},generated:{line:r.line,column:r.column}}),!E.call(o,u)){var p=e.sourceLines.toString();s.setSourceContent(u,p),o[u]=p}i.nextPos(r,!0),e.sourceLines.nextPos(t,!0)}}),a.cachedSourceMap=s,s.toJSON()},v.bootstrapCharAt=function(e){l.strictEqual(typeof e,"object"),l.strictEqual(typeof e.line,"number"),l.strictEqual(typeof e.column,"number");var t=e.line,r=e.column,n=this.toString().split(A),i=n[t-1];return"undefined"==typeof i?"":r===i.length&&t<n.length?"\n":r>=i.length?"":i.charAt(r)},v.charAt=function(e){l.strictEqual(typeof e,"object"),l.strictEqual(typeof e.line,"number"),l.strictEqual(typeof e.column,"number");var t=e.line,r=e.column,i=n(this),a=i.infos,s=a[t-1],o=r;if("undefined"==typeof s||0>o)return"";var u=this.getIndentAt(t);return u>o?" ":(o+=s.sliceStart-u,o===s.sliceEnd&&t<this.length?"\n":o>=s.sliceEnd?"":s.line.charAt(o))},v.stripMargin=function(e,t){if(0===e)return this;if(l.ok(e>0,"negative margin: "+e),t&&1===this.length)return this;var r=n(this),s=new i(r.infos.map(function(r,n){return r.line&&(n>0||!t)&&(r=a(r),r.indent=Math.max(0,r.indent-e)),r}));if(r.mappings.length>0){var o=n(s).mappings;l.strictEqual(o.length,0),r.mappings.forEach(function(r){o.push(r.indent(e,t,!0))})}return s},v.indent=function(e){if(0===e)return this;var t=n(this),r=new i(t.infos.map(function(t){return t.line&&(t=a(t),t.indent+=e),t}));if(t.mappings.length>0){var s=n(r).mappings;l.strictEqual(s.length,0),t.mappings.forEach(function(t){s.push(t.indent(e))})}return r},v.indentTail=function(e){if(0===e)return this;if(this.length<2)return this;var t=n(this),r=new i(t.infos.map(function(t,r){return r>0&&t.line&&(t=a(t),t.indent+=e),t}));if(t.mappings.length>0){var s=n(r).mappings;l.strictEqual(s.length,0),t.mappings.forEach(function(t){s.push(t.indent(e,!0))})}return r},v.getIndentAt=function(e){l.ok(e>=1,"no line "+e+" (line numbers start from 1)");var t=n(this),r=t.infos[e-1];return Math.max(r.indent,0)},v.guessTabWidth=function(){var e=n(this);if(E.call(e,"cachedTabWidth"))return e.cachedTabWidth;for(var t=[],r=0,i=1,a=this.length;a>=i;++i){var s=e.infos[i-1],o=s.line.slice(s.sliceStart,s.sliceEnd);if(!u(o)){var p=Math.abs(s.indent-r);t[p]=~~t[p]+1,r=s.indent}}for(var l=-1,c=2,f=1;f<t.length;f+=1)E.call(t,f)&&t[f]>l&&(l=t[f],c=f);return e.cachedTabWidth=c},v.isOnlyWhitespace=function(){return u(this.toString())},v.isPrecededOnlyByWhitespace=function(e){var t=n(this),r=t.infos[e.line-1],i=Math.max(r.indent,0),a=e.column-i;if(0>=a)return!0;var s=r.sliceStart,o=Math.min(s+a,r.sliceEnd),p=r.line.slice(s,o);return u(p)},v.getLineLength=function(e){var t=n(this),r=t.infos[e-1];return this.getIndentAt(e)+r.sliceEnd-r.sliceStart},v.nextPos=function(e,t){var r=Math.max(e.line,0),n=Math.max(e.column,0);return n<this.getLineLength(r)?(e.column+=1,t?!!this.skipSpaces(e,!1,!0):!0):r<this.length?(e.line+=1,e.column=0,t?!!this.skipSpaces(e,!1,!0):!0):!1},v.prevPos=function(e,t){var r=e.line,n=e.column;if(1>n){if(r-=1,1>r)return!1;n=this.getLineLength(r)}else n=Math.min(n-1,this.getLineLength(r));return e.line=r,e.column=n,t?!!this.skipSpaces(e,!0,!0):!0},v.firstPos=function(){return{line:1,column:0}},v.lastPos=function(){return{line:this.length,column:this.getLineLength(this.length)}},v.skipSpaces=function(e,t,r){if(e=e?r?e:{line:e.line,column:e.column}:t?this.lastPos():this.firstPos(),t){for(;this.prevPos(e);)if(!u(this.charAt(e))&&this.nextPos(e))return e;return null}for(;u(this.charAt(e));)if(!this.nextPos(e))return null;return e},v.trimLeft=function(){var e=this.skipSpaces(this.firstPos(),!1,!0);return e?this.slice(e):D},v.trimRight=function(){var e=this.skipSpaces(this.lastPos(),!0,!0);return e?this.slice(this.firstPos(),e):D},v.trim=function(){var e=this.skipSpaces(this.firstPos(),!1,!0);if(null===e)return D;var t=this.skipSpaces(this.lastPos(),!0,!0);return l.notStrictEqual(t,null),this.slice(e,t)},v.eachPos=function(e,t,r){var n=this.firstPos();if(t&&(n.line=t.line,n.column=t.column),!r||this.skipSpaces(n,!1,!0))do e.call(this,n);while(this.nextPos(n,r))},v.bootstrapSlice=function(e,t){var r=this.toString().split(A).slice(e.line-1,t.line);return r.push(r.pop().slice(0,t.column)),r[0]=r[0].slice(e.column),o(r.join("\n"))},v.slice=function(e,t){if(!t){if(!e)return this;t=this.lastPos()}var r=n(this),a=r.infos.slice(e.line-1,t.line);e.line===t.line?a[0]=p(a[0],e.column,t.column):(l.ok(e.line<t.line),a[0]=p(a[0],e.column),a.push(p(a.pop(),0,t.column)));var s=new i(a);if(r.mappings.length>0){var o=n(s).mappings;l.strictEqual(o.length,0),r.mappings.forEach(function(r){var n=r.slice(this,e,t);n&&o.push(n)},this)}return s},v.bootstrapSliceString=function(e,t,r){return this.slice(e,t).toString(r)},v.sliceString=function(e,t,r){if(!t){if(!e)return this;t=this.lastPos()}r=f(r);for(var i=n(this).infos,a=[],o=r.tabWidth,l=e.line;l<=t.line;++l){var c=i[l-1];l===e.line?c=l===t.line?p(c,e.column,t.column):p(c,e.column):l===t.line&&(c=p(c,0,t.column));var d=Math.max(c.indent,0),h=c.line.slice(0,c.sliceStart);if(r.reuseWhitespace&&u(h)&&s(h,r.tabWidth)===d)a.push(c.line.slice(0,c.sliceEnd));else{var m=0,y=d;r.useTabs&&(m=Math.floor(d/o),y-=m*o);var g="";m>0&&(g+=new Array(m+1).join(" ")),y>0&&(g+=new Array(y+1).join(" ")),g+=c.line.slice(c.sliceStart,c.sliceEnd),a.push(g)}}return a.join(r.lineTerminator)},v.isEmpty=function(){return this.length<2&&this.getLineLength(1)<1},v.join=function(e){function t(e){if(null!==e){if(s){var t=e.infos[0],r=new Array(t.indent+1).join(" "),n=l.length,i=Math.max(s.indent,0)+s.sliceEnd-s.sliceStart;s.line=s.line.slice(0,s.sliceEnd)+r+t.line.slice(t.sliceStart,t.sliceEnd),s.sliceEnd=s.line.length,e.mappings.length>0&&e.mappings.forEach(function(e){c.push(e.add(n,i))})}else e.mappings.length>0&&c.push.apply(c,e.mappings);e.infos.forEach(function(e,t){(!s||t>0)&&(s=a(e),l.push(s))})}}function r(e,r){r>0&&t(p),t(e)}var s,u=this,p=n(u),l=[],c=[];if(e.map(function(e){var t=o(e);return t.isEmpty()?null:n(t)}).forEach(u.isEmpty()?t:r),l.length<1)return D;var f=new i(l);return n(f).mappings=c,f},r.concat=function(e){return D.join(e)},v.concat=function(e){var t=arguments,r=[this];return r.push.apply(r,t),l.strictEqual(r.length,t.length+1),D.join(r)};var D=o("")},{1:1,536:536,561:561,562:562,566:566,567:567,607:607}],561:[function(e,t,r){function n(e,t,r){o.ok(this instanceof n),o.ok(e instanceof f.Lines),l.assert(t),r?o.ok(p.check(r.start.line)&&p.check(r.start.column)&&p.check(r.end.line)&&p.check(r.end.column)):r=t,Object.defineProperties(this,{sourceLines:{value:e},sourceLoc:{value:t},targetLoc:{value:r}})}function i(e,t,r){return{line:e.line+t-1,column:1===e.line?e.column+r:e.column}}function a(e,t,r){return{line:e.line-t+1,column:e.line===t?e.column-r:e.column}}function s(e,t,r,n,i){o.ok(e instanceof f.Lines),o.ok(r instanceof f.Lines),c.assert(t),c.assert(n),c.assert(i);var a=d(n,i);if(0===a)return t;if(0>a){var s=e.skipSpaces(t),u=r.skipSpaces(n),p=i.line-u.line;for(s.line+=p,u.line+=p,p>0?(s.column=0,u.column=0):o.strictEqual(p,0);d(u,i)<0&&r.nextPos(u,!0);)o.ok(e.nextPos(s,!0)),o.strictEqual(e.charAt(s),r.charAt(u))}else{var s=e.skipSpaces(t,!0),u=r.skipSpaces(n,!0),p=i.line-u.line;for(s.line+=p,u.line+=p,0>p?(s.column=e.getLineLength(s.line),u.column=r.getLineLength(u.line)):o.strictEqual(p,0);d(i,u)<0&&r.prevPos(u,!0);)o.ok(e.prevPos(s,!0)),o.strictEqual(e.charAt(s),r.charAt(u))}return s}var o=e(1),u=e(566),p=(u.builtInTypes.string,u.builtInTypes.number),l=u.namedTypes.SourceLocation,c=u.namedTypes.Position,f=e(560),d=e(567).comparePos,h=n.prototype;t.exports=n,h.slice=function(e,t,r){function i(n){var i=p[n],a=l[n],c=t;return"end"===n?c=r:o.strictEqual(n,"start"),s(u,i,e,a,c)}o.ok(e instanceof f.Lines),c.assert(t),r?c.assert(r):r=e.lastPos();var u=this.sourceLines,p=this.sourceLoc,l=this.targetLoc;if(d(t,l.start)<=0)if(d(l.end,r)<=0)l={start:a(l.start,t.line,t.column),end:a(l.end,t.line,t.column)};else{if(d(r,l.start)<=0)return null;p={start:p.start,end:i("end")},l={start:a(l.start,t.line,t.column),end:a(r,t.line,t.column)}}else{if(d(l.end,t)<=0)return null;d(l.end,r)<=0?(p={start:i("start"),end:p.end},l={start:{line:1,column:0},end:a(l.end,t.line,t.column)}):(p={start:i("start"),end:i("end")},l={start:{line:1,column:0},end:a(r,t.line,t.column)})}return new n(this.sourceLines,p,l)},h.add=function(e,t){return new n(this.sourceLines,this.sourceLoc,{start:i(this.targetLoc.start,e,t),end:i(this.targetLoc.end,e,t)})},h.subtract=function(e,t){return new n(this.sourceLines,this.sourceLoc,{start:a(this.targetLoc.start,e,t),end:a(this.targetLoc.end,e,t)})},h.indent=function(e,t,r){if(0===e)return this;var i=this.targetLoc,a=i.start.line,s=i.end.line;if(t&&1===a&&1===s)return this;if(i={start:i.start,end:i.end},!t||a>1){var o=i.start.column+e;i.start={line:a,column:r?Math.max(0,o):o}}if(!t||s>1){var u=i.end.column+e;i.end={line:s,column:r?Math.max(0,u):u}}return new n(this.sourceLines,this.sourceLoc,i)}},{1:1,560:560,566:566,567:567}],562:[function(e,t,r){var n={esprima:e(3),tabWidth:4,useTabs:!1,reuseWhitespace:!0,lineTerminator:e(8).EOL,wrapColumn:74,sourceFileName:null,sourceMapName:null,sourceRoot:null,inputSourceMap:null,range:!1,tolerant:!0,quote:null,trailingComma:!1},i=n.hasOwnProperty;r.normalize=function(e){function t(t){return i.call(e,t)?e[t]:n[t]}return e=e||n,{tabWidth:+t("tabWidth"),useTabs:!!t("useTabs"),reuseWhitespace:!!t("reuseWhitespace"),lineTerminator:t("lineTerminator"),wrapColumn:Math.max(t("wrapColumn"),0),sourceFileName:t("sourceFileName"),sourceMapName:t("sourceMapName"),sourceRoot:t("sourceRoot"),inputSourceMap:t("inputSourceMap"),esprima:t("esprima"),range:t("range"),tolerant:t("tolerant"),quote:t("quote"),trailingComma:t("trailingComma")}}},{3:3,8:8}],563:[function(e,t,r){function n(e){i.ok(this instanceof n),this.lines=e,this.indent=0}var i=e(1),a=e(566),s=(a.namedTypes,a.builders),o=a.builtInTypes.object,u=a.builtInTypes.array,p=(a.builtInTypes["function"],e(564).Patcher,e(562).normalize),l=e(560).fromString,c=e(558).attach,f=e(567);r.parse=function(e,t){t=p(t);var r=l(e,t),i=r.toString({tabWidth:t.tabWidth,reuseWhitespace:!1,useTabs:!1}),a=[],o=t.esprima.parse(i,{loc:!0,locations:!0,range:t.range,comment:!0,onComment:a,tolerant:t.tolerant,ecmaVersion:6,sourceType:"module"});o.loc=o.loc||{start:r.firstPos(),end:r.lastPos()},o.loc.lines=r,o.loc.indent=0;var u=f.getTrueLoc(o,r);o.loc.start=u.start,o.loc.end=u.end,o.comments&&(a=o.comments,delete o.comments);var d=s.file(o);return d.loc={lines:r,indent:0,start:r.firstPos(),end:r.lastPos()},c(a,o.body.length?d.program:d,r),new n(r).copy(d)};var d=n.prototype;d.copy=function(e){if(u.check(e))return e.map(this.copy,this);if(!o.check(e))return e;f.fixFaultyLocations(e);var t=Object.create(Object.getPrototypeOf(e),{original:{value:e,configurable:!1,enumerable:!1,writable:!0}}),r=e.loc,n=this.indent,i=n;r&&(("Block"===e.type||"Line"===e.type||this.lines.isPrecededOnlyByWhitespace(r.start))&&(i=this.indent=r.start.column),r.lines=this.lines,r.indent=i);for(var a=Object.keys(e),s=a.length,p=0;s>p;++p){var l=a[p];"loc"===l?t[l]=e[l]:t[l]=this.copy(e[l])}return this.indent=n,t}},{1:1,558:558,560:560,562:562,564:564,566:566,567:567}],564:[function(e,t,r){function n(e){d.ok(this instanceof n),d.ok(e instanceof h.Lines);var t=this,r=[];t.replace=function(e,t){D.check(t)&&(t=h.fromString(t)),r.push({lines:t,start:e.start,end:e.end})},t.get=function(t){function n(t,r){d.ok(E(t,r)<=0),a.push(e.slice(t,r))}t=t||{start:{line:1,column:0},end:{line:e.length,column:e.getLineLength(e.length)}};var i=t.start,a=[];return r.sort(function(e,t){return E(e.start,t.start)}).forEach(function(e){E(i,e.start)>0||(n(i,e.start),a.push(e.lines),i=e.end)}),n(i,t.end),h.concat(a)}}function i(e){var t=[];return e.comments&&e.comments.length>0&&e.comments.forEach(function(e){(e.leading||e.trailing)&&t.push(e)}),t}function a(e,t){var r=e.getValue();y.assert(r);var n=r.original;if(y.assert(n),d.deepEqual(t,[]),r.type!==n.type)return!1;var i=new x(n),a=f(e,i,t);return a||(t.length=0),a}function s(e,t,r){var n=e.getValue(),i=t.getValue();return n===i?!0:A.check(n)?o(e,t,r):S.check(n)?u(e,t,r):!1}function o(e,t,r){var n=e.getValue(),i=t.getValue();A.assert(n);var a=n.length;if(!A.check(i)||i.length!==a)return!1;for(var o=0;a>o;++o){e.stack.push(o,n[o]),t.stack.push(o,i[o]);var u=s(e,t,r);if(e.stack.length-=2,t.stack.length-=2,!u)return!1}return!0}function u(e,t,r){var n=e.getValue();if(S.assert(n),null===n.original)return!1;var i=t.getValue();if(!S.check(i))return!1;if(y.check(n)){if(!y.check(i))return!1;if(n.type===i.type){var a=[];if(f(e,t,a))r.push.apply(r,a);else{if(!i.loc)return!1;r.push({oldPath:t.copy(),newPath:e.copy()})}return!0}return g.check(n)&&g.check(i)&&i.loc?(r.push({oldPath:t.copy(),newPath:e.copy()}),!0):!1}return f(e,t,r)}function p(e){var t=e.getValue(),r=t.loc,n=r&&r.lines;if(n){var i=I;for(i.line=r.start.line,i.column=r.start.column;n.prevPos(i);){var a=n.charAt(i);if("("===a)return E(e.getRootValue().loc.start,i)<=0;if(_.test(a))return!1}}return!1}function l(e){var t=e.getValue(),r=t.loc,n=r&&r.lines;if(n){var i=I;i.line=r.end.line,i.column=r.end.column;do{var a=n.charAt(i);if(")"===a)return E(i,e.getRootValue().loc.end)<=0;if(_.test(a))return!1}while(n.nextPos(i))}return!1}function c(e){return p(e)&&l(e)}function f(e,t,r){var n=e.getValue(),i=t.getValue();if(S.assert(n),S.assert(i),null===n.original)return!1;if(!e.canBeFirstInStatement()&&e.firstInStatement()&&!p(t))return!1;if(e.needsParens(!0)&&!c(t))return!1;for(var a in b.getUnionOfKeys(n,i))if("loc"!==a){e.stack.push(a,m.getFieldValue(n,a)),t.stack.push(a,m.getFieldValue(i,a));var o=s(e,t,r);if(e.stack.length-=2,t.stack.length-=2,!o)return!1}return!0}var d=e(1),h=e(560),m=e(566),y=(m.getFieldValue,m.namedTypes.Printable),g=m.namedTypes.Expression,v=m.namedTypes.SourceLocation,b=e(567),E=b.comparePos,x=e(559),S=m.builtInTypes.object,A=m.builtInTypes.array,D=m.builtInTypes.string,C=/[0-9a-z_$]/i;r.Patcher=n;var w=n.prototype;w.tryToReprintComments=function(e,t,r){var n=this;if(!e.comments&&!t.comments)return!0;var a=x.from(e),s=x.from(t);a.stack.push("comments",i(e)),s.stack.push("comments",i(t));var u=[],p=o(a,s,u);return p&&u.length>0&&u.forEach(function(e){var t=e.oldPath.getValue();d.ok(t.leading||t.trailing),n.replace(t.loc,r(e.newPath).indentTail(t.loc.indent))}),p},w.deleteComments=function(e){if(e.comments){var t=this;e.comments.forEach(function(r){r.leading?t.replace({start:r.loc.start,end:e.loc.lines.skipSpaces(r.loc.end,!1,!1)},""):r.trailing&&t.replace({start:e.loc.lines.skipSpaces(r.loc.start,!0,!1),end:r.loc.end},"")})}},r.getReprinter=function(e){d.ok(e instanceof x);var t=e.getValue();if(y.check(t)){var r=t.original,i=r&&r.loc,s=i&&i.lines,o=[];if(s&&a(e,o))return function(e){var t=new n(s);return o.forEach(function(r){var n=r.newPath.getValue(),i=r.oldPath.getValue();v.assert(i.loc,!0);var a=!t.tryToReprintComments(n,i,e);a&&t.deleteComments(i);var o=b.copyPos(i.loc.start),u=s.prevPos(o)&&C.test(s.charAt(o)),p=e(r.newPath,a).indentTail(i.loc.indent),l=C.test(s.charAt(i.loc.end));if(u||l){var c=[];u&&c.push(" "),c.push(p),l&&c.push(" "),p=h.concat(c)}t.replace(i.loc,p)}),t.get(i).indentTail(-r.loc.indent)}}};var I={line:1,column:0},_=/\S/},{1:1,559:559,560:560,566:566,567:567}],565:[function(e,t,r){function n(e,t){E.ok(this instanceof n),F.assert(e),this.code=e,t&&(k.assert(t),this.map=t)}function i(e){function t(e){return E.ok(e instanceof P),x(e,r)}function r(e,r){if(r)return t(e);if(E.ok(e instanceof P),!l){var n=c.tabWidth,i=e.getNode().loc;if(i&&i.lines&&i.lines.guessTabWidth){c.tabWidth=i.lines.guessTabWidth();var a=o(e);return c.tabWidth=n,a}}return o(e)}function o(e){var t=w(e);return t?a(e,t(r)):u(e)}function u(e){return s(e,c,t)}function p(e){return s(e,c,p)}E.ok(this instanceof i);var l=e&&e.tabWidth,c=C(e);E.notStrictEqual(c,e),c.sourceFileName=null,this.print=function(e){if(!e)return O;var t=r(P.from(e),!0);return new n(t.toString(c),B.composeSourceMaps(c.inputSourceMap,t.getSourceMap(c.sourceMapName,c.sourceRoot)))},this.printGenerically=function(e){if(!e)return O;var t=P.from(e),r=c.reuseWhitespace;c.reuseWhitespace=!1;var i=new n(p(t).toString(c));return c.reuseWhitespace=r,i}}function a(e,t){return e.needsParens()?D(["(",t,")"]):t}function s(e,t,r){return E.ok(e instanceof P),a(e,o(e,t,r))}function o(e,t,r){var n=e.getValue();if(!n)return A("");if("string"==typeof n)return A(n,t);switch(_.Printable.assert(n),n.type){case"File":return e.call(r,"program");case"Program":return e.call(function(e){return u(e,t,r)},"body");case"Noop":case"EmptyStatement":return A("");case"ExpressionStatement":return D([e.call(r,"expression"),";"]);case"ParenthesizedExpression":return D(["(",e.call(r,"expression"),")"]);case"BinaryExpression":case"LogicalExpression":case"AssignmentExpression":return A(" ").join([e.call(r,"left"),n.operator,e.call(r,"right")]);case"AssignmentPattern":return D([e.call(r,"left"),"=",e.call(r,"right")]);case"MemberExpression":var i=[e.call(r,"object")],a=e.call(r,"property");return n.computed?i.push("[",a,"]"):i.push(".",a),D(i);case"MetaProperty":return D([e.call(r,"meta"),".",e.call(r,"property")]);case"BindExpression":var i=[];return n.object&&i.push(e.call(r,"object")),i.push("::",e.call(r,"callee")),D(i);case"Path":return A(".").join(n.body);case"Identifier":return D([A(n.name,t),e.call(r,"typeAnnotation")]);case"SpreadElement":case"SpreadElementPattern":case"SpreadProperty":case"SpreadPropertyPattern":case"RestElement":return D(["...",e.call(r,"argument")]);case"FunctionDeclaration":case"FunctionExpression":var i=[];return n.async&&i.push("async "),i.push("function"),n.generator&&i.push("*"),n.id&&i.push(" ",e.call(r,"id"),e.call(r,"typeParameters")),i.push("(",d(e,t,r),")",e.call(r,"returnType")," ",e.call(r,"body")),D(i);case"ArrowFunctionExpression":var i=[];return n.async&&i.push("async "),1!==n.params.length||n.rest||"SpreadElementPattern"===n.params[0].type||"RestElement"===n.params[0].type?i.push("(",d(e,t,r),")"):i.push(e.call(r,"params",0)),i.push(" => ",e.call(r,"body")),D(i);case"MethodDefinition":var i=[];return n["static"]&&i.push("static "),i.push(c(e,t,r)),D(i);case"YieldExpression":var i=["yield"];return n.delegate&&i.push("*"),n.argument&&i.push(" ",e.call(r,"argument")),D(i);case"AwaitExpression":var i=["await"];return n.all&&i.push("*"),n.argument&&i.push(" ",e.call(r,"argument")),D(i);case"ModuleDeclaration":var i=["module",e.call(r,"id")];return n.source?(E.ok(!n.body),i.push("from",e.call(r,"source"))):i.push(e.call(r,"body")),A(" ").join(i);case"ImportSpecifier":var i=[];return n.imported?(i.push(e.call(r,"imported")),n.local&&n.local.name!==n.imported.name&&i.push(" as ",e.call(r,"local"))):n.id&&(i.push(e.call(r,"id")),n.name&&i.push(" as ",e.call(r,"name"))),D(i);case"ExportSpecifier":var i=[];return n.local?(i.push(e.call(r,"local")),n.exported&&n.exported.name!==n.local.name&&i.push(" as ",e.call(r,"exported"))):n.id&&(i.push(e.call(r,"id")),n.name&&i.push(" as ",e.call(r,"name"))),D(i);case"ExportBatchSpecifier":return A("*");case"ImportNamespaceSpecifier":var i=["* as "];return n.local?i.push(e.call(r,"local")):n.id&&i.push(e.call(r,"id")),D(i);case"ImportDefaultSpecifier":return n.local?e.call(r,"local"):e.call(r,"id");case"ExportDeclaration":var i=["export"];if(n["default"])i.push(" default");else if(n.specifiers&&n.specifiers.length>0)return 1===n.specifiers.length&&"ExportBatchSpecifier"===n.specifiers[0].type?i.push(" *"):i.push(" { ",A(", ").join(e.map(r,"specifiers"))," }"),n.source&&i.push(" from ",e.call(r,"source")),i.push(";"),D(i);if(n.declaration){var s=e.call(r,"declaration");i.push(" ",s),";"!==m(s)&&i.push(";")}return D(i);case"ExportDefaultDeclaration":return D(["export default ",e.call(r,"declaration")]);case"ExportNamedDeclaration":var i=["export "];return n.declaration&&i.push(e.call(r,"declaration")),n.specifiers&&n.specifiers.length>0&&i.push(n.declaration?", {":"{",A(", ").join(e.map(r,"specifiers")),"}"),n.source&&i.push(" from ",e.call(r,"source")),D(i);case"ExportAllDeclaration":var i=["export *"];return n.exported&&i.push(" as ",e.call(r,"exported")),D([" from ",e.call(r,"source")]);case"ExportNamespaceSpecifier":return D(["* as ",e.call(r,"exported")]);case"ExportDefaultSpecifier":return e.call(r,"exported");case"ImportDeclaration":var i=["import "];if(n.importKind&&"value"!==n.importKind&&i.push(n.importKind+" "),n.specifiers&&n.specifiers.length>0){var o=!1;e.each(function(e){var t=e.getName();t>0&&i.push(", ");var n=e.getValue();_.ImportDefaultSpecifier.check(n)||_.ImportNamespaceSpecifier.check(n)?E.strictEqual(o,!1):(_.ImportSpecifier.assert(n),o||(o=!0,i.push("{"))),i.push(r(e))},"specifiers"),o&&i.push("}"),i.push(" from ")}return i.push(e.call(r,"source"),";"),D(i);case"BlockStatement":var l=e.call(function(e){return u(e,t,r)},"body");return l.isEmpty()?A("{}"):D(["{\n",l.indent(t.tabWidth),"\n}"]);case"ReturnStatement":var i=["return"];if(n.argument){var g=e.call(r,"argument");g.length>1&&(_.XJSElement&&_.XJSElement.check(n.argument)||_.JSXElement&&_.JSXElement.check(n.argument))?i.push(" (\n",g.indent(t.tabWidth),"\n)"):i.push(" ",g)}return i.push(";"),D(i);case"CallExpression":return D([e.call(r,"callee"),f(e,t,r)]);case"ObjectExpression":case"ObjectPattern":case"ObjectTypeAnnotation":var b=!1,x="ObjectTypeAnnotation"===n.type,S=x?";":",",C=[];x&&C.push("indexers","callProperties"),C.push("properties");var w=0;C.forEach(function(e){w+=n[e].length});var I=x&&1===w||0===w,i=[I?"{":"{\n"],F=0;return C.forEach(function(n){e.each(function(e){var n=r(e);I||(n=n.indent(t.tabWidth));var a=!x&&n.length>1;a&&b&&i.push("\n"),i.push(n),w-1>F?(i.push(S+(a?"\n\n":"\n")),b=!a):1!==w&&x?i.push(S):t.trailingComma&&i.push(S),F++},n)}),i.push(I?"}":"\n}"),D(i);case"PropertyPattern":return D([e.call(r,"key"),": ",e.call(r,"pattern")]);case"Property":if(n.method||"get"===n.kind||"set"===n.kind)return c(e,t,r);var i=[];n.decorators&&e.each(function(e){i.push(r(e),"\n")},"decorators");var k=e.call(r,"key");return n.computed?i.push("[",k,"]"):i.push(k),n.shorthand||i.push(": ",e.call(r,"value")),D(i);case"Decorator":return D(["@",e.call(r,"expression")]);case"ArrayExpression":case"ArrayPattern":var P=n.elements,w=P.length,B=e.map(r,"elements"),T=A(", ").join(B),I=T.getLineLength(1)<=t.wrapColumn,i=[I?"[":"[\n"];return e.each(function(e){var r=e.getName(),n=e.getValue();if(n){var a=B[r];I?r>0&&i.push(" "):a=a.indent(t.tabWidth),i.push(a),(w-1>r||!I&&t.trailingComma)&&i.push(","),I||i.push("\n")}else i.push(",")},"elements"),i.push("]"),D(i);case"SequenceExpression":return A(", ").join(e.map(r,"expressions"));case"ThisExpression":return A("this");case"Super":return A("super");case"Literal":return"string"!=typeof n.value?A(n.value,t):A(v(n.value,t),t);case"ModuleSpecifier":if(n.local)throw new Error("The ESTree ModuleSpecifier type should be abstract");return A(v(n.value,t),t);case"UnaryExpression":var i=[n.operator];return/[a-z]$/.test(n.operator)&&i.push(" "),i.push(e.call(r,"argument")),D(i);case"UpdateExpression":var i=[e.call(r,"argument"),n.operator];return n.prefix&&i.reverse(),D(i);case"ConditionalExpression":return D(["(",e.call(r,"test")," ? ",e.call(r,"consequent")," : ",e.call(r,"alternate"),")"]);case"NewExpression":var i=["new ",e.call(r,"callee")],M=n.arguments;return M&&i.push(f(e,t,r)),D(i);case"VariableDeclaration":var i=[n.kind," "],O=0,B=e.map(function(e){var t=r(e);return O=Math.max(t.length,O),t},"declarations");1===O?i.push(A(", ").join(B)):B.length>1?i.push(A(",\n").join(B).indentTail(n.kind.length+1)):i.push(B[0]);var j=e.getParentNode();return _.ForStatement.check(j)||_.ForInStatement.check(j)||_.ForOfStatement&&_.ForOfStatement.check(j)||i.push(";"),D(i);case"VariableDeclarator":return n.init?A(" = ").join([e.call(r,"id"),e.call(r,"init")]):e.call(r,"id");case"WithStatement":return D(["with (",e.call(r,"object"),") ",e.call(r,"body")]);case"IfStatement":var L=h(e.call(r,"consequent"),t),i=["if (",e.call(r,"test"),")",L];return n.alternate&&i.push(y(L)?" else":"\nelse",h(e.call(r,"alternate"),t)),D(i);case"ForStatement":var N=e.call(r,"init"),R=N.length>1?";\n":"; ",V="for (",U=A(R).join([N,e.call(r,"test"),e.call(r,"update")]).indentTail(V.length),q=D([V,U,")"]),G=h(e.call(r,"body"),t),i=[q];return q.length>1&&(i.push("\n"),G=G.trimLeft()),i.push(G),D(i);case"WhileStatement":return D(["while (",e.call(r,"test"),")",h(e.call(r,"body"),t)]);case"ForInStatement":return D([n.each?"for each (":"for (",e.call(r,"left")," in ",e.call(r,"right"),")",h(e.call(r,"body"),t)]);case"ForOfStatement":return D(["for (",e.call(r,"left")," of ",e.call(r,"right"),")",h(e.call(r,"body"),t)]);case"DoWhileStatement":var H=D(["do",h(e.call(r,"body"),t)]),i=[H];return y(H)?i.push(" while"):i.push("\nwhile"),i.push(" (",e.call(r,"test"),");"),D(i);case"DoExpression":var W=e.call(function(e){return u(e,t,r)},"body");return D(["do {\n",W.indent(t.tabWidth),"\n}"]);case"BreakStatement":var i=["break"];return n.label&&i.push(" ",e.call(r,"label")),i.push(";"),D(i);case"ContinueStatement":var i=["continue"];return n.label&&i.push(" ",e.call(r,"label")),i.push(";"),D(i);case"LabeledStatement":return D([e.call(r,"label"),":\n",e.call(r,"body")]);case"TryStatement":var i=["try ",e.call(r,"block")];return n.handler?i.push(" ",e.call(r,"handler")):n.handlers&&e.each(function(e){i.push(" ",r(e))},"handlers"),n.finalizer&&i.push(" finally ",e.call(r,"finalizer")),D(i);case"CatchClause":var i=["catch (",e.call(r,"param")];return n.guard&&i.push(" if ",e.call(r,"guard")),i.push(") ",e.call(r,"body")),D(i);case"ThrowStatement":return D(["throw ",e.call(r,"argument"),";"]);case"SwitchStatement":return D(["switch (",e.call(r,"discriminant"),") {\n",A("\n").join(e.map(r,"cases")),"\n}"]);case"SwitchCase":var i=[];return n.test?i.push("case ",e.call(r,"test"),":"):i.push("default:"),n.consequent.length>0&&i.push("\n",e.call(function(e){return u(e,t,r)},"consequent").indent(t.tabWidth)),D(i);case"DebuggerStatement":return A("debugger;");case"XJSAttribute":case"JSXAttribute":var i=[e.call(r,"name")];return n.value&&i.push("=",e.call(r,"value")),D(i);case"XJSIdentifier":case"JSXIdentifier":return A(n.name,t);case"XJSNamespacedName":case"JSXNamespacedName":return A(":").join([e.call(r,"namespace"),e.call(r,"name")]);case"XJSMemberExpression":case"JSXMemberExpression":return A(".").join([e.call(r,"object"),e.call(r,"property")]);case"XJSSpreadAttribute":case"JSXSpreadAttribute":return D(["{...",e.call(r,"argument"),"}"]);case"XJSExpressionContainer":case"JSXExpressionContainer":return D(["{",e.call(r,"expression"),"}"]);case"XJSElement":case"JSXElement":var X=e.call(r,"openingElement");if(n.openingElement.selfClosing)return E.ok(!n.closingElement),X;var Y=D(e.map(function(e){var t=e.getValue();if(_.Literal.check(t)&&"string"==typeof t.value){if(/\S/.test(t.value))return t.value.replace(/^\s+|\s+$/g,"");if(/\n/.test(t.value))return"\n"}return r(e)},"children")).indentTail(t.tabWidth),J=e.call(r,"closingElement");return D([X,Y,J]);case"XJSOpeningElement":case"JSXOpeningElement":var i=["<",e.call(r,"name")],z=[];e.each(function(e){z.push(" ",r(e))},"attributes");var K=D(z),$=K.length>1||K.getLineLength(1)>t.wrapColumn;return $&&(z.forEach(function(e,t){" "===e&&(E.strictEqual(t%2,0),z[t]="\n")}),K=D(z).indentTail(t.tabWidth)),i.push(K,n.selfClosing?" />":">"),D(i);case"XJSClosingElement":case"JSXClosingElement":return D(["</",e.call(r,"name"),">"]);case"XJSText":case"JSXText":return A(n.value,t);case"XJSEmptyExpression":case"JSXEmptyExpression":return A("");case"TypeAnnotatedIdentifier":return D([e.call(r,"annotation")," ",e.call(r,"identifier")]);case"ClassBody":return 0===n.body.length?A("{}"):D(["{\n",e.call(function(e){return u(e,t,r)},"body").indent(t.tabWidth),"\n}"]);case"ClassPropertyDefinition":var i=["static ",e.call(r,"definition")];return _.MethodDefinition.check(n.definition)||i.push(";"),D(i);case"ClassProperty":var i=[];return n["static"]&&i.push("static "),i.push(e.call(r,"key")),n.typeAnnotation&&i.push(e.call(r,"typeAnnotation")),n.value&&i.push(" = ",e.call(r,"value")),i.push(";"),D(i);case"ClassDeclaration":case"ClassExpression":var i=["class"];return n.id&&i.push(" ",e.call(r,"id"),e.call(r,"typeParameters")),n.superClass&&i.push(" extends ",e.call(r,"superClass"),e.call(r,"superTypeParameters")),n["implements"]&&i.push(" implements ",A(", ").join(e.map(r,"implements"))),i.push(" ",e.call(r,"body")),D(i);case"TemplateElement":return A(n.value.raw,t);case"TemplateLiteral":var Q=e.map(r,"expressions"),i=["`"];return e.each(function(e){var t=e.getName();i.push(r(e)),t<Q.length&&i.push("${",Q[t],"}")},"quasis"),i.push("`"),D(i);case"TaggedTemplateExpression":return D([e.call(r,"tag"),e.call(r,"quasi")]);case"Node":case"Printable":case"SourceLocation":case"Position":case"Statement":case"Function":case"Pattern":case"Expression":case"Declaration":case"Specifier":case"NamedSpecifier":case"Comment":case"MemberTypeAnnotation":case"TupleTypeAnnotation":case"Type":throw new Error("unprintable type: "+JSON.stringify(n.type));case"CommentBlock":case"Block":return D(["/*",A(n.value,t),"*/"]);case"CommentLine":case"Line":return D(["//",A(n.value,t)]);case"TypeAnnotation":var i=[];return n.typeAnnotation?("FunctionTypeAnnotation"!==n.typeAnnotation.type&&i.push(": "),i.push(e.call(r,"typeAnnotation")),D(i)):A("");case"AnyTypeAnnotation":return A("any",t);case"MixedTypeAnnotation":return A("mixed",t);case"ArrayTypeAnnotation":return D([e.call(r,"elementType"),"[]"]);
case"BooleanTypeAnnotation":return A("boolean",t);case"BooleanLiteralTypeAnnotation":return E.strictEqual(typeof n.value,"boolean"),A(""+n.value,t);case"DeclareClass":return D([A("declare class ",t),e.call(r,"id")," ",e.call(r,"body")]);case"DeclareFunction":return D([A("declare function ",t),e.call(r,"id"),";"]);case"DeclareModule":return D([A("declare module ",t),e.call(r,"id")," ",e.call(r,"body")]);case"DeclareVariable":return D([A("declare var ",t),e.call(r,"id"),";"]);case"FunctionTypeAnnotation":var i=[],Z=e.getParentNode(0),ee=!(_.ObjectTypeCallProperty.check(Z)||_.DeclareFunction.check(e.getParentNode(2))),te=ee&&!_.FunctionTypeParam.check(Z);return te&&i.push(": "),i.push("(",A(", ").join(e.map(r,"params")),")"),n.returnType&&i.push(ee?" => ":": ",e.call(r,"returnType")),D(i);case"FunctionTypeParam":return D([e.call(r,"name"),": ",e.call(r,"typeAnnotation")]);case"GenericTypeAnnotation":return D([e.call(r,"id"),e.call(r,"typeParameters")]);case"InterfaceDeclaration":var i=[A("interface ",t),e.call(r,"id"),e.call(r,"typeParameters")," "];return n["extends"]&&i.push("extends ",A(", ").join(e.map(r,"extends"))),i.push(" ",e.call(r,"body")),D(i);case"ClassImplements":case"InterfaceExtends":return D([e.call(r,"id"),e.call(r,"typeParameters")]);case"IntersectionTypeAnnotation":return A(" & ").join(e.map(r,"types"));case"NullableTypeAnnotation":return D(["?",e.call(r,"typeAnnotation")]);case"NumberTypeAnnotation":return A("number",t);case"ObjectTypeCallProperty":return e.call(r,"value");case"ObjectTypeIndexer":return D(["[",e.call(r,"id"),": ",e.call(r,"key"),"]: ",e.call(r,"value")]);case"ObjectTypeProperty":return D([e.call(r,"key"),": ",e.call(r,"value")]);case"QualifiedTypeIdentifier":return D([e.call(r,"qualification"),".",e.call(r,"id")]);case"StringLiteralTypeAnnotation":return A(v(n.value,t),t);case"NumberLiteralTypeAnnotation":return E.strictEqual(typeof n.value,"number"),A(""+n.value,t);case"StringTypeAnnotation":return A("string",t);case"TypeAlias":return D(["type ",e.call(r,"id")," = ",e.call(r,"right"),";"]);case"TypeCastExpression":return D(["(",e.call(r,"expression"),e.call(r,"typeAnnotation"),")"]);case"TypeParameterDeclaration":case"TypeParameterInstantiation":return D(["<",A(", ").join(e.map(r,"params")),">"]);case"TypeofTypeAnnotation":return D([A("typeof ",t),e.call(r,"argument")]);case"UnionTypeAnnotation":return A(" | ").join(e.map(r,"types"));case"VoidTypeAnnotation":return A("void",t);case"ClassHeritage":case"ComprehensionBlock":case"ComprehensionExpression":case"Glob":case"GeneratorExpression":case"LetStatement":case"LetExpression":case"GraphExpression":case"GraphIndexExpression":case"XMLDefaultDeclaration":case"XMLAnyName":case"XMLQualifiedIdentifier":case"XMLFunctionQualifiedIdentifier":case"XMLAttributeSelector":case"XMLFilterExpression":case"XML":case"XMLElement":case"XMLList":case"XMLEscape":case"XMLText":case"XMLStartTag":case"XMLEndTag":case"XMLPointTag":case"XMLName":case"XMLAttribute":case"XMLCdata":case"XMLComment":case"XMLProcessingInstruction":default:throw new Error("unknown type: "+JSON.stringify(n.type))}return p}function u(e,t,r){var n=_.ClassBody&&_.ClassBody.check(e.getParentNode()),i=[],a=!1,s=!1;e.each(function(e){var t=(e.getName(),e.getValue());t&&"EmptyStatement"!==t.type&&(_.Comment.check(t)?a=!0:n||(_.Statement.assert(t),s=!0),i.push({node:t,printed:r(e)}))}),a&&E.strictEqual(s,!1,"Comments may appear as statements in otherwise empty statement lists, but may not coexist with non-Comment nodes.");var o=null,u=i.length,p=[];return i.forEach(function(e,r){var n,i,a=e.printed,s=e.node,c=a.length>1,f=r>0,d=u-1>r,h=s&&s.loc&&s.loc.lines,m=h&&t.reuseWhitespace&&B.getTrueLoc(s,h);if(f)if(m){var y=h.skipSpaces(m.start,!0),g=y?y.line:1,v=m.start.line-g;n=Array(v+1).join("\n")}else n=c?"\n\n":"\n";else n="";if(d)if(m){var b=h.skipSpaces(m.end),E=b?b.line:h.length,x=E-m.end.line;i=Array(x+1).join("\n")}else i=c?"\n\n":"\n";else i="";p.push(l(o,n),a),d?o=i:i&&p.push(i)}),D(p)}function l(e,t){if(!e&&!t)return A("");if(!e)return A(t);if(!t)return A(e);var r=A(e),n=A(t);return n.length>r.length?n:r}function c(e,t,r){var n=e.getNode(),i=n.kind,a=[];_.FunctionExpression.assert(n.value),n.decorators&&e.each(function(e){a.push(r(e),"\n")},"decorators"),n.value.async&&a.push("async "),i&&"init"!==i&&"method"!==i&&"constructor"!==i?(E.ok("get"===i||"set"===i),a.push(i," ")):n.value.generator&&a.push("*");var s=e.call(r,"key");return n.computed&&(s=D(["[",s,"]"])),a.push(s,e.call(r,"value","typeParameters"),"(",e.call(function(e){return d(e,t,r)},"value"),")",e.call(r,"value","returnType")," ",e.call(r,"value","body")),D(a)}function f(e,t,r){var n=e.map(r,"arguments"),i=A(", ").join(n);return i.getLineLength(1)>t.wrapColumn?(i=A(",\n").join(n),D(["(\n",i.indent(t.tabWidth),t.trailingComma?",\n)":"\n)"])):D(["(",i,")"])}function d(e,t,r){var n=e.getValue();_.Function.assert(n);var i=e.map(r,"params");n.defaults&&e.each(function(e){var t=e.getName(),n=i[t];n&&e.getValue()&&(i[t]=D([n,"=",r(e)]))},"defaults"),n.rest&&i.push(D(["...",e.call(r,"rest")]));var a=A(", ").join(i);return a.length>1||a.getLineLength(1)>t.wrapColumn?(a=A(",\n").join(i),t.trailingComma&&!n.rest&&(a=D([a,",\n"])),D(["\n",a.indent(t.tabWidth)])):a}function h(e,t){return D(e.length>1?[" ",e]:["\n",b(e).indent(t.tabWidth)])}function m(e){var t=e.lastPos();do{var r=e.charAt(t);if(/\S/.test(r))return r}while(e.prevPos(t))}function y(e){return"}"===m(e)}function g(e){return e.replace(/['"]/g,function(e){return'"'===e?"'":'"'})}function v(e,t){switch(F.assert(e),t.quote){case"auto":var r=JSON.stringify(e),n=g(JSON.stringify(g(e)));return r.length>n.length?n:r;case"single":return g(JSON.stringify(g(e)));case"double":default:return JSON.stringify(e)}}function b(e){var t=m(e);return!t||"\n};".indexOf(t)<0?D([e,";"]):e}var E=e(1),x=(e(607),e(558).printComments),S=e(560),A=S.fromString,D=S.concat,C=e(562).normalize,w=e(564).getReprinter,I=e(566),_=I.namedTypes,F=I.builtInTypes.string,k=I.builtInTypes.object,P=e(559),B=e(567),T=n.prototype,M=!1;T.toString=function(){return M||(console.warn("Deprecation warning: recast.print now returns an object with a .code property. You appear to be treating the object as a string, which might still work but is strongly discouraged."),M=!0),this.code};var O=new n("");r.Printer=i},{1:1,558:558,559:559,560:560,562:562,564:564,566:566,567:567,607:607}],566:[function(e,t,r){t.exports=e(584)},{584:584}],567:[function(e,t,r){function n(){for(var e={},t=arguments.length,r=0;t>r;++r)for(var n=Object.keys(arguments[r]),i=n.length,a=0;i>a;++a)e[n[a]]=!0;return e}function i(e,t){return e.line-t.line||e.column-t.column}function a(e){return{line:e.line,column:e.column}}var s=(e(1),e(566)),o=(s.getFieldValue,s.namedTypes),u=e(607),p=u.SourceMapConsumer,l=u.SourceMapGenerator,c=Object.prototype.hasOwnProperty;r.getUnionOfKeys=n,r.comparePos=i,r.copyPos=a,r.composeSourceMaps=function(e,t){if(!e)return t||null;if(!t)return e;var r=new p(e),n=new p(t),i=new l({file:t.file,sourceRoot:t.sourceRoot}),s={};return n.eachMapping(function(e){var t=r.originalPositionFor({line:e.originalLine,column:e.originalColumn}),n=t.source;if(null!==n){i.addMapping({source:n,original:a(t),generated:{line:e.generatedLine,column:e.generatedColumn},name:e.name});var o=r.sourceContentFor(n);o&&!c.call(s,n)&&(s[n]=o,i.setSourceContent(n,o))}}),i.toJSON()},r.getTrueLoc=function(e,t){if(!e.loc)return null;var r=e.loc.start,n=e.loc.end;return e.comments&&e.comments.forEach(function(e){e.loc&&(i(e.loc.start,r)<0&&(r=e.loc.start),i(n,e.loc.end)<0&&(n=e.loc.end))}),{start:t.skipSpaces(r,!1,!1),end:t.skipSpaces(n,!0,!1)}},r.fixFaultyLocations=function(e){(o.MethodDefinition&&o.MethodDefinition.check(e)||o.Property.check(e)&&(e.method||e.shorthand))&&(e.value.loc=null,o.FunctionExpression.check(e.value)&&(e.value.id=null));var t=e.loc;t&&(t.start.line<1&&(t.start.line=1),t.end.line<1&&(t.end.line=1))}},{1:1,566:566,607:607}],568:[function(e,t,r){(function(t){function n(e,t){return new c(t).print(e)}function i(e,t){return new c(t).printGenerically(e)}function a(e,r){return s(t.argv[2],e,r)}function s(t,r,n){e(3).readFile(t,"utf-8",function(e,t){return e?void console.error(e):void u(t,r,n)})}function o(e){t.stdout.write(e)}function u(e,t,r){var i=r&&r.writeback||o;t(l(e,r),function(e){i(n(e,r).code)})}var p=e(566),l=e(563).parse,c=e(565).Printer;Object.defineProperties(r,{parse:{enumerable:!0,value:l},visit:{enumerable:!0,value:p.visit},print:{enumerable:!0,value:n},prettyPrint:{enumerable:!1,value:i},types:{enumerable:!1,value:p},run:{enumerable:!1,value:a}})}).call(this,e(10))},{10:10,3:3,563:563,565:565,566:566}],569:[function(e,t,r){e(573);var n=e(583),i=e(582).defaults,a=n.Type.def,s=n.Type.or;a("Noop").bases("Node").build(),a("DoExpression").bases("Expression").build("body").field("body",[a("Statement")]),a("Super").bases("Expression").build(),a("BindExpression").bases("Expression").build("object","callee").field("object",s(a("Expression"),null)).field("callee",a("Expression")),a("Decorator").bases("Node").build("expression").field("expression",a("Expression")),a("Property").field("decorators",s([a("Decorator")],null),i["null"]),a("MethodDefinition").field("decorators",s([a("Decorator")],null),i["null"]),a("MetaProperty").bases("Expression").build("meta","property").field("meta",a("Identifier")).field("property",a("Identifier")),a("ParenthesizedExpression").bases("Expression").build("expression").field("expression",a("Expression")),a("ImportSpecifier").bases("ModuleSpecifier").build("imported","local").field("imported",a("Identifier")),a("ImportDefaultSpecifier").bases("ModuleSpecifier").build("local"),a("ImportNamespaceSpecifier").bases("ModuleSpecifier").build("local"),a("ExportDefaultDeclaration").bases("Declaration").build("declaration").field("declaration",s(a("Declaration"),a("Expression"))),a("ExportNamedDeclaration").bases("Declaration").build("declaration","specifiers","source").field("declaration",s(a("Declaration"),null)).field("specifiers",[a("ExportSpecifier")],i.emptyArray).field("source",s(a("Literal"),null),i["null"]),a("ExportSpecifier").bases("ModuleSpecifier").build("local","exported").field("exported",a("Identifier")),a("ExportNamespaceSpecifier").bases("Specifier").build("exported").field("exported",a("Identifier")),a("ExportDefaultSpecifier").bases("Specifier").build("exported").field("exported",a("Identifier")),a("ExportAllDeclaration").bases("Declaration").build("exported","source").field("exported",s(a("Identifier"),null)).field("source",a("Literal")),a("CommentBlock").bases("Comment").build("value","leading","trailing"),a("CommentLine").bases("Comment").build("value","leading","trailing")},{573:573,582:582,583:583}],570:[function(e,t,r){var n=e(583),i=n.Type,a=i.def,s=i.or,o=e(582),u=o.defaults,p=o.geq;a("Printable").field("loc",s(a("SourceLocation"),null),u["null"],!0),a("Node").bases("Printable").field("type",String).field("comments",s([a("Comment")],null),u["null"],!0),a("SourceLocation").build("start","end","source").field("start",a("Position")).field("end",a("Position")).field("source",s(String,null),u["null"]),a("Position").build("line","column").field("line",p(1)).field("column",p(0)),a("File").bases("Node").build("program").field("program",a("Program")),a("Program").bases("Node").build("body").field("body",[a("Statement")]),a("Function").bases("Node").field("id",s(a("Identifier"),null),u["null"]).field("params",[a("Pattern")]).field("body",a("BlockStatement")),a("Statement").bases("Node"),a("EmptyStatement").bases("Statement").build(),a("BlockStatement").bases("Statement").build("body").field("body",[a("Statement")]),a("ExpressionStatement").bases("Statement").build("expression").field("expression",a("Expression")),a("IfStatement").bases("Statement").build("test","consequent","alternate").field("test",a("Expression")).field("consequent",a("Statement")).field("alternate",s(a("Statement"),null),u["null"]),a("LabeledStatement").bases("Statement").build("label","body").field("label",a("Identifier")).field("body",a("Statement")),a("BreakStatement").bases("Statement").build("label").field("label",s(a("Identifier"),null),u["null"]),a("ContinueStatement").bases("Statement").build("label").field("label",s(a("Identifier"),null),u["null"]),a("WithStatement").bases("Statement").build("object","body").field("object",a("Expression")).field("body",a("Statement")),a("SwitchStatement").bases("Statement").build("discriminant","cases","lexical").field("discriminant",a("Expression")).field("cases",[a("SwitchCase")]).field("lexical",Boolean,u["false"]),a("ReturnStatement").bases("Statement").build("argument").field("argument",s(a("Expression"),null)),a("ThrowStatement").bases("Statement").build("argument").field("argument",a("Expression")),a("TryStatement").bases("Statement").build("block","handler","finalizer").field("block",a("BlockStatement")).field("handler",s(a("CatchClause"),null),function(){return this.handlers&&this.handlers[0]||null}).field("handlers",[a("CatchClause")],function(){return this.handler?[this.handler]:[]},!0).field("guardedHandlers",[a("CatchClause")],u.emptyArray).field("finalizer",s(a("BlockStatement"),null),u["null"]),a("CatchClause").bases("Node").build("param","guard","body").field("param",a("Pattern")).field("guard",s(a("Expression"),null),u["null"]).field("body",a("BlockStatement")),a("WhileStatement").bases("Statement").build("test","body").field("test",a("Expression")).field("body",a("Statement")),a("DoWhileStatement").bases("Statement").build("body","test").field("body",a("Statement")).field("test",a("Expression")),a("ForStatement").bases("Statement").build("init","test","update","body").field("init",s(a("VariableDeclaration"),a("Expression"),null)).field("test",s(a("Expression"),null)).field("update",s(a("Expression"),null)).field("body",a("Statement")),a("ForInStatement").bases("Statement").build("left","right","body").field("left",s(a("VariableDeclaration"),a("Expression"))).field("right",a("Expression")).field("body",a("Statement")),a("DebuggerStatement").bases("Statement").build(),a("Declaration").bases("Statement"),a("FunctionDeclaration").bases("Function","Declaration").build("id","params","body").field("id",a("Identifier")),a("FunctionExpression").bases("Function","Expression").build("id","params","body"),a("VariableDeclaration").bases("Declaration").build("kind","declarations").field("kind",s("var","let","const")).field("declarations",[a("VariableDeclarator")]),a("VariableDeclarator").bases("Node").build("id","init").field("id",a("Pattern")).field("init",s(a("Expression"),null)),a("Expression").bases("Node","Pattern"),a("ThisExpression").bases("Expression").build(),a("ArrayExpression").bases("Expression").build("elements").field("elements",[s(a("Expression"),null)]),a("ObjectExpression").bases("Expression").build("properties").field("properties",[a("Property")]),a("Property").bases("Node").build("kind","key","value").field("kind",s("init","get","set")).field("key",s(a("Literal"),a("Identifier"))).field("value",a("Expression")),a("SequenceExpression").bases("Expression").build("expressions").field("expressions",[a("Expression")]);var l=s("-","+","!","~","typeof","void","delete");a("UnaryExpression").bases("Expression").build("operator","argument","prefix").field("operator",l).field("argument",a("Expression")).field("prefix",Boolean,u["true"]);var c=s("==","!=","===","!==","<","<=",">",">=","<<",">>",">>>","+","-","*","/","%","&","|","^","in","instanceof","..");a("BinaryExpression").bases("Expression").build("operator","left","right").field("operator",c).field("left",a("Expression")).field("right",a("Expression"));var f=s("=","+=","-=","*=","/=","%=","<<=",">>=",">>>=","|=","^=","&=");a("AssignmentExpression").bases("Expression").build("operator","left","right").field("operator",f).field("left",a("Pattern")).field("right",a("Expression"));var d=s("++","--");a("UpdateExpression").bases("Expression").build("operator","argument","prefix").field("operator",d).field("argument",a("Expression")).field("prefix",Boolean);var h=s("||","&&");a("LogicalExpression").bases("Expression").build("operator","left","right").field("operator",h).field("left",a("Expression")).field("right",a("Expression")),a("ConditionalExpression").bases("Expression").build("test","consequent","alternate").field("test",a("Expression")).field("consequent",a("Expression")).field("alternate",a("Expression")),a("NewExpression").bases("Expression").build("callee","arguments").field("callee",a("Expression")).field("arguments",[a("Expression")]),a("CallExpression").bases("Expression").build("callee","arguments").field("callee",a("Expression")).field("arguments",[a("Expression")]),a("MemberExpression").bases("Expression").build("object","property","computed").field("object",a("Expression")).field("property",s(a("Identifier"),a("Expression"))).field("computed",Boolean,u["false"]),a("Pattern").bases("Node"),a("SwitchCase").bases("Node").build("test","consequent").field("test",s(a("Expression"),null)).field("consequent",[a("Statement")]),a("Identifier").bases("Node","Expression","Pattern").build("name").field("name",String),a("Literal").bases("Node","Expression").build("value").field("value",s(String,Boolean,null,Number,RegExp)).field("regex",s({pattern:String,flags:String},null),function(){if(this.value instanceof RegExp){var e="";return this.value.ignoreCase&&(e+="i"),this.value.multiline&&(e+="m"),this.value.global&&(e+="g"),{pattern:this.value.source,flags:e}}return null}),a("Comment").bases("Printable").field("value",String).field("leading",Boolean,u["true"]).field("trailing",Boolean,u["false"])},{582:582,583:583}],571:[function(e,t,r){e(570);var n=e(583),i=n.Type.def,a=n.Type.or;i("XMLDefaultDeclaration").bases("Declaration").field("namespace",i("Expression")),i("XMLAnyName").bases("Expression"),i("XMLQualifiedIdentifier").bases("Expression").field("left",a(i("Identifier"),i("XMLAnyName"))).field("right",a(i("Identifier"),i("Expression"))).field("computed",Boolean),i("XMLFunctionQualifiedIdentifier").bases("Expression").field("right",a(i("Identifier"),i("Expression"))).field("computed",Boolean),i("XMLAttributeSelector").bases("Expression").field("attribute",i("Expression")),i("XMLFilterExpression").bases("Expression").field("left",i("Expression")).field("right",i("Expression")),i("XMLElement").bases("XML","Expression").field("contents",[i("XML")]),i("XMLList").bases("XML","Expression").field("contents",[i("XML")]),i("XML").bases("Node"),i("XMLEscape").bases("XML").field("expression",i("Expression")),i("XMLText").bases("XML").field("text",String),i("XMLStartTag").bases("XML").field("contents",[i("XML")]),i("XMLEndTag").bases("XML").field("contents",[i("XML")]),i("XMLPointTag").bases("XML").field("contents",[i("XML")]),i("XMLName").bases("XML").field("contents",a(String,[i("XML")])),i("XMLAttribute").bases("XML").field("value",String),i("XMLCdata").bases("XML").field("contents",String),i("XMLComment").bases("XML").field("contents",String),i("XMLProcessingInstruction").bases("XML").field("target",String).field("contents",a(String,null))},{570:570,583:583}],572:[function(e,t,r){e(570);var n=e(583),i=n.Type.def,a=n.Type.or,s=e(582).defaults;i("Function").field("generator",Boolean,s["false"]).field("expression",Boolean,s["false"]).field("defaults",[a(i("Expression"),null)],s.emptyArray).field("rest",a(i("Identifier"),null),s["null"]),i("RestElement").bases("Pattern").build("argument").field("argument",i("Pattern")),i("SpreadElementPattern").bases("Pattern").build("argument").field("argument",i("Pattern")),i("FunctionDeclaration").build("id","params","body","generator","expression"),i("FunctionExpression").build("id","params","body","generator","expression"),i("ArrowFunctionExpression").bases("Function","Expression").build("params","body","expression").field("id",null,s["null"]).field("body",a(i("BlockStatement"),i("Expression"))).field("generator",!1,s["false"]),i("YieldExpression").bases("Expression").build("argument","delegate").field("argument",a(i("Expression"),null)).field("delegate",Boolean,s["false"]),i("GeneratorExpression").bases("Expression").build("body","blocks","filter").field("body",i("Expression")).field("blocks",[i("ComprehensionBlock")]).field("filter",a(i("Expression"),null)),i("ComprehensionExpression").bases("Expression").build("body","blocks","filter").field("body",i("Expression")).field("blocks",[i("ComprehensionBlock")]).field("filter",a(i("Expression"),null)),i("ComprehensionBlock").bases("Node").build("left","right","each").field("left",i("Pattern")).field("right",i("Expression")).field("each",Boolean),i("Property").field("key",a(i("Literal"),i("Identifier"),i("Expression"))).field("value",a(i("Expression"),i("Pattern"))).field("method",Boolean,s["false"]).field("shorthand",Boolean,s["false"]).field("computed",Boolean,s["false"]),i("PropertyPattern").bases("Pattern").build("key","pattern").field("key",a(i("Literal"),i("Identifier"),i("Expression"))).field("pattern",i("Pattern")).field("computed",Boolean,s["false"]),i("ObjectPattern").bases("Pattern").build("properties").field("properties",[a(i("PropertyPattern"),i("Property"))]),i("ArrayPattern").bases("Pattern").build("elements").field("elements",[a(i("Pattern"),null)]),i("MethodDefinition").bases("Declaration").build("kind","key","value","static").field("kind",a("constructor","method","get","set")).field("key",a(i("Literal"),i("Identifier"),i("Expression"))).field("value",i("Function")).field("computed",Boolean,s["false"]).field("static",Boolean,s["false"]),i("SpreadElement").bases("Node").build("argument").field("argument",i("Expression")),i("ArrayExpression").field("elements",[a(i("Expression"),i("SpreadElement"),i("RestElement"),null)]),i("NewExpression").field("arguments",[a(i("Expression"),i("SpreadElement"))]),i("CallExpression").field("arguments",[a(i("Expression"),i("SpreadElement"))]),i("AssignmentPattern").bases("Pattern").build("left","right").field("left",i("Pattern")).field("right",i("Expression"));var o=a(i("MethodDefinition"),i("VariableDeclarator"),i("ClassPropertyDefinition"),i("ClassProperty"));i("ClassProperty").bases("Declaration").build("key").field("key",a(i("Literal"),i("Identifier"),i("Expression"))).field("computed",Boolean,s["false"]),i("ClassPropertyDefinition").bases("Declaration").build("definition").field("definition",o),i("ClassBody").bases("Declaration").build("body").field("body",[o]),i("ClassDeclaration").bases("Declaration").build("id","body","superClass").field("id",a(i("Identifier"),null)).field("body",i("ClassBody")).field("superClass",a(i("Expression"),null),s["null"]),i("ClassExpression").bases("Expression").build("id","body","superClass").field("id",a(i("Identifier"),null),s["null"]).field("body",i("ClassBody")).field("superClass",a(i("Expression"),null),s["null"]).field("implements",[i("ClassImplements")],s.emptyArray),i("ClassImplements").bases("Node").build("id").field("id",i("Identifier")).field("superClass",a(i("Expression"),null),s["null"]),i("Specifier").bases("Node"),i("ModuleSpecifier").bases("Specifier").field("local",a(i("Identifier"),null),s["null"]).field("id",a(i("Identifier"),null),s["null"]).field("name",a(i("Identifier"),null),s["null"]),i("TaggedTemplateExpression").bases("Expression").build("tag","quasi").field("tag",i("Expression")).field("quasi",i("TemplateLiteral")),i("TemplateLiteral").bases("Expression").build("quasis","expressions").field("quasis",[i("TemplateElement")]).field("expressions",[i("Expression")]),i("TemplateElement").bases("Node").build("value","tail").field("value",{cooked:String,raw:String}).field("tail",Boolean)},{570:570,582:582,583:583}],573:[function(e,t,r){e(572);var n=e(583),i=n.Type.def,a=n.Type.or,s=(n.builtInTypes,e(582).defaults);i("Function").field("async",Boolean,s["false"]),i("SpreadProperty").bases("Node").build("argument").field("argument",i("Expression")),i("ObjectExpression").field("properties",[a(i("Property"),i("SpreadProperty"))]),i("SpreadPropertyPattern").bases("Pattern").build("argument").field("argument",i("Pattern")),i("ObjectPattern").field("properties",[a(i("Property"),i("PropertyPattern"),i("SpreadPropertyPattern"))]),i("AwaitExpression").bases("Expression").build("argument","all").field("argument",a(i("Expression"),null)).field("all",Boolean,s["false"])},{572:572,582:582,583:583}],574:[function(e,t,r){e(573);var n=e(583),i=e(582).defaults,a=n.Type.def,s=n.Type.or;a("VariableDeclaration").field("declarations",[s(a("VariableDeclarator"),a("Identifier"))]),a("Property").field("value",s(a("Expression"),a("Pattern"))),a("ArrayPattern").field("elements",[s(a("Pattern"),a("SpreadElement"),null)]),a("ObjectPattern").field("properties",[s(a("Property"),a("PropertyPattern"),a("SpreadPropertyPattern"),a("SpreadProperty"))]),a("ExportSpecifier").bases("ModuleSpecifier").build("id","name"),a("ExportBatchSpecifier").bases("Specifier").build(),a("ImportSpecifier").bases("ModuleSpecifier").build("id","name"),a("ImportNamespaceSpecifier").bases("ModuleSpecifier").build("id"),a("ImportDefaultSpecifier").bases("ModuleSpecifier").build("id"),a("ExportDeclaration").bases("Declaration").build("default","declaration","specifiers","source").field("default",Boolean).field("declaration",s(a("Declaration"),a("Expression"),null)).field("specifiers",[s(a("ExportSpecifier"),a("ExportBatchSpecifier"))],i.emptyArray).field("source",s(a("Literal"),null),i["null"]),a("ImportDeclaration").bases("Declaration").build("specifiers","source").field("specifiers",[s(a("ImportSpecifier"),a("ImportNamespaceSpecifier"),a("ImportDefaultSpecifier"))],i.emptyArray).field("source",a("Literal")),a("Block").bases("Comment").build("value","leading","trailing"),a("Line").bases("Comment").build("value","leading","trailing")},{573:573,582:582,583:583}],575:[function(e,t,r){e(573);var n=e(583),i=n.Type.def,a=n.Type.or,s=e(582).defaults;i("JSXAttribute").bases("Node").build("name","value").field("name",a(i("JSXIdentifier"),i("JSXNamespacedName"))).field("value",a(i("Literal"),i("JSXExpressionContainer"),null),s["null"]),i("JSXIdentifier").bases("Identifier").build("name").field("name",String),i("JSXNamespacedName").bases("Node").build("namespace","name").field("namespace",i("JSXIdentifier")).field("name",i("JSXIdentifier")),i("JSXMemberExpression").bases("MemberExpression").build("object","property").field("object",a(i("JSXIdentifier"),i("JSXMemberExpression"))).field("property",i("JSXIdentifier")).field("computed",Boolean,s["false"]);var o=a(i("JSXIdentifier"),i("JSXNamespacedName"),i("JSXMemberExpression"));i("JSXSpreadAttribute").bases("Node").build("argument").field("argument",i("Expression"));var u=[a(i("JSXAttribute"),i("JSXSpreadAttribute"))];i("JSXExpressionContainer").bases("Expression").build("expression").field("expression",i("Expression")),i("JSXElement").bases("Expression").build("openingElement","closingElement","children").field("openingElement",i("JSXOpeningElement")).field("closingElement",a(i("JSXClosingElement"),null),s["null"]).field("children",[a(i("JSXElement"),i("JSXExpressionContainer"),i("JSXText"),i("Literal"))],s.emptyArray).field("name",o,function(){return this.openingElement.name},!0).field("selfClosing",Boolean,function(){return this.openingElement.selfClosing},!0).field("attributes",u,function(){return this.openingElement.attributes},!0),i("JSXOpeningElement").bases("Node").build("name","attributes","selfClosing").field("name",o).field("attributes",u,s.emptyArray).field("selfClosing",Boolean,s["false"]),i("JSXClosingElement").bases("Node").build("name").field("name",o),i("JSXText").bases("Literal").build("value").field("value",String),i("JSXEmptyExpression").bases("Expression").build(),i("Type").bases("Node"),i("AnyTypeAnnotation").bases("Type").build(),i("MixedTypeAnnotation").bases("Type").build(),i("VoidTypeAnnotation").bases("Type").build(),i("NumberTypeAnnotation").bases("Type").build(),i("NumberLiteralTypeAnnotation").bases("Type").build("value","raw").field("value",Number).field("raw",String),i("StringTypeAnnotation").bases("Type").build(),i("StringLiteralTypeAnnotation").bases("Type").build("value","raw").field("value",String).field("raw",String),i("BooleanTypeAnnotation").bases("Type").build(),i("BooleanLiteralTypeAnnotation").bases("Type").build("value","raw").field("value",Boolean).field("raw",String),i("TypeAnnotation").bases("Node").build("typeAnnotation").field("typeAnnotation",i("Type")),i("NullableTypeAnnotation").bases("Type").build("typeAnnotation").field("typeAnnotation",i("Type")),i("FunctionTypeAnnotation").bases("Type").build("params","returnType","rest","typeParameters").field("params",[i("FunctionTypeParam")]).field("returnType",i("Type")).field("rest",a(i("FunctionTypeParam"),null)).field("typeParameters",a(i("TypeParameterDeclaration"),null)),i("FunctionTypeParam").bases("Node").build("name","typeAnnotation","optional").field("name",i("Identifier")).field("typeAnnotation",i("Type")).field("optional",Boolean),i("ArrayTypeAnnotation").bases("Type").build("elementType").field("elementType",i("Type")),i("ObjectTypeAnnotation").bases("Type").build("properties").field("properties",[i("ObjectTypeProperty")]).field("indexers",[i("ObjectTypeIndexer")],s.emptyArray).field("callProperties",[i("ObjectTypeCallProperty")],s.emptyArray),i("ObjectTypeProperty").bases("Node").build("key","value","optional").field("key",a(i("Literal"),i("Identifier"))).field("value",i("Type")).field("optional",Boolean),i("ObjectTypeIndexer").bases("Node").build("id","key","value").field("id",i("Identifier")).field("key",i("Type")).field("value",i("Type")),i("ObjectTypeCallProperty").bases("Node").build("value").field("value",i("FunctionTypeAnnotation")).field("static",Boolean,!1),i("QualifiedTypeIdentifier").bases("Node").build("qualification","id").field("qualification",a(i("Identifier"),i("QualifiedTypeIdentifier"))).field("id",i("Identifier")),i("GenericTypeAnnotation").bases("Type").build("id","typeParameters").field("id",a(i("Identifier"),i("QualifiedTypeIdentifier"))).field("typeParameters",a(i("TypeParameterInstantiation"),null)),i("MemberTypeAnnotation").bases("Type").build("object","property").field("object",i("Identifier")).field("property",a(i("MemberTypeAnnotation"),i("GenericTypeAnnotation"))),i("UnionTypeAnnotation").bases("Type").build("types").field("types",[i("Type")]),i("IntersectionTypeAnnotation").bases("Type").build("types").field("types",[i("Type")]),i("TypeofTypeAnnotation").bases("Type").build("argument").field("argument",i("Type")),i("Identifier").field("typeAnnotation",a(i("TypeAnnotation"),null),s["null"]),i("TypeParameterDeclaration").bases("Node").build("params").field("params",[i("Identifier")]),i("TypeParameterInstantiation").bases("Node").build("params").field("params",[i("Type")]),i("Function").field("returnType",a(i("TypeAnnotation"),null),s["null"]).field("typeParameters",a(i("TypeParameterDeclaration"),null),s["null"]),i("ClassProperty").build("key","value","typeAnnotation","static").field("value",a(i("Expression"),null)).field("typeAnnotation",a(i("TypeAnnotation"),null)).field("static",Boolean,s["false"]),i("ClassImplements").field("typeParameters",a(i("TypeParameterInstantiation"),null),s["null"]),i("InterfaceDeclaration").bases("Statement").build("id","body","extends").field("id",i("Identifier")).field("typeParameters",a(i("TypeParameterDeclaration"),null),s["null"]).field("body",i("ObjectTypeAnnotation")).field("extends",[i("InterfaceExtends")]),i("InterfaceExtends").bases("Node").build("id").field("id",i("Identifier")).field("typeParameters",a(i("TypeParameterInstantiation"),null)),i("TypeAlias").bases("Statement").build("id","typeParameters","right").field("id",i("Identifier")).field("typeParameters",a(i("TypeParameterDeclaration"),null)).field("right",i("Type")),i("TypeCastExpression").bases("Expression").build("expression","typeAnnotation").field("expression",i("Expression")).field("typeAnnotation",i("TypeAnnotation")),i("TupleTypeAnnotation").bases("Type").build("types").field("types",[i("Type")]),i("DeclareVariable").bases("Statement").build("id").field("id",i("Identifier")),
i("DeclareFunction").bases("Statement").build("id").field("id",i("Identifier")),i("DeclareClass").bases("InterfaceDeclaration").build("id"),i("DeclareModule").bases("Statement").build("id","body").field("id",a(i("Identifier"),i("Literal"))).field("body",i("BlockStatement"))},{573:573,582:582,583:583}],576:[function(e,t,r){e(570);var n=e(583),i=n.Type.def,a=n.Type.or,s=e(582),o=s.geq,u=s.defaults;i("Function").field("body",a(i("BlockStatement"),i("Expression"))),i("ForInStatement").build("left","right","body","each").field("each",Boolean,u["false"]),i("ForOfStatement").bases("Statement").build("left","right","body").field("left",a(i("VariableDeclaration"),i("Expression"))).field("right",i("Expression")).field("body",i("Statement")),i("LetStatement").bases("Statement").build("head","body").field("head",[i("VariableDeclarator")]).field("body",i("Statement")),i("LetExpression").bases("Expression").build("head","body").field("head",[i("VariableDeclarator")]).field("body",i("Expression")),i("GraphExpression").bases("Expression").build("index","expression").field("index",o(0)).field("expression",i("Literal")),i("GraphIndexExpression").bases("Expression").build("index").field("index",o(0))},{570:570,582:582,583:583}],577:[function(e,t,r){function n(e,t,r){return c.check(r)?r.length=0:r=null,a(e,t,r)}function i(e){return/[_$a-z][_$a-z0-9]*/i.test(e)?"."+e:"["+JSON.stringify(e)+"]"}function a(e,t,r){return e===t?!0:c.check(e)?s(e,t,r):f.check(e)?o(e,t,r):d.check(e)?d.check(t)&&+e===+t:h.check(e)?h.check(t)&&e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.ignoreCase===t.ignoreCase:e==t}function s(e,t,r){c.assert(e);var n=e.length;if(!c.check(t)||t.length!==n)return r&&r.push("length"),!1;for(var i=0;n>i;++i){if(r&&r.push(i),i in e!=i in t)return!1;if(!a(e[i],t[i],r))return!1;if(r){var s=r.pop();if(s!==i)throw new Error(""+s)}}return!0}function o(e,t,r){if(f.assert(e),!f.check(t))return!1;if(e.type!==t.type)return r&&r.push("type"),!1;var n=p(e),i=n.length,s=p(t),o=s.length;if(i===o){for(var u=0;i>u;++u){var c=n[u],d=l(e,c),h=l(t,c);if(r&&r.push(c),!a(d,h,r))return!1;if(r){var y=r.pop();if(y!==c)throw new Error(""+y)}}return!0}if(!r)return!1;var g=Object.create(null);for(u=0;i>u;++u)g[n[u]]=!0;for(u=0;o>u;++u){if(c=s[u],!m.call(g,c))return r.push(c),!1;delete g[c]}for(c in g){r.push(c);break}return!1}var u=e(584),p=u.getFieldNames,l=u.getFieldValue,c=u.builtInTypes.array,f=u.builtInTypes.object,d=u.builtInTypes.Date,h=u.builtInTypes.RegExp,m=Object.prototype.hasOwnProperty;n.assert=function(e,t){var r=[];if(!n(e,t,r)){if(0!==r.length)throw new Error("Nodes differ in the following path: "+r.map(i).join(""));if(e!==t)throw new Error("Nodes must be equal")}},t.exports=n},{584:584}],578:[function(e,t,r){function n(e,t,r){if(!(this instanceof n))throw new Error("NodePath constructor cannot be invoked without 'new'");h.call(this,e,t,r)}function i(e){return l.BinaryExpression.check(e)||l.LogicalExpression.check(e)}function a(e){return l.CallExpression.check(e)?!0:d.check(e)?e.some(a):l.Node.check(e)?p.someField(e,function(e,t){return a(t)}):!1}function s(e){for(var t,r;e.parent;e=e.parent){if(t=e.node,r=e.parent.node,l.BlockStatement.check(r)&&"body"===e.parent.name&&0===e.name){if(r.body[0]!==t)throw new Error("Nodes must be equal");return!0}if(l.ExpressionStatement.check(r)&&"expression"===e.name){if(r.expression!==t)throw new Error("Nodes must be equal");return!0}if(l.SequenceExpression.check(r)&&"expressions"===e.parent.name&&0===e.name){if(r.expressions[0]!==t)throw new Error("Nodes must be equal")}else if(l.CallExpression.check(r)&&"callee"===e.name){if(r.callee!==t)throw new Error("Nodes must be equal")}else if(l.MemberExpression.check(r)&&"object"===e.name){if(r.object!==t)throw new Error("Nodes must be equal")}else if(l.ConditionalExpression.check(r)&&"test"===e.name){if(r.test!==t)throw new Error("Nodes must be equal")}else if(i(r)&&"left"===e.name){if(r.left!==t)throw new Error("Nodes must be equal")}else{if(!l.UnaryExpression.check(r)||r.prefix||"argument"!==e.name)return!1;if(r.argument!==t)throw new Error("Nodes must be equal")}}return!0}function o(e){if(l.VariableDeclaration.check(e.node)){var t=e.get("declarations").value;if(!t||0===t.length)return e.prune()}else if(l.ExpressionStatement.check(e.node)){if(!e.get("expression").value)return e.prune()}else l.IfStatement.check(e.node)&&u(e);return e}function u(e){var t=e.get("test").value,r=e.get("alternate").value,n=e.get("consequent").value;if(n||r){if(!n&&r){var i=c.unaryExpression("!",t,!0);l.UnaryExpression.check(t)&&"!"===t.operator&&(i=t.argument),e.get("test").replace(i),e.get("consequent").replace(r),e.get("alternate").replace()}}else{var a=c.expressionStatement(t);e.replace(a)}}var p=e(583),l=p.namedTypes,c=p.builders,f=p.builtInTypes.number,d=p.builtInTypes.array,h=e(580),m=e(581),y=n.prototype=Object.create(h.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}});Object.defineProperties(y,{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}}}),y.replace=function(){return delete this.node,delete this.parent,delete this.scope,h.prototype.replace.apply(this,arguments)},y.prune=function(){var e=this.parent;return this.replace(),o(e)},y._computeNode=function(){var e=this.value;if(l.Node.check(e))return e;var t=this.parentPath;return t&&t.node||null},y._computeParent=function(){var e=this.value,t=this.parentPath;if(!l.Node.check(e)){for(;t&&!l.Node.check(t.value);)t=t.parentPath;t&&(t=t.parentPath)}for(;t&&!l.Node.check(t.value);)t=t.parentPath;return t||null},y._computeScope=function(){var e=this.value,t=this.parentPath,r=t&&t.scope;return l.Node.check(e)&&m.isEstablishedBy(e)&&(r=new m(this,r)),r||null},y.getValueProperty=function(e){return p.getFieldValue(this.value,e)},y.needsParens=function(e){var t=this.parentPath;if(!t)return!1;var r=this.value;if(!l.Expression.check(r))return!1;if("Identifier"===r.type)return!1;for(;!l.Node.check(t.value);)if(t=t.parentPath,!t)return!1;var n=t.value;switch(r.type){case"UnaryExpression":case"SpreadElement":case"SpreadProperty":return"MemberExpression"===n.type&&"object"===this.name&&n.object===r;case"BinaryExpression":case"LogicalExpression":switch(n.type){case"CallExpression":return"callee"===this.name&&n.callee===r;case"UnaryExpression":case"SpreadElement":case"SpreadProperty":return!0;case"MemberExpression":return"object"===this.name&&n.object===r;case"BinaryExpression":case"LogicalExpression":var i=n.operator,t=g[i],s=r.operator,o=g[s];if(t>o)return!0;if(t===o&&"right"===this.name){if(n.right!==r)throw new Error("Nodes must be equal");return!0}default:return!1}case"SequenceExpression":switch(n.type){case"ForStatement":return!1;case"ExpressionStatement":return"expression"!==this.name;default:return!0}case"YieldExpression":switch(n.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"===n.type&&f.check(r.value)&&"object"===this.name&&n.object===r;case"AssignmentExpression":case"ConditionalExpression":switch(n.type){case"UnaryExpression":case"SpreadElement":case"SpreadProperty":case"BinaryExpression":case"LogicalExpression":return!0;case"CallExpression":return"callee"===this.name&&n.callee===r;case"ConditionalExpression":return"test"===this.name&&n.test===r;case"MemberExpression":return"object"===this.name&&n.object===r;default:return!1}default:if("NewExpression"===n.type&&"callee"===this.name&&n.callee===r)return a(r)}return e!==!0&&!this.canBeFirstInStatement()&&this.firstInStatement()?!0:!1};var g={};[["||"],["&&"],["|"],["^"],["&"],["==","===","!=","!=="],["<",">","<=",">=","in","instanceof"],[">>","<<",">>>"],["+","-"],["*","/","%"]].forEach(function(e,t){e.forEach(function(e){g[e]=t})}),y.canBeFirstInStatement=function(){var e=this.node;return!l.FunctionExpression.check(e)&&!l.ObjectExpression.check(e)},y.firstInStatement=function(){return s(this)},t.exports=n},{580:580,581:581,583:583}],579:[function(e,t,r){function n(){if(!(this instanceof n))throw new Error("PathVisitor constructor cannot be invoked without 'new'");this._reusableContextStack=[],this._methodNameTable=i(this),this._shouldVisitComments=h.call(this._methodNameTable,"Block")||h.call(this._methodNameTable,"Line"),this.Context=o(this),this._visiting=!1,this._changeReported=!1}function i(e){var t=Object.create(null);for(var r in e)/^visit[A-Z]/.test(r)&&(t[r.slice("visit".length)]=!0);for(var n=p.computeSupertypeLookupTable(t),i=Object.create(null),t=Object.keys(n),a=t.length,s=0;a>s;++s){var o=t[s];r="visit"+n[o],d.check(e[r])&&(i[o]=r)}return i}function a(e,t){for(var r in t)h.call(t,r)&&(e[r]=t[r]);return e}function s(e,t){if(!(e instanceof l))throw new Error("");if(!(t instanceof n))throw new Error("");var r=e.value;if(c.check(r))e.each(t.visitWithoutReset,t);else if(f.check(r)){var i=p.getFieldNames(r);t._shouldVisitComments&&r.comments&&i.indexOf("comments")<0&&i.push("comments");for(var a=i.length,s=[],o=0;a>o;++o){var u=i[o];h.call(r,u)||(r[u]=p.getFieldValue(r,u)),s.push(e.get(u))}for(var o=0;a>o;++o)t.visitWithoutReset(s[o])}else;return e.value}function o(e){function t(r){if(!(this instanceof t))throw new Error("");if(!(this instanceof n))throw new Error("");if(!(r instanceof l))throw new Error("");Object.defineProperty(this,"visitor",{value:e,writable:!1,enumerable:!0,configurable:!1}),this.currentPath=r,this.needToCallTraverse=!0,Object.seal(this)}if(!(e instanceof n))throw new Error("");var r=t.prototype=Object.create(e);return r.constructor=t,a(r,y),t}var u,p=e(583),l=e(578),c=(p.namedTypes.Printable,p.builtInTypes.array),f=p.builtInTypes.object,d=p.builtInTypes["function"],h=Object.prototype.hasOwnProperty;n.fromMethodsObject=function(e){function t(){if(!(this instanceof t))throw new Error("Visitor constructor cannot be invoked without 'new'");n.call(this)}if(e instanceof n)return e;if(!f.check(e))return new n;var r=t.prototype=Object.create(m);return r.constructor=t,a(r,e),a(t,n),d.assert(t.fromMethodsObject),d.assert(t.visit),new t},n.visit=function(e,t){return n.fromMethodsObject(t).visit(e)};var m=n.prototype;m.visit=function(){if(this._visiting)throw new Error("Recursively calling visitor.visit(path) resets visitor state. Try this.visit(path) or this.traverse(path) instead.");this._visiting=!0,this._changeReported=!1,this._abortRequested=!1;for(var e=arguments.length,t=new Array(e),r=0;e>r;++r)t[r]=arguments[r];t[0]instanceof l||(t[0]=new l({root:t[0]}).get("root")),this.reset.apply(this,t);try{var n=this.visitWithoutReset(t[0]),i=!0}finally{if(this._visiting=!1,!i&&this._abortRequested)return t[0].value}return n},m.AbortRequest=function(){},m.abort=function(){var e=this;e._abortRequested=!0;var t=new e.AbortRequest;throw t.cancel=function(){e._abortRequested=!1},t},m.reset=function(e){},m.visitWithoutReset=function(e){if(this instanceof this.Context)return this.visitor.visitWithoutReset(e);if(!(e instanceof l))throw new Error("");var t=e.value,r=t&&"object"==typeof t&&"string"==typeof t.type&&this._methodNameTable[t.type];if(!r)return s(e,this);var n=this.acquireContext(e);try{return n.invokeVisitorMethod(r)}finally{this.releaseContext(n)}},m.acquireContext=function(e){return 0===this._reusableContextStack.length?new this.Context(e):this._reusableContextStack.pop().reset(e)},m.releaseContext=function(e){if(!(e instanceof this.Context))throw new Error("");this._reusableContextStack.push(e),e.currentPath=null},m.reportChanged=function(){this._changeReported=!0},m.wasChangeReported=function(){return this._changeReported};var y=Object.create(null);y.reset=function(e){if(!(this instanceof this.Context))throw new Error("");if(!(e instanceof l))throw new Error("");return this.currentPath=e,this.needToCallTraverse=!0,this},y.invokeVisitorMethod=function(e){if(!(this instanceof this.Context))throw new Error("");if(!(this.currentPath instanceof l))throw new Error("");var t=this.visitor[e].call(this,this.currentPath);if(t===!1?this.needToCallTraverse=!1:t!==u&&(this.currentPath=this.currentPath.replace(t)[0],this.needToCallTraverse&&this.traverse(this.currentPath)),this.needToCallTraverse!==!1)throw new Error("Must either call this.traverse or return false in "+e);var r=this.currentPath;return r&&r.value},y.traverse=function(e,t){if(!(this instanceof this.Context))throw new Error("");if(!(e instanceof l))throw new Error("");if(!(this.currentPath instanceof l))throw new Error("");return this.needToCallTraverse=!1,s(e,n.fromMethodsObject(t||this.visitor))},y.visit=function(e,t){if(!(this instanceof this.Context))throw new Error("");if(!(e instanceof l))throw new Error("");if(!(this.currentPath instanceof l))throw new Error("");return this.needToCallTraverse=!1,n.fromMethodsObject(t||this.visitor).visitWithoutReset(e)},y.reportChanged=function(){this.visitor.reportChanged()},y.abort=function(){this.needToCallTraverse=!1,this.visitor.abort()},t.exports=n},{578:578,583:583}],580:[function(e,t,r){function n(e,t,r){if(!(this instanceof n))throw new Error("Path constructor cannot be invoked without 'new'");if(t){if(!(t instanceof n))throw new Error("")}else t=null,r=null;this.value=e,this.parentPath=t,this.name=r,this.__childCache=null}function i(e){return e.__childCache||(e.__childCache=Object.create(null))}function a(e,t){var r=i(e),n=e.getValueProperty(t),a=r[t];return l.call(r,t)&&a.value===n||(a=r[t]=new e.constructor(n,e,t)),a}function s(){}function o(e,t,r,n){if(f.assert(e.value),0===t)return s;var a=e.value.length;if(1>a)return s;var o=arguments.length;2===o?(r=0,n=a):3===o?(r=Math.max(r,0),n=a):(r=Math.max(r,0),n=Math.min(n,a)),d.assert(r),d.assert(n);for(var u=Object.create(null),p=i(e),c=r;n>c;++c)if(l.call(e.value,c)){var h=e.get(c);if(h.name!==c)throw new Error("");var m=c+t;h.name=m,u[m]=h,delete p[c]}return delete p.length,function(){for(var t in u){var r=u[t];if(r.name!==+t)throw new Error("");p[t]=r,e.value[t]=r.value}}}function u(e){if(!(e instanceof n))throw new Error("");var t=e.parentPath;if(!t)return e;var r=t.value,a=i(t);if(r[e.name]===e.value)a[e.name]=e;else if(f.check(r)){var s=r.indexOf(e.value);s>=0&&(a[e.name=s]=e)}else r[e.name]=e.value,a[e.name]=e;if(r[e.name]!==e.value)throw new Error("");if(e.parentPath.get(e.name)!==e)throw new Error("");return e}var p=Object.prototype,l=p.hasOwnProperty,c=e(583),f=c.builtInTypes.array,d=c.builtInTypes.number,h=Array.prototype,m=(h.slice,h.map,n.prototype);m.getValueProperty=function(e){return this.value[e]},m.get=function(e){for(var t=this,r=arguments,n=r.length,i=0;n>i;++i)t=a(t,r[i]);return t},m.each=function(e,t){for(var r=[],n=this.value.length,i=0,i=0;n>i;++i)l.call(this.value,i)&&(r[i]=this.get(i));for(t=t||this,i=0;n>i;++i)l.call(r,i)&&e.call(t,r[i])},m.map=function(e,t){var r=[];return this.each(function(t){r.push(e.call(this,t))},t),r},m.filter=function(e,t){var r=[];return this.each(function(t){e.call(this,t)&&r.push(t)},t),r},m.shift=function(){var e=o(this,-1),t=this.value.shift();return e(),t},m.unshift=function(e){var t=o(this,arguments.length),r=this.value.unshift.apply(this.value,arguments);return t(),r},m.push=function(e){return f.assert(this.value),delete i(this).length,this.value.push.apply(this.value,arguments)},m.pop=function(){f.assert(this.value);var e=i(this);return delete e[this.value.length-1],delete e.length,this.value.pop()},m.insertAt=function(e,t){var r=arguments.length,n=o(this,r-1,e);if(n===s)return this;e=Math.max(e,0);for(var i=1;r>i;++i)this.value[e+i-1]=arguments[i];return n(),this},m.insertBefore=function(e){for(var t=this.parentPath,r=arguments.length,n=[this.name],i=0;r>i;++i)n.push(arguments[i]);return t.insertAt.apply(t,n)},m.insertAfter=function(e){for(var t=this.parentPath,r=arguments.length,n=[this.name+1],i=0;r>i;++i)n.push(arguments[i]);return t.insertAt.apply(t,n)},m.replace=function(e){var t=[],r=this.parentPath.value,n=i(this.parentPath),a=arguments.length;if(u(this),f.check(r)){for(var s=r.length,p=o(this.parentPath,a-1,this.name+1),l=[this.name,1],c=0;a>c;++c)l.push(arguments[c]);var d=r.splice.apply(r,l);if(d[0]!==this.value)throw new Error("");if(r.length!==s-1+a)throw new Error("");if(p(),0===a)delete this.value,delete n[this.name],this.__childCache=null;else{if(r[this.name]!==e)throw new Error("");for(this.value!==e&&(this.value=e,this.__childCache=null),c=0;a>c;++c)t.push(this.parentPath.get(this.name+c));if(t[0]!==this)throw new Error("")}}else if(1===a)this.value!==e&&(this.__childCache=null),this.value=r[this.name]=e,t.push(this);else{if(0!==a)throw new Error("Could not replace path");delete r[this.name],delete this.value,this.__childCache=null}return t},t.exports=n},{583:583}],581:[function(e,t,r){function n(t,r){if(!(this instanceof n))throw new Error("Scope constructor cannot be invoked without 'new'");if(!(t instanceof e(578)))throw new Error("");g.assert(t.value);var i;if(r){if(!(r instanceof n))throw new Error("");i=r.depth+1}else r=null,i=0;Object.defineProperties(this,{path:{value:t},node:{value:t.value},isGlobal:{value:!r,enumerable:!0},depth:{value:i},parent:{value:r},bindings:{value:{}}})}function i(e,t){var r=e.value;g.assert(r),l.CatchClause.check(r)?o(e.get("param"),t):a(e,t)}function a(e,t){var r=e.value;e.parent&&l.FunctionExpression.check(e.parent.node)&&e.parent.node.id&&o(e.parent.get("id"),t),r&&(d.check(r)?e.each(function(e){s(e,t)}):l.Function.check(r)?(e.get("params").each(function(e){o(e,t)}),s(e.get("body"),t)):l.VariableDeclarator.check(r)?(o(e.get("id"),t),s(e.get("init"),t)):"ImportSpecifier"===r.type||"ImportNamespaceSpecifier"===r.type||"ImportDefaultSpecifier"===r.type?o(e.get(r.local?"local":r.name?"name":"id"),t):c.check(r)&&!f.check(r)&&u.eachField(r,function(r,n){var i=e.get(r);if(i.value!==n)throw new Error("");s(i,t)}))}function s(e,t){var r=e.value;if(!r||f.check(r));else if(l.FunctionDeclaration.check(r))o(e.get("id"),t);else if(l.ClassDeclaration&&l.ClassDeclaration.check(r))o(e.get("id"),t);else if(g.check(r)){if(l.CatchClause.check(r)){var n=r.param.name,i=h.call(t,n);a(e.get("body"),t),i||delete t[n]}}else a(e,t)}function o(e,t){var r=e.value;l.Pattern.assert(r),l.Identifier.check(r)?h.call(t,r.name)?t[r.name].push(e):t[r.name]=[e]:l.ObjectPattern&&l.ObjectPattern.check(r)?e.get("properties").each(function(e){var r=e.value;l.Pattern.check(r)?o(e,t):l.Property.check(r)?o(e.get("value"),t):l.SpreadProperty&&l.SpreadProperty.check(r)&&o(e.get("argument"),t)}):l.ArrayPattern&&l.ArrayPattern.check(r)?e.get("elements").each(function(e){var r=e.value;l.Pattern.check(r)?o(e,t):l.SpreadElement&&l.SpreadElement.check(r)&&o(e.get("argument"),t)}):l.PropertyPattern&&l.PropertyPattern.check(r)?o(e.get("pattern"),t):(l.SpreadElementPattern&&l.SpreadElementPattern.check(r)||l.SpreadPropertyPattern&&l.SpreadPropertyPattern.check(r))&&o(e.get("argument"),t)}var u=e(583),p=u.Type,l=u.namedTypes,c=l.Node,f=l.Expression,d=u.builtInTypes.array,h=Object.prototype.hasOwnProperty,m=u.builders,y=[l.Program,l.Function,l.CatchClause],g=p.or.apply(p,y);n.isEstablishedBy=function(e){return g.check(e)};var v=n.prototype;v.didScan=!1,v.declares=function(e){return this.scan(),h.call(this.bindings,e)},v.declareTemporary=function(e){if(e){if(!/^[a-z$_]/i.test(e))throw new Error("")}else e="t$";e+=this.depth.toString(36)+"$",this.scan();for(var t=0;this.declares(e+t);)++t;var r=e+t;return this.bindings[r]=u.builders.identifier(r)},v.injectTemporary=function(e,t){e||(e=this.declareTemporary());var r=this.path.get("body");return l.BlockStatement.check(r.value)&&(r=r.get("body")),r.unshift(m.variableDeclaration("var",[m.variableDeclarator(e,t||null)])),e},v.scan=function(e){if(e||!this.didScan){for(var t in this.bindings)delete this.bindings[t];i(this.path,this.bindings),this.didScan=!0}},v.getBindings=function(){return this.scan(),this.bindings},v.lookup=function(e){for(var t=this;t&&!t.declares(e);t=t.parent);return t},v.getGlobalScope=function(){for(var e=this;!e.isGlobal;)e=e.parent;return e},t.exports=n},{578:578,583:583}],582:[function(e,t,r){var n=e(583),i=n.Type,a=n.builtInTypes,s=a.number;r.geq=function(e){return new i(function(t){return s.check(t)&&t>=e},s+" >= "+e)},r.defaults={"null":function(){return null},emptyArray:function(){return[]},"false":function(){return!1},"true":function(){return!0},undefined:function(){}};var o=i.or(a.string,a.number,a["boolean"],a["null"],a.undefined);r.isPrimitive=new i(function(e){if(null===e)return!0;var t=typeof e;return!("object"===t||"function"===t)},o.toString())},{583:583}],583:[function(e,t,r){function n(e,t){var r=this;if(!(r instanceof n))throw new Error("Type constructor cannot be invoked without 'new'");if(b.call(e)!==E)throw new Error(e+" is not a function");var i=b.call(t);if(i!==E&&i!==x)throw new Error(t+" is neither a function nor a string");Object.defineProperties(r,{name:{value:t},check:{value:function(t,n){var i=e.call(r,t,n);return!i&&n&&b.call(n)===E&&n(r,t),i}}})}function i(e){return k.check(e)?"{"+Object.keys(e).map(function(t){return t+": "+e[t]}).join(", ")+"}":F.check(e)?"["+e.map(i).join(", ")+"]":JSON.stringify(e)}function a(e,t){var r=b.call(e),i=new n(function(e){return b.call(e)===r},t);return w[t]=i,e&&"function"==typeof e.constructor&&(D.push(e.constructor),C.push(i)),i}function s(e,t){if(e instanceof n)return e;if(e instanceof u)return e.type;if(F.check(e))return n.fromArray(e);if(k.check(e))return n.fromObject(e);if(_.check(e)){var r=D.indexOf(e);return r>=0?C[r]:new n(e,t)}return new n(function(t){return t===e},B.check(t)?function(){return e+""}:t)}function o(e,t,r,n){var i=this;if(!(i instanceof o))throw new Error("Field constructor cannot be invoked without 'new'");I.assert(e),t=s(t);var a={name:{value:e},type:{value:t},hidden:{value:!!n}};_.check(r)&&(a.defaultFn={value:r}),Object.defineProperties(i,a)}function u(e){var t=this;if(!(t instanceof u))throw new Error("Def constructor cannot be invoked without 'new'");Object.defineProperties(t,{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 n(function(e,r){return t.check(e,r)},e)}})}function p(e){return e.replace(/^[A-Z]+/,function(e){var t=e.length;switch(t){case 0:return"";case 1:return e.toLowerCase();default:return e.slice(0,t-1).toLowerCase()+e.charAt(t-1)}})}function l(e){return e=p(e),e.replace(/(Expression)?$/,"Statement")}function c(e){var t=u.fromValue(e);if(t)return t.fieldNames.slice(0);if("type"in e)throw new Error("did not recognize object of type "+JSON.stringify(e.type));return Object.keys(e)}function f(e,t){var r=u.fromValue(e);if(r){var n=r.allFields[t];if(n)return n.getValue(e)}return e[t]}function d(e){var t=l(e);if(!j[t]){var r=j[p(e)];r&&(j[t]=function(){return j.expressionStatement(r.apply(j,arguments))})}}function h(e,t){t.length=0,t.push(e);for(var r=Object.create(null),n=0;n<t.length;++n){e=t[n];var i=M[e];if(i.finalized!==!0)throw new Error("");S.call(r,e)&&delete t[r[e]],r[e]=n,t.push.apply(t,i.baseNames)}for(var a=0,s=a,o=t.length;o>s;++s)S.call(t,s)&&(t[a++]=t[s]);t.length=a}function m(e,t){return Object.keys(t).forEach(function(r){e[r]=t[r]}),e}var y=Array.prototype,g=y.slice,v=(y.map,y.forEach,Object.prototype),b=v.toString,E=b.call(function(){}),x=b.call(""),S=v.hasOwnProperty,A=n.prototype;r.Type=n,A.assert=function(e,t){if(!this.check(e,t)){var r=i(e);throw new Error(r+" does not match type "+this)}return!0},A.toString=function(){var e=this.name;return I.check(e)?e:_.check(e)?e.call(this)+"":e+" type"};var D=[],C=[],w={};r.builtInTypes=w;var I=a("truthy","string"),_=a(function(){},"function"),F=a([],"array"),k=a({},"object"),P=(a(/./,"RegExp"),a(new Date,"Date"),a(3,"number")),B=(a(!0,"boolean"),a(null,"null"),a(void 0,"undefined"));n.or=function(){for(var e=[],t=arguments.length,r=0;t>r;++r)e.push(s(arguments[r]));return new n(function(r,n){for(var i=0;t>i;++i)if(e[i].check(r,n))return!0;return!1},function(){return e.join(" | ")})},n.fromArray=function(e){if(!F.check(e))throw new Error("");if(1!==e.length)throw new Error("only one element type is permitted for typed arrays");return s(e[0]).arrayOf()},A.arrayOf=function(){var e=this;return new n(function(t,r){return F.check(t)&&t.every(function(t){return e.check(t,r)})},function(){return"["+e+"]"})},n.fromObject=function(e){var t=Object.keys(e).map(function(t){return new o(t,e[t])});return new n(function(e,r){return k.check(e)&&t.every(function(t){return t.type.check(e[t.name],r)})},function(){return"{ "+t.join(", ")+" }"})};var T=o.prototype;T.toString=function(){return JSON.stringify(this.name)+": "+this.type},T.getValue=function(e){var t=e[this.name];return B.check(t)?(this.defaultFn&&(t=this.defaultFn.call(e)),t):t},n.def=function(e){return I.assert(e),S.call(M,e)?M[e]:M[e]=new u(e)};var M=Object.create(null);u.fromValue=function(e){if(e&&"object"==typeof e){var t=e.type;if("string"==typeof t&&S.call(M,t)){var r=M[t];if(r.finalized)return r}}return null};var O=u.prototype;O.isSupertypeOf=function(e){if(e instanceof u){if(this.finalized!==!0||e.finalized!==!0)throw new Error("");return S.call(e.allSupertypes,this.typeName)}throw new Error(e+" is not a Def")},r.getSupertypeNames=function(e){if(!S.call(M,e))throw new Error("");var t=M[e];if(t.finalized!==!0)throw new Error("");return t.supertypeList.slice(1)},r.computeSupertypeLookupTable=function(e){for(var t={},r=Object.keys(M),n=r.length,i=0;n>i;++i){var a=r[i],s=M[a];if(s.finalized!==!0)throw new Error(""+a);for(var o=0;o<s.supertypeList.length;++o){var u=s.supertypeList[o];if(S.call(e,u)){t[a]=u;break}}}return t},O.checkAllFields=function(e,t){function r(r){var i=n[r],a=i.type,s=i.getValue(e);return a.check(s,t)}var n=this.allFields;if(this.finalized!==!0)throw new Error(""+this.typeName);return k.check(e)&&Object.keys(n).every(r)},O.check=function(e,t){if(this.finalized!==!0)throw new Error("prematurely checking unfinalized type "+this.typeName);if(!k.check(e))return!1;var r=u.fromValue(e);return r?t&&r===this?this.checkAllFields(e,t):this.isSupertypeOf(r)?t?r.checkAllFields(e,t)&&this.checkAllFields(e,!1):!0:!1:"SourceLocation"===this.typeName||"Position"===this.typeName?this.checkAllFields(e,t):!1},O.bases=function(){var e=g.call(arguments),t=this.baseNames;if(this.finalized){if(e.length!==t.length)throw new Error("");for(var r=0;r<e.length;r++)if(e[r]!==t[r])throw new Error("");return this}return e.forEach(function(e){I.assert(e),t.indexOf(e)<0&&t.push(e)}),this},Object.defineProperty(O,"buildable",{value:!1});var j={};r.builders=j;var L={};r.defineMethod=function(e,t){var r=L[e];return B.check(t)?delete L[e]:(_.assert(t),Object.defineProperty(L,e,{enumerable:!0,configurable:!0,value:t})),r};var N=I.arrayOf();O.build=function(){var e=this,t=g.call(arguments);return N.assert(t),Object.defineProperty(e,"buildParams",{value:t,writable:!1,enumerable:!1,configurable:!0}),e.buildable?e:(e.field("type",String,function(){return e.typeName}),Object.defineProperty(e,"buildable",{value:!0}),Object.defineProperty(j,p(e.typeName),{enumerable:!0,value:function(){function t(t,s){if(!S.call(a,t)){var o=e.allFields;if(!S.call(o,t))throw new Error(""+t);var u,p=o[t],l=p.type;if(P.check(s)&&n>s)u=r[s];else{if(!p.defaultFn){var c="no value or default function given for field "+JSON.stringify(t)+" of "+e.typeName+"("+e.buildParams.map(function(e){return o[e]}).join(", ")+")";throw new Error(c)}u=p.defaultFn.call(a)}if(!l.check(u))throw new Error(i(u)+" does not match field "+p+" of type "+e.typeName);a[t]=u}}var r=arguments,n=r.length,a=Object.create(L);if(!e.finalized)throw new Error("attempting to instantiate unfinalized type "+e.typeName);if(e.buildParams.forEach(function(e,r){t(e,r)}),Object.keys(e.allFields).forEach(function(e){t(e)}),a.type!==e.typeName)throw new Error("");return a}}),e)},r.getBuilderName=p,r.getStatementBuilderName=l,O.field=function(e,t,r,n){return this.finalized?(console.error("Ignoring attempt to redefine field "+JSON.stringify(e)+" of finalized type "+JSON.stringify(this.typeName)),this):(this.ownFields[e]=new o(e,t,r,n),this)};var R={};r.namedTypes=R,r.getFieldNames=c,r.getFieldValue=f,r.eachField=function(e,t,r){c(e).forEach(function(r){t.call(this,r,f(e,r))},r)},r.someField=function(e,t,r){return c(e).some(function(r){return t.call(this,r,f(e,r))},r)},Object.defineProperty(O,"finalized",{value:!1}),O.finalize=function(){var e=this;if(!e.finalized){var t=e.allFields,r=e.allSupertypes;e.baseNames.forEach(function(n){var i=M[n];if(!(i instanceof u)){var a="unknown supertype name "+JSON.stringify(n)+" for subtype "+JSON.stringify(e.typeName);throw new Error(a)}i.finalize(),m(t,i.allFields),m(r,i.allSupertypes)}),m(t,e.ownFields),r[e.typeName]=e,e.fieldNames.length=0;for(var n in t)S.call(t,n)&&!t[n].hidden&&e.fieldNames.push(n);Object.defineProperty(R,e.typeName,{enumerable:!0,value:e.type}),Object.defineProperty(e,"finalized",{value:!0}),h(e.typeName,e.supertypeList),e.buildable&&e.supertypeList.lastIndexOf("Expression")>=0&&d(e.typeName)}},r.finalize=function(){Object.keys(M).forEach(function(e){M[e].finalize()})}},{}],584:[function(e,t,r){var n=e(583);e(570),e(572),e(573),e(576),e(571),e(575),e(574),e(569),n.finalize(),r.Type=n.Type,r.builtInTypes=n.builtInTypes,r.namedTypes=n.namedTypes,r.builders=n.builders,r.defineMethod=n.defineMethod,r.getFieldNames=n.getFieldNames,r.getFieldValue=n.getFieldValue,r.eachField=n.eachField,r.someField=n.someField,r.getSupertypeNames=n.getSupertypeNames,r.astNodesAreEquivalent=e(577),r.finalize=n.finalize,r.NodePath=e(578),r.PathVisitor=e(579),r.visit=r.PathVisitor.visit},{569:569,570:570,571:571,572:572,573:573,574:574,575:575,576:576,577:577,578:578,579:579,583:583}],585:[function(e,t,r){(function(e,r){!function(r){"use strict";function n(e,t,r,n){var i=Object.create((t||a).prototype),s=new h(n||[]);return i._invoke=c(e,r,s),i}function i(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(n){return{type:"throw",arg:n}}}function a(){}function s(){}function o(){}function u(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function p(e){this.arg=e}function l(t){function r(e,r){var n=t[e](r),i=n.value;return i instanceof p?Promise.resolve(i.arg).then(a,s):Promise.resolve(i).then(function(e){return n.value=e,n})}function n(e,t){function n(){return r(e,t)}return i=i?i.then(n,n):new Promise(function(e){e(n())})}"object"==typeof e&&e.domain&&(r=e.domain.bind(r));var i,a=r.bind(t,"next"),s=r.bind(t,"throw");r.bind(t,"return");this._invoke=n}function c(e,t,r){var n=S;return function(a,s){if(n===D)throw new Error("Generator is already running");if(n===C){if("throw"===a)throw s;return y()}for(;;){var o=r.delegate;if(o){if("return"===a||"throw"===a&&o.iterator[a]===g){r.delegate=null;var u=o.iterator["return"];if(u){var p=i(u,o.iterator,s);if("throw"===p.type){a="throw",s=p.arg;continue}}if("return"===a)continue}var p=i(o.iterator[a],o.iterator,s);if("throw"===p.type){r.delegate=null,a="throw",s=p.arg;continue}a="next",s=g;var l=p.arg;if(!l.done)return n=A,l;r[o.resultName]=l.value,r.next=o.nextLoc,r.delegate=null}if("next"===a)n===A?r.sent=s:r.sent=g;else if("throw"===a){if(n===S)throw n=C,s;r.dispatchException(s)&&(a="next",s=g)}else"return"===a&&r.abrupt("return",s);n=D;var p=i(e,t,r);if("normal"===p.type){n=r.done?C:A;var l={value:p.arg,done:r.done};if(p.arg!==w)return l;r.delegate&&"next"===a&&(s=g)}else"throw"===p.type&&(n=C,a="throw",s=p.arg)}}}function f(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t);
}function d(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function h(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(f,this),this.reset(!0)}function m(e){if(e){var t=e[b];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,n=function i(){for(;++r<e.length;)if(v.call(e,r))return i.value=e[r],i.done=!1,i;return i.value=g,i.done=!0,i};return n.next=n}}return{next:y}}function y(){return{value:g,done:!0}}var g,v=Object.prototype.hasOwnProperty,b="function"==typeof Symbol&&Symbol.iterator||"@@iterator",E="object"==typeof t,x=r.regeneratorRuntime;if(x)return void(E&&(t.exports=x));x=r.regeneratorRuntime=E?t.exports:{},x.wrap=n;var S="suspendedStart",A="suspendedYield",D="executing",C="completed",w={},I=o.prototype=a.prototype;s.prototype=I.constructor=o,o.constructor=s,s.displayName="GeneratorFunction",x.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return t?t===s||"GeneratorFunction"===(t.displayName||t.name):!1},x.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,o):e.__proto__=o,e.prototype=Object.create(I),e},x.awrap=function(e){return new p(e)},u(l.prototype),x.async=function(e,t,r,i){var a=new l(n(e,t,r,i));return x.isGeneratorFunction(t)?a:a.next().then(function(e){return e.done?e.value:a.next()})},u(I),I[b]=function(){return this},I.toString=function(){return"[object Generator]"},x.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},x.values=m,h.prototype={constructor:h,reset:function(e){if(this.prev=0,this.next=0,this.sent=g,this.done=!1,this.delegate=null,this.tryEntries.forEach(d),!e)for(var t in this)"t"===t.charAt(0)&&v.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=g)},stop:function(){this.done=!0;var e=this.tryEntries[0],t=e.completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){function t(t,n){return a.type="throw",a.arg=e,r.next=t,!!n}if(this.done)throw e;for(var r=this,n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n],a=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var s=v.call(i,"catchLoc"),o=v.call(i,"finallyLoc");if(s&&o){if(this.prev<i.catchLoc)return t(i.catchLoc,!0);if(this.prev<i.finallyLoc)return t(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return t(i.catchLoc,!0)}else{if(!o)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return t(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&v.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?this.next=i.finallyLoc:this.complete(a),w},complete:function(e,t){if("throw"===e.type)throw e.arg;"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=e.arg,this.next="end"):"normal"===e.type&&t&&(this.next=t)},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),d(r),w}},"catch":function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;d(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:m(e),resultName:t,nextLoc:r},w}}}("object"==typeof r?r:"object"==typeof window?window:"object"==typeof self?self:this)}).call(this,e(10),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{10:10}],586:[function(e,t,r){var n=e(588);r.REGULAR={d:n().addRange(48,57),D:n().addRange(0,47).addRange(58,65535),s:n(32,160,5760,6158,8239,8287,12288,65279).addRange(9,13).addRange(8192,8202).addRange(8232,8233),S:n().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:n(95).addRange(48,57).addRange(65,90).addRange(97,122),W:n(96).addRange(0,47).addRange(58,64).addRange(91,94).addRange(123,65535)},r.UNICODE={d:n().addRange(48,57),D:n().addRange(0,47).addRange(58,1114111),s:n(32,160,5760,6158,8239,8287,12288,65279).addRange(9,13).addRange(8192,8202).addRange(8232,8233),S:n().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:n(95).addRange(48,57).addRange(65,90).addRange(97,122),W:n(96).addRange(0,47).addRange(58,64).addRange(91,94).addRange(123,1114111)},r.UNICODE_IGNORE_CASE={d:n().addRange(48,57),D:n().addRange(0,47).addRange(58,1114111),s:n(32,160,5760,6158,8239,8287,12288,65279).addRange(9,13).addRange(8192,8202).addRange(8232,8233),S:n().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:n(95,383,8490).addRange(48,57).addRange(65,90).addRange(97,122),W:n(75,83,96).addRange(0,47).addRange(58,64).addRange(91,94).addRange(123,1114111)}},{588:588}],587:[function(e,t,r){t.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,68736:68800,68737:68801,68738:68802,68739:68803,68740:68804,68741:68805,68742:68806,68743:68807,68744:68808,68745:68809,68746:68810,68747:68811,68748:68812,68749:68813,68750:68814,68751:68815,68752:68816,68753:68817,68754:68818,68755:68819,68756:68820,68757:68821,68758:68822,68759:68823,68760:68824,68761:68825,68762:68826,68763:68827,68764:68828,68765:68829,68766:68830,68767:68831,68768:68832,68769:68833,68770:68834,68771:68835,68772:68836,68773:68837,68774:68838,68775:68839,68776:68840,68777:68841,68778:68842,68779:68843,68780:68844,68781:68845,68782:68846,68783:68847,68784:68848,68785:68849,68786:68850,68800:68736,68801:68737,68802:68738,68803:68739,68804:68740,68805:68741,68806:68742,68807:68743,68808:68744,68809:68745,68810:68746,68811:68747,68812:68748,68813:68749,68814:68750,68815:68751,68816:68752,68817:68753,68818:68754,68819:68755,68820:68756,68821:68757,68822:68758,68823:68759,68824:68760,68825:68761,68826:68762,68827:68763,68828:68764,68829:68765,68830:68766,68831:68767,68832:68768,68833:68769,68834:68770,68835:68771,68836:68772,68837:68773,68838:68774,68839:68775,68840:68776,68841:68777,68842:68778,68843:68779,68844:68780,68845:68781,68846:68782,68847:68783,68848:68784,68849:68785,68850:68786,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}},{}],588:[function(t,r,n){(function(t){!function(i){var a="object"==typeof n&&n,s="object"==typeof r&&r&&r.exports==a&&r,o="object"==typeof t&&t;(o.global===o||o.window===o)&&(i=o);var u={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."},p=55296,l=56319,c=56320,f=57343,d=/\\x00([^0123456789]|$)/g,h={},m=h.hasOwnProperty,y=function(e,t){var r;for(r in t)m.call(t,r)&&(e[r]=t[r]);return e},g=function(e,t){for(var r=-1,n=e.length;++r<n;)t(e[r],r)},v=h.toString,b=function(e){return"[object Array]"==v.call(e)},E=function(e){return"number"==typeof e||"[object Number]"==v.call(e)},x="0000",S=function(e,t){var r=String(e);return r.length<t?(x+r).slice(-t):r},A=function(e){return Number(e).toString(16).toUpperCase()},D=[].slice,C=function(e){for(var t,r=-1,n=e.length,i=n-1,a=[],s=!0,o=0;++r<n;)if(t=e[r],s)a.push(t),o=t,s=!1;else if(t==o+1){if(r!=i){o=t;continue}s=!0,a.push(t+1)}else a.push(o+1,t),o=t;return s||a.push(t+1),a},w=function(e,t){for(var r,n,i=0,a=e.length;a>i;){if(r=e[i],n=e[i+1],t>=r&&n>t)return t==r?n==r+1?(e.splice(i,2),e):(e[i]=t+1,e):t==n-1?(e[i+1]=t,e):(e.splice(i,2,r,t,t+1,n),e);i+=2}return e},I=function(e,t,r){if(t>r)throw Error(u.rangeOrder);for(var n,i,a=0;a<e.length;){if(n=e[a],i=e[a+1]-1,n>r)return e;if(n>=t&&r>=i)e.splice(a,2);else{if(t>=n&&i>r)return t==n?(e[a]=r+1,e[a+1]=i+1,e):(e.splice(a,2,n,t,r+1,i+1),e);if(t>=n&&i>=t)e[a+1]=t;else if(r>=n&&i>=r)return e[a]=r+1,e;a+=2}}return e},_=function(e,t){var r,n,i=0,a=null,s=e.length;if(0>t||t>1114111)throw RangeError(u.codePointRange);for(;s>i;){if(r=e[i],n=e[i+1],t>=r&&n>t)return e;if(t==r-1)return e[i]=t,e;if(r>t)return e.splice(null!=a?a+2:0,0,t,t+1),e;if(t==n)return t+1==e[i+2]?(e.splice(i,4,r,e[i+3]),e):(e[i+1]=t+1,e);a=i,i+=2}return e.push(t,t+1),e},F=function(e,t){for(var r,n,i=0,a=e.slice(),s=t.length;s>i;)r=t[i],n=t[i+1]-1,a=r==n?_(a,r):P(a,r,n),i+=2;return a},k=function(e,t){for(var r,n,i=0,a=e.slice(),s=t.length;s>i;)r=t[i],n=t[i+1]-1,a=r==n?w(a,r):I(a,r,n),i+=2;return a},P=function(e,t,r){if(t>r)throw Error(u.rangeOrder);if(0>t||t>1114111||0>r||r>1114111)throw RangeError(u.codePointRange);for(var n,i,a=0,s=!1,o=e.length;o>a;){if(n=e[a],i=e[a+1],s){if(n==r+1)return e.splice(a-1,2),e;if(n>r)return e;n>=t&&r>=n&&(i>t&&r>=i-1?(e.splice(a,2),a-=2):(e.splice(a-1,2),a-=2))}else{if(n==r+1)return e[a]=t,e;if(n>r)return e.splice(a,0,t,r+1),e;if(t>=n&&i>t&&i>=r+1)return e;t>=n&&i>t||i==t?(e[a+1]=r+1,s=!0):n>=t&&r+1>=i&&(e[a]=t,e[a+1]=r+1,s=!0)}a+=2}return s||e.push(t,r+1),e},B=function(e,t){var r=0,n=e.length,i=e[r],a=e[n-1];if(n>=2&&(i>t||t>a))return!1;for(;n>r;){if(i=e[r],a=e[r+1],t>=i&&a>t)return!0;r+=2}return!1},T=function(e,t){for(var r,n=0,i=t.length,a=[];i>n;)r=t[n],B(e,r)&&a.push(r),++n;return C(a)},M=function(e){return!e.length},O=function(e){return 2==e.length&&e[0]+1==e[1]},j=function(e){for(var t,r,n=0,i=[],a=e.length;a>n;){for(t=e[n],r=e[n+1];r>t;)i.push(t),++t;n+=2}return i},L=Math.floor,N=function(e){return parseInt(L((e-65536)/1024)+p,10)},R=function(e){return parseInt((e-65536)%1024+c,10)},V=String.fromCharCode,U=function(e){var t;return t=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"+S(A(e),2):"\\u"+S(A(e),4)},q=function(e){var t,r=e.length,n=e.charCodeAt(0);return n>=p&&l>=n&&r>1?(t=e.charCodeAt(1),1024*(n-p)+t-c+65536):n},G=function(e){var t,r,n="",i=0,a=e.length;if(O(e))return U(e[0]);for(;a>i;)t=e[i],r=e[i+1]-1,n+=t==r?U(t):t+1==r?U(t)+U(r):U(t)+"-"+U(r),i+=2;return"["+n+"]"},H=function(e){for(var t,r,n=[],i=[],a=[],s=[],o=0,u=e.length;u>o;)t=e[o],r=e[o+1]-1,p>t?(p>r&&a.push(t,r+1),r>=p&&l>=r&&(a.push(t,p),n.push(p,r+1)),r>=c&&f>=r&&(a.push(t,p),n.push(p,l+1),i.push(c,r+1)),r>f&&(a.push(t,p),n.push(p,l+1),i.push(c,f+1),65535>=r?a.push(f+1,r+1):(a.push(f+1,65536),s.push(65536,r+1)))):t>=p&&l>=t?(r>=p&&l>=r&&n.push(t,r+1),r>=c&&f>=r&&(n.push(t,l+1),i.push(c,r+1)),r>f&&(n.push(t,l+1),i.push(c,f+1),65535>=r?a.push(f+1,r+1):(a.push(f+1,65536),s.push(65536,r+1)))):t>=c&&f>=t?(r>=c&&f>=r&&i.push(t,r+1),r>f&&(i.push(t,f+1),65535>=r?a.push(f+1,r+1):(a.push(f+1,65536),s.push(65536,r+1)))):t>f&&65535>=t?65535>=r?a.push(t,r+1):(a.push(t,65536),s.push(65536,r+1)):s.push(t,r+1),o+=2;return{loneHighSurrogates:n,loneLowSurrogates:i,bmp:a,astral:s}},W=function(e){for(var t,r,n,i,a,s,o=[],u=[],p=!1,l=-1,c=e.length;++l<c;)if(t=e[l],r=e[l+1]){for(n=t[0],i=t[1],a=r[0],s=r[1],u=i;a&&n[0]==a[0]&&n[1]==a[1];)u=O(s)?_(u,s[0]):P(u,s[0],s[1]-1),++l,t=e[l],n=t[0],i=t[1],r=e[l+1],a=r&&r[0],s=r&&r[1],p=!0;o.push([n,p?u:i]),p=!1}else o.push(t);return X(o)},X=function(e){if(1==e.length)return e;for(var t=-1,r=-1;++t<e.length;){var n=e[t],i=n[1],a=i[0],s=i[1];for(r=t;++r<e.length;){var o=e[r],u=o[1],p=u[0],l=u[1];a==p&&s==l&&(O(o[0])?n[0]=_(n[0],o[0][0]):n[0]=P(n[0],o[0][0],o[0][1]-1),e.splice(r,1),--r)}}return e},Y=function(e){if(!e.length)return[];for(var t,r,n,i,a,s,o=0,u=0,p=0,l=[],d=e.length;d>o;){t=e[o],r=e[o+1]-1,n=N(t),i=R(t),a=N(r),s=R(r);var h=i==c,m=s==f,y=!1;n==a||h&&m?(l.push([[n,a+1],[i,s+1]]),y=!0):l.push([[n,n+1],[i,f+1]]),!y&&a>n+1&&(m?(l.push([[n+1,a+1],[c,s+1]]),y=!0):l.push([[n+1,a],[c,f+1]])),y||l.push([[a,a+1],[c,s+1]]),u=n,p=a,o+=2}return W(l)},J=function(e){var t=[];return g(e,function(e){var r=e[0],n=e[1];t.push(G(r)+G(n))}),t.join("|")},z=function(e,t){var r=[],n=H(e),i=n.loneHighSurrogates,a=n.loneLowSurrogates,s=n.bmp,o=n.astral,u=(!M(n.astral),!M(i)),p=!M(a),l=Y(o);return t&&(s=F(s,i),u=!1,s=F(s,a),p=!1),M(s)||r.push(G(s)),l.length&&r.push(J(l)),u&&r.push(G(i)+"(?![\\uDC00-\\uDFFF])"),p&&r.push("(?:[^\\uD800-\\uDBFF]|^)"+G(a)),r.join("|")},K=function(e){return arguments.length>1&&(e=D.call(arguments)),this instanceof K?(this.data=[],e?this.add(e):this):(new K).add(e)};K.version="1.2.0";var $=K.prototype;y($,{add:function(e){var t=this;return null==e?t:e instanceof K?(t.data=F(t.data,e.data),t):(arguments.length>1&&(e=D.call(arguments)),b(e)?(g(e,function(e){t.add(e)}),t):(t.data=_(t.data,E(e)?e:q(e)),t))},remove:function(e){var t=this;return null==e?t:e instanceof K?(t.data=k(t.data,e.data),t):(arguments.length>1&&(e=D.call(arguments)),b(e)?(g(e,function(e){t.remove(e)}),t):(t.data=w(t.data,E(e)?e:q(e)),t))},addRange:function(e,t){var r=this;return r.data=P(r.data,E(e)?e:q(e),E(t)?t:q(t)),r},removeRange:function(e,t){var r=this,n=E(e)?e:q(e),i=E(t)?t:q(t);return r.data=I(r.data,n,i),r},intersection:function(e){var t=this,r=e instanceof K?j(e.data):e;return t.data=T(t.data,r),t},contains:function(e){return B(this.data,E(e)?e:q(e))},clone:function(){var e=new K;return e.data=this.data.slice(0),e},toString:function(e){var t=z(this.data,e?e.bmpOnly:!1);return t.replace(d,"\\0$1")},toRegExp:function(e){return RegExp(this.toString(),e||"")},valueOf:function(){return j(this.data)}}),$.toArray=$.valueOf,"function"==typeof e&&"object"==typeof e.amd&&e.amd?e(function(){return K}):a&&!a.nodeType?s?s.exports=K:a.regenerate=K:i.regenerate=K}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],589:[function(t,r,n){(function(t){(function(){"use strict";function i(){var e,t,r=16384,n=[],i=-1,a=arguments.length;if(!a)return"";for(var s="";++i<a;){var o=Number(arguments[i]);if(!isFinite(o)||0>o||o>1114111||I(o)!=o)throw RangeError("Invalid code point: "+o);65535>=o?n.push(o):(o-=65536,e=(o>>10)+55296,t=o%1024+56320,n.push(e,t)),(i+1==a||n.length>r)&&(s+=w.apply(null,n),n.length=0)}return s}function a(e,t){if(-1==t.indexOf("|")){if(e==t)return;throw Error("Invalid node type: "+e)}if(t=a.hasOwnProperty(t)?a[t]:a[t]=RegExp("^(?:"+t+")$"),!t.test(e))throw Error("Invalid node type: "+e)}function s(e){var t=e.type;if(s.hasOwnProperty(t)&&"function"==typeof s[t])return s[t](e);throw Error("Invalid node type: "+t)}function o(e){a(e.type,"alternative");var t=e.body,r=t?t.length:0;if(1==r)return b(t[0]);for(var n=-1,i="";++n<r;)i+=b(t[n]);return i}function u(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 p(e){return a(e.type,"anchor|characterClass|characterClassEscape|dot|group|reference|value"),s(e)}function l(e){a(e.type,"characterClass");var t=e.body,r=t?t.length:0,n=-1,i="[";for(e.negative&&(i+="^");++n<r;)i+=d(t[n]);return i+="]"}function c(e){return a(e.type,"characterClassEscape"),"\\"+e.value}function f(e){a(e.type,"characterClassRange");var t=e.min,r=e.max;if("characterClassRange"==t.type||"characterClassRange"==r.type)throw Error("Invalid character class range");return d(t)+"-"+d(r)}function d(e){return a(e.type,"anchor|characterClassEscape|characterClassRange|dot|value"),s(e)}function h(e){a(e.type,"disjunction");var t=e.body,r=t?t.length:0;if(0==r)throw Error("No body");if(1==r)return s(t[0]);for(var n=-1,i="";++n<r;)0!=n&&(i+="|"),i+=s(t[n]);return i}function m(e){return a(e.type,"dot"),"."}function y(e){a(e.type,"group");var t="(";switch(e.behavior){case"normal":break;case"ignore":t+="?:";break;case"lookahead":t+="?=";break;case"negativeLookahead":t+="?!";break;default:throw Error("Invalid behaviour: "+e.behaviour)}var r=e.body,n=r?r.length:0;if(1==n)t+=s(r[0]);else for(var i=-1;++i<n;)t+=s(r[i]);return t+=")"}function g(e){a(e.type,"quantifier");var t="",r=e.min,n=e.max;switch(n){case void 0:case null:switch(r){case 0:t="*";break;case 1:t="+";break;default:t="{"+r+",}"}break;default:t=r==n?"{"+r+"}":0==r&&1==n?"?":"{"+r+","+n+"}"}return e.greedy||(t+="?"),p(e.body[0])+t}function v(e){return a(e.type,"reference"),"\\"+e.matchIndex}function b(e){return a(e.type,"anchor|characterClass|characterClassEscape|empty|group|quantifier|reference|value"),s(e)}function E(e){a(e.type,"value");var t=e.kind,r=e.codePoint;switch(t){case"controlLetter":return"\\c"+i(r+64);case"hexadecimalEscape":return"\\x"+("00"+r.toString(16).toUpperCase()).slice(-2);case"identifier":return"\\"+i(r);case"null":return"\\"+r;case"octal":return"\\"+r.toString(8);case"singleEscape":switch(r){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: "+r)}case"symbol":return i(r);case"unicodeEscape":return"\\u"+("0000"+r.toString(16).toUpperCase()).slice(-4);case"unicodeCodePointEscape":return"\\u{"+r.toString(16).toUpperCase()+"}";default:throw Error("Unsupported node kind: "+t)}}var x={"function":!0,object:!0},S=x[typeof window]&&window||this,A=x[typeof n]&&n,D=x[typeof r]&&r&&!r.nodeType&&r,C=A&&D&&"object"==typeof t&&t;!C||C.global!==C&&C.window!==C&&C.self!==C||(S=C);var w=String.fromCharCode,I=Math.floor;s.alternative=o,s.anchor=u,s.characterClass=l,s.characterClassEscape=c,s.characterClassRange=f,s.disjunction=h,s.dot=m,s.group=y,s.quantifier=g,s.reference=v,s.value=E,"function"==typeof e&&"object"==typeof e.amd&&e.amd?e(function(){return{generate:s}}):A&&D?A.generate=s:S.regjsgen={generate:s}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],590:[function(e,t,r){!function(){function e(e,t){function r(t){return t.raw=e.substring(t.range[0],t.range[1]),t}function n(e,t){return e.range[0]=t,r(e)}function i(e,t){return r({type:"anchor",kind:e,range:[$-t,$]})}function a(e,t,n,i){return r({type:"value",kind:e,codePoint:t,range:[n,i]})}function s(e,t,r,n){return n=n||0,a(e,t,$-(r.length+n),$)}function o(e){var t=e[0],r=t.charCodeAt(0);if(K){var n;if(1===t.length&&r>=55296&&56319>=r&&(n=x().charCodeAt(0),n>=56320&&57343>=n))return $++,a("symbol",1024*(r-55296)+n-56320+65536,$-2,$)}return a("symbol",r,$-1,$)}function u(e,t,n){return r({type:"disjunction",body:e,range:[t,n]})}function p(){return r({type:"dot",range:[$-1,$]})}function l(e){return r({type:"characterClassEscape",value:e,range:[$-2,$]})}function c(e){return r({type:"reference",matchIndex:parseInt(e,10),range:[$-1-e.length,$]})}function f(e,t,n,i){return r({type:"group",behavior:e,body:t,range:[n,i]})}function d(e,t,n,i){return null==i&&(n=$-1,i=$),r({type:"quantifier",min:e,max:t,greedy:!0,body:null,range:[n,i]})}function h(e,t,n){return r({type:"alternative",body:e,range:[t,n]})}function m(e,t,n,i){return r({type:"characterClass",body:e,negative:t,range:[n,i]})}function y(e,t,n,i){return e.codePoint>t.codePoint&&X("invalid range in character class",e.raw+"-"+t.raw,n,i),r({type:"characterClassRange",min:e,max:t,range:[n,i]})}function g(e){return"alternative"===e.type?e.body:[e]}function v(t){t=t||1;var r=e.substring($,$+t);return $+=t||1,r}function b(e){E(e)||X("character",e)}function E(t){return e.indexOf(t,$)===$?v(t.length):void 0}function x(){return e[$]}function S(t){return e.indexOf(t,$)===$}function A(t){return e[$+1]===t}function D(t){var r=e.substring($),n=r.match(t);return n&&(n.range=[],n.range[0]=$,v(n[0].length),n.range[1]=$),n}function C(){var e=[],t=$;for(e.push(w());E("|");)e.push(w());return 1===e.length?e[0]:u(e,t,$)}function w(){for(var e,t=[],r=$;e=I();)t.push(e);return 1===t.length?t[0]:h(t,r,$)}function I(){if($>=e.length||S("|")||S(")"))return null;var t=F();if(t)return t;var r=P();r||X("Expected atom");var i=k()||!1;return i?(i.body=g(r),n(i,r.range[0]),i):r}function _(e,t,r,n){var i=null,a=$;if(E(e))i=t;else{if(!E(r))return!1;i=n}var s=C();s||X("Expected disjunction"),b(")");var o=f(i,g(s),a,$);return"normal"==i&&z&&J++,o}function F(){return E("^")?i("start",1):E("$")?i("end",1):E("\\b")?i("boundary",2):E("\\B")?i("not-boundary",2):_("(?=","lookahead","(?!","negativeLookahead")}function k(){var e,t,r,n,i=$;return E("*")?t=d(0):E("+")?t=d(1):E("?")?t=d(0,1):(e=D(/^\{([0-9]+)\}/))?(r=parseInt(e[1],10),t=d(r,r,e.range[0],e.range[1])):(e=D(/^\{([0-9]+),\}/))?(r=parseInt(e[1],10),t=d(r,void 0,e.range[0],e.range[1])):(e=D(/^\{([0-9]+),([0-9]+)\}/))&&(r=parseInt(e[1],10),n=parseInt(e[2],10),r>n&&X("numbers out of order in {} quantifier","",i,$),t=d(r,n,e.range[0],e.range[1])),t&&E("?")&&(t.greedy=!1,t.range[1]+=1),t}function P(){var e;return(e=D(/^[^^$\\.*+?(){[|]/))?o(e):E(".")?p():E("\\")?(e=M(),e||X("atomEscape"),e):(e=R())?e:_("(?:","ignore","(","normal")}function B(e){if(K){var t,n;if("unicodeEscape"==e.kind&&(t=e.codePoint)>=55296&&56319>=t&&S("\\")&&A("u")){var i=$;$++;var a=T();"unicodeEscape"==a.kind&&(n=a.codePoint)>=56320&&57343>=n?(e.range[1]=a.range[1],e.codePoint=1024*(t-55296)+n-56320+65536,e.type="value",e.kind="unicodeCodePointEscape",r(e)):$=i}}return e}function T(){return M(!0)}function M(e){var t,r=$;if(t=O())return t;if(e){if(E("b"))return s("singleEscape",8,"\\b");E("B")&&X("\\B not possible inside of CharacterClass","",r)}return t=j()}function O(){var e,t;if(e=D(/^(?!0)\d+/)){t=e[0];var r=parseInt(e[0],10);return J>=r?c(e[0]):(Y.push(r),v(-e[0].length),(e=D(/^[0-7]{1,3}/))?s("octal",parseInt(e[0],8),e[0],1):(e=o(D(/^[89]/)),n(e,e.range[0]-1)))}return(e=D(/^[0-7]{1,3}/))?(t=e[0],/^0{1,3}$/.test(t)?s("null",0,"0",t.length+1):s("octal",parseInt(t,8),t,1)):(e=D(/^[dDsSwW]/))?l(e[0]):!1}function j(){var e;if(e=D(/^[fnrtv]/)){var t=0;switch(e[0]){case"t":t=9;break;case"n":t=10;break;case"v":t=11;break;case"f":t=12;break;case"r":t=13}return s("singleEscape",t,"\\"+e[0])}return(e=D(/^c([a-zA-Z])/))?s("controlLetter",e[1].charCodeAt(0)%32,e[1],2):(e=D(/^x([0-9a-fA-F]{2})/))?s("hexadecimalEscape",parseInt(e[1],16),e[1],2):(e=D(/^u([0-9a-fA-F]{4})/))?B(s("unicodeEscape",parseInt(e[1],16),e[1],2)):K&&(e=D(/^u\{([0-9a-fA-F]+)\}/))?s("unicodeCodePointEscape",parseInt(e[1],16),e[1],4):N()}function L(e){var t=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&&t.test(String.fromCharCode(e))}function N(){var e,t="",r="";return L(x())?E(t)?s("identifier",8204,t):E(r)?s("identifier",8205,r):null:(e=v(),s("identifier",e.charCodeAt(0),e,1))}function R(){var e,t=$;return(e=D(/^\[\^/))?(e=V(),b("]"),m(e,!0,t,$)):E("[")?(e=V(),b("]"),m(e,!1,t,$)):null}function V(){var e;return S("]")?[]:(e=q(),e||X("nonEmptyClassRanges"),e)}function U(e){var t,r,n;if(S("-")&&!A("]")){b("-"),n=H(),n||X("classAtom"),r=$;var i=V();return i||X("classRanges"),t=e.range[0],"empty"===i.type?[y(e,n,t,r)]:[y(e,n,t,r)].concat(i)}return n=G(),n||X("nonEmptyClassRangesNoDash"),[e].concat(n)}function q(){var e=H();return e||X("classAtom"),S("]")?[e]:U(e)}function G(){var e=H();return e||X("classAtom"),S("]")?e:U(e)}function H(){return E("-")?o("-"):W()}function W(){var e;return(e=D(/^[^\\\]-]/))?o(e[0]):E("\\")?(e=T(),e||X("classEscape"),B(e)):void 0}function X(t,r,n,i){n=null==n?$:n,i=null==i?n:i;var a=Math.max(0,n-10),s=Math.min(i+10,e.length),o=" "+e.substring(a,s),u=" "+new Array(n-a+1).join(" ")+"^";throw SyntaxError(t+" at position "+n+(r?": "+r:"")+"\n"+o+"\n"+u)}var Y=[],J=0,z=!0,K=-1!==(t||"").indexOf("u"),$=0;e=String(e),""===e&&(e="(?:)");var Q=C();Q.range[1]!==e.length&&X("Could not parse entire input - got stuck","",Q.range[1]);for(var Z=0;Z<Y.length;Z++)if(Y[Z]<=J)return $=0,z=!1,C();return Q}var r={parse:e};"undefined"!=typeof t&&t.exports?t.exports=r:window.regjsparser=r}()},{}],591:[function(e,t,r){function n(e){return A?S?m.UNICODE_IGNORE_CASE[e]:m.UNICODE[e]:m.REGULAR[e]}function i(e,t){return g.call(e,t)}function a(e,t){for(var r in t)e[r]=t[r]}function s(e,t){if(t){var r=f(t,"");switch(r.type){case"characterClass":case"group":case"value":break;default:r=o(r,t)}a(e,r)}}function o(e,t){return{type:"group",behavior:"ignore",body:[e],raw:"(?:"+t+")"}}function u(e){return i(h,e)?h[e]:!1}function p(e){var t=d();e.body.forEach(function(e){switch(e.type){case"value":if(t.add(e.codePoint),S&&A){var r=u(e.codePoint);r&&t.add(r)}break;case"characterClassRange":var i=e.min.codePoint,a=e.max.codePoint;t.addRange(i,a),S&&A&&t.iuAddRange(i,a);break;case"characterClassEscape":t.add(n(e.value));break;default:throw Error("Unknown term type: "+e.type)}});return e.negative&&(t=(A?v:b).clone().remove(t)),s(e,t.toString()),e}function l(e){switch(e.type){case"dot":s(e,(A?E:x).toString());break;case"characterClass":e=p(e);break;case"characterClassEscape":s(e,n(e.value).toString());break;case"alternative":case"disjunction":case"group":case"quantifier":e.body=e.body.map(l);break;case"value":var t=e.codePoint,r=d(t);if(S&&A){var i=u(t);i&&r.add(i)}s(e,r.toString());break;case"anchor":case"empty":case"group":case"reference":break;default:throw Error("Unknown term type: "+e.type)}return e}var c=e(589).generate,f=e(590).parse,d=e(588),h=e(587),m=e(586),y={},g=y.hasOwnProperty,v=d().addRange(0,1114111),b=d().addRange(0,65535),E=v.clone().remove(10,13,8232,8233),x=E.clone().intersection(b);d.prototype.iuAddRange=function(e,t){var r=this;do{var n=u(e);n&&r.add(n)}while(++e<=t);return r};var S=!1,A=!1;t.exports=function(e,t){var r=f(e,t);return S=t?t.indexOf("i")>-1:!1,A=t?t.indexOf("u")>-1:!1,a(r,l(r)),c(r)}},{586:586,587:587,588:588,589:589,590:590}],592:[function(e,t,r){"use strict";var n=e(593);t.exports=function(e,t){if("string"!=typeof e)throw new TypeError("Expected a string as the first argument");if(0>t||!n(t))throw new TypeError("Expected a finite positive number");var r="";do 1&t&&(r+=e),e+=e;while(t>>=1);return r}},{593:593}],593:[function(e,t,r){arguments[4][407][0].apply(r,arguments)},{407:407,594:594}],594:[function(e,t,r){arguments[4][408][0].apply(r,arguments)},{408:408}],595:[function(e,t,r){"use strict";t.exports=/^#!.*/},{}],596:[function(e,t,r){"use strict";t.exports=function(e){var t=/^\\\\\?\\/.test(e),r=/[^\x00-\x80]+/.test(e);return t||r?e:e.replace(/\\/g,"/")}},{}],597:[function(e,t,r){function n(){this._array=[],this._set={}}var i=e(606);n.fromArray=function(e,t){for(var r=new n,i=0,a=e.length;a>i;i++)r.add(e[i],t);return r},n.prototype.size=function(){return Object.getOwnPropertyNames(this._set).length},n.prototype.add=function(e,t){var r=i.toSetString(e),n=this._set.hasOwnProperty(r),a=this._array.length;(!n||t)&&this._array.push(e),n||(this._set[r]=a)},n.prototype.has=function(e){var t=i.toSetString(e);return this._set.hasOwnProperty(t)},n.prototype.indexOf=function(e){var t=i.toSetString(e);if(this._set.hasOwnProperty(t))return this._set[t];throw new Error('"'+e+'" is not in the set.')},n.prototype.at=function(e){if(e>=0&&e<this._array.length)return this._array[e];throw new Error("No element indexed by "+e)},n.prototype.toArray=function(){return this._array.slice()},r.ArraySet=n},{606:606}],598:[function(e,t,r){function n(e){return 0>e?(-e<<1)+1:(e<<1)+0}function i(e){var t=1===(1&e),r=e>>1;return t?-r:r}var a=e(599),s=5,o=1<<s,u=o-1,p=o;r.encode=function(e){var t,r="",i=n(e);do t=i&u,i>>>=s,i>0&&(t|=p),r+=a.encode(t);while(i>0);return r},r.decode=function(e,t,r){var n,o,l=e.length,c=0,f=0;do{if(t>=l)throw new Error("Expected more digits in base 64 VLQ value.");if(o=a.decode(e.charCodeAt(t++)),-1===o)throw new Error("Invalid base64 digit: "+e.charAt(t-1));n=!!(o&p),o&=u,c+=o<<f,f+=s}while(n);r.value=i(c),r.rest=t}},{599:599}],599:[function(e,t,r){var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");r.encode=function(e){if(e>=0&&e<n.length)return n[e];throw new TypeError("Must be between 0 and 63: "+e)},r.decode=function(e){var t=65,r=90,n=97,i=122,a=48,s=57,o=43,u=47,p=26,l=52;return e>=t&&r>=e?e-t:e>=n&&i>=e?e-n+p:e>=a&&s>=e?e-a+l:e==o?62:e==u?63:-1}},{}],600:[function(e,t,r){function n(e,t,i,a,s,o){var u=Math.floor((t-e)/2)+e,p=s(i,a[u],!0);return 0===p?u:p>0?t-u>1?n(u,t,i,a,s,o):o==r.LEAST_UPPER_BOUND?t<a.length?t:-1:u:u-e>1?n(e,u,i,a,s,o):o==r.LEAST_UPPER_BOUND?u:0>e?-1:e}r.GREATEST_LOWER_BOUND=1,r.LEAST_UPPER_BOUND=2,r.search=function(e,t,i,a){if(0===t.length)return-1;var s=n(-1,t.length,e,t,i,a||r.GREATEST_LOWER_BOUND);if(0>s)return-1;for(;s-1>=0&&0===i(t[s],t[s-1],!0);)--s;return s}},{}],601:[function(e,t,r){function n(e,t){var r=e.generatedLine,n=t.generatedLine,i=e.generatedColumn,s=t.generatedColumn;return n>r||n==r&&s>=i||a.compareByGeneratedPositionsInflated(e,t)<=0}function i(){this._array=[],
this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}var a=e(606);i.prototype.unsortedForEach=function(e,t){this._array.forEach(e,t)},i.prototype.add=function(e){n(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))},i.prototype.toArray=function(){return this._sorted||(this._array.sort(a.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},r.MappingList=i},{606:606}],602:[function(e,t,r){function n(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function i(e,t){return Math.round(e+Math.random()*(t-e))}function a(e,t,r,s){if(s>r){var o=i(r,s),u=r-1;n(e,o,s);for(var p=e[s],l=r;s>l;l++)t(e[l],p)<=0&&(u+=1,n(e,u,l));n(e,u+1,l);var c=u+1;a(e,t,r,c-1),a(e,t,c+1,s)}}r.quickSort=function(e,t){a(e,t,0,e.length-1)}},{}],603:[function(e,t,r){function n(e){var t=e;return"string"==typeof e&&(t=JSON.parse(e.replace(/^\)\]\}'/,""))),null!=t.sections?new s(t):new i(t)}function i(e){var t=e;"string"==typeof e&&(t=JSON.parse(e.replace(/^\)\]\}'/,"")));var r=o.getArg(t,"version"),n=o.getArg(t,"sources"),i=o.getArg(t,"names",[]),a=o.getArg(t,"sourceRoot",null),s=o.getArg(t,"sourcesContent",null),u=o.getArg(t,"mappings"),l=o.getArg(t,"file",null);if(r!=this._version)throw new Error("Unsupported version: "+r);n=n.map(o.normalize).map(function(e){return a&&o.isAbsolute(a)&&o.isAbsolute(e)?o.relative(a,e):e}),this._names=p.fromArray(i,!0),this._sources=p.fromArray(n,!0),this.sourceRoot=a,this.sourcesContent=s,this._mappings=u,this.file=l}function a(){this.generatedLine=0,this.generatedColumn=0,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}function s(e){var t=e;"string"==typeof e&&(t=JSON.parse(e.replace(/^\)\]\}'/,"")));var r=o.getArg(t,"version"),i=o.getArg(t,"sections");if(r!=this._version)throw new Error("Unsupported version: "+r);this._sources=new p,this._names=new p;var a={line:-1,column:0};this._sections=i.map(function(e){if(e.url)throw new Error("Support for url field in sections not implemented.");var t=o.getArg(e,"offset"),r=o.getArg(t,"line"),i=o.getArg(t,"column");if(r<a.line||r===a.line&&i<a.column)throw new Error("Section offsets must be ordered and non-overlapping.");return a=t,{generatedOffset:{generatedLine:r+1,generatedColumn:i+1},consumer:new n(o.getArg(e,"map"))}})}var o=e(606),u=e(600),p=e(597).ArraySet,l=e(598),c=e(602).quickSort;n.fromSourceMap=function(e){return i.fromSourceMap(e)},n.prototype._version=3,n.prototype.__generatedMappings=null,Object.defineProperty(n.prototype,"_generatedMappings",{get:function(){return this.__generatedMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__generatedMappings}}),n.prototype.__originalMappings=null,Object.defineProperty(n.prototype,"_originalMappings",{get:function(){return this.__originalMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__originalMappings}}),n.prototype._charIsMappingSeparator=function(e,t){var r=e.charAt(t);return";"===r||","===r},n.prototype._parseMappings=function(e,t){throw new Error("Subclasses must implement _parseMappings")},n.GENERATED_ORDER=1,n.ORIGINAL_ORDER=2,n.GREATEST_LOWER_BOUND=1,n.LEAST_UPPER_BOUND=2,n.prototype.eachMapping=function(e,t,r){var i,a=t||null,s=r||n.GENERATED_ORDER;switch(s){case n.GENERATED_ORDER:i=this._generatedMappings;break;case n.ORIGINAL_ORDER:i=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}var u=this.sourceRoot;i.map(function(e){var t=null===e.source?null:this._sources.at(e.source);return null!=t&&null!=u&&(t=o.join(u,t)),{source:t,generatedLine:e.generatedLine,generatedColumn:e.generatedColumn,originalLine:e.originalLine,originalColumn:e.originalColumn,name:null===e.name?null:this._names.at(e.name)}},this).forEach(e,a)},n.prototype.allGeneratedPositionsFor=function(e){var t=o.getArg(e,"line"),r={source:o.getArg(e,"source"),originalLine:t,originalColumn:o.getArg(e,"column",0)};if(null!=this.sourceRoot&&(r.source=o.relative(this.sourceRoot,r.source)),!this._sources.has(r.source))return[];r.source=this._sources.indexOf(r.source);var n=[],i=this._findMapping(r,this._originalMappings,"originalLine","originalColumn",o.compareByOriginalPositions,u.LEAST_UPPER_BOUND);if(i>=0){var a=this._originalMappings[i];if(void 0===e.column)for(var s=a.originalLine;a&&a.originalLine===s;)n.push({line:o.getArg(a,"generatedLine",null),column:o.getArg(a,"generatedColumn",null),lastColumn:o.getArg(a,"lastGeneratedColumn",null)}),a=this._originalMappings[++i];else for(var p=a.originalColumn;a&&a.originalLine===t&&a.originalColumn==p;)n.push({line:o.getArg(a,"generatedLine",null),column:o.getArg(a,"generatedColumn",null),lastColumn:o.getArg(a,"lastGeneratedColumn",null)}),a=this._originalMappings[++i]}return n},r.SourceMapConsumer=n,i.prototype=Object.create(n.prototype),i.prototype.consumer=n,i.fromSourceMap=function(e){var t=Object.create(i.prototype),r=t._names=p.fromArray(e._names.toArray(),!0),n=t._sources=p.fromArray(e._sources.toArray(),!0);t.sourceRoot=e._sourceRoot,t.sourcesContent=e._generateSourcesContent(t._sources.toArray(),t.sourceRoot),t.file=e._file;for(var s=e._mappings.toArray().slice(),u=t.__generatedMappings=[],l=t.__originalMappings=[],f=0,d=s.length;d>f;f++){var h=s[f],m=new a;m.generatedLine=h.generatedLine,m.generatedColumn=h.generatedColumn,h.source&&(m.source=n.indexOf(h.source),m.originalLine=h.originalLine,m.originalColumn=h.originalColumn,h.name&&(m.name=r.indexOf(h.name)),l.push(m)),u.push(m)}return c(t.__originalMappings,o.compareByOriginalPositions),t},i.prototype._version=3,Object.defineProperty(i.prototype,"sources",{get:function(){return this._sources.toArray().map(function(e){return null!=this.sourceRoot?o.join(this.sourceRoot,e):e},this)}}),i.prototype._parseMappings=function(e,t){for(var r,n,i,s,u,p=1,f=0,d=0,h=0,m=0,y=0,g=e.length,v=0,b={},E={},x=[],S=[];g>v;)if(";"===e.charAt(v))p++,v++,f=0;else if(","===e.charAt(v))v++;else{for(r=new a,r.generatedLine=p,s=v;g>s&&!this._charIsMappingSeparator(e,s);s++);if(n=e.slice(v,s),i=b[n])v+=n.length;else{for(i=[];s>v;)l.decode(e,v,E),u=E.value,v=E.rest,i.push(u);if(2===i.length)throw new Error("Found a source, but no line and column");if(3===i.length)throw new Error("Found a source and line, but no column");b[n]=i}r.generatedColumn=f+i[0],f=r.generatedColumn,i.length>1&&(r.source=m+i[1],m+=i[1],r.originalLine=d+i[2],d=r.originalLine,r.originalLine+=1,r.originalColumn=h+i[3],h=r.originalColumn,i.length>4&&(r.name=y+i[4],y+=i[4])),S.push(r),"number"==typeof r.originalLine&&x.push(r)}c(S,o.compareByGeneratedPositionsDeflated),this.__generatedMappings=S,c(x,o.compareByOriginalPositions),this.__originalMappings=x},i.prototype._findMapping=function(e,t,r,n,i,a){if(e[r]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+e[r]);if(e[n]<0)throw new TypeError("Column must be greater than or equal to 0, got "+e[n]);return u.search(e,t,i,a)},i.prototype.computeColumnSpans=function(){for(var e=0;e<this._generatedMappings.length;++e){var t=this._generatedMappings[e];if(e+1<this._generatedMappings.length){var r=this._generatedMappings[e+1];if(t.generatedLine===r.generatedLine){t.lastGeneratedColumn=r.generatedColumn-1;continue}}t.lastGeneratedColumn=1/0}},i.prototype.originalPositionFor=function(e){var t={generatedLine:o.getArg(e,"line"),generatedColumn:o.getArg(e,"column")},r=this._findMapping(t,this._generatedMappings,"generatedLine","generatedColumn",o.compareByGeneratedPositionsDeflated,o.getArg(e,"bias",n.GREATEST_LOWER_BOUND));if(r>=0){var i=this._generatedMappings[r];if(i.generatedLine===t.generatedLine){var a=o.getArg(i,"source",null);null!==a&&(a=this._sources.at(a),null!=this.sourceRoot&&(a=o.join(this.sourceRoot,a)));var s=o.getArg(i,"name",null);return null!==s&&(s=this._names.at(s)),{source:a,line:o.getArg(i,"originalLine",null),column:o.getArg(i,"originalColumn",null),name:s}}}return{source:null,line:null,column:null,name:null}},i.prototype.hasContentsOfAllSources=function(){return this.sourcesContent?this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(e){return null==e}):!1},i.prototype.sourceContentFor=function(e,t){if(!this.sourcesContent)return null;if(null!=this.sourceRoot&&(e=o.relative(this.sourceRoot,e)),this._sources.has(e))return this.sourcesContent[this._sources.indexOf(e)];var r;if(null!=this.sourceRoot&&(r=o.urlParse(this.sourceRoot))){var n=e.replace(/^file:\/\//,"");if("file"==r.scheme&&this._sources.has(n))return this.sourcesContent[this._sources.indexOf(n)];if((!r.path||"/"==r.path)&&this._sources.has("/"+e))return this.sourcesContent[this._sources.indexOf("/"+e)]}if(t)return null;throw new Error('"'+e+'" is not in the SourceMap.')},i.prototype.generatedPositionFor=function(e){var t=o.getArg(e,"source");if(null!=this.sourceRoot&&(t=o.relative(this.sourceRoot,t)),!this._sources.has(t))return{line:null,column:null,lastColumn:null};t=this._sources.indexOf(t);var r={source:t,originalLine:o.getArg(e,"line"),originalColumn:o.getArg(e,"column")},i=this._findMapping(r,this._originalMappings,"originalLine","originalColumn",o.compareByOriginalPositions,o.getArg(e,"bias",n.GREATEST_LOWER_BOUND));if(i>=0){var a=this._originalMappings[i];if(a.source===r.source)return{line:o.getArg(a,"generatedLine",null),column:o.getArg(a,"generatedColumn",null),lastColumn:o.getArg(a,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},r.BasicSourceMapConsumer=i,s.prototype=Object.create(n.prototype),s.prototype.constructor=n,s.prototype._version=3,Object.defineProperty(s.prototype,"sources",{get:function(){for(var e=[],t=0;t<this._sections.length;t++)for(var r=0;r<this._sections[t].consumer.sources.length;r++)e.push(this._sections[t].consumer.sources[r]);return e}}),s.prototype.originalPositionFor=function(e){var t={generatedLine:o.getArg(e,"line"),generatedColumn:o.getArg(e,"column")},r=u.search(t,this._sections,function(e,t){var r=e.generatedLine-t.generatedOffset.generatedLine;return r?r:e.generatedColumn-t.generatedOffset.generatedColumn}),n=this._sections[r];return n?n.consumer.originalPositionFor({line:t.generatedLine-(n.generatedOffset.generatedLine-1),column:t.generatedColumn-(n.generatedOffset.generatedLine===t.generatedLine?n.generatedOffset.generatedColumn-1:0),bias:e.bias}):{source:null,line:null,column:null,name:null}},s.prototype.hasContentsOfAllSources=function(){return this._sections.every(function(e){return e.consumer.hasContentsOfAllSources()})},s.prototype.sourceContentFor=function(e,t){for(var r=0;r<this._sections.length;r++){var n=this._sections[r],i=n.consumer.sourceContentFor(e,!0);if(i)return i}if(t)return null;throw new Error('"'+e+'" is not in the SourceMap.')},s.prototype.generatedPositionFor=function(e){for(var t=0;t<this._sections.length;t++){var r=this._sections[t];if(-1!==r.consumer.sources.indexOf(o.getArg(e,"source"))){var n=r.consumer.generatedPositionFor(e);if(n){var i={line:n.line+(r.generatedOffset.generatedLine-1),column:n.column+(r.generatedOffset.generatedLine===n.line?r.generatedOffset.generatedColumn-1:0)};return i}}}return{line:null,column:null}},s.prototype._parseMappings=function(e,t){this.__generatedMappings=[],this.__originalMappings=[];for(var r=0;r<this._sections.length;r++)for(var n=this._sections[r],i=n.consumer._generatedMappings,a=0;a<i.length;a++){var s=i[a],u=n.consumer._sources.at(s.source);null!==n.consumer.sourceRoot&&(u=o.join(n.consumer.sourceRoot,u)),this._sources.add(u),u=this._sources.indexOf(u);var p=n.consumer._names.at(s.name);this._names.add(p),p=this._names.indexOf(p);var l={source:u,generatedLine:s.generatedLine+(n.generatedOffset.generatedLine-1),generatedColumn:s.generatedColumn+(n.generatedOffset.generatedLine===s.generatedLine?n.generatedOffset.generatedColumn-1:0),originalLine:s.originalLine,originalColumn:s.originalColumn,name:p};this.__generatedMappings.push(l),"number"==typeof l.originalLine&&this.__originalMappings.push(l)}c(this.__generatedMappings,o.compareByGeneratedPositionsDeflated),c(this.__originalMappings,o.compareByOriginalPositions)},r.IndexedSourceMapConsumer=s},{597:597,598:598,600:600,602:602,606:606}],604:[function(e,t,r){function n(e){e||(e={}),this._file=a.getArg(e,"file",null),this._sourceRoot=a.getArg(e,"sourceRoot",null),this._skipValidation=a.getArg(e,"skipValidation",!1),this._sources=new s,this._names=new s,this._mappings=new o,this._sourcesContents=null}var i=e(598),a=e(606),s=e(597).ArraySet,o=e(601).MappingList;n.prototype._version=3,n.fromSourceMap=function(e){var t=e.sourceRoot,r=new n({file:e.file,sourceRoot:t});return e.eachMapping(function(e){var n={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(n.source=e.source,null!=t&&(n.source=a.relative(t,n.source)),n.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(n.name=e.name)),r.addMapping(n)}),e.sources.forEach(function(t){var n=e.sourceContentFor(t);null!=n&&r.setSourceContent(t,n)}),r},n.prototype.addMapping=function(e){var t=a.getArg(e,"generated"),r=a.getArg(e,"original",null),n=a.getArg(e,"source",null),i=a.getArg(e,"name",null);this._skipValidation||this._validateMapping(t,r,n,i),null==n||this._sources.has(n)||this._sources.add(n),null==i||this._names.has(i)||this._names.add(i),this._mappings.add({generatedLine:t.line,generatedColumn:t.column,originalLine:null!=r&&r.line,originalColumn:null!=r&&r.column,source:n,name:i})},n.prototype.setSourceContent=function(e,t){var r=e;null!=this._sourceRoot&&(r=a.relative(this._sourceRoot,r)),null!=t?(this._sourcesContents||(this._sourcesContents={}),this._sourcesContents[a.toSetString(r)]=t):this._sourcesContents&&(delete this._sourcesContents[a.toSetString(r)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))},n.prototype.applySourceMap=function(e,t,r){var n=t;if(null==t){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.');n=e.file}var i=this._sourceRoot;null!=i&&(n=a.relative(i,n));var o=new s,u=new s;this._mappings.unsortedForEach(function(t){if(t.source===n&&null!=t.originalLine){var s=e.originalPositionFor({line:t.originalLine,column:t.originalColumn});null!=s.source&&(t.source=s.source,null!=r&&(t.source=a.join(r,t.source)),null!=i&&(t.source=a.relative(i,t.source)),t.originalLine=s.line,t.originalColumn=s.column,null!=s.name&&(t.name=s.name))}var p=t.source;null==p||o.has(p)||o.add(p);var l=t.name;null==l||u.has(l)||u.add(l)},this),this._sources=o,this._names=u,e.sources.forEach(function(t){var n=e.sourceContentFor(t);null!=n&&(null!=r&&(t=a.join(r,t)),null!=i&&(t=a.relative(i,t)),this.setSourceContent(t,n))},this)},n.prototype._validateMapping=function(e,t,r,n){if((!(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0)||t||r||n)&&!(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&r))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:r,original:t,name:n}))},n.prototype._serializeMappings=function(){for(var e,t,r,n=0,s=1,o=0,u=0,p=0,l=0,c="",f=this._mappings.toArray(),d=0,h=f.length;h>d;d++){if(e=f[d],e.generatedLine!==s)for(n=0;e.generatedLine!==s;)c+=";",s++;else if(d>0){if(!a.compareByGeneratedPositionsInflated(e,f[d-1]))continue;c+=","}c+=i.encode(e.generatedColumn-n),n=e.generatedColumn,null!=e.source&&(r=this._sources.indexOf(e.source),c+=i.encode(r-l),l=r,c+=i.encode(e.originalLine-1-u),u=e.originalLine-1,c+=i.encode(e.originalColumn-o),o=e.originalColumn,null!=e.name&&(t=this._names.indexOf(e.name),c+=i.encode(t-p),p=t))}return c},n.prototype._generateSourcesContent=function(e,t){return e.map(function(e){if(!this._sourcesContents)return null;null!=t&&(e=a.relative(t,e));var r=a.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null},this)},n.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},n.prototype.toString=function(){return JSON.stringify(this.toJSON())},r.SourceMapGenerator=n},{597:597,598:598,601:601,606:606}],605:[function(e,t,r){function n(e,t,r,n,i){this.children=[],this.sourceContents={},this.line=null==e?null:e,this.column=null==t?null:t,this.source=null==r?null:r,this.name=null==i?null:i,this[u]=!0,null!=n&&this.add(n)}var i=e(604).SourceMapGenerator,a=e(606),s=/(\r?\n)/,o=10,u="$$$isSourceNode$$$";n.fromStringWithSourceMap=function(e,t,r){function i(e,t){if(null===e||void 0===e.source)o.add(t);else{var i=r?a.join(r,e.source):e.source;o.add(new n(e.originalLine,e.originalColumn,i,t,e.name))}}var o=new n,u=e.split(s),p=function(){var e=u.shift(),t=u.shift()||"";return e+t},l=1,c=0,f=null;return t.eachMapping(function(e){if(null!==f){if(!(l<e.generatedLine)){var t=u[0],r=t.substr(0,e.generatedColumn-c);return u[0]=t.substr(e.generatedColumn-c),c=e.generatedColumn,i(f,r),void(f=e)}i(f,p()),l++,c=0}for(;l<e.generatedLine;)o.add(p()),l++;if(c<e.generatedColumn){var t=u[0];o.add(t.substr(0,e.generatedColumn)),u[0]=t.substr(e.generatedColumn),c=e.generatedColumn}f=e},this),u.length>0&&(f&&i(f,p()),o.add(u.join(""))),t.sources.forEach(function(e){var n=t.sourceContentFor(e);null!=n&&(null!=r&&(e=a.join(r,e)),o.setSourceContent(e,n))}),o},n.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},n.prototype.prepend=function(e){if(Array.isArray(e))for(var t=e.length-1;t>=0;t--)this.prepend(e[t]);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},n.prototype.walk=function(e){for(var t,r=0,n=this.children.length;n>r;r++)t=this.children[r],t[u]?t.walk(e):""!==t&&e(t,{source:this.source,line:this.line,column:this.column,name:this.name})},n.prototype.join=function(e){var t,r,n=this.children.length;if(n>0){for(t=[],r=0;n-1>r;r++)t.push(this.children[r]),t.push(e);t.push(this.children[r]),this.children=t}return this},n.prototype.replaceRight=function(e,t){var r=this.children[this.children.length-1];return r[u]?r.replaceRight(e,t):"string"==typeof r?this.children[this.children.length-1]=r.replace(e,t):this.children.push("".replace(e,t)),this},n.prototype.setSourceContent=function(e,t){this.sourceContents[a.toSetString(e)]=t},n.prototype.walkSourceContents=function(e){for(var t=0,r=this.children.length;r>t;t++)this.children[t][u]&&this.children[t].walkSourceContents(e);for(var n=Object.keys(this.sourceContents),t=0,r=n.length;r>t;t++)e(a.fromSetString(n[t]),this.sourceContents[n[t]])},n.prototype.toString=function(){var e="";return this.walk(function(t){e+=t}),e},n.prototype.toStringWithSourceMap=function(e){var t={code:"",line:1,column:0},r=new i(e),n=!1,a=null,s=null,u=null,p=null;return this.walk(function(e,i){t.code+=e,null!==i.source&&null!==i.line&&null!==i.column?((a!==i.source||s!==i.line||u!==i.column||p!==i.name)&&r.addMapping({source:i.source,original:{line:i.line,column:i.column},generated:{line:t.line,column:t.column},name:i.name}),a=i.source,s=i.line,u=i.column,p=i.name,n=!0):n&&(r.addMapping({generated:{line:t.line,column:t.column}}),a=null,n=!1);for(var l=0,c=e.length;c>l;l++)e.charCodeAt(l)===o?(t.line++,t.column=0,l+1===c?(a=null,n=!1):n&&r.addMapping({source:i.source,original:{line:i.line,column:i.column},generated:{line:t.line,column:t.column},name:i.name})):t.column++}),this.walkSourceContents(function(e,t){r.setSourceContent(e,t)}),{code:t.code,map:r}},r.SourceNode=n},{604:604,606:606}],606:[function(e,t,r){function n(e,t,r){if(t in e)return e[t];if(3===arguments.length)return r;throw new Error('"'+t+'" is a required argument.')}function i(e){var t=e.match(m);return t?{scheme:t[1],auth:t[2],host:t[3],port:t[4],path:t[5]}:null}function a(e){var t="";return e.scheme&&(t+=e.scheme+":"),t+="//",e.auth&&(t+=e.auth+"@"),e.host&&(t+=e.host),e.port&&(t+=":"+e.port),e.path&&(t+=e.path),t}function s(e){var t=e,n=i(e);if(n){if(!n.path)return e;t=n.path}for(var s,o=r.isAbsolute(t),u=t.split(/\/+/),p=0,l=u.length-1;l>=0;l--)s=u[l],"."===s?u.splice(l,1):".."===s?p++:p>0&&(""===s?(u.splice(l+1,p),p=0):(u.splice(l,2),p--));return t=u.join("/"),""===t&&(t=o?"/":"."),n?(n.path=t,a(n)):t}function o(e,t){""===e&&(e="."),""===t&&(t=".");var r=i(t),n=i(e);if(n&&(e=n.path||"/"),r&&!r.scheme)return n&&(r.scheme=n.scheme),a(r);if(r||t.match(y))return t;if(n&&!n.host&&!n.path)return n.host=t,a(n);var o="/"===t.charAt(0)?t:s(e.replace(/\/+$/,"")+"/"+t);return n?(n.path=o,a(n)):o}function u(e,t){""===e&&(e="."),e=e.replace(/\/$/,"");for(var r=0;0!==t.indexOf(e+"/");){var n=e.lastIndexOf("/");if(0>n)return t;if(e=e.slice(0,n),e.match(/^([^\/]+:\/)?\/*$/))return t;++r}return Array(r+1).join("../")+t.substr(e.length+1)}function p(e){return"$"+e}function l(e){return e.substr(1)}function c(e,t,r){var n=e.source-t.source;return 0!==n?n:(n=e.originalLine-t.originalLine,0!==n?n:(n=e.originalColumn-t.originalColumn,0!==n||r?n:(n=e.generatedColumn-t.generatedColumn,0!==n?n:(n=e.generatedLine-t.generatedLine,0!==n?n:e.name-t.name))))}function f(e,t,r){var n=e.generatedLine-t.generatedLine;return 0!==n?n:(n=e.generatedColumn-t.generatedColumn,0!==n||r?n:(n=e.source-t.source,0!==n?n:(n=e.originalLine-t.originalLine,0!==n?n:(n=e.originalColumn-t.originalColumn,0!==n?n:e.name-t.name))))}function d(e,t){return e===t?0:e>t?1:-1}function h(e,t){var r=e.generatedLine-t.generatedLine;return 0!==r?r:(r=e.generatedColumn-t.generatedColumn,0!==r?r:(r=d(e.source,t.source),0!==r?r:(r=e.originalLine-t.originalLine,0!==r?r:(r=e.originalColumn-t.originalColumn,0!==r?r:d(e.name,t.name)))))}r.getArg=n;var m=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/,y=/^data:.+\,.+$/;r.urlParse=i,r.urlGenerate=a,r.normalize=s,r.join=o,r.isAbsolute=function(e){return"/"===e.charAt(0)||!!e.match(m)},r.relative=u,r.toSetString=p,r.fromSetString=l,r.compareByOriginalPositions=c,r.compareByGeneratedPositionsDeflated=f,r.compareByGeneratedPositionsInflated=h},{}],607:[function(e,t,r){r.SourceMapGenerator=e(604).SourceMapGenerator,r.SourceMapConsumer=e(603).SourceMapConsumer,r.SourceNode=e(605).SourceNode},{603:603,604:604,605:605}],608:[function(e,t,r){"use strict";t.exports=function n(e){function t(){}t.prototype=e,new t}},{}],609:[function(e,t,r){"use strict";t.exports=function(e){for(var t=e.length;/[\s\uFEFF\u00A0]/.test(e[t-1]);)t--;return e.slice(0,t)}},{}],610:[function(e,t,r){(function(r){var n,i=e(3),a=t.exports=function(t,r){try{return(r||e).resolve(t)}catch(n){return null}};a.relative=function(e){if("object"==typeof i)return null;n||(n=new i,n.paths=i._nodeModulePaths(r.cwd()));try{return i._resolveFilename(e,n)}catch(t){return null}}}).call(this,e(10))},{10:10,3:3}],611:[function(e,t,r){t.exports={name:"babel-core",version:"5.8.35",description:"A compiler for writing next generation JavaScript",author:"Sebastian McKenzie <sebmck@gmail.com>",homepage:"https://babeljs.io/",license:"MIT",repository:"babel/babel",browser:{"./lib/api/register/node.js":"./lib/api/register/browser.js"},keywords:["6to5","babel","classes","const","es6","harmony","let","modules","transpile","transpiler","var"],scripts:{bench:"make bench",test:"make test"},dependencies:{"babel-plugin-constant-folding":"^1.0.1","babel-plugin-dead-code-elimination":"^1.0.2","babel-plugin-eval":"^1.0.1","babel-plugin-inline-environment-variables":"^1.0.1","babel-plugin-jscript":"^1.0.4","babel-plugin-member-expression-literals":"^1.0.1","babel-plugin-property-literals":"^1.0.1","babel-plugin-proto-to-assign":"^1.0.3","babel-plugin-react-constant-elements":"^1.0.3","babel-plugin-react-display-name":"^1.0.3","babel-plugin-remove-console":"^1.0.1","babel-plugin-remove-debugger":"^1.0.1","babel-plugin-runtime":"^1.0.7","babel-plugin-undeclared-variables-check":"^1.0.2","babel-plugin-undefined-to-void":"^1.1.6",babylon:"^5.8.35",bluebird:"^2.9.33",chalk:"^1.0.0","convert-source-map":"^1.1.0","core-js":"^1.0.0",debug:"^2.1.1","detect-indent":"^3.0.0",esutils:"^2.0.0","fs-readdir-recursive":"^0.1.0",globals:"^6.4.0","home-or-tmp":"^1.0.0","is-integer":"^1.0.4","js-tokens":"1.0.1",json5:"^0.4.0","line-numbers":"0.2.0",lodash:"^3.10.0",minimatch:"^2.0.3","output-file-sync":"^1.1.0","path-exists":"^1.0.0","path-is-absolute":"^1.0.0","private":"^0.1.6",regenerator:"0.8.40",regexpu:"^1.3.0",repeating:"^1.1.2",resolve:"^1.1.6","shebang-regex":"^1.0.0",slash:"^1.0.0","source-map":"^0.5.0","source-map-support":"^0.2.10","to-fast-properties":"^1.0.0","trim-right":"^1.0.0","try-resolve":"^1.0.0"}}},{}],612:[function(e,t,r){t.exports={"abstract-expression-call":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"PROPERTY"},property:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Identifier",name:"referenceGet"},computed:!1},computed:!0},arguments:[{type:"Identifier",name:"OBJECT"}]},property:{type:"Identifier",name:"call"},computed:!1},arguments:[{type:"Identifier",name:"OBJECT"}]}}]},"abstract-expression-delete":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"PROPERTY"},property:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Identifier",name:"referenceDelete"},computed:!1},computed:!0},arguments:[{type:"Identifier",name:"OBJECT"}]}}]},"abstract-expression-get":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"PROPERTY"},property:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Identifier",name:"referenceGet"},computed:!1},computed:!0},arguments:[{type:"Identifier",name:"OBJECT"}]}}]},"abstract-expression-set":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"PROPERTY"},property:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Identifier",name:"referenceSet"},computed:!1},computed:!0},arguments:[{type:"Identifier",name:"OBJECT"},{type:"Identifier",name:"VALUE"}]}}]},"array-comprehension-container":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[],body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"KEY"},init:{type:"ArrayExpression",elements:[]}}],kind:"var"},{type:"ReturnStatement",argument:{type:"Identifier",name:"KEY"}}]},parenthesizedExpression:!0},arguments:[]}}]},"array-from":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Array"},property:{type:"Identifier",name:"from"},computed:!1},arguments:[{type:"Identifier",name:"VALUE"}]}}]},"array-push":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"KEY"},property:{type:"Identifier",name:"push"},computed:!1},arguments:[{type:"Identifier",name:"STATEMENT"}]}}]},call:{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"OBJECT"},property:{type:"Identifier",name:"call"},computed:!1},arguments:[{type:"Identifier",name:"CONTEXT"}]}}]},"class-decorator":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"CLASS_REF"},right:{type:"LogicalExpression",left:{type:"CallExpression",callee:{type:"Identifier",name:"DECORATOR"},arguments:[{type:"Identifier",name:"CLASS_REF"}]},operator:"||",right:{type:"Identifier",name:"CLASS_REF"}}}}]},"class-derived-default-constructor":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[],body:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Super"},arguments:[{type:"SpreadElement",argument:{type:"Identifier",name:"arguments"}}]}}]},parenthesizedExpression:!0}}]},"default-parameter-assign":{type:"Program",body:[{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Identifier",name:"VARIABLE_NAME"},operator:"===",right:{type:"Identifier",name:"undefined"}},consequent:{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"VARIABLE_NAME"},right:{type:"Identifier",name:"DEFAULT_VALUE"}}},alternate:null}]},"default-parameter":{type:"Program",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"VARIABLE_NAME"},init:{type:"ConditionalExpression",test:{type:"LogicalExpression",left:{type:"BinaryExpression",left:{type:"MemberExpression",object:{type:"Identifier",name:"ARGUMENTS"},property:{type:"Identifier",name:"length"},computed:!1},operator:"<=",right:{type:"Identifier",name:"ARGUMENT_KEY"}},operator:"||",right:{type:"BinaryExpression",left:{type:"MemberExpression",object:{type:"Identifier",name:"ARGUMENTS"},property:{type:"Identifier",name:"ARGUMENT_KEY"},computed:!0},operator:"===",right:{type:"Identifier",name:"undefined"}}},consequent:{type:"Identifier",name:"DEFAULT_VALUE"},alternate:{type:"MemberExpression",object:{type:"Identifier",name:"ARGUMENTS"},property:{type:"Identifier",name:"ARGUMENT_KEY"},computed:!0}}}],kind:"let"}]},"exports-assign":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"exports"},property:{type:"Identifier",name:"KEY"},computed:!1},right:{type:"Identifier",name:"VALUE"}}}]},"exports-default-assign":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"module"},property:{type:"Identifier",name:"exports"},computed:!1},right:{type:"Identifier",name:"VALUE"}}}]},"exports-from-assign":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"defineProperty"},computed:!1},arguments:[{type:"Identifier",name:"exports"},{type:"Identifier",name:"ID"},{type:"ObjectExpression",properties:[{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"enumerable"},value:{type:"Literal",value:!0},kind:"init"},{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"get"},value:{type:"FunctionExpression",id:{type:"Identifier",name:"get"},generator:!1,expression:!1,params:[],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"Identifier",name:"INIT"}}]}},kind:"init"}]}]}}]},"exports-module-declaration-loose":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"exports"},property:{type:"Identifier",name:"__esModule"},computed:!1},right:{type:"Literal",value:!0}}}]},"exports-module-declaration":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"defineProperty"
},computed:!1},arguments:[{type:"Identifier",name:"exports"},{type:"Literal",value:"__esModule"},{type:"ObjectExpression",properties:[{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"value"},value:{type:"Literal",value:!0},kind:"init"}]}]}}]},"for-of-array":{type:"Program",body:[{type:"ForStatement",init:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"KEY"},init:{type:"Literal",value:0}}],kind:"var"},test:{type:"BinaryExpression",left:{type:"Identifier",name:"KEY"},operator:"<",right:{type:"MemberExpression",object:{type:"Identifier",name:"ARR"},property:{type:"Identifier",name:"length"},computed:!1}},update:{type:"UpdateExpression",operator:"++",prefix:!1,argument:{type:"Identifier",name:"KEY"}},body:{type:"ExpressionStatement",expression:{type:"Identifier",name:"BODY"}}}]},"for-of-loose":{type:"Program",body:[{type:"ForStatement",init:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"LOOP_OBJECT"},init:{type:"Identifier",name:"OBJECT"}},{type:"VariableDeclarator",id:{type:"Identifier",name:"IS_ARRAY"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Array"},property:{type:"Identifier",name:"isArray"},computed:!1},arguments:[{type:"Identifier",name:"LOOP_OBJECT"}]}},{type:"VariableDeclarator",id:{type:"Identifier",name:"INDEX"},init:{type:"Literal",value:0}},{type:"VariableDeclarator",id:{type:"Identifier",name:"LOOP_OBJECT"},init:{type:"ConditionalExpression",test:{type:"Identifier",name:"IS_ARRAY"},consequent:{type:"Identifier",name:"LOOP_OBJECT"},alternate:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"LOOP_OBJECT"},property:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Identifier",name:"iterator"},computed:!1},computed:!0},arguments:[]}}}],kind:"var"},test:null,update:null,body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"ID"},init:null}],kind:"var"},{type:"IfStatement",test:{type:"Identifier",name:"IS_ARRAY"},consequent:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Identifier",name:"INDEX"},operator:">=",right:{type:"MemberExpression",object:{type:"Identifier",name:"LOOP_OBJECT"},property:{type:"Identifier",name:"length"},computed:!1}},consequent:{type:"BreakStatement",label:null},alternate:null},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"ID"},right:{type:"MemberExpression",object:{type:"Identifier",name:"LOOP_OBJECT"},property:{type:"UpdateExpression",operator:"++",prefix:!1,argument:{type:"Identifier",name:"INDEX"}},computed:!0}}}]},alternate:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"INDEX"},right:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"LOOP_OBJECT"},property:{type:"Identifier",name:"next"},computed:!1},arguments:[]}}},{type:"IfStatement",test:{type:"MemberExpression",object:{type:"Identifier",name:"INDEX"},property:{type:"Identifier",name:"done"},computed:!1},consequent:{type:"BreakStatement",label:null},alternate:null},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"ID"},right:{type:"MemberExpression",object:{type:"Identifier",name:"INDEX"},property:{type:"Identifier",name:"value"},computed:!1}}}]}}]}}]},"for-of":{type:"Program",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"ITERATOR_COMPLETION"},init:{type:"Literal",value:!0}}],kind:"var"},{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"ITERATOR_HAD_ERROR_KEY"},init:{type:"Literal",value:!1}}],kind:"var"},{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"ITERATOR_ERROR_KEY"},init:{type:"Identifier",name:"undefined"}}],kind:"var"},{type:"TryStatement",block:{type:"BlockStatement",body:[{type:"ForStatement",init:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"ITERATOR_KEY"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"OBJECT"},property:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Identifier",name:"iterator"},computed:!1},computed:!0},arguments:[]}},{type:"VariableDeclarator",id:{type:"Identifier",name:"STEP_KEY"},init:null}],kind:"var"},test:{type:"UnaryExpression",operator:"!",prefix:!0,argument:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"ITERATOR_COMPLETION"},right:{type:"MemberExpression",object:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"STEP_KEY"},right:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"ITERATOR_KEY"},property:{type:"Identifier",name:"next"},computed:!1},arguments:[]},parenthesizedExpression:!0},property:{type:"Identifier",name:"done"},computed:!1},parenthesizedExpression:!0}},update:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"ITERATOR_COMPLETION"},right:{type:"Literal",value:!0}},body:{type:"BlockStatement",body:[]}}]},handler:{type:"CatchClause",param:{type:"Identifier",name:"err"},body:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"ITERATOR_HAD_ERROR_KEY"},right:{type:"Literal",value:!0}}},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"ITERATOR_ERROR_KEY"},right:{type:"Identifier",name:"err"}}}]}},guardedHandlers:[],finalizer:{type:"BlockStatement",body:[{type:"TryStatement",block:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"LogicalExpression",left:{type:"UnaryExpression",operator:"!",prefix:!0,argument:{type:"Identifier",name:"ITERATOR_COMPLETION"}},operator:"&&",right:{type:"MemberExpression",object:{type:"Identifier",name:"ITERATOR_KEY"},property:{type:"Literal",value:"return"},computed:!0}},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"ITERATOR_KEY"},property:{type:"Literal",value:"return"},computed:!0},arguments:[]}}]},alternate:null}]},handler:null,guardedHandlers:[],finalizer:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"Identifier",name:"ITERATOR_HAD_ERROR_KEY"},consequent:{type:"BlockStatement",body:[{type:"ThrowStatement",argument:{type:"Identifier",name:"ITERATOR_ERROR_KEY"}}]},alternate:null}]}}]}}]},"helper-async-to-generator":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"fn"}],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[],body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"gen"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"fn"},property:{type:"Identifier",name:"apply"},computed:!1},arguments:[{type:"ThisExpression"},{type:"Identifier",name:"arguments"}]}}],kind:"var"},{type:"ReturnStatement",argument:{type:"NewExpression",callee:{type:"Identifier",name:"Promise"},arguments:[{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"resolve"},{type:"Identifier",name:"reject"}],body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"callNext"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"step"},property:{type:"Identifier",name:"bind"},computed:!1},arguments:[{type:"Literal",value:null,rawValue:null},{type:"Literal",value:"next"}]}}],kind:"var"},{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"callThrow"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"step"},property:{type:"Identifier",name:"bind"},computed:!1},arguments:[{type:"Literal",value:null,rawValue:null},{type:"Literal",value:"throw"}]}}],kind:"var"},{type:"FunctionDeclaration",id:{type:"Identifier",name:"step"},generator:!1,expression:!1,params:[{type:"Identifier",name:"key"},{type:"Identifier",name:"arg"}],body:{type:"BlockStatement",body:[{type:"TryStatement",block:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"info"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"gen"},property:{type:"Identifier",name:"key"},computed:!0},arguments:[{type:"Identifier",name:"arg"}]}}],kind:"var"},{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"value"},init:{type:"MemberExpression",object:{type:"Identifier",name:"info"},property:{type:"Identifier",name:"value"},computed:!1}}],kind:"var"}]},handler:{type:"CatchClause",param:{type:"Identifier",name:"error"},body:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"reject"},arguments:[{type:"Identifier",name:"error"}]}},{type:"ReturnStatement",argument:null}]}},guardedHandlers:[],finalizer:null},{type:"IfStatement",test:{type:"MemberExpression",object:{type:"Identifier",name:"info"},property:{type:"Identifier",name:"done"},computed:!1},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"resolve"},arguments:[{type:"Identifier",name:"value"}]}}]},alternate:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Promise"},property:{type:"Identifier",name:"resolve"},computed:!1},arguments:[{type:"Identifier",name:"value"}]},property:{type:"Identifier",name:"then"},computed:!1},arguments:[{type:"Identifier",name:"callNext"},{type:"Identifier",name:"callThrow"}]}}]}}]}},{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"callNext"},arguments:[]}}]}}]}}]}}}]},parenthesizedExpression:!0}}]},"helper-bind":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"MemberExpression",object:{type:"MemberExpression",object:{type:"Identifier",name:"Function"},property:{type:"Identifier",name:"prototype"},computed:!1},property:{type:"Identifier",name:"bind"},computed:!1}}]},"helper-class-call-check":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"instance"},{type:"Identifier",name:"Constructor"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"UnaryExpression",operator:"!",prefix:!0,argument:{type:"BinaryExpression",left:{type:"Identifier",name:"instance"},operator:"instanceof",right:{type:"Identifier",name:"Constructor"},parenthesizedExpression:!0}},consequent:{type:"BlockStatement",body:[{type:"ThrowStatement",argument:{type:"NewExpression",callee:{type:"Identifier",name:"TypeError"},arguments:[{type:"Literal",value:"Cannot call a class as a function"}]}}]},alternate:null}]},parenthesizedExpression:!0}}]},"helper-create-class":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[],body:{type:"BlockStatement",body:[{type:"FunctionDeclaration",id:{type:"Identifier",name:"defineProperties"},generator:!1,expression:!1,params:[{type:"Identifier",name:"target"},{type:"Identifier",name:"props"}],body:{type:"BlockStatement",body:[{type:"ForStatement",init:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"i"},init:{type:"Literal",value:0}}],kind:"var"},test:{type:"BinaryExpression",left:{type:"Identifier",name:"i"},operator:"<",right:{type:"MemberExpression",object:{type:"Identifier",name:"props"},property:{type:"Identifier",name:"length"},computed:!1}},update:{type:"UpdateExpression",operator:"++",prefix:!1,argument:{type:"Identifier",name:"i"}},body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"descriptor"},init:{type:"MemberExpression",object:{type:"Identifier",name:"props"},property:{type:"Identifier",name:"i"},computed:!0}}],kind:"var"},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"enumerable"},computed:!1},right:{type:"LogicalExpression",left:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"enumerable"},computed:!1},operator:"||",right:{type:"Literal",value:!1}}}},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"configurable"},computed:!1},right:{type:"Literal",value:!0}}},{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Literal",value:"value"},operator:"in",right:{type:"Identifier",name:"descriptor"}},consequent:{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"writable"},computed:!1},right:{type:"Literal",value:!0}}},alternate:null},{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"defineProperty"},computed:!1},arguments:[{type:"Identifier",name:"target"},{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"key"},computed:!1},{type:"Identifier",name:"descriptor"}]}}]}}]}},{type:"ReturnStatement",argument:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"Constructor"},{type:"Identifier",name:"protoProps"},{type:"Identifier",name:"staticProps"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"Identifier",name:"protoProps"},consequent:{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"defineProperties"},arguments:[{type:"MemberExpression",object:{type:"Identifier",name:"Constructor"},property:{type:"Identifier",name:"prototype"},computed:!1},{type:"Identifier",name:"protoProps"}]}},alternate:null},{type:"IfStatement",test:{type:"Identifier",name:"staticProps"},consequent:{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"defineProperties"},arguments:[{type:"Identifier",name:"Constructor"},{type:"Identifier",name:"staticProps"}]}},alternate:null},{type:"ReturnStatement",argument:{type:"Identifier",name:"Constructor"}}]}}}]},parenthesizedExpression:!0},arguments:[]}}]},"helper-create-decorated-class":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[],body:{type:"BlockStatement",body:[{type:"FunctionDeclaration",id:{type:"Identifier",name:"defineProperties"},generator:!1,expression:!1,params:[{type:"Identifier",name:"target"},{type:"Identifier",name:"descriptors"},{type:"Identifier",name:"initializers"}],body:{type:"BlockStatement",body:[{type:"ForStatement",init:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"i"},init:{type:"Literal",value:0}}],kind:"var"},test:{type:"BinaryExpression",left:{type:"Identifier",name:"i"},operator:"<",right:{type:"MemberExpression",object:{type:"Identifier",name:"descriptors"},property:{type:"Identifier",name:"length"},computed:!1}},update:{type:"UpdateExpression",operator:"++",prefix:!1,argument:{type:"Identifier",name:"i"}},body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"descriptor"},init:{type:"MemberExpression",object:{type:"Identifier",name:"descriptors"},property:{type:"Identifier",name:"i"},computed:!0}}],kind:"var"},{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"decorators"},init:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"decorators"},computed:!1}}],kind:"var"},{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"key"},init:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"key"},computed:!1}}],kind:"var"},{type:"ExpressionStatement",expression:{type:"UnaryExpression",operator:"delete",prefix:!0,argument:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor",leadingComments:null},property:{type:"Identifier",name:"key"},computed:!1,leadingComments:null},leadingComments:null}},{type:"ExpressionStatement",expression:{type:"UnaryExpression",operator:"delete",prefix:!0,argument:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"decorators"},computed:!1}}},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"enumerable"},computed:!1},right:{type:"LogicalExpression",left:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"enumerable"},computed:!1},operator:"||",right:{type:"Literal",value:!1}}}},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"configurable"},computed:!1},right:{type:"Literal",value:!0}}},{type:"IfStatement",test:{type:"LogicalExpression",left:{type:"BinaryExpression",left:{type:"Literal",value:"value"},operator:"in",right:{type:"Identifier",name:"descriptor"}},operator:"||",right:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"initializer"},computed:!1}},consequent:{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"writable"},computed:!1},right:{type:"Literal",value:!0}}},alternate:null},{type:"IfStatement",test:{type:"Identifier",name:"decorators"},consequent:{type:"BlockStatement",body:[{type:"ForStatement",init:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"f"},init:{type:"Literal",value:0}}],kind:"var"},test:{type:"BinaryExpression",left:{type:"Identifier",name:"f"},operator:"<",right:{type:"MemberExpression",object:{type:"Identifier",name:"decorators"},property:{type:"Identifier",name:"length"},computed:!1}},update:{type:"UpdateExpression",operator:"++",prefix:!1,argument:{type:"Identifier",name:"f"}},body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"decorator"},init:{type:"MemberExpression",object:{type:"Identifier",name:"decorators"},property:{type:"Identifier",name:"f"},computed:!0}}],kind:"var"},{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"Identifier",name:"decorator"}},operator:"===",right:{type:"Literal",value:"function"}},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"descriptor"},right:{type:"LogicalExpression",left:{type:"CallExpression",callee:{type:"Identifier",name:"decorator"},arguments:[{type:"Identifier",name:"target"},{type:"Identifier",name:"key"},{type:"Identifier",name:"descriptor"}]},operator:"||",right:{type:"Identifier",name:"descriptor"}}}}]},alternate:{type:"BlockStatement",body:[{type:"ThrowStatement",argument:{type:"NewExpression",callee:{type:"Identifier",name:"TypeError"},arguments:[{type:"BinaryExpression",left:{type:"BinaryExpression",left:{type:"BinaryExpression",left:{type:"Literal",value:"The decorator for method "},operator:"+",right:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"key"},computed:!1}},operator:"+",right:{type:"Literal",value:" is of the invalid type "}},operator:"+",right:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"Identifier",name:"decorator"}}}]}}]}}]}},{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"initializer"},computed:!1},operator:"!==",right:{type:"Identifier",name:"undefined"}},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"initializers"},property:{type:"Identifier",name:"key"},computed:!0},right:{type:"Identifier",name:"descriptor"}}},{type:"ContinueStatement",label:null}]},alternate:null}]},alternate:null},{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"defineProperty"},computed:!1},arguments:[{type:"Identifier",name:"target"},{type:"Identifier",name:"key"},{type:"Identifier",name:"descriptor"}]}}]}}]}},{type:"ReturnStatement",argument:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"Constructor"},{type:"Identifier",name:"protoProps"},{type:"Identifier",name:"staticProps"},{type:"Identifier",name:"protoInitializers"},{type:"Identifier",name:"staticInitializers"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"Identifier",name:"protoProps"},consequent:{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"defineProperties"},arguments:[{type:"MemberExpression",object:{type:"Identifier",name:"Constructor"},property:{type:"Identifier",name:"prototype"},computed:!1},{type:"Identifier",name:"protoProps"},{type:"Identifier",name:"protoInitializers"}]}},alternate:null},{type:"IfStatement",test:{type:"Identifier",name:"staticProps"},consequent:{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"defineProperties"},arguments:[{type:"Identifier",name:"Constructor"},{type:"Identifier",name:"staticProps"},{type:"Identifier",name:"staticInitializers"}]}},alternate:null},{type:"ReturnStatement",argument:{type:"Identifier",name:"Constructor"}}]}}}]},parenthesizedExpression:!0},arguments:[]}}]},"helper-create-decorated-object":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"descriptors"}],body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"target"},init:{type:"ObjectExpression",properties:[]}}],kind:"var"},{type:"ForStatement",init:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"i"},init:{type:"Literal",value:0}}],kind:"var"},test:{type:"BinaryExpression",left:{type:"Identifier",name:"i"},operator:"<",right:{type:"MemberExpression",object:{type:"Identifier",name:"descriptors"},property:{type:"Identifier",name:"length"},computed:!1}},update:{type:"UpdateExpression",operator:"++",prefix:!1,argument:{type:"Identifier",name:"i"}},body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"descriptor"},init:{type:"MemberExpression",object:{type:"Identifier",name:"descriptors"},property:{type:"Identifier",name:"i"},computed:!0}}],kind:"var"},{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"decorators"},init:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"decorators"},computed:!1}}],kind:"var"},{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"key"},init:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"key"},computed:!1}}],kind:"var"},{type:"ExpressionStatement",expression:{type:"UnaryExpression",operator:"delete",prefix:!0,argument:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor",leadingComments:null},property:{type:"Identifier",name:"key"},computed:!1,leadingComments:null},leadingComments:null}},{type:"ExpressionStatement",expression:{type:"UnaryExpression",operator:"delete",prefix:!0,argument:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"decorators"},computed:!1}}},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"enumerable"},computed:!1},right:{type:"Literal",value:!0}}},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"configurable"},computed:!1},right:{type:"Literal",value:!0}}},{type:"IfStatement",test:{type:"LogicalExpression",left:{type:"BinaryExpression",left:{type:"Literal",value:"value"},operator:"in",right:{type:"Identifier",name:"descriptor"}},operator:"||",right:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"initializer"},computed:!1}},consequent:{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"writable"},computed:!1},right:{type:"Literal",value:!0}}},alternate:null},{type:"IfStatement",test:{type:"Identifier",name:"decorators"},consequent:{type:"BlockStatement",body:[{type:"ForStatement",init:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"f"},init:{type:"Literal",value:0}}],kind:"var"},test:{type:"BinaryExpression",left:{type:"Identifier",name:"f"},operator:"<",right:{type:"MemberExpression",object:{type:"Identifier",name:"decorators"},property:{type:"Identifier",name:"length"},computed:!1}},update:{type:"UpdateExpression",operator:"++",prefix:!1,argument:{type:"Identifier",name:"f"}},body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"decorator"},init:{type:"MemberExpression",object:{type:"Identifier",name:"decorators"},property:{type:"Identifier",name:"f"},computed:!0}}],kind:"var"},{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"Identifier",name:"decorator"}},operator:"===",right:{type:"Literal",value:"function"}},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"descriptor"},right:{type:"LogicalExpression",left:{type:"CallExpression",callee:{type:"Identifier",name:"decorator"},arguments:[{type:"Identifier",name:"target"},{type:"Identifier",name:"key"},{type:"Identifier",name:"descriptor"}]},operator:"||",right:{type:"Identifier",name:"descriptor"}}}}]},alternate:{type:"BlockStatement",body:[{type:"ThrowStatement",argument:{type:"NewExpression",callee:{type:"Identifier",name:"TypeError"},arguments:[{type:"BinaryExpression",left:{type:"BinaryExpression",left:{type:"BinaryExpression",left:{type:"Literal",value:"The decorator for method "},operator:"+",right:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"key"},computed:!1}},operator:"+",right:{type:"Literal",value:" is of the invalid type "}},operator:"+",right:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"Identifier",name:"decorator"}}}]}}]}}]}}]},alternate:null},{type:"IfStatement",test:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"initializer"},computed:!1},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"value"},computed:!1},right:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"initializer"},computed:!1},property:{type:"Identifier",name:"call"},computed:!1},arguments:[{type:"Identifier",name:"target"}]}}}]},alternate:null},{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"defineProperty"},computed:!1},arguments:[{type:"Identifier",name:"target"},{type:"Identifier",name:"key"},{type:"Identifier",name:"descriptor"}]}}]}},{type:"ReturnStatement",argument:{type:"Identifier",name:"target"}}]},parenthesizedExpression:!0}}]},"helper-default-props":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"defaultProps"},{type:"Identifier",name:"props"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"Identifier",name:"defaultProps"},consequent:{type:"BlockStatement",body:[{type:"ForInStatement",left:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"propName"},init:null}],kind:"var"},right:{type:"Identifier",name:"defaultProps"},body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"MemberExpression",object:{type:"Identifier",name:"props"},property:{type:"Identifier",name:"propName"},computed:!0}},operator:"===",right:{type:"Literal",value:"undefined"}},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"props"},property:{type:"Identifier",name:"propName"},computed:!0},right:{type:"MemberExpression",object:{type:"Identifier",name:"defaultProps"},property:{type:"Identifier",name:"propName"},computed:!0}}}]},alternate:null}]}}]},alternate:null},{type:"ReturnStatement",argument:{type:"Identifier",name:"props"}}]},parenthesizedExpression:!0}}]},"helper-defaults":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"obj"},{type:"Identifier",name:"defaults"}],body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"keys"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"getOwnPropertyNames"},computed:!1},arguments:[{type:"Identifier",name:"defaults"
}]}}],kind:"var"},{type:"ForStatement",init:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"i"},init:{type:"Literal",value:0}}],kind:"var"},test:{type:"BinaryExpression",left:{type:"Identifier",name:"i"},operator:"<",right:{type:"MemberExpression",object:{type:"Identifier",name:"keys"},property:{type:"Identifier",name:"length"},computed:!1}},update:{type:"UpdateExpression",operator:"++",prefix:!1,argument:{type:"Identifier",name:"i"}},body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"key"},init:{type:"MemberExpression",object:{type:"Identifier",name:"keys"},property:{type:"Identifier",name:"i"},computed:!0}}],kind:"var"},{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"value"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"getOwnPropertyDescriptor"},computed:!1},arguments:[{type:"Identifier",name:"defaults"},{type:"Identifier",name:"key"}]}}],kind:"var"},{type:"IfStatement",test:{type:"LogicalExpression",left:{type:"LogicalExpression",left:{type:"Identifier",name:"value"},operator:"&&",right:{type:"MemberExpression",object:{type:"Identifier",name:"value"},property:{type:"Identifier",name:"configurable"},computed:!1}},operator:"&&",right:{type:"BinaryExpression",left:{type:"MemberExpression",object:{type:"Identifier",name:"obj"},property:{type:"Identifier",name:"key"},computed:!0},operator:"===",right:{type:"Identifier",name:"undefined"}}},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"defineProperty"},computed:!1},arguments:[{type:"Identifier",name:"obj"},{type:"Identifier",name:"key"},{type:"Identifier",name:"value"}]}}]},alternate:null}]}},{type:"ReturnStatement",argument:{type:"Identifier",name:"obj"}}]},parenthesizedExpression:!0}}]},"helper-define-decorated-property-descriptor":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"target"},{type:"Identifier",name:"key"},{type:"Identifier",name:"descriptors"}],body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"_descriptor"},init:{type:"MemberExpression",object:{type:"Identifier",name:"descriptors"},property:{type:"Identifier",name:"key"},computed:!0}}],kind:"var"},{type:"IfStatement",test:{type:"UnaryExpression",operator:"!",prefix:!0,argument:{type:"Identifier",name:"_descriptor"}},consequent:{type:"ReturnStatement",argument:null,leadingComments:null,trailingComments:null},alternate:null},{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"descriptor",leadingComments:null},init:{type:"ObjectExpression",properties:[]},leadingComments:null}],kind:"var"},{type:"ForInStatement",left:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"_key"},init:null}],kind:"var"},right:{type:"Identifier",name:"_descriptor"},body:{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"_key"},computed:!0},right:{type:"MemberExpression",object:{type:"Identifier",name:"_descriptor"},property:{type:"Identifier",name:"_key"},computed:!0}},trailingComments:null}},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor",leadingComments:null},property:{type:"Identifier",name:"value"},computed:!1,leadingComments:null},right:{type:"ConditionalExpression",test:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"initializer"},computed:!1},consequent:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"initializer"},computed:!1},property:{type:"Identifier",name:"call"},computed:!1},arguments:[{type:"Identifier",name:"target"}]},alternate:{type:"Identifier",name:"undefined"}},leadingComments:null}},{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"defineProperty"},computed:!1},arguments:[{type:"Identifier",name:"target"},{type:"Identifier",name:"key"},{type:"Identifier",name:"descriptor"}]}}]},parenthesizedExpression:!0}}]},"helper-define-property":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"obj"},{type:"Identifier",name:"key"},{type:"Identifier",name:"value"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Identifier",name:"key",leadingComments:null},operator:"in",right:{type:"Identifier",name:"obj"},leadingComments:null},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"defineProperty"},computed:!1},arguments:[{type:"Identifier",name:"obj"},{type:"Identifier",name:"key"},{type:"ObjectExpression",properties:[{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"value"},value:{type:"Identifier",name:"value"},kind:"init"},{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"enumerable"},value:{type:"Literal",value:!0},kind:"init"},{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"configurable"},value:{type:"Literal",value:!0},kind:"init"},{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"writable"},value:{type:"Literal",value:!0},kind:"init"}]}]}}]},alternate:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"obj"},property:{type:"Identifier",name:"key"},computed:!0},right:{type:"Identifier",name:"value"}}}]}},{type:"ReturnStatement",argument:{type:"Identifier",name:"obj"}}]},parenthesizedExpression:!0}}]},"helper-extends":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"LogicalExpression",left:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"assign"},computed:!1},operator:"||",right:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"target"}],body:{type:"BlockStatement",body:[{type:"ForStatement",init:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"i"},init:{type:"Literal",value:1}}],kind:"var"},test:{type:"BinaryExpression",left:{type:"Identifier",name:"i"},operator:"<",right:{type:"MemberExpression",object:{type:"Identifier",name:"arguments"},property:{type:"Identifier",name:"length"},computed:!1}},update:{type:"UpdateExpression",operator:"++",prefix:!1,argument:{type:"Identifier",name:"i"}},body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"source"},init:{type:"MemberExpression",object:{type:"Identifier",name:"arguments"},property:{type:"Identifier",name:"i"},computed:!0}}],kind:"var"},{type:"ForInStatement",left:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"key"},init:null}],kind:"var"},right:{type:"Identifier",name:"source"},body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"MemberExpression",object:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"prototype"},computed:!1},property:{type:"Identifier",name:"hasOwnProperty"},computed:!1},property:{type:"Identifier",name:"call"},computed:!1},arguments:[{type:"Identifier",name:"source"},{type:"Identifier",name:"key"}]},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"target"},property:{type:"Identifier",name:"key"},computed:!0},right:{type:"MemberExpression",object:{type:"Identifier",name:"source"},property:{type:"Identifier",name:"key"},computed:!0}}}]},alternate:null}]}}]}},{type:"ReturnStatement",argument:{type:"Identifier",name:"target"}}]}}}}]},"helper-get":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:{type:"Identifier",name:"get"},generator:!1,expression:!1,params:[{type:"Identifier",name:"object"},{type:"Identifier",name:"property"},{type:"Identifier",name:"receiver"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Identifier",name:"object"},operator:"===",right:{type:"Literal",value:null,rawValue:null}},consequent:{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"object"},right:{type:"MemberExpression",object:{type:"Identifier",name:"Function"},property:{type:"Identifier",name:"prototype"},computed:!1}}},alternate:null},{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"desc"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"getOwnPropertyDescriptor"},computed:!1},arguments:[{type:"Identifier",name:"object"},{type:"Identifier",name:"property"}]}}],kind:"var"},{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Identifier",name:"desc"},operator:"===",right:{type:"Identifier",name:"undefined"}},consequent:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"parent"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"getPrototypeOf"},computed:!1},arguments:[{type:"Identifier",name:"object"}]}}],kind:"var"},{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Identifier",name:"parent"},operator:"===",right:{type:"Literal",value:null,rawValue:null}},consequent:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"Identifier",name:"undefined"}}]},alternate:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"CallExpression",callee:{type:"Identifier",name:"get"},arguments:[{type:"Identifier",name:"parent"},{type:"Identifier",name:"property"},{type:"Identifier",name:"receiver"}]}}]}}]},alternate:{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Literal",value:"value"},operator:"in",right:{type:"Identifier",name:"desc"}},consequent:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"MemberExpression",object:{type:"Identifier",name:"desc"},property:{type:"Identifier",name:"value"},computed:!1}}]},alternate:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"getter"},init:{type:"MemberExpression",object:{type:"Identifier",name:"desc"},property:{type:"Identifier",name:"get"},computed:!1}}],kind:"var"},{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Identifier",name:"getter"},operator:"===",right:{type:"Identifier",name:"undefined"}},consequent:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"Identifier",name:"undefined"}}]},alternate:null},{type:"ReturnStatement",argument:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"getter"},property:{type:"Identifier",name:"call"},computed:!1},arguments:[{type:"Identifier",name:"receiver"}]}}]}}}]},parenthesizedExpression:!0}}]},"helper-has-own":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"MemberExpression",object:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"prototype"},computed:!1},property:{type:"Identifier",name:"hasOwnProperty"},computed:!1}}]},"helper-inherits":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"subClass"},{type:"Identifier",name:"superClass"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"LogicalExpression",left:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"Identifier",name:"superClass"}},operator:"!==",right:{type:"Literal",value:"function"}},operator:"&&",right:{type:"BinaryExpression",left:{type:"Identifier",name:"superClass"},operator:"!==",right:{type:"Literal",value:null,rawValue:null}}},consequent:{type:"BlockStatement",body:[{type:"ThrowStatement",argument:{type:"NewExpression",callee:{type:"Identifier",name:"TypeError"},arguments:[{type:"BinaryExpression",left:{type:"Literal",value:"Super expression must either be null or a function, not "},operator:"+",right:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"Identifier",name:"superClass"}}}]}}]},alternate:null},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"subClass"},property:{type:"Identifier",name:"prototype"},computed:!1},right:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"create"},computed:!1},arguments:[{type:"LogicalExpression",left:{type:"Identifier",name:"superClass"},operator:"&&",right:{type:"MemberExpression",object:{type:"Identifier",name:"superClass"},property:{type:"Identifier",name:"prototype"},computed:!1}},{type:"ObjectExpression",properties:[{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"constructor"},value:{type:"ObjectExpression",properties:[{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"value"},value:{type:"Identifier",name:"subClass"},kind:"init"},{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"enumerable"},value:{type:"Literal",value:!1},kind:"init"},{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"writable"},value:{type:"Literal",value:!0},kind:"init"},{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"configurable"},value:{type:"Literal",value:!0},kind:"init"}]},kind:"init"}]}]}}},{type:"IfStatement",test:{type:"Identifier",name:"superClass"},consequent:{type:"ExpressionStatement",expression:{type:"ConditionalExpression",test:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"setPrototypeOf"},computed:!1},consequent:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"setPrototypeOf"},computed:!1},arguments:[{type:"Identifier",name:"subClass"},{type:"Identifier",name:"superClass"}]},alternate:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"subClass"},property:{type:"Identifier",name:"__proto__"},computed:!1},right:{type:"Identifier",name:"superClass"}}}},alternate:null}]},parenthesizedExpression:!0}}]},"helper-instanceof":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"left"},{type:"Identifier",name:"right"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"LogicalExpression",left:{type:"BinaryExpression",left:{type:"Identifier",name:"right"},operator:"!=",right:{type:"Literal",value:null,rawValue:null}},operator:"&&",right:{type:"MemberExpression",object:{type:"Identifier",name:"right"},property:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Identifier",name:"hasInstance"},computed:!1},computed:!0}},consequent:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"right"},property:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Identifier",name:"hasInstance"},computed:!1},computed:!0},arguments:[{type:"Identifier",name:"left"}]}}]},alternate:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"BinaryExpression",left:{type:"Identifier",name:"left"},operator:"instanceof",right:{type:"Identifier",name:"right"}}}]}}]},parenthesizedExpression:!0}}]},"helper-interop-export-wildcard":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"obj"},{type:"Identifier",name:"defaults"}],body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"newObj"},init:{type:"CallExpression",callee:{type:"Identifier",name:"defaults"},arguments:[{type:"ObjectExpression",properties:[]},{type:"Identifier",name:"obj"}]}}],kind:"var"},{type:"ExpressionStatement",expression:{type:"UnaryExpression",operator:"delete",prefix:!0,argument:{type:"MemberExpression",object:{type:"Identifier",name:"newObj"},property:{type:"Literal",value:"default"},computed:!0}}},{type:"ReturnStatement",argument:{type:"Identifier",name:"newObj"}}]},parenthesizedExpression:!0}}]},"helper-interop-require-default":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"obj"}],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"ConditionalExpression",test:{type:"LogicalExpression",left:{type:"Identifier",name:"obj"},operator:"&&",right:{type:"MemberExpression",object:{type:"Identifier",name:"obj"},property:{type:"Identifier",name:"__esModule"},computed:!1}},consequent:{type:"Identifier",name:"obj"},alternate:{type:"ObjectExpression",properties:[{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Literal",value:"default"},value:{type:"Identifier",name:"obj"},kind:"init"}]}}}]},parenthesizedExpression:!0}}]},"helper-interop-require-wildcard":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"obj"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"LogicalExpression",left:{type:"Identifier",name:"obj"},operator:"&&",right:{type:"MemberExpression",object:{type:"Identifier",name:"obj"},property:{type:"Identifier",name:"__esModule"},computed:!1}},consequent:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"Identifier",name:"obj"}}]},alternate:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"newObj"},init:{type:"ObjectExpression",properties:[]}}],kind:"var"},{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Identifier",name:"obj"},operator:"!=",right:{type:"Literal",value:null,rawValue:null}},consequent:{type:"BlockStatement",body:[{type:"ForInStatement",left:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"key"},init:null}],kind:"var"},right:{type:"Identifier",name:"obj"},body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"MemberExpression",object:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"prototype"},computed:!1},property:{type:"Identifier",name:"hasOwnProperty"},computed:!1},property:{type:"Identifier",name:"call"},computed:!1},arguments:[{type:"Identifier",name:"obj"},{type:"Identifier",name:"key"}]},consequent:{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"newObj"},property:{type:"Identifier",name:"key"},computed:!0},right:{type:"MemberExpression",object:{type:"Identifier",name:"obj"},property:{type:"Identifier",name:"key"},computed:!0}}},alternate:null}]}}]},alternate:null},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"newObj"},property:{type:"Literal",value:"default"},computed:!0},right:{type:"Identifier",name:"obj"}}},{type:"ReturnStatement",argument:{type:"Identifier",name:"newObj"}}]}}]},parenthesizedExpression:!0}}]},"helper-interop-require":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"obj"}],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"ConditionalExpression",test:{type:"LogicalExpression",left:{type:"Identifier",name:"obj"},operator:"&&",right:{type:"MemberExpression",object:{type:"Identifier",name:"obj"},property:{type:"Identifier",name:"__esModule"},computed:!1}},consequent:{type:"MemberExpression",object:{type:"Identifier",name:"obj"},property:{type:"Literal",value:"default"},computed:!0},alternate:{type:"Identifier",name:"obj"}}}]},parenthesizedExpression:!0}}]},"helper-new-arrow-check":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"innerThis"},{type:"Identifier",name:"boundThis"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Identifier",name:"innerThis"},operator:"!==",right:{type:"Identifier",name:"boundThis"}},consequent:{type:"BlockStatement",body:[{type:"ThrowStatement",argument:{type:"NewExpression",callee:{type:"Identifier",name:"TypeError"},arguments:[{type:"Literal",value:"Cannot instantiate an arrow function"}]}}]},alternate:null}]},parenthesizedExpression:!0}}]},"helper-object-destructuring-empty":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"obj"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Identifier",name:"obj"},operator:"==",right:{type:"Literal",value:null,rawValue:null}},consequent:{type:"ThrowStatement",argument:{type:"NewExpression",callee:{type:"Identifier",name:"TypeError"},arguments:[{type:"Literal",value:"Cannot destructure undefined"}]}},alternate:null}]},parenthesizedExpression:!0}}]},"helper-object-without-properties":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"obj"},{type:"Identifier",name:"keys"}],body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"target"},init:{type:"ObjectExpression",properties:[]}}],kind:"var"},{type:"ForInStatement",left:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"i"},init:null}],kind:"var"},right:{type:"Identifier",name:"obj"},body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"keys"},property:{type:"Identifier",name:"indexOf"},computed:!1},arguments:[{type:"Identifier",name:"i"}]},operator:">=",right:{type:"Literal",value:0}},consequent:{type:"ContinueStatement",label:null},alternate:null},{type:"IfStatement",test:{type:"UnaryExpression",operator:"!",prefix:!0,argument:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"MemberExpression",object:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"prototype"},computed:!1},property:{type:"Identifier",name:"hasOwnProperty"},computed:!1},property:{type:"Identifier",name:"call"},computed:!1},arguments:[{type:"Identifier",name:"obj"},{type:"Identifier",name:"i"}]}},consequent:{type:"ContinueStatement",label:null},alternate:null},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"target"},property:{type:"Identifier",name:"i"},computed:!0},right:{type:"MemberExpression",object:{type:"Identifier",name:"obj"},property:{type:"Identifier",name:"i"},computed:!0}}}]}},{type:"ReturnStatement",argument:{type:"Identifier",name:"target"}}]},parenthesizedExpression:!0}}]},"helper-self-global":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"ConditionalExpression",test:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"Identifier",name:"global"}},operator:"===",right:{type:"Literal",value:"undefined"}},consequent:{type:"Identifier",name:"self"},alternate:{type:"Identifier",name:"global"}}}]},"helper-set":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:{type:"Identifier",name:"set"},generator:!1,expression:!1,params:[{type:"Identifier",name:"object"},{type:"Identifier",name:"property"},{type:"Identifier",name:"value"},{type:"Identifier",name:"receiver"}],body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"desc"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"getOwnPropertyDescriptor"},computed:!1},arguments:[{type:"Identifier",name:"object"},{type:"Identifier",name:"property"}]}}],kind:"var"},{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Identifier",name:"desc"},operator:"===",right:{type:"Identifier",name:"undefined"}},consequent:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"parent"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"getPrototypeOf"},computed:!1},arguments:[{type:"Identifier",name:"object"}]}}],kind:"var"},{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Identifier",name:"parent"},operator:"!==",right:{type:"Literal",value:null,rawValue:null}},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"set"},arguments:[{type:"Identifier",name:"parent"},{type:"Identifier",name:"property"},{type:"Identifier",name:"value"},{type:"Identifier",name:"receiver"}]}}]},alternate:null}]},alternate:{type:"IfStatement",test:{type:"LogicalExpression",left:{type:"BinaryExpression",left:{type:"Literal",value:"value"},operator:"in",right:{type:"Identifier",name:"desc"}},operator:"&&",right:{type:"MemberExpression",object:{type:"Identifier",name:"desc"},property:{type:"Identifier",name:"writable"},computed:!1}},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"desc"},property:{type:"Identifier",name:"value"},computed:!1},right:{type:"Identifier",name:"value"}}}]},alternate:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"setter"},init:{type:"MemberExpression",object:{type:"Identifier",name:"desc"},property:{type:"Identifier",name:"set"},computed:!1}}],kind:"var"},{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Identifier",name:"setter"},operator:"!==",right:{type:"Identifier",name:"undefined"}},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"setter"},property:{type:"Identifier",name:"call"},computed:!1},arguments:[{type:"Identifier",name:"receiver"},{type:"Identifier",name:"value"}]}}]},alternate:null}]}}},{type:"ReturnStatement",argument:{type:"Identifier",name:"value"}}]},parenthesizedExpression:!0}}]},"helper-slice":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"MemberExpression",object:{type:"MemberExpression",object:{type:"Identifier",name:"Array"},property:{type:"Identifier",name:"prototype"},computed:!1},property:{type:"Identifier",name:"slice"},computed:!1}}]},"helper-sliced-to-array-loose":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"arr"},{type:"Identifier",name:"i"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Array"},property:{type:"Identifier",name:"isArray"},computed:!1},arguments:[{type:"Identifier",name:"arr"}]},consequent:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"Identifier",name:"arr"}}]},alternate:{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Identifier",name:"iterator"},computed:!1},operator:"in",right:{type:"CallExpression",callee:{type:"Identifier",name:"Object"},arguments:[{type:"Identifier",name:"arr"}]}},consequent:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"_arr"},init:{type:"ArrayExpression",elements:[]}}],kind:"var"},{type:"ForStatement",init:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"_iterator"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"arr"},property:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Identifier",name:"iterator"},computed:!1},computed:!0},arguments:[]}},{type:"VariableDeclarator",id:{type:"Identifier",name:"_step"},init:null}],kind:"var"},test:{type:"UnaryExpression",operator:"!",prefix:!0,argument:{type:"MemberExpression",object:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"_step"},right:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"_iterator"},property:{type:"Identifier",name:"next"},computed:!1},arguments:[]},parenthesizedExpression:!0},property:{type:"Identifier",name:"done"},computed:!1}},update:null,body:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"_arr"},property:{type:"Identifier",name:"push"},computed:!1},arguments:[{type:"MemberExpression",object:{type:"Identifier",name:"_step"},property:{type:"Identifier",name:"value"},computed:!1}]}},{type:"IfStatement",test:{type:"LogicalExpression",left:{type:"Identifier",name:"i"},operator:"&&",right:{type:"BinaryExpression",left:{type:"MemberExpression",object:{type:"Identifier",name:"_arr"},property:{type:"Identifier",name:"length"},computed:!1},operator:"===",right:{type:"Identifier",name:"i"}}},consequent:{type:"BreakStatement",label:null},alternate:null}]}},{type:"ReturnStatement",argument:{type:"Identifier",name:"_arr"}}]},alternate:{type:"BlockStatement",body:[{type:"ThrowStatement",argument:{type:"NewExpression",callee:{type:"Identifier",name:"TypeError"},arguments:[{type:"Literal",value:"Invalid attempt to destructure non-iterable instance"}]}}]}}}]},parenthesizedExpression:!0}}]},"helper-sliced-to-array":{type:"Program",body:[{type:"ExpressionStatement",
expression:{type:"CallExpression",callee:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[],body:{type:"BlockStatement",body:[{type:"FunctionDeclaration",id:{type:"Identifier",name:"sliceIterator",leadingComments:null},generator:!1,expression:!1,params:[{type:"Identifier",name:"arr"},{type:"Identifier",name:"i"}],body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"_arr",leadingComments:null},init:{type:"ArrayExpression",elements:[]},leadingComments:null}],kind:"var"},{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"_n"},init:{type:"Literal",value:!0}}],kind:"var"},{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"_d"},init:{type:"Literal",value:!1}}],kind:"var"},{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"_e"},init:{type:"Identifier",name:"undefined"}}],kind:"var"},{type:"TryStatement",block:{type:"BlockStatement",body:[{type:"ForStatement",init:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"_i"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"arr"},property:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Identifier",name:"iterator"},computed:!1},computed:!0},arguments:[]}},{type:"VariableDeclarator",id:{type:"Identifier",name:"_s"},init:null}],kind:"var"},test:{type:"UnaryExpression",operator:"!",prefix:!0,argument:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"_n"},right:{type:"MemberExpression",object:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"_s"},right:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"_i"},property:{type:"Identifier",name:"next"},computed:!1},arguments:[]},parenthesizedExpression:!0},property:{type:"Identifier",name:"done"},computed:!1},parenthesizedExpression:!0}},update:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"_n"},right:{type:"Literal",value:!0}},body:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"_arr"},property:{type:"Identifier",name:"push"},computed:!1},arguments:[{type:"MemberExpression",object:{type:"Identifier",name:"_s"},property:{type:"Identifier",name:"value"},computed:!1}]}},{type:"IfStatement",test:{type:"LogicalExpression",left:{type:"Identifier",name:"i"},operator:"&&",right:{type:"BinaryExpression",left:{type:"MemberExpression",object:{type:"Identifier",name:"_arr"},property:{type:"Identifier",name:"length"},computed:!1},operator:"===",right:{type:"Identifier",name:"i"}}},consequent:{type:"BreakStatement",label:null},alternate:null}]}}]},handler:{type:"CatchClause",param:{type:"Identifier",name:"err"},body:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"_d"},right:{type:"Literal",value:!0}}},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"_e"},right:{type:"Identifier",name:"err"}}}]}},guardedHandlers:[],finalizer:{type:"BlockStatement",body:[{type:"TryStatement",block:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"LogicalExpression",left:{type:"UnaryExpression",operator:"!",prefix:!0,argument:{type:"Identifier",name:"_n"}},operator:"&&",right:{type:"MemberExpression",object:{type:"Identifier",name:"_i"},property:{type:"Literal",value:"return"},computed:!0}},consequent:{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"_i"},property:{type:"Literal",value:"return"},computed:!0},arguments:[]}},alternate:null}]},handler:null,guardedHandlers:[],finalizer:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"Identifier",name:"_d"},consequent:{type:"ThrowStatement",argument:{type:"Identifier",name:"_e"}},alternate:null}]}}]}},{type:"ReturnStatement",argument:{type:"Identifier",name:"_arr"}}]}},{type:"ReturnStatement",argument:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"arr"},{type:"Identifier",name:"i"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Array"},property:{type:"Identifier",name:"isArray"},computed:!1},arguments:[{type:"Identifier",name:"arr"}]},consequent:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"Identifier",name:"arr"}}]},alternate:{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Identifier",name:"iterator"},computed:!1},operator:"in",right:{type:"CallExpression",callee:{type:"Identifier",name:"Object"},arguments:[{type:"Identifier",name:"arr"}]}},consequent:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"CallExpression",callee:{type:"Identifier",name:"sliceIterator"},arguments:[{type:"Identifier",name:"arr"},{type:"Identifier",name:"i"}]}}]},alternate:{type:"BlockStatement",body:[{type:"ThrowStatement",argument:{type:"NewExpression",callee:{type:"Identifier",name:"TypeError"},arguments:[{type:"Literal",value:"Invalid attempt to destructure non-iterable instance"}]}}]}}}]}}}]},parenthesizedExpression:!0},arguments:[]}}]},"helper-tagged-template-literal-loose":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"strings"},{type:"Identifier",name:"raw"}],body:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"strings"},property:{type:"Identifier",name:"raw"},computed:!1},right:{type:"Identifier",name:"raw"}}},{type:"ReturnStatement",argument:{type:"Identifier",name:"strings"}}]},parenthesizedExpression:!0}}]},"helper-tagged-template-literal":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"strings"},{type:"Identifier",name:"raw"}],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"freeze"},computed:!1},arguments:[{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"defineProperties"},computed:!1},arguments:[{type:"Identifier",name:"strings"},{type:"ObjectExpression",properties:[{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"raw"},value:{type:"ObjectExpression",properties:[{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"value"},value:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"freeze"},computed:!1},arguments:[{type:"Identifier",name:"raw"}]},kind:"init"}]},kind:"init"}]}]}]}}]},parenthesizedExpression:!0}}]},"helper-temporal-assert-defined":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"val"},{type:"Identifier",name:"name"},{type:"Identifier",name:"undef"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Identifier",name:"val"},operator:"===",right:{type:"Identifier",name:"undef"}},consequent:{type:"BlockStatement",body:[{type:"ThrowStatement",argument:{type:"NewExpression",callee:{type:"Identifier",name:"ReferenceError"},arguments:[{type:"BinaryExpression",left:{type:"Identifier",name:"name"},operator:"+",right:{type:"Literal",value:" is not defined - temporal dead zone"}}]}}]},alternate:null},{type:"ReturnStatement",argument:{type:"Literal",value:!0}}]},parenthesizedExpression:!0}}]},"helper-temporal-undefined":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"ObjectExpression",properties:[],parenthesizedExpression:!0}}]},"helper-to-array":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"arr"}],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"ConditionalExpression",test:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Array"},property:{type:"Identifier",name:"isArray"},computed:!1},arguments:[{type:"Identifier",name:"arr"}]},consequent:{type:"Identifier",name:"arr"},alternate:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Array"},property:{type:"Identifier",name:"from"},computed:!1},arguments:[{type:"Identifier",name:"arr"}]}}}]},parenthesizedExpression:!0}}]},"helper-to-consumable-array":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"arr"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Array"},property:{type:"Identifier",name:"isArray"},computed:!1},arguments:[{type:"Identifier",name:"arr"}]},consequent:{type:"BlockStatement",body:[{type:"ForStatement",init:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"i"},init:{type:"Literal",value:0}},{type:"VariableDeclarator",id:{type:"Identifier",name:"arr2"},init:{type:"CallExpression",callee:{type:"Identifier",name:"Array"},arguments:[{type:"MemberExpression",object:{type:"Identifier",name:"arr"},property:{type:"Identifier",name:"length"},computed:!1}]}}],kind:"var"},test:{type:"BinaryExpression",left:{type:"Identifier",name:"i"},operator:"<",right:{type:"MemberExpression",object:{type:"Identifier",name:"arr"},property:{type:"Identifier",name:"length"},computed:!1}},update:{type:"UpdateExpression",operator:"++",prefix:!1,argument:{type:"Identifier",name:"i"}},body:{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"arr2"},property:{type:"Identifier",name:"i"},computed:!0},right:{type:"MemberExpression",object:{type:"Identifier",name:"arr"},property:{type:"Identifier",name:"i"},computed:!0}}}},{type:"ReturnStatement",argument:{type:"Identifier",name:"arr2"}}]},alternate:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Array"},property:{type:"Identifier",name:"from"},computed:!1},arguments:[{type:"Identifier",name:"arr"}]}}]}}]},parenthesizedExpression:!0}}]},"helper-typeof-react-element":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"LogicalExpression",left:{type:"LogicalExpression",left:{type:"LogicalExpression",left:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"Identifier",name:"Symbol"}},operator:"===",right:{type:"Literal",value:"function"}},operator:"&&",right:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Literal",value:"for"},computed:!0}},operator:"&&",right:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Literal",value:"for"},computed:!0},arguments:[{type:"Literal",value:"react.element"}]}},operator:"||",right:{type:"Literal",value:60103}}}]},"helper-typeof":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"obj"}],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"ConditionalExpression",test:{type:"LogicalExpression",left:{type:"Identifier",name:"obj"},operator:"&&",right:{type:"BinaryExpression",left:{type:"MemberExpression",object:{type:"Identifier",name:"obj"},property:{type:"Identifier",name:"constructor"},computed:!1},operator:"===",right:{type:"Identifier",name:"Symbol"}}},consequent:{type:"Literal",value:"symbol"},alternate:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"Identifier",name:"obj"}}}}]},parenthesizedExpression:!0}}]},"let-scoping-return":{type:"Program",body:[{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"Identifier",name:"RETURN"}},operator:"===",right:{type:"Literal",value:"object"}},consequent:{type:"ReturnStatement",argument:{type:"MemberExpression",object:{type:"Identifier",name:"RETURN"},property:{type:"Identifier",name:"v"},computed:!1}},alternate:null}]},"named-function":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[],body:{type:"BlockStatement",body:[{type:"FunctionDeclaration",id:{type:"Identifier",name:"GET_OUTER_ID"},generator:!1,expression:!1,params:[],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"Identifier",name:"FUNCTION_ID"}}]}},{type:"ReturnStatement",argument:{type:"Identifier",name:"FUNCTION"}}]},parenthesizedExpression:!0},arguments:[]}}]},"property-method-assignment-wrapper-generator":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"FUNCTION_KEY"}],body:{type:"BlockStatement",body:[{type:"FunctionDeclaration",id:{type:"Identifier",name:"FUNCTION_ID"},generator:!0,expression:!1,params:[],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"YieldExpression",delegate:!0,argument:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"FUNCTION_KEY"},property:{type:"Identifier",name:"apply"},computed:!1},arguments:[{type:"ThisExpression"},{type:"Identifier",name:"arguments"}]}}}]}},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"FUNCTION_ID"},property:{type:"Identifier",name:"toString"},computed:!1},right:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"FUNCTION_KEY"},property:{type:"Identifier",name:"toString"},computed:!1},arguments:[]}}]}}}},{type:"ReturnStatement",argument:{type:"Identifier",name:"FUNCTION_ID"}}]},parenthesizedExpression:!0},arguments:[{type:"Identifier",name:"FUNCTION"}]}}]},"property-method-assignment-wrapper":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"FUNCTION_KEY"}],body:{type:"BlockStatement",body:[{type:"FunctionDeclaration",id:{type:"Identifier",name:"FUNCTION_ID"},generator:!1,expression:!1,params:[],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"FUNCTION_KEY"},property:{type:"Identifier",name:"apply"},computed:!1},arguments:[{type:"ThisExpression"},{type:"Identifier",name:"arguments"}]}}]}},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"FUNCTION_ID"},property:{type:"Identifier",name:"toString"},computed:!1},right:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"FUNCTION_KEY"},property:{type:"Identifier",name:"toString"},computed:!1},arguments:[]}}]}}}},{type:"ReturnStatement",argument:{type:"Identifier",name:"FUNCTION_ID"}}]},parenthesizedExpression:!0},arguments:[{type:"Identifier",name:"FUNCTION"}]}}]},"prototype-identifier":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"MemberExpression",object:{type:"Identifier",name:"CLASS_NAME"},property:{type:"Identifier",name:"prototype"},computed:!1}}]},"require-assign-key":{type:"Program",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"VARIABLE_NAME"},init:{type:"MemberExpression",object:{type:"CallExpression",callee:{type:"Identifier",name:"require"},arguments:[{type:"Identifier",name:"MODULE_NAME"}]},property:{type:"Identifier",name:"KEY"},computed:!1}}],kind:"var"}]},require:{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"require"},arguments:[{type:"Identifier",name:"MODULE_NAME"}]}}]},rest:{type:"Program",body:[{type:"ForStatement",init:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"LEN"},init:{type:"MemberExpression",object:{type:"Identifier",name:"ARGUMENTS"},property:{type:"Identifier",name:"length"},computed:!1}},{type:"VariableDeclarator",id:{type:"Identifier",name:"ARRAY"},init:{type:"CallExpression",callee:{type:"Identifier",name:"Array"},arguments:[{type:"Identifier",name:"ARRAY_LEN"}]}},{type:"VariableDeclarator",id:{type:"Identifier",name:"KEY"},init:{type:"Identifier",name:"START"}}],kind:"var"},test:{type:"BinaryExpression",left:{type:"Identifier",name:"KEY"},operator:"<",right:{type:"Identifier",name:"LEN"}},update:{type:"UpdateExpression",operator:"++",prefix:!1,argument:{type:"Identifier",name:"KEY"}},body:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"ARRAY"},property:{type:"Identifier",name:"ARRAY_KEY"},computed:!0},right:{type:"MemberExpression",object:{type:"Identifier",name:"ARGUMENTS"},property:{type:"Identifier",name:"KEY"},computed:!0}}}]}}]},"self-contained-helpers-head":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"exports"},property:{type:"Literal",value:"default"},computed:!0},right:{type:"Identifier",name:"HELPER"}}},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"exports"},property:{type:"Identifier",name:"__esModule"},computed:!1},right:{type:"Literal",value:!0}}}]},system:{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"System"},property:{type:"Identifier",name:"register"},computed:!1},arguments:[{type:"Identifier",name:"MODULE_NAME"},{type:"Identifier",name:"MODULE_DEPENDENCIES"},{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"EXPORT_IDENTIFIER"}],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"ObjectExpression",properties:[{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"setters"},value:{type:"Identifier",name:"SETTERS"},kind:"init"},{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"execute"},value:{type:"Identifier",name:"EXECUTE"},kind:"init"}]}}]}}]}}]},"tail-call-body":{type:"Program",body:[{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"AGAIN_ID"},init:{type:"Literal",value:!0}}],kind:"var"},{type:"LabeledStatement",body:{type:"WhileStatement",test:{type:"Identifier",name:"AGAIN_ID"},body:{type:"ExpressionStatement",expression:{type:"Identifier",name:"BLOCK"}}},label:{type:"Identifier",name:"FUNCTION_ID"}}]}]},"test-exports":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"Identifier",name:"exports"}},operator:"!==",right:{type:"Literal",value:"undefined"}}}]},"test-module":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"Identifier",name:"module"}},operator:"!==",right:{type:"Literal",value:"undefined"}}}]},"umd-commonjs-strict":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"root"},{type:"Identifier",name:"factory"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"LogicalExpression",left:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"Identifier",name:"define"}},operator:"===",right:{type:"Literal",value:"function"}},operator:"&&",right:{type:"MemberExpression",object:{type:"Identifier",name:"define"},property:{type:"Identifier",name:"amd"},computed:!1}},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"define"},arguments:[{type:"Identifier",name:"AMD_ARGUMENTS"},{type:"Identifier",name:"factory"}]}}]},alternate:{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"Identifier",name:"exports"}},operator:"===",right:{type:"Literal",value:"object"}},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"factory"},arguments:[{type:"Identifier",name:"COMMON_ARGUMENTS"}]}}]},alternate:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"factory"},arguments:[{type:"Identifier",name:"BROWSER_ARGUMENTS"}]}}]}}}]},parenthesizedExpression:!0},arguments:[{type:"Identifier",name:"UMD_ROOT"},{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"FACTORY_PARAMETERS"}],body:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"Identifier",name:"FACTORY_BODY"}}]}}]}}]},"umd-runner-body":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"global"},{type:"Identifier",name:"factory"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"LogicalExpression",left:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"Identifier",name:"define"}},operator:"===",right:{type:"Literal",value:"function"}},operator:"&&",right:{type:"MemberExpression",object:{type:"Identifier",name:"define"},property:{type:"Identifier",name:"amd"},computed:!1}},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"define"},arguments:[{type:"Identifier",name:"AMD_ARGUMENTS"},{type:"Identifier",name:"factory"}]}}]},alternate:{type:"IfStatement",test:{type:"Identifier",name:"COMMON_TEST"},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"factory"},arguments:[{type:"Identifier",name:"COMMON_ARGUMENTS"}]}}]},alternate:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"mod"},init:{type:"ObjectExpression",properties:[{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"exports"},value:{type:"ObjectExpression",properties:[]},kind:"init"}]}}],kind:"var"},{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"factory"},arguments:[{type:"MemberExpression",object:{type:"Identifier",name:"mod"},property:{type:"Identifier",name:"exports"},computed:!1},{type:"Identifier",name:"BROWSER_ARGUMENTS"}]}},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"global"},property:{type:"Identifier",name:"GLOBAL_ARG"},computed:!1},right:{type:"MemberExpression",object:{type:"Identifier",name:"mod"},property:{type:"Identifier",name:"exports"},computed:!1}}}]}}}]},parenthesizedExpression:!0}}]}}},{}],613:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){return new s["default"](t,e).parse()}r.__esModule=!0,r.parse=i;var a=e(617),s=n(a);e(622),e(621),e(619),e(616),e(620),e(618),e(615);var o=e(629);e(627),e(626);var u=e(623),p=n(u),l=e(624),c=n(l);a.plugins.flow=p["default"],a.plugins.jsx=c["default"],r.tokTypes=o.types},{615:615,616:616,617:617,618:618,619:619,620:620,621:621,622:622,623:623,624:624,626:626,627:627,629:629}],614:[function(e,t,r){"use strict";function n(e){var t={};for(var r in i)t[r]=e&&r in e?e[r]:i[r];return t}r.__esModule=!0,r.getOptions=n;var i={sourceType:"script",allowReserved:!0,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,plugins:{},features:{},strictMode:null};r.defaultOptions=i},{}],615:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e){return e[e.length-1]}var a=e(617),s=n(a),o=s["default"].prototype;o.addComment=function(e){this.state.trailingComments.push(e),this.state.leadingComments.push(e)},o.processComment=function(e){if(!("Program"===e.type&&e.body.length>0)){var t,r,n,a=this.state.commentStack;if(this.state.trailingComments.length>0)this.state.trailingComments[0].start>=e.end?(r=this.state.trailingComments,this.state.trailingComments=[]):this.state.trailingComments.length=0;else{var s=i(a);a.length>0&&s.trailingComments&&s.trailingComments[0].start>=e.end&&(r=s.trailingComments,s.trailingComments=null)}for(;a.length>0&&i(a).start>=e.start;)t=a.pop();if(t){if(t.leadingComments)if(t!==e&&i(t.leadingComments).end<=e.start)e.leadingComments=t.leadingComments,t.leadingComments=null;else for(n=t.leadingComments.length-2;n>=0;--n)if(t.leadingComments[n].end<=e.start){e.leadingComments=t.leadingComments.splice(0,n+1);break}}else if(this.state.leadingComments.length>0)if(i(this.state.leadingComments).end<=e.start)e.leadingComments=this.state.leadingComments,this.state.leadingComments=[];else{for(n=0;n<this.state.leadingComments.length&&!(this.state.leadingComments[n].end>e.start);n++);e.leadingComments=this.state.leadingComments.slice(0,n),0===e.leadingComments.length&&(e.leadingComments=null),r=this.state.leadingComments.slice(n),0===r.length&&(r=null)}r&&(r.length&&r[0].start>=e.start&&i(r).end<=e.end?e.innerComments=r:e.trailingComments=r),a.push(e)}}},{617:617}],616:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var i=e(629),a=e(617),s=n(a),o=e(630),u=s["default"].prototype;u.checkPropClash=function(e,t){if(!(e.computed||e.method||e.shorthand)){var r=e.key,n=void 0;switch(r.type){case"Identifier":n=r.name;break;case"Literal":n=String(r.value);break;default:return}var i=e.kind;"__proto__"===n&&"init"===i&&(t.proto&&this.raise(r.start,"Redefinition of __proto__ property"),t.proto=!0)}},u.parseExpression=function(e,t){var r=this.state.start,n=this.state.startLoc,a=this.parseMaybeAssign(e,t);if(this.match(i.types.comma)){var s=this.startNodeAt(r,n);for(s.expressions=[a];this.eat(i.types.comma);)s.expressions.push(this.parseMaybeAssign(e,t));return this.toReferencedList(s.expressions),this.finishNode(s,"SequenceExpression")}return a},u.parseMaybeAssign=function(e,t,r){if(this.match(i.types._yield)&&this.state.inGenerator)return this.parseYield();var n=void 0;t?n=!1:(t={start:0},n=!0);var a=this.state.start,s=this.state.startLoc;(this.match(i.types.parenL)||this.match(i.types.name))&&(this.state.potentialArrowAt=this.state.start);var o=this.parseMaybeConditional(e,t);if(r&&(o=r.call(this,o,a,s)),this.state.type.isAssign){var u=this.startNodeAt(a,s);if(u.operator=this.state.value,u.left=this.match(i.types.eq)?this.toAssignable(o):o,t.start=0,this.checkLVal(o),o.parenthesizedExpression){var p=void 0;"ObjectPattern"===o.type?p="`({a}) = 0` use `({a} = 0)`":"ArrayPattern"===o.type&&(p="`([a]) = 0` use `([a] = 0)`"),p&&this.raise(o.start,"You're trying to assign to a parenthesized expression, eg. instead of "+p)}return this.next(),u.right=this.parseMaybeAssign(e),this.finishNode(u,"AssignmentExpression")}return n&&t.start&&this.unexpected(t.start),o},u.parseMaybeConditional=function(e,t){var r=this.state.start,n=this.state.startLoc,a=this.parseExprOps(e,t);if(t&&t.start)return a;if(this.eat(i.types.question)){var s=this.startNodeAt(r,n);return s.test=a,s.consequent=this.parseMaybeAssign(),this.expect(i.types.colon),s.alternate=this.parseMaybeAssign(e),this.finishNode(s,"ConditionalExpression")}return a},u.parseExprOps=function(e,t){var r=this.state.start,n=this.state.startLoc,i=this.parseMaybeUnary(t);return t&&t.start?i:this.parseExprOp(i,r,n,-1,e)},u.parseExprOp=function(e,t,r,n,a){var s=this.state.type.binop;if(!(null==s||a&&this.match(i.types._in))&&s>n){var o=this.startNodeAt(t,r);o.left=e,o.operator=this.state.value;var u=this.state.type;this.next();var p=this.state.start,l=this.state.startLoc;return o.right=this.parseExprOp(this.parseMaybeUnary(),p,l,u.rightAssociative?s-1:s,a),this.finishNode(o,u===i.types.logicalOR||u===i.types.logicalAND?"LogicalExpression":"BinaryExpression"),this.parseExprOp(o,t,r,n,a)}return e},u.parseMaybeUnary=function(e){if(this.state.type.prefix){var t=this.startNode(),r=this.match(i.types.incDec);return t.operator=this.state.value,t.prefix=!0,this.next(),t.argument=this.parseMaybeUnary(),e&&e.start&&this.unexpected(e.start),r?this.checkLVal(t.argument):this.strict&&"delete"===t.operator&&"Identifier"===t.argument.type&&this.raise(t.start,"Deleting local variable in strict mode"),this.finishNode(t,r?"UpdateExpression":"UnaryExpression")}var n=this.state.start,a=this.state.startLoc,s=this.parseExprSubscripts(e);if(e&&e.start)return s;for(;this.state.type.postfix&&!this.canInsertSemicolon();){var t=this.startNodeAt(n,a);t.operator=this.state.value,t.prefix=!1,t.argument=s,this.checkLVal(s),this.next(),s=this.finishNode(t,"UpdateExpression")}return s},u.parseExprSubscripts=function(e){var t=this.state.start,r=this.state.startLoc,n=this.parseExprAtom(e);return e&&e.start?n:this.parseSubscripts(n,t,r)},u.parseSubscripts=function(e,t,r,n){for(;;){if(!n&&this.eat(i.types.doubleColon)){var a=this.startNodeAt(t,r);return a.object=e,a.callee=this.parseNoCallExpr(),this.parseSubscripts(this.finishNode(a,"BindExpression"),t,r,n)}if(this.eat(i.types.dot)){var a=this.startNodeAt(t,r);a.object=e,a.property=this.parseIdent(!0),a.computed=!1,e=this.finishNode(a,"MemberExpression")}else if(this.eat(i.types.bracketL)){var a=this.startNodeAt(t,r);a.object=e,a.property=this.parseExpression(),a.computed=!0,this.expect(i.types.bracketR),e=this.finishNode(a,"MemberExpression")}else if(!n&&this.match(i.types.parenL)){var s="Identifier"===e.type&&"async"===e.name&&!this.canInsertSemicolon();this.next();var a=this.startNodeAt(t,r);a.callee=e,a.arguments=this.parseExprList(i.types.parenR,this.options.features["es7.trailingFunctionCommas"]),e=this.finishNode(a,"CallExpression"),s&&(this.match(i.types.colon)||this.match(i.types.arrow))?e=this.parseAsyncArrowFromCallExpression(this.startNodeAt(t,r),a):this.toReferencedList(a.arguments)}else{if(!this.match(i.types.backQuote))return e;var a=this.startNodeAt(t,r);a.tag=e,a.quasi=this.parseTemplate(),e=this.finishNode(a,"TaggedTemplateExpression")}}},u.parseAsyncArrowFromCallExpression=function(e,t){return this.options.features["es7.asyncFunctions"]||this.unexpected(),
this.expect(i.types.arrow),this.parseArrowExpression(e,t.arguments,!0)},u.parseNoCallExpr=function(){var e=this.state.start,t=this.state.startLoc;return this.parseSubscripts(this.parseExprAtom(),e,t,!0)},u.parseExprAtom=function(e){var t=void 0,r=this.state.potentialArrowAt===this.state.start;switch(this.state.type){case i.types._super:this.state.inFunction||this.raise(this.state.start,"'super' outside of function or class");case i.types._this:var n=this.match(i.types._this)?"ThisExpression":"Super";return t=this.startNode(),this.next(),this.finishNode(t,n);case i.types._yield:this.state.inGenerator&&this.unexpected();case i.types._do:if(this.options.features["es7.doExpressions"]){var a=this.startNode();this.next();var s=this.state.inFunction,o=this.state.labels;return this.state.labels=[],this.state.inFunction=!1,a.body=this.parseBlock(),this.state.inFunction=s,this.state.labels=o,this.finishNode(a,"DoExpression")}case i.types.name:t=this.startNode();var u=this.parseIdent(!0);if(this.options.features["es7.asyncFunctions"])if("await"===u.name){if(this.inAsync)return this.parseAwait(t)}else{if("async"===u.name&&this.match(i.types._function)&&!this.canInsertSemicolon())return this.next(),this.parseFunction(t,!1,!1,!0);if(r&&"async"===u.name&&this.match(i.types.name)){var p=[this.parseIdent()];return this.expect(i.types.arrow),this.parseArrowExpression(t,p,!0)}}return r&&!this.canInsertSemicolon()&&this.eat(i.types.arrow)?this.parseArrowExpression(t,[u]):u;case i.types.regexp:var l=this.state.value;return t=this.parseLiteral(l.value),t.regex={pattern:l.pattern,flags:l.flags},t;case i.types.num:case i.types.string:return this.parseLiteral(this.state.value);case i.types._null:case i.types._true:case i.types._false:return t=this.startNode(),t.rawValue=t.value=this.match(i.types._null)?null:this.match(i.types._true),t.raw=this.state.type.keyword,this.next(),this.finishNode(t,"Literal");case i.types.parenL:return this.parseParenAndDistinguishExpression(null,null,r);case i.types.bracketL:return t=this.startNode(),this.next(),this.options.features["es7.comprehensions"]&&this.match(i.types._for)?this.parseComprehension(t,!1):(t.elements=this.parseExprList(i.types.bracketR,!0,!0,e),this.toReferencedList(t.elements),this.finishNode(t,"ArrayExpression"));case i.types.braceL:return this.parseObj(!1,e);case i.types._function:return t=this.startNode(),this.next(),this.parseFunction(t,!1);case i.types.at:this.parseDecorators();case i.types._class:return t=this.startNode(),this.takeDecorators(t),this.parseClass(t,!1);case i.types._new:return this.parseNew();case i.types.backQuote:return this.parseTemplate();case i.types.doubleColon:t=this.startNode(),this.next(),t.object=null;var c=t.callee=this.parseNoCallExpr();if("MemberExpression"===c.type)return this.finishNode(t,"BindExpression");this.raise(c.start,"Binding should be performed on object property.");default:this.unexpected()}},u.parseLiteral=function(e){var t=this.startNode();return t.rawValue=t.value=e,t.raw=this.input.slice(this.state.start,this.state.end),this.next(),this.finishNode(t,"Literal")},u.parseParenExpression=function(){this.expect(i.types.parenL);var e=this.parseExpression();return this.expect(i.types.parenR),e},u.parseParenAndDistinguishExpression=function(e,t,r,n){e=e||this.state.start,t=t||this.state.startLoc;var a=void 0;if(this.next(),this.options.features["es7.comprehensions"]&&this.match(i.types._for))return this.parseComprehension(this.startNodeAt(e,t),!0);for(var s=this.state.start,o=this.state.startLoc,u=[],p=!0,l={start:0},c=void 0,f=void 0,d=void 0;!this.match(i.types.parenR);){if(p)p=!1;else if(this.expect(i.types.comma),this.match(i.types.parenR)&&this.options.features["es7.trailingFunctionCommas"]){d=this.state.start;break}if(this.match(i.types.ellipsis)){var h=this.state.start,m=this.state.startLoc;c=this.state.start,u.push(this.parseParenItem(this.parseRest(),m,h));break}this.match(i.types.parenL)&&!f&&(f=this.state.start),u.push(this.parseMaybeAssign(!1,l,this.parseParenItem))}var y=this.state.start,g=this.state.startLoc;if(this.expect(i.types.parenR),r&&!this.canInsertSemicolon()&&this.eat(i.types.arrow))return f&&this.unexpected(f),this.parseArrowExpression(this.startNodeAt(e,t),u,n);if(!u.length){if(n)return;this.unexpected(this.state.lastTokStart)}return d&&this.unexpected(d),c&&this.unexpected(c),l.start&&this.unexpected(l.start),u.length>1?(a=this.startNodeAt(s,o),a.expressions=u,this.toReferencedList(a.expressions),this.finishNodeAt(a,"SequenceExpression",y,g)):a=u[0],a.parenthesizedExpression=!0,a},u.parseParenItem=function(e){return e},u.parseNew=function(){var e=this.startNode(),t=this.parseIdent(!0);return this.eat(i.types.dot)?(e.meta=t,e.property=this.parseIdent(!0),"target"!==e.property.name&&this.raise(e.property.start,"The only valid meta property for new is new.target"),this.finishNode(e,"MetaProperty")):(e.callee=this.parseNoCallExpr(),this.eat(i.types.parenL)?(e.arguments=this.parseExprList(i.types.parenR,this.options.features["es7.trailingFunctionCommas"]),this.toReferencedList(e.arguments)):e.arguments=[],this.finishNode(e,"NewExpression"))},u.parseTemplateElement=function(){var e=this.startNode();return e.value={raw:this.input.slice(this.state.start,this.state.end).replace(/\r\n?/g,"\n"),cooked:this.state.value},this.next(),e.tail=this.match(i.types.backQuote),this.finishNode(e,"TemplateElement")},u.parseTemplate=function(){var e=this.startNode();this.next(),e.expressions=[];var t=this.parseTemplateElement();for(e.quasis=[t];!t.tail;)this.expect(i.types.dollarBraceL),e.expressions.push(this.parseExpression()),this.expect(i.types.braceR),e.quasis.push(t=this.parseTemplateElement());return this.next(),this.finishNode(e,"TemplateLiteral")},u.parseObj=function(e,t){var r=this.startNode(),n=!0,a=Object.create(null);r.properties=[];var s=[];for(this.next();!this.eat(i.types.braceR);){if(n)n=!1;else if(this.expect(i.types.comma),this.eat(i.types.braceR))break;for(;this.match(i.types.at);)s.push(this.parseDecorator());var o=this.startNode(),u=!1,p=!1,l=void 0,c=void 0;if(s.length&&(o.decorators=s,s=[]),this.options.features["es7.objectRestSpread"]&&this.match(i.types.ellipsis))o=this.parseSpread(),o.type="SpreadProperty",r.properties.push(o);else{if(o.method=!1,o.shorthand=!1,(e||t)&&(l=this.state.start,c=this.state.startLoc),e||(u=this.eat(i.types.star)),!e&&this.options.features["es7.asyncFunctions"]&&this.isContextual("async")){u&&this.unexpected();var f=this.parseIdent();this.match(i.types.colon)||this.match(i.types.parenL)||this.match(i.types.braceR)?o.key=f:(p=!0,this.parsePropertyName(o))}else this.parsePropertyName(o);this.parseObjPropValue(o,l,c,u,p,e,t),this.checkPropClash(o,a),r.properties.push(this.finishNode(o,"Property"))}}return s.length&&this.raise(this.state.start,"You have trailing decorators with no property"),this.finishNode(r,e?"ObjectPattern":"ObjectExpression")},u.parseObjPropValue=function(e,t,r,n,a,s,u){if(this.eat(i.types.colon))e.value=s?this.parseMaybeDefault(this.state.start,this.state.startLoc):this.parseMaybeAssign(!1,u),e.kind="init";else if(this.match(i.types.parenL))s&&this.unexpected(),e.kind="init",e.method=!0,e.value=this.parseMethod(n,a);else if(e.computed||"Identifier"!==e.key.type||"get"!==e.key.name&&"set"!==e.key.name||this.match(i.types.comma)||this.match(i.types.braceR))e.computed||"Identifier"!==e.key.type?this.unexpected():(e.kind="init",s?((this.isKeyword(e.key.name)||this.strict&&(o.reservedWords.strictBind(e.key.name)||o.reservedWords.strict(e.key.name))||!this.options.allowReserved&&this.isReservedWord(e.key.name))&&this.raise(e.key.start,"Binding "+e.key.name),e.value=this.parseMaybeDefault(t,r,e.key.__clone())):this.match(i.types.eq)&&u?(u.start||(u.start=this.state.start),e.value=this.parseMaybeDefault(t,r,e.key.__clone())):e.value=e.key.__clone(),e.shorthand=!0);else{(n||a||s)&&this.unexpected(),e.kind=e.key.name,this.parsePropertyName(e),e.value=this.parseMethod(!1);var p="get"===e.kind?0:1;if(e.value.params.length!==p){var l=e.value.start;"get"===e.kind?this.raise(l,"getter should have no params"):this.raise(l,"setter should have exactly one param")}}},u.parsePropertyName=function(e){return this.eat(i.types.bracketL)?(e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(i.types.bracketR),e.key):(e.computed=!1,e.key=this.match(i.types.num)||this.match(i.types.string)?this.parseExprAtom():this.parseIdent(!0))},u.initFunction=function(e,t){e.id=null,e.generator=!1,e.expression=!1,this.options.features["es7.asyncFunctions"]&&(e.async=!!t)},u.parseMethod=function(e,t){var r=this.startNode();return this.initFunction(r,t),this.expect(i.types.parenL),r.params=this.parseBindingList(i.types.parenR,!1,this.options.features["es7.trailingFunctionCommas"]),r.generator=e,this.parseFunctionBody(r),this.finishNode(r,"FunctionExpression")},u.parseArrowExpression=function(e,t,r){return this.initFunction(e,r),e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0),this.finishNode(e,"ArrowFunctionExpression")},u.parseFunctionBody=function(e,t){var r=t&&!this.match(i.types.braceL),n=this.inAsync;if(this.inAsync=e.async,r)e.body=this.parseMaybeAssign(),e.expression=!0;else{var a=this.state.inFunction,s=this.state.inGenerator,o=this.state.labels;this.state.inFunction=!0,this.state.inGenerator=e.generator,this.state.labels=[],e.body=this.parseBlock(!0),e.expression=!1,this.state.inFunction=a,this.state.inGenerator=s,this.state.labels=o}if(this.inAsync=n,this.strict||!r&&e.body.body.length&&this.isUseStrict(e.body.body[0])){var u=Object.create(null),p=this.strict;this.strict=!0,e.id&&this.checkLVal(e.id,!0);for(var l=e.params,c=0;c<l.length;c++){var f=l[c];this.checkLVal(f,!0,u)}this.strict=p}},u.parseExprList=function(e,t,r,n){for(var a=[],s=!0;!this.eat(e);){if(s)s=!1;else if(this.expect(i.types.comma),t&&this.eat(e))break;a.push(this.parseExprListItem(r,n))}return a},u.parseExprListItem=function(e,t){var r=void 0;return r=e&&this.match(i.types.comma)?null:this.match(i.types.ellipsis)?this.parseSpread(t):this.parseMaybeAssign(!1,t)},u.parseIdent=function(e){var t=this.startNode();return this.match(i.types.name)?(!e&&(!this.options.allowReserved&&this.isReservedWord(this.state.value)||this.strict&&o.reservedWords.strict(this.state.value))&&this.raise(this.state.start,"The keyword '"+this.state.value+"' is reserved"),t.name=this.state.value):e&&this.state.type.keyword?t.name=this.state.type.keyword:this.unexpected(),this.next(),this.finishNode(t,"Identifier")},u.parseAwait=function(e){return(this.eat(i.types.semi)||this.canInsertSemicolon())&&this.unexpected(),e.all=this.eat(i.types.star),e.argument=this.parseMaybeUnary(),this.finishNode(e,"AwaitExpression")},u.parseYield=function(){var e=this.startNode();return this.next(),this.match(i.types.semi)||this.canInsertSemicolon()||!this.match(i.types.star)&&!this.state.type.startsExpr?(e.delegate=!1,e.argument=null):(e.delegate=this.eat(i.types.star),e.argument=this.parseMaybeAssign()),this.finishNode(e,"YieldExpression")},u.parseComprehension=function(e,t){for(e.blocks=[];this.match(i.types._for);){var r=this.startNode();this.next(),this.expect(i.types.parenL),r.left=this.parseBindingAtom(),this.checkLVal(r.left,!0),this.expectContextual("of"),r.right=this.parseExpression(),this.expect(i.types.parenR),e.blocks.push(this.finishNode(r,"ComprehensionBlock"))}return e.filter=this.eat(i.types._if)?this.parseParenExpression():null,e.body=this.parseExpression(),this.expect(t?i.types.parenR:i.types.bracketR),e.generator=t,this.finishNode(e,"ComprehensionExpression")}},{617:617,629:629,630:630}],617:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}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)}r.__esModule=!0;var s=e(630),o=e(614),u=e(627),p=n(u),l={};r.plugins=l;var c=function(e){function t(r,n){i(this,t),e.call(this,n),this.options=o.getOptions(r),this.isKeyword=s.isKeyword,this.isReservedWord=s.reservedWords[6],this.input=n,this.loadPlugins(this.options.plugins),this.inModule="module"===this.options.sourceType,this.strict=this.options.strictMode===!1?!1:this.inModule,0===this.state.pos&&"#"===this.input[0]&&"!"===this.input[1]&&this.skipLineComment(2)}return a(t,e),t.prototype.extend=function(e,t){this[e]=t(this[e])},t.prototype.loadPlugins=function(e){for(var t in e){var n=r.plugins[t];if(!n)throw new Error("Plugin '"+t+"' not found");n(this,e[t])}},t.prototype.parse=function(){var e=this.startNode(),t=this.startNode();return this.nextToken(),this.parseTopLevel(e,t)},t}(p["default"]);r["default"]=c},{614:614,627:627,630:630}],618:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var i=e(631),a=e(617),s=n(a),o=s["default"].prototype;o.raise=function(e,t){var r=i.getLineInfo(this.input,e);t+=" ("+r.line+":"+r.column+")";var n=new SyntaxError(t);throw n.pos=e,n.loc=r,n}},{617:617,631:631}],619:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var i=e(629),a=e(617),s=n(a),o=e(630),u=s["default"].prototype;u.toAssignable=function(e,t){if(e)switch(e.type){case"Identifier":case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":break;case"ObjectExpression":e.type="ObjectPattern";for(var r=e.properties,n=0;n<r.length;n++){var i=r[n];"SpreadProperty"!==i.type&&("init"!==i.kind&&this.raise(i.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(i.value,t))}break;case"ArrayExpression":e.type="ArrayPattern",this.toAssignableList(e.elements,t);break;case"AssignmentExpression":"="===e.operator?(e.type="AssignmentPattern",delete e.operator):this.raise(e.left.end,"Only '=' operator can be used for specifying default value.");break;case"MemberExpression":if(!t)break;default:this.raise(e.start,"Assigning to rvalue")}return e},u.toAssignableList=function(e,t){var r=e.length;if(r){var n=e[r-1];if(n&&"RestElement"===n.type)--r;else if(n&&"SpreadElement"===n.type){n.type="RestElement";var i=n.argument;this.toAssignable(i,t),"Identifier"!==i.type&&"MemberExpression"!==i.type&&"ArrayPattern"!==i.type&&this.unexpected(i.start),--r}}for(var a=0;r>a;a++){var s=e[a];s&&this.toAssignable(s,t)}return e},u.toReferencedList=function(e){return e},u.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(e),this.finishNode(t,"SpreadElement")},u.parseRest=function(){var e=this.startNode();return this.next(),e.argument=this.match(i.types.name)||this.match(i.types.bracketL)?this.parseBindingAtom():this.unexpected(),this.finishNode(e,"RestElement")},u.parseBindingAtom=function(){switch(this.state.type){case i.types.name:return this.parseIdent();case i.types.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(i.types.bracketR,!0,!0),this.finishNode(e,"ArrayPattern");case i.types.braceL:return this.parseObj(!0);default:this.unexpected()}},u.parseBindingList=function(e,t,r){for(var n=[],a=!0;!this.eat(e);)if(a?a=!1:this.expect(i.types.comma),t&&this.match(i.types.comma))n.push(null);else{if(r&&this.eat(e))break;if(this.match(i.types.ellipsis)){n.push(this.parseAssignableListItemTypes(this.parseRest())),this.expect(e);break}var s=this.parseMaybeDefault();this.parseAssignableListItemTypes(s),n.push(this.parseMaybeDefault(null,null,s))}return n},u.parseAssignableListItemTypes=function(e){return e},u.parseMaybeDefault=function(e,t,r){if(t=t||this.state.startLoc,e=e||this.state.start,r=r||this.parseBindingAtom(),!this.eat(i.types.eq))return r;var n=this.startNodeAt(e,t);return n.left=r,n.right=this.parseMaybeAssign(),this.finishNode(n,"AssignmentPattern")},u.checkLVal=function(e,t,r){switch(e.type){case"Identifier":this.strict&&(o.reservedWords.strictBind(e.name)||o.reservedWords.strict(e.name))&&this.raise(e.start,(t?"Binding ":"Assigning to ")+e.name+" in strict mode"),r&&(r[e.name]?this.raise(e.start,"Argument name clash in strict mode"):r[e.name]=!0);break;case"MemberExpression":t&&this.raise(e.start,(t?"Binding":"Assigning to")+" member expression");break;case"ObjectPattern":for(var n=e.properties,i=0;i<n.length;i++){var a=n[i];"Property"===a.type&&(a=a.value),this.checkLVal(a,t,r)}break;case"ArrayPattern":for(var s=e.elements,u=0;u<s.length;u++){var p=s[u];p&&this.checkLVal(p,t,r)}break;case"AssignmentPattern":this.checkLVal(e.left,t,r);break;case"SpreadProperty":case"RestElement":this.checkLVal(e.argument,t,r);break;default:this.raise(e.start,(t?"Binding":"Assigning to")+" rvalue")}}},{617:617,629:629,630:630}],620:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t,r,n){return e.type=t,e.end=r,e.loc.end=n,this.processComment(e),e}r.__esModule=!0;var s=e(617),o=n(s),u=e(631),p=o["default"].prototype,l=function(){function e(t,r,n){i(this,e),this.type="",this.start=r,this.end=0,this.loc=new u.SourceLocation(n)}return e.prototype.__clone=function(){var t=new e;for(var r in this)t[r]=this[r];return t},e}();r.Node=l,p.startNode=function(){return new l(this,this.state.start,this.state.startLoc)},p.startNodeAt=function(e,t){return new l(this,e,t)},p.finishNode=function(e,t){return a.call(this,e,t,this.state.lastTokEnd,this.state.lastTokEndLoc)},p.finishNodeAt=function(e,t,r,n){return a.call(this,e,t,r,n)}},{617:617,631:631}],621:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var i=e(629),a=e(617),s=n(a),o=e(632),u=s["default"].prototype;u.parseTopLevel=function(e,t){t.sourceType=this.options.sourceType,t.body=[];for(var r=!0;!this.match(i.types.eof);){var n=this.parseStatement(!0,!0);t.body.push(n),r&&(this.isUseStrict(n)&&this.setStrict(!0),r=!1)}return this.next(),e.program=this.finishNode(t,"Program"),e.comments=this.state.comments,e.tokens=this.state.tokens,this.finishNode(e,"File")};var p={kind:"loop"},l={kind:"switch"};u.parseStatement=function(e,t){this.match(i.types.at)&&this.parseDecorators(!0);var r=this.state.type,n=this.startNode();switch(r){case i.types._break:case i.types._continue:return this.parseBreakContinueStatement(n,r.keyword);case i.types._debugger:return this.parseDebuggerStatement(n);case i.types._do:return this.parseDoStatement(n);case i.types._for:return this.parseForStatement(n);case i.types._function:return e||this.unexpected(),this.parseFunctionStatement(n);case i.types._class:return e||this.unexpected(),this.takeDecorators(n),this.parseClass(n,!0);case i.types._if:return this.parseIfStatement(n);case i.types._return:return this.parseReturnStatement(n);case i.types._switch:return this.parseSwitchStatement(n);case i.types._throw:return this.parseThrowStatement(n);case i.types._try:return this.parseTryStatement(n);case i.types._let:case i.types._const:e||this.unexpected();case i.types._var:return this.parseVarStatement(n,r);case i.types._while:return this.parseWhileStatement(n);case i.types._with:return this.parseWithStatement(n);case i.types.braceL:return this.parseBlock();case i.types.semi:return this.parseEmptyStatement(n);case i.types._export:case i.types._import:return this.options.allowImportExportEverywhere||(t||this.raise(this.state.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.state.start,"'import' and 'export' may appear only with 'sourceType: module'")),r===i.types._import?this.parseImport(n):this.parseExport(n);case i.types.name:if(this.options.features["es7.asyncFunctions"]&&"async"===this.state.value){var a=this.state.clone();if(this.next(),this.match(i.types._function)&&!this.canInsertSemicolon())return this.expect(i.types._function),this.parseFunction(n,!0,!1,!0);this.state=a}default:var s=this.state.value,o=this.parseExpression();return r===i.types.name&&"Identifier"===o.type&&this.eat(i.types.colon)?this.parseLabeledStatement(n,s,o):this.parseExpressionStatement(n,o)}},u.takeDecorators=function(e){this.state.decorators.length&&(e.decorators=this.state.decorators,this.state.decorators=[])},u.parseDecorators=function(e){for(;this.match(i.types.at);)this.state.decorators.push(this.parseDecorator());e&&this.match(i.types._export)||this.match(i.types._class)||this.raise(this.state.start,"Leading decorators must be attached to a class declaration")},u.parseDecorator=function(){this.options.features["es7.decorators"]||this.unexpected();var e=this.startNode();return this.next(),e.expression=this.parseMaybeAssign(),this.finishNode(e,"Decorator")},u.parseBreakContinueStatement=function(e,t){var r="break"===t;this.next(),this.eat(i.types.semi)||this.canInsertSemicolon()?e.label=null:this.match(i.types.name)?(e.label=this.parseIdent(),this.semicolon()):this.unexpected();for(var n=0;n<this.state.labels.length;++n){var a=this.state.labels[n];if(null==e.label||a.name===e.label.name){if(null!=a.kind&&(r||"loop"===a.kind))break;if(e.label&&r)break}}return n===this.state.labels.length&&this.raise(e.start,"Unsyntactic "+t),this.finishNode(e,r?"BreakStatement":"ContinueStatement")},u.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,"DebuggerStatement")},u.parseDoStatement=function(e){return this.next(),this.state.labels.push(p),e.body=this.parseStatement(!1),this.state.labels.pop(),this.expect(i.types._while),e.test=this.parseParenExpression(),this.eat(i.types.semi),this.finishNode(e,"DoWhileStatement")},u.parseForStatement=function(e){if(this.next(),this.state.labels.push(p),this.expect(i.types.parenL),this.match(i.types.semi))return this.parseFor(e,null);if(this.match(i.types._var)||this.match(i.types._let)||this.match(i.types._const)){var t=this.startNode(),r=this.state.type;return this.next(),this.parseVar(t,!0,r),this.finishNode(t,"VariableDeclaration"),!this.match(i.types._in)&&!this.isContextual("of")||1!==t.declarations.length||r!==i.types._var&&t.declarations[0].init?this.parseFor(e,t):this.parseForIn(e,t)}var n={start:0},a=this.parseExpression(!0,n);return this.match(i.types._in)||this.isContextual("of")?(this.toAssignable(a),this.checkLVal(a),this.parseForIn(e,a)):(n.start&&this.unexpected(n.start),this.parseFor(e,a))},u.parseFunctionStatement=function(e){return this.next(),this.parseFunction(e,!0)},u.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement(!1),e.alternate=this.eat(i.types._else)?this.parseStatement(!1):null,this.finishNode(e,"IfStatement")},u.parseReturnStatement=function(e){return this.state.inFunction||this.options.allowReturnOutsideFunction||this.raise(this.state.start,"'return' outside of function"),this.next(),this.eat(i.types.semi)||this.canInsertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")},u.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(i.types.braceL),this.state.labels.push(l);for(var t,r;!this.match(i.types.braceR);)if(this.match(i.types._case)||this.match(i.types._default)){var n=this.match(i.types._case);t&&this.finishNode(t,"SwitchCase"),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),n?t.test=this.parseExpression():(r&&this.raise(this.state.lastTokStart,"Multiple default clauses"),r=!0,t.test=null),this.expect(i.types.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(!0));return t&&this.finishNode(t,"SwitchCase"),this.next(),this.state.labels.pop(),this.finishNode(e,"SwitchStatement")},u.parseThrowStatement=function(e){return this.next(),o.lineBreak.test(this.input.slice(this.state.lastTokEnd,this.state.start))&&this.raise(this.state.lastTokEnd,"Illegal newline after throw"),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,"ThrowStatement")};var c=[];u.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.match(i.types._catch)){var t=this.startNode();this.next(),this.expect(i.types.parenL),t.param=this.parseBindingAtom(),this.checkLVal(t.param,!0),this.expect(i.types.parenR),t.body=this.parseBlock(),e.handler=this.finishNode(t,"CatchClause")}return e.guardedHandlers=c,e.finalizer=this.eat(i.types._finally)?this.parseBlock():null,e.handler||e.finalizer||this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")},u.parseVarStatement=function(e,t){return this.next(),this.parseVar(e,!1,t),this.semicolon(),this.finishNode(e,"VariableDeclaration")},u.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.state.labels.push(p),e.body=this.parseStatement(!1),this.state.labels.pop(),this.finishNode(e,"WhileStatement")},u.parseWithStatement=function(e){return this.strict&&this.raise(this.state.start,"'with' in strict mode"),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement(!1),this.finishNode(e,"WithStatement")},u.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")},u.parseLabeledStatement=function(e,t,r){for(var n=this.state.labels,a=0;a<n.length;a++){var s=n[a];s.name===t&&this.raise(r.start,"Label '"+t+"' is already declared")}for(var o=this.state.type.isLoop?"loop":this.match(i.types._switch)?"switch":null,u=this.state.labels.length-1;u>=0;u--){var s=this.state.labels[u];if(s.statementStart!==e.start)break;s.statementStart=this.state.start,s.kind=o}return this.state.labels.push({name:t,kind:o,statementStart:this.state.start}),e.body=this.parseStatement(!0),this.state.labels.pop(),e.label=r,this.finishNode(e,"LabeledStatement")},u.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")},u.parseBlock=function(e){var t=this.startNode(),r=!0,n=void 0;for(t.body=[],this.expect(i.types.braceL);!this.eat(i.types.braceR);){var a=this.parseStatement(!0);t.body.push(a),r&&e&&this.isUseStrict(a)&&(n=this.strict,this.setStrict(this.strict=!0)),r=!1}return n===!1&&this.setStrict(!1),this.finishNode(t,"BlockStatement")},u.parseFor=function(e,t){return e.init=t,this.expect(i.types.semi),e.test=this.match(i.types.semi)?null:this.parseExpression(),this.expect(i.types.semi),e.update=this.match(i.types.parenR)?null:this.parseExpression(),this.expect(i.types.parenR),e.body=this.parseStatement(!1),this.state.labels.pop(),this.finishNode(e,"ForStatement")},u.parseForIn=function(e,t){var r=this.match(i.types._in)?"ForInStatement":"ForOfStatement";return this.next(),e.left=t,e.right=this.parseExpression(),this.expect(i.types.parenR),e.body=this.parseStatement(!1),this.state.labels.pop(),this.finishNode(e,r)},u.parseVar=function(e,t,r){for(e.declarations=[],e.kind=r.keyword;;){var n=this.startNode();if(this.parseVarHead(n),this.eat(i.types.eq)?n.init=this.parseMaybeAssign(t):r!==i.types._const||this.match(i.types._in)||this.isContextual("of")?"Identifier"===n.id.type||t&&(this.match(i.types._in)||this.isContextual("of"))?n.init=null:this.raise(this.state.lastTokEnd,"Complex binding patterns require an initialization value"):this.unexpected(),e.declarations.push(this.finishNode(n,"VariableDeclarator")),!this.eat(i.types.comma))break}return e},u.parseVarHead=function(e){e.id=this.parseBindingAtom(),this.checkLVal(e.id,!0)},u.parseFunction=function(e,t,r,n){return this.initFunction(e,n),e.generator=this.eat(i.types.star),(t||this.match(i.types.name))&&(e.id=this.parseIdent()),this.parseFunctionParams(e),this.parseFunctionBody(e,r),this.finishNode(e,t?"FunctionDeclaration":"FunctionExpression")},u.parseFunctionParams=function(e){this.expect(i.types.parenL),e.params=this.parseBindingList(i.types.parenR,!1,this.options.features["es7.trailingFunctionCommas"])},u.parseClass=function(e,t){this.next(),this.parseClassId(e,t),this.parseClassSuper(e);var r=this.startNode(),n=!1;r.body=[],this.expect(i.types.braceL);for(var a=[];!this.eat(i.types.braceR);)if(!this.eat(i.types.semi))if(this.match(i.types.at))a.push(this.parseDecorator());else{var s=this.startNode();a.length&&(s.decorators=a,a=[]);var o=this.match(i.types.name)&&"static"===this.state.value,u=this.eat(i.types.star),p=!1;if(this.parsePropertyName(s),s["static"]=o&&!this.match(i.types.parenL),s["static"]&&(u&&this.unexpected(),u=this.eat(i.types.star),this.parsePropertyName(s)),u||"Identifier"!==s.key.type||s.computed||!this.isClassProperty()){!this.options.features["es7.asyncFunctions"]||this.match(i.types.parenL)||s.computed||"Identifier"!==s.key.type||"async"!==s.key.name||(p=!0,this.parsePropertyName(s));var l=!1;if(s.kind="method",!s.computed){var c=s.key;p||u||"Identifier"!==c.type||this.match(i.types.parenL)||"get"!==c.name&&"set"!==c.name||(l=!0,s.kind=c.name,c=this.parsePropertyName(s)),!s["static"]&&("Identifier"===c.type&&"constructor"===c.name||"Literal"===c.type&&"constructor"===c.value)&&(n&&this.raise(c.start,"Duplicate constructor in the same class"),l&&this.raise(c.start,"Constructor can't have get/set modifier"),u&&this.raise(c.start,"Constructor can't be a generator"),p&&this.raise(c.start,"Constructor can't be an async function"),s.kind="constructor",n=!0)}if("constructor"===s.kind&&s.decorators&&this.raise(s.start,"You can't attach decorators to a class constructor"),this.parseClassMethod(r,s,u,p),l){var f="get"===s.kind?0:1;if(s.value.params.length!==f){var d=s.value.start;"get"===s.kind?this.raise(d,"getter should have no params"):this.raise(d,"setter should have exactly one param")}}}else r.body.push(this.parseClassProperty(s))}return a.length&&this.raise(this.state.start,"You have trailing decorators with no method"),e.body=this.finishNode(r,"ClassBody"),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")},u.isClassProperty=function(){return this.match(i.types.eq)||this.match(i.types.semi)||this.canInsertSemicolon()},u.parseClassProperty=function(e){return this.match(i.types.eq)?(this.options.features["es7.classProperties"]||this.unexpected(),this.next(),e.value=this.parseMaybeAssign()):e.value=null,this.semicolon(),this.finishNode(e,"ClassProperty")},u.parseClassMethod=function(e,t,r,n){t.value=this.parseMethod(r,n),e.body.push(this.finishNode(t,"MethodDefinition"))},u.parseClassId=function(e,t){e.id=this.match(i.types.name)?this.parseIdent():t?this.unexpected():null},u.parseClassSuper=function(e){e.superClass=this.eat(i.types._extends)?this.parseExprSubscripts():null},u.parseExport=function(e){if(this.next(),this.match(i.types.star)){var t=this.startNode();if(this.next(),!this.options.features["es7.exportExtensions"]||!this.eatContextual("as"))return this.parseExportFrom(e,!0),this.finishNode(e,"ExportAllDeclaration");t.exported=this.parseIdent(),e.specifiers=[this.finishNode(t,"ExportNamespaceSpecifier")],this.parseExportSpecifiersMaybe(e),this.parseExportFrom(e,!0)}else if(this.options.features["es7.exportExtensions"]&&this.isExportDefaultSpecifier()){var t=this.startNode();if(t.exported=this.parseIdent(!0),e.specifiers=[this.finishNode(t,"ExportDefaultSpecifier")],this.match(i.types.comma)&&this.lookahead().type===i.types.star){this.expect(i.types.comma);var r=this.startNode();this.expect(i.types.star),this.expectContextual("as"),r.exported=this.parseIdent(),e.specifiers.push(this.finishNode(r,"ExportNamespaceSpecifier"))}else this.parseExportSpecifiersMaybe(e);this.parseExportFrom(e,!0)}else{if(this.eat(i.types._default)){var n=this.match(i.types._function)||this.match(i.types._class),a=this.parseMaybeAssign(),s=!0;return n&&(s=!1,a.id&&(a.type="FunctionExpression"===a.type?"FunctionDeclaration":"ClassDeclaration")),e.declaration=a,s&&this.semicolon(),this.checkExport(e),this.finishNode(e,"ExportDefaultDeclaration")}this.state.type.keyword||this.shouldParseExportDeclaration()?(e.specifiers=[],e.source=null,e.declaration=this.parseExportDeclaration(e)):(e.declaration=null,
e.specifiers=this.parseExportSpecifiers(),this.parseExportFrom(e))}return this.checkExport(e),this.finishNode(e,"ExportNamedDeclaration")},u.parseExportDeclaration=function(){return this.parseStatement(!0)},u.isExportDefaultSpecifier=function(){if(this.match(i.types.name))return"type"!==this.state.value&&"async"!==this.state.value&&"interface"!==this.state.value;if(!this.match(i.types._default))return!1;var e=this.lookahead();return e.type===i.types.comma||e.type===i.types.name&&"from"===e.value},u.parseExportSpecifiersMaybe=function(e){this.eat(i.types.comma)&&(e.specifiers=e.specifiers.concat(this.parseExportSpecifiers()))},u.parseExportFrom=function(e,t){this.eatContextual("from")?(e.source=this.match(i.types.string)?this.parseExprAtom():this.unexpected(),this.checkExport(e)):t?this.unexpected():e.source=null,this.semicolon()},u.shouldParseExportDeclaration=function(){return this.options.features["es7.asyncFunctions"]&&this.isContextual("async")},u.checkExport=function(e){if(this.state.decorators.length){var t=e.declaration&&("ClassDeclaration"===e.declaration.type||"ClassExpression"===e.declaration.type);e.declaration&&t||this.raise(e.start,"You can only use decorators on an export when exporting a class"),this.takeDecorators(e.declaration)}},u.parseExportSpecifiers=function(){var e=[],t=!0;for(this.expect(i.types.braceL);!this.eat(i.types.braceR);){if(t)t=!1;else if(this.expect(i.types.comma),this.eat(i.types.braceR))break;var r=this.startNode();r.local=this.parseIdent(this.match(i.types._default)),r.exported=this.eatContextual("as")?this.parseIdent(!0):r.local.__clone(),e.push(this.finishNode(r,"ExportSpecifier"))}return e},u.parseImport=function(e){return this.next(),this.match(i.types.string)?(e.specifiers=[],e.source=this.parseExprAtom()):(e.specifiers=[],this.parseImportSpecifiers(e),this.expectContextual("from"),e.source=this.match(i.types.string)?this.parseExprAtom():this.unexpected()),this.semicolon(),this.finishNode(e,"ImportDeclaration")},u.parseImportSpecifiers=function(e){var t=!0;if(this.match(i.types.name)){var r=this.state.start,n=this.state.startLoc;if(e.specifiers.push(this.parseImportSpecifierDefault(this.parseIdent(),r,n)),!this.eat(i.types.comma))return}if(this.match(i.types.star)){var a=this.startNode();return this.next(),this.expectContextual("as"),a.local=this.parseIdent(),this.checkLVal(a.local,!0),void e.specifiers.push(this.finishNode(a,"ImportNamespaceSpecifier"))}for(this.expect(i.types.braceL);!this.eat(i.types.braceR);){if(t)t=!1;else if(this.expect(i.types.comma),this.eat(i.types.braceR))break;var a=this.startNode();a.imported=this.parseIdent(!0),a.local=this.eatContextual("as")?this.parseIdent():a.imported.__clone(),this.checkLVal(a.local,!0),e.specifiers.push(this.finishNode(a,"ImportSpecifier"))}},u.parseImportSpecifierDefault=function(e,t,r){var n=this.startNodeAt(t,r);return n.local=e,this.checkLVal(n.local,!0),this.finishNode(n,"ImportDefaultSpecifier")}},{617:617,629:629,632:632}],622:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var i=e(629),a=e(617),s=n(a),o=e(632),u=s["default"].prototype;u.isUseStrict=function(e){return"ExpressionStatement"===e.type&&"Literal"===e.expression.type&&"use strict"===e.expression.raw.slice(1,-1)},u.isRelational=function(e){return this.match(i.types.relational)&&this.state.value===e},u.expectRelational=function(e){this.isRelational(e)?this.next():this.unexpected()},u.isContextual=function(e){return this.match(i.types.name)&&this.state.value===e},u.eatContextual=function(e){return this.state.value===e&&this.eat(i.types.name)},u.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},u.canInsertSemicolon=function(){return this.match(i.types.eof)||this.match(i.types.braceR)||o.lineBreak.test(this.input.slice(this.state.lastTokEnd,this.state.start))},u.semicolon=function(){this.eat(i.types.semi)||this.canInsertSemicolon()||this.unexpected()},u.expect=function(e){return this.eat(e)||this.unexpected()},u.unexpected=function(e){this.raise(null!=e?e:this.state.start,"Unexpected token")}},{617:617,629:629,632:632}],623:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var i=e(629),a=e(617),s=n(a),o=s["default"].prototype;o.flowParseTypeInitialiser=function(e){var t=this.state.inType;this.state.inType=!0,this.expect(e||i.types.colon);var r=this.flowParseType();return this.state.inType=t,r},o.flowParseDeclareClass=function(e){return this.next(),this.flowParseInterfaceish(e,!0),this.finishNode(e,"DeclareClass")},o.flowParseDeclareFunction=function(e){this.next();var t=e.id=this.parseIdent(),r=this.startNode(),n=this.startNode();this.isRelational("<")?r.typeParameters=this.flowParseTypeParameterDeclaration():r.typeParameters=null,this.expect(i.types.parenL);var a=this.flowParseFunctionTypeParams();return r.params=a.params,r.rest=a.rest,this.expect(i.types.parenR),r.returnType=this.flowParseTypeInitialiser(),n.typeAnnotation=this.finishNode(r,"FunctionTypeAnnotation"),t.typeAnnotation=this.finishNode(n,"TypeAnnotation"),this.finishNode(t,t.type),this.semicolon(),this.finishNode(e,"DeclareFunction")},o.flowParseDeclare=function(e){return this.match(i.types._class)?this.flowParseDeclareClass(e):this.match(i.types._function)?this.flowParseDeclareFunction(e):this.match(i.types._var)?this.flowParseDeclareVariable(e):this.isContextual("module")?this.flowParseDeclareModule(e):this.isContextual("type")?this.flowParseDeclareTypeAlias(e):this.isContextual("interface")?this.flowParseDeclareInterface(e):void this.unexpected()},o.flowParseDeclareVariable=function(e){return this.next(),e.id=this.flowParseTypeAnnotatableIdentifier(),this.semicolon(),this.finishNode(e,"DeclareVariable")},o.flowParseDeclareModule=function(e){this.next(),this.match(i.types.string)?e.id=this.parseExprAtom():e.id=this.parseIdent();var t=e.body=this.startNode(),r=t.body=[];for(this.expect(i.types.braceL);!this.match(i.types.braceR);){var n=this.startNode();this.next(),r.push(this.flowParseDeclare(n))}return this.expect(i.types.braceR),this.finishNode(t,"BlockStatement"),this.finishNode(e,"DeclareModule")},o.flowParseDeclareTypeAlias=function(e){return this.next(),this.flowParseTypeAlias(e),this.finishNode(e,"DeclareTypeAlias")},o.flowParseDeclareInterface=function(e){return this.next(),this.flowParseInterfaceish(e),this.finishNode(e,"DeclareInterface")},o.flowParseInterfaceish=function(e,t){if(e.id=this.parseIdent(),this.isRelational("<")?e.typeParameters=this.flowParseTypeParameterDeclaration():e.typeParameters=null,e["extends"]=[],e.mixins=[],this.eat(i.types._extends))do e["extends"].push(this.flowParseInterfaceExtends());while(this.eat(i.types.comma));if(this.isContextual("mixins")){this.next();do e.mixins.push(this.flowParseInterfaceExtends());while(this.eat(i.types.comma))}e.body=this.flowParseObjectType(t)},o.flowParseInterfaceExtends=function(){var e=this.startNode();return e.id=this.parseIdent(),this.isRelational("<")?e.typeParameters=this.flowParseTypeParameterInstantiation():e.typeParameters=null,this.finishNode(e,"InterfaceExtends")},o.flowParseInterface=function(e){return this.flowParseInterfaceish(e,!1),this.finishNode(e,"InterfaceDeclaration")},o.flowParseTypeAlias=function(e){return e.id=this.parseIdent(),this.isRelational("<")?e.typeParameters=this.flowParseTypeParameterDeclaration():e.typeParameters=null,e.right=this.flowParseTypeInitialiser(i.types.eq),this.semicolon(),this.finishNode(e,"TypeAlias")},o.flowParseTypeParameterDeclaration=function(){var e=this.startNode();for(e.params=[],this.expectRelational("<");!this.isRelational(">");)e.params.push(this.flowParseTypeAnnotatableIdentifier()),this.isRelational(">")||this.expect(i.types.comma);return this.expectRelational(">"),this.finishNode(e,"TypeParameterDeclaration")},o.flowParseTypeParameterInstantiation=function(){var e=this.startNode(),t=this.state.inType;for(e.params=[],this.state.inType=!0,this.expectRelational("<");!this.isRelational(">");)e.params.push(this.flowParseType()),this.isRelational(">")||this.expect(i.types.comma);return this.expectRelational(">"),this.state.inType=t,this.finishNode(e,"TypeParameterInstantiation")},o.flowParseObjectPropertyKey=function(){return this.match(i.types.num)||this.match(i.types.string)?this.parseExprAtom():this.parseIdent(!0)},o.flowParseObjectTypeIndexer=function(e,t){return e["static"]=t,this.expect(i.types.bracketL),e.id=this.flowParseObjectPropertyKey(),e.key=this.flowParseTypeInitialiser(),this.expect(i.types.bracketR),e.value=this.flowParseTypeInitialiser(),this.flowObjectTypeSemicolon(),this.finishNode(e,"ObjectTypeIndexer")},o.flowParseObjectTypeMethodish=function(e){for(e.params=[],e.rest=null,e.typeParameters=null,this.isRelational("<")&&(e.typeParameters=this.flowParseTypeParameterDeclaration()),this.expect(i.types.parenL);this.match(i.types.name);)e.params.push(this.flowParseFunctionTypeParam()),this.match(i.types.parenR)||this.expect(i.types.comma);return this.eat(i.types.ellipsis)&&(e.rest=this.flowParseFunctionTypeParam()),this.expect(i.types.parenR),e.returnType=this.flowParseTypeInitialiser(),this.finishNode(e,"FunctionTypeAnnotation")},o.flowParseObjectTypeMethod=function(e,t,r,n){var i=this.startNodeAt(e,t);return i.value=this.flowParseObjectTypeMethodish(this.startNodeAt(e,t)),i["static"]=r,i.key=n,i.optional=!1,this.flowObjectTypeSemicolon(),this.finishNode(i,"ObjectTypeProperty")},o.flowParseObjectTypeCallProperty=function(e,t){var r=this.startNode();return e["static"]=t,e.value=this.flowParseObjectTypeMethodish(r),this.flowObjectTypeSemicolon(),this.finishNode(e,"ObjectTypeCallProperty")},o.flowParseObjectType=function(e){var t,r,n,a=this.startNode();for(a.callProperties=[],a.properties=[],a.indexers=[],this.expect(i.types.braceL);!this.match(i.types.braceR);){var s=!1,o=this.state.start,u=this.state.startLoc;t=this.startNode(),e&&this.isContextual("static")&&(this.next(),n=!0),this.match(i.types.bracketL)?a.indexers.push(this.flowParseObjectTypeIndexer(t,n)):this.match(i.types.parenL)||this.isRelational("<")?a.callProperties.push(this.flowParseObjectTypeCallProperty(t,e)):(r=n&&this.match(i.types.colon)?this.parseIdent():this.flowParseObjectPropertyKey(),this.isRelational("<")||this.match(i.types.parenL)?a.properties.push(this.flowParseObjectTypeMethod(o,u,n,r)):(this.eat(i.types.question)&&(s=!0),t.key=r,t.value=this.flowParseTypeInitialiser(),t.optional=s,t["static"]=n,this.flowObjectTypeSemicolon(),a.properties.push(this.finishNode(t,"ObjectTypeProperty"))))}return this.expect(i.types.braceR),this.finishNode(a,"ObjectTypeAnnotation")},o.flowObjectTypeSemicolon=function(){this.eat(i.types.semi)||this.eat(i.types.comma)||this.match(i.types.braceR)||this.unexpected()},o.flowParseGenericType=function(e,t,r){var n=this.startNodeAt(e,t);for(n.typeParameters=null,n.id=r;this.eat(i.types.dot);){var a=this.startNodeAt(e,t);a.qualification=n.id,a.id=this.parseIdent(),n.id=this.finishNode(a,"QualifiedTypeIdentifier")}return this.isRelational("<")&&(n.typeParameters=this.flowParseTypeParameterInstantiation()),this.finishNode(n,"GenericTypeAnnotation")},o.flowParseTypeofType=function(){var e=this.startNode();return this.expect(i.types._typeof),e.argument=this.flowParsePrimaryType(),this.finishNode(e,"TypeofTypeAnnotation")},o.flowParseTupleType=function(){var e=this.startNode();for(e.types=[],this.expect(i.types.bracketL);this.state.pos<this.input.length&&!this.match(i.types.bracketR)&&(e.types.push(this.flowParseType()),!this.match(i.types.bracketR));)this.expect(i.types.comma);return this.expect(i.types.bracketR),this.finishNode(e,"TupleTypeAnnotation")},o.flowParseFunctionTypeParam=function(){var e=!1,t=this.startNode();return t.name=this.parseIdent(),this.eat(i.types.question)&&(e=!0),t.optional=e,t.typeAnnotation=this.flowParseTypeInitialiser(),this.finishNode(t,"FunctionTypeParam")},o.flowParseFunctionTypeParams=function(){for(var e={params:[],rest:null};this.match(i.types.name);)e.params.push(this.flowParseFunctionTypeParam()),this.match(i.types.parenR)||this.expect(i.types.comma);return this.eat(i.types.ellipsis)&&(e.rest=this.flowParseFunctionTypeParam()),e},o.flowIdentToTypeAnnotation=function(e,t,r,n){switch(n.name){case"any":return this.finishNode(r,"AnyTypeAnnotation");case"void":return this.finishNode(r,"VoidTypeAnnotation");case"bool":case"boolean":return this.finishNode(r,"BooleanTypeAnnotation");case"mixed":return this.finishNode(r,"MixedTypeAnnotation");case"number":return this.finishNode(r,"NumberTypeAnnotation");case"string":return this.finishNode(r,"StringTypeAnnotation");default:return this.flowParseGenericType(e,t,n)}},o.flowParsePrimaryType=function(){var e,t,r=this.state.start,n=this.state.startLoc,a=this.startNode(),s=!1;switch(this.state.type){case i.types.name:return this.flowIdentToTypeAnnotation(r,n,a,this.parseIdent());case i.types.braceL:return this.flowParseObjectType();case i.types.bracketL:return this.flowParseTupleType();case i.types.relational:if("<"===this.state.value)return a.typeParameters=this.flowParseTypeParameterDeclaration(),this.expect(i.types.parenL),e=this.flowParseFunctionTypeParams(),a.params=e.params,a.rest=e.rest,this.expect(i.types.parenR),this.expect(i.types.arrow),a.returnType=this.flowParseType(),this.finishNode(a,"FunctionTypeAnnotation");case i.types.parenL:if(this.next(),!this.match(i.types.parenR)&&!this.match(i.types.ellipsis))if(this.match(i.types.name)){var o=this.lookahead().type;s=o!==i.types.question&&o!==i.types.colon}else s=!0;return s?(t=this.flowParseType(),this.expect(i.types.parenR),this.eat(i.types.arrow)&&this.raise(a,"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"),t):(e=this.flowParseFunctionTypeParams(),a.params=e.params,a.rest=e.rest,this.expect(i.types.parenR),this.expect(i.types.arrow),a.returnType=this.flowParseType(),a.typeParameters=null,this.finishNode(a,"FunctionTypeAnnotation"));case i.types.string:return a.rawValue=a.value=this.state.value,a.raw=this.input.slice(this.state.start,this.state.end),this.next(),this.finishNode(a,"StringLiteralTypeAnnotation");case i.types._true:case i.types._false:return a.value=this.match(i.types._true),this.next(),this.finishNode(a,"BooleanLiteralTypeAnnotation");case i.types.num:return a.rawValue=a.value=this.state.value,a.raw=this.input.slice(this.state.start,this.state.end),this.next(),this.finishNode(a,"NumberLiteralTypeAnnotation");case i.types._null:return a.value=this.match(i.types._null),this.next(),this.finishNode(a,"NullLiteralTypeAnnotation");case i.types._this:return a.value=this.match(i.types._this),this.next(),this.finishNode(a,"ThisTypeAnnotation");default:if("typeof"===this.state.type.keyword)return this.flowParseTypeofType()}this.unexpected()},o.flowParsePostfixType=function(){var e=this.startNode(),t=e.elementType=this.flowParsePrimaryType();return this.match(i.types.bracketL)?(this.expect(i.types.bracketL),this.expect(i.types.bracketR),this.finishNode(e,"ArrayTypeAnnotation")):t},o.flowParsePrefixType=function(){var e=this.startNode();return this.eat(i.types.question)?(e.typeAnnotation=this.flowParsePrefixType(),this.finishNode(e,"NullableTypeAnnotation")):this.flowParsePostfixType()},o.flowParseIntersectionType=function(){var e=this.startNode(),t=this.flowParsePrefixType();for(e.types=[t];this.eat(i.types.bitwiseAND);)e.types.push(this.flowParsePrefixType());return 1===e.types.length?t:this.finishNode(e,"IntersectionTypeAnnotation")},o.flowParseUnionType=function(){var e=this.startNode(),t=this.flowParseIntersectionType();for(e.types=[t];this.eat(i.types.bitwiseOR);)e.types.push(this.flowParseIntersectionType());return 1===e.types.length?t:this.finishNode(e,"UnionTypeAnnotation")},o.flowParseType=function(){var e=this.state.inType;this.state.inType=!0;var t=this.flowParseUnionType();return this.state.inType=e,t},o.flowParseTypeAnnotation=function(){var e=this.startNode();return e.typeAnnotation=this.flowParseTypeInitialiser(),this.finishNode(e,"TypeAnnotation")},o.flowParseTypeAnnotatableIdentifier=function(e,t){var r=this.parseIdent(),n=!1;return t&&this.eat(i.types.question)&&(this.expect(i.types.question),n=!0),(e||this.match(i.types.colon))&&(r.typeAnnotation=this.flowParseTypeAnnotation(),this.finishNode(r,r.type)),n&&(r.optional=!0,this.finishNode(r,r.type)),r},r["default"]=function(e){function t(e){return e.expression.typeAnnotation=e.typeAnnotation,e.expression}e.extend("parseFunctionBody",function(e){return function(t,r){return this.match(i.types.colon)&&!r&&(t.returnType=this.flowParseTypeAnnotation()),e.call(this,t,r)}}),e.extend("parseStatement",function(e){return function(t,r){if(this.strict&&this.match(i.types.name)&&"interface"===this.state.value){var n=this.startNode();return this.next(),this.flowParseInterface(n)}return e.call(this,t,r)}}),e.extend("parseExpressionStatement",function(e){return function(t,r){if("Identifier"===r.type)if("declare"===r.name){if(this.match(i.types._class)||this.match(i.types.name)||this.match(i.types._function)||this.match(i.types._var))return this.flowParseDeclare(t)}else if(this.match(i.types.name)){if("interface"===r.name)return this.flowParseInterface(t);if("type"===r.name)return this.flowParseTypeAlias(t)}return e.call(this,t,r)}}),e.extend("shouldParseExportDeclaration",function(e){return function(){return this.isContextual("type")||this.isContextual("interface")||e.call(this)}}),e.extend("parseParenItem",function(){return function(e,t,r,n){if(this.match(i.types.colon)){var a=this.startNodeAt(t,r);if(a.expression=e,a.typeAnnotation=this.flowParseTypeAnnotation(),n&&!this.match(i.types.arrow)&&this.unexpected(),this.eat(i.types.arrow)){var s=this.parseArrowExpression(this.startNodeAt(t,r),[e]);return s.returnType=a.typeAnnotation,s}return this.finishNode(a,"TypeCastExpression")}return e}}),e.extend("parseExport",function(e){return function(t){return t=e.call(this,t),"ExportNamedDeclaration"===t.type&&(t.exportKind=t.exportKind||"value"),t}}),e.extend("parseExportDeclaration",function(e){return function(t){if(this.isContextual("type")){t.exportKind="type";var r=this.startNode();return this.next(),this.match(i.types.braceL)?(t.specifiers=this.parseExportSpecifiers(),this.parseExportFrom(t),null):this.flowParseTypeAlias(r)}if(this.isContextual("interface")){t.exportKind="type";var n=this.startNode();return this.next(),this.flowParseInterface(n)}return e.call(this,t)}}),e.extend("parseClassId",function(e){return function(t,r){e.call(this,t,r),this.isRelational("<")&&(t.typeParameters=this.flowParseTypeParameterDeclaration())}}),e.extend("isKeyword",function(e){return function(t){return this.state.inType&&"void"===t?!1:e.call(this,t)}}),e.extend("readToken",function(e){return function(t){return!this.state.inType||62!==t&&60!==t?e.call(this,t):this.finishOp(i.types.relational,1)}}),e.extend("jsx_readToken",function(e){return function(){return this.state.inType?void 0:e.call(this)}}),e.extend("toAssignableList",function(e){return function(r,n){for(var i=0;i<r.length;i++){var a=r[i];a&&"TypeCastExpression"===a.type&&(r[i]=t(a))}return e.call(this,r,n)}}),e.extend("toReferencedList",function(){return function(e){for(var t=0;t<e.length;t++){var r=e[t];r&&r._exprListItem&&"TypeCastExpression"===r.type&&this.raise(r.start,"Unexpected type cast")}return e}}),e.extend("parseExprListItem",function(e){return function(t,r){var n=this.startNode(),a=e.call(this,t,r);return this.match(i.types.colon)?(n._exprListItem=!0,n.expression=a,n.typeAnnotation=this.flowParseTypeAnnotation(),this.finishNode(n,"TypeCastExpression")):a}}),e.extend("parseClassProperty",function(e){return function(t){return this.match(i.types.colon)&&(t.typeAnnotation=this.flowParseTypeAnnotation()),e.call(this,t)}}),e.extend("isClassProperty",function(e){return function(){return this.match(i.types.colon)||e.call(this)}}),e.extend("parseClassMethod",function(){return function(e,t,r,n){var i;this.isRelational("<")&&(i=this.flowParseTypeParameterDeclaration()),t.value=this.parseMethod(r,n),t.value.typeParameters=i,e.body.push(this.finishNode(t,"MethodDefinition"))}}),e.extend("parseClassSuper",function(e){return function(t,r){if(e.call(this,t,r),t.superClass&&this.isRelational("<")&&(t.superTypeParameters=this.flowParseTypeParameterInstantiation()),this.isContextual("implements")){this.next();var n=t["implements"]=[];do{var a=this.startNode();a.id=this.parseIdent(),this.isRelational("<")?a.typeParameters=this.flowParseTypeParameterInstantiation():a.typeParameters=null,n.push(this.finishNode(a,"ClassImplements"))}while(this.eat(i.types.comma))}}}),e.extend("parseObjPropValue",function(e){return function(t){var r;this.isRelational("<")&&(r=this.flowParseTypeParameterDeclaration(),this.match(i.types.parenL)||this.unexpected()),e.apply(this,arguments),r&&(t.value.typeParameters=r)}}),e.extend("parseAssignableListItemTypes",function(){return function(e){return this.eat(i.types.question)&&(e.optional=!0),this.match(i.types.colon)&&(e.typeAnnotation=this.flowParseTypeAnnotation()),this.finishNode(e,e.type),e}}),e.extend("parseImportSpecifiers",function(e){return function(t){t.importKind="value";var r=this.match(i.types._typeof)?"typeof":this.isContextual("type")?"type":null;if(r){var n=this.lookahead();(n.type===i.types.name&&"from"!==n.value||n.type===i.types.braceL||n.type===i.types.star)&&(this.next(),t.importKind=r)}e.call(this,t)}}),e.extend("parseFunctionParams",function(e){return function(t){this.isRelational("<")&&(t.typeParameters=this.flowParseTypeParameterDeclaration()),e.call(this,t)}}),e.extend("parseVarHead",function(e){return function(t){e.call(this,t),this.match(i.types.colon)&&(t.id.typeAnnotation=this.flowParseTypeAnnotation(),this.finishNode(t.id,t.id.type))}}),e.extend("parseAsyncArrowFromCallExpression",function(e){return function(t,r){return this.match(i.types.colon)&&(t.returnType=this.flowParseTypeAnnotation()),e.call(this,t,r)}}),e.extend("parseParenAndDistinguishExpression",function(e){return function(t,r,n,a){if(t=t||this.state.start,r=r||this.state.startLoc,this.lookahead().type===i.types.parenR){this.expect(i.types.parenL),this.expect(i.types.parenR);var s=this.startNodeAt(t,r);return this.match(i.types.colon)&&(s.returnType=this.flowParseTypeAnnotation()),this.expect(i.types.arrow),this.parseArrowExpression(s,[],a)}var s=e.call(this,t,r,n,a);if(!this.match(i.types.colon))return s;var o=this.state.clone();try{return this.parseParenItem(s,t,r,!0)}catch(u){if(u instanceof SyntaxError)return this.state=o,s;throw u}}})},t.exports=r["default"]},{617:617,629:629}],624:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e){return"JSXIdentifier"===e.type?e.name:"JSXNamespacedName"===e.type?e.namespace.name+":"+e.name.name:"JSXMemberExpression"===e.type?i(e.object)+"."+i(e.property):void 0}r.__esModule=!0;var a=e(625),s=n(a),o=e(629),u=e(626),p=e(617),l=n(p),c=e(630),f=e(632),d=/^[\da-fA-F]+$/,h=/^\d+$/;u.types.j_oTag=new u.TokContext("<tag",!1),u.types.j_cTag=new u.TokContext("</tag",!1),u.types.j_expr=new u.TokContext("<tag>...</tag>",!0,!0),o.types.jsxName=new o.TokenType("jsxName"),o.types.jsxText=new o.TokenType("jsxText",{beforeExpr:!0}),o.types.jsxTagStart=new o.TokenType("jsxTagStart"),o.types.jsxTagEnd=new o.TokenType("jsxTagEnd"),o.types.jsxTagStart.updateContext=function(){this.state.context.push(u.types.j_expr),this.state.context.push(u.types.j_oTag),this.state.exprAllowed=!1},o.types.jsxTagEnd.updateContext=function(e){var t=this.state.context.pop();t===u.types.j_oTag&&e===o.types.slash||t===u.types.j_cTag?(this.state.context.pop(),this.state.exprAllowed=this.curContext()===u.types.j_expr):this.state.exprAllowed=!0};var m=l["default"].prototype;m.jsxReadToken=function(){for(var e="",t=this.state.pos;;){this.state.pos>=this.input.length&&this.raise(this.state.start,"Unterminated JSX contents");var r=this.input.charCodeAt(this.state.pos);switch(r){case 60:case 123:return this.state.pos===this.state.start?60===r&&this.state.exprAllowed?(++this.state.pos,this.finishToken(o.types.jsxTagStart)):this.getTokenFromCode(r):(e+=this.input.slice(t,this.state.pos),this.finishToken(o.types.jsxText,e));case 38:e+=this.input.slice(t,this.state.pos),e+=this.jsxReadEntity(),t=this.state.pos;break;default:f.isNewLine(r)?(e+=this.input.slice(t,this.state.pos),e+=this.jsxReadNewLine(!0),t=this.state.pos):++this.state.pos}}},m.jsxReadNewLine=function(e){var t,r=this.input.charCodeAt(this.state.pos);return++this.state.pos,13===r&&10===this.input.charCodeAt(this.state.pos)?(++this.state.pos,t=e?"\n":"\r\n"):t=String.fromCharCode(r),++this.state.curLine,this.state.lineStart=this.state.pos,t},m.jsxReadString=function(e){for(var t="",r=++this.state.pos;;){this.state.pos>=this.input.length&&this.raise(this.state.start,"Unterminated string constant");var n=this.input.charCodeAt(this.state.pos);if(n===e)break;38===n?(t+=this.input.slice(r,this.state.pos),t+=this.jsxReadEntity(),r=this.state.pos):f.isNewLine(n)?(t+=this.input.slice(r,this.state.pos),t+=this.jsxReadNewLine(!1),r=this.state.pos):++this.state.pos}return t+=this.input.slice(r,this.state.pos++),this.finishToken(o.types.string,t)},m.jsxReadEntity=function(){for(var e,t="",r=0,n=this.input[this.state.pos],i=++this.state.pos;this.state.pos<this.input.length&&r++<10;){if(n=this.input[this.state.pos++],";"===n){"#"===t[0]?"x"===t[1]?(t=t.substr(2),d.test(t)&&(e=String.fromCharCode(parseInt(t,16)))):(t=t.substr(1),h.test(t)&&(e=String.fromCharCode(parseInt(t,10)))):e=s["default"][t];break}t+=n}return e?e:(this.state.pos=i,"&")},m.jsxReadWord=function(){var e,t=this.state.pos;do e=this.input.charCodeAt(++this.state.pos);while(c.isIdentifierChar(e)||45===e);return this.finishToken(o.types.jsxName,this.input.slice(t,this.state.pos))},m.jsxParseIdentifier=function(){var e=this.startNode();return this.match(o.types.jsxName)?e.name=this.state.value:this.state.type.keyword?e.name=this.state.type.keyword:this.unexpected(),this.next(),this.finishNode(e,"JSXIdentifier")},m.jsxParseNamespacedName=function(){var e=this.state.start,t=this.state.startLoc,r=this.jsxParseIdentifier();if(!this.eat(o.types.colon))return r;var n=this.startNodeAt(e,t);return n.namespace=r,n.name=this.jsxParseIdentifier(),this.finishNode(n,"JSXNamespacedName")},m.jsxParseElementName=function(){for(var e=this.state.start,t=this.state.startLoc,r=this.jsxParseNamespacedName();this.eat(o.types.dot);){var n=this.startNodeAt(e,t);n.object=r,n.property=this.jsxParseIdentifier(),r=this.finishNode(n,"JSXMemberExpression")}return r},m.jsxParseAttributeValue=function(){var e;switch(this.state.type){case o.types.braceL:if(e=this.jsxParseExpressionContainer(),"JSXEmptyExpression"!==e.expression.type)return e;this.raise(e.start,"JSX attributes must only be assigned a non-empty expression");case o.types.jsxTagStart:case o.types.string:return e=this.parseExprAtom(),e.rawValue=null,e;default:this.raise(this.state.start,"JSX value should be either an expression or a quoted JSX text")}},m.jsxParseEmptyExpression=function(){var e=this.state.start;return this.state.start=this.state.lastTokEnd,this.state.lastTokEnd=e,e=this.state.startLoc,this.state.startLoc=this.state.lastTokEndLoc,this.state.lastTokEndLoc=e,this.finishNode(this.startNode(),"JSXEmptyExpression")},m.jsxParseExpressionContainer=function(){var e=this.startNode();return this.next(),this.match(o.types.braceR)?e.expression=this.jsxParseEmptyExpression():e.expression=this.parseExpression(),this.expect(o.types.braceR),this.finishNode(e,"JSXExpressionContainer")},m.jsxParseAttribute=function(){var e=this.startNode();return this.eat(o.types.braceL)?(this.expect(o.types.ellipsis),e.argument=this.parseMaybeAssign(),this.expect(o.types.braceR),this.finishNode(e,"JSXSpreadAttribute")):(e.name=this.jsxParseNamespacedName(),e.value=this.eat(o.types.eq)?this.jsxParseAttributeValue():null,this.finishNode(e,"JSXAttribute"))},m.jsxParseOpeningElementAt=function(e,t){var r=this.startNodeAt(e,t);for(r.attributes=[],r.name=this.jsxParseElementName();!this.match(o.types.slash)&&!this.match(o.types.jsxTagEnd);)r.attributes.push(this.jsxParseAttribute());return r.selfClosing=this.eat(o.types.slash),this.expect(o.types.jsxTagEnd),this.finishNode(r,"JSXOpeningElement")},m.jsxParseClosingElementAt=function(e,t){var r=this.startNodeAt(e,t);return r.name=this.jsxParseElementName(),this.expect(o.types.jsxTagEnd),this.finishNode(r,"JSXClosingElement")},m.jsxParseElementAt=function(e,t){var r=this.startNodeAt(e,t),n=[],a=this.jsxParseOpeningElementAt(e,t),s=null;if(!a.selfClosing){e:for(;;)switch(this.state.type){case o.types.jsxTagStart:if(e=this.state.start,t=this.state.startLoc,this.next(),this.eat(o.types.slash)){s=this.jsxParseClosingElementAt(e,t);break e}n.push(this.jsxParseElementAt(e,t));break;case o.types.jsxText:n.push(this.parseExprAtom());break;case o.types.braceL:n.push(this.jsxParseExpressionContainer());break;default:this.unexpected()}i(s.name)!==i(a.name)&&this.raise(s.start,"Expected corresponding JSX closing tag for <"+i(a.name)+">")}return r.openingElement=a,r.closingElement=s,r.children=n,this.match(o.types.relational)&&"<"===this.state.value&&this.raise(this.state.start,"Adjacent JSX elements must be wrapped in an enclosing tag"),this.finishNode(r,"JSXElement")},m.jsxParseElement=function(){var e=this.state.start,t=this.state.startLoc;return this.next(),this.jsxParseElementAt(e,t)},r["default"]=function(e){e.extend("parseExprAtom",function(e){return function(t){if(this.match(o.types.jsxText)){var r=this.parseLiteral(this.state.value);return r.rawValue=null,r}return this.match(o.types.jsxTagStart)?this.jsxParseElement():e.call(this,t)}}),e.extend("readToken",function(e){return function(t){var r=this.curContext();if(r===u.types.j_expr)return this.jsxReadToken();if(r===u.types.j_oTag||r===u.types.j_cTag){if(c.isIdentifierStart(t))return this.jsxReadWord();if(62===t)return++this.state.pos,this.finishToken(o.types.jsxTagEnd);if((34===t||39===t)&&r===u.types.j_oTag)return this.jsxReadString(t)}return 60===t&&this.state.exprAllowed?(++this.state.pos,this.finishToken(o.types.jsxTagStart)):e.call(this,t)}}),e.extend("updateContext",function(e){return function(t){if(this.match(o.types.braceL)){var r=this.curContext();r===u.types.j_oTag?this.state.context.push(u.types.b_expr):r===u.types.j_expr?this.state.context.push(u.types.b_tmpl):e.call(this,t),this.state.exprAllowed=!0}else{if(!this.match(o.types.slash)||t!==o.types.jsxTagStart)return e.call(this,t);this.state.context.length-=2,this.state.context.push(u.types.j_cTag),this.state.exprAllowed=!1}}})},t.exports=r["default"]},{617:617,625:625,626:626,629:629,630:630,632:632}],625:[function(e,t,r){"use strict";r.__esModule=!0,r["default"]={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:"♦"},t.exports=r["default"]},{}],626:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var i=e(629),a=function o(e,t,r,i){n(this,o),this.token=e,this.isExpr=!!t,this.preserveSpace=!!r,this.override=i};r.TokContext=a;var s={b_stat:new a("{",!1),b_expr:new a("{",!0),b_tmpl:new a("${",!0),p_stat:new a("(",!1),p_expr:new a("(",!0),q_tmpl:new a("`",!0,!0,function(e){return e.readTmplToken()}),f_expr:new a("function",!0)};r.types=s,i.types.parenR.updateContext=i.types.braceR.updateContext=function(){if(1===this.state.context.length)return void(this.state.exprAllowed=!0);var e=this.state.context.pop();e===s.b_stat&&this.curContext()===s.f_expr?(this.state.context.pop(),this.state.exprAllowed=!1):e===s.b_tmpl?this.state.exprAllowed=!0:this.state.exprAllowed=!e.isExpr},i.types.braceL.updateContext=function(e){this.state.context.push(this.braceIsBlock(e)?s.b_stat:s.b_expr),this.state.exprAllowed=!0},i.types.dollarBraceL.updateContext=function(){this.state.context.push(s.b_tmpl),this.state.exprAllowed=!0},i.types.parenL.updateContext=function(e){var t=e===i.types._if||e===i.types._for||e===i.types._with||e===i.types._while;this.state.context.push(t?s.p_stat:s.p_expr),this.state.exprAllowed=!0},i.types.incDec.updateContext=function(){},i.types._function.updateContext=function(){this.curContext()!==s.b_stat&&this.state.context.push(s.f_expr),this.state.exprAllowed=!1},i.types.backQuote.updateContext=function(){this.curContext()===s.q_tmpl?this.state.context.pop():this.state.context.push(s.q_tmpl),this.state.exprAllowed=!1}},{629:629}],627:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t,r){try{return new RegExp(e,t)}catch(n){void 0!==r&&(n instanceof SyntaxError&&this.raise(r,"Error parsing regular expression: "+n.message),this.raise(n))}}function s(e){return 65535>=e?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}r.__esModule=!0;var o=e(630),u=e(629),p=e(626),l=e(631),c=e(632),f=e(628),d=n(f),h=function v(e){i(this,v),this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,this.loc=new l.SourceLocation(e.startLoc,e.endLoc)};r.Token=h;var m="object"==typeof Packages&&"[object JavaPackage]"===Object.prototype.toString.call(Packages),y=!!a("","u"),g=function(){function e(t){i(this,e),this.state=new d["default"],this.state.init(t)}return e.prototype.next=function(){this.state.tokens.push(new h(this.state)),this.state.lastTokEnd=this.state.end,this.state.lastTokStart=this.state.start,this.state.lastTokEndLoc=this.state.endLoc,this.state.lastTokStartLoc=this.state.startLoc,this.nextToken()},e.prototype.eat=function(e){return this.match(e)?(this.next(),!0):!1},e.prototype.match=function(e){return this.state.type===e},e.prototype.lookahead=function(){var e=this.state;this.state=e.clone(),this.next();var t=this.state.clone();return this.state=e,t},e.prototype.setStrict=function(e){if(this.strict=e,this.match(u.types.num)||this.match(u.types.string)){for(this.state.pos=this.state.start;this.state.pos<this.state.lineStart;)this.state.lineStart=this.input.lastIndexOf("\n",this.state.lineStart-2)+1,--this.state.curLine;this.nextToken()}},e.prototype.curContext=function(){return this.state.context[this.state.context.length-1]},e.prototype.nextToken=function(){var e=this.curContext();return e&&e.preserveSpace||this.skipSpace(),this.state.start=this.state.pos,this.state.startLoc=this.state.curPosition(),this.state.pos>=this.input.length?this.finishToken(u.types.eof):e.override?e.override(this):this.readToken(this.fullCharCodeAtPos())},e.prototype.readToken=function(e){return o.isIdentifierStart(e,!0)||92===e?this.readWord():this.getTokenFromCode(e)},e.prototype.fullCharCodeAtPos=function(){var e=this.input.charCodeAt(this.state.pos);if(55295>=e||e>=57344)return e;var t=this.input.charCodeAt(this.state.pos+1);return(e<<10)+t-56613888},e.prototype.pushComment=function(e,t,r,n,i,a){var s={type:e?"CommentBlock":"CommentLine",value:t,start:r,end:n,loc:new l.SourceLocation(i,a),range:[r,n]};this.state.tokens.push(s),this.state.comments.push(s),this.addComment(s)},e.prototype.skipBlockComment=function(){var e=this.state.curPosition(),t=this.state.pos,r=this.input.indexOf("*/",this.state.pos+=2);-1===r&&this.raise(this.state.pos-2,"Unterminated comment"),this.state.pos=r+2,c.lineBreakG.lastIndex=t;for(var n=void 0;(n=c.lineBreakG.exec(this.input))&&n.index<this.state.pos;)++this.state.curLine,this.state.lineStart=n.index+n[0].length;this.pushComment(!0,this.input.slice(t+2,r),t,this.state.pos,e,this.state.curPosition())},e.prototype.skipLineComment=function(e){for(var t=this.state.pos,r=this.state.curPosition(),n=this.input.charCodeAt(this.state.pos+=e);this.state.pos<this.input.length&&10!==n&&13!==n&&8232!==n&&8233!==n;)++this.state.pos,n=this.input.charCodeAt(this.state.pos);this.pushComment(!1,this.input.slice(t+e,this.state.pos),t,this.state.pos,r,this.state.curPosition())},e.prototype.skipSpace=function(){e:for(;this.state.pos<this.input.length;){var e=this.input.charCodeAt(this.state.pos);switch(e){case 32:case 160:++this.state.pos;break;case 13:10===this.input.charCodeAt(this.state.pos+1)&&++this.state.pos;case 10:case 8232:case 8233:++this.state.pos,++this.state.curLine,this.state.lineStart=this.state.pos;break;case 47:switch(this.input.charCodeAt(this.state.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break e}break;default:if(!(e>8&&14>e||e>=5760&&c.nonASCIIwhitespace.test(String.fromCharCode(e))))break e;++this.state.pos}}},e.prototype.finishToken=function(e,t){this.state.end=this.state.pos,this.state.endLoc=this.state.curPosition();var r=this.state.type;this.state.type=e,this.state.value=t,this.updateContext(r)},e.prototype.readToken_dot=function(){var e=this.input.charCodeAt(this.state.pos+1);if(e>=48&&57>=e)return this.readNumber(!0);var t=this.input.charCodeAt(this.state.pos+2);return 46===e&&46===t?(this.state.pos+=3,this.finishToken(u.types.ellipsis)):(++this.state.pos,this.finishToken(u.types.dot))},e.prototype.readToken_slash=function(){if(this.state.exprAllowed)return++this.state.pos,this.readRegexp();var e=this.input.charCodeAt(this.state.pos+1);return 61===e?this.finishOp(u.types.assign,2):this.finishOp(u.types.slash,1)},e.prototype.readToken_mult_modulo=function(e){var t=42===e?u.types.star:u.types.modulo,r=1,n=this.input.charCodeAt(this.state.pos+1);return 42===n&&this.options.features["es7.exponentiationOperator"]&&(r++,n=this.input.charCodeAt(this.state.pos+2),t=u.types.exponent),61===n&&(r++,t=u.types.assign),this.finishOp(t,r)},e.prototype.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.state.pos+1);return t===e?this.finishOp(124===e?u.types.logicalOR:u.types.logicalAND,2):61===t?this.finishOp(u.types.assign,2):this.finishOp(124===e?u.types.bitwiseOR:u.types.bitwiseAND,1)},e.prototype.readToken_caret=function(){var e=this.input.charCodeAt(this.state.pos+1);return 61===e?this.finishOp(u.types.assign,2):this.finishOp(u.types.bitwiseXOR,1)},e.prototype.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.state.pos+1);return t===e?45===t&&62===this.input.charCodeAt(this.state.pos+2)&&c.lineBreak.test(this.input.slice(this.state.lastTokEnd,this.state.pos))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(u.types.incDec,2):61===t?this.finishOp(u.types.assign,2):this.finishOp(u.types.plusMin,1)},e.prototype.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.state.pos+1),r=1;return t===e?(r=62===e&&62===this.input.charCodeAt(this.state.pos+2)?3:2,61===this.input.charCodeAt(this.state.pos+r)?this.finishOp(u.types.assign,r+1):this.finishOp(u.types.bitShift,r)):33===t&&60===e&&45===this.input.charCodeAt(this.state.pos+2)&&45===this.input.charCodeAt(this.state.pos+3)?(this.inModule&&this.unexpected(),this.skipLineComment(4),this.skipSpace(),this.nextToken()):(61===t&&(r=61===this.input.charCodeAt(this.state.pos+2)?3:2),this.finishOp(u.types.relational,r))},e.prototype.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.state.pos+1);return 61===t?this.finishOp(u.types.equality,61===this.input.charCodeAt(this.state.pos+2)?3:2):61===e&&62===t?(this.state.pos+=2,this.finishToken(u.types.arrow)):this.finishOp(61===e?u.types.eq:u.types.prefix,1)},e.prototype.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.state.pos,this.finishToken(u.types.parenL);case 41:return++this.state.pos,this.finishToken(u.types.parenR);case 59:return++this.state.pos,this.finishToken(u.types.semi);case 44:return++this.state.pos,this.finishToken(u.types.comma);case 91:return++this.state.pos,this.finishToken(u.types.bracketL);case 93:return++this.state.pos,this.finishToken(u.types.bracketR);case 123:return++this.state.pos,this.finishToken(u.types.braceL);case 125:return++this.state.pos,this.finishToken(u.types.braceR);case 58:return this.options.features["es7.functionBind"]&&58===this.input.charCodeAt(this.state.pos+1)?this.finishOp(u.types.doubleColon,2):(++this.state.pos,this.finishToken(u.types.colon));case 63:return++this.state.pos,this.finishToken(u.types.question);case 64:return++this.state.pos,this.finishToken(u.types.at);case 96:return++this.state.pos,this.finishToken(u.types.backQuote);case 48:var t=this.input.charCodeAt(this.state.pos+1);if(120===t||88===t)return this.readRadixNumber(16);if(111===t||79===t)return this.readRadixNumber(8);if(98===t||66===t)return this.readRadixNumber(2);case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 126:return this.finishOp(u.types.prefix,1)}this.raise(this.state.pos,"Unexpected character '"+s(e)+"'")},e.prototype.finishOp=function(e,t){var r=this.input.slice(this.state.pos,this.state.pos+t);return this.state.pos+=t,this.finishToken(e,r)},e.prototype.readRegexp=function(){for(var e=this,t=void 0,r=void 0,n=this.state.pos;;){this.state.pos>=this.input.length&&this.raise(n,"Unterminated regular expression");var i=this.input.charAt(this.state.pos);if(c.lineBreak.test(i)&&this.raise(n,"Unterminated regular expression"),t)t=!1;else{if("["===i)r=!0;else if("]"===i&&r)r=!1;else if("/"===i&&!r)break;t="\\"===i}++this.state.pos}var s=this.input.slice(n,this.state.pos);++this.state.pos;var o=this.readWord1(),p=s;if(o){var l=/^[gmsiyu]*$/;l.test(o)||this.raise(n,"Invalid regular expression flag"),o.indexOf("u")>=0&&!y&&(p=p.replace(/\\u\{([0-9a-fA-F]+)\}/g,function(t,r,i){return r=Number("0x"+r),r>1114111&&e.raise(n+i+3,"Code point out of bounds"),"x"}),p=p.replace(/\\u([a-fA-F0-9]{4})|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"))}var f=null;return m||(a.call(this,p,void 0,n),f=a.call(this,s,o)),this.finishToken(u.types.regexp,{pattern:s,flags:o,value:f})},e.prototype.readInt=function(e,t){for(var r=this.state.pos,n=0,i=0,a=null==t?1/0:t;a>i;++i){var s=this.input.charCodeAt(this.state.pos),o=void 0;if(o=s>=97?s-97+10:s>=65?s-65+10:s>=48&&57>=s?s-48:1/0,o>=e)break;++this.state.pos,n=n*e+o}return this.state.pos===r||null!=t&&this.state.pos-r!==t?null:n},e.prototype.readRadixNumber=function(e){this.state.pos+=2;var t=this.readInt(e);return null==t&&this.raise(this.state.start+2,"Expected number in radix "+e),o.isIdentifierStart(this.fullCharCodeAtPos())&&this.raise(this.state.pos,"Identifier directly after number"),this.finishToken(u.types.num,t)},e.prototype.readNumber=function(e){var t=this.state.pos,r=!1,n=48===this.input.charCodeAt(this.state.pos);e||null!==this.readInt(10)||this.raise(t,"Invalid number");var i=this.input.charCodeAt(this.state.pos);46===i&&(++this.state.pos,this.readInt(10),r=!0,i=this.input.charCodeAt(this.state.pos)),(69===i||101===i)&&(i=this.input.charCodeAt(++this.state.pos),(43===i||45===i)&&++this.state.pos,null===this.readInt(10)&&this.raise(t,"Invalid number"),r=!0),o.isIdentifierStart(this.fullCharCodeAtPos())&&this.raise(this.state.pos,"Identifier directly after number");var a=this.input.slice(t,this.state.pos),s=void 0;return r?s=parseFloat(a):n&&1!==a.length?/[89]/.test(a)||this.strict?this.raise(t,"Invalid number"):s=parseInt(a,8):s=parseInt(a,10),this.finishToken(u.types.num,s)},e.prototype.readCodePoint=function(){var e=this.input.charCodeAt(this.state.pos),t=void 0;if(123===e){var r=++this.state.pos;t=this.readHexChar(this.input.indexOf("}",this.state.pos)-this.state.pos),++this.state.pos,t>1114111&&this.raise(r,"Code point out of bounds")}else t=this.readHexChar(4);return t},e.prototype.readString=function(e){for(var t="",r=++this.state.pos;;){this.state.pos>=this.input.length&&this.raise(this.state.start,"Unterminated string constant");var n=this.input.charCodeAt(this.state.pos);if(n===e)break;92===n?(t+=this.input.slice(r,this.state.pos),t+=this.readEscapedChar(!1),r=this.state.pos):(c.isNewLine(n)&&this.raise(this.state.start,"Unterminated string constant"),++this.state.pos)}return t+=this.input.slice(r,this.state.pos++),this.finishToken(u.types.string,t)},e.prototype.readTmplToken=function(){for(var e="",t=this.state.pos;;){this.state.pos>=this.input.length&&this.raise(this.state.start,"Unterminated template");var r=this.input.charCodeAt(this.state.pos);if(96===r||36===r&&123===this.input.charCodeAt(this.state.pos+1))return this.state.pos===this.state.start&&this.match(u.types.template)?36===r?(this.state.pos+=2,this.finishToken(u.types.dollarBraceL)):(++this.state.pos,this.finishToken(u.types.backQuote)):(e+=this.input.slice(t,this.state.pos),this.finishToken(u.types.template,e));if(92===r)e+=this.input.slice(t,this.state.pos),e+=this.readEscapedChar(!0),t=this.state.pos;else if(c.isNewLine(r)){switch(e+=this.input.slice(t,this.state.pos),++this.state.pos,r){case 13:10===this.input.charCodeAt(this.state.pos)&&++this.state.pos;case 10:e+="\n";break;default:e+=String.fromCharCode(r)}++this.state.curLine,this.state.lineStart=this.state.pos,t=this.state.pos}else++this.state.pos}},e.prototype.readEscapedChar=function(e){var t=this.input.charCodeAt(++this.state.pos);switch(++this.state.pos,t){case 110:return"\n";case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return s(this.readCodePoint());case 116:return" ";case 98:return"\b";case 118:return"\x0B";case 102:return"\f";case 13:10===this.input.charCodeAt(this.state.pos)&&++this.state.pos;case 10:return this.state.lineStart=this.state.pos,++this.state.curLine,"";default:if(t>=48&&55>=t){var r=this.input.substr(this.state.pos-1,3).match(/^[0-7]+/)[0],n=parseInt(r,8);return n>255&&(r=r.slice(0,-1),n=parseInt(r,8)),n>0&&(this.strict||e)&&this.raise(this.state.pos-2,"Octal literal in strict mode"),this.state.pos+=r.length-1,String.fromCharCode(n)}return String.fromCharCode(t)}},e.prototype.readHexChar=function(e){var t=this.state.pos,r=this.readInt(16,e);return null===r&&this.raise(t,"Bad character escape sequence"),r},e.prototype.readWord1=function(){this.state.containsEsc=!1;for(var e="",t=!0,r=this.state.pos;this.state.pos<this.input.length;){var n=this.fullCharCodeAtPos();if(o.isIdentifierChar(n,!0))this.state.pos+=65535>=n?1:2;else{if(92!==n)break;this.state.containsEsc=!0,e+=this.input.slice(r,this.state.pos);var i=this.state.pos;117!==this.input.charCodeAt(++this.state.pos)&&this.raise(this.state.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.state.pos;var a=this.readCodePoint();(t?o.isIdentifierStart:o.isIdentifierChar)(a,!0)||this.raise(i,"Invalid Unicode escape"),e+=s(a),r=this.state.pos}t=!1}return e+this.input.slice(r,this.state.pos)},e.prototype.readWord=function(){var e=this.readWord1(),t=u.types.name;return!this.state.containsEsc&&this.isKeyword(e)&&(t=u.keywords[e]),this.finishToken(t,e)},e.prototype.braceIsBlock=function(e){if(e===u.types.colon){var t=this.curContext();if(t===p.types.b_stat||t===p.types.b_expr)return!t.isExpr}return e===u.types._return?c.lineBreak.test(this.input.slice(this.state.lastTokEnd,this.state.start)):e===u.types._else||e===u.types.semi||e===u.types.eof||e===u.types.parenR?!0:e===u.types.braceL?this.curContext()===p.types.b_stat:!this.state.exprAllowed},e.prototype.updateContext=function(e){var t=void 0,r=this.state.type;r.keyword&&e===u.types.dot?this.state.exprAllowed=!1:(t=r.updateContext)?t.call(this,e):this.state.exprAllowed=r.beforeExpr},e}();r["default"]=g},{626:626,628:628,629:629,630:630,631:631,632:632}],628:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var i=e(631),a=e(626),s=e(629),o=function(){function e(){n(this,e)}return e.prototype.init=function(e){return this.input=e,this.potentialArrowAt=-1,this.inFunction=this.inGenerator=!1,this.labels=[],this.decorators=[],this.tokens=[],this.comments=[],this.trailingComments=[],this.leadingComments=[],this.commentStack=[],this.pos=this.lineStart=0,this.curLine=1,this.type=s.types.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=[a.types.b_stat],this.exprAllowed=!0,this.containsEsc=!1,this},e.prototype.curPosition=function(){return new i.Position(this.curLine,this.pos-this.lineStart)},e.prototype.clone=function(){var t=new e;for(var r in this){var n=this[r];Array.isArray(n)&&(n=n.slice()),t[r]=n}return t},e}();r["default"]=o,t.exports=r["default"]},{626:626,629:629,631:631}],629:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){return new s(e,{beforeExpr:!0,binop:t})}function a(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];t.keyword=e,l[e]=p["_"+e]=new s(e,t)}r.__esModule=!0;var s=function c(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];n(this,c),this.label=e,this.keyword=t.keyword,this.beforeExpr=!!t.beforeExpr,this.startsExpr=!!t.startsExpr,this.rightAssociative=!!t.rightAssociative,this.isLoop=!!t.isLoop,this.isAssign=!!t.isAssign,this.prefix=!!t.prefix,this.postfix=!!t.postfix,this.binop=t.binop||null,this.updateContext=null};r.TokenType=s;var o={beforeExpr:!0},u={startsExpr:!0},p={num:new s("num",u),regexp:new s("regexp",u),string:new s("string",u),name:new s("name",u),eof:new s("eof"),bracketL:new s("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new s("]"),braceL:new s("{",{beforeExpr:!0,startsExpr:!0}),braceR:new s("}"),parenL:new s("(",{beforeExpr:!0,startsExpr:!0}),parenR:new s(")"),comma:new s(",",o),semi:new s(";",o),colon:new s(":",o),doubleColon:new s("::",o),dot:new s("."),question:new s("?",o),arrow:new s("=>",o),template:new s("template"),ellipsis:new s("...",o),backQuote:new s("`",u),dollarBraceL:new s("${",{beforeExpr:!0,startsExpr:!0}),at:new s("@"),eq:new s("=",{beforeExpr:!0,isAssign:!0}),assign:new s("_=",{beforeExpr:!0,isAssign:!0}),incDec:new s("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new s("prefix",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:i("||",1),logicalAND:i("&&",2),bitwiseOR:i("|",3),bitwiseXOR:i("^",4),bitwiseAND:i("&",5),equality:i("==/!=",6),relational:i("</>",7),bitShift:i("<</>>",8),plusMin:new s("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:i("%",10),star:i("*",10),slash:i("/",10),exponent:new s("**",{beforeExpr:!0,binop:11,rightAssociative:!0})};r.types=p;var l={};r.keywords=l,a("break"),a("case",o),a("catch"),a("continue"),a("debugger"),a("default",o),a("do",{isLoop:!0}),a("else",o),a("finally"),a("for",{isLoop:!0}),a("function",u),a("if"),a("return",o),a("switch"),a("throw",o),a("try"),a("var"),a("let"),a("const"),a("while",{isLoop:!0}),a("with"),a("new",{beforeExpr:!0,startsExpr:!0}),a("this",u),a("super",u),a("class"),a("extends",o),a("export"),a("import"),a("yield",{beforeExpr:!0,startsExpr:!0}),a("null",u),a("true",u),a("false",u),a("in",{beforeExpr:!0,binop:7}),a("instanceof",{beforeExpr:!0,binop:7}),a("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),a("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),a("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},{}],630:[function(e,t,r){"use strict";function n(e){return e=e.split(" "),function(t){return e.indexOf(t)>=0}}function i(e,t){for(var r=65536,n=0;n<t.length;n+=2){if(r+=t[n],r>e)return!1;if(r+=t[n+1],r>=e)return!0}}function a(e){return 65>e?36===e:91>e?!0:97>e?95===e:123>e?!0:65535>=e?e>=170&&c.test(String.fromCharCode(e)):i(e,d)}function s(e){return 48>e?36===e:58>e?!0:65>e?!1:91>e?!0:97>e?95===e:123>e?!0:65535>=e?e>=170&&f.test(String.fromCharCode(e)):i(e,d)||i(e,h)}r.__esModule=!0,r.isIdentifierStart=a,r.isIdentifierChar=s;var o={6:n("enum await"),strict:n("implements interface let package private protected public static yield"),strictBind:n("eval arguments")};r.reservedWords=o;var u=n("break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this let const class extends export import yield super");r.isKeyword=u;var p="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠ-ࢲऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞭꞰꞱꟷ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭟꭤꭥꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",l="·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣤ-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఃా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഁ-ഃാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ංඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ູົຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏ᦰ-ᧀᧈᧉ᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭ᳲ-᳴᳸᳹᷀-᷵᷼-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧꢀꢁꢴ-꣄꣐-꣙꣠-꣱꤀-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︭︳︴﹍-﹏0-9_",c=new RegExp("["+p+"]"),f=new RegExp("["+p+l+"]");p=l=null;var d=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,17,26,6,37,11,29,3,35,5,7,2,4,43,157,99,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,98,21,11,25,71,55,7,1,65,0,16,3,2,2,2,26,45,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,955,52,76,44,33,24,27,35,42,34,4,0,13,47,15,3,22,0,38,17,2,24,133,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,32,4,287,47,21,1,2,0,185,46,82,47,21,0,60,42,502,63,32,0,449,56,1288,920,104,110,2962,1070,13266,568,8,30,114,29,19,47,17,3,32,20,6,18,881,68,12,0,67,12,16481,1,3071,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,4149,196,1340,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42710,42,4148,12,221,16355,541],h=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,1306,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,52,0,13,2,49,13,16,9,83,11,168,11,6,9,8,2,57,0,2,6,3,1,3,2,10,0,11,1,3,6,4,4,316,19,13,9,214,6,3,8,112,16,16,9,82,12,9,9,535,9,20855,9,135,4,60,6,26,9,1016,45,17,3,19723,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,4305,6,792618,239]},{}],631:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var r=1,n=0;;){a.lineBreakG.lastIndex=n;var i=a.lineBreakG.exec(e);if(!(i&&i.index<t))return new s(r,t-n);++r,n=i.index+i[0].length}}r.__esModule=!0,r.getLineInfo=i;var a=e(632),s=function u(e,t){n(this,u),this.line=e,this.column=t};r.Position=s;var o=function p(e,t){n(this,p),this.start=e,this.end=t};r.SourceLocation=o},{632:632}],632:[function(e,t,r){"use strict";function n(e){return 10===e||13===e||8232===e||8233===e}r.__esModule=!0,r.isNewLine=n;var i=/\r\n?|\n|\u2028|\u2029/;r.lineBreak=i;var a=new RegExp(i.source,"g");r.lineBreakG=a;var s=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;r.nonASCIIwhitespace=s},{}]},{},[14])(14)});
|
actor-apps/app-web/src/app/components/ActivitySection.react.js | webwlsong/actor-platform | import React from 'react';
import classNames from 'classnames';
import { ActivityTypes } from 'constants/ActorAppConstants';
//import ActivityActionCreators from 'actions/ActivityActionCreators';
import ActivityStore from 'stores/ActivityStore';
import UserProfile from 'components/activity/UserProfile.react';
import GroupProfile from 'components/activity/GroupProfile.react';
const getStateFromStores = () => {
return {
activity: ActivityStore.getActivity(),
isOpen: ActivityStore.isOpen()
};
};
class ActivitySection extends React.Component {
constructor(props) {
super(props);
this.state = getStateFromStores();
ActivityStore.addChangeListener(this.onChange);
}
componentWillUnmount() {
ActivityStore.removeChangeListener(this.onChange);
}
render() {
const activity = this.state.activity;
if (activity !== null) {
const activityClassName = classNames('activity', {
'activity--shown': this.state.isOpen
});
let activityBody;
switch (activity.type) {
case ActivityTypes.USER_PROFILE:
activityBody = <UserProfile user={activity.user}/>;
break;
case ActivityTypes.GROUP_PROFILE:
activityBody = <GroupProfile group={activity.group}/>;
break;
default:
}
return (
<section className={activityClassName}>
{activityBody}
</section>
);
} else {
return null;
}
}
onChange = () => {
this.setState(getStateFromStores());
};
}
export default ActivitySection;
|
packages/material-ui-icons/src/DirectionsRunSharp.js | kybarg/material-ui | import React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<path d="M13.49 5.48c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm-3.6 13.9l1-4.4 2.1 2v6h2v-7.5l-2.1-2 .6-3c1.3 1.5 3.3 2.5 5.5 2.5v-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.1l-5.2 2.2v4.7h2v-3.4l1.8-.7-1.6 8.1-4.9-1-.4 2 7 1.4z" />
, 'DirectionsRunSharp');
|
node_modules/core-js/library/modules/es6.promise.js | akh000/YoutubeApp | 'use strict';
var LIBRARY = require('./_library')
, global = require('./_global')
, ctx = require('./_ctx')
, classof = require('./_classof')
, $export = require('./_export')
, isObject = require('./_is-object')
, aFunction = require('./_a-function')
, anInstance = require('./_an-instance')
, forOf = require('./_for-of')
, speciesConstructor = require('./_species-constructor')
, task = require('./_task').set
, microtask = require('./_microtask')()
, PROMISE = 'Promise'
, TypeError = global.TypeError
, process = global.process
, $Promise = global[PROMISE]
, process = global.process
, isNode = classof(process) == 'process'
, empty = function(){ /* empty */ }
, Internal, GenericPromiseCapability, Wrapper;
var USE_NATIVE = !!function(){
try {
// correct subclassing with @@species support
var promise = $Promise.resolve(1)
, FakePromise = (promise.constructor = {})[require('./_wks')('species')] = function(exec){ exec(empty, empty); };
// unhandled rejections tracking support, NodeJS Promise without it fails @@species test
return (isNode || typeof PromiseRejectionEvent == 'function') && promise.then(empty) instanceof FakePromise;
} catch(e){ /* empty */ }
}();
// helpers
var sameConstructor = function(a, b){
// with library wrapper special case
return a === b || a === $Promise && b === Wrapper;
};
var isThenable = function(it){
var then;
return isObject(it) && typeof (then = it.then) == 'function' ? then : false;
};
var newPromiseCapability = function(C){
return sameConstructor($Promise, C)
? new PromiseCapability(C)
: new GenericPromiseCapability(C);
};
var PromiseCapability = GenericPromiseCapability = function(C){
var resolve, reject;
this.promise = new C(function($$resolve, $$reject){
if(resolve !== undefined || reject !== undefined)throw TypeError('Bad Promise constructor');
resolve = $$resolve;
reject = $$reject;
});
this.resolve = aFunction(resolve);
this.reject = aFunction(reject);
};
var perform = function(exec){
try {
exec();
} catch(e){
return {error: e};
}
};
var notify = function(promise, isReject){
if(promise._n)return;
promise._n = true;
var chain = promise._c;
microtask(function(){
var value = promise._v
, ok = promise._s == 1
, i = 0;
var run = function(reaction){
var handler = ok ? reaction.ok : reaction.fail
, resolve = reaction.resolve
, reject = reaction.reject
, domain = reaction.domain
, result, then;
try {
if(handler){
if(!ok){
if(promise._h == 2)onHandleUnhandled(promise);
promise._h = 1;
}
if(handler === true)result = value;
else {
if(domain)domain.enter();
result = handler(value);
if(domain)domain.exit();
}
if(result === reaction.promise){
reject(TypeError('Promise-chain cycle'));
} else if(then = isThenable(result)){
then.call(result, resolve, reject);
} else resolve(result);
} else reject(value);
} catch(e){
reject(e);
}
};
while(chain.length > i)run(chain[i++]); // variable length - can't use forEach
promise._c = [];
promise._n = false;
if(isReject && !promise._h)onUnhandled(promise);
});
};
var onUnhandled = function(promise){
task.call(global, function(){
var value = promise._v
, abrupt, handler, console;
if(isUnhandled(promise)){
abrupt = perform(function(){
if(isNode){
process.emit('unhandledRejection', value, promise);
} else if(handler = global.onunhandledrejection){
handler({promise: promise, reason: value});
} else if((console = global.console) && console.error){
console.error('Unhandled promise rejection', value);
}
});
// Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
promise._h = isNode || isUnhandled(promise) ? 2 : 1;
} promise._a = undefined;
if(abrupt)throw abrupt.error;
});
};
var isUnhandled = function(promise){
if(promise._h == 1)return false;
var chain = promise._a || promise._c
, i = 0
, reaction;
while(chain.length > i){
reaction = chain[i++];
if(reaction.fail || !isUnhandled(reaction.promise))return false;
} return true;
};
var onHandleUnhandled = function(promise){
task.call(global, function(){
var handler;
if(isNode){
process.emit('rejectionHandled', promise);
} else if(handler = global.onrejectionhandled){
handler({promise: promise, reason: promise._v});
}
});
};
var $reject = function(value){
var promise = this;
if(promise._d)return;
promise._d = true;
promise = promise._w || promise; // unwrap
promise._v = value;
promise._s = 2;
if(!promise._a)promise._a = promise._c.slice();
notify(promise, true);
};
var $resolve = function(value){
var promise = this
, then;
if(promise._d)return;
promise._d = true;
promise = promise._w || promise; // unwrap
try {
if(promise === value)throw TypeError("Promise can't be resolved itself");
if(then = isThenable(value)){
microtask(function(){
var wrapper = {_w: promise, _d: false}; // wrap
try {
then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1));
} catch(e){
$reject.call(wrapper, e);
}
});
} else {
promise._v = value;
promise._s = 1;
notify(promise, false);
}
} catch(e){
$reject.call({_w: promise, _d: false}, e); // wrap
}
};
// constructor polyfill
if(!USE_NATIVE){
// 25.4.3.1 Promise(executor)
$Promise = function Promise(executor){
anInstance(this, $Promise, PROMISE, '_h');
aFunction(executor);
Internal.call(this);
try {
executor(ctx($resolve, this, 1), ctx($reject, this, 1));
} catch(err){
$reject.call(this, err);
}
};
Internal = function Promise(executor){
this._c = []; // <- awaiting reactions
this._a = undefined; // <- checked in isUnhandled reactions
this._s = 0; // <- state
this._d = false; // <- done
this._v = undefined; // <- value
this._h = 0; // <- rejection state, 0 - default, 1 - handled, 2 - unhandled
this._n = false; // <- notify
};
Internal.prototype = require('./_redefine-all')($Promise.prototype, {
// 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected)
then: function then(onFulfilled, onRejected){
var reaction = newPromiseCapability(speciesConstructor(this, $Promise));
reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;
reaction.fail = typeof onRejected == 'function' && onRejected;
reaction.domain = isNode ? process.domain : undefined;
this._c.push(reaction);
if(this._a)this._a.push(reaction);
if(this._s)notify(this, false);
return reaction.promise;
},
// 25.4.5.1 Promise.prototype.catch(onRejected)
'catch': function(onRejected){
return this.then(undefined, onRejected);
}
});
PromiseCapability = function(){
var promise = new Internal;
this.promise = promise;
this.resolve = ctx($resolve, promise, 1);
this.reject = ctx($reject, promise, 1);
};
}
$export($export.G + $export.W + $export.F * !USE_NATIVE, {Promise: $Promise});
require('./_set-to-string-tag')($Promise, PROMISE);
require('./_set-species')(PROMISE);
Wrapper = require('./_core')[PROMISE];
// statics
$export($export.S + $export.F * !USE_NATIVE, PROMISE, {
// 25.4.4.5 Promise.reject(r)
reject: function reject(r){
var capability = newPromiseCapability(this)
, $$reject = capability.reject;
$$reject(r);
return capability.promise;
}
});
$export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, {
// 25.4.4.6 Promise.resolve(x)
resolve: function resolve(x){
// instanceof instead of internal slot check because we should fix it without replacement native Promise core
if(x instanceof $Promise && sameConstructor(x.constructor, this))return x;
var capability = newPromiseCapability(this)
, $$resolve = capability.resolve;
$$resolve(x);
return capability.promise;
}
});
$export($export.S + $export.F * !(USE_NATIVE && require('./_iter-detect')(function(iter){
$Promise.all(iter)['catch'](empty);
})), PROMISE, {
// 25.4.4.1 Promise.all(iterable)
all: function all(iterable){
var C = this
, capability = newPromiseCapability(C)
, resolve = capability.resolve
, reject = capability.reject;
var abrupt = perform(function(){
var values = []
, index = 0
, remaining = 1;
forOf(iterable, false, function(promise){
var $index = index++
, alreadyCalled = false;
values.push(undefined);
remaining++;
C.resolve(promise).then(function(value){
if(alreadyCalled)return;
alreadyCalled = true;
values[$index] = value;
--remaining || resolve(values);
}, reject);
});
--remaining || resolve(values);
});
if(abrupt)reject(abrupt.error);
return capability.promise;
},
// 25.4.4.4 Promise.race(iterable)
race: function race(iterable){
var C = this
, capability = newPromiseCapability(C)
, reject = capability.reject;
var abrupt = perform(function(){
forOf(iterable, false, function(promise){
C.resolve(promise).then(capability.resolve, reject);
});
});
if(abrupt)reject(abrupt.error);
return capability.promise;
}
}); |
js/jqwidgets/demos/react/app/tabs/collapsible/app.js | luissancheza/sice | import React from 'react';
import ReactDOM from 'react-dom';
import JqxTabs from '../../../jqwidgets-react/react_jqxtabs.js';
class App extends React.Component {
render () {
let tabsHTML = `
<ul>
<li style="margin-left: 30px;">Node.js</li>
<li>JavaServer Pages</li>
<li>Active Server Pages</li>
<li>Python</li>
<li>Perl</li>
</ul>
<div>
Node.js is an event-driven I/O server-side JavaScript environment based on V8. It
is intended for writing scalable network programs such as web servers. It was created
by Ryan Dahl in 2009, and its growth is sponsored by Joyent, which employs Dahl.
Similar environments written in other programming languages include Twisted for
Python, Perl Object Environment for Perl, libevent for C and EventMachine for Ruby.
Unlike most JavaScript, it is not executed in a web browser, but is instead a form
of server-side JavaScript. Node.js implements some CommonJS specifications. Node.js
includes a REPL environment for interactive testing.
</div>
<div>
JavaServer Pages (JSP) is a Java technology that helps software developers serve
dynamically generated web pages based on HTML, XML, or other document types. Released
in 1999 as Sun's answer to ASP and PHP,[citation needed] JSP was designed to address
the perception that the Java programming environment didn't provide developers with
enough support for the Web. To deploy and run, a compatible web server with servlet
container is required. The Java Servlet and the JavaServer Pages (JSP) specifications
from Sun Microsystems and the JCP (Java Community Process) must both be met by the
container.
</div>
<div>
ASP.NET is a web application framework developed and marketed by Microsoft to allow
programmers to build dynamic web sites, web applications and web services. It was
first released in January 2002 with version 1.0 of the .NET Framework, and is the
successor to Microsoft's Active Server Pages (ASP) technology. ASP.NET is built
on the Common Language Runtime (CLR), allowing programmers to write ASP.NET code
using any supported .NET language. The ASP.NET SOAP extension framework allows ASP.NET
components to process SOAP messages.
</div>
<div>
Python is a general-purpose, high-level programming language[5] whose design philosophy
emphasizes code readability. Python claims to "[combine] remarkable power with very
clear syntax",[7] and its standard library is large and comprehensive. Its use of
indentation for block delimiters is unique among popular programming languages.
Python supports multiple programming paradigms, primarily but not limited to object-oriented,
imperative and, to a lesser extent, functional programming styles. It features a
fully dynamic type system and automatic memory management, similar to that of Scheme,
Ruby, Perl, and Tcl. Like other dynamic languages, Python is often used as a scripting
language, but is also used in a wide range of non-scripting contexts.
</div>
<div>
Perl is a high-level, general-purpose, interpreted, dynamic programming language.
Perl was originally developed by Larry Wall in 1987 as a general-purpose Unix scripting
language to make report processing easier. Since then, it has undergone many changes
and revisions and become widely popular amongst programmers. Larry Wall continues
to oversee development of the core language, and its upcoming version, Perl 6. Perl
borrows features from other programming languages including C, shell scripting (sh),
AWK, and sed.[5] The language provides powerful text processing facilities without
the arbitrary data length limits of many contemporary Unix tools, facilitating easy
manipulation of text files.
</div>
`;
return (
<JqxTabs ref='myTabs' template={tabsHTML}
width={580} position={'top'} collapsible={true}
/>
)
}
}
ReactDOM.render(<App />, document.getElementById('app'));
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.